Browse Source

5/15更新

2025/5/15 修改用户信息页面错误,修正反馈页面bug,宠物生日错误
增加狗如果没有识别voiceCommand情况下,播放问号粒子效果
将commandHug替换为CommandTouch
将commandRotate替换为CommandShake
优化command动画播放流畅性
Jees 3 weeks ago
parent
commit
c55e71651b

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

@@ -318,6 +318,22 @@
             "en": "Record fail. Please try again.",
             "zh-cn": "录音失败。请再试一次。"
         },
+        "commandShake_00": {
+            "en": "Are you ready? Now you can give <<dog_name>> the command to shake.",
+            "zh-cn": "准备好了吗?现在可以说出口令让<<dog_name>>摇晃。"
+        },
+        "commandShake_01": {
+            "en": "Record again. Ensure that the two recordings are consistent.",
+            "zh-cn": "再输入一次。确保两次录音一致。"
+        },
+        "commandShake_10": {
+            "en": "Now <<dog_name>> will shake when you give it a command.<br>Talk to <<dog_name>> often, and it will be more obedient.",
+            "zh-cn": "<<dog_name>>现在会听从你的指令摇晃了。<br>经常训练<<dog_name>>,它会更听话哦。"
+        },
+        "commandShake_20": {
+            "en": "Record fail. Please try again.",
+            "zh-cn": "录音失败。请再试一次。"
+        },
         "commandDeath_00": {
             "en": "Are you ready? Now you can give <<dog_name>> the command to pretend to be dead.",
             "zh-cn": "准备好了吗?现在可以说出口令让<<dog_name>>装死。"
@@ -350,6 +366,22 @@
             "en": "Record fail. Please try again.",
             "zh-cn": "录音失败。请再试一次。"
         },
