123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using UI.LuckyBox;
- using UI.CommonGame;
- using System.Collections.Generic;
- using FairyGUI;
- namespace GFGGame
- {
- public class LuckyBoxPreShowView : BaseWindow
- {
- private UI_LuckyBoxPreShowUI _ui;
- private List<LuckyBoxBonusData> _bonusList;
- public override void Dispose()
- {
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- _ui = UI_LuckyBoxPreShowUI.Create();
- this.viewCom = _ui.target;
- this.viewCom.Center();
- this.modal = true;
- }
- protected override void OnShown()
- {
- base.OnShown();
- string probShow = LuckyBoxDataManager.Instance.probShow;
- probShow = probShow.Replace("\\n", "\n");
- _ui.m_compText.m_txtShow.text = probShow;
- _bonusList = LuckyBoxDataManager.Instance.GetCurrentShowList();
- _ui.m_list.RemoveChildrenToPool();
- _ui.m_list.itemRenderer = ListItemRenderer;
- _ui.m_list.numItems = _bonusList.Count;
- }
- protected override void OnHide()
- {
- base.OnHide();
- _ui.m_list.RemoveChildrenToPool();
- }
- private void ListItemRenderer(int index, GObject item)
- {
- UI_CompLuckyBoxBonusListItem listItem = UI_CompLuckyBoxBonusListItem.Proxy(item);
- LuckyBoxBonusData luckyBoxBonusData = _bonusList[index];
- listItem.m_txtName.text = luckyBoxBonusData.name;
- listItem.m_list.itemRenderer = (int index, GObject item) =>
- {
- ItemData itemData = luckyBoxBonusData.itemList[index] as ItemData;
- if (item.data == null)
- {
- item.data = new ItemView(item as GComponent);
- }
- (item.data as ItemView).SetData(itemData);
- (item.data as ItemView).TxtHasCountVisble = false;
- };
- listItem.m_list.numItems = luckyBoxBonusData.itemList.Count;
- listItem.m_list.ResizeToFit();
- listItem.target.height = listItem.m_list.y + listItem.m_list.height;
- }
- }
- }
|