diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index 772176dac6824524e01d82809db02e001a0e9451..df939318ec53b0440958fd39d8026675a6b10f6d 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -87,11 +87,14 @@ public class AnimationEventWithUris : UnityEvent<List<string>> { } public static int[] CheckServerA = new int[7] { 0, 0, 0, 0, 0, 0, 0 }; public static bool autoOSrecognition = true; - //int Opsys =1 Android. - //int Opsys =0 Windows; - //public static int Opsys_Default = 0; - public static int Opsys = 0; //Script + public static OperationSystem Opsys = OperationSystem.Windows; //Scripts + + public enum OperationSystem + { + Windows=0, + Android=1, + } public static bool CursorVisDefault = true; //Script. public static bool GadgetCanBeUsed = false; @@ -100,6 +103,7 @@ public class AnimationEventWithUris : UnityEvent<List<string>> { } + // Configs public static bool VerboseURI = false; @@ -139,7 +143,7 @@ public static string CreatePathToFile(out bool file_exists, string name, string //is set above; switch (Opsys) { - case 0: + case OperationSystem.Windows: path = use_install_folder ? Application.dataPath : Application.persistentDataPath; @@ -154,7 +158,7 @@ public static string CreatePathToFile(out bool file_exists, string name, string return path; - case 1: + case OperationSystem.Android: path = Application.persistentDataPath; if (hierarchie != null) diff --git a/Assets/Scripts/Loading/StreamingAssetLoader.cs b/Assets/Scripts/Loading/StreamingAssetLoader.cs index db78c65a17060460fdea686b4cacf7aee5673593..cfc4b5d83a353fe53f67ad40ed75bd1f0cfc50b9 100644 --- a/Assets/Scripts/Loading/StreamingAssetLoader.cs +++ b/Assets/Scripts/Loading/StreamingAssetLoader.cs @@ -8,6 +8,7 @@ using UnityEngine.Networking; using static CommunicationEvents; using static UIconfig; +using System; //Uploading Files from StreamingAsset folder to the Persistent Folder for Android Devices @@ -78,11 +79,11 @@ public static void NetworkJSON_Save() myObject.IPslot2 = CommunicationEvents.IPslot2; myObject.IPslot3 = CommunicationEvents.IPslot3; myObject.selecIP = CommunicationEvents.selecIP; - myObject.ControlMode = UIconfig.controlMode; + myObject.ControlMode = UIconfig.controlMode.ToString(); myObject.TouchMode = UIconfig.touchControlMode; myObject.TAvisibility = UIconfig.TAvisibility; myObject.autoOSrecognition = CommunicationEvents.autoOSrecognition; - myObject.Opsys = CommunicationEvents.Opsys; + myObject.Opsys = CommunicationEvents.Opsys.ToString(); myObject.FrameITUIversion = UIconfig.FrameITUIversion; myObject.InputManagerVersion = UIconfig.InputManagerVersion; myObject.colliderScale_all = UIconfig.colliderScale_all; @@ -196,7 +197,7 @@ public static void NetworkJSON_Load() } if (string.IsNullOrEmpty(myObjsOnlyStrings.ControlMode)) { } else { - UIconfig.controlMode = myObjs.ControlMode; + UIconfig.controlMode = (ControlMode)Enum.Parse(typeof(ControlMode), myObjs.ControlMode); } if (string.IsNullOrEmpty(myObjsOnlyStrings.TouchMode)) { } else { @@ -212,7 +213,7 @@ public static void NetworkJSON_Load() } if (string.IsNullOrEmpty(myObjsOnlyStrings.Opsys)) { } else { - CommunicationEvents.Opsys = myObjs.Opsys; + CommunicationEvents.Opsys = (OperationSystem)Enum.Parse(typeof(OperationSystem), myObjs.Opsys); } if (string.IsNullOrEmpty(myObjsOnlyStrings.FrameITUIversion)) { } else { @@ -271,7 +272,7 @@ public static void RereadFileUWR(string pathfolders, string fileName, int toMain { //copies and unpacks file from apk to persistentDataPath where it can be accessed string destinationPath = ""; - if (toMainpath == 0 && CommunicationEvents.Opsys != 1) { destinationPath = Path.Combine(Application.dataPath, destpathf); } + if (toMainpath == 0 && CommunicationEvents.Opsys != OperationSystem.Android) { destinationPath = Path.Combine(Application.dataPath, destpathf); } else { destinationPath = Path.Combine(Application.persistentDataPath, destpathf); diff --git a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs index 2aac5598e0b5ceeba321a2eb4e8b8b21daea615b..a4c525ba5e0e87577ff21423a562f0c9839b4c9e 100644 --- a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs +++ b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs @@ -282,7 +282,7 @@ private void GetInput(out float speed) //m_IsWalking = !Input.GetKey(Running_keyBind); #endif m_IsWalking = !Input.GetKey(KeyCode.LeftShift); - if (UIconfig.controlMode!=2) + if (UIconfig.controlMode!= ControlMode.Mobile ) { //m_IsWalking = !Input.GetKey(Running_keyBind); } @@ -293,7 +293,7 @@ private void GetInput(out float speed) if (UIconfig.InputManagerVersion == 2) { Vector2 a = Vector2.zero; - if (CommunicationEvents.Opsys == 1) + if (CommunicationEvents.Opsys == CommunicationEvents.OperationSystem.Android) { switch (UIconfig.touchControlMode) { diff --git a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs index b0d6fc44c8afe151aabe803070f789350ef6f014..5e0438266dbe0e29bed54575bab5ae5a08e90e9e 100644 --- a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs +++ b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs @@ -3,6 +3,7 @@ //using UnityStandardAssets.CrossPlatformInput; using PlayerCtrl; using static UIconfig; +using static CommunicationEvents; //namespace UnityStandardAssets.Characters.FirstPerson namespace Characters.FirstPerson @@ -72,7 +73,7 @@ public void LookRotation(Transform character, Transform camera) { - if (CommunicationEvents.Opsys == 1) + if (CommunicationEvents.Opsys == OperationSystem.Android) { a = input_ControlMapping.Actnmp_HC.LookCamera.ReadValue<Vector2>(); diff --git a/Assets/Scripts/UI/HideUI_mobile.cs b/Assets/Scripts/UI/HideUI_mobile.cs index 66ea2338c38e20666b58a27f3e4b95971ba105bc..92748262fc942218d967f1fb4f609ce0b4d9e99e 100644 --- a/Assets/Scripts/UI/HideUI_mobile.cs +++ b/Assets/Scripts/UI/HideUI_mobile.cs @@ -177,7 +177,22 @@ void Update3() void CheckUI_Vis_walk() { - int uiccm = UIconfig.controlMode - 1; + + int uiccm=0; + switch (UIconfig.controlMode) + { + case ControlMode.Keyboard: + uiccm = 0; + break; + case ControlMode.Mobile: + uiccm = 1; + break; + default: + uiccm = 0; + break; + } + + UIconfig.CanvasOnOff_Array[11] = uiccm; UIconfig.CanvasOnOff_Array[12] = uiccm; UIconfig.CanvasOnOff_Array[13] = uiccm; diff --git a/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs b/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs index 2f590e882570b1b230475a6e8e2ffd1f070b8fc5..0ef452af3d375b77be446251e76b3580925007bb 100644 --- a/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs +++ b/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs @@ -16,7 +16,7 @@ public class IngameUI_OnOff_TouchControlMode : MonoBehaviour { public GameObject myself_GObj; - public int myControlMode_ID; + public ControlMode myControlMode_ID; public int myTouchControlMode_ID; @@ -25,8 +25,8 @@ public class IngameUI_OnOff_TouchControlMode : MonoBehaviour void Start() { - - + + print("hey"); Update(); } diff --git a/Assets/Scripts/UI/InGame/ScalingCollider.cs b/Assets/Scripts/UI/InGame/ScalingCollider.cs index 88d3f5df82d13e7aedbaf2742a4050e2e237260f..4da5d6acedbcba091fc37226ef0eb83909f03758 100644 --- a/Assets/Scripts/UI/InGame/ScalingCollider.cs +++ b/Assets/Scripts/UI/InGame/ScalingCollider.cs @@ -45,10 +45,10 @@ private void scalingCollider() { switch (Opsys) { - case 1: + case OperationSystem.Android: scale=colliderScale_all* UIconfig.colliderScale_Mobile_default; ; break; - case 0: + case OperationSystem.Windows: scale = colliderScale_all * UIconfig.colliderScale_PC_default; diff --git a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs index a14e0004fca4e7731414b0338069c9d39c1fcb60..950c28c037530962239c3b04a127df4891bf3c21 100644 --- a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs @@ -45,7 +45,7 @@ private void Update() public void updateUIpreview() { - if (UIconfig.controlMode == 2) + if (UIconfig.controlMode == ControlMode.Mobile) { colChangeable.a = UIconfig.TAvisibility; diff --git a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs index ff3e37dc716ef4e44729a575888f9b4fb5e9c9e7..49e247ed163e31acda131ee4d4cc588b02ee9675 100644 --- a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs @@ -102,9 +102,9 @@ public void InputTXTupdate() private void UpdateUI_6() { - switch (UIconfig.controlMode) + switch (UIconfig.controlMode ) { - case 1: + case ControlMode.Keyboard: //TouchControlButtonT.GetComponent<Text>().text = "Touch controls: OFF"; //TouchControlButtonUT.GetComponent<Text>().text = "Press for activating"; @@ -112,7 +112,7 @@ private void UpdateUI_6() TouchControlButtonUT.GetComponent<Text>().text = "Press for changing mode"; break; - case 2: + case ControlMode.Mobile: //TouchControlButtonT.GetComponent<Text>().text = "Touch controls: ON"; //TouchControlButtonUT.GetComponent<Text>().text = "Press for deactivating"; @@ -191,17 +191,17 @@ public void TouchControls() { switch (UIconfig.controlMode) { - case 1: - UIconfig.controlMode = 2; + case ControlMode.Keyboard: + UIconfig.controlMode = ControlMode.Mobile; break; - case 2: - UIconfig.controlMode = 1; + case ControlMode.Mobile: + UIconfig.controlMode = ControlMode.Keyboard; break; default: - UIconfig.controlMode = 2; + UIconfig.controlMode = ControlMode.Keyboard; break; diff --git a/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs index 2346d57b61d7ba8283e15a59247e33b11a77fb76..642c394be521eeda4fa0d8d7e8efed645a65e0ea 100644 --- a/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs @@ -59,7 +59,7 @@ void start2_CheckOS_CheckConfig() { switch (CommunicationEvents.Opsys) { - case 0: + case OperationSystem.Windows: @@ -68,8 +68,18 @@ void start2_CheckOS_CheckConfig() { ResetStreamingAsset(); - - UIconfig.controlMode = CommunicationEvents.Opsys + 1; + switch (Opsys) + { + case OperationSystem.Windows: + UIconfig.controlMode = ControlMode.Keyboard; + break; + case OperationSystem.Android: + UIconfig.controlMode = ControlMode.Mobile; + break; + default: + break; + } + NetworkJSON_Save(); } @@ -78,13 +88,23 @@ void start2_CheckOS_CheckConfig() ResetDataPath(); setMouse(); break; - case 1: + case OperationSystem.Android: if (!checkPDP()) { ResetStreamingAsset(); - UIconfig.controlMode = CommunicationEvents.Opsys + 1; + switch (Opsys) + { + case OperationSystem.Windows: + UIconfig.controlMode = ControlMode.Keyboard; + break; + case OperationSystem.Android: + UIconfig.controlMode = ControlMode.Mobile; + break; + default: + break; + } NetworkJSON_Save(); } NetworkJSON_Load(); @@ -101,7 +121,17 @@ void start2_CheckOS_CheckConfig() ResetStreamingAsset(); - UIconfig.controlMode = CommunicationEvents.Opsys + 1; + switch (Opsys) + { + case OperationSystem.Windows: + UIconfig.controlMode = ControlMode.Keyboard; + break; + case OperationSystem.Android: + UIconfig.controlMode = ControlMode.Mobile; + break; + default: + break; + } NetworkJSON_Save(); } @@ -134,7 +164,7 @@ void checkOS() { //CommunicationEvents.Opsys = CommunicationEvents.Opsys_Default; } - if(Opsys == 1) + if(Opsys == OperationSystem.Android) { ServerAutoStart = false; } @@ -147,14 +177,14 @@ void checkOS2() { Debug.Log("Windows OS detected"); - CommunicationEvents.Opsys = 0; + CommunicationEvents.Opsys = OperationSystem.Windows; return; } if (Application.platform == RuntimePlatform.Android) { Debug.Log("Android OS detected"); - CommunicationEvents.Opsys = 1; + CommunicationEvents.Opsys = OperationSystem.Windows; return; } diff --git a/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs index acfb8615a019fcf5ea7cd8fbc30f29a701f3e5e5..9d68153fc3f9b18a90e44bd016f0c9c8540154b6 100644 --- a/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs @@ -9,7 +9,7 @@ using static UIconfig; using static StreamingAssetLoader; - +using static CommunicationEvents; public class SystemOptionsMenue_mobile : MonoBehaviour { @@ -68,14 +68,14 @@ void UpdateUI_6() switch (CommunicationEvents.Opsys) { - case 0: + case OperationSystem.Windows: Opsys_ButtonT.GetComponent<Text>().text = "Windows optimized"; Opsys_ButtonUT.GetComponent<Text>().text = "Press for changing optimzation"; setMouse(); break; - case 1: + case OperationSystem.Android: Opsys_ButtonT.GetComponent<Text>().text = "Android optimized: No mouse"; @@ -146,15 +146,15 @@ public void ChangeOpsysModes() { switch (CommunicationEvents.Opsys) { - case 0: - CommunicationEvents.Opsys = 1; + case OperationSystem.Windows: + CommunicationEvents.Opsys = OperationSystem.Android; Opsys_ButtonT.GetComponent<Text>().text = "Android optimized: No Mouse"; Opsys_ButtonUT.GetComponentInChildren<Text>().text = "Press for changing optimzation"; break; - case 1: - CommunicationEvents.Opsys = 0; + case OperationSystem.Android: + CommunicationEvents.Opsys = OperationSystem.Windows; Opsys_ButtonT.GetComponent<Text>().text = "Windows optimized"; Opsys_ButtonUT.GetComponentInChildren<Text>().text = "Press for changing optimzation"; if (UIconfig.MouseKeepingInWindow == true) @@ -169,7 +169,7 @@ public void ChangeOpsysModes() break; default: - CommunicationEvents.Opsys = 1; + CommunicationEvents.Opsys = OperationSystem.Android; Opsys_ButtonT.GetComponent<Text>().text = "Not optimized"; Opsys_ButtonUT.GetComponentInChildren<Text>().text = "Press for changing optimzation"; break; diff --git a/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs b/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs index aa6ae17373f4d00507e0de34d4fbcfdc2c8ca9d9..33672a1ebb86768a773cce67204ce63bdb8f3b0c 100644 --- a/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs +++ b/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs @@ -24,7 +24,7 @@ public static void setMouse() //updateMouseCursor.setMouse(); - if (CommunicationEvents.Opsys == 1) + if (CommunicationEvents.Opsys == CommunicationEvents.OperationSystem.Android) { CommunicationEvents.CursorVisDefault = false; //Cursor.visible = false; @@ -39,7 +39,7 @@ public static void setMouse() //Android crashes in level scene; - if (CommunicationEvents.Opsys != 1) + if (CommunicationEvents.Opsys!= CommunicationEvents.OperationSystem.Windows) { double curssz = 1 / (UIconfig.cursorSize); diff --git a/Assets/Scripts/UI/NetwMenue/uploadMouseCursor.cs b/Assets/Scripts/UI/NetwMenue/uploadMouseCursor.cs index f4b433548bcddf622fcf8b7a5c395fa9335148ad..e72f8e4ff2f55cb875a9ab75cf054428cad3dc09 100644 --- a/Assets/Scripts/UI/NetwMenue/uploadMouseCursor.cs +++ b/Assets/Scripts/UI/NetwMenue/uploadMouseCursor.cs @@ -11,6 +11,7 @@ using static StreamingAssetLoader; + public class uploadMouseCursor : MonoBehaviour { @@ -86,88 +87,4 @@ public void setMouse() updateMouseCursor.setMouse(); } - - //Backup von UpdateMouseCursor.cs - public void setMouse_01() - { - - //print("OPSYS: " + CommunicationEvents.Opsys); - if (CommunicationEvents.Opsys == 1) - { - CommunicationEvents.CursorVisDefault = false; - //Cursor.visible = false; - } - else - { - Cursor.visible = true; - CommunicationEvents.CursorVisDefault = true; - } - - //Android crashes in level scene; - if (CommunicationEvents.Opsys != 1) - { - double curssz = 1 / (UIconfig.cursorSize); - // print(UIconfig.cursorSize); - - if (UIconfig.screWidth / 35 < curssz) - { - Cursor.SetCursor(cursorArrow_35, Vector2.zero, CursorMode.ForceSoftware); - print("m35"); - } - else - { - if (UIconfig.screWidth / 50 < curssz) - { - Cursor.SetCursor(cursorArrow_50, Vector2.zero, CursorMode.ForceSoftware); - print("m50"); - } - else - { - - if (UIconfig.screWidth / 60 < curssz) - { - Cursor.SetCursor(cursorArrow_60, Vector2.zero, CursorMode.ForceSoftware); - print("m60"); - } - else - { - if (UIconfig.screWidth / 70 < curssz) - { - Cursor.SetCursor(cursorArrow_70, Vector2.zero, CursorMode.ForceSoftware); - print("m70"); - } - else - { - if (UIconfig.screWidth / 100 < curssz) - { - Cursor.SetCursor(cursorArrow_100, Vector2.zero, CursorMode.ForceSoftware); - print("m100"); - } - else - { - if (UIconfig.screWidth / 140 < curssz) - { - Cursor.SetCursor(cursorArrow_140, Vector2.zero, CursorMode.ForceSoftware); - print("m140"); - } - else - { - if (UIconfig.screWidth / 200 < curssz) - { - Cursor.SetCursor(cursorArrow_200, Vector2.zero, CursorMode.ForceSoftware); - print("m200"); - } - else - { - Cursor.SetCursor(cursorArrow_300, Vector2.zero, CursorMode.ForceSoftware); - print("m300"); - } - } - } - } - } - } - } - } - } } \ No newline at end of file diff --git a/Assets/Scripts/UI/UIconfig.cs b/Assets/Scripts/UI/UIconfig.cs index c2c89df104086e70d00616ee31b98e6305b717d2..b9f25769bbe298f25f8bd9696d119070184a08bc 100644 --- a/Assets/Scripts/UI/UIconfig.cs +++ b/Assets/Scripts/UI/UIconfig.cs @@ -40,9 +40,16 @@ public static class UIconfig public static int Andr_Start_menue_counter = 1; //public static int Andr_Start_menue_counter = 1; - public static int controlMode = 1; //1=keyboard 2=mobile - - + public static ControlMode controlMode = ControlMode.Keyboard; //1=keyboard 2=mobile + + public enum ControlMode + { + Keyboard = 1, + Mobile = 2, + } + + + public static int touchControlMode = 1; //1=buttons, 2, 3 public static float TAvisibility = 1; @@ -81,11 +88,11 @@ public class NetworkJSON public string IPslot2; public string IPslot3; public string selecIP; - public int ControlMode; + public string ControlMode; public int TouchMode; public float TAvisibility; public bool autoOSrecognition; - public int Opsys; + public string Opsys; public int FrameITUIversion; public int InputManagerVersion; public double colliderScale_all; diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 0a74b62c402f2c5273503b05534a6f733b7d29e2..d5b75b13d5cbba48e860a8dfccc70c86a2dcd74b 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -5,6 +5,9 @@ EditorUserSettings: m_ObjectHideFlags: 0 serializedVersion: 4 m_ConfigSettings: + RecentlyUsedSceneGuid-0: + value: 0709560454055c0d0c5e5c2444740b4413154a72792d22627c714963e0b6373d + flags: 0 RecentlyUsedScenePath-0: value: 22424703114646680e0b0227036c721518021d39630928343f162e27e3f22076f7e93ffdfe flags: 0 @@ -43,9 +46,13 @@ EditorUserSettings: m_VCDebugCmd: 0 m_VCDebugOut: 0 m_SemanticMergeMode: 2 + m_DesiredImportWorkerCount: 1 + m_StandbyImportWorkerCount: 1 + m_IdleImportWorkerShutdownDelay: 60000 m_VCShowFailedCheckout: 1 m_VCOverwriteFailedCheckoutAssets: 1 m_VCProjectOverlayIcons: 1 m_VCHierarchyOverlayIcons: 1 m_VCOtherOverlayIcons: 1 m_VCAllowAsyncUpdate: 1 + m_ArtifactGarbageCollection: 1