12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using UnityEngine;
- using FairyGUI;
- using UI.CommonGame;
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class FunctionOpenView : BaseWindow
- {
- private UI_FunctionOpenUI _ui;
- List<string> _funList = new List<string>();
- public override void Dispose()
- {
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_FunctionOpenUI.PACKAGE_NAME;
- _ui = UI_FunctionOpenUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- this.viewCom.Center();
- }
- protected override void OnShown()
- {
- base.OnShown();
- List<string> funList = (viewData as object) as List<string>;
- AddFunDatas(funList);
- UpdateFunIcon();
- // _ui.m_t0.Play(UpdateFunIcon);
- // Timers.inst.Remove(UpdateFunIcon);
- // Timers.inst.Add(1.5f, _funList.Count, UpdateFunIcon);
- }
- private void AddFunDatas(List<string> itemList)
- {
- for (int i = 0; i < itemList.Count; i++)
- {
- if (_funList.IndexOf(itemList[i]) < 0)
- {
- _funList.Add(itemList[i]);
- }
- }
- }
- private void UpdateFunIcon()
- {
- if (_funList.Count == 0)
- {
- this.Hide();
- return;
- }
- FunctionOpenCfg cfg = FunctionOpenCfgArray.Instance.GetCfg(_funList[0]);
- _ui.m_ComFunctionOpen.m_txtName.text = cfg.name;
- _ui.m_ComFunctionOpen.m_logIcon.url = ResPathUtil.GetCommonGameResPath(cfg.res);
- _funList.RemoveAt(0);
- _ui.m_t0.Play(UpdateFunIcon);
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- }
- }
|