+        "commandTouch_00": {
+            "en": "Are you ready? Now you can give <<dog_name>> the command to touch you.",
+            "zh-cn": "准备好了吗?现在可以说出口令让<<dog_name>>触摸你。"
+        },
+        "commandTouch_01": {
+            "en": "Record again. Ensure that the two recordings are consistent.",
+            "zh-cn": "再输入一次。确保两次录音一致。"
+        },
+        "commandTouch_10": {
+            "en": "Now <<dog_name>> will touch you when you give it a command.<br>Talk to <<dog_name>> often, and it will be more obedient.",
+            "zh-cn": "<<dog_name>>现在会听从你的触摸指令了。<br>经常训练<<dog_name>>,它会更听话哦。"
+        },
+        "commandTouch_20": {
+            "en": "Record fail. Please try again.",
+            "zh-cn": "录音失败。请再试一次。"
+        },
         "commandTurnL_00": {
             "en": "Are you ready? Now you can give <<dog_name>> the command to turn left.",
             "zh-cn": "准备好了吗?现在可以说出口令让<<dog_name>>左转。"

+ 49 - 37
Assets/Resources/Dog/AnimatorController/shibaInu/HomeDogInteractController.controller

@@ -46,7 +46,7 @@ AnimatorStateTransition:
   serializedVersion: 3
   m_TransitionDuration: 0.7061628
   m_TransitionOffset: 0.035126932
-  m_ExitTime: 0.04697351
+  m_ExitTime: 0
   m_HasExitTime: 0
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -91,9 +91,9 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 0.25
+  m_TransitionDuration: 1
   m_TransitionOffset: 0
-  m_ExitTime: 0.75
+  m_ExitTime: 1
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -106,7 +106,7 @@ AnimatorState:
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_Name: R Turn
+  m_Name: TurnR
   m_Speed: 1
   m_CycleOffset: 0
   m_Transitions:
@@ -143,11 +143,11 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 0.88157994
-  m_TransitionOffset: 0.00000008339813
-  m_ExitTime: 1.5978219e-10
+  m_TransitionDuration: 0.20031473
+  m_TransitionOffset: 0
+  m_ExitTime: 0
   m_HasExitTime: 0
-  m_HasFixedDuration: 1
+  m_HasFixedDuration: 0
   m_InterruptionSource: 0
   m_OrderedInterruption: 1
   m_CanTransitionToSelf: 1
@@ -168,9 +168,9 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 1.1192349
-  m_TransitionOffset: 0.007821141
-  m_ExitTime: 0.080458455
+  m_TransitionDuration: 0.5
+  m_TransitionOffset: 0
+  m_ExitTime: 1
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -454,7 +454,7 @@ AnimatorState:
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_Name: Hug
+  m_Name: Touch
   m_Speed: 1
   m_CycleOffset: 0
   m_Transitions:
@@ -715,6 +715,12 @@ AnimatorController:
     m_DefaultInt: 0
     m_DefaultBool: 0
     m_Controller: {fileID: 9100000}
+  - m_Name: Touch_status
+    m_Type: 4
+    m_DefaultFloat: 0
+    m_DefaultInt: 0
+    m_DefaultBool: 0
+    m_Controller: {fileID: 9100000}
   m_AnimatorLayers:
   - serializedVersion: 5
     m_Name: Base Layer
@@ -826,11 +832,11 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 0.69210476
-  m_TransitionOffset: 0.04912278
-  m_ExitTime: 0.22554438
+  m_TransitionDuration: 0.5
+  m_TransitionOffset: 0
+  m_ExitTime: 1
   m_HasExitTime: 1
-  m_HasFixedDuration: 1
+  m_HasFixedDuration: 0
   m_InterruptionSource: 0
   m_OrderedInterruption: 1
   m_CanTransitionToSelf: 1
@@ -985,7 +991,7 @@ AnimatorStateTransition:
   serializedVersion: 3
   m_TransitionDuration: 0.25
   m_TransitionOffset: 0
-  m_ExitTime: 0.75
+  m_ExitTime: 1
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -998,16 +1004,19 @@ AnimatorStateTransition:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_Name: 
-  m_Conditions: []
+  m_Conditions:
+  - m_ConditionMode: 2
+    m_ConditionEvent: Touch_status
+    m_EventTreshold: 0
   m_DstStateMachine: {fileID: 0}
   m_DstState: {fileID: 533779715773965248}
   m_Solo: 0
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 0.9434768
-  m_TransitionOffset: 0.013531265
-  m_ExitTime: 0.08284372
+  m_TransitionDuration: 1
+  m_TransitionOffset: 0
+  m_ExitTime: 0.5
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -1072,7 +1081,7 @@ AnimatorStateMachine:
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_Name: Lie
+  m_Name: LieDown
   m_ChildStates:
   - serializedVersion: 1
     m_State: {fileID: 5934876067920876819}
@@ -1107,9 +1116,9 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 3.4844563
+  m_TransitionDuration: 1
   m_TransitionOffset: 0
-  m_ExitTime: 0.04851382
+  m_ExitTime: 0.5
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -1277,7 +1286,7 @@ AnimatorState:
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_Name: bark
+  m_Name: Bark
   m_Speed: 1
   m_CycleOffset: 0
   m_Transitions:
@@ -1304,17 +1313,20 @@ AnimatorStateTransition:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_Name: 
-  m_Conditions: []
+  m_Conditions:
+  - m_ConditionMode: 2
+    m_ConditionEvent: Stand_status
+    m_EventTreshold: 0
   m_DstStateMachine: {fileID: 0}
   m_DstState: {fileID: 533779715773965248}
   m_Solo: 0
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 1.5725398
-  m_TransitionOffset: 0.03778664
-  m_ExitTime: 0.053911936
-  m_HasExitTime: 1
+  m_TransitionDuration: 1
+  m_TransitionOffset: 0
+  m_ExitTime: 0.2
+  m_HasExitTime: 0
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
   m_OrderedInterruption: 1
@@ -1360,9 +1372,9 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 0.8848174
-  m_TransitionOffset: 0.03314199
-  m_ExitTime: 0.06973055
+  m_TransitionDuration: 1
+  m_TransitionOffset: 0
+  m_ExitTime: 1
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0
@@ -1375,7 +1387,7 @@ AnimatorState:
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_Name: L Turn
+  m_Name: TurnL
   m_Speed: 1
   m_CycleOffset: 0
   m_Transitions:
@@ -1487,9 +1499,9 @@ AnimatorStateTransition:
   m_Mute: 0
   m_IsExit: 0
   serializedVersion: 3
-  m_TransitionDuration: 0.58529466
-  m_TransitionOffset: 0.78666335
-  m_ExitTime: 0
+  m_TransitionDuration: 0.5
+  m_TransitionOffset: 0
+  m_ExitTime: 1
   m_HasExitTime: 1
   m_HasFixedDuration: 1
   m_InterruptionSource: 0

+ 3 - 3
Assets/Resources/Status/StatusController.cs

@@ -222,7 +222,7 @@ public class StatusController : MonoBehaviour
             summary += GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "statusUI", "command", "Bark", EnviromentSetting.languageCode });
             summary += ", ";
         }
