using System.Collections.Generic; using MoleMole.Config; using UnityEngine; using UnityEngine.UI; using proto; namespace MoleMole { public class RewardGotDialogContext : BaseDialogContext { public delegate void OnDialogDestroy(); private const string DROP_ITEM_PREFAB_PATH = "UI/Menus/Widget/Map/DropItemButton"; private OnDialogDestroy _onDestroy; private proto.RewardData _rewardData; private SequenceAnimationManager _animationManager; private string _titleTextID; private string _completeIconPrefabPath; private List _dropItemList; private List _nonItemRewardList; private Dictionary _rewardItemDict; private int _playerLevelBefore; public RewardGotDialogContext(proto.RewardData rewardData, int playerLevelBefore, List dropList = null, string titleTextID = "", string completeIconPrefabPath = "") { config = new ContextPattern { contextName = "RewardGotDialogContext", viewPrefabPath = "UI/Menus/Dialog/RewardGotDialog" }; _rewardData = rewardData; _dropItemList = dropList; _titleTextID = titleTextID; _completeIconPrefabPath = completeIconPrefabPath; _playerLevelBefore = playerLevelBefore; } public void RegisterCallBack(OnDialogDestroy callback) { _onDestroy = callback; } protected override bool SetupView() { _animationManager = new SequenceAnimationManager(); ClearViews(); SetupTitle(); SetupRewardList(); SetupCompleteIcon(); _animationManager.AddAnimation(base.view.transform.Find("Dialog/Content/CompleteIcon").GetComponent()); _animationManager.StartPlay(0.5f, false); Singleton.Instance.RequestHasGotItemIdList(); return false; } protected override void BindViewCallbacks() { BindViewCallback(base.view.transform.Find("BG").GetComponent