using System.Collections; using System.Collections.Generic; using UnityEngine; using UI.RoleLvUp; using FairyGUI; namespace GFGGame { public class RoleLvUpView : BaseWindow { private UI_RoleLvUpUI _ui; private int oldLvValue; private EffectUI _effectUI1; private EffectUI _effectUI2; private EffectUI _effectUI3; public override void Dispose() { EffectUIPool.Recycle(_effectUI1); _effectUI1 = null; EffectUIPool.Recycle(_effectUI2); _effectUI2 = null; EffectUIPool.Recycle(_effectUI3); _effectUI3 = null; if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_RoleLvUpUI.PACKAGE_NAME; _ui = UI_RoleLvUpUI.Create(); this.viewCom = _ui.target; this.viewCom.Center(); this.modal = true; //viewAnimationType = EnumViewAnimationType.ZOOM_CENTER; AddEffect(); } protected override void OnShown() { base.OnShown(); oldLvValue = (int)this.viewData; UpdateView(); } private void UpdateView() { _ui.m_txtLv.text = RoleDataManager.lvl.ToString(); _ui.m_txtLastLv.text = oldLvValue.ToString(); _ui.m_txtCurLv.text = RoleDataManager.lvl.ToString(); int limiteCountAdd = 0; int powerCount = 0; for (int i = oldLvValue; i < RoleDataManager.lvl; i++) { RoleLevelCfg cfg = RoleLevelCfgArray.Instance.GetCfg(i); limiteCountAdd += cfg.addPowerLimit; powerCount += cfg.addPower; } _ui.m_com0.target.visible = limiteCountAdd > 0; _ui.m_com1.target.visible = powerCount > 0; _ui.m_com0.m_txtCount.text = string.Format("+{0}", limiteCountAdd); _ui.m_com1.m_txtCount.text = string.Format("+{0}", powerCount); } protected override void OnHide() { base.OnHide(); string viewName = GuideController.CheckHasRoleLvGuideOpen(); if (viewName != "") { // ViewManager.Show(viewName, null, null, true); } } private void AddEffect() { //升级成功特效 _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderTitle, "ui_sj", "SJ"); //升级成功特效上层 _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderTitleUp, "ui_sj", "SJ_top_number"); //等级特效 _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_holderNumber, "ui_sj", "SJ_Number"); } } }