Skip to content
Snippets Groups Projects
Commit 4804cc14 authored by Stefan Richter's avatar Stefan Richter
Browse files

added network error-messages for things that never should happen

parent de37f0a1
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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();
......
......@@ -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)
{
......
{
"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
......@@ -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}"
}
]
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment