1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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) =>
- {
- // UI_ComItem goodsItem = UI_ComItem.Proxy(item);
- ItemData itemData = luckyBoxBonusData.itemList[index] as ItemData;
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemData.id);
- // goodsItem.m_iconOwned.visible = ItemDataManager.GetItemNum(itemData.id) > 0;
- // goodsItem.m_txtName.text = itemCfg.name;
- // goodsItem.m_iconItem.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
- // RarityIconController.UpdateRarityIcon(goodsItem.m_iconItem.m_rarity, itemData.id, true);
- // goodsItem.target.data = itemData.id;
- // ItemData reward = ItemUtil.createItemData(_cfg.rewardsArr[index]);
- 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.onClickItem.Add((EventContext context) =>
- // {
- // GComponent item = context.data as GComponent;
- // int itemID = (int)item.data;
- // GoodsItemTipsController.ShowItemTips(itemID);
- // });
- listItem.m_list.numItems = luckyBoxBonusData.itemList.Count;
- listItem.m_list.ResizeToFit();
- // listItem.m_list.columnGap = 50;
- listItem.target.height = listItem.m_list.y + listItem.m_list.height;
- }
- }
- }
|