| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- 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;
- private const int _blindBoxId = 3;
- 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(_blindBoxId);
- 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);
- }
- }
- }
|