1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using FairyGUI;
- using UI.BlindBox;
- using System.Collections;
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class BlindBoxRewardView : BaseWindow
- {
- private UI_BlindBoxRewardUI _ui;
- private List<DropOutCfg> _rewardNormal = null;
- private List<DropOutCfg> _rewardSpecial = null;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_BlindBoxRewardUI.PACKAGE_NAME;
- _ui = UI_BlindBoxRewardUI.Create();
- this.viewCom = _ui.target;
- modal = true;
- this.viewCom.Center();
- viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
- _ui.m_normalList.itemRenderer = NormalRewardList;
- _ui.m_specialList.itemRenderer = SpecialRewardList;
- }
- protected override void OnShown()
- {
- base.OnShown();
- BlindBoxCfg blindBoxCfg = BlindBoxCfgArray.Instance.GetCfg(2);
- int id1 = blindBoxCfg.OrdinaryDropDisplay; //(int)(this.viewData as object[])[0];
- int id2 = blindBoxCfg.HideDropDisplay; //(int)(this.viewData as object[])[1];
- _rewardNormal = DropOutCfgArray.Instance.GetCfgsByid(id1);
- _ui.m_normalList.numItems = _rewardNormal.Count;
- _rewardSpecial = DropOutCfgArray.Instance.GetCfgsByid(id2);
- _ui.m_specialList.numItems = _rewardSpecial.Count;
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void NormalRewardList(int index, GObject obj)
- {
- UI_Itemitem item = UI_Itemitem.Proxy(obj);
- int id = _rewardNormal[index].item;
- ItemCfg itemcfg = ItemCfgArray.Instance.GetCfg(id);
- item.m_icon.url = ResPathUtil.GetIconPath(itemcfg);
- item.m_name.text = itemcfg.name;
- if (item.target.data == null)
- {
- item.target.onClick.Add(OnClickItem);
- }
- item.target.data = id;
- UI_Itemitem.ProxyEnd();
- }
- private void SpecialRewardList(int index, GObject obj)
- {
- UI_Itemitem item = UI_Itemitem.Proxy(obj);
- int id = _rewardSpecial[index].item;
- ItemCfg itemcfg = ItemCfgArray.Instance.GetCfg(id);
- item.m_icon.url = ResPathUtil.GetIconPath(itemcfg);
- item.m_name.text = itemcfg.name;
- if (item.target.data == null)
- {
- item.target.onClick.Add(OnClickItem);
- }
- item.target.data = id;
- UI_Itemitem.ProxyEnd();
- }
- private void OnClickItem(EventContext context)
- {
- GObject obj = context.sender as GObject;
- int id = (int)obj.data;
- GoodsItemTipsController.ShowItemTips(id);
- }
- }
- }
|