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; public override void Dispose() { 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; } 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); } } } }