Переглянути джерело

6/19更新

2025/6/19 添加狗领养超过上限提示
添加领养自己的狗提示
修改是否完成当日训练的代码
Jees 1 день тому
батько
коміт
75ccac7cf8

+ 8 - 0
Assets/Resources/Data/languages.json

@@ -971,6 +971,14 @@
             "purchase_dog_cost": {
                 "en": "Adopt <<breed>> costs <<dog_cost>> coins.<br>Are you sure?",
                 "zh-cn": "领养<<breed>>需要花费<<dog_cost>>金币。<br> 确认?"
+            },
+            "dog_limit": {
+                "en": "You have reached the limit of adopted dogs.",
+                "zh-cn": "您已达到领养狗的数量上限。"
+            },
+            "cannot_receive_own_dog": {
+                "en": "You cannot adopt your own dog.",
+                "zh-cn": "你不能领养自己的狗。"
             }
         }
     },

+ 2 - 2
Assets/Scripts/Develop Script/TestSetup.cs

@@ -26,7 +26,7 @@ public class TestSetup : MonoBehaviour
         // }
         if (SceneManager.GetActiveScene().name == "Home")
         {
-            GameData.isVoiceTrainingToday = false;
+            // GameData.isVoiceTrainingToday = false;
             // GameData.isFirstInteraction = true;
         }
 
@@ -54,7 +54,7 @@ public class TestSetup : MonoBehaviour
         // 如果场景不是从login开始的,初始化环境数据
         if (EnviromentSetting.languageData == null)
         {
-            EnviromentController.InitialGameEnviroment();
+            // EnviromentController.InitialGameEnviroment();
         }
     }
     // Start is called once before the first execution of Update after the MonoBehaviour is created

+ 3 - 1
Assets/Scripts/EnviromentSetting.cs

@@ -21,7 +21,9 @@ public static class EnviromentSetting
     public static string[] accessTokenWhiteList = {
         "/api/login/token/",
         "/api/game/quick_start/",
-        "/api/login/"
+        "/api/login/",
+        "/api/reset/password/step1/",
+        "/api/reset/password/step2/"
     };
 
     //系统语言 default=en

+ 10 - 0
Assets/Scripts/GameControllers/GameData.cs

@@ -2,6 +2,8 @@
  */
 
 using System;
+using System.Net.NetworkInformation;
+using UnityEngine;
 
 public static class GameData
 {
@@ -20,4 +22,12 @@ public static class GameData
     public static string bathItemId = string.Empty;        // 用于暂存洗澡场景中使用的道具
     public static bool hasRemindedRegister = false;      // 用于暂存是否已经提醒用户注册
     #endregion
+
+    public static void SetIsVoiceTrainingToday()
+    {
+        isVoiceTrainingToday = true;
+        string todayDate = System.DateTime.Now.ToString("yyyy-MM-dd");
+        PlayerPrefs.SetString("lastTrainingDate", todayDate);
+        PlayerPrefs.Save();
+    }
 }

+ 7 - 9
Assets/Scripts/Home/HomeController.cs

@@ -144,7 +144,8 @@ public class HomeController : MonoBehaviour
                         //GameData.focusDog = UserProperty.GetDogIndexById(dog.dogProperty.d_id);
                         dogsInScene[GameData.focusDog].SetupInteract();
                         interactDog = dogsInScene[GameData.focusDog].gameObject;
-                        GameData.isVoiceTrainingToday = true;
+                        // GameData.isVoiceTrainingToday = true;
+                        GameData.SetIsVoiceTrainingToday();        // 设置当天已经完成了语音训练
                         VoiceButtonOnlySwitch(true);        // 交互模式下关闭其他菜单
                     }
                 }
@@ -175,7 +176,8 @@ public class HomeController : MonoBehaviour
                             }
                             else
                             {
-                                GameData.isVoiceTrainingToday = true;
+                                // GameData.isVoiceTrainingToday = true;
+                                GameData.SetIsVoiceTrainingToday();        // 设置当天已经完成了语音训练
                             }
                         }
                         else if (dog.dogProperty.voiceCommand >= 40 && dog.dogProperty.CommandTrainingPhase() >= 4)
