Browse Source

问题修复

lvjincheng 3 years ago
parent
commit
1a4b8351df

+ 28 - 34
Assets/BowArrow/Scripts/Entry.cs

@@ -43,34 +43,34 @@ public class Entry : MonoBehaviour
     bool appVersionCheckOK = false;
 
     IEnumerator CheckAppVersion() {
-        countStr1 += "a";
-        string url = CommonConfig.businessServerURI + "/app/checkAppVersion?appVersion=" + appVersion;
-        countStr1 += "b";
-        using (UnityWebRequest request = UnityWebRequest.Get(url)) {
-            countStr1 += "c";
-            yield return request.SendWebRequest();
-            countStr1 += "d";
-            if (request.result == UnityWebRequest.Result.Success) {
-                countStr1 += "e";
-                appVersionCheckOK = bool.Parse(request.downloadHandler.text);
-                countStr1 += "f";
-                if (appVersionCheckOK) {
-                    countStr1 += "g";
-                    //等场景加载完再提示
-                } else {
-                    countStr1 += "h";
-                    SetTip("请安装最新版本软件", Color.yellow);
-                    DelayQuit();
-                }
-            } else {
-                countStr1 += "i";
-                SetTip("读取服务端软件版本配置失败", Color.red);
-                DelayQuit();
-            }
-            countStr1 += "j";
-        }
-        countStr1 += "k";
-        Debug.Log("countStr1:" + countStr1);
+        // countStr1 += "a";
+        // string url = CommonConfig.businessServerURI + "/app/checkAppVersion?appVersion=" + appVersion;
+        // countStr1 += "b";
+        // using (UnityWebRequest request = UnityWebRequest.Get(url)) {
+        //     countStr1 += "c";
+        //     yield return request.SendWebRequest();
+        //     countStr1 += "d";
+        //     if (request.result == UnityWebRequest.Result.Success) {
+        //         countStr1 += "e";
+        //         appVersionCheckOK = bool.Parse(request.downloadHandler.text);
+        //         countStr1 += "f";
+        //         if (appVersionCheckOK) {
+        //             countStr1 += "g";
+        //             //等场景加载完再提示
+        //         } else {
+        //             countStr1 += "h";
+        //             SetTip("请安装最新版本软件", Color.yellow);
+        //         }
+        //     } else {
+        //         countStr1 += "i";
+        //         SetTip("读取服务端软件版本配置失败", Color.red);
+        //     }
+        //     countStr1 += "j";
+        // }
+        // countStr1 += "k";
+        // Debug.Log("countStr1:" + countStr1);
+        yield return null;
+        appVersionCheckOK = true;
     }
 
     float timeOnStartLoadScene;
@@ -121,12 +121,6 @@ public class Entry : MonoBehaviour
         tipText.fontSize = fontSize;
     }
 
-    void DelayQuit() {
-        DoTweenUtil.CallDelay(3f, () => {
-            Application.Quit();
-        });
-    }
-
     int counter = 0;
     string countStr1 = "";
     string countStr2 = "";

+ 6 - 10
Assets/BowArrow/Scripts/Network/UserPlayer.cs

@@ -50,6 +50,7 @@ public class UserPlayer : JCEntity
     }
 
     public void Close() {
+        PlayerPrefs.DeleteKey("IdAndToken");
         if (ins == this) ins = null;
         this.canReconnnect = false;
         this.channel.close();
@@ -64,7 +65,8 @@ public class UserPlayer : JCEntity
                 p0 = "12&f29f72fcba4b4a63aa4f965b5d603a4e";
             } 
         #endif
-        call("authToken", p0);
+        string p1 = SceneManager.GetActiveScene().name;
+        call("authToken2", p0, p1);
     }
 
     //被服务端调用的函数
@@ -86,25 +88,19 @@ public class UserPlayer : JCEntity
                 }
             });            
         } else {
-            //clear token info
-            PlayerPrefs.DeleteKey("IdAndToken");
             //tip
             if (HomeMgr.ins && HomeMgr.ins.IsAuthLoginMaskActive()) {
                 HomeMgr.ins.SetAuthLoginText(TextAutoLanguage2.GetTextByCNKey("登录认证过期"));
             } else {
                 PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByCNKey("登录认证过期"));
             }
-            //delay back login or quit
+            //delay back login
             Sequence seq = DOTween.Sequence();
             seq.AppendInterval(1.5f);
             seq.AppendCallback(() => {
-                 if (SceneManager.GetActiveScene().name == "Home") {
-                    SceneManager.LoadScene("Login", LoadSceneMode.Single);
-                } else {
-                    Application.Quit();
-                }
+                SceneManager.LoadScene("Login", LoadSceneMode.Single);
             });
-            //close socket
+            //close userplayer
             Close();
         }
     }

+ 1 - 2
Assets/BowArrow/Scripts/View/SetUpView1.cs

@@ -67,9 +67,8 @@ public class SetUpView1 : MonoBehaviour, MenuBackInterface
     public void QuitLogin() 
     {
         AudioMgr.ins.PlayBtn();
-        PlayerPrefs.DeleteKey("IdAndToken");
+        UserPlayer.ins?.Close();
         SceneManager.LoadScene("Login", LoadSceneMode.Single);
-        if (UserPlayer.ins != null) UserPlayer.ins.Close();
     }
 
     public void Back() {