123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- 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 + 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 OnClickItem(EventContext context)
- {
- int index = (int)(context.sender as GObject).data;
- _ui.m_name.text = index.ToString();
- _ui.m_desc.text = index.ToString();
- }
- }
- }
|