|
@@ -43,6 +43,11 @@ namespace GFGGame
|
|
|
_ui.m_btnClose.onClick.Add(Hide);
|
|
|
|
|
|
AddEffect();
|
|
|
+
|
|
|
+ ItemCfg cfg = ItemCfgArray.Instance.GetCfg(GlobalCfgArray.globalCfg.changeNameCostArr[0]);
|
|
|
+ //_ui.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(cfg.res);
|
|
|
+ _ui.m_loaIcon.url = ResPathUtil.GetIconPath(cfg.res, "png");
|
|
|
+ _ui.m_loaIcon.onClick.Add(OnBtnIconClick);
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
@@ -50,20 +55,7 @@ namespace GFGGame
|
|
|
base.OnShown();
|
|
|
this._ui.m_inputName.text = "";
|
|
|
|
|
|
- long haveNum = ItemDataManager.GetItemNum(GlobalCfgArray.globalCfg.changeNameCostArr[0]);
|
|
|
- long needNum = GlobalCfgArray.globalCfg.changeNameCostArr[1];
|
|
|
- if (haveNum < needNum)
|
|
|
- {
|
|
|
- _ui.m_txtNeed.text = string.Format("改名卡:[color=#E26A21]{0}[color]/{1}", haveNum, needNum);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _ui.m_txtNeed.text = string.Format("改名卡:{0}/{1}", haveNum, needNum);
|
|
|
- }
|
|
|
- ItemCfg cfg = ItemCfgArray.Instance.GetCfg(GlobalCfgArray.globalCfg.changeNameCostArr[0]);
|
|
|
- //_ui.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(cfg.res);
|
|
|
- _ui.m_loaIcon.url = ResPathUtil.GetIconPath(cfg.res, "png");
|
|
|
- _ui.m_loaIcon.onClick.Add(OnBtnIconClick);
|
|
|
+ UpdateView();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -79,6 +71,18 @@ namespace GFGGame
|
|
|
_effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down");
|
|
|
}
|
|
|
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+ EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateItem);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateItem);
|
|
|
+ }
|
|
|
+
|
|
|
private void OnClickBtnSureAsync()
|
|
|
{
|
|
|
string roleName = _ui.m_inputName.text;
|
|
@@ -148,5 +152,29 @@ namespace GFGGame
|
|
|
GoodsItemTipsController.ShowItemTips(itemCfg.id, sourceDatas);
|
|
|
}
|
|
|
|
|
|
+ private void UpdateItem(EventContext context)
|
|
|
+ {
|
|
|
+ int itemID = (int)context.data;
|
|
|
+ if(itemID != GlobalCfgArray.globalCfg.changeNameCostArr[0])
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateView()
|
|
|
+ {
|
|
|
+ long haveNum = ItemDataManager.GetItemNum(GlobalCfgArray.globalCfg.changeNameCostArr[0]);
|
|
|
+ long needNum = GlobalCfgArray.globalCfg.changeNameCostArr[1];
|
|
|
+ if (haveNum < needNum)
|
|
|
+ {
|
|
|
+ _ui.m_txtNeed.text = string.Format("改名卡:[color=#E26A21]{0}[color]/{1}", haveNum, needNum);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _ui.m_txtNeed.text = string.Format("改名卡:{0}/{1}", haveNum, needNum);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|