using UnityEngine; using FairyGUI; using UI.CommonGame; using System.Collections.Generic; namespace GFGGame { public class FunctionOpenView : BaseWindow { private UI_FunctionOpenUI _ui; List _funList = new List(); private GameObject _effectObj; private GoWrapper _wrapper; 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(); this.modal = true; this.clickBlankToClose = false; } protected override void OnShown() { base.OnShown(); List funList = (viewData as object) as List; AddFunDatas(funList); UpdateFunIcon(); } private void AddFunDatas(List 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(_effectObj, _wrapper, _ui.m_holder, resPath, out _effectObj, 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); _ui.m_t0.Play(UpdateFunIcon); } protected override void OnHide() { base.OnHide(); } } }