123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using ET;
- using FairyGUI;
- using UI.MatchingCompetition;
- using UnityEngine;
- namespace GFGGame
- {
- class MatchingCompetitionWorksView : BaseWindow
- {
- private UI_MatchingCompetitionWorksUI _ui;
- private int _currentIndex = 0;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_MatchingCompetitionWorksUI.PACKAGE_NAME;
- _ui = UI_MatchingCompetitionWorksUI.Create();
- this.viewCom = _ui.target;
- isReturnView = true;
- isfullScreen = true;
- _ui.m_worksList.itemRenderer = RenderRankList;
- _ui.m_BtnBack.onClick.Add(OnClickBtnBack);
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- _ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj");
- UpdateView();
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void UpdateView()
- {
- _ui.m_worksList.numItems = MatchingCompetitionDataManager.Instance._BeforeWorksList.Count;
- }
- private void RenderRankList(int index, GObject obj)
- {
- UI_Component5 item = UI_Component5.Proxy(obj);
- if (item.target.data == null)
- {
- item.target.onClick.Add(OnClickBtnItem);
- }
- item.target.data = index;
- UI_Component5.ProxyEnd();
- }
- private void OnClickBtnItem(EventContext context)
- {
- GObject item = context.sender as GObject;
- int index = (int)item.data +1;
- ViewManager.Show<MatchingCompetitionWorksListView>(index);
- }
- private void OnClickBtnBack()
- {
- ViewManager.GoBackFrom(typeof(MatchingCompetitionWorksView).FullName);
- }
- }
- }
|