|
|
@@ -21,7 +21,7 @@ public class Entry : MonoBehaviour
|
|
|
// Application.targetFrameRate = 60;
|
|
|
QualitySettings.vSyncCount = 1;
|
|
|
// SetTip("Loading", Color.white, 56);
|
|
|
- versionText.text = "Version_" + appVersion + "_R5";
|
|
|
+ versionText.text = "Version_" + appVersion + "_R6";
|
|
|
//SetTip("正在检测对比软件版本", Color.white);
|
|
|
StartCoroutine(CheckAppVersion());
|
|
|
StartCoroutine(AsyncLoadScene());
|
|
|
@@ -33,6 +33,8 @@ public class Entry : MonoBehaviour
|
|
|
long t2 = JC.CS.Utility.GetTimestamp();
|
|
|
Debug.Log($"场景{scene.name}销毁,释放资源和GC回收的总耗时={t2 - t1}ms");
|
|
|
};
|
|
|
+
|
|
|
+ PersistenHandler.Init();
|
|
|
}
|
|
|
|
|
|
[SerializeField] Text versionText;
|
|
|
@@ -40,49 +42,74 @@ 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);
|
|
|
}
|
|
|
|
|
|
float timeOnStartLoadScene;
|
|
|
IEnumerator AsyncLoadScene() {
|
|
|
+ countStr2 += "a";
|
|
|
timeOnStartLoadScene = Time.realtimeSinceStartup;
|
|
|
//加载场景名
|
|
|
string sceneName = "Login";
|
|
|
if (LoginMgr.HasToken()) {
|
|
|
sceneName = "Home";
|
|
|
}
|
|
|
+ countStr2 += sceneName;
|
|
|
//异步加载场景
|
|
|
AsyncOperation async = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
|
|
|
+ countStr2 += "b";
|
|
|
//阻止当加载完成自动切换
|
|
|
async.allowSceneActivation = false;
|
|
|
+ countStr2 += "c";
|
|
|
while (!async.isDone) {
|
|
|
if (async.progress >= 0.9f) {
|
|
|
+ countStr2 += "e";
|
|
|
break;
|
|
|
}
|
|
|
+ if (!countStr2.Contains("d")) countStr2 += "d";
|
|
|
yield return null;
|
|
|
}
|
|
|
+ countStr2 += "f";
|
|
|
while (!appVersionCheckOK) {
|
|
|
+ if (!countStr2.Contains("@")) countStr2 += "@";
|
|
|
yield return null;
|
|
|
}
|
|
|
+ countStr2 += "g";
|
|
|
while (Time.realtimeSinceStartup - timeOnStartLoadScene < 1.5) {
|
|
|
+ if (!countStr2.Contains("%")) countStr2 += "%";
|
|
|
yield return null;
|
|
|
}
|
|
|
+ countStr2 += "h";
|
|
|
async.allowSceneActivation = true;
|
|
|
+ countStr2 += "i";
|
|
|
+ Debug.Log("countStr2:" + countStr2);
|
|
|
//SetTip("软件版本校验成功", Color.green);
|
|
|
}
|
|
|
|
|
|
@@ -98,4 +125,15 @@ public class Entry : MonoBehaviour
|
|
|
Application.Quit();
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ int counter = 0;
|
|
|
+ string countStr1 = "";
|
|
|
+ string countStr2 = "";
|
|
|
+ void OnGUI()
|
|
|
+ {
|
|
|
+ GUIStyle labelFont = new GUIStyle();
|
|
|
+ labelFont.normal.textColor = new Color(1, 0.6f, 0.6f);
|
|
|
+ labelFont.fontSize = 40;
|
|
|
+ GUI.Label(new Rect(Screen.width/10,Screen.height/10,200,200), (counter++) + "," + countStr1 + "," + countStr2, labelFont);
|
|
|
+ }
|
|
|
}
|