-        if (puppy.commandRotate)
+        if (puppy.commandShake)
         {
             summary += GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "statusUI", "command", "Rotate", EnviromentSetting.languageCode });
             summary += ", ";
@@ -232,7 +232,7 @@ public class StatusController : MonoBehaviour
             summary += GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "statusUI", "command", "LieDown", EnviromentSetting.languageCode });
             summary += ", ";
         }
-        if (puppy.commandHug)
+        if (puppy.commandTouch)
         {
             summary += GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "statusUI", "command", "Hug", EnviromentSetting.languageCode });
             summary += ", ";
@@ -390,7 +390,7 @@ public class StatusController : MonoBehaviour
     {
         // todo 重置狗的语音训练数据提示
         string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "game_message", "reset_voice_reminder", EnviromentSetting.languageCode });
-        msg = msg.Replace("<<dog name>>", UserProperty.dogs[GameData.focusDog].dog_name);
+        msg = msg.Replace("<<dog_name>>", UserProperty.dogs[GameData.focusDog].dog_name);
         MessageBoxController.YorN_Message(msg, ResetVoiceRequest);
     }
     void ResetVoiceRequest()

+ 4 - 14
Assets/Resources/UserInfo/UserInfoController.cs

@@ -77,16 +77,10 @@ public class UserInfoController : MonoBehaviour
         var data = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
         if (data != null && data["status"].ToString() == "success")
         {
-            var user_info = JsonConvert.DeserializeObject<Dictionary<string, string>>(data["user_info"].ToString());
-
-            UserProperty.name = user_info["user_name"];
-            UserProperty.coin = int.Parse(user_info["coin"]);
-            UserProperty.mobile = user_info["mobile"];
-            UserProperty.email = user_info["email"];
-            UserProperty.level = user_info["level"];
-            if (UserProperty.level == "pro") { EnviromentSetting.maxDogQty = 3; }
-            UserProperty.isRegUser = bool.Parse(user_info["isRegUser"]);
-            Debug.Log("Updated user id: " + UserProperty.userId);
+            UserProperty.name = data["user_name"].ToString();
+            UserProperty.mobile = data["mobile_number"].ToString();
+            UserProperty.email = data["email"].ToString();
+            Debug.Log("Updated user id: " + data["user_id"].ToString());
 
             string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "game_message", "update_user_info_success", EnviromentSetting.languageCode });
             MessageBoxController.ShowMessage(msg, CancelClick);
@@ -109,10 +103,6 @@ public class UserInfoController : MonoBehaviour
             }
             errorMsgLabel.text = errorText;
         }
-        else
-        {
-
-        }
     }
     // 绑定取消按键,关闭用户信息更新菜单
     void CancelClick()

+ 1 - 0
Assets/Scripts/EnviromentSetting.cs

@@ -48,6 +48,7 @@ public static class EnviromentSetting
 
     // 语音识别通过分数
     public static float voiceRecognitionScore = 0.6f;
+    public static float interactTimeoutSec = 10f; // 交互超时
 
 }
 

+ 3 - 3
Assets/Scripts/GameControllers/DogProperty.cs

@@ -47,7 +47,7 @@ public class DogProperty
     public int voiceCommand = 0;       // 识别所有口令能力
     public bool voiceCallEnable = false;
     public bool voiceCommandEnable = false;     // 暂时弃用参数
