12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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>();
- private GameObject _gameObject;
- private GoWrapper _wrapper;
- public override void Dispose()
- {
- SceneController.DestroyObjectFromView(_gameObject, _wrapper);
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- 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();
- this.modal = true;
- this.clickBlankToClose = false;
- }
- protected override void OnShown()
- {
- base.OnShown();
- List<string> funList = (viewData as object) as List<string>;
- AddFunDatas(funList);
- 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;
- }
- string resPath = ResPathUtil.GetViewEffectPath("ui_xjs", "ui_xjs");
- SceneController.AddObjectToView(_gameObject, _wrapper, _ui.m_holder, resPath, out _gameObject, out _wrapper);
- 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);
- ET.Log.Debug("zoya:" + _funList.Count);
- _ui.m_t0.Play(UpdateFunIcon);
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- }
- }
|