From 8e044cbb49d34106b8c96e35d9087577b809e80f Mon Sep 17 00:00:00 2001 From: Tao Laurent <tlaurent@NT.LIRMM.FR> Date: Mon, 11 Jul 2022 14:04:16 +0200 Subject: [PATCH] updated loading of InterfaceManager in WebGL to look at the version file in build (for the moment it is Beta Only) --- .../Assets/Interface/InterfaceManager.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/MorphoNet/Assets/Interface/InterfaceManager.cs b/MorphoNet/Assets/Interface/InterfaceManager.cs index 9a12bc15..e6bb5ae5 100644 --- a/MorphoNet/Assets/Interface/InterfaceManager.cs +++ b/MorphoNet/Assets/Interface/InterfaceManager.cs @@ -13,6 +13,7 @@ using UnityEngine; using UnityEngine.UI; using Button = UnityEngine.UI.Button; using Screen = UnityEngine.Screen; +using UnityEngine.Networking; public class InterfaceManager : MonoBehaviour { @@ -1692,6 +1693,46 @@ public class InterfaceManager : MonoBehaviour MenuShortcuts.transform.Find("version").gameObject.transform.GetComponent<Text>().text="Version "+reader.ReadToEnd()+ " ("+readergit.ReadToEnd()+")"; reader.Close(); readergit.Close(); +#else + string GitVersion=""; string Version=""; + bool VersionFound=true; + UnityWebRequest www = UnityWebRequests.Get(MorphoTools.GetServer(), "MorphoNet/Beta/StreamingAssets/version.txt"); + yield return www.SendWebRequest(); + if (www.isHttpError || www.isNetworkError) + { + InterfaceManager.instance.setComment("Error during version number loading : " + www.error); + } + else + { + if (www.downloadHandler.text != "") + { + Version = www.downloadHandler.text; + } + else + VersionFound = false; + } + if (VersionFound) + { + UnityWebRequest www2 = UnityWebRequests.Get(MorphoTools.GetServer(), "MorphoNet/Beta/StreamingAssets/gitversion.txt"); + yield return www2.SendWebRequest(); + if (www2.isHttpError || www2.isNetworkError) + { + InterfaceManager.instance.setComment("Error during version number loading : " + www2.error); + } + else + { + if (www2.downloadHandler.text != "") + { + GitVersion = www2.downloadHandler.text; + } + else + VersionFound = false; + } + } + if(VersionFound) + MenuShortcuts.transform.Find("version").gameObject.transform.GetComponent<Text>().text = "Version " + Version + " (" + GitVersion + ")"; + + #endif -- GitLab