1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- 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 override void OnHide()
- {
- base.OnHide();
- }
- private void RenderAFuList(int index, GObject obj)
- {
- UI_MergeGamematerialItem item = UI_MergeGamematerialItem.Proxy(obj);
- item.m_icon.url = ResPathUtil.GetMiniGamePicPath(MergeCfgArray.Instance.GetCfgsByresTypeAndmaterialId(_res,index+11)[0].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;
- 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.GetCfgsByresTypeAndmaterialId(_res, index+1)[0].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;
- 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();
- }
- }
- }
|