From 4789d1f5b5fd8d4406450a18e1c037bf341f72c1 Mon Sep 17 00:00:00 2001 From: MaZiFAU <63099053+MaZiFAU@users.noreply.github.com> Date: Tue, 7 Nov 2023 23:05:23 +0100 Subject: [PATCH] Auto Code Cleane-Up II --- Assets/Editor/LaserPointer.cs | 7 +- Assets/Editor/ShowSize.cs | 4 +- .../Prefabs/Rainmaker/RainCollision.cs | 2 +- .../1.3.0/Rebinding UI/RebindActionUI.cs | 4 +- .../UI vs. Game Input/UIvsGameInputHandler.cs | 68 +++--- .../Gadgets/DataContainerGadgetCollection.cs | 10 +- .../Gadgets/DataContainerGadgetInit.cs | 2 - Assets/Scripts/CheckServer.cs | 18 +- Assets/Scripts/CheckServerPush.cs | 2 - Assets/Scripts/GenerateDemoFiles.cs | 10 +- .../Character_Animations/CharacterDialog.cs | 42 ++-- .../TaskCharakterAnimation.cs | 38 +-- .../InteractionEngine/CommunicationEvents.cs | 22 +- .../FactHandling/FactAdder.cs | 16 +- .../FactHandling/FactComparer.cs | 6 +- .../FactHandling/FactRecorder.cs | 8 +- .../FactHandling/FactWrapper/FactObject.cs | 6 +- .../FactHandling/FactWrapper/FactObject3D.cs | 4 +- .../FactHandling/FactWrapper/FactObjectUI.cs | 7 +- .../FactHandling/FactWrapper/FactWrapper.cs | 4 +- .../FactWrapper/RenderedScrollFact.cs | 6 +- .../FactHandling/Facts/AbstractLineFact.cs | 2 +- .../FactHandling/Facts/CircleFact.cs | 8 +- .../FactHandling/Facts/Fact.cs | 12 +- .../FactHandling/Facts/FunctionFact.cs | 14 +- .../FactHandling/Facts/MMTTypes.cs | 12 +- .../FactHandling/Facts/UnsortedFact.cs | 6 +- .../FactHandling/Facts/VolumeFacts.cs | 6 +- .../FactHandling/SolutionRecorder.cs | 6 +- .../ForestElementsManager.cs | 2 - .../Gadgets/EqualCircleGadget.cs | 2 +- .../Gadgets/GadgetBehaviour.cs | 11 +- .../InteractionEngine/Gadgets/LotTool.cs | 13 +- .../InteractionEngine/Gadgets/Remover.cs | 7 +- .../InteractionEngine/TBD/Interactable.cs | 5 +- .../Scripts/InteractionEngine/WorldCursor.cs | 6 +- Assets/Scripts/InventoryStuff/DisplayFacts.cs | 12 +- .../Scripts/InventoryStuff/ScrollDetails.cs | 10 +- .../InventoryStuff/ToggleFactscreen.cs | 2 - .../InventoryStuff/ToggleRotateImage.cs | 5 +- Assets/Scripts/Loading/Loader.cs | 2 +- .../Loading/LoadingScreenPercentage.cs | 2 - Assets/Scripts/Loading/Stage.cs | 10 +- .../Scripts/Loading/StreamingAssetLoader.cs | 223 +++++++++++------- .../CommunicationProtocoll/Endpoints.cs | 2 - .../CommunicationProtocoll/MMTConstants.cs | 3 +- .../SOMDocToLambdaExpression.cs | 10 +- .../CommunicationProtocoll/SOMDocs.cs | 10 +- .../CommunicationProtocoll/TupleFactory.cs | 6 +- .../MeshGenerator/BoundingPositioning.cs | 4 +- .../Scripts/MeshGenerator/CircleGenerator.cs | 4 +- .../MeshGenerator/CircleSegmentGenerator.cs | 10 +- Assets/Scripts/MeshGenerator/ConeGenerator.cs | 2 +- .../Scripts/MeshGenerator/ShapeGenerator.cs | 4 +- .../Scripts/MeshGenerator/TorusGenerator.cs | 2 +- Assets/Scripts/SoundManager.cs | 4 +- Assets/Scripts/StageBehaviour.cs | 4 +- Assets/Scripts/StageStatic.cs | 6 +- Assets/Scripts/StartServer.cs | 16 +- Assets/Scripts/UI/CamControl_1.cs | 10 +- .../Scripts/FirstPersonController1.cs | 74 +++--- .../Scripts/MouseLook1.cs | 53 ++--- .../RigidbodyFirstPersonController1.cs | 2 +- .../Scripts/ThirdPersonCharacter1.cs | 2 +- .../Scripts/ThirdPersonMovementScript.cs | 7 +- .../Scripts/ThirdPersonMovementScript_yt.cs | 27 +-- .../Scripts/ThirdPersonUserControl1.cs | 3 +- Assets/Scripts/UI/DiscreteBarSlider.cs | 10 +- .../Scripts/UI/FactExplorer/FactExplorer.cs | 2 +- .../UI/FactExplorer/FactFavorisation.cs | 3 +- Assets/Scripts/UI/FactExplorer/UILine.cs | 24 +- Assets/Scripts/UI/HideUI.cs | 8 +- Assets/Scripts/UI/HideUI_mobile.cs | 12 +- .../UI/InGame/BackToButton_withConfChange.cs | 6 +- Assets/Scripts/UI/InGame/GameObj_OnOff.cs | 15 +- .../UI/InGame/IngameUI_OnOffButton_mobile.cs | 12 +- .../InGame/IngameUI_OnOff_TouchControlMode.cs | 19 +- .../UI/InGame/IngameUI_OnOff_mobile.cs | 22 +- .../Scripts/UI/InGame/InputUI_Ctrl_mobile.cs | 16 +- .../Scripts/UI/InGame/MainPlayerMode_Ctrl.cs | 30 +-- .../Scripts/UI/InGame/Pause_Menue_mobile.cs | 38 ++- .../UI/InGame/PointAndClick_changeCam.cs | 14 +- Assets/Scripts/UI/InGame/PopupBehavior.cs | 5 +- Assets/Scripts/UI/InGame/ScalingCollider.cs | 5 +- .../Scripts/UI/InGame/SceneStartMenue_101.cs | 34 +-- Assets/Scripts/UI/InGame/TimeStop.cs | 4 +- .../UI/InGame/ToolmodeSelector_bttn_mobile.cs | 5 - .../Scripts/UI/InGame/UI_OnOff_InputModule.cs | 24 +- Assets/Scripts/UI/InputFieldPanel.cs | 3 - .../CollapsableStage/CollapsableCategory.cs | 5 +- .../CollapsableStage/CollapsableStage.cs | 14 +- Assets/Scripts/UI/MainMenue/ListLoader.cs | 4 +- Assets/Scripts/UI/MainMenue/MenueLoader.cs | 2 +- .../UI/MainMenue/PageLoader/CreateLoader.cs | 35 +-- .../UI/MainMenue/PageLoader/EditLoader.cs | 16 +- .../UI/MainMenue/PageLoader/LocalLoader.cs | 5 - .../UI/MainMenue/PageLoader/StageLoader.cs | 5 +- Assets/Scripts/UI/MainMenue/QuitApp.cs | 21 +- Assets/Scripts/UI/MainMenue/SceneSwitcher.cs | 39 ++- .../MainMenue/ScrollListWindowInitializer.cs | 2 - .../UI/NetwMenue/BackToButton_mobile.cs | 9 - .../ControlOptionsM_Keyboard_mobile.cs | 14 +- .../ControlOptionsMenuePreview_mobile.cs | 12 +- .../NetwMenue/ControlOptionsMenue_mobile.cs | 37 ++- Assets/Scripts/UI/NetwMenue/FindIP.cs | 26 +- .../NetwMenue/GameplayOptionsMenue_mobile.cs | 27 +-- .../NetwMenue/GraphicOptionsMenue_mobile.cs | 13 +- .../UI/NetwMenue/LaunchMenue_mobile.cs | 22 +- Assets/Scripts/UI/NetwMenue/LoadingCircle.cs | 10 +- .../UI/NetwMenue/MenueControl_mobile.cs | 16 +- .../UI/NetwMenue/SaveNetwAddr_mobile.cs | 91 ++++--- .../UI/NetwMenue/SelectNetwServer_mobile.cs | 24 +- .../UI/NetwMenue/SelectedNetwServer_mobile.cs | 11 +- .../NetwMenue/SelectedNewNetwServer_mobile.cs | 21 +- .../Scripts/UI/NetwMenue/StartMenue_mobile.cs | 57 ++--- .../UI/NetwMenue/SystemOptionsMenue_mobile.cs | 20 +- .../UI/NetwMenue/WaitingForLocalMMT.cs | 5 +- .../Scripts/UI/NetwMenue/updateMouseCursor.cs | 10 +- .../Scripts/UI/NetwMenue/uploadMouseCursor.cs | 8 - .../UI/PlayerControls/AxisInputButton.cs | 11 +- .../Scripts/UI/PlayerControls/AxisTouchPad.cs | 4 +- .../CrossPlatformInputManager.cs | 2 +- .../InputSystemPackage/RebindActionUI.cs | 4 +- .../dm/ControlsRemapping.cs | 11 +- .../dm/InputActionDisplay.cs | 6 +- .../InputSystemPackage/yt_RebindingDisplay.cs | 102 ++++---- Assets/Scripts/UI/PlayerControls/TestInput.cs | 17 +- Assets/Scripts/UI/Pointers/cursor_script1.cs | 2 - Assets/Scripts/UI/UIToolBox.cs | 1 - Assets/Scripts/UI/UIconfig.cs | 61 +++-- .../Utility/Extensions/ArrayExtensions.cs | 2 +- .../Extensions/GameObjectExtensions.cs | 6 +- .../Extensions/IEnumerableExtensions.cs | 3 +- .../Extensions/IEnumeratorExtensions.cs | 6 +- .../Utility/Extensions/LayerMaskExtensions.cs | 2 +- .../Utility/Extensions/MathfExtensions.cs | 6 +- Assets/Scripts/Utility/IJSONsavable.cs | 8 +- Assets/Scripts/Utility/Math3d.cs | 6 +- 138 files changed, 923 insertions(+), 1158 deletions(-) diff --git a/Assets/Editor/LaserPointer.cs b/Assets/Editor/LaserPointer.cs index b174fa8b..c326c811 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 71b5db25..64e83f96 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 f91bcd14..7b7652a8 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 a325a0ae..a17584e5 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 386218b9..cb0a968d 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 538ef9ed..f9e32823 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 637075bc..4aa90bcf 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 443fa8d8..ecbbf3cb 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 7d52bbea..6d8c2e8e 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 480ce344..cab121e2 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 08abda0a..69e82a39 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 4012bda9..921e009e 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 97ac16e2..5cd33fba 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 e8b18cea..778b0ff9 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 4f29e9c0..2e6b2e20 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 376c0e8e..e1127c61 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 cb844473..c90f73e5 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 d30f65d0..5f3b1558 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 52163edd..7a0449d0 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 9f39c812..cec5f22c 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 7fbdda75..ea0df4fc 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 36022ae6..6d3b328a 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 bb2263f8..902763cf 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 ac3d8bc0..15828e90 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 e00a6a99..226f3b8e 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 6fcd8fc5..c3a6053e 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 bd05a3b7..29af5a54 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 07cac373..6cf53fea 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 f340a9fe..562a1bc9 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 c149aec7..805a1677 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 61abf753..07b16eab 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 4a214266..39dbb095 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 51d90a01..bbe8acbc 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 9d93ce8f..ac2b3eed 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 1be9b825..ea61ccb8 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 9ee2ac56..2cfbb31c 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 fcff0fce..9070aa63 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 6c570edb..81755de9 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 adc37814..d9dbde3d 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 3c893c10..1fb0f8cc 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 840e7d64..e4c0c2aa 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 bee09c9e..241dc386 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 da0090ba..ba06db5f 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 209ba364..0d4e7f65 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 0b8ee4d6..67b538ee 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 0a95014a..de04d96a 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 e919909e..7cd2a724 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 9381af65..18201bde 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 a36f9e49..69944308 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 60cfae43..0eb8e45e 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 5f8e3b70..31ff35d0 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 e8e284b7..a5a97f75 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 ebc95111..d45cf547 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 5437db58..8e2d3095 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 3d8dd0c6..25ee4dc1 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 5837c5b0..37872d46 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 d9b4a6b0..def3c91f 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 bd27fad7..de00bccd 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 e15c4426..d790451a 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 9713f489..078c519d 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 d15609fb..65e76902 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 fa7c66a7..46dfda3d 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 0cee0fe0..44913090 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 66606101..7365075a 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 ba3ee1b0..0e2f9daa 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 838af6b2..98c88f97 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 09df9af6..412cc5a9 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 9e016715..7e27597b 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 d023e963..4bc98808 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 ed49702a..0cb6998b 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 b8c56f42..efa5256c 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 250f1c9e..27bde709 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 e5979574..8bf5c646 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 5a1847fe..698528aa 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 4bd9ae78..38d681be 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 0d17d761..0216bb4f 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 8fbe6400..e5d44bba 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 dd07c8d9..829af790 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 54a70988..fa944691 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 6e04bcf2..26f5c18f 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 8611eb18..00925803 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 c36c306b..e6d84290 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 0212e5de..6685ced2 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 71a9f767..9d4e6559 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 80d9d1b2..c83ce598 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 1dc0226a..dffea696 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 7a3ed35a..f561a084 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 63d22819..2332e8ec 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 c7fa7072..6efdfd10 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 3410f16e..4ee9d6a5 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 52a2c65b..413a1cbd 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 edfab7d7..c2c1449b 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 54e60417..361ba63f 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 2eb0a497..fa199710 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 d713dae0..04df547e 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 0c5619d7..8443f16a 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 2660ab07..5fa7e8c3 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 b358ac50..10121903 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 d9466e20..36d2a61d 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 a31d04d8..350af91e 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 a62ece91..56d531a1 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 b261db3e..65478c8a 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 950c28c0..072bf4b6 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 89dd33f6..62873143 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 32a8546c..fb2b211b 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 cee35dfe..b9b4454f 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 e9a4a3ce..2d5ae763 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 18abece6..d6e49958 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 cbf5c3ab..c44274d2 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 81acf894..313ff8b6 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 34759481..ed277aca 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 5d85e7f5..9bbd2705 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 d0c32fff..bc9f6291 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 d0f03af6..f5b0a04a 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 46459bd2..087f10b6 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 e4781bfe..9e2e92d9 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 f6094139..ff75261c 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 33672a1e..74c3f5dc 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 e72f8e4f..c44fd51d 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 4553f93a..93927327 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 eaf36efa..c720e2d0 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 30f2b763..e7fc9ad3 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 cf661b6d..1dc30dcb 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 c6956f92..2406ceb1 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 44746646..e57ca827 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 a2a25c96..b7983458 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 b54b9b22..1046cb00 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 7f4b3115..aa19e6d0 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 5c70eb81..caf15ae9 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 7ff3546a..cca33893 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 2493c8b9..9b129a51 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 015d5919..d1e8d03b 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 568a3dc1..1ac7d7da 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 6d8c37ce..b303b36c 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 38b68e51..25de57fa 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 198f0565..da34b248 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 af8b8b78..bb542405 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 220fa8ce..50ecae95 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; } -- GitLab