|
@@ -0,0 +1,94 @@
|
|
|
+using System.Collections.Generic;
|
|
|
+using ET;
|
|
|
+using FairyGUI;
|
|
|
+using UI.ActivityThemeLuckyBox;
|
|
|
+using UnityEngine;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ public class ActivityThemeLuckyBoxBonusView : BaseWindow
|
|
|
+ {
|
|
|
+ private UI_ActivityThemeLuckyBoxBonusUI _ui;
|
|
|
+ private List<ActivityLuckybonusCfg> _bonueCfgs = new List<ActivityLuckybonusCfg>();
|
|
|
+
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnInit()
|
|
|
+ {
|
|
|
+ base.OnInit();
|
|
|
+ packageName = UI_ActivityThemeLuckyBoxBonusUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_ActivityThemeLuckyBoxBonusUI.Create();
|
|
|
+ this.viewCom = _ui.target;
|
|
|
+ this.viewCom.Center();
|
|
|
+ this.modal = true;
|
|
|
+ viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
+
|
|
|
+ _ui.m_list.itemRenderer = RenderListItem;
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void OnShown()
|
|
|
+ {
|
|
|
+ base.OnShown();
|
|
|
+ _bonueCfgs = ActivityLuckybonusCfgArray.Instance.GetCfgsByid(ActivityDataManager.Instance.activityId);
|
|
|
+ _ui.m_list.numItems = _bonueCfgs.Count;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ base.OnHide();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void RenderListItem(int index, GObject obj)
|
|
|
+ {
|
|
|
+ ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(ActivityDataManager.Instance.activityId);
|
|
|
+
|
|
|
+ UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
+
|
|
|
+ item.m_txtTitle.text = string.Format("{0}限定摘星{1}次({2}/{3})", activityOpenCfg.themeName, _bonueCfgs[index].num, ActivityDataManager.Instance.allPlayTimes, _bonueCfgs[index].num);
|
|
|
+ if (item.m_listRewards.data == null)
|
|
|
+ {
|
|
|
+ item.m_listRewards.itemRenderer = RenderListRewardItem;
|
|
|
+ }
|
|
|
+ item.m_listRewards.data = _bonueCfgs[index].bonusArr;
|
|
|
+ item.m_listRewards.numItems = _bonueCfgs[index].bonusArr.Length;
|
|
|
+ int key = _bonueCfgs[index].num;
|
|
|
+ item.m_c1.selectedIndex = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(key) ? ActivityDataManager.Instance.luckyBoxActBonusState[key] : 0;
|
|
|
+
|
|
|
+ UI_ListItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void RenderListRewardItem(int index, GObject obj)
|
|
|
+ {
|
|
|
+ int[][] bonus = (int[][])obj.parent.data;
|
|
|
+ ItemData reward = ItemUtil.createItemData(bonus[index]);
|
|
|
+ if (obj.data == null)
|
|
|
+ {
|
|
|
+ obj.data = new ItemView(obj as GComponent);
|
|
|
+ }
|
|
|
+ (obj.data as ItemView).SetData(reward);
|
|
|
+ (obj.data as ItemView).ChangeTxtCountStyle();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|