lvjincheng 4 роки тому
батько
коміт
1c5fd7a9eb

+ 30 - 18
Assets/BowArrow/Scenes/Login.unity

@@ -1315,7 +1315,7 @@ RectTransform:
   - {fileID: 1154515702}
   - {fileID: 920161640}
   m_Father: {fileID: 239919974}
-  m_RootOrder: 3
+  m_RootOrder: 4
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
@@ -2429,6 +2429,7 @@ RectTransform:
   m_LocalScale: {x: 0, y: 0, z: 0}
   m_Children:
   - {fileID: 813754774}
+  - {fileID: 681531955}
   - {fileID: 894239524}
   - {fileID: 261231101}
   - {fileID: 106161737}
@@ -2702,7 +2703,7 @@ RectTransform:
   - {fileID: 2005827719}
   - {fileID: 979076807}
   m_Father: {fileID: 239919974}
-  m_RootOrder: 2
+  m_RootOrder: 3
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
@@ -3742,7 +3743,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.180458, y: 0}
+  m_AnchoredPosition: {x: 34.918293, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &355551584
@@ -5425,8 +5426,9 @@ GameObject:
   - component: {fileID: 681531958}
   - component: {fileID: 681531957}
   - component: {fileID: 681531956}
+  - component: {fileID: 681531960}
   m_Layer: 5
-  m_Name: Agreement
+  m_Name: AgreenmentOption
   m_TagString: Untagged
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
@@ -5439,7 +5441,7 @@ RectTransform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 681531954}
-  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children:
@@ -5448,8 +5450,8 @@ RectTransform:
   - {fileID: 1549087751}
   - {fileID: 1900702358}
   - {fileID: 1628073322}
-  m_Father: {fileID: 894239524}
-  m_RootOrder: 12
+  m_Father: {fileID: 239919974}
+  m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
@@ -5534,6 +5536,18 @@ CanvasRenderer:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 681531954}
   m_CullTransparentMesh: 1
+--- !u!114 &681531960
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 681531954}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: fd60a0b8a3de3814c9bce50c2515f709, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
 --- !u!1 &700181132
 GameObject:
   m_ObjectHideFlags: 0
@@ -6064,7 +6078,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: 118.95336, y: 0}
+  m_AnchoredPosition: {x: 114.704796, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &750604318
@@ -6994,9 +7008,8 @@ RectTransform:
   - {fileID: 118209002}
   - {fileID: 306981414}
   - {fileID: 627835919}
-  - {fileID: 681531955}
   m_Father: {fileID: 239919974}
-  m_RootOrder: 1
+  m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
@@ -7027,7 +7040,6 @@ MonoBehaviour:
   loginInCode: {fileID: 1275536125}
   loginValidTime: {fileID: 1393089227}
   loginInCaptcha2: {fileID: 1666954136}
-  agreementTF: {fileID: 681531955}
   captcha_Login: -222222222
   captcha_LoginPhone: -222222222
 --- !u!1 &912071297
@@ -7671,7 +7683,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 1}
   m_AnchorMax: {x: 0.5, y: 1}
-  m_AnchoredPosition: {x: 45, y: -594}
+  m_AnchoredPosition: {x: 45, y: -540}
   m_SizeDelta: {x: 197, y: 61}
   m_Pivot: {x: 0.5, y: 1}
 --- !u!114 &979076808
@@ -10658,7 +10670,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: 255.88007, y: 0}
+  m_AnchoredPosition: {x: 244.95518, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1549087752
@@ -11075,7 +11087,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: 385.81345, y: 0}
+  m_AnchoredPosition: {x: 368.81918, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1628073323
@@ -11963,7 +11975,7 @@ RectTransform:
   m_Children:
   - {fileID: 241269955}
   m_Father: {fileID: 239919974}
-  m_RootOrder: 4
+  m_RootOrder: 5
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
@@ -12797,7 +12809,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: 113.53693, y: 0}
+  m_AnchoredPosition: {x: 112.34581, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1847328316
@@ -13282,7 +13294,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: 320.84677, y: 0}
+  m_AnchoredPosition: {x: 306.8872, y: 0}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1900702359
@@ -13820,7 +13832,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 1}
   m_AnchorMax: {x: 0.5, y: 1}
-  m_AnchoredPosition: {x: 45, y: -594}
+  m_AnchoredPosition: {x: 45, y: -540}
   m_SizeDelta: {x: 197, y: 61}
   m_Pivot: {x: 0.5, y: 1}
 --- !u!114 &2005827720

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

@@ -15,18 +15,21 @@ public class LoginMgr : MonoBehaviour
         loginView.SetActive(false);
         registerView.SetActive(true);
         forgetPWD_View.SetActive(false);
