Explorar el Código

6/21更新

添加领养狗的时候验证码处理
Jees hace 23 horas
padre
commit
ae05b668e2

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

@@ -903,6 +903,10 @@
             "email_format_wrong": {
                 "en": "* Please use correct E-mail address.",
                 "zh-cn": "* 请输入正确的电子邮箱。"
+            },
+            "too_many_attempts": {
+                "en": "* Too many attempts. Please try again later.",
+                "zh-cn": "* 尝试次数过多,请稍后再试。"
             }
         }
     },

+ 4 - 3
Assets/Scripts/Login/CreateOrAdopt.cs

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

+ 13 - 4
Assets/Scripts/Login/ResetUIController.cs

@@ -67,6 +67,8 @@ public class ResetUIController : MonoBehaviour
         errorMessageDict.Add("wrong_verification_code", textValue);
         textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "error_msg", "email_format_wrong", EnviromentSetting.languageCode });
         errorMessageDict.Add("email_format_wrong", textValue);
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "error_msg", "too_many_attempts", EnviromentSetting.languageCode });
+        errorMessageDict.Add("too_many_attempts", textValue);
 
         cancel.clicked += CancelClick;
         submit.clicked += SubmitClick;
@@ -127,7 +129,7 @@ public class ResetUIController : MonoBehaviour
         else if (sceneCondition.GetHashCode()  == 2)
         {
             // 输入验证码阶段和输入新密码阶段
-            NewPassowrdRequest();
+            NewPasswordRequest();
 
         }
     }
@@ -168,16 +170,22 @@ public class ResetUIController : MonoBehaviour
         }
         else if (data != null && data["status"] == "error")
         {
+            int errorCode = int.Parse(data["code"]);
             // 找不到对应的账户
-            if (data["message"] == "cannot find account")
+            if (errorCode == 610)
             {
                 errorText += errorMessageDict["cannot_find_account"];
             }
+            // 尝试太多次数
+            if (errorCode == 612)
+            {
 
+                errorText += errorMessageDict["too_many_attempts"];
+            }
         }
     }
 
-    void NewPassowrdRequest()
+    void NewPasswordRequest()
     {
         // 检查验证码
         string url = "/api/reset/password/step2/";
@@ -210,8 +218,9 @@ public class ResetUIController : MonoBehaviour
         }
         else if (data != null && data["status"] == "error")
         {
+            int errorCode = int.Parse(data["code"]);
             // 验证码错误
-            if (data["message"] == "wrong verification code")
+            if (errorCode == 611)
             {
                 errorText += errorMessageDict["wrong_verification_code"];
             }