瀏覽代碼

角色升级

zhaoyang 3 年之前
父節點
當前提交
f0ca6b9e54

+ 21 - 2
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -13,7 +13,6 @@ namespace GFGGame
         public static string roleName;
         public static int rechargeTotal;
         public static int rechargeTotalMon;
-        public static int roleLastLv;//上次的角色等级,用于升级界面展示用
 
         public static int power
         {
@@ -97,14 +96,34 @@ namespace GFGGame
 
         }
 
-        public static void ShowRoleLvUpView()
+        private static int oldLvValue;
+        public static void RoleLvUp(int oldValue)
         {
+            oldLvValue = oldValue;
             Timers.inst.Remove(CheckUpLv);
+            Timers.inst.Remove(OpenRoleLvUpView);
+
             Timers.inst.Add(1, 0, CheckUpLv);
         }
         private static void CheckUpLv(object param)
         {
+            if (GRoot.inst.GetTopWindow() == null)
+            {
+                OpenRoleLvUpView(null);
+                Timers.inst.Remove(CheckUpLv);
+                // roleLastLv = lvl;
+            }
+            if (ViewManager.isViewOpen(typeof(StroyFightResultView).Name))
+            {
+                Timers.inst.Add(0.2f, 1, OpenRoleLvUpView);
+            }
+        }
+        private static void OpenRoleLvUpView(object param)
+        {
+            ViewManager.Show<RoleLvUpView>(oldLvValue);
+            Timers.inst.Remove(CheckUpLv);
 
         }
     }
+
 }

+ 3 - 2
GameClient/Assets/Game/HotUpdate/ServerProxy/CommonSProxy.cs

@@ -7,13 +7,14 @@ namespace ET
     {
         protected override async ETTask Run(Session session, M2C_NoticeUnitNumeric message)
         {
-            session.ZoneScene()?.CurrentScene()?.GetComponent<UnitComponent>()?
-                .Get(message.UnitId)?.GetComponent<NumericComponent>()?.Set(message.NumericType, message.NewValue);
+            int oldValue = GameGlobal.myNumericComponent.GetAsInt(message.NumericType);
+            GameGlobal.myNumericComponent.Set(message.NumericType, message.NewValue);
 
             switch (message.NumericType)
             {
                 case NumericType.Lvl:
                     FunctionOpenDataManager.Instance.CheckHasLvFunOpen((int)message.NewValue);//等级变化要加测是否有功能开启
+                    RoleDataManager.RoleLvUp(oldValue);
                     break;
                 case NumericType.Power:
                     RoleDataManager.powerTimeServerLock = false;

+ 22 - 1
GameClient/Assets/Game/HotUpdate/Views/RoleLvUp/RoleLvUpView.cs

@@ -10,7 +10,7 @@ namespace GFGGame
     {
 
         private UI_RoleLvUpUI _ui;
-
+        private int oldLvValue;
         public override void Dispose()
         {
             base.Dispose();
@@ -24,12 +24,33 @@ namespace GFGGame
             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()
         {