|
@@ -13,6 +13,8 @@ namespace GFGGame
|
|
|
private UI_LimitChargeUI _ui;
|
|
|
private List<ActivityRechargeCfg> _rechargeCfgs;
|
|
|
|
|
|
+ private ActivityInfo _activityInfo;
|
|
|
+
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
|
|
@@ -31,7 +33,6 @@ namespace GFGGame
|
|
|
_ui = UI_LimitChargeUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
-
|
|
|
_ui.m_list.itemRenderer = RenderListItem;
|
|
|
|
|
|
_ui.m_btnBack.onClick.Add(OnBtnBackClick);
|
|
@@ -40,6 +41,11 @@ namespace GFGGame
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath(openCfg.res);
|
|
|
|
|
|
}
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+ EventAgent.AddEventListener(ConstMessage.ACTIVITY_REWARD_ADD, UpdateView);
|
|
|
+ }
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
@@ -54,7 +60,11 @@ namespace GFGGame
|
|
|
if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
|
|
|
Timers.inst.Remove(UpdateTime);
|
|
|
}
|
|
|
-
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REWARD_ADD, UpdateView);
|
|
|
+ }
|
|
|
private void OnBtnBackClick()
|
|
|
{
|
|
|
ViewManager.GoBackFrom(typeof(LimitChargeView).FullName);
|
|
@@ -74,6 +84,7 @@ namespace GFGGame
|
|
|
|
|
|
private void UpdateView()
|
|
|
{
|
|
|
+ _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(ActivityDataManager.Instance.actLimitChargeId);
|
|
|
_ui.m_list.numItems = _rechargeCfgs.Count;
|
|
|
}
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
@@ -82,12 +93,21 @@ namespace GFGGame
|
|
|
UI_ListChargeItem item = UI_ListChargeItem.Proxy(obj);
|
|
|
|
|
|
item.m_txtTitle.text = string.Format("活动期间累计获得{0}会员积分({1}/{2})", _rechargeCfgs[index].value, RoleDataManager.vipExp, _rechargeCfgs[index].value);
|
|
|
+ int limitChargeExp = GameGlobal.myNumericComponent.GetAsInt(NumericType.RechargeTotal);
|
|
|
+ if (limitChargeExp >= _rechargeCfgs[index].value)
|
|
|
+ {
|
|
|
+ item.m_c1.selectedIndex = _activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) > 0 ? 2 : 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.m_c1.selectedIndex = 0;
|
|
|
+ }
|
|
|
|
|
|
if (item.m_btnGet.data == null)
|
|
|
{
|
|
|
item.m_btnGet.onClick.Add(OnBtnGetClick);
|
|
|
}
|
|
|
- item.m_btnGet.data = _rechargeCfgs[index].value;
|
|
|
+ item.m_btnGet.data = _rechargeCfgs[index].id;
|
|
|
|
|
|
if (item.m_listRewards.data == null)
|
|
|
{
|
|
@@ -107,20 +127,15 @@ namespace GFGGame
|
|
|
{
|
|
|
obj.data = new ItemView(obj as GComponent);
|
|
|
}
|
|
|
- (obj.data as ItemView).SetData(itemData);
|
|
|
+ (obj.data as ItemView).SetData(itemData);
|
|
|
UI_ComItem.ProxyEnd();
|
|
|
}
|
|
|
|
|
|
- private async void OnBtnGetClick(EventContext context)
|
|
|
+ private void OnBtnGetClick(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.sender as GObject;
|
|
|
- int value = (int)obj.data;
|
|
|
-
|
|
|
- bool result = await ActivitySProxy.ReqGetLimitChargeBonus(ActivityDataManager.Instance.actLimitChargeId, value);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- UpdateView();
|
|
|
- }
|
|
|
+ int id = (int)obj.data;
|
|
|
+ ActivityGlobalSProxy.ReqGetActivityBonus(id, ActivityDataManager.Instance.actLimitChargeId).Coroutine();
|
|
|
}
|
|
|
}
|
|
|
}
|