+        AgreenmentOption.ins.gameObject.SetActive(true);
     }
 
     public void showLoginView() {
         loginView.SetActive(true);
         registerView.SetActive(false);
         forgetPWD_View.SetActive(false);
+        AgreenmentOption.ins.gameObject.SetActive(true);
     }
 
     public void showForgetPWD_View() {
         loginView.SetActive(false);
         registerView.SetActive(false);
         forgetPWD_View.SetActive(true);
+        AgreenmentOption.ins.gameObject.SetActive(false);
     }
 
     public static bool HasToken() {

+ 3 - 3
Assets/BowArrow/Scripts/Manager/LoginView/AgreementPopup.cs

@@ -8,20 +8,20 @@ public class AgreementPopup : MonoBehaviour
     {
         if (PlayerPrefs.GetInt("AgreementPopupChecked", 0) == 1) {
             this.gameObject.SetActive(false);
-            LoginView.ins.SetAgreementChecked(true);
+            AgreenmentOption.ins.SetAgreementChecked(true);
         }
     }
 
     public void Agree() {
         PlayerPrefs.SetInt("AgreementPopupChecked", 1);
         this.gameObject.SetActive(false);
-        LoginView.ins.SetAgreementChecked(true);
+        AgreenmentOption.ins.SetAgreementChecked(true);
     }
     [System.NonSerialized] public System.Action onDisagree;
     public void Disagree() {
         PlayerPrefs.SetInt("AgreementPopupChecked", 0);
         this.gameObject.SetActive(false);
-        LoginView.ins.SetAgreementChecked(false);
+        AgreenmentOption.ins.SetAgreementChecked(false);
         onDisagree?.Invoke();
     }
 

+ 37 - 0
Assets/BowArrow/Scripts/Manager/LoginView/AgreenmentOption.cs

@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class AgreenmentOption : MonoBehaviour
+{
+    public static AgreenmentOption ins;
+
+    void Awake() {
+        ins = this;
+        InitAgreementOnClickListeners();
+    }
+
+    void OnDestroy() {
+        if (ins == this) ins = null;
+    }
+
+    void InitAgreementOnClickListeners() {
+        transform.Find("TextA").GetComponent<Button>().onClick.AddListener(delegate() {
+            GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
+            o.GetComponent<AgreementView>().EnterUserAgreement();
+        });
+        transform.Find("TextB").GetComponent<Button>().onClick.AddListener(delegate() {
+            GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
+            o.GetComponent<AgreementView>().EnterPrivacyAgreement();
+        });
+    }
+
+    public bool IsAgreementChecked() {
+        return transform.Find("Toggle").GetComponent<Toggle>().isOn; 
+    }
+
+    public void SetAgreementChecked(bool value) {
+        transform.Find("Toggle").GetComponent<Toggle>().isOn = value;
+    }
+}

+ 11 - 0
Assets/BowArrow/Scripts/Manager/LoginView/AgreenmentOption.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fd60a0b8a3de3814c9bce50c2515f709
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 20
Assets/BowArrow/Scripts/Manager/LoginView/LoginView.cs

@@ -21,8 +21,6 @@ public class LoginView : MonoBehaviour
     [SerializeField] GameObject loginInCode;
     [SerializeField] GameObject loginValidTime;
     [SerializeField] GameObject loginInCaptcha2;
-    //协议栏
-    [SerializeField] Transform agreementTF;
 
     int loginMode = 1;
 
@@ -43,7 +41,6 @@ public class LoginView : MonoBehaviour
     void Start()
     {
         InitInputLimit();
-        InitAgreementOnClickListeners();
         SelectLoginMode(1);
     }
 
@@ -81,17 +78,6 @@ public class LoginView : MonoBehaviour
         }
     }
 
-    void InitAgreementOnClickListeners() {
-        agreementTF.Find("TextA").GetComponent<Button>().onClick.AddListener(delegate() {
-            GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
-            o.GetComponent<AgreementView>().EnterUserAgreement();
-        });
-        agreementTF.Find("TextB").GetComponent<Button>().onClick.AddListener(delegate() {
-            GameObject o = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/Views/AgreementView"));
-            o.GetComponent<AgreementView>().EnterPrivacyAgreement();
-        });
-    }
-
     public void SelectLoginMode(int mode) {
         loginMode = mode;
         if (loginMode == 1) {
@@ -167,8 +153,8 @@ public class LoginView : MonoBehaviour
             PopupMgr.ins.ShowTip("验证码错误");
             return;
         }
-        if (!agreementTF.Find("Toggle").GetComponent<Toggle>().isOn) {
-            PopupMgr.ins.ShowTip("登录需要勾选同意App协议");
+        if (!AgreenmentOption.ins.IsAgreementChecked()) {
+            PopupMgr.ins.ShowTip("请阅读并同意App协议");
             return;
         }
         if (throttlerLoginNormal.CanPass() == false) {
@@ -191,10 +177,6 @@ public class LoginView : MonoBehaviour
 
     }
 
-    public void SetAgreementChecked(bool value) {
-        agreementTF.Find("Toggle").GetComponent<Toggle>().isOn = value;
-    }
-
     public void FillLoginInput(string username, string password) {
         GetInputField(loginInUser).text = username;
         GetInputField(loginInPWD).text = password;

+ 8 - 0
Assets/BowArrow/Scripts/Manager/LoginView/RegisterView.cs

@@ -108,6 +108,10 @@ public class RegisterView : MonoBehaviour
             PopupMgr.ins.ShowTip("验证码错误");
             return;
         }
+        if (!AgreenmentOption.ins.IsAgreementChecked()) {
+            PopupMgr.ins.ShowTip("请阅读并同意App协议");
+            return;
+        }
         if (throttlerRegisterNext.CanPass() == false) {
             PopupMgr.ins.ShowTip("操作过于频繁");
             return;
@@ -150,6 +154,10 @@ public class RegisterView : MonoBehaviour
             PopupMgr.ins.ShowTip("未填写所在地区");
             return;
         }
+        if (!AgreenmentOption.ins.IsAgreementChecked()) {
+            PopupMgr.ins.ShowTip("请阅读并同意App协议");
+            return;
+        }
         if (throttlerRegisterSave.CanPass() == false) {
             PopupMgr.ins.ShowTip("操作过于频繁");
             return;