diff --git a/Assets/Editor/LaserPointer.cs b/Assets/Editor/LaserPointer.cs index b174fa8bdbb30ca522a984204d0ddab032c086ac..c326c811ecd3748bdc2c2fb93f2c6415f72a5e20 100644 --- a/Assets/Editor/LaserPointer.cs +++ b/Assets/Editor/LaserPointer.cs @@ -1,8 +1,7 @@ -using System.Collections; +using UnityEditor; using UnityEngine; -using UnityEditor; -public class LaserPointer : Editor +public class LaserPointer : Editor { static public RaycastHit laserHit; static public bool laserBool; @@ -20,7 +19,7 @@ void OnSceneGUI() RaycastHit tempHit; if (!(laserBool = Physics.Raycast(ray, out tempHit, Mathf.Infinity, int.MaxValue))) - return ; + return; laserHit = tempHit; } diff --git a/Assets/Editor/ShowSize.cs b/Assets/Editor/ShowSize.cs index 71b5db25dccc547a8f089f9c6dc39ec42c11c8db..64e83f96d066142ea0ddebd68ebedca9bb717191 100644 --- a/Assets/Editor/ShowSize.cs +++ b/Assets/Editor/ShowSize.cs @@ -1,7 +1,5 @@ - -using System.Collections; +using UnityEditor; using UnityEngine; -using UnityEditor; /* ############################ * ## Show Size Editor Addon ## diff --git a/Assets/Resources/Prefabs/Rainmaker/RainCollision.cs b/Assets/Resources/Prefabs/Rainmaker/RainCollision.cs index f91bcd1415fefb04eb396b73c54fd172fe562417..7b7652a8af31d1a35c4bf4f838e04e28bd170957 100644 --- a/Assets/Resources/Prefabs/Rainmaker/RainCollision.cs +++ b/Assets/Resources/Prefabs/Rainmaker/RainCollision.cs @@ -3,8 +3,8 @@ // http://www.digitalruby.com // -using UnityEngine; using System.Collections.Generic; +using UnityEngine; namespace DigitalRuby.RainMaker { diff --git a/Assets/Samples/Input System/1.3.0/Rebinding UI/RebindActionUI.cs b/Assets/Samples/Input System/1.3.0/Rebinding UI/RebindActionUI.cs index a325a0ae59dd98a47e44a9789316707950300005..a17584e526750253a2e3359634c112b7423394b4 100644 --- a/Assets/Samples/Input System/1.3.0/Rebinding UI/RebindActionUI.cs +++ b/Assets/Samples/Input System/1.3.0/Rebinding UI/RebindActionUI.cs @@ -413,14 +413,14 @@ private static void OnActionChange(object obj, InputActionChange change) // We want the label for the action name to update in edit mode, too, so // we kick that off from here. - #if UNITY_EDITOR +#if UNITY_EDITOR protected void OnValidate() { UpdateActionLabel(); UpdateBindingDisplay(); } - #endif +#endif private void UpdateActionLabel() { diff --git a/Assets/Samples/Input System/1.3.0/UI vs. Game Input/UIvsGameInputHandler.cs b/Assets/Samples/Input System/1.3.0/UI vs. Game Input/UIvsGameInputHandler.cs index 386218b9233c721e4a3c68ed59e4b2335c8bee78..cb0a968dd722f1b54a92c3ab2379c101cf88b769 100644 --- a/Assets/Samples/Input System/1.3.0/UI vs. Game Input/UIvsGameInputHandler.cs +++ b/Assets/Samples/Input System/1.3.0/UI vs. Game Input/UIvsGameInputHandler.cs @@ -113,42 +113,42 @@ public void Update() switch (m_State) { case State.InGame: - { - if (m_OpenMenuActionTriggered) { - m_State = State.InMenu; + if (m_OpenMenuActionTriggered) + { + m_State = State.InMenu; - // Bring up main menu. - inGameUI.SetActive(false); - mainMenuUI.SetActive(true); + // Bring up main menu. + inGameUI.SetActive(false); + mainMenuUI.SetActive(true); - // Disable gameplay inputs. - playerInput.DeactivateInput(); + // Disable gameplay inputs. + playerInput.DeactivateInput(); - // Select topmost button. - EventSystem.current.SetSelectedGameObject(firstButtonInMainMenu); - } + // Select topmost button. + EventSystem.current.SetSelectedGameObject(firstButtonInMainMenu); + } - var pointerIsOverUI = IsPointerOverUI(); - if (pointerIsOverUI) - break; + var pointerIsOverUI = IsPointerOverUI(); + if (pointerIsOverUI) + break; - if (m_ResetCameraActionTriggered) - transform.rotation = default; + if (m_ResetCameraActionTriggered) + transform.rotation = default; - // When using a pointer-based control scheme, we engage camera look explicitly. - if (m_ControlStyle != ControlStyle.GamepadJoystick && m_LookEngageAction.WasPressedThisFrame() && IsPointerInsideScreen()) - EngageCameraControl(); + // When using a pointer-based control scheme, we engage camera look explicitly. + if (m_ControlStyle != ControlStyle.GamepadJoystick && m_LookEngageAction.WasPressedThisFrame() && IsPointerInsideScreen()) + EngageCameraControl(); - // With gamepad/joystick, we can freely rotate the camera at any time. - if (m_ControlStyle == ControlStyle.GamepadJoystick) - ProcessCameraLook(); + // With gamepad/joystick, we can freely rotate the camera at any time. + if (m_ControlStyle == ControlStyle.GamepadJoystick) + ProcessCameraLook(); - if (m_FireActionTriggered) - Fire(); + if (m_FireActionTriggered) + Fire(); - break; - } + break; + } case State.InGameControllingCamera: @@ -270,11 +270,11 @@ public void OnContinueClicked() public void OnExitClicked() { - #if UNITY_EDITOR +#if UNITY_EDITOR EditorApplication.ExitPlaymode(); - #else +#else Application.Quit(); - #endif +#endif } public void OnMenu(InputAction.CallbackContext context) @@ -347,7 +347,7 @@ private void SetPlayerActionsEnabled(bool value) // callbacks above and just sets some state to leave action responses to Update(). // The second OnFire() puts the response logic directly inside the callback. - #if false +#if false public void OnFire(InputAction.CallbackContext context) { @@ -355,7 +355,7 @@ public void OnFire(InputAction.CallbackContext context) m_FireActionTriggered = true; } - #else +#else public void OnFire(InputAction.CallbackContext context) { @@ -392,7 +392,7 @@ private bool IsRaycastHittingUIObject(Vector2 position) private PointerEventData m_PointerData; private List<RaycastResult> m_RaycastResults = new List<RaycastResult>(); - #endif +#endif private bool IsPointerOverUI() { @@ -437,9 +437,9 @@ private void RepaintInspector() // We thus manually force a refresh. There's more elegant ways to do this but the easiest by // far is to just globally force a repaint of the entire editor window. - #if UNITY_EDITOR +#if UNITY_EDITOR InternalEditorUtility.RepaintAllViews(); - #endif +#endif } } diff --git a/Assets/ScriptableObjects/Gadgets/DataContainerGadgetCollection.cs b/Assets/ScriptableObjects/Gadgets/DataContainerGadgetCollection.cs index 538ef9ed9bcea1ce7ac40cb3e1b5b8d2bd709b66..f9e328239ec99c522ca965b4b4dbc1952fb4cf4c 100644 --- a/Assets/ScriptableObjects/Gadgets/DataContainerGadgetCollection.cs +++ b/Assets/ScriptableObjects/Gadgets/DataContainerGadgetCollection.cs @@ -1,6 +1,6 @@ using System; -using System.Linq; using System.Collections.Generic; +using System.Linq; using UnityEngine; [CreateAssetMenu(fileName = "DataContainerGadgetCollection", menuName = "ScriptableObjects/Spawn DataContainerGadgetCollection", order = 1)] @@ -22,11 +22,11 @@ public void OnBeforeSerialize() for (int i = 0; i < keys.Length; i++) { - if (GadgetType.Count <= i) GadgetType.Add(keys[i]); - else GadgetType[i] = keys[i]; + if (GadgetType.Count <= i) GadgetType.Add(keys[i]); + else GadgetType[i] = keys[i]; - if (GadgetData.Count <= i) GadgetData.Add(vals[i]); - else GadgetData[i] = vals[i]; + if (GadgetData.Count <= i) GadgetData.Add(vals[i]); + else GadgetData[i] = vals[i]; } } diff --git a/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs b/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs index 637075bc26cd0530bac31810b465bef0027120ba..4aa90bcf4d6fb8a044193e00765e5728108845f2 100644 --- a/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs +++ b/Assets/ScriptableObjects/Gadgets/DataContainerGadgetInit.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; [CreateAssetMenu(fileName = "DataContainerGadgetInit", menuName = "ScriptableObjects/SpawnDataContainerGadgetInit", order = 1)] diff --git a/Assets/Scripts/CheckServer.cs b/Assets/Scripts/CheckServer.cs index 443fa8d8ed364604caacb3f04de33a1015434994..ecbbf3cb14d9e51fa41e6e0e73ecde9a6489a64d 100644 --- a/Assets/Scripts/CheckServer.cs +++ b/Assets/Scripts/CheckServer.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using UnityEngine; using UnityEngine.Networking; -using UnityEngine.SceneManagement; using static CommunicationEvents; @@ -92,13 +91,13 @@ IEnumerator waiter(String NetwAddress, int NA_id, double ics) } else { - CommunicationEvents.IPcheckGeneration--; + CommunicationEvents.IPcheckGeneration--; + + if (NA_id == 2) + { + CommunicationEvents.ServerRunningA[NA_id] = 1; + } - if (NA_id == 2) - { - CommunicationEvents.ServerRunningA[NA_id] = 1; - } - } //Wait for 0,5 seconds @@ -117,7 +116,7 @@ IEnumerator ServerRoutine(String NetwAddress, int NA_id, double ics) CommunicationEvents.ServerRunningA_test[NA_id] = false; UnityWebRequest request = ping1(NetwAddress); - // UnityWebRequest request = UnityWebRequest.Get("http://localhost:8085/fact/list"); + // UnityWebRequest request = UnityWebRequest.Get("http://localhost:8085/fact/list"); //UnityEngine.Debug.Log("Req"); yield return request.SendWebRequest(); @@ -142,7 +141,8 @@ IEnumerator ServerRoutine(String NetwAddress, int NA_id, double ics) } - public UnityWebRequest ping1(String NetwAddress) { + public UnityWebRequest ping1(String NetwAddress) + { //UnityWebRequest request = UnityWebRequest.Get("http://" + NetwAddress + "/scroll/list"); UnityWebRequest request = UnityWebRequest.Get("http://" + NetwAddress + "/fact/list"); return request; diff --git a/Assets/Scripts/CheckServerPush.cs b/Assets/Scripts/CheckServerPush.cs index 7d52bbead65b378a367d105903c1b5c0399ca2fc..6d8c2e8e2959ed20776d1e520ce7957c54f7bba9 100644 --- a/Assets/Scripts/CheckServerPush.cs +++ b/Assets/Scripts/CheckServerPush.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using static CommunicationEvents; diff --git a/Assets/Scripts/GenerateDemoFiles.cs b/Assets/Scripts/GenerateDemoFiles.cs index 480ce3443edea2a11ae69c8c8c28ddce27786f3e..cab121e2a65f02a85efb3a7e067ccd4ce20e3f46 100644 --- a/Assets/Scripts/GenerateDemoFiles.cs +++ b/Assets/Scripts/GenerateDemoFiles.cs @@ -1,11 +1,9 @@ -using System.Linq; +using REST_JSON_API; +using System; using System.Collections.Generic; -using UnityEngine; -using static CanonBallProblemCalculator2D; +using System.Linq; using Unity.Mathematics; -using System; -using REST_JSON_API; -using MoreLinq; +using UnityEngine; public class GenerateDemoFiles { diff --git a/Assets/Scripts/InteractionEngine/Character_Animations/CharacterDialog.cs b/Assets/Scripts/InteractionEngine/Character_Animations/CharacterDialog.cs index 08abda0af9c06828f775e23cd331adc37a9456ca..69e82a39fe0b0f90685830d3a59a45aff5dd4bde 100644 --- a/Assets/Scripts/InteractionEngine/Character_Animations/CharacterDialog.cs +++ b/Assets/Scripts/InteractionEngine/Character_Animations/CharacterDialog.cs @@ -1,8 +1,6 @@ using System.Collections; -using System.Collections.Generic; -using UnityEngine; using TMPro; -using static TaskCharakterAnimation; +using UnityEngine; using static UIconfig; public class CharacterDialog : MonoBehaviour @@ -46,7 +44,7 @@ private void Awake() //New InputSystem input_ControlMapping = new ControlMapping(); input_ControlMapping.Actionmap1.Talking.Enable(); - + } private void OnEnable() @@ -61,18 +59,18 @@ private void OnDisable() } - + public void nextSentenceBttn_pressed() { if (numinputtrigger == 0) { - numinputtrigger++; - StartCoroutine(slowInput()); - //Type Next sentence if player is in the talkinZone around the TaskCharacter AND the player typed the return-Key - idleTime = 0; - NextSentence(); + numinputtrigger++; + StartCoroutine(slowInput()); + //Type Next sentence if player is in the talkinZone around the TaskCharacter AND the player typed the return-Key + idleTime = 0; + NextSentence(); } } @@ -89,8 +87,10 @@ private void Update() //print("InTalkingZone"); //print("CharacterDialog" + gameSucceeded + " && " + CharakterAnimation.getPlayerInTalkingZone()); - if (UIconfig.InputManagerVersion == 1) { - if (Input.GetKeyDown(KeyCode.C)) { + if (UIconfig.InputManagerVersion == 1) + { + if (Input.GetKeyDown(KeyCode.C)) + { //Type Next sentence if player is in the talkinZone around the TaskCharacter AND the player typed the return-Key NextSentence(); idleTime = 0; @@ -106,10 +106,10 @@ private void Update() } } } - - if ((!gameSucceeded) && (!textReseted) ) + + if ((!gameSucceeded) && (!textReseted)) { - if ((!CharakterAnimation.getPlayerInTalkingZone()) || (idleTime > 7)) + if ((!CharakterAnimation.getPlayerInTalkingZone()) || (idleTime > 7)) { //Reset Sentence if Player is out of range of the TaskCharacter and it's not already reseted ResetSentence(); @@ -130,7 +130,8 @@ IEnumerator IdleTimer() } - public void TypeFkt() { + public void TypeFkt() + { if (typingActive) { if (this.timer >= this.typingSpeed) @@ -156,7 +157,8 @@ public void TypeFkt() { } - public void NextSentence() { + public void NextSentence() + { //-2 because the last sentence is only for SucceededPushout-Purposes if (sentenceIndex < sentences.Length - 2) { @@ -169,7 +171,8 @@ public void NextSentence() { TypeFkt(); textReseted = false; } - else { + else + { letterIndex = 0; typingActive = false; timer = 0; @@ -184,7 +187,8 @@ public void NextSentence() { } } - public void ResetSentence() { + public void ResetSentence() + { CharakterAnimation.setTaskCharacterAddressed(false); sentenceIndex = 0; letterIndex = 0; diff --git a/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs b/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs index 4012bda90524d6d1d0fee7a1105664d459088fed..921e009ebcc4073a7d81f32497fb5b0c2533215e 100644 --- a/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs +++ b/Assets/Scripts/InteractionEngine/Character_Animations/TaskCharakterAnimation.cs @@ -1,14 +1,11 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; +using UnityEngine; using static UIconfig; public class TaskCharakterAnimation : MonoBehaviour { public Vector3 startingPosition; public GameObject playerDefault; - + public float radiusAroundObject; public float talkingZoneDistance; @@ -31,7 +28,7 @@ public class TaskCharakterAnimation : MonoBehaviour private float rotationUnits = 0; private float rotationTime = 2; private bool happy = false; - + private bool LelvelVerifiedSolved = false; private float happyTimer = 0; @@ -66,7 +63,7 @@ void Update() return; } //print("player: "+ player); - + Ray ray = new Ray(player.transform.position, player.transform.forward); int layerMask = LayerMask.GetMask("TalkingZone"); //only hit TalkingZone @@ -97,7 +94,7 @@ void Update() //Face walkAroundObject to Player (but only on y-Axis, so ignore x-and z-axis) currentTransform.LookAt(new Vector3(player.transform.position.x, currentTransform.position.y, player.transform.position.z)); - if(taskCharacterAddressed && !LelvelVerifiedSolved && StageStatic.stage.CheckSolved()) + if (taskCharacterAddressed && !LelvelVerifiedSolved && StageStatic.stage.CheckSolved()) { startHappy(); LelvelVerifiedSolved = true; @@ -106,7 +103,8 @@ void Update() return; } - else { + else + { //disable enter-key for talking setPlayerInTalkingZone(false); } @@ -120,7 +118,8 @@ void Update() //Change to random direction after standing-state currentTransform.RotateAround(currentTransform.position, Vector3.up, rotationUnits); } - else { + else + { //After rotating: Change to Walking-State rotate = false; this.timer = 0; @@ -152,9 +151,9 @@ void Update() this.walking = true; this.timer = 0; - + bool hitInvWall = Physics.OverlapSphere(talkingZoneCapsule.center, talkingZoneCapsule.radius, LayerMask.GetMask("TransparentFX")).Length > 0; - + //Calculate distance from tree, so that the TaskCharacter only walks in a specific radius around the tree //so that the player always knows where he is currentDistance = (currentTransform.position - startingPosition).magnitude; @@ -166,7 +165,7 @@ void Update() int temp = Random.Range(0, 5); int positive = (int)Random.Range(0, 2); //Calculate NextRotation towards radiusAroundObject - nextRotation = Vector3.Angle(currentTransform.forward, (startingPosition-currentTransform.position).normalized); + nextRotation = Vector3.Angle(currentTransform.forward, (startingPosition - currentTransform.position).normalized); if (positive == 0) nextRotation -= temp; @@ -183,7 +182,7 @@ void Update() nextRotation *= -1; } - rotationUnits = nextRotation / (rotationTime/Time.deltaTime); + rotationUnits = nextRotation / (rotationTime / Time.deltaTime); rotate = true; } } @@ -209,7 +208,8 @@ public void stopHappy() resetToStart(); } - public void resetToStart() { + public void resetToStart() + { //On Reset: Player must go into walking state, because it could be that after the happy/running-animation the player is //out of radius and rotates -> AnimationController StateMachine always changes into walking-state after hyppAnimation walking = false; @@ -222,12 +222,14 @@ public void resetToStart() { } //Static Method for CharacterDialog - public bool getPlayerInTalkingZone() { + public bool getPlayerInTalkingZone() + { return playerInTalkingZone; } //Static Method for CharacterDialog - public void setPlayerInTalkingZone(bool value) { + public void setPlayerInTalkingZone(bool value) + { playerInTalkingZone = value; } @@ -246,7 +248,7 @@ public void setTaskCharacterAddressed(bool value) //Static Method for CharacterDialog public void setPlayer(GameObject player) { - this.player = player; + this.player = player; } diff --git a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs index 97ac16e2a03a08b1d2779d357cfb7bb5711f735f..5cd33fbaebce02f90eebe57f16433d7bbefb7e6f 100644 --- a/Assets/Scripts/InteractionEngine/CommunicationEvents.cs +++ b/Assets/Scripts/InteractionEngine/CommunicationEvents.cs @@ -25,7 +25,7 @@ public static class CommunicationEvents public static UnityEvent<Fact, FactWrapper.FactMaterials> AnimateExistingAsSolutionEvent = new(); public static UnityEvent<Fact> AnimateNonExistingFactEvent = new(); public static UnityEvent<List<string>> HintAvailableEvent = new(); - + //------------------------------------------------------------------------------------ @@ -34,7 +34,7 @@ public static class CommunicationEvents public static bool ServerAutoStart = true; public static bool ServerRunning = true; - + //CHANGE HERE PORT OF SERVER public static string ServerPortDefault = "8085"; //used for Local @@ -46,16 +46,16 @@ public static class CommunicationEvents public static int ToolID_new; public static int ToolID_selected;//Script - + /* * will be loaded from other config file */ - public static string lastIP = ""; - public static string newIP = ""; - 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 string lastIP = ""; + public static string newIP = ""; + 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'"; //------ @@ -71,8 +71,8 @@ public static class CommunicationEvents public enum OperationSystem { - Windows=0, - Android=1, + Windows = 0, + Android = 1, } public static bool CursorVisDefault = true; //Script. diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs index e8b18cea1ca08c53ca5520fe53f4326e204dd721..778b0ff927e0100e6147a09d627b199ea12c26a9 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactAdder.cs @@ -1,5 +1,4 @@ -using System; -using UnityEngine; +using UnityEngine; /// <summary> /// Initiates named <see cref="Fact"/> and adds it to <see cref="StageStatic.stage.factState"/> @@ -39,7 +38,7 @@ public static Fact AddFactIfNotFound(Fact fact, out bool exists, bool samestep, /// \copydetails FactManager public static PointFact AddPointFact(RaycastHit hit, bool samestep = false, Gadget gadget = null, string scroll_label = null) { - return (PointFact) AddFactIfNotFound( + return (PointFact)AddFactIfNotFound( new PointFact(hit.point, hit.normal) , out _, samestep, gadget, scroll_label); } @@ -50,7 +49,7 @@ public static PointFact AddPointFact(RaycastHit hit, bool samestep = false, Gadg /// \copydetails FactManager public static PointFact AddPointFact(Vector3 point, Vector3 normal, bool samestep = false, Gadget gadget = null, string scroll_label = null) { - return (PointFact) AddFactIfNotFound( + return (PointFact)AddFactIfNotFound( new PointFact(point, normal) , out _, samestep, gadget, scroll_label); } @@ -107,7 +106,7 @@ public static RayFact AddRayFact(string pid1, string pid2, bool samestep = false PointFact rayP1 = (PointFact)FactRecorder.AllFacts[rayFact.Pid1]; PointFact rayP2 = (PointFact)FactRecorder.AllFacts[rayFact.Pid2]; int layerMask = LayerMask.GetMask("Point"); - RaycastHit[] hitsA = Physics.RaycastAll(rayP1.Point, rayFact.Dir, Mathf.Infinity, layerMask); + RaycastHit[] hitsA = Physics.RaycastAll(rayP1.Point, rayFact.Dir, Mathf.Infinity, layerMask); RaycastHit[] hitsB = Physics.RaycastAll(rayP2.Point, -rayFact.Dir, Mathf.Infinity, layerMask); void AddHitIfOnLine(RaycastHit hit) @@ -144,7 +143,8 @@ public static AngleFact AddAngleFact(string pid1, string pid2, string pid3, bool new AngleFact(pid1, pid2, pid3) , out _, samestep, gadget, scroll_label); - if (angle.is_right_angle) { + if (angle.is_right_angle) + { AddFactIfNotFound( new RightAngleFact(pid1, pid2, pid3) , out _, samestep, gadget, scroll_label); @@ -203,11 +203,11 @@ public static Fact AddParsedAngleFactIfNotFound(AngleFact fact, out bool exists, public static EqualCirclesFact AddEqualCirclesFact(string cid1, string cid2, bool samestep = false, Gadget gadget = null, string scroll_label = null) { - return (EqualCirclesFact)AddFactIfNotFound(new EqualCirclesFact(cid1, cid2), out _, samestep,gadget,scroll_label); + return (EqualCirclesFact)AddFactIfNotFound(new EqualCirclesFact(cid1, cid2), out _, samestep, gadget, scroll_label); } public static UnEqualCirclesFact AddUnEqualCirclesFact(string cid1, string cid2, bool samestep = false, Gadget gadget = null, string scroll_label = null) { - return (UnEqualCirclesFact)AddFactIfNotFound(new UnEqualCirclesFact(cid1, cid2), out _, samestep,gadget,scroll_label); + return (UnEqualCirclesFact)AddFactIfNotFound(new UnEqualCirclesFact(cid1, cid2), out _, samestep, gadget, scroll_label); } } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs index 4f29e9c00708f09b21270a1419e4a4af9505d508..2e6b2e20137c0d756b23bd65e8e3de61eed5d957 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactComparer.cs @@ -20,7 +20,7 @@ public abstract class FactComparer : EqualityComparer<Fact> /// <param name="solution">to be fulfilled</param> /// <param name="fact">to be fulfilling</param> /// <returns><c>true</c> iff fact is described by solution</returns> - protected abstract bool Compare (Fact solution, Fact fact); + protected abstract bool Compare(Fact solution, Fact fact); /// <summary> /// Called by <see cref="SetSearchLeft"/> and <see cref="SetSearchRight"/> to initate any class variables. @@ -85,7 +85,7 @@ public class FactEquivalentsComparer : FactComparer { /// \copydoc FactEquivalentsComparer /// \copydoc FactComparer.Compare - protected override bool Compare (Fact solution, Fact fact) + protected override bool Compare(Fact solution, Fact fact) { return solution.Equivalent(fact); } @@ -102,7 +102,7 @@ class LineFactHightDirectionComparer : FactComparer { /// \copydoc LineFactHightDirectionComparer /// \copydoc FactComparer.Compare - protected override bool Compare (Fact solution, Fact fact) + protected override bool Compare(Fact solution, Fact fact) { return fact is LineFact factLine && solution is LineFact solutionLine && Math3d.IsApproximatelyParallel(factLine.Dir, solutionLine.Dir) diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs index 376c0e8ec66606b614159ad07ca0c1ee5fcc7bf2..e1127c61375e0a1dd356f7f8d2d380e9f4d75d5c 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactRecorder.cs @@ -1,8 +1,8 @@ -using System.Collections.Generic; -using Newtonsoft.Json; -using UnityEngine; -using System.Linq; +using Newtonsoft.Json; using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; using UnityEngine.InputSystem.Utilities; using static CommunicationEvents; diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs index cb844473f45dc90c015e05bdf4d7d94e8653f6df..c90f73e5407b9d7edaa57d163db09a56b9d5ae7c 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject.cs @@ -1,10 +1,10 @@ using System; -using System.Linq; -using System.Collections.Generic; -using UnityEngine; using System.Collections; +using System.Collections.Generic; +using System.Linq; using TMPro; using UnityEditor; +using UnityEngine; using static GlobalBehaviour; /// <summary> diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject3D.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject3D.cs index d30f65d070dc34f1a7e492ffcd0a9cec7d59a568..5f3b155812b4b0eb91494e48dde8921e64ae0002 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject3D.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObject3D.cs @@ -1,8 +1,8 @@ using System; -using System.Linq; -using UnityEngine; using System.Collections; +using System.Linq; using UnityEditor; +using UnityEngine; /// <summary> /// <see cref="Fact.Id"/>/ <c>MonoBehaviour</c> wrapper to be attached to <see cref="Fact.WorldRepresentation"/> diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs index 52163edd4601751872f07f6fe4864c6beb55837f..7a0449d0a3cb18953becd9dbff8b867262a9b32d 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs @@ -6,8 +6,9 @@ public class FactObjectUI : FactObject public Image[] Images; #region Unity Serialization - protected override void _OnBeforeSerialize() { - if(Images == null) + protected override void _OnBeforeSerialize() + { + if (Images == null) Images = GetComponents<Image>().ToArray(); } @@ -20,7 +21,7 @@ protected override void _Awake() Images ??= new Image[0]; - if(MaterialsToChange == null) + if (MaterialsToChange == null) { MaterialsToChange = new UnityEngine.Material[Images.Length]; for (int i = 0; i < Images.Length; i++) diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactWrapper.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactWrapper.cs index 9f39c812e5037338f62c835a9a1c9ff85b529f36..cec5f22cb8245b00fccabc3b99cc195b0538f5cd 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactWrapper.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactWrapper.cs @@ -36,14 +36,14 @@ public Fact Fact { get { - if (_Fact == null && URI != null) + if (_Fact == null && URI != null) FactRecorder.AllFacts.TryGetValue(URI, out _Fact); return _Fact; } set { _Fact = value; - _URI = value?.Id; + _URI = value?.Id; FactUpdated(); } } diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs index 7fbdda756680011edd558dd2c7e9b8b9acbdc6af..ea0df4fcd1dd46473e443c46b9053623fdecf675 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/RenderedScrollFact.cs @@ -1,8 +1,8 @@ -using System.Collections.Generic; +using REST_JSON_API; +using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.EventSystems; -using REST_JSON_API; using static CommunicationEvents; public class RenderedScrollFact : FactObjectUI, IDropHandler @@ -94,7 +94,7 @@ public void OnHintAvailable(List<string> uris) } #region DropHandling - public FactObjectUI Payload + public FactObjectUI Payload => _Payload == null ? null : _Payload.GetComponent<FactObjectUI>(); private GameObject _Payload; diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs index 36022ae6d6caeb0e230db13fc6e8d1e00551b0a7..6d3b328ae659e6c39b145b7d4a8a2dab03374c0c 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/AbstractLineFact.cs @@ -202,7 +202,7 @@ public override MMTFact MakeMMTDeclaration() } public override SOMDoc Defines() - =>new OMA( + => new OMA( new OMS(MMTConstants.LineOf), new[] { new OMS(Pid1), diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs index bb2263f8ad3620c9bd0599e81c80f11becceccc4..902763cfad64007c5d39d308149d4479c585bcd6 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CircleFact.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using Newtonsoft.Json; +using Newtonsoft.Json; using REST_JSON_API; +using System; using System.Collections; +using System.Collections.Generic; +using UnityEngine; /// <summary> /// A Circle that is made out of a middle point, a plane and a radius diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs index ac3d8bc04998aca7c55c456ddcbcbf82b62981ea..15828e908e772e13cdb11ba34c31bc49d191daaf 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.Networking; +using JsonSubTypes; using Newtonsoft.Json; -using JsonSubTypes; -using System.Linq; using REST_JSON_API; +using System; using System.Collections; +using System.Collections.Generic; +using System.Linq; using System.Linq.Expressions; +using UnityEngine; +using UnityEngine.Networking; public static class ParsingDictionary { diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs index e00a6a99cc02754539468e1ae2add8c3b3f20410..226f3b8e631ad68461b7e5af6bfcadd63d34d90e 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/FunctionFact.cs @@ -1,15 +1,15 @@ -using System; +using Newtonsoft.Json; +using REST_JSON_API; +using System; +using System.Collections; using System.Collections.Generic; -using UnityEngine; -using Newtonsoft.Json; using System.Linq; -using REST_JSON_API; using System.Linq.Expressions; -using System.Collections; +using UnityEngine; public class FunctionCallFact : FactWrappedCRTP<FunctionCallFact> { - protected override object GetCompiledValue() + protected override object GetCompiledValue() => Tuple.Create(Domain, Function_args.CompiledValue, Function.CompiledValue); public string func_id @@ -150,7 +150,7 @@ protected override Fact _ReInitializeMe(Dictionary<string, string> old_to_new) public class FunctionFact : FactWrappedCRTP<FunctionFact> { - protected override object GetCompiledValue() + protected override object GetCompiledValue() => Expression.Lambda(CompileBase).Compile().DynamicInvoke(); public SOMDoc Function_SOMDoc; diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs index 6fcd8fc5a3ed0dc4a0230f595c44ac018beb40dd..c3a6053e59a6e8114af826feed7160078df9540e 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/MMTTypes.cs @@ -1,13 +1,13 @@ +using Newtonsoft.Json; +using REST_JSON_API; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; -using System; -using REST_JSON_API; +using System.Linq.Expressions; +using System.Runtime.CompilerServices; using Unity.Mathematics; using UnityEngine; -using System.Runtime.CompilerServices; -using Newtonsoft.Json; -using System.Collections; -using System.Linq.Expressions; /// <summary> /// diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs index bd05a3b738ad41029b953fe49d099147e38dadbf..29af5a54c0b29699f49646f2a07896f0ce9fa7fe 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/UnsortedFact.cs @@ -1,10 +1,10 @@ using Newtonsoft.Json; using REST_JSON_API; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; -using System; using UnityEngine; -using System.Collections; /// <summary> /// Point in 3D Space @@ -512,7 +512,7 @@ private void Init(Vector3[] Verticies) throw new NotImplementedException(); } - public override MMTFact MakeMMTDeclaration() + public override MMTFact MakeMMTDeclaration() => new MMTGeneralFact(_LastLabel, GetMMTType(), Defines()); public override SOMDoc Defines() diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs index 07cac37357b88150c40667954c8ef61fc131d5e7..6cf53fea9dccc8cfc8776e15fbc5f65db12c1323 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/VolumeFacts.cs @@ -1,7 +1,7 @@ -using System.Collections; -using System.Collections.Generic; -using Newtonsoft.Json; +using Newtonsoft.Json; using REST_JSON_API; +using System.Collections; +using System.Collections.Generic; /// <summary> /// The volume of a cone A defined by a base area <see cref="CircleFact">CircleFact</see>, an apex <see cref="PointFact">PointFact</see> and the volume as float diff --git a/Assets/Scripts/InteractionEngine/FactHandling/SolutionRecorder.cs b/Assets/Scripts/InteractionEngine/FactHandling/SolutionRecorder.cs index f340a9fe2fb2c2b48fe7152bbd75ca3363f60386..562a1bc970b8357bc470fa721aecbd3510c504c7 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/SolutionRecorder.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/SolutionRecorder.cs @@ -1,9 +1,9 @@ -using System; +using MoreLinq; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using MoreLinq; -using Newtonsoft.Json; using static CommunicationEvents; /// <summary> diff --git a/Assets/Scripts/InteractionEngine/ForestElementsManager.cs b/Assets/Scripts/InteractionEngine/ForestElementsManager.cs index c149aec7292d909129c7021b5d8ee92ce649269a..805a1677ce9dfd7cb46b6239f849f7563b3a8415 100644 --- a/Assets/Scripts/InteractionEngine/ForestElementsManager.cs +++ b/Assets/Scripts/InteractionEngine/ForestElementsManager.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; public class ForestElementsManager : MonoBehaviour diff --git a/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs b/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs index 61abf7534e8174b270a0a653b066b79cdbe6a788..07b16eabe5f3bf73fd938b030abd51f59539420b 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/EqualCircleGadget.cs @@ -27,7 +27,7 @@ protected override void _Hit(RaycastHit[] hit) CircleFact FirstCircle = (CircleFact)FactRecorder.AllFacts[tempFactId]; if (Mathf.Approximately(FirstCircle.radius, tempFact.radius)) - FactAdder.AddEqualCirclesFact (Workflow[0], tempFactId); + FactAdder.AddEqualCirclesFact(Workflow[0], tempFactId); else FactAdder.AddUnEqualCirclesFact(Workflow[0], tempFactId); diff --git a/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs b/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs index 4a214266d0e6a375edaa21e5ceccf53191a047c3..39dbb095cb19b6509f56983bd13e4544e8ab25b7 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/GadgetBehaviour.cs @@ -74,7 +74,8 @@ private void OnDestroy() private void Awake() { Singelton ??= this; - if (this != Singelton) { + if (this != Singelton) + { Debug.LogError("Only one Instance of GadgetManager allowed!"); return; } @@ -108,7 +109,7 @@ void CreateButton(int gid) { GameObject button = GameObject.Instantiate(GadgetButton, parent: ParentMe.transform); button.GetComponent<Image>().sprite = ButtonSprites[gadgets[gid].ButtonIndx]; - + (buttons[gid] = button.GetComponent<Button>()) .onClick.AddListener(() => ActivateGadget(gid)); } @@ -141,7 +142,7 @@ void Update() if (Input.GetButtonDown("ToolMode")) offset = 1; else if (Input.GetAxis("Mouse ScrollWheel") != 0) - offset = (int) Mathf.Sign(Input.GetAxis("Mouse ScrollWheel")); + offset = (int)Mathf.Sign(Input.GetAxis("Mouse ScrollWheel")); if (offset != 0) ActivateGadget(ActiveGadgetInd + offset); @@ -166,8 +167,8 @@ void OnEnable() public static void ActivateGadget(int gid) { ParentMe.SetActive(true); - gid += gid >= gadgets.Length - ? -gadgets.Length + gid += gid >= gadgets.Length + ? -gadgets.Length : gid < 0 ? +gadgets.Length : 0; //buttons[activeGadget].animator.StopPlayback(); diff --git a/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs b/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs index 51d90a01b147826eebba1f8f2af8dd52406d5837..bbe8acbcb7a0a86eb5b4ccd911831451e9e9e164 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/LotTool.cs @@ -1,8 +1,5 @@ using Newtonsoft.Json; -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using static CommunicationEvents; public class LotTool : Gadget //constructs a Perpendicular between a Line and a Point @@ -46,7 +43,7 @@ void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) return; Workflow.Add(tempFactId); - BaseLine = (AbstractLineFact) tempFact; + BaseLine = (AbstractLineFact)tempFact; BaseLineRoot = ((PointFact)FactRecorder.AllFacts[BaseLine.Pid1]).Point; BaseLineHit = hit[0].point; @@ -78,7 +75,7 @@ void CreateRayAndAngles(string IntersectionId, string LotPointId, bool samestep) break; case 2: // create perpendicular through new Point off Line - if (!((LayerMask) hit[0].transform.gameObject.layer).IsAnyByName(new string[] { "Default", "Tree" })) + if (!((LayerMask)hit[0].transform.gameObject.layer).IsAnyByName(new string[] { "Default", "Tree" })) return; Vector3 LotPoint = Math3d.ProjectPointOnLine(hit[0].point, BaseLine.Dir, IntersectionPoint); @@ -107,11 +104,13 @@ protected override void _ActivateLineDrawing() //Updates the points of the Lines when baseLine was selected in LineMode protected override void _UpdateLineDrawing() { - if (Workflow.Count < 2) { + if (Workflow.Count < 2) + { SetPosition(0, GadgetBehaviour.Cursor.transform.position); SetPosition(1, Math3d.ProjectPointOnLine(BaseLineRoot, BaseLine.Dir, GetPosition(0))); } - else { + else + { SetPosition(1, IntersectionPoint); SetPosition(0, Math3d.ProjectPointOnLine(GadgetBehaviour.Cursor.transform.position, BaseLine.Dir, GetPosition(1))); } diff --git a/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs b/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs index 9d93ce8f1645fcca073ac3fef2a34e963f51d0ed..ac2b3eedb3298ed75667fd6c5ae656d60ef7a4b2 100644 --- a/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs +++ b/Assets/Scripts/InteractionEngine/Gadgets/Remover.cs @@ -1,8 +1,5 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using UnityEngine; -using static CommunicationEvents; public class Remover : Gadget { @@ -16,7 +13,7 @@ protected override void _Hit(RaycastHit[] hit) bool samestep = false; foreach (string uri in hit.Select(h => h.transform.GetComponent<FactObject>()?.URI)) { - if(uri == null) + if (uri == null) continue; Workflow.Add(uri); diff --git a/Assets/Scripts/InteractionEngine/TBD/Interactable.cs b/Assets/Scripts/InteractionEngine/TBD/Interactable.cs index 1be9b825a50c8c392c16c3eec2ff7ba08e48700d..ea61ccb8984172ca88d6bd9d7e3f56ed88b49d3b 100644 --- a/Assets/Scripts/InteractionEngine/TBD/Interactable.cs +++ b/Assets/Scripts/InteractionEngine/TBD/Interactable.cs @@ -1,4 +1,3 @@ -using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -14,12 +13,12 @@ public class Interactable : MonoBehaviour // Start is called before the first frame update void Start() { - + } // Update is called once per frame void Update() { - + } } diff --git a/Assets/Scripts/InteractionEngine/WorldCursor.cs b/Assets/Scripts/InteractionEngine/WorldCursor.cs index 9ee2ac56b5c9265939dcdd5789575657db70bfb8..2cfbb31c9e7ec8ea771f426e7cf0e2f5b3db1456 100644 --- a/Assets/Scripts/InteractionEngine/WorldCursor.cs +++ b/Assets/Scripts/InteractionEngine/WorldCursor.cs @@ -1,9 +1,9 @@ -using System.Globalization; +using MoreLinq; using System.Collections.Generic; +using System.Globalization; +using System.Linq; using UnityEngine; using UnityEngine.EventSystems; -using MoreLinq; -using System.Linq; public class WorldCursor : MonoBehaviour { diff --git a/Assets/Scripts/InventoryStuff/DisplayFacts.cs b/Assets/Scripts/InventoryStuff/DisplayFacts.cs index fcff0fcef4eb0cf8224269261b1d5961e8a79683..9070aa63da97dc6eafa50d2a5c072b51663d80ca 100644 --- a/Assets/Scripts/InventoryStuff/DisplayFacts.cs +++ b/Assets/Scripts/InventoryStuff/DisplayFacts.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; -using UnityEngine; +using MoreLinq; using System; -using System.Linq; -using UnityEngine.UI; -using MoreLinq; +using System.Collections.Generic; using System.ComponentModel; +using System.Linq; using UnityEditor; +using UnityEngine; +using UnityEngine.UI; using static CommunicationEvents; public class DisplayFacts : MonoBehaviour, ISerializationCallbackReceiver @@ -47,7 +47,7 @@ public void OnBeforeSerialize() // if order has changed => do not forget var keys = _PrefabDictionary.Keys.Select(type => type.ToString()).ToList(); var keys_permutation = PrefabtTypeReadonly.Select(type => keys.IndexOf(type)).ToArray(); - + _PrefabDictionary.TryGetValue(typeof(TestFact), out GameObject POdefault); var vals = _PrefabDictionary.Values.ToArray(); diff --git a/Assets/Scripts/InventoryStuff/ScrollDetails.cs b/Assets/Scripts/InventoryStuff/ScrollDetails.cs index 6c570edb9e9e9aa14d5c714eba699a778b9ecee4..81755de95fd4be271120ce8db8fecd927bbc5806 100644 --- a/Assets/Scripts/InventoryStuff/ScrollDetails.cs +++ b/Assets/Scripts/InventoryStuff/ScrollDetails.cs @@ -1,11 +1,11 @@ -using System.Collections; +using Newtonsoft.Json; +using REST_JSON_API; +using System.Collections; using System.Collections.Generic; -using UnityEngine; +using System.Linq; using TMPro; +using UnityEngine; using UnityEngine.Networking; -using Newtonsoft.Json; -using System.Linq; -using REST_JSON_API; using static CommunicationEvents; public class ScrollDetails : MonoBehaviour diff --git a/Assets/Scripts/InventoryStuff/ToggleFactscreen.cs b/Assets/Scripts/InventoryStuff/ToggleFactscreen.cs index adc378141e3fe9aa1efbe63689dae4619f7aa2ae..d9dbde3d6aca57d244eb370bb2bc84c42919cb16 100644 --- a/Assets/Scripts/InventoryStuff/ToggleFactscreen.cs +++ b/Assets/Scripts/InventoryStuff/ToggleFactscreen.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; diff --git a/Assets/Scripts/InventoryStuff/ToggleRotateImage.cs b/Assets/Scripts/InventoryStuff/ToggleRotateImage.cs index 3c893c1023de43904f33fa1d0946615534550a36..1fb0f8cc3ce1e256c435e166bf5ad02241a70777 100644 --- a/Assets/Scripts/InventoryStuff/ToggleRotateImage.cs +++ b/Assets/Scripts/InventoryStuff/ToggleRotateImage.cs @@ -2,8 +2,9 @@ using UnityEngine.UI; //[ExecuteInEditMode] -public class ToggleRotateImage : MonoBehaviour { - [SerializeField] Transform targetGraphic; +public class ToggleRotateImage : MonoBehaviour +{ + [SerializeField] Transform targetGraphic; Toggle _toggle; Toggle toggle => _toggle ??= GetComponent<Toggle>(); diff --git a/Assets/Scripts/Loading/Loader.cs b/Assets/Scripts/Loading/Loader.cs index 840e7d64c209b8a6675dd01ceab3a9f299f8d76b..e4c0c2aa74fb6aab7c45f5202091d3466ab12359 100644 --- a/Assets/Scripts/Loading/Loader.cs +++ b/Assets/Scripts/Loading/Loader.cs @@ -11,7 +11,7 @@ public static class Loader /// <summary> /// <c>return <see cref="loadingscene"/> == <see langword="null"/> ? 1f : <see cref="loadingscene"/>.progress;</c> /// </summary> - public static float progress + public static float progress => loadingscene == null ? 1f : loadingscene.progress; /// <summary> diff --git a/Assets/Scripts/Loading/LoadingScreenPercentage.cs b/Assets/Scripts/Loading/LoadingScreenPercentage.cs index bee09c9eff2faca51461266cc83600c09058f87d..241dc3861abb7672045fa7a15eeddfa4ce48f329 100644 --- a/Assets/Scripts/Loading/LoadingScreenPercentage.cs +++ b/Assets/Scripts/Loading/LoadingScreenPercentage.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; /// <summary> diff --git a/Assets/Scripts/Loading/Stage.cs b/Assets/Scripts/Loading/Stage.cs index da0090ba911f87447cd37d90030432d30fc46e29..ba06db5f9cd436cc444cee016044d8c7e1f2fa07 100644 --- a/Assets/Scripts/Loading/Stage.cs +++ b/Assets/Scripts/Loading/Stage.cs @@ -1,11 +1,9 @@ -using System.IO; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Newtonsoft.Json; -using System; using static CommunicationEvents; -using System.Collections; public class Stage : IJSONsavable<Stage> { @@ -379,7 +377,7 @@ public static bool ShallowLoad(out Stage set, string path) DateTime t_PP = DateTime.Now; - if(!IJSONsavable<Stage>.load_children(null /*hierarchie*/, set.name, ref set, post_process: true)) + if (!IJSONsavable<Stage>.load_children(null /*hierarchie*/, set.name, ref set, post_process: true)) _ = set.player_record; //init set.player_record.CopyExposedSolutionFacts(set); @@ -445,7 +443,7 @@ public class SaveGame : IJSONsavable<SaveGame> public string path { get; set; } [JsonIgnore] - public bool IsEmpty + public bool IsEmpty => (player_record_list ??= new()).Count == 0; [JsonIgnore]//[JSONsavable.JsonAutoPreProcess, JSONsavable.JsonAutoPostProcess] diff --git a/Assets/Scripts/Loading/StreamingAssetLoader.cs b/Assets/Scripts/Loading/StreamingAssetLoader.cs index 209ba364dee8c866f1550507255a4fbda9aed2c8..0d4e7f6521befece4c3c57e565e6180ef7f2b371 100644 --- a/Assets/Scripts/Loading/StreamingAssetLoader.cs +++ b/Assets/Scripts/Loading/StreamingAssetLoader.cs @@ -1,14 +1,9 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; +using System; using System.IO; // -using UnityEngine.Video;//streaming +using UnityEngine; using UnityEngine.Networking; using static CommunicationEvents; using static UIconfig; -using System; //Uploading Files from StreamingAsset folder to the Persistent Folder for Android Devices @@ -58,7 +53,7 @@ public static bool ReloadManualy_StreamToDataPath() string sourcePath = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_Folder); string targetFolder = Application.dataPath; RereadFileWithUnityWebRequest(sourcePath, "", StreamToDataPath_Folder_Cookie, targetFolder); - + NetworkJSON_Load(); //Debug.Log("Reloaded_DP"); return true; @@ -66,7 +61,7 @@ public static bool ReloadManualy_StreamToDataPath() public static bool ReloadManualy_StreamToDataPathWithHandler(string TargetDir_1) { string sourcePath = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_withHandler_Folder); - string targetFolder_dpwh = TargetDir_1 ; + string targetFolder_dpwh = TargetDir_1; //Debug.Log(targetFolder_dpwh); string sourcePath2 = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_withHandler_Folder, Stage_Folder); @@ -91,7 +86,7 @@ public enum ID_toPath public static bool checkPersistentDataPath() - { + { return checkFileExistence(Application.persistentDataPath, StreamToPersistentDataPath_Folder_Cookie); } public static bool checkDataPath() @@ -121,7 +116,7 @@ public static void NetworkJSON_Save() { NetworkJSON myObject = new NetworkJSON(); - + //MyClass myObject = new MyClass(); myObject.newIP = CommunicationEvents.newIP; myObject.lastIP = CommunicationEvents.lastIP; @@ -146,7 +141,7 @@ public static void NetworkJSON_Save() //Data storage - SafeCreateDirectory(Path.Combine(Application.persistentDataPath ,ConfigDir)); + SafeCreateDirectory(Path.Combine(Application.persistentDataPath, ConfigDir)); //string json = JsonUtility.ToJson(date); string json = JsonUtility.ToJson(myObject); StreamWriter Writer = new StreamWriter(Path.Combine(Application.persistentDataPath, ConfigDir, ConfigFile_Network)); @@ -156,7 +151,7 @@ public static void NetworkJSON_Save() } public static DirectoryInfo SafeCreateDirectory(string path) { - + //Generate if you don't check if the directory exists if (Directory.Exists(path)) { @@ -216,13 +211,14 @@ public static void deleteADirectoryAndSubDir(string path) 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); string targetFolder = Application.persistentDataPath; - if(!ReReadFiles(rootPath, targetFolder)){ + if (!ReReadFiles(rootPath, targetFolder)) + { ReloadManualy_StreamToPers(); } } @@ -231,20 +227,20 @@ public static void RereadFiles_DataPath() //Debug.Log("Reread_DataPath"); string rootPath = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_Folder); string targetFolder = Application.dataPath; - + RereadFiles_DataPath_withHandler(); if (!ReReadFiles(rootPath, targetFolder)) { ReloadManualy_StreamToDataPath(); } - + } public static void RereadFiles_DataPath_withHandler() { string rootPath = Path.Combine(Application.streamingAssetsPath, StreamToDataPath_withHandler_Folder); string targetFolder_wh = Application.dataPath; - + //Debug.Log(CommunicationEvents.Opsys); if (CommunicationEvents.Opsys == OperationSystem.Android) { @@ -261,7 +257,7 @@ public static void RereadFiles_DataPath_withHandler() public static bool ReReadFiles(string rootPath, string targetFolder)//ID_toPath PathHandler) { - if (!Directory.Exists(rootPath)) { Debug.Log("no Dir: " + rootPath); return false ; } + if (!Directory.Exists(rootPath)) { Debug.Log("no Dir: " + rootPath); return false; } //---- //Debug.Log("Loading Dir"); @@ -292,7 +288,8 @@ public static bool ReReadFiles(string rootPath, string targetFolder)//ID_toPath foreach (FileInfo file in Files) { if (file.Name.Contains(".meta")) { continue; }; - if(!RereadFileWithUnityWebRequest(dir_fullpath, dir, file.Name, targetFolder)){ + if (!RereadFileWithUnityWebRequest(dir_fullpath, dir, file.Name, targetFolder)) + { return false; } } @@ -323,83 +320,137 @@ public static void NetworkJSON_Load_x(string path) NetworkJSONonlyString myObjsOnlyStrings = JsonUtility.FromJson<NetworkJSONonlyString>(json); NetworkJSON myObjs = JsonUtility.FromJson<NetworkJSON>(json); - if (string.IsNullOrEmpty(myObjsOnlyStrings.newIP)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.newIP)) + { CommunicationEvents.newIP = ""; - } else { + } + else + { CommunicationEvents.newIP = myObjs.newIP; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.lastIP)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.lastIP)) + { CommunicationEvents.lastIP = ""; - } else { + } + else + { CommunicationEvents.lastIP = myObjs.lastIP; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.IPslot1)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.IPslot1)) + { CommunicationEvents.IPslot1 = ""; - } else { + } + else + { CommunicationEvents.IPslot1 = myObjs.IPslot1;//myObjs.IPslot1; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.IPslot2)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.IPslot2)) + { CommunicationEvents.IPslot2 = "";//"Empty"; - } else { + } + else + { CommunicationEvents.IPslot2 = myObjs.IPslot2; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.IPslot3)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.IPslot3)) + { CommunicationEvents.IPslot3 = ""; - } else { + } + else + { CommunicationEvents.IPslot3 = myObjs.IPslot3; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.selecIP)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.selecIP)) + { CommunicationEvents.selecIP = ""; - } else { + } + else + { CommunicationEvents.selecIP = myObjs.selecIP; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.ControlMode)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.ControlMode)) + { + } + else + { UIconfig.controlMode = (ControlMode)Enum.Parse(typeof(ControlMode), myObjs.ControlMode); } - if (string.IsNullOrEmpty(myObjsOnlyStrings.TouchMode)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.TouchMode)) + { + } + else + { UIconfig.touchControlMode = myObjs.TouchMode; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.TAvisibility)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.TAvisibility)) + { + } + else + { UIconfig.TAvisibility = myObjs.TAvisibility; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.autoOSrecognition)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.autoOSrecognition)) + { + } + else + { CommunicationEvents.autoOSrecognition = myObjs.autoOSrecognition; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.autoOSrecognition)){ - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.autoOSrecognition)) + { + } + else + { UIconfig.autoSettingsAdaption = myObjs.autoSettingsAdaption; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.Opsys)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.Opsys)) + { + } + else + { CommunicationEvents.Opsys = (OperationSystem)Enum.Parse(typeof(OperationSystem), myObjs.Opsys); } - if (string.IsNullOrEmpty(myObjsOnlyStrings.FrameITUIversion)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.FrameITUIversion)) + { + } + else + { UIconfig.FrameITUIversion = myObjs.FrameITUIversion; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.InputManagerVersion)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.InputManagerVersion)) + { + } + else + { UIconfig.InputManagerVersion = myObjs.InputManagerVersion; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.colliderScale_all)) { + if (string.IsNullOrEmpty(myObjsOnlyStrings.colliderScale_all)) + { - } else { + } + else + { UIconfig.colliderScale_all = myObjs.colliderScale_all; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.cursorSize)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.cursorSize)) + { + } + else + { UIconfig.cursorSize = myObjs.cursorSize; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.camRotatingSensitivity)) { - } else { + if (string.IsNullOrEmpty(myObjsOnlyStrings.camRotatingSensitivity)) + { + } + else + { UIconfig.camRotatingSensitivity = myObjs.camRotatingSensitivity; } - if (string.IsNullOrEmpty(myObjsOnlyStrings.MouseKeepingInWindow)){ - }else{ + if (string.IsNullOrEmpty(myObjsOnlyStrings.MouseKeepingInWindow)) + { + } + else + { UIconfig.MouseKeepingInWindow = myObjs.MouseKeepingInWindow; } @@ -407,7 +458,7 @@ public static void NetworkJSON_Load_x(string path) public static void RereadFileUWR(string pathfolders, string fileName, ID_toPath toMainpath) { - if (fileName == ""){ return; } + if (fileName == "") { return; } string sourcePath = Path.Combine(Application.streamingAssetsPath, pathfolders); string destpathf = pathfolders; string destname = fileName; @@ -446,11 +497,11 @@ public static void RereadFileUWR(string pathfolders, string fileName, ID_toPath } } - public static bool RereadFileWithUnityWebRequest(string sourcePath1, string pathfolders, string fileName, string targetpath) + public static bool RereadFileWithUnityWebRequest(string sourcePath1, string pathfolders, string fileName, string targetpath) { - - if (fileName == "") { Debug.Log("no File"); return false; } + + if (fileName == "") { Debug.Log("no File"); return false; } string destpathf = pathfolders; string destname = fileName; @@ -588,44 +639,44 @@ public static string RereadFileNA(string pathfolders, string fileName, string de public static void RereadFileUW4(string pathfolders, string fileName, string destpathf, string destname) { - if (fileName == "") - { - return; - } + if (fileName == "") + { + return; + } - string sourcePath = Path.Combine(Application.streamingAssetsPath, pathfolders); - sourcePath = Path.Combine(sourcePath, fileName); - using var loadingRequest = UnityWebRequest.Get(sourcePath); - loadingRequest.SendWebRequest(); - while (!loadingRequest.isDone) + string sourcePath = Path.Combine(Application.streamingAssetsPath, pathfolders); + sourcePath = Path.Combine(sourcePath, fileName); + using var loadingRequest = UnityWebRequest.Get(sourcePath); + loadingRequest.SendWebRequest(); + while (!loadingRequest.isDone) + { + if (loadingRequest.result == UnityWebRequest.Result.ConnectionError || loadingRequest.result == UnityWebRequest.Result.ProtocolError) { - if (loadingRequest.result == UnityWebRequest.Result.ConnectionError || loadingRequest.result == UnityWebRequest.Result.ProtocolError) - { - break; - } + break; } - if (loadingRequest.result==UnityWebRequest.Result.ConnectionError || loadingRequest.result==UnityWebRequest.Result.ProtocolError) - { + } + if (loadingRequest.result == UnityWebRequest.Result.ConnectionError || loadingRequest.result == UnityWebRequest.Result.ProtocolError) + { - } - else - { - //copies and unpacks file from apk to persistentDataPath where it can be accessed - string destinationPath = Path.Combine(Application.persistentDataPath, destpathf); + } + else + { + //copies and unpacks file from apk to persistentDataPath where it can be accessed + string destinationPath = Path.Combine(Application.persistentDataPath, destpathf); - if (Directory.Exists(destinationPath) == false) - { - Directory.CreateDirectory(destinationPath); - } - File.WriteAllBytes(Path.Combine(destinationPath, destname), loadingRequest.downloadHandler.data); + if (Directory.Exists(destinationPath) == false) + { + Directory.CreateDirectory(destinationPath); } + File.WriteAllBytes(Path.Combine(destinationPath, destname), loadingRequest.downloadHandler.data); + } } - + public class MyClass diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/Endpoints.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/Endpoints.cs index 0b8ee4d68c62c52ef19344fd7f9347f2b4663415..67b538eeccd0cebfbd90ca453924d69f07e80e28 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/Endpoints.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/Endpoints.cs @@ -1,9 +1,7 @@ using JsonSubTypes; using Newtonsoft.Json; using System.Collections.Generic; -using System.Runtime.Serialization; using System.Text.RegularExpressions; -using static Unity.Burst.Intrinsics.X86; /// <summary> /// Implements REST/JSON API diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs index 0a95014a59149056aa456aad510aab8d99386b93..de04d96ab0e1a956dd52eb505df2d7345a68b6f3 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using UnityEngine; namespace REST_JSON_API @@ -264,7 +263,7 @@ public static class MMTConstants ListType }, }; public static readonly IReadOnlyDictionary<string, string> TypeOF_TO_HomogenApplication = HomogenApplication_TO_TypeOF.ReverseKeyVal(); - + //TODO: Make this dynamic //public static readonly IReadOnlyDictionary<string, int> ApplicationSelector_TO_Index = new Dictionary<string, int> { // { GetField, diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocToLambdaExpression.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocToLambdaExpression.cs index e919909e04acb68293ab434a4b711b0f880cd29d..7cd2a72440402f1baae31d757bec4a8d0faf329d 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocToLambdaExpression.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocToLambdaExpression.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; -using System.Linq.Expressions; -using System; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; -using UnityEngine; +using System.Linq.Expressions; using System.Reflection; using UnityEditor; -using System.Collections.ObjectModel; +using UnityEngine; namespace REST_JSON_API { diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs index 9381af65126f945baaff2fb86bd01904582cd057..18201bded4c5e5f0f683549f4c9029d0339fe4ab 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/SOMDocs.cs @@ -1,13 +1,13 @@ using JsonSubTypes; +using MoreLinq; using Newtonsoft.Json; +using System; +using System.Collections; using System.Collections.Generic; -using System.Linq.Expressions; using System.Linq; -using System; -using UnityEngine; -using MoreLinq; +using System.Linq.Expressions; using System.Runtime.CompilerServices; -using System.Collections; +using UnityEngine; namespace REST_JSON_API { diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/TupleFactory.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/TupleFactory.cs index a36f9e4969821a9401d3fc0d0efd2e437a462cd5..6994430898a84785755e9b3c4be042c55973f7f3 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/TupleFactory.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/TupleFactory.cs @@ -1,11 +1,11 @@ +using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Linq.Expressions; -using System.Reflection.Emit; using System.Reflection; +using System.Reflection.Emit; using System.Runtime.CompilerServices; -using System; -using System.Linq; // from https://stackoverflow.com/questions/31918924/expression-tree-to-initialize-new-anonymous-object-with-arbitrary-number-of-prop diff --git a/Assets/Scripts/MeshGenerator/BoundingPositioning.cs b/Assets/Scripts/MeshGenerator/BoundingPositioning.cs index 60cfae432fa2298f5afcd7b60b62c5f8dd0652b1..0eb8e45e5a27dc719bb9fa1d0fa39d68d13a27bb 100644 --- a/Assets/Scripts/MeshGenerator/BoundingPositioning.cs +++ b/Assets/Scripts/MeshGenerator/BoundingPositioning.cs @@ -29,8 +29,8 @@ private void UpdatePosition() }; transform.position = new Vector3( - bounds[(int)x][0], - bounds[(int)y][1], + bounds[(int)x][0], + bounds[(int)y][1], bounds[(int)z][2] ); } diff --git a/Assets/Scripts/MeshGenerator/CircleGenerator.cs b/Assets/Scripts/MeshGenerator/CircleGenerator.cs index 5f8e3b70e2598908e1ea01991ee59914240c0a32..31ff35d0fc07d894b25fa4943b6d46972e1a906b 100644 --- a/Assets/Scripts/MeshGenerator/CircleGenerator.cs +++ b/Assets/Scripts/MeshGenerator/CircleGenerator.cs @@ -6,10 +6,10 @@ public class CircleGenerator : ShapeGenerator { #region InspectorVariables [Header("Circle values")] - [Range(0,100)] public float radius = 1f; + [Range(0, 100)] public float radius = 1f; [Header("Technical")] - [Range(3,1000)] public int sideCount = 500; + [Range(3, 1000)] public int sideCount = 500; #endregion InspectorVariables #region Implementation diff --git a/Assets/Scripts/MeshGenerator/CircleSegmentGenerator.cs b/Assets/Scripts/MeshGenerator/CircleSegmentGenerator.cs index e8e284b7a55eda5f284324d6529daeee0a2d8854..a5a97f75583ff237208183384411c5bca340d916 100644 --- a/Assets/Scripts/MeshGenerator/CircleSegmentGenerator.cs +++ b/Assets/Scripts/MeshGenerator/CircleSegmentGenerator.cs @@ -19,7 +19,7 @@ public void setAngle(float angle) private void CreateSegment(float angle, float radius) { - float absoluteAngle = angle == 0f ? (float) Math3d.vectorPrecission : Mathf.Abs(angle); + float absoluteAngle = angle == 0f ? (float)Math3d.vectorPrecission : Mathf.Abs(angle); List<Vector3> verticeList = new List<Vector3>(); List<int> triangleList = new List<int>(); @@ -55,8 +55,8 @@ private void CreateSegment(float angle, float radius) //Add first Points at the beginning of the angle float firstPointX = radius * Mathf.Cos(negAngle * Mathf.Deg2Rad); float firstPointZ = radius * Mathf.Sin(negAngle * Mathf.Deg2Rad); - verticeList.Add(new Vector3(firstPointX, -height/2, firstPointZ)); - verticeList.Add(new Vector3(firstPointX, +height/2, firstPointZ)); + verticeList.Add(new Vector3(firstPointX, -height / 2, firstPointZ)); + verticeList.Add(new Vector3(firstPointX, +height / 2, firstPointZ)); //Adding triangles for left side if (absoluteAngle != 360) @@ -72,8 +72,8 @@ private void CreateSegment(float angle, float radius) i += 2; } - verticeList.Add(new Vector3(newPointX, -height/2, newPointZ)); - verticeList.Add(new Vector3(newPointX, +height/2, newPointZ)); + verticeList.Add(new Vector3(newPointX, -height / 2, newPointZ)); + verticeList.Add(new Vector3(newPointX, +height / 2, newPointZ)); //Adding triangles for upper- and lower-side triangleList.Add(center0Index); diff --git a/Assets/Scripts/MeshGenerator/ConeGenerator.cs b/Assets/Scripts/MeshGenerator/ConeGenerator.cs index ebc95111e39c11e369f3eb94069e60a4908da894..d45cf547e2aff419f3a08e0b395a0a032b777bdc 100644 --- a/Assets/Scripts/MeshGenerator/ConeGenerator.cs +++ b/Assets/Scripts/MeshGenerator/ConeGenerator.cs @@ -11,7 +11,7 @@ public class ConeGenerator : ShapeGenerator public Vector3 topPosition = new Vector3(0, 1f, 0); [Header("Technical")] - [Range(3,1000)] + [Range(3, 1000)] public int sideCount = 500; #endregion InspectorVariables diff --git a/Assets/Scripts/MeshGenerator/ShapeGenerator.cs b/Assets/Scripts/MeshGenerator/ShapeGenerator.cs index 5437db581b8762f8a6d71f8bbf9a4c20deae38e5..8e2d3095aca14a31dfc83c7149be30c34a5de925 100644 --- a/Assets/Scripts/MeshGenerator/ShapeGenerator.cs +++ b/Assets/Scripts/MeshGenerator/ShapeGenerator.cs @@ -31,7 +31,7 @@ protected void GenerateShapeForAll() NormalOffset?.CopyTo(0, _NormalOffset, 0 , math.min(NormalOffset.Count, Meshs.Count)); - (Vector3[] vertices, int[] triangles) topology = + (Vector3[] vertices, int[] triangles) topology = GenerateTopology(); if (topology.vertices.Length == 0) @@ -50,7 +50,7 @@ protected void GenerateShapeForAll() mesh.SetVertices( mesh.vertices - .Zip(normals, (v, n) + .Zip(normals, (v, n) => v + n * _NormalOffset[i]) .ToList() ); diff --git a/Assets/Scripts/MeshGenerator/TorusGenerator.cs b/Assets/Scripts/MeshGenerator/TorusGenerator.cs index 3d8dd0c6a69c62a4c5d0d128a93ed9a0e950fbc9..25ee4dc138f8b2d3069ae1e50cf1c48f9b0ff2c3 100644 --- a/Assets/Scripts/MeshGenerator/TorusGenerator.cs +++ b/Assets/Scripts/MeshGenerator/TorusGenerator.cs @@ -1,5 +1,5 @@ -using UnityEngine; using System; +using UnityEngine; public class TorusGenerator : ShapeGenerator { diff --git a/Assets/Scripts/SoundManager.cs b/Assets/Scripts/SoundManager.cs index 5837c5b05f40a456297336185c323a5caba7451e..37872d46b602b9bab611920ed0609fb2b98c8c3d 100644 --- a/Assets/Scripts/SoundManager.cs +++ b/Assets/Scripts/SoundManager.cs @@ -1,7 +1,5 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine.UI; using UnityEngine; +using UnityEngine.UI; public class SoundManager : MonoBehaviour { diff --git a/Assets/Scripts/StageBehaviour.cs b/Assets/Scripts/StageBehaviour.cs index d9b4a6b022735b36390fda4e3c000d89bf879944..def3c91f3cbb68d10be98085d5626778ea5e1897 100644 --- a/Assets/Scripts/StageBehaviour.cs +++ b/Assets/Scripts/StageBehaviour.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.Linq; -using System.Xml.Serialization; using UnityEngine; using static StageStatic; @@ -27,7 +25,7 @@ public static List<TriangleFact> GenerateMMTCollider(GameObject obj = null) foreach (BoxCollider coll in FindObjectsOfType<BoxCollider>()) { - if(!UseMe(coll)) + if (!UseMe(coll)) continue; Vector3[] minmax = new Vector3[] diff --git a/Assets/Scripts/StageStatic.cs b/Assets/Scripts/StageStatic.cs index bd27fad7c35a9b831ce32d6c9c70a55d9c63805a..de00bccdfb9727a9dedf71624b0066e988781221 100644 --- a/Assets/Scripts/StageStatic.cs +++ b/Assets/Scripts/StageStatic.cs @@ -1,10 +1,10 @@ +using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; -using System; using UnityEngine; using static CommunicationEvents; -using System.IO; /// <summary> /// Keeps track of all available and current <see cref="Stage"/> @@ -358,7 +358,7 @@ public static void ShallowLoadStages(bool force = false) static IEnumerator _WaitForContext() { - while(!GlobalBehaviour.ContextLoaded) + while (!GlobalBehaviour.ContextLoaded) yield return null; ShallowLoadStages(true); diff --git a/Assets/Scripts/StartServer.cs b/Assets/Scripts/StartServer.cs index e15c4426888e63e4248b71631785060f4e4319a7..d790451acc0e5619c004fa43c56ba45cf6caee25 100644 --- a/Assets/Scripts/StartServer.cs +++ b/Assets/Scripts/StartServer.cs @@ -3,8 +3,8 @@ using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; -using static UIconfig; using static CommunicationEvents; +using static UIconfig; public class StartServer : MonoBehaviour { @@ -23,12 +23,12 @@ public class StartServer : MonoBehaviour void Start() { CommunicationEvents.ServerRunning = false; - - if (ServerAutoStart==true && autostart == 1 ) + + if (ServerAutoStart == true && autostart == 1) { StartCoroutine(ServerRoutine()); } - if (ServerAutoStart == true && autostart == 2 ) + if (ServerAutoStart == true && autostart == 2) { StartCoroutine(ServerRoutine1()); } @@ -49,7 +49,7 @@ void Update() void PrepareGame() { - if (autoprepareGame !=0) + if (autoprepareGame != 0) { WaitingText.text = "Press any key to start the game"; CommunicationEvents.ServerRunning = true; @@ -120,11 +120,11 @@ IEnumerator ServerRoutine() //set "UseShellExecute = true" AND "CreateNoWindow = false" to see the mmt-server output processInfo.UseShellExecute = false; processInfo.CreateNoWindow = !localServerWithAdditionalWindow; // true; - print("Serverinit: " + processInfo.Arguments); + print("Serverinit: " + processInfo.Arguments); process = Process.Start(processInfo); process_mmt_frameIT_server = process; - + //#endif yield return null; #endif @@ -135,7 +135,7 @@ IEnumerator ServerRoutine() //Wait for 2 seconds yield return new WaitForSecondsRealtime(2f); print("waiting"); - + request = UnityWebRequest.Get(CommunicationEvents.ServerAddressLocal + "/scroll/list"); yield return request.SendWebRequest(); if (request.result == UnityWebRequest.Result.ConnectionError diff --git a/Assets/Scripts/UI/CamControl_1.cs b/Assets/Scripts/UI/CamControl_1.cs index 9713f489c24a170816a1414585ed5333c72d14b0..078c519d85d79c93c81c4b8920477b7de0e0d0b0 100644 --- a/Assets/Scripts/UI/CamControl_1.cs +++ b/Assets/Scripts/UI/CamControl_1.cs @@ -1,22 +1,20 @@ using UnityEngine; -using UnityEngine.SceneManagement; -using static CommunicationEvents; //War ein Auslagerungsversuch bzgl HideUI -public class CamControl_1: MonoBehaviour +public class CamControl_1 : MonoBehaviour { - + public UnityStandardAssets.Characters.FirstPerson.FirstPersonController CamControl_StdAsset; public Characters.FirstPerson.FirstPersonController1 CamControl_ScriptChar; - + void Start() { - + } diff --git a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs index d15609fbb8dd662ca2588c8dcba7c53a1c389d20..65e769026a100e61376afc8b77dec6c06247cd7f 100644 --- a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs +++ b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/FirstPersonController1.cs @@ -1,10 +1,10 @@ -using UnityEngine; //using UnityStandardAssets.CrossPlatformInput; using PlayerCtrl; +using UnityEngine; +using UnityEngine.InputSystem; using UnityStandardAssets.Utility; -using Random = UnityEngine.Random; using static UIconfig; -using UnityEngine.InputSystem; +using Random = UnityEngine.Random; //using ControlMapping; //namespace UnityStandardAssets.Characters.FirstPerson @@ -17,7 +17,7 @@ public class FirstPersonController1 : MonoBehaviour [SerializeField] private bool m_IsWalking; [SerializeField] private float m_WalkSpeed; [SerializeField] private float m_RunSpeed; - [SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten; + [SerializeField][Range(0f, 1f)] private float m_RunstepLenghten; [SerializeField] private float m_JumpSpeed; [SerializeField] private float m_StickToGroundForce; [SerializeField] private float m_GravityMultiplier; @@ -79,8 +79,8 @@ private void Awake() */ playerInput = GetComponent<PlayerInput>(); - - + + //unity event; action_jump = playerInput.actions["Jump"]; action_run = playerInput.actions["Run"]; @@ -89,7 +89,7 @@ private void Awake() //playerInput -> C# event //playerInput.onActionTriggered += PlayerInput_onActionTriggered; - + } //playerInput -> C# event @@ -101,24 +101,24 @@ private void PlayerInput_onActionTriggered(InputAction.CallbackContext context) private void OnEnable() { - input_ControlMapping.Actionmap1.Movement.Enable(); - input_ControlMapping.Actnmp_HC.Movement.Enable(); - input_ControlMapping.Actnmp_HC.Move_Left.Enable(); - input_ControlMapping.Actnmp_HC.Move_Right.Enable(); - input_ControlMapping.Actnmp_HC.Move_Forward.Enable(); - input_ControlMapping.Actnmp_HC.Move_Backwards.Enable(); - + input_ControlMapping.Actionmap1.Movement.Enable(); + input_ControlMapping.Actnmp_HC.Movement.Enable(); + input_ControlMapping.Actnmp_HC.Move_Left.Enable(); + input_ControlMapping.Actnmp_HC.Move_Right.Enable(); + input_ControlMapping.Actnmp_HC.Move_Forward.Enable(); + input_ControlMapping.Actnmp_HC.Move_Backwards.Enable(); + } private void OnDisable() { input_ControlMapping.Actionmap1.Movement.Disable(); - input_ControlMapping.Actnmp_HC.Movement.Disable(); - input_ControlMapping.Actnmp_HC.Move_Left.Disable(); - input_ControlMapping.Actnmp_HC.Move_Right.Disable(); - input_ControlMapping.Actnmp_HC.Move_Forward.Disable(); - input_ControlMapping.Actnmp_HC.Move_Backwards.Disable(); - + input_ControlMapping.Actnmp_HC.Movement.Disable(); + input_ControlMapping.Actnmp_HC.Move_Left.Disable(); + input_ControlMapping.Actnmp_HC.Move_Right.Disable(); + input_ControlMapping.Actnmp_HC.Move_Forward.Disable(); + input_ControlMapping.Actnmp_HC.Move_Backwards.Disable(); + } // Use this for initialization @@ -135,7 +135,7 @@ private void Start() m_AudioSource = GetComponent<AudioSource>(); m_MouseLook.Init(transform, m_Camera.transform); - + } @@ -167,7 +167,7 @@ private void Update() m_PreviouslyGrounded = m_CharacterController.isGrounded; SetPositionOfActivePlayerGObj(); - + } private void SetPositionOfActivePlayerGObj() @@ -232,7 +232,7 @@ public void callbackMovement(InputAction.CallbackContext ctx) { Movement_fromCallback = ctx.ReadValue<Vector2>(); } - + } private void PlayJumpSound() @@ -305,7 +305,7 @@ private void UpdateCameraPosition(float speed) private void GetInput(out float speed) { float horizontal = 0; ; - float vertical=0; + float vertical = 0; if (UIconfig.InputManagerVersion == 1) { @@ -324,7 +324,7 @@ private void GetInput(out float speed) //m_IsWalking = !Input.GetKey(Running_keyBind); #endif m_IsWalking = !Input.GetKey(KeyCode.LeftShift); - if (UIconfig.controlMode!= ControlMode.Mobile ) + if (UIconfig.controlMode != ControlMode.Mobile) { //m_IsWalking = !Input.GetKey(Running_keyBind); } @@ -341,7 +341,7 @@ private void GetInput(out float speed) switch (UIconfig.touchControlMode) { case 0: - + break; case 1: //vertical = ButtonsToAxe(input_ControlMapping.Actnmp_HC.Move_Left.ReadValue<float>(), input_ControlMapping.Actnmp_HC.Move_Right.ReadValue<float>()); @@ -356,18 +356,18 @@ private void GetInput(out float speed) a = input_ControlMapping.Actnmp_HC.Movement.ReadValue<Vector2>(); break; - + case 3: a = input_ControlMapping.Actnmp_HC.Movement.ReadValue<Vector2>(); - + break; default: a = input_ControlMapping.Actnmp_HC.Movement.ReadValue<Vector2>(); - + break; } - + } else { @@ -377,11 +377,13 @@ private void GetInput(out float speed) b = action_run.ReadValue<float>(); } - + if (b != 0) { m_IsWalking = false; - }else{ + } + else + { m_IsWalking = true; } m_Input = a; @@ -392,7 +394,7 @@ private void GetInput(out float speed) if (UIconfig.InputManagerVersion == 3) { - vertical = ButtonsToAxe(DPAD[0, 1], DPAD[0, 0]); + vertical = ButtonsToAxe(DPAD[0, 1], DPAD[0, 0]); horizontal = ButtonsToAxe(DPAD[0, 3], DPAD[0, 2]); @@ -404,12 +406,12 @@ private void GetInput(out float speed) - bool waswalking = m_IsWalking; + bool waswalking = m_IsWalking; // set the desired speed to be walking or running speed = m_IsWalking ? m_WalkSpeed : m_RunSpeed; - + // normalize input if it exceeds 1 in combined length: if (m_Input.sqrMagnitude > 1) @@ -451,7 +453,7 @@ private void OnControllerColliderHit(ControllerColliderHit hit) public float ButtonsToAxe(float up, float down) { - float axe=0; + float axe = 0; if (up != 0) { axe = up; } if (down != 0) { axe = down; } diff --git a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs index fa7c66a701d75bd8e6171e1d5c15dd24b97be39a..46dfda3db6893e5516a938788af1edc59899d805 100644 --- a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs +++ b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/MouseLook1.cs @@ -1,10 +1,9 @@ -using System; -using UnityEngine; //using UnityStandardAssets.CrossPlatformInput; using PlayerCtrl; -using static UIconfig; +using System; +using UnityEngine; using static CommunicationEvents; -using UnityEngine.InputSystem; +using static UIconfig; //namespace UnityStandardAssets.Characters.FirstPerson namespace Characters.FirstPerson @@ -30,7 +29,7 @@ public class MouseLook1 //private PlayerInput playerInput; //Store the controls - // private InputAction action_LookCamera; + // private InputAction action_LookCamera; public void Init(Transform character, Transform camera) @@ -65,23 +64,23 @@ public void LookRotation(Transform character, Transform camera) { XSensitivity = UIconfig.camRotatingSensitivity; YSensitivity = XSensitivity; - Vector2 a=Vector2.zero; + Vector2 a = Vector2.zero; - float yRot=0; - float xRot=0; + float yRot = 0; + float xRot = 0; if (UIconfig.InputManagerVersion == 1) { // Read input - a.x = CrossPlatformInputManager.GetAxis("Mouse X") ; - a.y = CrossPlatformInputManager.GetAxis("Mouse Y") ; + a.x = CrossPlatformInputManager.GetAxis("Mouse X"); + a.y = CrossPlatformInputManager.GetAxis("Mouse Y"); } if (UIconfig.InputManagerVersion == 2) { - + if (CommunicationEvents.Opsys == OperationSystem.Android) { a = input_ControlMapping.Actnmp_HC.LookCamera.ReadValue<Vector2>(); @@ -93,22 +92,22 @@ public void LookRotation(Transform character, Transform camera) } - + //xRot = XSensitivity * input_ControlMapping.Actionmap1.MouseX.ReadValue<float>(); //yRot = 100* YSensitivity * input_ControlMapping.Actionmap1.MouseY.ReadValue<float>(); } if (UIconfig.InputManagerVersion == 3) { - - + + // Read input a.y = ButtonsToAxe(DPAD[1, 1], DPAD[1, 0]); a.x = ButtonsToAxe(DPAD[1, 3], DPAD[1, 2]); - - - + + + } if (a.sqrMagnitude > 1) @@ -137,7 +136,7 @@ public void LookRotation(Transform character, Transform camera) { character.localRotation = m_CharacterTargetRot; camera.localRotation = m_CameraTargetRot;//Wieso magst du nicht nach Build! - + } //if (yRot != 0) { Debug.Log("my" + yRot); Debug.Log("mc" + camera.localRotation); } //if (xRot != 0) { Debug.Log("mx" + xRot); Debug.Log("mc" + camera.localRotation); } //Hoch runter @@ -203,19 +202,19 @@ Quaternion ClampRotationAroundXAxis(Quaternion q) public float ButtonsToAxe(float up, float down) { - float axe = 0; + float axe = 0; - if (up != 0) { axe = up; } - if (down != 0) { axe = down; } + if (up != 0) { axe = up; } + if (down != 0) { axe = down; } - if (down != 0 && up != 0) - { - axe = 0; - } + if (down != 0 && up != 0) + { + axe = 0; + } + + return axe; - return axe; - } } diff --git a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController1.cs b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController1.cs index 0cee0fe0795b8f3f1382d886bbf15482197a593a..44913090610c7ee7107f3a9b5764f936a2e9090f 100644 --- a/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController1.cs +++ b/Assets/Scripts/UI/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController1.cs @@ -1,6 +1,6 @@ +using PlayerCtrl; using System; using UnityEngine; -using PlayerCtrl; //namespace UnityStandardAssets.Characters.FirstPerson namespace Characters.FirstPerson diff --git a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonCharacter1.cs b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonCharacter1.cs index 66606101845aa9983ed197f374b0bb082b1e0e86..7365075a3239b38acf914591e5e45e9b15c5ce43 100644 --- a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonCharacter1.cs +++ b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonCharacter1.cs @@ -11,7 +11,7 @@ public class ThirdPersonCharacter1 : MonoBehaviour [SerializeField] float m_MovingTurnSpeed = 360; [SerializeField] float m_StationaryTurnSpeed = 180; [SerializeField] float m_JumpPower = 12f; - [Range(1f, 4f)] [SerializeField] float m_GravityMultiplier = 2f; + [Range(1f, 4f)][SerializeField] float m_GravityMultiplier = 2f; [SerializeField] float m_RunCycleLegOffset = 0.2f; //specific to the character in sample assets, will need to be modified to work with others [SerializeField] float m_MoveSpeedMultiplier = 1f; [SerializeField] float m_AnimSpeedMultiplier = 1f; diff --git a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript.cs b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript.cs index ba3ee1b01ebba6f75d300854e1be6c02d5701389..0e2f9daa4e9c56f7a27657d4835bf4d8fa5c5db1 100644 --- a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript.cs +++ b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript.cs @@ -1,10 +1,5 @@ -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Security.Cryptography; -using System.Threading; -using UnityEngine; using PlayerCtrl; +using UnityEngine; public class ThirdPersonMovementScript : MonoBehaviour { diff --git a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript_yt.cs b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript_yt.cs index 838af6b2c4d6f0944c5e16426a17c5944f0cabe2..98c88f97d5ab8e5404929337d3629733ba0c247b 100644 --- a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript_yt.cs +++ b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonMovementScript_yt.cs @@ -1,10 +1,3 @@ -using System.Collections; - - -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Security.Cryptography; -using System.Threading; using UnityEngine; public class ThirdPersonMovementScript_yt : MonoBehaviour @@ -28,7 +21,7 @@ public class ThirdPersonMovementScript_yt : MonoBehaviour // Update is called once per frame void Update() { - + /* //jump isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask); @@ -51,17 +44,17 @@ void Update() float vertical = 1;// Input.GetAxisRaw("Vertical"); Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized; - + if (direction.magnitude >= 0.1f) { - /* - float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y; - float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime); - transform.rotation = Quaternion.Euler(0f, angle, 0f); - - Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward; - controller.Move(moveDir.normalized * speed * Time.deltaTime); - */ + /* + float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y; + float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime); + transform.rotation = Quaternion.Euler(0f, angle, 0f); + + Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward; + controller.Move(moveDir.normalized * speed * Time.deltaTime); + */ controller.Move(direction * speed * Time.deltaTime); } diff --git a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonUserControl1.cs b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonUserControl1.cs index 09df9af675fdd6b6221ef951a5ed3463a274b284..412cc5a91e6fe21da850c2fd9cee87a3d39a2653 100644 --- a/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonUserControl1.cs +++ b/Assets/Scripts/UI/Characters/ThirdPersonCharacter/Scripts/ThirdPersonUserControl1.cs @@ -1,5 +1,4 @@ using UnityEngine; -using PlayerCtrl; namespace PlayerCtrl.ThirdPerson { @@ -51,7 +50,7 @@ private void OnDisable() - private void Start() + private void Start() { // get the transform of the main camera if (Camera.main != null) diff --git a/Assets/Scripts/UI/DiscreteBarSlider.cs b/Assets/Scripts/UI/DiscreteBarSlider.cs index 9e0167151cdca6f768ca3149b43a8aca61d940b0..7e27597b8bbb62db4209b114c71958d356094856 100644 --- a/Assets/Scripts/UI/DiscreteBarSlider.cs +++ b/Assets/Scripts/UI/DiscreteBarSlider.cs @@ -34,10 +34,10 @@ void Update() { v = 0f; next_slot = -1; - if(last_active_slot != targ) + if (last_active_slot != targ) { last_active_slot = targ; - if(FieldActions.Count > targ) + if (FieldActions.Count > targ) FieldActions[targ].Invoke(); } return; @@ -54,10 +54,10 @@ private int GetTarget() if (next_slot >= 0) return next_slot; - int ret = (int) (slider.normalizedValue * slots); - ret = ret >= slots ? slots-1 : ret; + int ret = (int)(slider.normalizedValue * slots); + ret = ret >= slots ? slots - 1 : ret; - if(ret == last_active_slot && GetTargetRelativePosition(ret) != slider.normalizedValue) + if (ret == last_active_slot && GetTargetRelativePosition(ret) != slider.normalizedValue) ret += GetTargetRelativePosition(ret) > slider.normalizedValue ? -1 : 1; return ret; diff --git a/Assets/Scripts/UI/FactExplorer/FactExplorer.cs b/Assets/Scripts/UI/FactExplorer/FactExplorer.cs index d023e9639348cc80fe7baf7eaef3afed5fd43b58..4bc98808eb757af327da9af4e35ca15ca5c654a5 100644 --- a/Assets/Scripts/UI/FactExplorer/FactExplorer.cs +++ b/Assets/Scripts/UI/FactExplorer/FactExplorer.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using UnityEngine; using System.Linq; +using UnityEngine; using UnityEngine.UI; public class FactExplorer : MonoBehaviour diff --git a/Assets/Scripts/UI/FactExplorer/FactFavorisation.cs b/Assets/Scripts/UI/FactExplorer/FactFavorisation.cs index ed49702a87451930bb560266a036e9eb6e2f9977..0cb6998bb3d137387a47d6e91043f095ef79a855 100644 --- a/Assets/Scripts/UI/FactExplorer/FactFavorisation.cs +++ b/Assets/Scripts/UI/FactExplorer/FactFavorisation.cs @@ -54,7 +54,8 @@ private void Start() ChangeFavoriteEvent.AddListener(OnFavoriteChange); // if there already was a favoriteDisplayPrefab child (e.g. due to cloning) remove it - gameObject.ForAllChildren(child => { + gameObject.ForAllChildren(child => + { if (child.name.StartsWith(favoriteDisplayPrefab.name)) Destroy(child); }); diff --git a/Assets/Scripts/UI/FactExplorer/UILine.cs b/Assets/Scripts/UI/FactExplorer/UILine.cs index b8c56f425ee7f92303d7a952a78280af87184581..efa5256cd49173df9828a73343a0978e061b7406 100644 --- a/Assets/Scripts/UI/FactExplorer/UILine.cs +++ b/Assets/Scripts/UI/FactExplorer/UILine.cs @@ -1,9 +1,8 @@ using System; -using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; using UnityEngine.UI; -using System.Linq; public class UILine : Graphic { @@ -90,12 +89,12 @@ private void GenerateLinesDashed(VertexHelper vh) // is there a dash wrapping around a corner? bool dashOverCorner = false; - + float distLeft = Vector2.Distance(current, end); if (!isDash) restLen -= distLeft; // dont fill remaining distance with dash, if it would be short (shorter than width/2) - else if (isDash && distLeft > width/2) + else if (isDash && distLeft > width / 2) { CreateSegment(vh, current, end); restLen -= distLeft; @@ -103,7 +102,7 @@ private void GenerateLinesDashed(VertexHelper vh) } // discard rest of dash if it is too short (shorter than width/2) - if (isDash && restLen < width/2) + if (isDash && restLen < width / 2) { isDash = false; restLen = dashSpacing; @@ -111,7 +110,7 @@ private void GenerateLinesDashed(VertexHelper vh) } // only create round corners if roundCorners are enabled and there is a dash wrapping around the corner and not last corner (aka end) - if (roundCorners && dashOverCorner && i != lines.Count-1) + if (roundCorners && dashOverCorner && i != lines.Count - 1) CreateCircle(vh, end, width); } } @@ -153,11 +152,12 @@ private void CreateCircle(VertexHelper vh, Vector2 center, float diameter, int s UIVertex vertex = UIVertex.simpleVert; vertex.color = color; - Vector3[] vertices = GetCirclePoints(diameter/2, sideCount, center).Union(new Vector3[] { center }).ToArray(); - vertices.ToList().ForEach(vert => { - vertex.position = vert; - vh.AddVert(vertex); - } + Vector3[] vertices = GetCirclePoints(diameter / 2, sideCount, center).Union(new Vector3[] { center }).ToArray(); + vertices.ToList().ForEach(vert => + { + vertex.position = vert; + vh.AddVert(vertex); + } ); int startVert = vh.currentVertCount - vertices.Length; @@ -167,7 +167,7 @@ private void CreateCircle(VertexHelper vh, Vector2 center, float diameter, int s vh.currentVertCount - 1, // center startVert + i, startVert + ((i + 1) % (vertices.Length - 1)) - ); + ); } return; } diff --git a/Assets/Scripts/UI/HideUI.cs b/Assets/Scripts/UI/HideUI.cs index 250f1c9e0ff980efe8a358f74b87e889c6a6c998..27bde70969379d16016553b0ce079e1da0068c46 100644 --- a/Assets/Scripts/UI/HideUI.cs +++ b/Assets/Scripts/UI/HideUI.cs @@ -1,9 +1,7 @@ -using UnityEngine; -using UnityEngine.SceneManagement; -using static CommunicationEvents; -using static UIconfig; -using System.Collections; +using System.Collections; +using UnityEngine; using UnityEngine.InputSystem; +using static CommunicationEvents; //using static CamControl_1; public class HideUI : MonoBehaviour diff --git a/Assets/Scripts/UI/HideUI_mobile.cs b/Assets/Scripts/UI/HideUI_mobile.cs index e5979574ae7515eb3b1dcb480391354b7483e76a..8bf5c6468545ce6cea12166fb8dec0124ee34384 100644 --- a/Assets/Scripts/UI/HideUI_mobile.cs +++ b/Assets/Scripts/UI/HideUI_mobile.cs @@ -1,10 +1,8 @@ -using UnityEngine; -using UnityEngine.SceneManagement; +using System.Collections; +using UnityEngine; +using UnityEngine.InputSystem; using static CommunicationEvents; using static UIconfig; -using static Restart; -using System.Collections; -using UnityEngine.InputSystem; public class HideUI_mobile : MonoBehaviour { @@ -211,9 +209,9 @@ void CheckUI_Vis_walk() { var uiccm = UIconfig.controlMode switch { - ControlMode.Mobile + ControlMode.Mobile => 1, - ControlMode.Keyboard or _ + ControlMode.Keyboard or _ => 0, }; diff --git a/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs b/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs index 5a1847fe90128be4d17418780934d8da248fbdc1..698528aae23dc60f51fa2cc0a0ecb60ca5ca9b6b 100644 --- a/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs +++ b/Assets/Scripts/UI/InGame/BackToButton_withConfChange.cs @@ -4,13 +4,13 @@ public class BackToButton_withConfChange : MonoBehaviour { public GameObject backTo_GObj; public GameObject parentM_GObj; - public int GameplayMode; + public int GameplayMode; + - public void goBackButtonOPTM() { //NetworkJSON_Save(); - + parentM_GObj.SetActiveAllChildren(false); backTo_GObj.SetActive(true); ; diff --git a/Assets/Scripts/UI/InGame/GameObj_OnOff.cs b/Assets/Scripts/UI/InGame/GameObj_OnOff.cs index 4bd9ae787cf8d7ea4758d7d3a577b7268a1e2e68..38d681bef896e288cff83cdeefc8c9c298854636 100644 --- a/Assets/Scripts/UI/InGame/GameObj_OnOff.cs +++ b/Assets/Scripts/UI/InGame/GameObj_OnOff.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; public class GameObj_OnOff : MonoBehaviour @@ -23,7 +15,8 @@ void Start() { if (CheckArray()) { - if (UIconfig.CanvasOnOff_Array[myUI_ID] != 2 || UIconfig.CanvasOnOff_Array[myUI_ID] != 3) { + if (UIconfig.CanvasOnOff_Array[myUI_ID] != 2 || UIconfig.CanvasOnOff_Array[myUI_ID] != 3) + { UIconfig.CanvasOnOff_Array[myUI_ID] = default_value; //Update(); } @@ -43,7 +36,7 @@ private void Update() Target_GObj.SetActive(activate); } } - - private bool CheckArray() + + private bool CheckArray() => myUI_ID >= 0 && myUI_ID < UIconfig.CanvasOnOff_Array.Length; } \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/IngameUI_OnOffButton_mobile.cs b/Assets/Scripts/UI/InGame/IngameUI_OnOffButton_mobile.cs index 0d17d761c36c6145572381e31af5788017e599b0..0216bb4fada4862344a5ea04fe299bd52d6e7578 100644 --- a/Assets/Scripts/UI/InGame/IngameUI_OnOffButton_mobile.cs +++ b/Assets/Scripts/UI/InGame/IngameUI_OnOffButton_mobile.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; using UnityEngine.EventSystems; @@ -25,7 +17,7 @@ public class IngameUI_OnOffButton_mobile : MonoBehaviour, IPointerDownHandler, I void Start() { - checkedA= CheckArray(); + checkedA = CheckArray(); } @@ -53,7 +45,7 @@ public void OnPointerDown(PointerEventData data) } else { - Debug.Log( "Out of Array Length"); + Debug.Log("Out of Array Length"); } } diff --git a/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs b/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs index 8fbe6400427e75ad42c4d2c763cb3d832ad7d7b6..e5d44bbac22de2b59958afa186ec1defad761c97 100644 --- a/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs +++ b/Assets/Scripts/UI/InGame/IngameUI_OnOff_TouchControlMode.cs @@ -1,11 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; @@ -18,7 +11,7 @@ public class IngameUI_OnOff_TouchControlMode : MonoBehaviour public GameObject myself_GObj; public ControlMode myControlMode_ID; public int myTouchControlMode_ID; - + @@ -27,8 +20,8 @@ void Start() { //print("hey"); - Update(); - + Update(); + } private void Update() @@ -45,7 +38,7 @@ private void Update() } } } - + private bool CheckArray() { /* @@ -78,12 +71,12 @@ private void ActivateUIC() /// </summary> private void ClearUIC() { - + for (int i = 0; i < myself_GObj.transform.childCount; i++) { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); } } - + } \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/IngameUI_OnOff_mobile.cs b/Assets/Scripts/UI/InGame/IngameUI_OnOff_mobile.cs index dd07c8d92dcbec9d19da9db6bda888a9f75e0b96..829af7900f59b2a602507f23949e8e4b9b45bae1 100644 --- a/Assets/Scripts/UI/InGame/IngameUI_OnOff_mobile.cs +++ b/Assets/Scripts/UI/InGame/IngameUI_OnOff_mobile.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; public class IngameUI_OnOff_mobile : MonoBehaviour @@ -19,8 +11,8 @@ public class IngameUI_OnOff_mobile : MonoBehaviour public int myUI_ID; public int default_value; private bool cA; - private int lasttime=-99; - + private int lasttime = -99; + void Start() { @@ -29,7 +21,7 @@ void Start() { if (UIconfig.CanvasOnOff_Array[myUI_ID] != 2 || UIconfig.CanvasOnOff_Array[myUI_ID] != 3) { - + UIconfig.CanvasOnOff_Array[myUI_ID] = default_value; //Update(); } @@ -38,7 +30,7 @@ void Start() private void Update() { - if (cA && lasttime!= UIconfig.CanvasOnOff_Array[myUI_ID]) + if (cA && lasttime != UIconfig.CanvasOnOff_Array[myUI_ID]) { switch (UIconfig.CanvasOnOff_Array[myUI_ID]) { @@ -62,7 +54,7 @@ private void Update() lasttime = UIconfig.CanvasOnOff_Array[myUI_ID]; } } - + private bool CheckArray() { if (myUI_ID >= 0 && myUI_ID < UIconfig.CanvasOnOff_Array.Length) @@ -91,12 +83,12 @@ private void ActivateUIC() /// </summary> private void ClearUIC() { - + for (int i = 0; i < myself_GObj.transform.childCount; i++) { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); } } - + } \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/InputUI_Ctrl_mobile.cs b/Assets/Scripts/UI/InGame/InputUI_Ctrl_mobile.cs index 54a70988ef96e001838ce17d513bb7d675ebf616..fa944691b1fb24cc7b33b5157b61d72b28aa1f29 100644 --- a/Assets/Scripts/UI/InGame/InputUI_Ctrl_mobile.cs +++ b/Assets/Scripts/UI/InGame/InputUI_Ctrl_mobile.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; public class InputUI_Ctrl_mobile : MonoBehaviour @@ -24,7 +16,7 @@ public class InputUI_Ctrl_mobile : MonoBehaviour //public int failedUI_ID; public GameObject FrameITUI_GObj; public GameObject FrameITUI_mobile_GObj; - private int FrameITUIversion_temp =-1; + private int FrameITUIversion_temp = -1; void Awake() { @@ -60,7 +52,7 @@ public void toMouseUI2() { ClearUIC(); //UIconfig.Andr_Start_menue_counter = 1; - FrameITUI_GObj.SetActive(true); + FrameITUI_GObj.SetActive(true); } @@ -69,7 +61,7 @@ public void toMobileUI2() { ClearUIC(); //UIconfig.Andr_Start_menue_counter = 1; - FrameITUI_mobile_GObj.SetActive(true); + FrameITUI_mobile_GObj.SetActive(true); } @@ -79,7 +71,7 @@ public void toMobileUI2() /// </summary> private void ClearUIC() { - for (int i = 0; i < myself_GObj.transform.childCount-1; i++) // -1: dont affect Gadgets + for (int i = 0; i < myself_GObj.transform.childCount - 1; i++) // -1: dont affect Gadgets { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); } diff --git a/Assets/Scripts/UI/InGame/MainPlayerMode_Ctrl.cs b/Assets/Scripts/UI/InGame/MainPlayerMode_Ctrl.cs index 6e04bcf2625d43e51f6456d1586067241831b871..26f5c18f140377bbc22d00331128592d59114766 100644 --- a/Assets/Scripts/UI/InGame/MainPlayerMode_Ctrl.cs +++ b/Assets/Scripts/UI/InGame/MainPlayerMode_Ctrl.cs @@ -1,11 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; -using UnityEngine.SceneManagement; -using System.IO; -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; @@ -42,17 +35,17 @@ public class MainPlayerMode_Ctrl : MonoBehaviour void Start() { - - Update2(); - - + + Update2(); + + } private void Update() { if (InputDisable) { - if (GpMode_before!= -100) + if (GpMode_before != -100) { //Camera_ofActivePlayer.SetActive(false); //Camera_ofActivePlayer.SetActive(true); @@ -70,12 +63,13 @@ private void Update() } - private void Update2(){ + private void Update2() + { + - //Todo Eventbased ClearUIC(); - print("Active_Gameplaymode: "+ UIconfig.GameplayMode); + print("Active_Gameplaymode: " + UIconfig.GameplayMode); switch (UIconfig.GameplayMode) { case 0: @@ -111,21 +105,21 @@ private void Update2(){ break; default: - + break; } GpMode_before = UIconfig.GameplayMode; } - + /// <summary> /// Deactivates all Pages. /// </summary> private void ClearUIC() { - + for (int i = 0; i < myself_GObj.transform.childCount; i++) { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); diff --git a/Assets/Scripts/UI/InGame/Pause_Menue_mobile.cs b/Assets/Scripts/UI/InGame/Pause_Menue_mobile.cs index 8611eb18b5a15f6d2b4b188e99d73f877853274a..00925803c13c8d99a3d49b982badf234e4976603 100644 --- a/Assets/Scripts/UI/InGame/Pause_Menue_mobile.cs +++ b/Assets/Scripts/UI/InGame/Pause_Menue_mobile.cs @@ -1,17 +1,8 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; -using static CommunicationEvents; -using static UIconfig; using UnityEngine.EventSystems; -using static Restart; +using UnityEngine.SceneManagement; //using static SceneSwitcher; @@ -29,8 +20,8 @@ public class Pause_Menue_mobile : MonoBehaviour, IPointerDownHandler, IPointerUp public int setValueTo; public bool ResetLevel; public bool checkTimeToStop; - public bool ResetUI=false; - public int switchToScene_ID_=0; + public bool ResetUI = false; + public int switchToScene_ID_ = 0; @@ -42,7 +33,8 @@ void Start() private void Update() { - if (checkTimeToStop == true) { + if (checkTimeToStop == true) + { setPauseToken(); //disableGameUI(); } @@ -67,22 +59,22 @@ public void OnPointerUp(PointerEventData data) UIconfig.GamePaused = false; ResumeGame(); - + } - + private void ContinueGame_BttnPressed() { - for (int i = 0; i<UIconfig.CanvasOn_afterPM.Length; i++) + for (int i = 0; i < UIconfig.CanvasOn_afterPM.Length; i++) { int a = UIconfig.CanvasOn_afterPM[i]; - if ( a>=0 && a< UIconfig.CanvasOnOff_Array.Length) + if (a >= 0 && a < UIconfig.CanvasOnOff_Array.Length) { UIconfig.CanvasOnOff_Array[a] = 1; } - - + + } @@ -101,9 +93,9 @@ private void setPauseToken() { if (CheckArray()) { - if (UIconfig.CanvasOnOff_Array[myUI_ID] == 1 ) + if (UIconfig.CanvasOnOff_Array[myUI_ID] == 1) { - + if (CommunicationEvents.CursorVisDefault) { Cursor.visible = true; @@ -140,7 +132,7 @@ private void ResumeGame() } if (switchToScene_ID_ > 0) { - + //SceneSwitcher ScSw = new SceneSwitcher(); //ScSw.NowsSwitchToScene(switchToScene_ID_); //SceneManager.LoadScene("MainMenue"); @@ -152,7 +144,7 @@ private void ResumeGame() break; case 3: default: - SceneManager.LoadScene("LaunchMenue"); + SceneManager.LoadScene("LaunchMenue"); break; } diff --git a/Assets/Scripts/UI/InGame/PointAndClick_changeCam.cs b/Assets/Scripts/UI/InGame/PointAndClick_changeCam.cs index c36c306ba8652fc320c5052cecf8d7a665e57fe4..e6d84290c9225d493e8cf5a66695fac54013d4cc 100644 --- a/Assets/Scripts/UI/InGame/PointAndClick_changeCam.cs +++ b/Assets/Scripts/UI/InGame/PointAndClick_changeCam.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; public class PointAndClick_changeCam : MonoBehaviour @@ -24,7 +16,7 @@ public class PointAndClick_changeCam : MonoBehaviour public GameObject Position3_GObj; - private int Position=1; + private int Position = 1; @@ -64,11 +56,11 @@ public void changePosition() break; } } - - + + } \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/PopupBehavior.cs b/Assets/Scripts/UI/InGame/PopupBehavior.cs index 0212e5de2dd126034d8c1033375f01f3c2428abd..6685ced25ec25e476f35190ac058fce7e44508f6 100644 --- a/Assets/Scripts/UI/InGame/PopupBehavior.cs +++ b/Assets/Scripts/UI/InGame/PopupBehavior.cs @@ -1,9 +1,8 @@ +using REST_JSON_API; using System.Collections; -using System.Collections.Generic; -using UnityEngine; using TMPro; +using UnityEngine; using UnityEngine.UI; -using REST_JSON_API; public class PopupBehavior : MonoBehaviour { diff --git a/Assets/Scripts/UI/InGame/ScalingCollider.cs b/Assets/Scripts/UI/InGame/ScalingCollider.cs index 71a9f7673daea8ffa73f8da7671d345ee471825f..9d4e6559f81c21c1460efafb0c7785798ddc7c69 100644 --- a/Assets/Scripts/UI/InGame/ScalingCollider.cs +++ b/Assets/Scripts/UI/InGame/ScalingCollider.cs @@ -1,7 +1,6 @@ using UnityEngine; using static CommunicationEvents; using static UIconfig; -using System; public class ScalingCollider : MonoBehaviour { @@ -20,9 +19,9 @@ private void scalingCollider() { var scale = Opsys switch { - OperationSystem.Android + OperationSystem.Android => colliderScale_all * UIconfig.colliderScale_Mobile_default, - OperationSystem.Windows or _ + OperationSystem.Windows or _ => colliderScale_all * UIconfig.colliderScale_PC_default, }; diff --git a/Assets/Scripts/UI/InGame/SceneStartMenue_101.cs b/Assets/Scripts/UI/InGame/SceneStartMenue_101.cs index 80d9d1b228efd320bbf516aa86d84834aeb86b54..c83ce5988fee919f198dc725245303bb03bb312e 100644 --- a/Assets/Scripts/UI/InGame/SceneStartMenue_101.cs +++ b/Assets/Scripts/UI/InGame/SceneStartMenue_101.cs @@ -1,17 +1,8 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; -using UnityEngine.EventSystems; -using static StageStatic; @@ -47,7 +38,7 @@ public class SceneStartMenue_101 : MonoBehaviour//, IPointerDownHandler, IPointe void Start() { - + //myself_GObj_Txt.text = "hello World"; //StageStatic StgStc = new StageStatic(); @@ -55,12 +46,13 @@ void Start() //myself_GObj_Txt.text = "ssss" + StageStatic.stage.scene; //myself_GObj_Txt.text = "ssss" + StageStatic.stage.description; - switch (myself_Txt_ID) { - case 1 : + switch (myself_Txt_ID) + { + case 1: myself_GObj_Txt.text = "World: " + StageStatic.stage.scene + "\n" + - "Stage: " + StageStatic.stage.name + "\n"; - //"Info:" + StageStatic.stage.description; - break; + "Stage: " + StageStatic.stage.name + "\n"; + //"Info:" + StageStatic.stage.description; + break; case 2: missionbriefing = missionbriefing1; myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + @@ -72,42 +64,42 @@ void Start() myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + //"\n"+ missionbriefing330; - + break; case 331: missionbriefing = missionbriefing1; myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + //"\n"+ missionbriefing331; - + break; case 332: missionbriefing = missionbriefing1; myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + //"\n"+ missionbriefing332; - + break; case 333: missionbriefing = missionbriefing1; myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + //"\n"+ missionbriefing333; - + break; case 334: missionbriefing = missionbriefing1; myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + //"\n"+ missionbriefing334; - + break; case 335: missionbriefing = missionbriefing1; myself_GObj_Txt.text = StageStatic.stage.description + "\n" + "\n" + //"\n"+ missionbriefing335; - + break; case 336: missionbriefing = missionbriefing1; diff --git a/Assets/Scripts/UI/InGame/TimeStop.cs b/Assets/Scripts/UI/InGame/TimeStop.cs index 1dc0226a4656937230d3bc517bb602faf353bbce..dffea696d4a7d2b3c037d92a638d5139edf1318b 100644 --- a/Assets/Scripts/UI/InGame/TimeStop.cs +++ b/Assets/Scripts/UI/InGame/TimeStop.cs @@ -4,7 +4,7 @@ https://gamedevbeginner.com/the-right-way-to-pause-the-game-in-unity/#:~:text=The%20most%20convenient%20method%20for%20pausing%20the%20game,will%20return%20the%20game%20to%20its%20normal%20speed. */ -public class TimeStop: MonoBehaviour +public class TimeStop : MonoBehaviour { public bool checkTimeToStop; @@ -22,7 +22,7 @@ private void Update() private void PauseGame() { - UIconfig.GamePaused = true; + UIconfig.GamePaused = true; Time.timeScale = 0; } } \ No newline at end of file diff --git a/Assets/Scripts/UI/InGame/ToolmodeSelector_bttn_mobile.cs b/Assets/Scripts/UI/InGame/ToolmodeSelector_bttn_mobile.cs index 7a3ed35a70e609ec30fe0950f834371af7de1da7..f561a08482ea2534e379594e598e820b1de362e3 100644 --- a/Assets/Scripts/UI/InGame/ToolmodeSelector_bttn_mobile.cs +++ b/Assets/Scripts/UI/InGame/ToolmodeSelector_bttn_mobile.cs @@ -1,9 +1,4 @@ - -using System.Collections; -using System.Linq; using UnityEngine; -using UnityEngine.UI; -using static CommunicationEvents; public class ToolmodeSelector_bttn_mobile : MonoBehaviour { diff --git a/Assets/Scripts/UI/InGame/UI_OnOff_InputModule.cs b/Assets/Scripts/UI/InGame/UI_OnOff_InputModule.cs index 63d228197166975c64821069d698635e7bace698..2332e8ec6b9034d3a985bf2e40893d5945d28405 100644 --- a/Assets/Scripts/UI/InGame/UI_OnOff_InputModule.cs +++ b/Assets/Scripts/UI/InGame/UI_OnOff_InputModule.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; public class UI_OnOff_InputModule : MonoBehaviour @@ -18,7 +10,7 @@ public class UI_OnOff_InputModule : MonoBehaviour public GameObject myself_GObj; public int myInputModule_ID; //public int default_value; - private bool cA=true; + private bool cA = true; private int before = -99; @@ -29,22 +21,22 @@ void Start() private void Update() { - if (cA && before!= UIconfig.InputManagerVersion) + if (cA && before != UIconfig.InputManagerVersion) { - if (UIconfig.InputManagerVersion==myInputModule_ID) + if (UIconfig.InputManagerVersion == myInputModule_ID) { ActivateUIC(); } else { - + ClearUIC(); - + } before = UIconfig.InputManagerVersion; } } - + @@ -66,12 +58,12 @@ private void ActivateUIC() /// </summary> private void ClearUIC() { - + for (int i = 0; i < myself_GObj.transform.childCount; i++) { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); } } - + } \ No newline at end of file diff --git a/Assets/Scripts/UI/InputFieldPanel.cs b/Assets/Scripts/UI/InputFieldPanel.cs index c7fa70728e81892be21c49509307984a655896d7..6efdfd10994b82e2b134f1655252ffa4bdaccee2 100644 --- a/Assets/Scripts/UI/InputFieldPanel.cs +++ b/Assets/Scripts/UI/InputFieldPanel.cs @@ -1,7 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; /// <summary> /// Just adds a " " to the end of <see cref="TMPro"/> input-field-text-box. <br/> diff --git a/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableCategory.cs b/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableCategory.cs index 3410f16e843e4fa91f3ea6e6aa6eb5e57af801d5..4ee9d6a5a5a020f1897d41aa3b619b0c8083db6a 100644 --- a/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableCategory.cs +++ b/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableCategory.cs @@ -1,4 +1,3 @@ -using System.Collections; using System.Collections.Generic; using UnityEngine; using static UIToolBox; @@ -27,7 +26,7 @@ public void Init() var p = DrawChildren(); // set text percent - PopulateLocalEntryList(header, new List<string> { ((int)(p * 100)).ToString() + "%"}); + PopulateLocalEntryList(header, new List<string> { ((int)(p * 100)).ToString() + "%" }); // set colour percent header.GetNthChild(new List<int> { 0, 0 }).GetComponent<UnityEngine.UI.Image>().color = @@ -47,7 +46,7 @@ public float DrawChildren() cat_suc += System.Convert.ToInt32(stage.completed_once); GameObject stage_entry = Instantiate(StageEntry); - stage_entry.transform.SetParent(gameObject.GetNthChild(new List<int>{ 1 }).transform, false); + stage_entry.transform.SetParent(gameObject.GetNthChild(new List<int> { 1 }).transform, false); CollapsableStage stage_beahviour = stage_entry.GetComponent<CollapsableStage>(); stage_beahviour.stage_name = stage.name; diff --git a/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableStage.cs b/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableStage.cs index 52a2c65b57f6eed1d68c555693553b2a3339d51c..413a1cbd4460f74af9b084e8a2fe29e3329ae079 100644 --- a/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableStage.cs +++ b/Assets/Scripts/UI/MainMenue/CollapsableStage/CollapsableStage.cs @@ -21,11 +21,12 @@ public void Init() PopulateLocalEntryList(header, new List<string> { stage.number.ToString(), stage.name, stage.description }); // set colour - header.GetNthChild(new List<int> { 0, 0 }).GetComponent<UnityEngine.UI.Image>().color = + header.GetNthChild(new List<int> { 0, 0 }).GetComponent<UnityEngine.UI.Image>().color = stage.completed_once ? GlobalBehaviour.StageAccomplished : GlobalBehaviour.StageNotYetAccomplished; // set implicit load button (whole header) - header.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate { + header.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate + { StageStatic.SetMode(StageStatic.Mode.Play); // TODO: handle unable to load Loader.LoadStage(stage.name, !stage.use_install_folder, true); @@ -63,15 +64,18 @@ public void DrawChildren() stage.player_record_list[index].solved ? GlobalBehaviour.StageAccomplished : GlobalBehaviour.StageNotYetAccomplished; // set delete button - time_entry.GetNthChild(new List<int> { 3, 0 }).GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate { + time_entry.GetNthChild(new List<int> { 3, 0 }).GetComponent<UnityEngine.UI.Button>().onClick.AddListener(delegate + { stage.deletet_record(stage.player_record_list[index]); this.Init(); }); // button Action to load a record - UnityAction loadRecord = delegate () { + UnityAction loadRecord = delegate () + { // redraw this, when unable to find record - if (!stage.set_record(index)) { + if (!stage.set_record(index)) + { this.Init(); return; } diff --git a/Assets/Scripts/UI/MainMenue/ListLoader.cs b/Assets/Scripts/UI/MainMenue/ListLoader.cs index edfab7d7907dfa085ccaf87049eec6fca2b82f87..c2c1449b2ed10550843c382018e734324e37f614 100644 --- a/Assets/Scripts/UI/MainMenue/ListLoader.cs +++ b/Assets/Scripts/UI/MainMenue/ListLoader.cs @@ -22,8 +22,8 @@ protected void OnEnable() //{ // yield return new WaitForFixedUpdate(); - Clear(); - Init(); + Clear(); + Init(); //} } diff --git a/Assets/Scripts/UI/MainMenue/MenueLoader.cs b/Assets/Scripts/UI/MainMenue/MenueLoader.cs index 54e60417ef9f8326f9fd8c7fd28d89d68ccc51b6..361ba63f2ccd2b276ff93196592d05166ac30a10 100644 --- a/Assets/Scripts/UI/MainMenue/MenueLoader.cs +++ b/Assets/Scripts/UI/MainMenue/MenueLoader.cs @@ -15,7 +15,7 @@ public class MenueLoader : MonoBehaviour protected void Start() { - if(scroll != null) + if (scroll != null) scroll.verticalNormalizedPosition = 1f; } diff --git a/Assets/Scripts/UI/MainMenue/PageLoader/CreateLoader.cs b/Assets/Scripts/UI/MainMenue/PageLoader/CreateLoader.cs index 2eb0a497aa7bdfc6d8418ffa5b77836b4805f92b..fa19971015ebbbdc852c935dca059ab645f06b55 100644 --- a/Assets/Scripts/UI/MainMenue/PageLoader/CreateLoader.cs +++ b/Assets/Scripts/UI/MainMenue/PageLoader/CreateLoader.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; public class CreateLoader : MenueLoader @@ -17,28 +15,36 @@ protected string category get { return Category.text.Trim(); } set { Category.text = value; } } - protected int id { + protected int id + { get { return Id.text.Length == 0 ? StageStatic.NextNumber(true, category) : int.Parse(Id.text); } set { Id.text = value.ToString(); } } - protected new string name { + protected new string name + { get { return Name.text.Trim(); } set { Name.text = value; } } - protected string description { + protected string description + { get { return Description.text; } set { Description.text = value; } } - protected string scene { - get { + protected string scene + { + get + { return WorldDropdown.value < StageStatic.Worlds.Count ? StageStatic.Worlds[WorldDropdown.value] : invalid_world; } - set { - if (!StageStatic.Worlds.Contains(value)) { + set + { + if (!StageStatic.Worlds.Contains(value)) + { //WorldDropdown.AddOptions(new List<string> { invalid_world }); WorldDropdown.value = StageStatic.Worlds.Count; - } else + } + else WorldDropdown.value = StageStatic.Worlds.IndexOf(value); } } @@ -65,9 +71,10 @@ public void Init() } public void Create() - { + { var error = StageStatic.LoadNewStage(category, id, name, description, scene); - if (!error.pass) { + if (!error.pass) + { Error(error); return; } @@ -79,7 +86,7 @@ protected void Error(StageStatic.StageErrorStruct error) if (error.category) { throw new System.NotImplementedException("Invalid Category"); // unused - } + } if (error.id) { throw new System.NotImplementedException("Id must be unique within a category"); // technichal a lie @@ -98,7 +105,7 @@ protected void Error(StageStatic.StageErrorStruct error) } if (error.local) // keep custom levels custom { - throw new System.NotImplementedException("Not allowed to create or change non-local Stages"); + throw new System.NotImplementedException("Not allowed to create or change non-local Stages"); } if (error.load) { diff --git a/Assets/Scripts/UI/MainMenue/PageLoader/EditLoader.cs b/Assets/Scripts/UI/MainMenue/PageLoader/EditLoader.cs index d713dae021f76092d2d8aa0db59bed3e439355c2..04df547ece7fa7ab5968480e87b36da7f32b85e6 100644 --- a/Assets/Scripts/UI/MainMenue/PageLoader/EditLoader.cs +++ b/Assets/Scripts/UI/MainMenue/PageLoader/EditLoader.cs @@ -15,7 +15,7 @@ public void SetStage(string name, bool local) category = original_stage.category; id = original_stage.number; this.name = original_stage.name; - description= original_stage.description; + description = original_stage.description; scene = original_stage.scene; } @@ -45,13 +45,15 @@ public void Delete() private bool _Clone(bool overwrite) { var error = StageStatic.Validate(category, id, name, description, scene); - if (overwrite) { - if(name == original_stage.name) + if (overwrite) + { + if (name == original_stage.name) error.name = false; - if(id == original_stage.number) + if (id == original_stage.number) error.id = false; } - if (!error.pass) { + if (!error.pass) + { Error(error); return false; } @@ -63,7 +65,7 @@ private bool _Clone(bool overwrite) new_stage.ResetSaves(); StageStatic.stage = new_stage; - new_stage.store(force_stage_file: true ); + new_stage.store(force_stage_file: true); new_stage.store(force_stage_file: false); return true; } @@ -83,7 +85,7 @@ private bool _Save() return false; if (name != original_stage.name) - // has not been overridden + // has not been overridden _Delete(); return true; diff --git a/Assets/Scripts/UI/MainMenue/PageLoader/LocalLoader.cs b/Assets/Scripts/UI/MainMenue/PageLoader/LocalLoader.cs index 0c5619d7d0aae1b364f2beaa40ceff5802dab2ff..8443f16abb4e07133947af23960e0fa324df8697 100644 --- a/Assets/Scripts/UI/MainMenue/PageLoader/LocalLoader.cs +++ b/Assets/Scripts/UI/MainMenue/PageLoader/LocalLoader.cs @@ -1,8 +1,3 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - /// <summary> /// Dummy class; "needed" /// </summary> diff --git a/Assets/Scripts/UI/MainMenue/PageLoader/StageLoader.cs b/Assets/Scripts/UI/MainMenue/PageLoader/StageLoader.cs index 2660ab0720d7cd484ed20f00eb5ad74d14a10f8c..5fa7e8c349d98c37f5d4173a5c4e3d9cd1a34e86 100644 --- a/Assets/Scripts/UI/MainMenue/PageLoader/StageLoader.cs +++ b/Assets/Scripts/UI/MainMenue/PageLoader/StageLoader.cs @@ -1,4 +1,3 @@ -using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -27,7 +26,7 @@ public override void Init() IReadOnlyDictionary<string, Stage> dict = local ? StageStatic.StageLocal : StageStatic.StageOfficial; - var ord = local ? + var ord = local ? dict.Values.OrderBy(s => s.category) : dict.Values.OrderBy(s => StageStatic.Category.ContainsKey(s.category) ? StageStatic.Category[s.category] : -1); @@ -41,7 +40,7 @@ public override void Init() protected override void Default() { var def = Instantiate(EntryHeader); - CreateEntry(def, List, NoId, NoStage, local ? NoLocal:NoDescr, new Color(0,0,0,0)); + CreateEntry(def, List, NoId, NoStage, local ? NoLocal : NoDescr, new Color(0, 0, 0, 0)); } protected override void ListButtonsWrapped(List<Stage> list) diff --git a/Assets/Scripts/UI/MainMenue/QuitApp.cs b/Assets/Scripts/UI/MainMenue/QuitApp.cs index b358ac50bfd91b29e15863f67943ee0a71478ac1..101219038b04d164f4c9e72ca3ee688dca0537d3 100644 --- a/Assets/Scripts/UI/MainMenue/QuitApp.cs +++ b/Assets/Scripts/UI/MainMenue/QuitApp.cs @@ -1,17 +1,9 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; +using UnityEngine.EventSystems; +using static CommunicationEvents; //using static CheckServer; ///using static CommunicationEvents; using static StreamingAssetLoader; -using static UIconfig; -using static CommunicationEvents; -using UnityEngine.EventSystems; public class QuitApp : MonoBehaviour, IPointerDownHandler, IPointerUpHandler @@ -19,7 +11,7 @@ public class QuitApp : MonoBehaviour, IPointerDownHandler, IPointerUpHandler void Start() { - + } private void Update() @@ -46,17 +38,18 @@ public void QuitApp1() NetworkJSON_Save(); if (process_mmt_frameIT_server != null) { - if (!process_mmt_frameIT_server.HasExited) { + if (!process_mmt_frameIT_server.HasExited) + { process_mmt_frameIT_server.Kill(); } } - + #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #endif Application.Quit(); - + } } diff --git a/Assets/Scripts/UI/MainMenue/SceneSwitcher.cs b/Assets/Scripts/UI/MainMenue/SceneSwitcher.cs index d9466e2010ddedc8aa41d70bc75c2c67fc739dae..36d2a61d9767e635497b51a410288768838e6d42 100644 --- a/Assets/Scripts/UI/MainMenue/SceneSwitcher.cs +++ b/Assets/Scripts/UI/MainMenue/SceneSwitcher.cs @@ -1,25 +1,16 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static CheckServer; -using static CommunicationEvents; -using static StreamingAssetLoader; -using static UIconfig; using UnityEngine.EventSystems; +using UnityEngine.SceneManagement; public class SceneSwitcher : MonoBehaviour, IPointerDownHandler, IPointerUpHandler { public int switchToScene_ID; - + void Start() { - + } private void Update() @@ -45,21 +36,21 @@ public void NowsSwitchToScene(int switchToSceneID_2) { - switch(switchToSceneID_2) + switch (switchToSceneID_2) { - case 3: - SceneManager.LoadScene("LaunchMenue"); - break; - case 4: - SceneManager.LoadScene("MainMenue"); - break; + case 3: + SceneManager.LoadScene("LaunchMenue"); + break; + case 4: + SceneManager.LoadScene("MainMenue"); + break; default: - SceneManager.LoadScene("LaunchMenue"); - break; + SceneManager.LoadScene("LaunchMenue"); + break; + + } + - } - - } } diff --git a/Assets/Scripts/UI/MainMenue/ScrollListWindowInitializer.cs b/Assets/Scripts/UI/MainMenue/ScrollListWindowInitializer.cs index a31d04d898389d98fe6d31ba2275fe99d9b500f7..350af91e469301e759d763062651eaae7643ca59 100644 --- a/Assets/Scripts/UI/MainMenue/ScrollListWindowInitializer.cs +++ b/Assets/Scripts/UI/MainMenue/ScrollListWindowInitializer.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; public class ScrollListWindowInitializer : MonoBehaviour diff --git a/Assets/Scripts/UI/NetwMenue/BackToButton_mobile.cs b/Assets/Scripts/UI/NetwMenue/BackToButton_mobile.cs index a62ece916012d14fdfc360690f12acf6e9fcd46f..56d531a1b63dd44693286d4c1ebb5a764ba61fb0 100644 --- a/Assets/Scripts/UI/NetwMenue/BackToButton_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/BackToButton_mobile.cs @@ -1,13 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -using static CommunicationEvents; -using static UIconfig; using static StreamingAssetLoader; diff --git a/Assets/Scripts/UI/NetwMenue/ControlOptionsM_Keyboard_mobile.cs b/Assets/Scripts/UI/NetwMenue/ControlOptionsM_Keyboard_mobile.cs index b261db3eb09431f041905f0d21b539c44759d8e2..65478c8afb0b8efc9a91315358243a917e122459 100644 --- a/Assets/Scripts/UI/NetwMenue/ControlOptionsM_Keyboard_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/ControlOptionsM_Keyboard_mobile.cs @@ -1,13 +1,5 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; - -using static UIconfig; using static StreamingAssetLoader; @@ -35,7 +27,7 @@ public class ControlOptionsM_Keyboard_mobile : MonoBehaviour void Start() { UpdateUI_6(); - + } private void Update() @@ -83,12 +75,12 @@ public void ChangeMouseCaptureInWindow() break; } - + //updateUIpreview(); NetworkJSON_Save(); } - + } diff --git a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs index 950c28c037530962239c3b04a127df4891bf3c21..072bf4b6d571c5ea5aa0a08be051d65f9bc3bb6e 100644 --- a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenuePreview_mobile.cs @@ -1,11 +1,5 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; using static UIconfig; @@ -40,7 +34,7 @@ private void Update() } - + public void updateUIpreview() { @@ -100,7 +94,7 @@ public void updateUIpreview() } - - + + } diff --git a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs index 89dd33f63f02c05d96a2a7c25163903e55f38c67..628731436d359bb6cba6132df0eb2d74eb34f85b 100644 --- a/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/ControlOptionsMenue_mobile.cs @@ -1,14 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; - -using static UIconfig; using static StreamingAssetLoader; +using static UIconfig; public class ControlOptionsMenue_mobile : MonoBehaviour @@ -62,9 +55,9 @@ private void Update() public void InputTXTupdate() { UpdateUI_6(); - InputManager_Txt1a.text = "Movement Forward: " + "\n" + + InputManager_Txt1a.text = "Movement Forward: " + "\n" + "Movement Backward: " + "\n" + - "Movement Left: " + "\n" + + "Movement Left: " + "\n" + "Movement Right: " + "\n" + "Movement Running: " + "\n" + "Movement Jump: " + "\n" + @@ -76,15 +69,15 @@ public void InputTXTupdate() //"\n" + "Menue Tools: " + "\n" + "Menue Mathematics: " + "\n" + - "Menue Cancel: " + "\n" + + "Menue Cancel: " + "\n" + //"\n" + - "Command Load: " + "\n" + + "Command Load: " + "\n" + "Command Save: " + "\n" + - "Command Reset: " + "\n" + + "Command Reset: " + "\n" + "Command Undo: " + "\n" + - "Command Redo: " + "\n"; - - InputManager_Txt1b.text = InputManager_KeyBinding_Vertical_1 + " , " + InputManager_KeyBinding_Vertical_2 + "\n" + + "Command Redo: " + "\n"; + + InputManager_Txt1b.text = InputManager_KeyBinding_Vertical_1 + " , " + InputManager_KeyBinding_Vertical_2 + "\n" + InputManager_KeyBinding_Vertical_01 + " , " + InputManager_KeyBinding_Vertical_02 + "\n" + InputManager_KeyBinding_Horizontal_01 + " , " + InputManager_KeyBinding_Horizontal_02 + "\n" + InputManager_KeyBinding_Horizontal_1 + " , " + InputManager_KeyBinding_Horizontal_2 + "\n" + @@ -99,7 +92,7 @@ public void InputTXTupdate() InputManager_KeyBinding_ToolmMenue_1 + "\n" + InputManager_KeyBinding_MathMenue_1 + "\n" + InputManager_KeyBinding_Cancel_1 + "\n" + - //"\n" + + //"\n" + InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_load_1 + "\n" + InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_save_1 + "\n" + InputManager_KeyBinding_modifier + " + " + InputManager_KeyBinding_mod_reset_1 + "\n" + @@ -113,7 +106,7 @@ public void InputTXTupdate() private void UpdateUI_6() { - switch (UIconfig.controlMode ) + switch (UIconfig.controlMode) { case ControlMode.Keyboard: @@ -192,11 +185,11 @@ private void UpdateUI_6() TouchModeButtonUT.GetComponent<Text>().text = "Press for changing mode"; break; } - + //updateUIpreview(); } - + public void TouchControls() { @@ -260,7 +253,7 @@ public void InputSystemModes() case 2: UIconfig.InputManagerVersion = 3; //GameObject.Find("TextSlotTOO").GetComponent<Text>().text = "Touch controls OFF"; - + break; case 3: UIconfig.InputManagerVersion = 1; @@ -285,6 +278,6 @@ public void touchAreaVisibilityBttn() //updateUIpreview(); } - + } diff --git a/Assets/Scripts/UI/NetwMenue/FindIP.cs b/Assets/Scripts/UI/NetwMenue/FindIP.cs index 32a8546c4a69087e18efff2b99fd0ae0b4042dc9..fb2b211b1c374a691b5820f15be09f5e3f9b8a73 100644 --- a/Assets/Scripts/UI/NetwMenue/FindIP.cs +++ b/Assets/Scripts/UI/NetwMenue/FindIP.cs @@ -1,14 +1,6 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; using static StreamingAssetLoader; -using static CheckServer; -using static CommunicationEvents; //[RequireComponent(typeof(Image))] //[SerializeField] private UnityEngine.UI.Image image = null; @@ -25,7 +17,7 @@ public class FindIP : MonoBehaviour public InputField mainInputField; - + //CheckServer CSform = new CheckServer(); //Color colOnline = new Color(148, 229, 156, 1); private Color colOnline = new Color(148f / 255f, 229f / 255f, 156f / 255f, 1f); @@ -154,11 +146,11 @@ public void SetText(string text) - - CommunicationEvents.ServerRunningA[6] = 1; - CommunicationEvents.selecIP = CommunicationEvents.newIP; - CommunicationEvents.IPcheckGeneration++; + CommunicationEvents.ServerRunningA[6] = 1; + CommunicationEvents.selecIP = CommunicationEvents.newIP; + + CommunicationEvents.IPcheckGeneration++; //Safefieldmenue(); goBackButtonOPTM(); @@ -177,7 +169,7 @@ public void goBackButtonOPTM() ClearUIC(); //UIconfig.Andr_Start_menue_counter = 1; - backTo_GObj.SetActive(true); + backTo_GObj.SetActive(true); @@ -197,9 +189,9 @@ private void ClearUIC() } - - - + + + diff --git a/Assets/Scripts/UI/NetwMenue/GameplayOptionsMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/GameplayOptionsMenue_mobile.cs index cee35dfe311bdedd7124be82ff59b4ac6678f714..b9b4454ff09614f1d8171fb2f40a5caf7c38d6d5 100644 --- a/Assets/Scripts/UI/NetwMenue/GameplayOptionsMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/GameplayOptionsMenue_mobile.cs @@ -1,14 +1,5 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -using static CommunicationEvents; -using static UIconfig; -using static StreamingAssetLoader; public class GameplayOptionsMenue_mobile : MonoBehaviour @@ -31,7 +22,7 @@ public class GameplayOptionsMenue_mobile : MonoBehaviour void Start() { - + } private void Update() @@ -39,7 +30,7 @@ private void Update() cllscaleAll_Slider.GetComponent<Slider>().value = (float)(UIconfig.colliderScale_all / (UIconfig.colliderScale_all_default * UIconfig.colliderScale_all_SliderMax)); ScaleColliderAllBttn(); - + CamSens_Slider.GetComponent<Slider>().value = (float)((UIconfig.camRotatingSensitivity) / (UIconfig.camRotatingSensitivity_default * UIconfig.camRotatingSensitivity_sliderMax)); CamSensitivityBttn(); @@ -48,31 +39,31 @@ private void Update() - + public void ScaleColliderAllBttn() { - UIconfig.colliderScale_all = cllscaleAll_Slider.GetComponent<Slider>().value* UIconfig.colliderScale_all_SliderMax* UIconfig.colliderScale_all_default; - cllscaleAll_SliderT.GetComponent<Text>().text = "Scale of Hitbox for MouseClicks is " + (int)(100 * UIconfig.colliderScale_all/UIconfig.colliderScale_all_default) + "%"; + UIconfig.colliderScale_all = cllscaleAll_Slider.GetComponent<Slider>().value * UIconfig.colliderScale_all_SliderMax * UIconfig.colliderScale_all_default; + cllscaleAll_SliderT.GetComponent<Text>().text = "Scale of Hitbox for MouseClicks is " + (int)(100 * UIconfig.colliderScale_all / UIconfig.colliderScale_all_default) + "%"; //updateUIpreview(); } - + public void CamSensitivityBttn() { UIconfig.camRotatingSensitivity = CamSens_Slider.GetComponent<Slider>().value * UIconfig.camRotatingSensitivity_sliderMax * UIconfig.camRotatingSensitivity_default; double zwischenRechn = 100 * (UIconfig.camRotatingSensitivity); // /(UIconfig.camRotatingSensitivity_default); CamSens_SliderT.GetComponent<Text>().text = "Sensitivity of Camera is " + (int)(zwischenRechn) + "%"; - + } - - + + } diff --git a/Assets/Scripts/UI/NetwMenue/GraphicOptionsMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/GraphicOptionsMenue_mobile.cs index e9a4a3ce3922f979a48dfa61e7a751f723ced97f..2d5ae763fe28f55043e92f33aef7c696efd8208d 100644 --- a/Assets/Scripts/UI/NetwMenue/GraphicOptionsMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/GraphicOptionsMenue_mobile.cs @@ -1,14 +1,5 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; - -using static UIconfig; -using static StreamingAssetLoader; public class GraphicOptionsMenue_mobile : MonoBehaviour @@ -16,7 +7,7 @@ public class GraphicOptionsMenue_mobile : MonoBehaviour public GameObject cursorScaler_Slider; public GameObject cursorScaler_SliderT; - + @@ -58,7 +49,7 @@ public void mousePointerScaleBttn() public void setMouse() { updateMouseCursor.setMouse(); - + } } \ No newline at end of file diff --git a/Assets/Scripts/UI/NetwMenue/LaunchMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/LaunchMenue_mobile.cs index 18abece6a74762f01e7057150d46adb4955737b2..d6e499588d25af5d710e594c8b1da94581b4c4ab 100644 --- a/Assets/Scripts/UI/NetwMenue/LaunchMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/LaunchMenue_mobile.cs @@ -1,18 +1,10 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr +//new InputSystem +using UnityEngine.EventSystems; using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static CheckServer; ///using static CommunicationEvents; using static StreamingAssetLoader; -using static UIconfig; -//new InputSystem -using UnityEngine.EventSystems; -using UnityEngine.InputSystem.Layouts; public class LaunchMenue_mobile : MonoBehaviour, IPointerDownHandler, IPointerUpHandler @@ -29,7 +21,7 @@ public void OnPointerDown(PointerEventData eventData) } public void OnPointerUp(PointerEventData eventData) { - + } @@ -37,7 +29,7 @@ public void OnPointerUp(PointerEventData eventData) void Start() { - + } @@ -76,7 +68,7 @@ public void toNetwOptionsM() /// <summary> /// Deactivates all Pages. /// </summary> - private void ClearUIC() + private void ClearUIC() { for (int i = 0; i < parentM_GObj.transform.childCount; i++) @@ -87,7 +79,7 @@ private void ClearUIC() - + public static void startNextSceneFunctionNewGame() { NetworkJSON_Save(); @@ -101,7 +93,7 @@ public static void startNextSceneFunctionNewGame() } - + diff --git a/Assets/Scripts/UI/NetwMenue/LoadingCircle.cs b/Assets/Scripts/UI/NetwMenue/LoadingCircle.cs index cbf5c3aba4837439481bc9c8c8103aeb4a05f2f6..c44274d272c8fc229a0b81bacb428f0ab8b64c47 100644 --- a/Assets/Scripts/UI/NetwMenue/LoadingCircle.cs +++ b/Assets/Scripts/UI/NetwMenue/LoadingCircle.cs @@ -5,15 +5,15 @@ public class LoadingCircle : MonoBehaviour { private RectTransform rectComponent; public float rotateSpeed = -200f; - private float width=100; - private float height=100; + private float width = 100; + private float height = 100; public float scale; - + private void Start() { rectComponent = GetComponent<RectTransform>(); - + } private void Update() @@ -34,6 +34,6 @@ private void Update() rectComponent.sizeDelta = new Vector2(width, height); } - + } } \ No newline at end of file diff --git a/Assets/Scripts/UI/NetwMenue/MenueControl_mobile.cs b/Assets/Scripts/UI/NetwMenue/MenueControl_mobile.cs index 81acf894addb32e0b2871abfd6b50cdda6dfc6ce..313ff8b6f78ac9c468221d7438620365ad0e3710 100644 --- a/Assets/Scripts/UI/NetwMenue/MenueControl_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/MenueControl_mobile.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; -using static UIconfig; public class MenueControl_mobile : MonoBehaviour @@ -31,7 +23,7 @@ void Start() private void Update() { - + } @@ -40,17 +32,17 @@ public void toChild1() { ClearUIC(); //UIconfig.Andr_Start_menue_counter = 1; - child1_GObj.SetActive(true); + child1_GObj.SetActive(true); } - + /// <summary> /// Deactivates all Pages. /// </summary> private void ClearUIC() { - + for (int i = 0; i < myself_GObj.transform.childCount; i++) { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); diff --git a/Assets/Scripts/UI/NetwMenue/SaveNetwAddr_mobile.cs b/Assets/Scripts/UI/NetwMenue/SaveNetwAddr_mobile.cs index 34759481530b2e8d2fdfcd01db29548e6677e4f6..ed277aca328ca90f808cdd40dcb50d3c2cd6ac94 100644 --- a/Assets/Scripts/UI/NetwMenue/SaveNetwAddr_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/SaveNetwAddr_mobile.cs @@ -1,15 +1,8 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; using static CommunicationEvents; -using static UIconfig; using static StreamingAssetLoader; -using static CheckServer; +using static UIconfig; public class SaveNetwAddr_mobile : MonoBehaviour { @@ -49,10 +42,10 @@ private void Update() public void Refresh_pressed() { Ip1_sup = CommunicationEvents.IPslot1; - Ip2_sup = CommunicationEvents.IPslot2; + Ip2_sup = CommunicationEvents.IPslot2; Ip3_sup = CommunicationEvents.IPslot3; - print("se"+Ip1_sup); - + print("se" + Ip1_sup); + } @@ -65,56 +58,56 @@ void UpdateUI_3_f() tempColB = SaveSlot1_B_GObj.GetComponent<Button>().colors; tempColB.pressedColor = colPressed; tempColB.selectedColor = colSelect; - - if (CommunicationEvents.ServerRunningA[3] == 0) + + if (CommunicationEvents.ServerRunningA[3] == 0) + { + tempColB.normalColor = colOffline; + if (string.IsNullOrEmpty(CommunicationEvents.IPslot1))// || CommunicationEvents.IPslot1.Length < 1) { - tempColB.normalColor = colOffline; - if (string.IsNullOrEmpty(CommunicationEvents.IPslot1))// || CommunicationEvents.IPslot1.Length < 1) + SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >"; + } + else + { + + + if (Ip1_sup.Equals(CommunicationEvents.IPslot1)) { - SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >"; + SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1 + " (Offline)"; } else { - - - if (Ip1_sup.Equals(CommunicationEvents.IPslot1)) - { - SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1 + " (Offline)"; - } - else - { - print("sss" + Ip1_sup.Equals(CommunicationEvents.IPslot1)); - SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1; - } + print("sss" + Ip1_sup.Equals(CommunicationEvents.IPslot1)); + SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1; } } - else + } + else + { + if (CommunicationEvents.ServerRunningA[3] == 2) { - if (CommunicationEvents.ServerRunningA[3] == 2) + print("test" + Ip1_sup); + if (Ip1_sup.Equals(CommunicationEvents.IPslot1)) { - print("test" + Ip1_sup); - if (Ip1_sup.Equals(CommunicationEvents.IPslot1)) - { - tempColB.normalColor = colOnline; - SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1 + " (Online)"; - } - else - { - print("s3ss" + Ip1_sup.Equals(CommunicationEvents.IPslot1)); - SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1; - print("ww"+ Ip1_sup); - print("we"+ CommunicationEvents.IPslot1); - - } + tempColB.normalColor = colOnline; + SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1 + " (Online)"; } else { - tempColB.normalColor = colOffline; - SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >"; + print("s3ss" + Ip1_sup.Equals(CommunicationEvents.IPslot1)); + SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1; + print("ww" + Ip1_sup); + print("we" + CommunicationEvents.IPslot1); + } } - SaveSlot1_B_GObj.GetComponent<Button>().colors = tempColB; - + else + { + tempColB.normalColor = colOffline; + SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >"; + } + } + SaveSlot1_B_GObj.GetComponent<Button>().colors = tempColB; + @@ -220,7 +213,7 @@ void UpdateUI_5_f() } } SaveSlot3_B_GObj.GetComponent<Button>().colors = tempColB; - + } @@ -243,7 +236,7 @@ public void Slot2_s() //CommunicationEvents.ServerAdress = "http://" + CommunicationEvents.ServerAddress2; CommunicationEvents.IPslot2 = CommunicationEvents.newIP; Update(); - + CheckServerA[4] = 1; NetworkJSON_Save(); diff --git a/Assets/Scripts/UI/NetwMenue/SelectNetwServer_mobile.cs b/Assets/Scripts/UI/NetwMenue/SelectNetwServer_mobile.cs index 5d85e7f592ffc00638335eba8029139521b99549..9bbd2705af98760a1a0e954de4d1996c1760fbad 100644 --- a/Assets/Scripts/UI/NetwMenue/SelectNetwServer_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/SelectNetwServer_mobile.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -using static CommunicationEvents; -using static UIconfig; using static StreamingAssetLoader; -using static CheckServer; +using static UIconfig; public class SelectNetwServer_mobile : MonoBehaviour { @@ -30,12 +22,12 @@ void Start() private void Update() { - - UpdateUI_1_f(); - UpdateUI_3_f(); - UpdateUI_4_f(); - - UpdateUI_5_f(); + + UpdateUI_1_f(); + UpdateUI_3_f(); + UpdateUI_4_f(); + + UpdateUI_5_f(); } public void SlotLPS() @@ -258,7 +250,7 @@ void UpdateUI_5_f() Slot3_B_GObj.GetComponent<Button>().colors = tempColB; } - + } diff --git a/Assets/Scripts/UI/NetwMenue/SelectedNetwServer_mobile.cs b/Assets/Scripts/UI/NetwMenue/SelectedNetwServer_mobile.cs index d0c32fffbd09552e469792d220cbad5ec556a24a..bc9f6291ed123ce726ebc24e5cb927b108e9071c 100644 --- a/Assets/Scripts/UI/NetwMenue/SelectedNetwServer_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/SelectedNetwServer_mobile.cs @@ -1,16 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -using static CommunicationEvents; -using static UIconfig; -using static StreamingAssetLoader; -using static CheckServer; using static LaunchMenue_mobile; +using static UIconfig; public class SelectedNetwServer_mobile : MonoBehaviour { diff --git a/Assets/Scripts/UI/NetwMenue/SelectedNewNetwServer_mobile.cs b/Assets/Scripts/UI/NetwMenue/SelectedNewNetwServer_mobile.cs index d0f03af69fb555cfc0124dd9f2a899d18cd6422b..f5b0a04a6b7850be6c5f1eb52bd729fdd2e5027c 100644 --- a/Assets/Scripts/UI/NetwMenue/SelectedNewNetwServer_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/SelectedNewNetwServer_mobile.cs @@ -1,16 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; -using static CommunicationEvents; -using static UIconfig; -using static StreamingAssetLoader; -using static CheckServer; using static LaunchMenue_mobile; +using static UIconfig; public class SelectedNewNetwServer_mobile : MonoBehaviour { @@ -19,7 +10,7 @@ public class SelectedNewNetwServer_mobile : MonoBehaviour public GameObject NewNAddrTS; public GameObject NewNAddrTI; public GameObject StartGwoS; - + private Color32 firstColB; private float transCol; @@ -37,7 +28,7 @@ private void Update() { UpdateUI_6_f(); - + } void UpdateUI_6_f() @@ -70,7 +61,7 @@ void UpdateUI_6_f() else { NewNAddrTS.GetComponent<Text>().text = "Status: no ip-address"; - + } } @@ -84,7 +75,7 @@ void UpdateUI_6_f() NewNAddrTS.GetComponent<Text>().text = "Status: Online"; StartGwoS.GetComponent<Image>().color = Color.white; StartGwoS.GetComponentInChildren<Text>().color = Color.black; - + } else { @@ -120,7 +111,7 @@ public void startNewIPGameButton() } else { - + } } diff --git a/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs index 46459bd23db5346849e9dc8f3da0229c11359eed..087f10b6cde0318d9312cca80cdf1b9c92ba444d 100644 --- a/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/StartMenue_mobile.cs @@ -1,18 +1,12 @@ -using System.Collections; -using System.Collections.Generic; +using System; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; +using static CommunicationEvents; +using static StreamingAssetLoader; //using static StreamingAssetLoader; //using static CheckServer; //using static CommunicationEvents; using static UIconfig; -using static StreamingAssetLoader; -using static CommunicationEvents; -using System; public class StartMenue_mobile : MonoBehaviour { @@ -50,7 +44,7 @@ private void Awake() void Start() { - + } void start2_CheckOS_CheckConfig() @@ -58,10 +52,10 @@ void start2_CheckOS_CheckConfig() //Try to find existing Config: int configExists = 0; //Debug.Log("Load Streaming Asset"); - try { NetworkJSON_Load_0(); configExists=1; } + try { NetworkJSON_Load_0(); configExists = 1; } catch (Exception e) { - Debug.Log(e); + Debug.Log(e); } //Debug.Log("Load Streaming Asset finished"); //Debug.Log(checkPersistentDataPath()); @@ -70,12 +64,12 @@ void start2_CheckOS_CheckConfig() NetworkJSON_Load(); configExists = 2; } - catch(Exception e) + catch (Exception e) { Debug.Log(e); } - + if (configExists == 0) { Debug.Log(configExists + "No Config found"); @@ -97,7 +91,7 @@ void start2_CheckOS_CheckConfig() checkOS(); } //Entpacken - if (!checkPersistentDataPath() || configExists<1) + if (!checkPersistentDataPath() || configExists < 1) { //Debug.Log("initialReset_PDP"); ResetPersistentDataPath(); @@ -109,7 +103,7 @@ void start2_CheckOS_CheckConfig() } //Save CheckOS NetworkJSON_Save(); - + //Debug.Log("StartAdaption"); if (autoSettingsAdaption) { @@ -118,7 +112,7 @@ void start2_CheckOS_CheckConfig() } //Debug.Log("EndAdaption"); NetworkJSON_Load(); - + if (!checkDataPath() || true) { ResetDataPath(); @@ -135,24 +129,25 @@ void start2_CheckOS_CheckConfig() { Cursor.lockState = CursorLockMode.None; } - + } private void Update() { - + } void checkOS() { - if (CommunicationEvents.autoOSrecognition == true) { + if (CommunicationEvents.autoOSrecognition == true) + { checkOS2(); } else { //CommunicationEvents.Opsys = CommunicationEvents.Opsys_Default; } - if(Opsys == OperationSystem.Android) + if (Opsys == OperationSystem.Android) { ServerAutoStart = false; } @@ -161,21 +156,21 @@ void checkOS() void checkOS2() { //https://docs.unity3d.com/ScriptReference/RuntimePlatform.html - + if (Application.platform == RuntimePlatform.WindowsPlayer) { - + //Debug.Log("Windows OS detected"); CommunicationEvents.Opsys = OperationSystem.Windows; - + return; } if (Application.platform == RuntimePlatform.Android) { //Debug.Log("Android OS detected"); CommunicationEvents.Opsys = OperationSystem.Android; - + return; } if (Application.platform == RuntimePlatform.WindowsEditor) @@ -209,16 +204,16 @@ void changeSettingsToOS() } -public void setMouse() + public void setMouse() { - updateMouseCursor.setMouse(); + updateMouseCursor.setMouse(); } void ScreenOptimization() { Screen.orientation = ScreenOrientation.LandscapeLeft; - + UIconfig.screHeight = Screen.height; UIconfig.screWidth = Screen.width; CommunicationEvents.lastIP = CommunicationEvents.selecIP; @@ -272,7 +267,7 @@ void ScreenOptimization() rt.localScale = new Vector3(sizeX, sizeY, 1); */ - + } @@ -285,13 +280,13 @@ public void toChild1() } - + /// <summary> /// Deactivates all Pages. /// </summary> private void ClearUIC() { - + for (int i = 0; i < myself_GObj.transform.childCount; i++) { myself_GObj.transform.GetChild(i).gameObject.SetActive(false); diff --git a/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs b/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs index e4781bfe45dec8e66621d1e607f39314fb4a5acd..9e2e92d9ce5d230c5464d16f03f9eedcb8c2cd2f 100644 --- a/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs +++ b/Assets/Scripts/UI/NetwMenue/SystemOptionsMenue_mobile.cs @@ -1,15 +1,7 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; - -using static UIconfig; -using static StreamingAssetLoader; using static CommunicationEvents; +using static StreamingAssetLoader; public class SystemOptionsMenue_mobile : MonoBehaviour { @@ -69,8 +61,8 @@ void UpdateUI_6() } - switch (UIconfig.autoSettingsAdaption) - { + switch (UIconfig.autoSettingsAdaption) + { case false: //GameObject.Find("TextSlotTOO").GetComponent<Text>().text = "Touch controls OFF"; @@ -82,11 +74,11 @@ void UpdateUI_6() AutoSettingsAdap_Button.GetComponent<Text>().text = "Settings Adaption: ON"; AutoSettingsAdap_ButtonUT.GetComponentInChildren<Text>().text = "Press for deactivating"; - break; + break; - } - + } + diff --git a/Assets/Scripts/UI/NetwMenue/WaitingForLocalMMT.cs b/Assets/Scripts/UI/NetwMenue/WaitingForLocalMMT.cs index f6094139ad14a4c5559d7bea911a66732b1c59ce..ff75261c1eb10c7caa0a06f4215ae2e3d1f91372 100644 --- a/Assets/Scripts/UI/NetwMenue/WaitingForLocalMMT.cs +++ b/Assets/Scripts/UI/NetwMenue/WaitingForLocalMMT.cs @@ -1,8 +1,7 @@ using System.Collections; using UnityEngine; -using UnityEngine.SceneManagement; using UnityEngine.Networking; -using static UIconfig; +using UnityEngine.SceneManagement; public class WaitingForLocalMMT : MonoBehaviour { @@ -56,7 +55,7 @@ IEnumerator ServerRoutine() { - + using UnityWebRequest request = pingL(); yield return request.SendWebRequest(); if (request.result == UnityWebRequest.Result.ConnectionError diff --git a/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs b/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs index 33672a1ebb86768a773cce67204ce63bdb8f3b0c..74c3f5dcf9cf8478be60cefc45ccff036104d142 100644 --- a/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs +++ b/Assets/Scripts/UI/NetwMenue/updateMouseCursor.cs @@ -1,14 +1,6 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; using static UIconfig; -using static StreamingAssetLoader; public static class updateMouseCursor @@ -39,7 +31,7 @@ public static void setMouse() //Android crashes in level scene; - if (CommunicationEvents.Opsys!= CommunicationEvents.OperationSystem.Windows) + 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 e72f8e4ff2f55cb875a9ab75cf054428cad3dc09..c44fd51d32a29738885d21af294641578e9573b9 100644 --- a/Assets/Scripts/UI/NetwMenue/uploadMouseCursor.cs +++ b/Assets/Scripts/UI/NetwMenue/uploadMouseCursor.cs @@ -1,14 +1,6 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.UI; //andr -using UnityEngine.SceneManagement; -using System.IO; // -using UnityEngine.Video;//streaming -using UnityEngine.Networking; using static UIconfig; -using static StreamingAssetLoader; diff --git a/Assets/Scripts/UI/PlayerControls/AxisInputButton.cs b/Assets/Scripts/UI/PlayerControls/AxisInputButton.cs index 4553f93a54418ad9cba7fbc4b6a0de57b408c94e..93927327c12d6aadf0d89648eaee2e85cf35c262 100644 --- a/Assets/Scripts/UI/PlayerControls/AxisInputButton.cs +++ b/Assets/Scripts/UI/PlayerControls/AxisInputButton.cs @@ -1,5 +1,4 @@ using UnityEngine; -using UnityEngine.UI; using UnityEngine.EventSystems; using static UIconfig; @@ -19,7 +18,7 @@ public class AxisInputButton : MonoBehaviour, IPointerDownHandler, IPointerUpHan AxisInputButton m_PairedWith; // Which button this one is paired with CrossPlatformInputManager.VirtualAxis m_Axis; // A reference to the virtual axis as it is in the cross platform input - + void Start() { @@ -28,7 +27,7 @@ void Update() { } - + void OnEnable() { @@ -49,7 +48,7 @@ void FindPairedButton() { // find the other button witch which this button should be paired // (it should have the same axisName) - var otherAxisButtons = FindObjectsOfType(typeof(AxisInputButton)) as AxisInputButton[]; + var otherAxisButtons = FindObjectsOfType(typeof(AxisInputButton)) as AxisInputButton[]; if (otherAxisButtons != null) { @@ -80,9 +79,9 @@ public void OnPointerDown(PointerEventData data) m_Axis.Update(Mathf.MoveTowards(m_Axis.GetValue, axisValue, responseSpeed * Time.deltaTime)); //GameObject.Find("TextUPress").GetComponent<Text>().text = m_Axis.GetValue +", "+axisValue +", "+ responseSpeed +" * " +Time.deltaTime; //print("down"); - DPAD[DPAD_ID,DPAD_subID]= axisValue; + DPAD[DPAD_ID, DPAD_subID] = axisValue; + - } diff --git a/Assets/Scripts/UI/PlayerControls/AxisTouchPad.cs b/Assets/Scripts/UI/PlayerControls/AxisTouchPad.cs index eaf36efa76c83e1a751852d0e726e74710080efa..c720e2d0ecaae412aff811360ac80180bc596b00 100644 --- a/Assets/Scripts/UI/PlayerControls/AxisTouchPad.cs +++ b/Assets/Scripts/UI/PlayerControls/AxisTouchPad.cs @@ -4,7 +4,7 @@ using static UIconfig; namespace PlayerCtrl -{ +{ [RequireComponent(typeof(Image))] public class AxisTouchPad : MonoBehaviour, IPointerDownHandler, IPointerUpHandler @@ -142,7 +142,7 @@ void Update() m_PreviousMouse = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0f); #endif UpdateVirtualAxes(new Vector3(pointerDelta.x, pointerDelta.y, 0)); - + } } diff --git a/Assets/Scripts/UI/PlayerControls/CrossPlatformInputManager.cs b/Assets/Scripts/UI/PlayerControls/CrossPlatformInputManager.cs index 30f2b763e3ef9ccbae9850f57a32fbaa29d4e357..e7fc9ad3cde2c42646e59334f776879a847fe733 100644 --- a/Assets/Scripts/UI/PlayerControls/CrossPlatformInputManager.cs +++ b/Assets/Scripts/UI/PlayerControls/CrossPlatformInputManager.cs @@ -1,6 +1,6 @@ +using PlayerCtrl.PlatformSpecific; using System; using UnityEngine; -using PlayerCtrl.PlatformSpecific; namespace PlayerCtrl { diff --git a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/RebindActionUI.cs b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/RebindActionUI.cs index cf661b6da735a19fd29c8f228b7873a04d1e8573..1dc30dcb8241eb67528f1fe0e8160bbf08e61938 100644 --- a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/RebindActionUI.cs +++ b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/RebindActionUI.cs @@ -413,14 +413,14 @@ private static void OnActionChange(object obj, InputActionChange change) // We want the label for the action name to update in edit mode, too, so // we kick that off from here. - #if UNITY_EDITOR +#if UNITY_EDITOR protected void OnValidate() { UpdateActionLabel(); UpdateBindingDisplay(); } - #endif +#endif private void UpdateActionLabel() { diff --git a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/ControlsRemapping.cs b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/ControlsRemapping.cs index c6956f9298105068da0d3f857eda7491b4a25ab7..2406ceb1ea62d4510e3592605764d10675ae69f2 100644 --- a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/ControlsRemapping.cs +++ b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/ControlsRemapping.cs @@ -1,8 +1,7 @@ using System; +using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; @@ -16,7 +15,7 @@ public class ControlsRemapping : MonoBehaviour private void Awake() { - + if (Controls != null) { Destroy(this); @@ -38,7 +37,8 @@ public static void RemapKeyboardAction(InputAction actionToRebind, int targetBin .WithBindingGroup("Keyboard") .WithCancelingThrough("<Keyboard>/escape") .OnCancel(operation => SuccessfulRebinding?.Invoke(null)) - .OnComplete(operation => { + .OnComplete(operation => + { operation.Dispose(); AddOverrideToDictionary(actionToRebind.id, actionToRebind.bindings[targetBinding].effectivePath, targetBinding); SaveControlOverrides(); @@ -54,7 +54,8 @@ public static void RemapGamepadAction(InputAction actionToRebind, int targetBind .WithBindingGroup("Gamepad") .WithCancelingThrough("<Keyboard>/escape") .OnCancel(operation => SuccessfulRebinding?.Invoke(null)) - .OnComplete(operation => { + .OnComplete(operation => + { operation.Dispose(); AddOverrideToDictionary(actionToRebind.id, actionToRebind.bindings[targetBinding].effectivePath, targetBinding); SaveControlOverrides(); diff --git a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/InputActionDisplay.cs b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/InputActionDisplay.cs index 44746646098f2e22758b1fa1718b5c745653281f..e57ca827971836c459d0ea7e6b2e9c9f7a90cc6f 100644 --- a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/InputActionDisplay.cs +++ b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/dm/InputActionDisplay.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; using TMPro; using UnityEngine; using UnityEngine.InputSystem; @@ -11,7 +7,7 @@ public class InputActionDisplay : MonoBehaviour { [SerializeField] private InputActionReference actionReference; [SerializeField] private int bindingIndex; - + private InputAction action; diff --git a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/yt_RebindingDisplay.cs b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/yt_RebindingDisplay.cs index a2a25c96fbbd8144f3f52ffc775b5d5543d2f500..b79834587cd0791133280342377f433a1f0d2d65 100644 --- a/Assets/Scripts/UI/PlayerControls/InputSystemPackage/yt_RebindingDisplay.cs +++ b/Assets/Scripts/UI/PlayerControls/InputSystemPackage/yt_RebindingDisplay.cs @@ -1,73 +1,69 @@ -using TMPro; -using UnityEngine; -using UnityEngine.InputSystem; - namespace DapperDino.InputSystemTutorials { - /* - public class yt_RebindingDisplay : MonoBehaviour - { - [SerializeField] private InputActionReference jumpAction = null; - [SerializeField] private PlayerController playerController = null; - [SerializeField] private TMP_Text bindingDisplayNameText = null; - [SerializeField] private GameObject startRebindObject = null; - [SerializeField] private GameObject waitingForInputObject = null; + /* + public class yt_RebindingDisplay : MonoBehaviour + { + [SerializeField] private InputActionReference jumpAction = null; + [SerializeField] private PlayerController playerController = null; + [SerializeField] private TMP_Text bindingDisplayNameText = null; + [SerializeField] private GameObject startRebindObject = null; + [SerializeField] private GameObject waitingForInputObject = null; - private InputActionRebindingExtensions.RebindingOperation rebindingOperation; + private InputActionRebindingExtensions.RebindingOperation rebindingOperation; - private const string RebindsKey = "rebinds"; + private const string RebindsKey = "rebinds"; - private void Start() - { - string rebinds = PlayerPrefs.GetString(RebindsKey, string.Empty); + private void Start() + { + string rebinds = PlayerPrefs.GetString(RebindsKey, string.Empty); - if (string.IsNullOrEmpty(rebinds)) { return; } + if (string.IsNullOrEmpty(rebinds)) { return; } - playerController.PlayerInput.actions.LoadBindingOverridesFromJson(rebinds); + playerController.PlayerInput.actions.LoadBindingOverridesFromJson(rebinds); - int bindingIndex = jumpAction.action.GetBindingIndexForControl(jumpAction.action.controls[0]); + int bindingIndex = jumpAction.action.GetBindingIndexForControl(jumpAction.action.controls[0]); - bindingDisplayNameText.text = InputControlPath.ToHumanReadableString( - jumpAction.action.bindings[bindingIndex].effectivePath, - InputControlPath.HumanReadableStringOptions.OmitDevice); - } + bindingDisplayNameText.text = InputControlPath.ToHumanReadableString( + jumpAction.action.bindings[bindingIndex].effectivePath, + InputControlPath.HumanReadableStringOptions.OmitDevice); + } - public void Save() - { - string rebinds = playerController.PlayerInput.actions.SaveBindingOverridesAsJson(); + public void Save() + { + string rebinds = playerController.PlayerInput.actions.SaveBindingOverridesAsJson(); - PlayerPrefs.SetString(RebindsKey, rebinds); - } + PlayerPrefs.SetString(RebindsKey, rebinds); + } - public void StartRebinding() - { - startRebindObject.SetActive(false); - waitingForInputObject.SetActive(true); + public void StartRebinding() + { + startRebindObject.SetActive(false); + waitingForInputObject.SetActive(true); - playerController.PlayerInput.SwitchCurrentActionMap("Menu"); + playerController.PlayerInput.SwitchCurrentActionMap("Menu"); - rebindingOperation = jumpAction.action.PerformInteractiveRebinding() - .WithControlsExcluding("Mouse") - .OnMatchWaitForAnother(0.1f) - .OnComplete(operation => RebindComplete()) - .Start(); - } + rebindingOperation = jumpAction.action.PerformInteractiveRebinding() + .WithControlsExcluding("Mouse") + .OnMatchWaitForAnother(0.1f) + .OnComplete(operation => RebindComplete()) + .Start(); + } - private void RebindComplete() - { - int bindingIndex = jumpAction.action.GetBindingIndexForControl(jumpAction.action.controls[0]); + private void RebindComplete() + { + int bindingIndex = jumpAction.action.GetBindingIndexForControl(jumpAction.action.controls[0]); - bindingDisplayNameText.text = InputControlPath.ToHumanReadableString( - jumpAction.action.bindings[bindingIndex].effectivePath, - InputControlPath.HumanReadableStringOptions.OmitDevice); + bindingDisplayNameText.text = InputControlPath.ToHumanReadableString( + jumpAction.action.bindings[bindingIndex].effectivePath, + InputControlPath.HumanReadableStringOptions.OmitDevice); - rebindingOperation.Dispose(); + rebindingOperation.Dispose(); - startRebindObject.SetActive(true); - waitingForInputObject.SetActive(false); + startRebindObject.SetActive(true); + waitingForInputObject.SetActive(false); - playerController.PlayerInput.SwitchCurrentActionMap("Gameplay"); - } - } - */ + playerController.PlayerInput.SwitchCurrentActionMap("Gameplay"); + } + } + */ } \ No newline at end of file diff --git a/Assets/Scripts/UI/PlayerControls/TestInput.cs b/Assets/Scripts/UI/PlayerControls/TestInput.cs index b54b9b223a585196998b2eb8e435e847d850ab16..1046cb0057164edbe67d4fcf76712d7adeeb7bd9 100644 --- a/Assets/Scripts/UI/PlayerControls/TestInput.cs +++ b/Assets/Scripts/UI/PlayerControls/TestInput.cs @@ -1,7 +1,4 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEngine.InputSystem; using UnityEngine.UI; public class TestInput : MonoBehaviour @@ -17,7 +14,7 @@ public class TestInput : MonoBehaviour // Start is called before the first frame update void Start() { - + } private void Awake() { @@ -29,20 +26,20 @@ private void Awake() private void OnEnable() { input_ControlMapping = new ControlMapping(); - input_ControlMapping.Actionmap1.Movement.Enable(); - + input_ControlMapping.Actionmap1.Movement.Enable(); + } private void OnDisable() { - + input_ControlMapping.Actionmap1.Movement.Disable(); } - // Update is called once per frame - void Update() + // Update is called once per frame + void Update() { @@ -61,6 +58,6 @@ void Update() image.color = imageColorToBeUsed_w; } - + } } diff --git a/Assets/Scripts/UI/Pointers/cursor_script1.cs b/Assets/Scripts/UI/Pointers/cursor_script1.cs index 7f4b31150c4c6281207b9b66b9e8b4e64c72337b..aa19e6d0ff1119fe37b18353f2d1382a2d8934e0 100644 --- a/Assets/Scripts/UI/Pointers/cursor_script1.cs +++ b/Assets/Scripts/UI/Pointers/cursor_script1.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; public class cursor_script1 : MonoBehaviour diff --git a/Assets/Scripts/UI/UIToolBox.cs b/Assets/Scripts/UI/UIToolBox.cs index 5c70eb810c3cef0ac2e379484f3b4969f899f62a..caf15ae93428e5dfdec37b62e38e9ecfdae16c34 100644 --- a/Assets/Scripts/UI/UIToolBox.cs +++ b/Assets/Scripts/UI/UIToolBox.cs @@ -1,4 +1,3 @@ -using System.Collections; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/Scripts/UI/UIconfig.cs b/Assets/Scripts/UI/UIconfig.cs index 7ff3546ab5fe833e7c10fa0b67f1ce34157525e5..cca338939636fafd7e536a87037a0453b8dc6f2d 100644 --- a/Assets/Scripts/UI/UIconfig.cs +++ b/Assets/Scripts/UI/UIconfig.cs @@ -1,7 +1,6 @@ +using System; using System.Collections.Generic; using UnityEngine; -using UnityEngine.Events; -using System; public static class UIconfig { @@ -28,14 +27,14 @@ public enum InteractingRangeMode public static int MainCameraID = 0; //0=Camera.main; 1=Cam1, 2=Cam2 - public static float[,] DPAD = new float[2, 4] { { 0, 0,0,0 }, { 0, 0, 0, 0 } } ; //Movement, Camera //Up, Down, Left, Right// + public static float[,] DPAD = new float[2, 4] { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; //Movement, Camera //Up, Down, Left, Right// public static bool localServerWithAdditionalWindow = true; - + //How to handle the waitTime to start ToolModeSelector - public static int ToolModeSelector_HandlerMode = 1 ; //set 1. At moment no other options available + public static int ToolModeSelector_HandlerMode = 1; //set 1. At moment no other options available public static int GadgetFirstUse = 0; @@ -70,10 +69,10 @@ public enum ControlMode public static int touchControlMode = 1; //1=buttons, 2, 3 public static float TAvisibility = 1; - public static bool MouseKeepingInWindow=true; + public static bool MouseKeepingInWindow = true; //public static List<Tuple<int, Texture2D>> CursorTexture_List_01 = new List<Tuple<int, Texture2D>>(); - public static List<(int, Texture2D)> CursorTexture_List_01 = new List<(int, Texture2D)>{ }; + public static List<(int, Texture2D)> CursorTexture_List_01 = new List<(int, Texture2D)> { }; @@ -83,7 +82,7 @@ public enum ControlMode public static Color colSelect = new Color(133f / 255f, 125f / 255f, 107f / 255f, 1f); public static Color colClear = new Color(133f / 255f, 125f / 255f, 107f / 255f, 0f); - public static double colliderScale_all =1; + public static double colliderScale_all = 1; public static double colliderScale_all_SliderMax = 5; //Faktor public static double colliderScale_all_default = 1; public static double colliderScale_PC_default = 1; @@ -109,7 +108,7 @@ public class NetworkJSON public float TAvisibility; public bool autoOSrecognition; public bool autoSettingsAdaption; - public string Opsys; + public string Opsys; public int FrameITUIversion; public int InputManagerVersion; public double colliderScale_all; @@ -143,28 +142,28 @@ public class NetworkJSONonlyString //------------------------------------------------------------------------------------------------------ //INPUTMANAGER KEY BINDINGS LIST for display Purpose public static string InputManager_KeyBinding_Horizontal_01 = "left"; - public static string InputManager_KeyBinding_Horizontal_1 = "right"; - public static string InputManager_KeyBinding_Horizontal_02 = "a"; - public static string InputManager_KeyBinding_Horizontal_2= "d"; - public static string InputManager_KeyBinding_Vertical_01 = "down"; - public static string InputManager_KeyBinding_Vertical_1 = "up"; - public static string InputManager_KeyBinding_Vertical_02 = "s"; - public static string InputManager_KeyBinding_Vertical_2 = "w"; - public static string InputManager_KeyBinding_Running_1 = "left shift"; - public static string InputManager_KeyBinding_ToolmMenue_1 = "e"; - public static string InputManager_KeyBinding_MathMenue_1 = "tab"; - public static string InputManager_KeyBinding_Jump_1 = "space"; - public static string InputManager_KeyBinding_Cancel_1 = "escape"; - public static string InputManager_KeyBinding_modifier = "m"; - public static string InputManager_KeyBinding_mod_load_1 = "l"; - public static string InputManager_KeyBinding_mod_save_1 = "s"; - public static string InputManager_KeyBinding_mod_reset_1 = "backspace"; - public static string InputManager_KeyBinding_mod_redo_1 = "r"; - public static string InputManager_KeyBinding_mod_undo_1 = "u"; - public static string InputManager_KeyBinding_Fire1_1 = "Mouse 0"; - public static string InputManager_KeyBinding_Fire2_1 = "Mouse 1"; - public static string InputManager_KeyBinding_talk_1 = "c"; - public static string InputManager_KeyBinding_MouseScrollWheel_1 = "MouseScrollWheel"; + public static string InputManager_KeyBinding_Horizontal_1 = "right"; + public static string InputManager_KeyBinding_Horizontal_02 = "a"; + public static string InputManager_KeyBinding_Horizontal_2 = "d"; + public static string InputManager_KeyBinding_Vertical_01 = "down"; + public static string InputManager_KeyBinding_Vertical_1 = "up"; + public static string InputManager_KeyBinding_Vertical_02 = "s"; + public static string InputManager_KeyBinding_Vertical_2 = "w"; + public static string InputManager_KeyBinding_Running_1 = "left shift"; + public static string InputManager_KeyBinding_ToolmMenue_1 = "e"; + public static string InputManager_KeyBinding_MathMenue_1 = "tab"; + public static string InputManager_KeyBinding_Jump_1 = "space"; + public static string InputManager_KeyBinding_Cancel_1 = "escape"; + public static string InputManager_KeyBinding_modifier = "m"; + public static string InputManager_KeyBinding_mod_load_1 = "l"; + public static string InputManager_KeyBinding_mod_save_1 = "s"; + public static string InputManager_KeyBinding_mod_reset_1 = "backspace"; + public static string InputManager_KeyBinding_mod_redo_1 = "r"; + public static string InputManager_KeyBinding_mod_undo_1 = "u"; + public static string InputManager_KeyBinding_Fire1_1 = "Mouse 0"; + public static string InputManager_KeyBinding_Fire2_1 = "Mouse 1"; + public static string InputManager_KeyBinding_talk_1 = "c"; + public static string InputManager_KeyBinding_MouseScrollWheel_1 = "MouseScrollWheel"; // 11=TouchUI_onoff // TODO: setter/getter event? diff --git a/Assets/Scripts/Utility/Extensions/ArrayExtensions.cs b/Assets/Scripts/Utility/Extensions/ArrayExtensions.cs index 2493c8b95629fc339f68f242b37cb4a09d35a5a2..9b129a51b2ab893d03adcdb9ef90445ff55f6fcd 100644 --- a/Assets/Scripts/Utility/Extensions/ArrayExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/ArrayExtensions.cs @@ -19,7 +19,7 @@ public static T[] ShallowCloneAppendNullChecked<T>(this T[] source, T[] append, if (append == null) return source.Clone() as T[]; - + return ShallowCloneAppend<T>(source, append, front); } } diff --git a/Assets/Scripts/Utility/Extensions/GameObjectExtensions.cs b/Assets/Scripts/Utility/Extensions/GameObjectExtensions.cs index 015d5919d9d52764e459266b3f740c382bcdd667..d1e8d03b7c5d987cde6f6a599e8a8d63a308f193 100644 --- a/Assets/Scripts/Utility/Extensions/GameObjectExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/GameObjectExtensions.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -9,7 +8,8 @@ public static bool IsRoot(this GameObject root) => root.transform.parent == null; public static void SetActiveByTagRecursive(this GameObject root, string tag, bool enable) - => root.ForAllChildren(child => { + => root.ForAllChildren(child => + { if (child.CompareTag(tag)) child.SetActive(enable); else @@ -30,7 +30,7 @@ public static void ForAllChildren(this GameObject root, Action<GameObject> func_ public static List<GameObject> GetDirectChildren(this GameObject root) { - List<GameObject> ret = new (capacity: root.transform.childCount); + List<GameObject> ret = new(capacity: root.transform.childCount); foreach (Transform transform in root.transform) ret.Add(transform.gameObject); diff --git a/Assets/Scripts/Utility/Extensions/IEnumerableExtensions.cs b/Assets/Scripts/Utility/Extensions/IEnumerableExtensions.cs index 568a3dc1494eb2014175cc294b2e8bd6014651eb..1ac7d7dad5ec54126e7fa3d5c372c14df516323d 100644 --- a/Assets/Scripts/Utility/Extensions/IEnumerableExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/IEnumerableExtensions.cs @@ -1,6 +1,5 @@ -using System.Collections.Generic; using System; -using System.Linq; +using System.Collections.Generic; public static class IEnumerableExtensions { diff --git a/Assets/Scripts/Utility/Extensions/IEnumeratorExtensions.cs b/Assets/Scripts/Utility/Extensions/IEnumeratorExtensions.cs index 6d8c37ce283010ca9e975dee250ec3515243bfd0..b303b36cff587ccfb56d301252eea5ba3dbee9f4 100644 --- a/Assets/Scripts/Utility/Extensions/IEnumeratorExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/IEnumeratorExtensions.cs @@ -7,14 +7,14 @@ public static class IEnumeratorExtensions public static void FastForward(this IEnumerator that) { while (that.MoveNext()) - if(that.Current is IEnumerator next) + if (that.Current is IEnumerator next) next.FastForward(); } public static IEnumerator ProxyHandle(this IEnumerator that) { while (that.MoveNext()) - if(that.Current is IEnumerator next) + if (that.Current is IEnumerator next) yield return next.ProxyHandle(); else yield return null; @@ -29,7 +29,7 @@ public static IEnumerator YieldBreak() public static IEnumerator<float> ClockForSeconds(float time) { - if (time < 0) + if (time < 0) yield break; for (float current_time = 0; time > current_time; current_time += Time.deltaTime) diff --git a/Assets/Scripts/Utility/Extensions/LayerMaskExtensions.cs b/Assets/Scripts/Utility/Extensions/LayerMaskExtensions.cs index 38b68e51a0e6e837701bf0ad1299a5b17db76428..25de57fac289f0bf130df87f93b2fd55327d5b1d 100644 --- a/Assets/Scripts/Utility/Extensions/LayerMaskExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/LayerMaskExtensions.cs @@ -1,5 +1,5 @@ -using System.Linq; using System.Collections.Generic; +using System.Linq; using UnityEngine; public static class LayerMaskExtensions diff --git a/Assets/Scripts/Utility/Extensions/MathfExtensions.cs b/Assets/Scripts/Utility/Extensions/MathfExtensions.cs index 198f0565f091b0e63e52e9a53e721c320d259c61..da34b248cd8240fc0d9516ae673b20bd10b72feb 100644 --- a/Assets/Scripts/Utility/Extensions/MathfExtensions.cs +++ b/Assets/Scripts/Utility/Extensions/MathfExtensions.cs @@ -11,7 +11,7 @@ public static class MathfExtensions /// <param name="precission">precission to use, default: <see cref="Math3d.vectorPrecission"/></param> /// <returns>true if two floats are approximately equal with given precission</returns> /// <seealso cref="Mathf.Approximately"/> - public static bool IsApproximatelyEqual(this float floatA, float floatB, float precission = (float) Math3d.vectorPrecission) + public static bool IsApproximatelyEqual(this float floatA, float floatB, float precission = (float)Math3d.vectorPrecission) => Mathf.Abs(floatA - floatB) < precission; /// <summary> @@ -37,7 +37,7 @@ public static IEnumerator<float> LerpInTime(this float start, float end, float t /// </summary> /// <param name="angleInDegree">The Angle in Degrees</param> /// <returns>The Angle in Radians</returns> - public static float ToRadians(this float angleInDegree) + public static float ToRadians(this float angleInDegree) => angleInDegree * 2 * Mathf.PI / 360f; /// <summary> @@ -45,6 +45,6 @@ public static float ToRadians(this float angleInDegree) /// </summary> /// <param name="angleInRadians">The Angle in Radians</param> /// <returns>The Angle in Degrees</returns> - public static float ToDegrees(this float angleInRadians) + public static float ToDegrees(this float angleInRadians) => angleInRadians / 2 / Mathf.PI * 360f; } diff --git a/Assets/Scripts/Utility/IJSONsavable.cs b/Assets/Scripts/Utility/IJSONsavable.cs index af8b8b78b6a4b2b5ec02fe429b09f1055b0614ab..bb542405ed6024bce0bbb2815f094a658ef514ae 100644 --- a/Assets/Scripts/Utility/IJSONsavable.cs +++ b/Assets/Scripts/Utility/IJSONsavable.cs @@ -1,9 +1,9 @@ +using Newtonsoft.Json; +using System; using System.Collections.Generic; -using System.Reflection; -using System.Linq; using System.IO; -using System; -using Newtonsoft.Json; +using System.Linq; +using System.Reflection; using UnityEngine; using static CommunicationEvents; diff --git a/Assets/Scripts/Utility/Math3d.cs b/Assets/Scripts/Utility/Math3d.cs index 220fa8ceb39f80ee00ffd0e1a981ae90e59acdae..50ecae95872377247f39d5f3177f29930b16fb8b 100644 --- a/Assets/Scripts/Utility/Math3d.cs +++ b/Assets/Scripts/Utility/Math3d.cs @@ -543,7 +543,7 @@ public static bool IsPointApproximatelyOnLine(Vector3 linePoint, Vector3 lineVec double t = Math.Abs(Vector3.Dot(linePointToPoint.normalized, lineVec)); // expected to be ~1 - return 1-precission < t; + return 1 - precission < t; } //This function returns true if two Vector3s are approximately parallel @@ -551,8 +551,8 @@ public static bool IsApproximatelyParallel(Vector3 vectorA, Vector3 vectorB, dou { //SqrMagnitude(Abs(vectorA) - Abs(vectorB)) < precission return Math.Pow(Math.Abs(vectorA.x) - Math.Abs(vectorB.x), 2) - + Math.Pow(Math.Abs(vectorA.y) - Math.Abs(vectorB.y), 2) - + Math.Pow(Math.Abs(vectorA.z) - Math.Abs(vectorB.z), 2) + + Math.Pow(Math.Abs(vectorA.y) - Math.Abs(vectorB.y), 2) + + Math.Pow(Math.Abs(vectorA.z) - Math.Abs(vectorB.z), 2) < precission; }