void OnDestroy() { RefreshGrowingUpOk = null; RefreshGrowingUpHanOk = null; BagSystem.instance.UpdateItemEvent -= updateUI; BagSystem.instance.DelItemEvent -= updateUI; BagSystem.instance.DelItemInstEvent -= updateUI; BagSystem.instance.ItemChanged += updateUI; hasDestroyed = true; }
void Start() { GlobalValue.Get(Constant.C_ResetBabyPay, out itemid); InitUIText(); RefreshGrowingUpOk = RefreshGrowingUp; RefreshGrowingUpHanOk = Refresh; HeadIconLoader.Instance.LoadIcon(ItemData.GetData(itemid).icon_, itemIcon); miaoshuLabel.text = ItemData.GetData(itemid).name_ /*LanguageManager.instance.GetValue ("babyxiaohao").Replace ("{n}",ItemData.GetData(itemid).name_)*/; UIManager.SetButtonEventHandler(enterBtn.gameObject, EnumButtonEvent.OnClick, OnClickhuanyuanBtn, 0, 0); numlabel.text = BagSystem.instance.GetItemMaxNum((uint)itemid) + "/1"; BagSystem.instance.ItemChanged += updateUI; BagSystem.instance.UpdateItemEvent += updateUI; BagSystem.instance.DelItemEvent += updateUI; hasDestroyed = false; if (GlobalValue.isBattleScene(StageMgr.Scene_name)) { enterBtn.gameObject.SetActive(false); } }