using System; using System.Collections.Generic; using ET; using FairyGUI; using UI.MiniGame; using UnityEngine; namespace GFGGame { public class MergeGameMaterialTipView : BaseWindow { private UI_MergeGameRouteTips _ui; private int _res; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_MergeGameRouteTips.PACKAGE_NAME; _ui = UI_MergeGameRouteTips.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_btnBack.onClick.Add(Hide); _ui.m_AFuList.itemRenderer = RenderAFuList; _ui.m_DouBaoList.itemRenderer = RenderDouBaoList; } protected override void OnShown() { base.OnShown(); if (this.viewData != null && (this.viewData as object[]).Length != 2) { _res = (int)(this.viewData as object[])[0]; } else { _res = 1; } _ui.m_AFuList.numItems = 10; _ui.m_DouBaoList.numItems = 10; } protected async override void OnHide() { bool result = await MiniGameProxy.ReqMergeGameNewStyle(); base.OnHide(); } private void RenderAFuList(int index, GObject obj) { UI_MergeGamematerialItem item = UI_MergeGamematerialItem.Proxy(obj); item.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res,index+11).resName,"MergeGame"); if( (index+1) % 5 == 0) { item.m_right.visible = false; } if(item.target.data == null) { item.target.onClick.Add(OnClickItem); } item.target.data = index + 1 + 10; int id = index + 1 + 10; if (MiniGameDateManager.Instance.NewItemIdDic.ContainsKey(id)) { if (MiniGameDateManager.Instance.NewItemIdDic[id] == 1) { item.m_c1.selectedIndex = 1; } else { item.m_c1.selectedIndex = 0; } } else { item.m_c1.selectedIndex = 2; } if (index % 5 == 0) { item.m_c1.selectedIndex = 0; } UI_MergeGamematerialItem.ProxyEnd(); } private void RenderDouBaoList(int index,GObject obj) { UI_MergeGamematerialItem item = UI_MergeGamematerialItem.Proxy(obj); item.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(_res, index+1).resName, "MergeGame"); if ((index + 1) % 5 == 0) { item.m_right.visible = false; } if (item.target.data == null) { item.target.onClick.Add(OnClickItem); } item.target.data = index + 1; int id = index + 1; if (MiniGameDateManager.Instance.NewItemIdDic.ContainsKey(id)) { if (MiniGameDateManager.Instance.NewItemIdDic[id] == 1) { item.m_c1.selectedIndex = 1; } else { item.m_c1.selectedIndex = 0; } } else { item.m_c1.selectedIndex = 2; } if (index % 5 == 0) { item.m_c1.selectedIndex = 0; } UI_MergeGamematerialItem.ProxyEnd(); } private void OnClickItem(EventContext context) { int index = (int)(context.sender as GObject).data; MergeCfg mergeCfg = MergeCfgArray.Instance.GetCfgByresTypeAndmaterialld(MiniGameDateManager.Instance.MergeGameMatType, index); _ui.m_name.text = mergeCfg.name; _ui.m_desc.text = mergeCfg.desc; } } }