Bladeren bron

手机登录

lvjincheng 3 jaren geleden
bovenliggende
commit
eb5d58b93d

+ 7 - 7
Assets/BowArrow/Scenes/Login.unity

@@ -420,7 +420,7 @@ MonoBehaviour:
   m_LineType: 0
   m_HideMobileInput: 0
   m_CharacterValidation: 1
-  m_CharacterLimit: 18
+  m_CharacterLimit: 11
   m_OnEndEdit:
     m_PersistentCalls:
       m_Calls: []
@@ -3823,7 +3823,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 35.291496, y: 0}
+  m_AnchoredPosition: {x: 35.06087, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &355551584
@@ -6174,7 +6174,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 117.346825, y: 0}
+  m_AnchoredPosition: {x: 116.8087, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &750604318
@@ -10990,7 +10990,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 251.74898, y: 0}
+  m_AnchoredPosition: {x: 250.36523, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1549087752
@@ -11527,7 +11527,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 379.3873, y: 0}
+  m_AnchoredPosition: {x: 377.2348, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1628073323
@@ -13551,7 +13551,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 114.43001, y: 0}
+  m_AnchoredPosition: {x: 113.53044, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1847328316
@@ -14037,7 +14037,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 315.56815, y: 0}
+  m_AnchoredPosition: {x: 313.80002, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1900702359

+ 33 - 4
Assets/BowArrow/Scripts/Manager/LoginView/LoginView.cs

@@ -90,6 +90,11 @@ public class LoginView : MonoBehaviour
             loginInCode.SetActive(false);
             loginValidTime.SetActive(false);
             loginInCaptcha2.SetActive(false);
+
+            Transform btnRegister = transform.Find("BtnRegister");
+            Vector3 v31 = btnRegister.localPosition; v31.y = -168.5f;
+            btnRegister.localPosition = v31;
+
             if (captcha_Login < 0) {
                 ChnageCaptcha1();
             }
@@ -101,9 +106,17 @@ public class LoginView : MonoBehaviour
             loginInPWD.SetActive(false);
             loginInCaptcha1.SetActive(false);
             loginInPhone.SetActive(true);
-            loginInCode.SetActive(true);
-            loginValidTime.SetActive(true);
-            loginInCaptcha2.SetActive(true);
+            loginInCode.SetActive(false);
+            loginValidTime.SetActive(false);
+            loginInCaptcha2.SetActive(false);
+
+            Transform btnInPhone = loginInPhone.transform;
+            Vector3 v30 = btnInPhone.localPosition; v30.y = -30f;
+            btnInPhone.localPosition = v30;
+            Transform btnRegister = transform.Find("BtnRegister");
+            Vector3 v31 = btnRegister.localPosition; v31.y = -88;
+            btnRegister.localPosition = v31;
+
             if (captcha_LoginPhone < 0) {
                 ChnageCaptcha2();
             }
@@ -174,7 +187,23 @@ public class LoginView : MonoBehaviour
     }
 
     void LoginByPhone() {
-
+        InputField user = GetInputField(loginInPhone);
+        Regex regex = new Regex(@"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$");
+        bool isMobilePhone = regex.IsMatch(user.text);
+        if (!isMobilePhone) {
+            PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("手机号格式不正确"));
+            return;
+        }
+        StartCoroutine(LoginController.ins.LoginByPhone(
+            user.text, (res) => {
+                PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey(res.msg));
+                if (res.code == 0) {
+                    string IdAndToken = (string)res.data;
+                    PlayerPrefs.SetString("IdAndToken", IdAndToken);
+                    SceneManager.LoadScene("Home", LoadSceneMode.Single);
+                }
+            }
+        ));
     }
 
     public void FillLoginInput(string username, string password) {

+ 10 - 0
Assets/BowArrow/Scripts/Network/HttpController/LoginController.cs

@@ -50,6 +50,16 @@ public class LoginController : Singleton<LoginController>
         RequestResult requestResult = JsonConvert.DeserializeObject<RequestResult>(request.downloadHandler.text);
         if (callback != null) callback(requestResult);
     }
+
+    public IEnumerator LoginByPhone(string phone, Action<RequestResult> callback) {
+        string url = CommonConfig.businessServerURI + "/gameLogin/loginByPhone";
+        WWWForm form = new WWWForm();
+        form.AddField("phone", phone);
+        UnityWebRequest request = UnityWebRequest.Post(url, form);
+        yield return request.SendWebRequest();
+        RequestResult requestResult = JsonConvert.DeserializeObject<RequestResult>(request.downloadHandler.text);
+        if (callback != null) callback(requestResult);
+    }
 }
 
 public class RequestResult {