Quellcode durchsuchen

获取地址时要先声明(谷歌过审要求)

lvjincheng vor 3 Jahren
Ursprung
Commit
02201f53f7

+ 1 - 1
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/cn.json

@@ -136,7 +136,7 @@
     "MagInterferenceTip_content": "由于地磁计初始化易受到周围环境的影响,因此在初始化过程中请按照以下步骤来做:\n1、请在初始化过程中,保持周围环境的稳定,远离金属物体和磁场干扰。\n2、请保持智能弓箭模块和手机、电视等电子设备0.5米以上的距离。\n3、请将安装了模块的智能弓箭或单独模块沿着XYZ三轴进行充分地旋转,直到提示完成为止。\n4、如多次无法完成初始化,也可继续使用,只是瞄准的精度会受到影响,游戏中需多做一次视角归位的操作。",
     "MagInterferenceTip_ok": "确定",
 
-    "Model_Location-Prominent": "{0}收集位置数据,即使应用程序关闭或未使用,也能连接弓箭模块。",
+    "Model_Location-Prominent": "{0}收集位置数据,即使应用程序关闭或未使用,也能连接弓箭模块和参与地区排行。",
 
     "lebo_viewname": "乐播投屏",
     "lebo_browseTip": "正在不断搜索可用设备...",

+ 1 - 1
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/en.json

@@ -136,7 +136,7 @@
     "MagInterferenceTip_content": "Since the initialization of the magnetometer is vulnerable to the influence of the surrounding environment, please follow the following steps in the initialization process: \n1. Please keep the surrounding environment stable and away from metal objects and magnetic field interference during the initialization process. \n2. Please keep a distance of more than 0.5m between the smart bow module and electronic devices such as mobile phones and televisions. \n3. Please fully rotate the smart bow or individual module with the module installed along the XYZ axis until the prompt is completed. \n4. If the initialization cannot be completed for many times, it can still be used. However, the accuracy of aiming will be affected, and the game needs to do one more angle of view homing operation.",
     "MagInterferenceTip_ok": "OK",
 
-    "Model_Location-Prominent": "{0} collects location data to enable the bow module connecting even when the app is closed or not in use.",
+    "Model_Location-Prominent": "{0} collects location data to enable the bow module connecting and ranked in the region even when the app is closed or not in use.",
 
     "lebo_viewname": "Screen Projection",
     "lebo_browseTip": "Constantly searching for available devices...",

+ 18 - 13
Assets/BowArrow/Scripts/Network/UserPlayer.cs

@@ -105,19 +105,24 @@ public class UserPlayer : JCEntity
                         }
                     }
                 }
-                GPSTool.GetAddress((address) => {
-                    if (address != null) {
-                        Debug.Log("登陆时获取地理位置成功:" + string.Join(" ", address));
-                        if (LoginMgr.myUserInfo.country == address[0]
-                            && LoginMgr.myUserInfo.state == address[1]
-                            && LoginMgr.myUserInfo.city == address[2]
-                        ) return;
-                        LoginMgr.myUserInfo.country = address[0];
-                        LoginMgr.myUserInfo.state = address[1];
-                        LoginMgr.myUserInfo.city = address[2];
-                        LoginMgr.myUserInfo.Save();
-                    }
-                });
+                if (SceneManager.GetActiveScene().name.Equals("Home")) {
+                    var eOnAgree = () => {
+                        GPSTool.GetAddress((address) => {
+                            if (address != null) {
+                                Debug.Log("登陆时获取地理位置成功:" + string.Join(" ", address));
+                                if (LoginMgr.myUserInfo.country == address[0]
+                                    && LoginMgr.myUserInfo.state == address[1]
+                                    && LoginMgr.myUserInfo.city == address[2]
+                                ) return;
+                                LoginMgr.myUserInfo.country = address[0];
+                                LoginMgr.myUserInfo.state = address[1];
+                                LoginMgr.myUserInfo.city = address[2];
+                                LoginMgr.myUserInfo.Save();
+                            }
+                        });
+                    };
+                    if (HomeView.ins && !HomeView.ins.ShowProminentBeforeConnectBLE(eOnAgree)) eOnAgree.Invoke();
+                }
             });            
         } else {
             handleAuthExpire();

+ 6 - 1
Assets/BowArrow/Scripts/View/HomeView.cs

@@ -73,7 +73,7 @@ public class HomeView : MonoBehaviour
         }
     }
 
-    public bool ShowProminentBeforeConnectBLE()
+    public bool ShowProminentBeforeConnectBLE(Action onAgree = null)
     {
         if (PlayerPrefs.GetInt("Location-Prominent", 0) == 0) {
             ModalView m = ModalView.Show();
@@ -82,6 +82,11 @@ public class HomeView : MonoBehaviour
             m.textFormatArgs = new object[] {pName};
             m.onAgree = () => {
                 PlayerPrefs.SetInt("Location-Prominent", 1);
+                try { 
+                    onAgree?.Invoke(); 
+                } catch (System.Exception e) { 
+                    Debug.LogError(e.Message + "\n" + e.StackTrace); 
+                } 
             };
             return true;
         }