@@ -216,7 +218,7 @@ public class HomeController : MonoBehaviour
                         //GameData.focusDog = UserProperty.GetDogIndexById(dog.dogProperty.d_id);
                         dogsInScene[GameData.focusDog].SetupInteract();
                         interactDog = dogsInScene[GameData.focusDog].gameObject;
-                        GameData.isVoiceTrainingToday = true;
+                        GameData.SetIsVoiceTrainingToday();        // 设置当天已经完成了语音训练
                         VoiceButtonOnlySwitch(true);        // 交互模式下关闭其他菜单
                     }
                 }
@@ -701,11 +703,7 @@ public class HomeController : MonoBehaviour
                     this.sceneMode = SceneMode.NORMAL;
                     VoiceButtonOnlySwitch(false);        // 交互结束,打开其他菜单
 
-                    GameData.isVoiceTrainingToday = true;        // 训练完成,设置为true
-                    string todayDate = System.DateTime.Now.ToString("yyyy-MM-dd");
-                    PlayerPrefs.SetString("lastTrainingDate", todayDate);
-                    PlayerPrefs.Save();
-
+                    GameData.SetIsVoiceTrainingToday();        // 设置当天已经完成了语音训练
                 }
                 else if (data["message"].ToString() == "fail")
                 {
@@ -764,7 +762,7 @@ public class HomeController : MonoBehaviour
         sceneMode = SceneMode.NORMAL;       // 交互模式
         Debug.Log("Reset Training Mode Parameters");
         GameTool.ResumeGameTime();
-        GameData.isVoiceTrainingToday = true;        // 训练完成,设置为true
+        GameData.SetIsVoiceTrainingToday();        // 训练完成,设置为true
         var BGM = GameObject.Find("BGM");
         if (BGM != null)
         {

+ 13 - 1
Assets/Scripts/Login/CreateOrAdopt.cs

@@ -211,11 +211,23 @@ public class CreateOrAdopt : MonoBehaviour
         else if (data != null && data["status"].ToString() == "error")
         {
             // 二维码过期
-            if (data["error_code"].ToString() == "620")
+            if (data["code"].ToString() == "620")
             {
                 string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "InitDogUI", "message", "QRcode_expired", EnviromentSetting.languageCode });
                 MessageBoxController.ShowMessage(msg);
             }
+            // 超过领养狗的数量上限
+            if (data["code"].ToString() == "621")
+            {
+                string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "InitDogUI", "message", "dog_limit", EnviromentSetting.languageCode });
+                MessageBoxController.ShowMessage(msg);
+            }
+            // 不能接收来自自己的狗
+            if (data["code"].ToString() == "622")
+            {
+                string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "InitDogUI", "message", "cannot_receive_own_dog", EnviromentSetting.languageCode });
+                MessageBoxController.ShowMessage(msg);
+            }
         }
         else
         {

+ 0 - 18
Assets/Scripts/Login/ResetUIController.cs

@@ -114,24 +114,6 @@ public class ResetUIController : MonoBehaviour
                 password.style.display = DisplayStyle.Flex;
                 submit.SetEnabled(false);
                 break;
-            //case 3:
-            //    textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 3", EnviromentSetting.languageCode });
-            //    message.text = textValue;
-            //    email.SetEnabled(false);
-            //    mobile.SetEnabled(false);
-            //    verification.style.display = DisplayStyle.Flex;
-            //    password.style.display = DisplayStyle.None;
-            //    submit.SetEnabled(false);
-            //    break;
-            //case 4:
-            //    textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 4", EnviromentSetting.languageCode });
-            //    message.text = textValue;
-            //    email.SetEnabled(false);
-            //    mobile.SetEnabled(false);
-            //    verification.style.display = DisplayStyle.None;
-            //    password.style.display = DisplayStyle.Flex;
-            //    submit.SetEnabled(false);
-            //    break;
         }
     }