From 4804cc145f304908546d7e635e586e90427419ed Mon Sep 17 00:00:00 2001 From: Stefan Richter <o-s-r1993@web.de> Date: Fri, 27 Jan 2023 19:33:32 +0100 Subject: [PATCH] added network error-messages for things that never should happen --- .../InteractionEngine/CommunicationEvents.cs | 15 ++++---- .../Scripts/Loading/StreamingAssetLoader.cs | 36 +++++++++--------- .../Scripts/UI/NetwMenue/StartMenue_mobile.cs | 14 +++---- .../Config/Network.JSON | 37 +++++++++---------- .../com.unity.probuilder/Settings.json | 5 +++ 5 files changed, 57 insertions(+), 50 deletions(-) diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index be559e69..7cf79e73 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -38,9 +38,9 @@ public static class CommunicationEvents //CHANGE HERE PORT OF SERVER public static string ServerPortDefault = "8085"; //used for Local - public static string ServerAddressLocalhost = "http://localhost"; //Without Port - public static string ServerAddressLocal = "http://localhost:8085"; // "http://localhost:8085" - public static string ServerAdress = "http://localhost:8085"; //need "http://" //used by dispalyScrolls.cs //http://10.231.4.95:8085"; + public static string ServerAddressLocalhost = "http://localhost"; //Without Port //Kann das weg? + public static string ServerAddressLocal = "http://localhost:8085"; // "http://localhost:8085" //Kann das weg? + public static string ServerAdress = "http://localhost:8085"; //need "http://" //used by dispalyScrolls.cs //http://10.231.4.95:8085"; //IMPORTANT for MAINMENUE public static Process process_mmt_frameIT_server; @@ -53,10 +53,11 @@ public static class CommunicationEvents */ public static string lastIP = ""; public static string newIP = ""; - public static string IPslot1 = ""; - public static string IPslot2 = "http://10.231.4.95:8085"; - public static string IPslot3 = "10.231.4.95:8085"; - public static string selecIP = ""; + public static string IPslot1 = "- if you can read this"; + public static string IPslot2 = "- NetworkConfig"; + public static string IPslot3 = "- not loaded"; + public static string selecIP = "GO TO -> 'Options'\n-> 'Reset Options'\nPRESS: \n'Reset Configurations'"; + //------ public static int[] ServerRunningA = new int[7] { 0, 0, 0, 0, 0, 0, 0 }; //other, lastIP, newIP, IP1, IP2, IP3, selecIP} //0: offline, 1: Checking, 2: online, 3: NoNetworkAddress; diff --git a/Assets/Scripts/Loading/StreamingAssetLoader.cs b/Assets/Scripts/Loading/StreamingAssetLoader.cs index 8f4ba9f5..f733a2da 100644 --- a/Assets/Scripts/Loading/StreamingAssetLoader.cs +++ b/Assets/Scripts/Loading/StreamingAssetLoader.cs @@ -24,8 +24,8 @@ public static class StreamingAssetLoader //Config - public static string file_8_path = "Config"; - public static string file_8 = "Network.JSON"; + public static string ConfigDir = "Config"; + public static string ConfigFile_Network = "Network.JSON"; //public static ID_toPath toPath = ID_toPath.DataPath; public enum ID_toPath @@ -65,6 +65,8 @@ public static bool checkFileExistence(string sourcepath, string filename) public static void NetworkJSON_Save() { NetworkJSON myObject = new NetworkJSON(); + + //MyClass myObject = new MyClass(); myObject.newIP = CommunicationEvents.newIP; myObject.lastIP = CommunicationEvents.lastIP; @@ -88,10 +90,10 @@ public static void NetworkJSON_Save() //Data storage - SafeCreateDirectory(Application.persistentDataPath + "/Config"); + SafeCreateDirectory(Path.Combine(Application.persistentDataPath ,ConfigDir)); //string json = JsonUtility.ToJson(date); string json = JsonUtility.ToJson(myObject); - StreamWriter Writer = new StreamWriter(Application.persistentDataPath + "/Config/Network.json"); + StreamWriter Writer = new StreamWriter(Path.Combine(Application.persistentDataPath, ConfigDir, ConfigFile_Network)); Writer.Write(json); Writer.Flush(); Writer.Close(); @@ -118,16 +120,6 @@ public static void ResetPlayerSaveGame() - - - public static void ResetPlayerConfig() - { - string sourcePath = Path.Combine(Application.streamingAssetsPath, StreamToPersistentDataPath_Folder); - string targetFolder = Application.persistentDataPath; - - RereadFileWithUnityWebRequest(sourcePath, StreamingAssetLoader.file_8_path, StreamingAssetLoader.file_8, targetFolder); - NetworkJSON_Load(); - } public static void ResetPersistentDataPath() { RereadFiles_PersistentDataPath(); @@ -163,11 +155,19 @@ public static void deleteADirectoryAndSubDir(string path) } } } + public static void ResetPlayerConfig() + { + string sourcePath = Path.Combine(Application.streamingAssetsPath, StreamToPersistentDataPath_Folder, ConfigDir); + string targetFolder = Application.persistentDataPath; + RereadFileWithUnityWebRequest(sourcePath, ConfigDir, ConfigFile_Network, targetFolder); + NetworkJSON_Load(); + } public static void RereadFiles_PersistentDataPath() { + Debug.Log("Reread_PersistentDataPath"); //RereadFileUWR(StreamingAssetLoader.file_1_path, StreamingAssetLoader.file_1, ID_toPath.PersistentDataPath); //---- string rootPath = Path.Combine(Application.streamingAssetsPath, StreamToPersistentDataPath_Folder); @@ -178,7 +178,8 @@ public static void RereadFiles_PersistentDataPath() } public static void RereadFiles_DataPath() - { + { + Debug.Log("Reread_DataPath"); string rootPath = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_Folder); string targetFolder = Application.dataPath; ReReadFiles(rootPath, targetFolder); @@ -235,7 +236,7 @@ public static void ReReadFiles(string rootPath, string targetFolder)//ID_toPath public static void NetworkJSON_Load() { - var reader = new StreamReader(Application.persistentDataPath + "/Config/Network.JSON"); + var reader = new StreamReader(Path.Combine(Application.persistentDataPath, ConfigDir, ConfigFile_Network)); string json = reader.ReadToEnd(); reader.Close(); @@ -370,6 +371,7 @@ public static void RereadFileWithUnityWebRequest(string sourcePath1, string path string sourcePath = Path.Combine(sourcePath1, fileName); + //Debug.Log(sourcePath); using var loadingRequest = UnityWebRequest.Get(sourcePath); loadingRequest.SendWebRequest(); while (!loadingRequest.isDone) @@ -583,7 +585,7 @@ public static void Score_Save(string Directory_path, string date) public static string Score_Load(string Directory_path) { //Data acquisition - var reader = new StreamReader(Application.persistentDataPath + "/Config/Network.JSON"); + var reader = new StreamReader(Path.Combine(Application.persistentDataPath, ConfigDir, ConfigFile_Network)); string json = reader.ReadToEnd(); reader.Close(); diff --git a/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs index e720298a..28124483 100644 --- a/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs @@ -56,16 +56,16 @@ void Start() void start2_CheckOS_CheckConfig() { + //Debug.Log("start2: " + CommunicationEvents.Opsys); switch (CommunicationEvents.Opsys) - { + { + case OperationSystem.Windows: - - - + //Debug.Log(checkPersistentDataPath()); if (!checkPersistentDataPath()) { - + //Debug.Log("initialReset_PDP"); ResetPersistentDataPath(); switch (Opsys) { @@ -93,7 +93,7 @@ void start2_CheckOS_CheckConfig() if (!checkPersistentDataPath()) { - + //Debug.Log("initialReset_PDP"); ResetPersistentDataPath(); switch (Opsys) { @@ -122,7 +122,7 @@ void start2_CheckOS_CheckConfig() if (!checkPersistentDataPath()) { - + //Debug.Log("initialReset_PDP"); ResetPersistentDataPath(); switch (Opsys) { diff --git a/Assets/StreamingAssets/StreamToPersistentDataPath/Config/Network.JSON b/Assets/StreamingAssets/StreamToPersistentDataPath/Config/Network.JSON index 8672bd6e..a261a61d 100644 --- a/Assets/StreamingAssets/StreamToPersistentDataPath/Config/Network.JSON +++ b/Assets/StreamingAssets/StreamToPersistentDataPath/Config/Network.JSON @@ -1,20 +1,19 @@ { - "lastIP":"", - "newIP":"", - "IPslot1":"uframeit.informatik.uni-erlangen.de:8085", - "IPslot2":"uframeit.informatik.uni-erlangen.de:8086", - "IPslot3":"10.231.4.95:8085", - "selecIP":"", - "ControlMode":"1", - "TouchMode":"1", - "TAvisibility":"1", - "autoOSrecognition":"true", - "Opsys":"Windows", - "FrameITUIversion":"2", - "InputManagerVersion":"1", - "colliderScale_all":"1.2", - "cursorSize":"0.03125", - "camRotatingSensitivity":"2f", - "MouseKeepingInWindow":"true" -} - + "lastIP": "", + "newIP": "", + "IPslot1": "uframeit.informatik.uni-erlangen.de:8085", + "IPslot2": "uframeit.informatik.uni-erlangen.de:8086", + "IPslot3": "", + "selecIP": "", + "ControlMode": "Keyboard", + "TouchMode": 1, + "TAvisibility": 1.0, + "autoOSrecognition": true, + "Opsys": "Windows", + "FrameITUIversion": 2, + "InputManagerVersion": 1, + "colliderScale_all": 1.200000047683716, + "cursorSize": 0.03125, + "camRotatingSensitivity": 2.0, + "MouseKeepingInWindow": true +} \ No newline at end of file diff --git a/ProjectSettings/Packages/com.unity.probuilder/Settings.json b/ProjectSettings/Packages/com.unity.probuilder/Settings.json index cc0de852..d6f0f026 100644 --- a/ProjectSettings/Packages/com.unity.probuilder/Settings.json +++ b/ProjectSettings/Packages/com.unity.probuilder/Settings.json @@ -42,6 +42,11 @@ "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "key": "experimental.enabled", "value": "{\"m_Value\":false}" + }, + { + "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "key": "editor.stripProBuilderScriptsOnBuild", + "value": "{\"m_Value\":true}" } ] } -- GitLab