using UI.CommonGame; using FairyGUI; using UnityEngine; using UI.LuckyBox; namespace GFGGame { public class SuitItemView : BaseWindow { private UI_SuitItemUI _ui; private EffectUI _effectUI1; private int suitID; private int count = 0;//套装当前拥有的部件数量 private int totalCount = 1; public override void Dispose() { EffectUIPool.Recycle(_effectUI1); _effectUI1 = null; if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_SuitItemUI.PACKAGE_NAME; _ui = UI_SuitItemUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_loaBg.onTouchBegin.Add(OnClickBg); } protected override void OnShown() { base.OnShown(); suitID = (int)this.viewData; UpdateView(); } private void UpdateView() { DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount); if (suitID > 0) { SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitID); _ui.m_txtName.text = "套装·" + suitCfg.name; _ui.m_icon.url = ResPathUtil.GetFieldGuideIconPath(suitCfg.res); } _ui.m_probar.max = totalCount; _ui.m_probar.value = count; _ui.m_t_open.Play(); if (GetSuitItemController.isAuto) { Timers.inst.Add(LuckyBoxDataManager.ANIMATION_TIME, 1, WaitAutoEnd); } } private void OnClickBg() { if(!GetSuitItemController.isAuto) { if (count == totalCount) { ViewManager.Show(suitID); } else { EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ANIMATION_WAIT); } this.Hide(); } } protected override void OnHide() { } private void WaitAutoEnd(object param = null) { this.Hide(); if (count == totalCount) { ViewManager.Show(suitID); } else { EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ANIMATION_WAIT); } Timers.inst.Remove(WaitAutoEnd); } } }