From a0e83acfe7c9dfe9b2827f9a132860839d5c4ad2 Mon Sep 17 00:00:00 2001 From: baletiballo <75846481+baletiballo@users.noreply.github.com> Date: Wed, 15 Jan 2025 09:57:50 +0100 Subject: [PATCH] auto-reload default server addresses from streaming assets if smth broke them Instead of telling the player to do so --- .../InteractionEngine/CommunicationEvents.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index 4b1a79c5..28751dc1 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -94,6 +94,12 @@ public class ServerSlotData /// </summary> public IEnumerator UpdateServerStatus(bool skipIfAlreadyChecked = false) { + // This is the "default" value of slot1. If it has not been overwritten, the config should be reset from Streaming Assets (as it says) + // This should hopefully deal with this situation before a player has to + if (domain.Equals("if you can read this, go to 'Options'\n -> 'Reset Options'\n -> PRESS: 'Reset Configurations'")) + { + StreamingAssetLoader.ResetPlayerConfig(); + } if (skipIfAlreadyChecked && hasBeenChecked) { yield break; // Skip, if not neccessary @@ -105,7 +111,7 @@ public IEnumerator UpdateServerStatus(bool skipIfAlreadyChecked = false) if (string.IsNullOrEmpty(domain)) { currentStatus = ServerStatus.NoNetworkAddress; - UnityEngine.Debug.LogWarning("Server " + myKey.ToString() + " has no network adress."); + UnityEngine.Debug.LogWarning($"Server {myKey} has no network adress."); } else { @@ -118,7 +124,7 @@ public IEnumerator UpdateServerStatus(bool skipIfAlreadyChecked = false) } else { - UnityEngine.Debug.Log("Couldn't connect to Server " + myKey.ToString() + " under " + domain + " : " + request.error + "\n"); + UnityEngine.Debug.Log($"Couldn't connect to Server {myKey} under {domain} : {request.error}"); currentStatus = ServerStatus.offline; //try again @@ -149,11 +155,11 @@ public IEnumerator UpdateServerStatus(bool skipIfAlreadyChecked = false) { { ServerSlot.last, new ServerSlotData("") }, { ServerSlot.newIP, new ServerSlotData("") }, - { ServerSlot.slot1, new ServerSlotData("- if you can read this") }, - { ServerSlot.slot2, new ServerSlotData("- NetworkConfig") }, - { ServerSlot.slot3, new ServerSlotData("- GO TO -> 'Options'") }, - { ServerSlot.slot4, new ServerSlotData("- -> 'Reset Options'") }, - { ServerSlot.slot5, new ServerSlotData("- -> PRESS: 'Reset Configurations'") }, + { ServerSlot.slot1, new ServerSlotData("if you can read this, go to 'Options'\n -> 'Reset Options'\n -> PRESS: 'Reset Configurations'") }, + { ServerSlot.slot2, new ServerSlotData("") }, + { ServerSlot.slot3, new ServerSlotData("") }, + { ServerSlot.slot4, new ServerSlotData("") }, + { ServerSlot.slot5, new ServerSlotData("") }, { ServerSlot.selecIP, new ServerSlotData("") }, { ServerSlot.localServer, new ServerSlotData(ServerAddressLocal) } }; -- GitLab