using FairyGUI; using UI.BlindBox; using System.Collections; using System.Collections.Generic; using System.Linq; using cfg.GfgCfg; using ET; namespace GFGGame { public class BlindBoxRewardView : BaseWindow { private UI_BlindBoxRewardUI _ui; private List _rewardNormal = null; private List _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 = CommonDataManager.Tables.TblBlindBoxCfg.GetOrDefault(2); int id1 = blindBoxCfg.OrdinaryDropDisplay; //(int)(this.viewData as object[])[0]; int id2 = blindBoxCfg.HideDropDisplay; //(int)(this.viewData as object[])[1]; _rewardNormal = CommonDataManager.Tables.TblDropOutCfg.DataList.Where(a => a.Id == id1).ToList(); _ui.m_normalList.numItems = _rewardNormal.Count; _rewardSpecial = CommonDataManager.Tables.TblDropOutCfg.DataList.Where(a => a.Id == id2).ToList(); _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 = CommonDataManager.Tables.TblItemCfg.GetOrDefault(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 = CommonDataManager.Tables.TblItemCfg.GetOrDefault(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); } } }