-    public bool commandSit, commandStand, commandBark, commandLieDown, commandRotate, commandHug, commandDeath, commandTurnL, commandTurnR;        // 具体的口令能力是否开启
+    public bool commandSit, commandStand, commandBark, commandLieDown, commandShake, commandTouch, commandDeath, commandTurnL, commandTurnR;        // 具体的口令能力是否开启
 
     public int CommandTrainingPhase()
     {
@@ -56,8 +56,8 @@ public class DogProperty
         if (commandStand) phase++;
         if (commandBark) phase++;
         if (commandLieDown) phase++;
-        if (commandRotate) phase++;
-        if (commandHug) phase++;
+        if (commandShake) phase++;
+        if (commandTouch) phase++;
         if (commandDeath) phase++;
         if (commandTurnL) phase++;
         if (commandTurnR) phase++;

+ 2 - 2
Assets/Scripts/Home/DogInScene.cs

@@ -201,12 +201,12 @@ public class DogInScene //: ScriptableObject
     }
 
     // 交互动画行为计时器(暂时设定为6秒)
-    public IEnumerator InteractAnimationCountDown(float seconds = 6.0f)
+    public IEnumerator InteractAnimationCountDown()
     {
 
         TimeSpan ts = new TimeSpan();
         ts = DateTime.Now - this.interactAnimationStartTime;
-        if (ts.TotalSeconds < 6)
+        if (ts.TotalSeconds < EnviromentSetting.interactTimeoutSec)
         {
             yield return new WaitForSeconds(0.25f);
         }

+ 5 - 3
Assets/Scripts/Home/HomeController.cs

@@ -159,11 +159,11 @@ public class HomeController : MonoBehaviour
                         {
                             // 当狗的voiceCommand大于等于40并且完成第一阶段所有训练,进入第二阶段指令训练模式
                             int random = UnityEngine.Random.Range(0, 100);
-                            if (GameTool.IntBetween(0, 20, random) && !dog.dogProperty.commandRotate)
+                            if (GameTool.IntBetween(0, 20, random) && !dog.dogProperty.commandShake)
                             {
                                 trainingContent = "commandRotate";
                             }
-                            else if (GameTool.IntBetween(20, 40, random) && !dog.dogProperty.commandHug)
+                            else if (GameTool.IntBetween(20, 40, random) && !dog.dogProperty.commandTouch)
                             {
                                 trainingContent = "commandHug";
                             }
@@ -675,7 +675,8 @@ public class HomeController : MonoBehaviour
                     {
                         HomeSoundEffectController.Instance.PlaySoundEffect(5);
                     }
-                    animator.SetTrigger(animationTrigger);
+                    //animator.SetTrigger(animationTrigger);
+                    animator.Play(animationTrigger);
                     animator.SetBool(animationBool, true);
 
                     // 交互动画执行一段时间后停止
@@ -684,6 +685,7 @@ public class HomeController : MonoBehaviour
                 else
                 {
                     HomeSoundEffectController.Instance.PlaySoundEffect(4);
+                    dogsInScene[GameData.focusDog].PlayQuestionMark();
                 }
             }
             else

+ 1 - 2
Assets/Scripts/Home/UserFeedbackController.cs

@@ -12,8 +12,7 @@ public class UserFeedbackController : MonoBehaviour
     private DropdownField type;
     private TextField feedback;
     private Button submit, cancel;
-    private string typeOption0, typeOption1;
-    void Awake()
+    void OnEnable()
     {
         var root = GetComponent<UIDocument>().rootVisualElement;
         type = root.Q<DropdownField>("type");

+ 4 - 0
Assets/UI Toolkit/Style/rootStyle.uss

@@ -87,6 +87,10 @@
 }
 
 .textField__multiline > .unity-base-field__input > .unity-base-text-field__multiline-container {
+    margin-top: 2px;
+    margin-right: 2px;
+    margin-bottom: 2px;
+    margin-left: 2px;
 }
 
 .err_msg {