Przeglądaj źródła

WildAttack最高分纪录保存

lvjincheng 2 lat temu
rodzic
commit
0eac484112

+ 4 - 3
Assets/BowArrow/Scripts/Manager/LoginMgr/LoginMgr.cs

@@ -70,13 +70,14 @@ public class UserInfo
     public string mac = "";
     public List<PropInfo> bagList = new List<PropInfo>();
     public List<DeviceInfo> deviceList = new List<DeviceInfo>();
-    //显示游戏最高分(不同距离分数独立)
+    /// <summary>
+    /// 显示游戏最高分(不同距离分数独立)
+    /// 2023-7-16兼容WildAttack最高分纪录
+    /// </summary>
     public Dictionary<string, float> timeLimitGameScores = new Dictionary<string, float>();
     //闯关记录(gameType:通关数)(野兔、野鸡、野狼的通关数)
     public Dictionary<int, int> challengeLevels = new Dictionary<int, int>();
     public string guideRecord = "";
-    //wildAttackRecord最高分纪录
-    public int wildAttackRecord;
     public void Save()
     {
         try { UserComp.Instance.saveUserInfo(this); } catch (System.Exception e) { Debug.LogError(e.Message); }

+ 9 - 3
Assets/WildAttack/Scripts/UI/GameOverPanel.cs

@@ -98,13 +98,19 @@ namespace WildAttack
             text_currScoreTitle.text = StringModule.GetInstance().GetData("score") + ":";
             text_currScore.text = GameMananger.GetInstance().TotalScore.ToString();
 
-            if (GameMananger.GetInstance().TotalScore > LoginMgr.myUserInfo.wildAttackRecord)
+            float recordScore = 0;
+            if (LoginMgr.myUserInfo.timeLimitGameScores.ContainsKey("WildAttack"))
             {
-                LoginMgr.myUserInfo.wildAttackRecord = GameMananger.GetInstance().TotalScore;
+                recordScore = LoginMgr.myUserInfo.timeLimitGameScores["WildAttack"];
+            }
+            if (GameMananger.GetInstance().TotalScore > recordScore)
+            {
+                recordScore = GameMananger.GetInstance().TotalScore;
+                LoginMgr.myUserInfo.timeLimitGameScores["WildAttack"] = recordScore;
                 LoginMgr.myUserInfo.Save();
             }
             text_highScoreTitle.text = StringModule.GetInstance().GetData("highScore") + ":";
-            text_highScore.text = LoginMgr.myUserInfo.wildAttackRecord.ToString();
+            text_highScore.text = recordScore.ToString();
 
         }
         #endregion

+ 6 - 1
Assets/WildAttack/Scripts/UI/MainPanel.cs

@@ -75,7 +75,12 @@ namespace WildAttack
                 LoginMgr.myUserInfo.avatarID, LoginMgr.myUserInfo.avatarUrl
             );
             _textUserNickname.text = LoginMgr.myUserInfo.nickname + "  ";
-            _textUserRecordScore.text = LoginMgr.myUserInfo.wildAttackRecord.ToString();
+            float recordScore = 0;
+            if (LoginMgr.myUserInfo.timeLimitGameScores.ContainsKey("WildAttack"))
+            {
+                recordScore = LoginMgr.myUserInfo.timeLimitGameScores["WildAttack"];
+            }
+            _textUserRecordScore.text = recordScore.ToString();
         }
 
         // Update is called once per frame