示例#1
0
 void BindEvent()
 {
     if (uiObj == null && CSUI_MainWndCtrl.Instance != null)
     {
         if (m_MgCreator != null)
         {
             m_MgCreator.RegistStoreIdAddedEvent(AddSellItems);
             m_MgCreator.RegistUpdateAddedStoreIdEvent(UpdateTradeData);
             m_MgCreator.RegistUpdateMoneyEvent(UpdateMoneyToUI);
         }
         uiObj = CSUI_MainWndCtrl.Instance.TradingPostUI;
         uiObj.BuyItemEvent          += BuyItem;
         uiObj.SellItemEvent         += SellItem;
         uiObj.RepurchaseItemEvent   += RepurchaseItem;
         uiObj.RequestRefreshUIEvent += UpdateShop;
     }
 }
示例#2
0
 void UnbindEvent()
 {
     if (uiObj != null)
     {
         if (m_MgCreator != null)
         {
             m_MgCreator.UnRegistStoreIdAddedEvent(AddSellItems);
             m_MgCreator.UnRegistUpdateAddedStoreIdEvent(UpdateTradeData);
             m_MgCreator.UnRegistUpdateMoneyEvent(UpdateMoneyToUI);
         }
         uiObj.BuyItemEvent          -= BuyItem;
         uiObj.SellItemEvent         -= SellItem;
         uiObj.RepurchaseItemEvent   -= RepurchaseItem;
         uiObj.RequestRefreshUIEvent -= UpdateShop;
         uiObj = null;
     }
 }