diff --git a/Assets/SEE/Utils/BoundsVisualizer.cs b/Assets/Editor/BoundsVisualizer.cs similarity index 91% rename from Assets/SEE/Utils/BoundsVisualizer.cs rename to Assets/Editor/BoundsVisualizer.cs index ad2de8af99..fb174e2980 100644 --- a/Assets/SEE/Utils/BoundsVisualizer.cs +++ b/Assets/Editor/BoundsVisualizer.cs @@ -1,7 +1,10 @@ -using SEE.GO; +#if UNITY_EDITOR + +using SEE.Extensions; +using SEE.Utils; using UnityEngine; -namespace SEE.Utils +namespace SEEEditor { /// /// Draws and updates a visual bounding box for debugging. @@ -9,6 +12,8 @@ namespace SEE.Utils /// Enables Gizmos in the Unity Editor to see the bounding box. /// /// + /// Intended to be added to the game object whose bounding box + /// is to be visualized. [ExecuteAlways] public class BoundsVisualizer : MonoBehaviour { @@ -75,9 +80,9 @@ void OnDrawGizmos() return; } - Gizmos.color = BoundsColor; - Gizmos.matrix = matrix; - Gizmos.DrawWireCube(center.Value, size.Value); + UnityEngine.Gizmos.color = BoundsColor; + UnityEngine.Gizmos.matrix = matrix; + UnityEngine.Gizmos.DrawWireCube(center.Value, size.Value); } /// @@ -113,3 +118,5 @@ public enum BoundsType } } } + +#endif \ No newline at end of file diff --git a/Assets/SEE/Utils/BoundsVisualizer.cs.meta b/Assets/Editor/BoundsVisualizer.cs.meta similarity index 100% rename from Assets/SEE/Utils/BoundsVisualizer.cs.meta rename to Assets/Editor/BoundsVisualizer.cs.meta diff --git a/Assets/Editor/ClearMap.cs b/Assets/Editor/ClearMap.cs index b62145b393..8efea734e9 100644 --- a/Assets/Editor/ClearMap.cs +++ b/Assets/Editor/ClearMap.cs @@ -1,6 +1,6 @@ #if UNITY_EDITOR -using SEE.Game; +using SEE.GraphElementRefs; using UnityEditor; namespace SEEEditor diff --git a/Assets/Editor/DumpMap.cs b/Assets/Editor/DumpMap.cs index 5e618f7787..0e0869a37b 100644 --- a/Assets/Editor/DumpMap.cs +++ b/Assets/Editor/DumpMap.cs @@ -1,6 +1,6 @@ #if UNITY_EDITOR -using SEE.Game; +using SEE.GraphElementRefs; using UnityEditor; namespace SEEEditor diff --git a/Assets/Editor/EdgeRefEditor.cs b/Assets/Editor/EdgeRefEditor.cs index 624e954a3e..147f7c0813 100644 --- a/Assets/Editor/EdgeRefEditor.cs +++ b/Assets/Editor/EdgeRefEditor.cs @@ -1,6 +1,6 @@ #if UNITY_EDITOR -using SEE.GO; +using SEE.GraphElementRefs; using UnityEditor; using UnityEngine; diff --git a/Assets/Editor/GraphElementEditor.cs b/Assets/Editor/GraphElementEditor.cs index 8e8dcd8f80..0b1366136d 100644 --- a/Assets/Editor/GraphElementEditor.cs +++ b/Assets/Editor/GraphElementEditor.cs @@ -1,7 +1,7 @@ #if UNITY_EDITOR using SEE.DataModel.DG; -using SEE.GO; +using SEE.GraphElementRefs; using UnityEditor; using UnityEngine; diff --git a/Assets/Editor/NodeRefEditor.cs b/Assets/Editor/NodeRefEditor.cs index 8b629e08f0..5f77bff9bd 100644 --- a/Assets/Editor/NodeRefEditor.cs +++ b/Assets/Editor/NodeRefEditor.cs @@ -1,6 +1,6 @@ #if UNITY_EDITOR -using SEE.GO; +using SEE.GraphElementRefs; using UnityEditor; using UnityEngine; diff --git a/Assets/Editor/PrepareCCForSEE.cs b/Assets/Editor/PrepareCCForSEE.cs index a2e58d282f..24eed9e389 100644 --- a/Assets/Editor/PrepareCCForSEE.cs +++ b/Assets/Editor/PrepareCCForSEE.cs @@ -2,7 +2,7 @@ using CrazyMinnow.SALSA; using RootMotion.FinalIK; -using SEE.GO; +using SEE.Extensions; using SEE.Net; using SEE.Utils; using SEE.Game.Avatars; diff --git a/Assets/Editor/ShowNormalVectors.cs b/Assets/Editor/ShowNormalVectors.cs index 260012479e..566a9d7d0f 100644 --- a/Assets/Editor/ShowNormalVectors.cs +++ b/Assets/Editor/ShowNormalVectors.cs @@ -1,6 +1,6 @@ #if UNITY_EDITOR -using SEE.GO; +using SEE.Extensions; using UnityEditor; using UnityEngine; diff --git a/Assets/Editor/TextGUIAndPaperResizerEditor.cs b/Assets/Editor/TextGUIAndPaperResizerEditor.cs deleted file mode 100644 index cc6900de4f..0000000000 --- a/Assets/Editor/TextGUIAndPaperResizerEditor.cs +++ /dev/null @@ -1,53 +0,0 @@ -#if UNITY_EDITOR - -using SEE.GO; -using UnityEditor; -using UnityEngine; - -namespace SEEEditor -{ - /// - /// Custom editor for TextGUIAndPaperResizer. - /// - [CustomEditor(typeof(TextGUIAndPaperResizer))] - public class TextGUIAndPaperResizerEditor : Editor - { - private TextGUIAndPaperResizer _sourceGuiAndPaperResizer; - - private SerializedProperty TheTextProp; - private SerializedProperty TheMarginProp; - private SerializedProperty TheScaleProp; - - private void OnEnable() - { - TheTextProp = serializedObject.FindProperty("text"); - TheMarginProp = serializedObject.FindProperty("Margin"); - TheScaleProp = serializedObject.FindProperty("FontScale"); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - EditorGUI.BeginChangeCheck(); - EditorGUILayout.BeginVertical(); - - EditorGUILayout.PrefixLabel(new GUIContent("Text", "left/right and top/bottom")); // label for text area - TheTextProp.stringValue = EditorGUILayout.TextArea(TheTextProp.stringValue, GUILayout.MaxHeight(75)); - TheMarginProp.vector2Value = EditorGUILayout.Vector2Field(new GUIContent("Margin", "left/right and top/bottom"), TheMarginProp.vector2Value); - TheScaleProp.floatValue = EditorGUILayout.FloatField(new GUIContent("Font Scale", "Scale of the font: \n1.00 = 89 chars per meter in a line,\n0.21 = 89 chars per line on a A4 paper"), TheScaleProp.floatValue); - - EditorGUILayout.EndVertical(); - if (EditorGUI.EndChangeCheck()) - { - serializedObject.ApplyModifiedProperties(); - _sourceGuiAndPaperResizer = (TextGUIAndPaperResizer)target; - _sourceGuiAndPaperResizer.OnGuiChangedHandler(); - } - - // Show default inspector property editor - //DrawDefaultInspector (); - } - } -} - -#endif diff --git a/Assets/Editor/TextGUIAndPaperResizerEditor.cs.meta b/Assets/Editor/TextGUIAndPaperResizerEditor.cs.meta deleted file mode 100644 index 486d9db481..0000000000 --- a/Assets/Editor/TextGUIAndPaperResizerEditor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6998e39421282e84ba7be067fff4a2ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Editor/UserSettingsBuildProcessor.cs b/Assets/Editor/UserSettingsBuildProcessor.cs index b5324f18db..25751dc607 100644 --- a/Assets/Editor/UserSettingsBuildProcessor.cs +++ b/Assets/Editor/UserSettingsBuildProcessor.cs @@ -1,5 +1,5 @@ using System.IO; -using SEE.User; +using SEE.UserSettings; using UnityEditor.Build; using UnityEditor.Build.Reporting; using UnityEngine; @@ -30,12 +30,12 @@ internal sealed class UserSettingsBuildProcessor : IPreprocessBuildWithReport /// public void OnPreprocessBuild(BuildReport report) { - UserSettings userSettings = UserSettings.Instance; + UserSetting userSettings = UserSetting.Instance; if (userSettings == null) { throw new BuildFailedException( - $"Cannot regenerate user settings because no {nameof(UserSettings)} component exists in the currently loaded scene." + + $"Cannot regenerate user settings because no {nameof(UserSetting)} component exists in the currently loaded scene." + "Open the SEEStart scene before creating a player build."); } diff --git a/Assets/Editor/WorldTransform.cs b/Assets/Editor/WorldTransform.cs index 4fe1b856fc..e0b60805b3 100644 --- a/Assets/Editor/WorldTransform.cs +++ b/Assets/Editor/WorldTransform.cs @@ -1,6 +1,6 @@ #if UNITY_EDITOR -using SEE.GO; +using SEE.Extensions; using UnityEditor; using UnityEngine; diff --git a/Assets/Plugins/ZFBrowser/Scripts/BrowserInput.cs b/Assets/Plugins/ZFBrowser/Scripts/BrowserInput.cs index 63ae9c6225..e0aa71dce2 100644 --- a/Assets/Plugins/ZFBrowser/Scripts/BrowserInput.cs +++ b/Assets/Plugins/ZFBrowser/Scripts/BrowserInput.cs @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc0644730d9a00ca8ede04cda7289d7b6ae13a14fe1ec8fc464c90421414bc63 -size 10918 +oid sha256:f8332f64aa2c24f73363edcd5cc54a3e15994ed47aa3ab1c881707ac7ea1503d +size 10929 diff --git a/Assets/SEE/GameObjects.meta b/Assets/SEE/ActionHistory.meta similarity index 77% rename from Assets/SEE/GameObjects.meta rename to Assets/SEE/ActionHistory.meta index 51d423d864..4791bffa97 100644 --- a/Assets/SEE/GameObjects.meta +++ b/Assets/SEE/ActionHistory.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 59dfebccc4563e043b00aa8e934b39db +guid: f233c1da6d5c6d641bdea282278101a9 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/SEE/Utils/History/ActionHistory.cs b/Assets/SEE/ActionHistory/ActionHistory.cs similarity index 99% rename from Assets/SEE/Utils/History/ActionHistory.cs rename to Assets/SEE/ActionHistory/ActionHistory.cs index ab26bd7f7b..5a5564f742 100644 --- a/Assets/SEE/Utils/History/ActionHistory.cs +++ b/Assets/SEE/ActionHistory/ActionHistory.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using SEE.Controls.ReversibleActions; using SEE.Net.Actions; using SEE.Tools.OpenTelemetry; -namespace SEE.Utils.History +namespace SEE.ReversibleActionHistory { /// /// Thrown in case an Undo is called although there is no action diff --git a/Assets/SEE/Utils/History/ActionHistory.cs.meta b/Assets/SEE/ActionHistory/ActionHistory.cs.meta similarity index 100% rename from Assets/SEE/Utils/History/ActionHistory.cs.meta rename to Assets/SEE/ActionHistory/ActionHistory.cs.meta diff --git a/Assets/SEE/Controls/Actions/GlobalActionHistory.cs b/Assets/SEE/ActionHistory/GlobalActionHistory.cs similarity index 96% rename from Assets/SEE/Controls/Actions/GlobalActionHistory.cs rename to Assets/SEE/ActionHistory/GlobalActionHistory.cs index 8cb03acf62..fbd3885fc0 100644 --- a/Assets/SEE/Controls/Actions/GlobalActionHistory.cs +++ b/Assets/SEE/ActionHistory/GlobalActionHistory.cs @@ -1,7 +1,7 @@ -using SEE.Utils.History; -using static SEE.Utils.History.ActionHistory; +using SEE.Controls.ReversibleActions; +using static SEE.ReversibleActionHistory.ActionHistory; -namespace SEE.Controls.Actions +namespace SEE.ReversibleActionHistory { /// /// This class manages the history of actions triggered by the player and that diff --git a/Assets/SEE/Controls/Actions/GlobalActionHistory.cs.meta b/Assets/SEE/ActionHistory/GlobalActionHistory.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/GlobalActionHistory.cs.meta rename to Assets/SEE/ActionHistory/GlobalActionHistory.cs.meta diff --git a/Assets/SEE/Audio/Audio.cs b/Assets/SEE/Audio/Audio.cs new file mode 100644 index 0000000000..0554ec72cd --- /dev/null +++ b/Assets/SEE/Audio/Audio.cs @@ -0,0 +1,6 @@ +/// +/// Plays sounds for events during the game (e.g., hovering a game node). +/// +namespace SEE.Audio +{ +} diff --git a/Assets/SEE/Audio/Audio.cs.meta b/Assets/SEE/Audio/Audio.cs.meta new file mode 100644 index 0000000000..83c5f6d285 --- /dev/null +++ b/Assets/SEE/Audio/Audio.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1ec3249938db2c2479fb5d1488a32167 \ No newline at end of file diff --git a/Assets/SEE/Audio/AudioGameObject.cs b/Assets/SEE/Audio/AudioGameObject.cs index d0b1730841..417c99f8f7 100644 --- a/Assets/SEE/Audio/AudioGameObject.cs +++ b/Assets/SEE/Audio/AudioGameObject.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using System.Collections.Generic; using SEE.Utils; using UnityEngine; @@ -6,8 +6,7 @@ namespace SEE.Audio { /// - /// An Object that contains a SEE game object - /// and an audio queue and makes the sounds originate + /// An object that contains a SEE game object and an audio queue and makes the sounds originate /// from the game object in 3D space. /// public class AudioGameObject diff --git a/Assets/SEE/Audio/AudioManagerImpl.cs b/Assets/SEE/Audio/AudioManagerImpl.cs index 75461f4971..570ef4e611 100644 --- a/Assets/SEE/Audio/AudioManagerImpl.cs +++ b/Assets/SEE/Audio/AudioManagerImpl.cs @@ -1,5 +1,5 @@ +using SEE.UserSettings; using SEE.Net.Actions.GraphElement; -using SEE.User; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -10,7 +10,7 @@ namespace SEE.Audio { /// - /// Implements the IAudioManager interface. + /// Implements the interface. /// public class AudioManagerImpl : MonoBehaviour, IAudioManager { @@ -277,10 +277,10 @@ private void TriggerVolumeChanges() /// public float MusicVolume { - get => UserSettings.Instance.Audio.MusicVolume; + get => UserSetting.Instance.Audio.MusicVolume; set { - UserSettings.Instance.Audio.MusicVolume = Mathf.Clamp(value, 0f, 1f); + UserSetting.Instance.Audio.MusicVolume = Mathf.Clamp(value, 0f, 1f); TriggerVolumeChanges(); } } @@ -288,10 +288,10 @@ public float MusicVolume /// public float SoundEffectsVolume { - get => UserSettings.Instance.Audio.SoundEffectsVolume; + get => UserSetting.Instance.Audio.SoundEffectsVolume; set { - UserSettings.Instance.Audio.SoundEffectsVolume = Mathf.Clamp(value, 0f, 1f); + UserSetting.Instance.Audio.SoundEffectsVolume = Mathf.Clamp(value, 0f, 1f); TriggerVolumeChanges(); } } @@ -299,10 +299,10 @@ public float SoundEffectsVolume /// public bool MusicMuted { - get => UserSettings.Instance.Audio.MusicMuted; + get => UserSetting.Instance.Audio.MusicMuted; set { - UserSettings.Instance.Audio.MusicMuted = value; + UserSetting.Instance.Audio.MusicMuted = value; TriggerVolumeChanges(); PauseMusic(); } @@ -311,10 +311,10 @@ public bool MusicMuted /// public bool SoundEffectsMuted { - get => UserSettings.Instance.Audio.SoundEffectsMuted; + get => UserSetting.Instance.Audio.SoundEffectsMuted; set { - UserSettings.Instance.Audio.SoundEffectsMuted = value; + UserSetting.Instance.Audio.SoundEffectsMuted = value; TriggerVolumeChanges(); } } @@ -322,10 +322,10 @@ public bool SoundEffectsMuted /// public bool RemoteSoundEffectsMuted { - get => UserSettings.Instance.Audio.RemoteSoundEffectsMuted; + get => UserSetting.Instance.Audio.RemoteSoundEffectsMuted; set { - UserSettings.Instance.Audio.RemoteSoundEffectsMuted = value; + UserSetting.Instance.Audio.RemoteSoundEffectsMuted = value; TriggerVolumeChanges(); } } @@ -438,7 +438,7 @@ private void QueueSoundEffect(SoundEffect soundEffect, GameObject sourceObject, AudioGameObject controlObject = soundEffectGameObjects.FirstOrDefault(x => x.AttachedObject == sourceObject); if (controlObject == null) { - controlObject = new AudioGameObject(sourceObject, SoundEffectsVolume, UserSettings.Instance.Audio.SoundEffectsMuted); + controlObject = new AudioGameObject(sourceObject, SoundEffectsVolume, UserSetting.Instance.Audio.SoundEffectsMuted); soundEffectGameObjects.Add(controlObject); } controlObject.EnqueueSoundEffect(GetAudioClipFromSoundEffectName(soundEffect)); diff --git a/Assets/SEE/CameraPaths/CameraPath.cs b/Assets/SEE/CameraPaths/CameraPath.cs index 34ba9a5138..1736c6e164 100644 --- a/Assets/SEE/CameraPaths/CameraPath.cs +++ b/Assets/SEE/CameraPaths/CameraPath.cs @@ -1,5 +1,5 @@ using SEE.Game; -using SEE.GO.Factories; +using SEE.Factories; using System.Collections; using System.Collections.Generic; using System.Globalization; diff --git a/Assets/SEE/CameraPaths/CameraRecorder.cs b/Assets/SEE/CameraPaths/CameraRecorder.cs index 160d4779bb..83942996a8 100644 --- a/Assets/SEE/CameraPaths/CameraRecorder.cs +++ b/Assets/SEE/CameraPaths/CameraRecorder.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.Utils; using System.Collections.Generic; using System.IO; diff --git a/Assets/SEE/CameraPaths/PathReplay.cs b/Assets/SEE/CameraPaths/PathReplay.cs index fe92bbd7d7..aa56c2507b 100644 --- a/Assets/SEE/CameraPaths/PathReplay.cs +++ b/Assets/SEE/CameraPaths/PathReplay.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.Utils; using System; using System.Collections.Generic; diff --git a/Assets/SEE/GameObjects/Menu.meta b/Assets/SEE/Cities.meta similarity index 77% rename from Assets/SEE/GameObjects/Menu.meta rename to Assets/SEE/Cities.meta index e12d726b20..fcd7da2889 100644 --- a/Assets/SEE/GameObjects/Menu.meta +++ b/Assets/SEE/Cities.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1521264504027d04c88bdec42ea65e3b +guid: ee13fa859a230314eba4eaebc2758601 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/SEE/Cities/Cities.cs b/Assets/SEE/Cities/Cities.cs new file mode 100644 index 0000000000..7bc28887ad --- /dev/null +++ b/Assets/SEE/Cities/Cities.cs @@ -0,0 +1,13 @@ +/// +/// Consists of components related to code-city game objects. +/// A code-city is a Unity GameObject holding an instance of a subclass of +/// . It is the child of a table +/// game object. Game nodes and game edges are placed underneath the code-city +/// object as children. Generally, there is only one root game node and all +/// other game nodes are transitive descendants of the root game node. The +/// game edges are likewise children of the root game node, but they do not form +/// a hierarchy. +/// +namespace SEE.Cities +{ +} diff --git a/Assets/SEE/Cities/Cities.cs.meta b/Assets/SEE/Cities/Cities.cs.meta new file mode 100644 index 0000000000..5bc2a16452 --- /dev/null +++ b/Assets/SEE/Cities/Cities.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f675b16db8d6b454cb6a8d5997539550 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/CitiesHolder.cs b/Assets/SEE/Cities/CitiesHolder.cs similarity index 86% rename from Assets/SEE/GameObjects/CitiesHolder.cs rename to Assets/SEE/Cities/CitiesHolder.cs index 62ab05f20c..9d5770a04a 100644 --- a/Assets/SEE/GameObjects/CitiesHolder.cs +++ b/Assets/SEE/Cities/CitiesHolder.cs @@ -2,12 +2,13 @@ using System.Collections.Generic; using UnityEngine; -namespace SEE.GameObjects +namespace SEE.Cities { /// - /// This component provides a map that assigns each key (tableID) to the respective game object, - /// on which an component can be attached. + /// This component provides a map that assigns each tableID (key) to the respective + /// code-city game object which an component can be attached to. /// + /// This component is part of the DesktopPlayer.prefab. public class CitiesHolder : MonoBehaviour { /// @@ -32,7 +33,8 @@ public GameObject Find(string tableID) try { return Cities[tableID]; - } catch (KeyNotFoundException) + } + catch (KeyNotFoundException) { return null; } diff --git a/Assets/SEE/GameObjects/CitiesHolder.cs.meta b/Assets/SEE/Cities/CitiesHolder.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/CitiesHolder.cs.meta rename to Assets/SEE/Cities/CitiesHolder.cs.meta diff --git a/Assets/SEE/GameObjects/CitySelectionManager.cs b/Assets/SEE/Cities/CitySelectionManager.cs similarity index 92% rename from Assets/SEE/GameObjects/CitySelectionManager.cs rename to Assets/SEE/Cities/CitySelectionManager.cs index 32ea2086e9..34c4f51e9a 100644 --- a/Assets/SEE/GameObjects/CitySelectionManager.cs +++ b/Assets/SEE/Cities/CitySelectionManager.cs @@ -1,19 +1,24 @@ using Cysharp.Threading.Tasks; -using SEE.Controls; using SEE.Game; using SEE.Game.City; -using SEE.GO; +using SEE.Gizmos; +using SEE.Extensions; using SEE.Net.Actions.City; using SEE.UI.Notification; using SEE.UI.PropertyDialog.CitySelection; using SEE.Utils; using UnityEngine; +using SEE.Controls.KeyActions; -namespace SEE.GameObjects +namespace SEE.Cities { /// /// Component for selecting a city to be added to the table. /// + /// This component will be attached to a code-city game object. + /// A code-city game object is a an instance + /// of a concrete subclass of is + /// attached to. It is part of the UniversalTable.prefab. public class CitySelectionManager : MonoBehaviour { /// diff --git a/Assets/SEE/GameObjects/CitySelectionManager.cs.meta b/Assets/SEE/Cities/CitySelectionManager.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/CitySelectionManager.cs.meta rename to Assets/SEE/Cities/CitySelectionManager.cs.meta diff --git a/Assets/SEE/GameObjects/Plane.cs b/Assets/SEE/Cities/Plane.cs similarity index 92% rename from Assets/SEE/GameObjects/Plane.cs rename to Assets/SEE/Cities/Plane.cs index 2f5016aca9..ab3731f271 100644 --- a/Assets/SEE/GameObjects/Plane.cs +++ b/Assets/SEE/Cities/Plane.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.GO +namespace SEE.Cities { /// /// Represents a plane on which the city objects can be placed defined as @@ -9,6 +9,10 @@ namespace SEE.GO /// (MaxX, MaxZ) denotes the right back corner /// YPosition denotes the y co-ordinate of the plane /// + /// + /// A is attached to a code-city game object holding + /// an instance of a concrete subclass of . + /// public class Plane : MonoBehaviour { /// diff --git a/Assets/SEE/GameObjects/Plane.cs.meta b/Assets/SEE/Cities/Plane.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Plane.cs.meta rename to Assets/SEE/Cities/Plane.cs.meta diff --git a/Assets/SEE/Controls/Actions.meta b/Assets/SEE/Components.meta similarity index 77% rename from Assets/SEE/Controls/Actions.meta rename to Assets/SEE/Components.meta index 63215fd290..4f495b02f2 100644 --- a/Assets/SEE/Controls/Actions.meta +++ b/Assets/SEE/Components.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1cd782d49369bf94c820888abbdecfa4 +guid: ff359eefb6891a448bd5126f335cf9b4 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/SEE/Components/Components.cs b/Assets/SEE/Components/Components.cs new file mode 100644 index 0000000000..a001bd210f --- /dev/null +++ b/Assets/SEE/Components/Components.cs @@ -0,0 +1,7 @@ +/// +/// Provides s to be attached +/// to game nodes and game edges. +/// +namespace SEE.Components +{ +} diff --git a/Assets/SEE/Components/Components.cs.meta b/Assets/SEE/Components/Components.cs.meta new file mode 100644 index 0000000000..af1393dfa4 --- /dev/null +++ b/Assets/SEE/Components/Components.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ea578600d49477d468b576acb9191cc0 \ No newline at end of file diff --git a/Assets/SEE/Components/GameEdges.meta b/Assets/SEE/Components/GameEdges.meta new file mode 100644 index 0000000000..00b67cd2c6 --- /dev/null +++ b/Assets/SEE/Components/GameEdges.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 69f65bb17b5bcf14abde152fe258b0b3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Components/GameEdges/GameEdges.cs b/Assets/SEE/Components/GameEdges/GameEdges.cs new file mode 100644 index 0000000000..4631659ed8 --- /dev/null +++ b/Assets/SEE/Components/GameEdges/GameEdges.cs @@ -0,0 +1,6 @@ +/// +/// Namespace for components to be attached to game edges. +/// +namespace SEE.Components.GameEdges +{ +} diff --git a/Assets/SEE/Components/GameEdges/GameEdges.cs.meta b/Assets/SEE/Components/GameEdges/GameEdges.cs.meta new file mode 100644 index 0000000000..b66cc66f94 --- /dev/null +++ b/Assets/SEE/Components/GameEdges/GameEdges.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1e861fbd095d9ea4ea6e587cdb64ee21 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/SEESpline.cs b/Assets/SEE/Components/GameEdges/SEESpline.cs similarity index 99% rename from Assets/SEE/GameObjects/SEESpline.cs rename to Assets/SEE/Components/GameEdges/SEESpline.cs index 4abe89a0ad..0c1894a638 100644 --- a/Assets/SEE/GameObjects/SEESpline.cs +++ b/Assets/SEE/Components/GameEdges/SEESpline.cs @@ -2,8 +2,9 @@ using SEE.Game; using SEE.Game.City; using SEE.Game.Operator; -using SEE.GO.Factories; +using SEE.Factories; using SEE.Utils; +using SEE.Extensions; using Sirenix.OdinInspector; using System; using System.Collections.Generic; @@ -11,7 +12,7 @@ using UnityEngine; using Frame = TinySpline.Frame; -namespace SEE.GO +namespace SEE.Components.GameEdges { /// /// This class serves as a bridge between TinySpline's representation of @@ -47,6 +48,8 @@ namespace SEE.GO /// needs to be applied immediately, call after /// setting one or more properties. /// + /// This component is expected to be attached to a game + /// object representing a graph edge, i.e., a game edge. public class SEESpline : SerializedMonoBehaviour { /// diff --git a/Assets/SEE/GameObjects/SEESpline.cs.meta b/Assets/SEE/Components/GameEdges/SEESpline.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/SEESpline.cs.meta rename to Assets/SEE/Components/GameEdges/SEESpline.cs.meta diff --git a/Assets/SEE/Components/GameNodes.meta b/Assets/SEE/Components/GameNodes.meta new file mode 100644 index 0000000000..6c761a89f7 --- /dev/null +++ b/Assets/SEE/Components/GameNodes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2a35d861aedb8f549a32964af8ddbe72 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/GameObjects/BranchCity.meta b/Assets/SEE/Components/GameNodes/BranchCity.meta similarity index 100% rename from Assets/SEE/GameObjects/BranchCity.meta rename to Assets/SEE/Components/GameNodes/BranchCity.meta diff --git a/Assets/SEE/GameObjects/BranchCity/AuthorEdge.cs b/Assets/SEE/Components/GameNodes/BranchCity/AuthorEdge.cs similarity index 97% rename from Assets/SEE/GameObjects/BranchCity/AuthorEdge.cs rename to Assets/SEE/Components/GameNodes/BranchCity/AuthorEdge.cs index 18a6941286..4980262c83 100644 --- a/Assets/SEE/GameObjects/BranchCity/AuthorEdge.cs +++ b/Assets/SEE/Components/GameNodes/BranchCity/AuthorEdge.cs @@ -1,10 +1,10 @@ using SEE.Game.City; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using System; using UnityEngine; -namespace SEE.GameObjects.BranchCity +namespace SEE.Components.GameNodes.BranchCity { /// /// Attribute of an author edge connecting an @@ -12,7 +12,7 @@ namespace SEE.GameObjects.BranchCity /// /// This component will be attached to connections between authors and their edited files. [RequireComponent(typeof(LineRenderer))] - public class AuthorEdge : VCSDecorator + public class AuthorEdge : VCS { /// /// Reference to the target node this edge connects to. diff --git a/Assets/SEE/GameObjects/BranchCity/AuthorEdge.cs.meta b/Assets/SEE/Components/GameNodes/BranchCity/AuthorEdge.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/BranchCity/AuthorEdge.cs.meta rename to Assets/SEE/Components/GameNodes/BranchCity/AuthorEdge.cs.meta diff --git a/Assets/SEE/GameObjects/BranchCity/AuthorRef.cs b/Assets/SEE/Components/GameNodes/BranchCity/AuthorRef.cs similarity index 97% rename from Assets/SEE/GameObjects/BranchCity/AuthorRef.cs rename to Assets/SEE/Components/GameNodes/BranchCity/AuthorRef.cs index c2cda72205..fbccbc76f0 100644 --- a/Assets/SEE/GameObjects/BranchCity/AuthorRef.cs +++ b/Assets/SEE/Components/GameNodes/BranchCity/AuthorRef.cs @@ -1,16 +1,16 @@ using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using Sirenix.Serialization; using System.Collections; using System.Collections.Generic; -namespace SEE.GameObjects.BranchCity +namespace SEE.Components.GameNodes.BranchCity { /// /// Holds the connections of a file to all its authors. /// This component will be attached to all file game nodes in a . /// - public class AuthorRef : VCSDecorator, IEnumerable + public class AuthorRef : VCS, IEnumerable { /// /// The edges to the authors of this specific file. diff --git a/Assets/SEE/GameObjects/BranchCity/AuthorRef.cs.meta b/Assets/SEE/Components/GameNodes/BranchCity/AuthorRef.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/BranchCity/AuthorRef.cs.meta rename to Assets/SEE/Components/GameNodes/BranchCity/AuthorRef.cs.meta diff --git a/Assets/SEE/GameObjects/BranchCity/AuthorSphere.cs b/Assets/SEE/Components/GameNodes/BranchCity/AuthorSphere.cs similarity index 97% rename from Assets/SEE/GameObjects/BranchCity/AuthorSphere.cs rename to Assets/SEE/Components/GameNodes/BranchCity/AuthorSphere.cs index c4d61b3c4e..af588cd5f9 100644 --- a/Assets/SEE/GameObjects/BranchCity/AuthorSphere.cs +++ b/Assets/SEE/Components/GameNodes/BranchCity/AuthorSphere.cs @@ -1,19 +1,19 @@ -using SEE.Controls.Actions; using SEE.Game; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.GraphProviders.VCS; using System.Collections.Generic; using TMPro; using UnityEngine; +using SEE.Components.Objects; -namespace SEE.GameObjects.BranchCity +namespace SEE.Components.GameNodes.BranchCity { /// /// Attributes of an author sphere. /// /// This component will be attached to all author spheres. - public class AuthorSphere : VCSDecorator + public class AuthorSphere : VCS { /// /// The identity of the author. diff --git a/Assets/SEE/GameObjects/BranchCity/AuthorSphere.cs.meta b/Assets/SEE/Components/GameNodes/BranchCity/AuthorSphere.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/BranchCity/AuthorSphere.cs.meta rename to Assets/SEE/Components/GameNodes/BranchCity/AuthorSphere.cs.meta diff --git a/Assets/SEE/Components/GameNodes/BranchCity/BranchCity.cs b/Assets/SEE/Components/GameNodes/BranchCity/BranchCity.cs new file mode 100644 index 0000000000..98f045c347 --- /dev/null +++ b/Assets/SEE/Components/GameNodes/BranchCity/BranchCity.cs @@ -0,0 +1,7 @@ +/// +/// Contains components for game nodes and edges used for cities +/// representing VCS data. +/// +namespace SEE.Components.GameNodes.BranchCity +{ +} diff --git a/Assets/SEE/Components/GameNodes/BranchCity/BranchCity.cs.meta b/Assets/SEE/Components/GameNodes/BranchCity/BranchCity.cs.meta new file mode 100644 index 0000000000..1df4a9a533 --- /dev/null +++ b/Assets/SEE/Components/GameNodes/BranchCity/BranchCity.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 138fa35540c9637499d0badd6b900988 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/BranchCity/VCSDecorator.cs b/Assets/SEE/Components/GameNodes/BranchCity/VCS.cs similarity index 88% rename from Assets/SEE/GameObjects/BranchCity/VCSDecorator.cs rename to Assets/SEE/Components/GameNodes/BranchCity/VCS.cs index c8009199e7..07dba214ea 100644 --- a/Assets/SEE/GameObjects/BranchCity/VCSDecorator.cs +++ b/Assets/SEE/Components/GameNodes/BranchCity/VCS.cs @@ -1,14 +1,14 @@ -using SEE.GO; +using SEE.Extensions; using Sirenix.OdinInspector; -namespace SEE.GameObjects.BranchCity +namespace SEE.Components.GameNodes.BranchCity { /// /// Abstract super class of game node and edge decorators in the /// context of a . Provides /// a cached access to the containing city. /// - public abstract class VCSDecorator : SerializedMonoBehaviour + public abstract class VCS : SerializedMonoBehaviour { /// /// Backing field for . diff --git a/Assets/SEE/Components/GameNodes/BranchCity/VCS.cs.meta b/Assets/SEE/Components/GameNodes/BranchCity/VCS.cs.meta new file mode 100644 index 0000000000..37c61efd60 --- /dev/null +++ b/Assets/SEE/Components/GameNodes/BranchCity/VCS.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 126a23176bff2d04c84d7a862a4fc798 \ No newline at end of file diff --git a/Assets/SEE/Components/GameNodes/GameNodes.cs b/Assets/SEE/Components/GameNodes/GameNodes.cs new file mode 100644 index 0000000000..f052e2afc9 --- /dev/null +++ b/Assets/SEE/Components/GameNodes/GameNodes.cs @@ -0,0 +1,6 @@ +/// +/// Namespace for components to be attached to game nodes. +/// +namespace SEE.Components.GameNodes +{ +} diff --git a/Assets/SEE/Components/GameNodes/GameNodes.cs.meta b/Assets/SEE/Components/GameNodes/GameNodes.cs.meta new file mode 100644 index 0000000000..0b38337ffd --- /dev/null +++ b/Assets/SEE/Components/GameNodes/GameNodes.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8666dab8a5f4b7344aabbd38ba2f3d65 \ No newline at end of file diff --git a/Assets/SEE/Components/GraphElements.meta b/Assets/SEE/Components/GraphElements.meta new file mode 100644 index 0000000000..6e904a112a --- /dev/null +++ b/Assets/SEE/Components/GraphElements.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 632cec02e074d3e45bc520e9670b8102 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Components/GraphElements/GraphElements.cs b/Assets/SEE/Components/GraphElements/GraphElements.cs new file mode 100644 index 0000000000..9ad2f43ee3 --- /dev/null +++ b/Assets/SEE/Components/GraphElements/GraphElements.cs @@ -0,0 +1,7 @@ +/// +/// Namespace for components to be attached to game nodes or edges. +/// + +namespace SEE.Components.GraphElements +{ +} diff --git a/Assets/SEE/Components/GraphElements/GraphElements.cs.meta b/Assets/SEE/Components/GraphElements/GraphElements.cs.meta new file mode 100644 index 0000000000..9930933ba6 --- /dev/null +++ b/Assets/SEE/Components/GraphElements/GraphElements.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e32966a5dbccc9d45923202fa928e5f5 \ No newline at end of file diff --git a/Assets/SEE/Controls/Interactables/Outline.cs b/Assets/SEE/Components/GraphElements/Outline.cs similarity index 95% rename from Assets/SEE/Controls/Interactables/Outline.cs rename to Assets/SEE/Components/GraphElements/Outline.cs index e24c187551..b0ac1b9074 100644 --- a/Assets/SEE/Controls/Interactables/Outline.cs +++ b/Assets/SEE/Components/GraphElements/Outline.cs @@ -11,12 +11,15 @@ using System; using System.Collections.Generic; using System.Linq; -using SEE.GO; +using SEE.Extensions; using UnityEngine; using UnityEngine.Assertions; -namespace SEE.Controls.Interactables +namespace SEE.Components.GraphElements { + /// + /// Draws an outline for a game node or edge. + /// [DisallowMultipleComponent] public class Outline : MonoBehaviour { @@ -103,6 +106,13 @@ private class ListVector3 /// public const float DefaultWidth = 1.0f; + /// + /// Adds an to the given . + /// + /// A game node or edge. + /// The color of the outline. + /// The width of the outline. + /// Resulting outline. public static Outline Create(GameObject go, Color color, float outlineWidth = DefaultWidth) { Outline result = null; @@ -286,7 +296,7 @@ private void LoadSmoothNormals() // Retrieve or generate smooth normals int index = bakeKeys.IndexOf(meshFilter.sharedMesh); List smoothNormals = - (index >= 0) ? bakeValues[index].Data : SmoothNormals(meshFilter.sharedMesh); + index >= 0 ? bakeValues[index].Data : SmoothNormals(meshFilter.sharedMesh); // Store smooth normals in UV3 meshFilter.sharedMesh.SetUVs(3, smoothNormals); diff --git a/Assets/SEE/Controls/Interactables/Outline.cs.meta b/Assets/SEE/Components/GraphElements/Outline.cs.meta similarity index 100% rename from Assets/SEE/Controls/Interactables/Outline.cs.meta rename to Assets/SEE/Components/GraphElements/Outline.cs.meta diff --git a/Assets/SEE/Components/Objects.meta b/Assets/SEE/Components/Objects.meta new file mode 100644 index 0000000000..e44be0aeae --- /dev/null +++ b/Assets/SEE/Components/Objects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 923617103c14d264099a59e8b103bbda +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/GameObjects/FaceCamera.cs b/Assets/SEE/Components/Objects/FaceCamera.cs similarity index 97% rename from Assets/SEE/GameObjects/FaceCamera.cs rename to Assets/SEE/Components/Objects/FaceCamera.cs index 636ae74c2a..50c8e86560 100644 --- a/Assets/SEE/GameObjects/FaceCamera.cs +++ b/Assets/SEE/Components/Objects/FaceCamera.cs @@ -3,12 +3,13 @@ using SEE.Utils; using UnityEngine; -namespace SEE.GO +namespace SEE.Components.Objects { /// /// This script can be added to any game object to make it always face /// the main camera. It supports locking of all three axes. /// + /// It is used in the Playername.prefab. public class FaceCamera : MonoBehaviour { /// diff --git a/Assets/SEE/GameObjects/FaceCamera.cs.meta b/Assets/SEE/Components/Objects/FaceCamera.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/FaceCamera.cs.meta rename to Assets/SEE/Components/Objects/FaceCamera.cs.meta diff --git a/Assets/SEE/Components/Objects/Objects.cs b/Assets/SEE/Components/Objects/Objects.cs new file mode 100644 index 0000000000..b96353c270 --- /dev/null +++ b/Assets/SEE/Components/Objects/Objects.cs @@ -0,0 +1,7 @@ +/// +/// Namespace for components to be attached any kind of game object, +/// including game nodes and edges. +/// +namespace SEE.Components.Objects +{ +} diff --git a/Assets/SEE/Components/Objects/Objects.cs.meta b/Assets/SEE/Components/Objects/Objects.cs.meta new file mode 100644 index 0000000000..36d2c1cf86 --- /dev/null +++ b/Assets/SEE/Components/Objects/Objects.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8b3f3bfba7b856046b276ad8816b273b \ No newline at end of file diff --git a/Assets/SEE/Controls/Actions/HighlightErosion.cs.meta b/Assets/SEE/Controls/Actions/HighlightErosion.cs.meta deleted file mode 100644 index c46c5ae22e..0000000000 --- a/Assets/SEE/Controls/Actions/HighlightErosion.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 33c1f00e7e614d51b2e84ca6b66438a1 -timeCreated: 1626044414 \ No newline at end of file diff --git a/Assets/SEE/Controls/Actions/HighlightedInteractableObjectAction.cs.meta b/Assets/SEE/Controls/Actions/HighlightedInteractableObjectAction.cs.meta deleted file mode 100644 index a93d04ee3d..0000000000 --- a/Assets/SEE/Controls/Actions/HighlightedInteractableObjectAction.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 609466bdbaa25914cabd3299e483343c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/Controls/Actions/InteractableObjectAction.cs.meta b/Assets/SEE/Controls/Actions/InteractableObjectAction.cs.meta deleted file mode 100644 index 1e6ac19953..0000000000 --- a/Assets/SEE/Controls/Actions/InteractableObjectAction.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5361607a692b5dc4dab1c581d58f792d -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/Controls/CodeCityActions.meta b/Assets/SEE/Controls/CodeCityActions.meta new file mode 100644 index 0000000000..3c582c8502 --- /dev/null +++ b/Assets/SEE/Controls/CodeCityActions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30f499db94975e04785038d283d826b9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/Actions/ShuffleAction.cs b/Assets/SEE/Controls/CodeCityActions/ShuffleAction.cs similarity index 96% rename from Assets/SEE/Controls/Actions/ShuffleAction.cs rename to Assets/SEE/Controls/CodeCityActions/ShuffleAction.cs index a6e1243f4e..81fff1590b 100644 --- a/Assets/SEE/Controls/Actions/ShuffleAction.cs +++ b/Assets/SEE/Controls/CodeCityActions/ShuffleAction.cs @@ -1,14 +1,16 @@ using SEE.Game; using SEE.Game.Operator; -using SEE.UI3D; -using SEE.GO; -using SEE.Net.Actions; +using SEE.Gizmos; +using SEE.Extensions; using SEE.Utils; using UnityEngine; using UnityEngine.Assertions; +using SEE.GraphElementRefs; +using Plane = SEE.Cities.Plane; using SEE.Net.Actions.GraphElement; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.CodeCityActions { /// /// Implements shuffling a code city on its plane. @@ -159,7 +161,7 @@ private void Update() { if (cityRootNode && !shuffling) { - GO.Plane plane = cityRootNode.GetComponentInParent(); + Plane plane = cityRootNode.GetComponentInParent(); nodeOperator.MoveTo(plane.CenterTop); new ShuffleNetAction(cityRootNode.name, plane.CenterTop).Execute(); gizmo.gameObject.SetActive(false); diff --git a/Assets/SEE/Controls/Actions/ShuffleAction.cs.meta b/Assets/SEE/Controls/CodeCityActions/ShuffleAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShuffleAction.cs.meta rename to Assets/SEE/Controls/CodeCityActions/ShuffleAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ZoomAction.cs b/Assets/SEE/Controls/CodeCityActions/ZoomAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/ZoomAction.cs rename to Assets/SEE/Controls/CodeCityActions/ZoomAction.cs index e2723102d7..5c2384b061 100644 --- a/Assets/SEE/Controls/Actions/ZoomAction.cs +++ b/Assets/SEE/Controls/CodeCityActions/ZoomAction.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.GraphElement; using SEE.Utils; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.CodeCityActions { /// /// Implements zooming into or out of a code city. diff --git a/Assets/SEE/Controls/Actions/ZoomAction.cs.meta b/Assets/SEE/Controls/CodeCityActions/ZoomAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ZoomAction.cs.meta rename to Assets/SEE/Controls/CodeCityActions/ZoomAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ZoomActionDesktop.cs b/Assets/SEE/Controls/CodeCityActions/ZoomActionDesktop.cs similarity index 94% rename from Assets/SEE/Controls/Actions/ZoomActionDesktop.cs rename to Assets/SEE/Controls/CodeCityActions/ZoomActionDesktop.cs index b960bd88f2..d2bfd5b582 100644 --- a/Assets/SEE/Controls/Actions/ZoomActionDesktop.cs +++ b/Assets/SEE/Controls/CodeCityActions/ZoomActionDesktop.cs @@ -1,12 +1,14 @@ using SEE.Game; -using SEE.GO; using SEE.Utils; -using static SEE.GO.GameObjectExtensions; using UnityEngine; using SEE.Game.Operator; +using SEE.Gizmos; +using Plane = SEE.Cities.Plane; +using SEE.Extensions; using SEE.Net.Actions.GraphElement; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.CodeCityActions { /// /// Zoom actions holding data about zooming into or out of the city @@ -51,9 +53,9 @@ private void Update() Debug.LogError($"ZoomActionDesktop.Update: rootTransform for hovered {io.name} has no parent.\n"); return; } - if (!rootTransform.parent.TryGetComponent(out GO.Plane clippingPlane) || clippingPlane == null) + if (!rootTransform.parent.TryGetComponent(out Plane clippingPlane) || clippingPlane == null) { - Debug.LogError($"ZoomActionDesktop.Update: parent for hovered {io.name} has no {typeof(GO.Plane)}.\n"); + Debug.LogError($"ZoomActionDesktop.Update: parent for hovered {io.name} has no {typeof(Plane)}.\n"); return; } @@ -89,7 +91,7 @@ private void Update() // only if zoomSteps equals 0, which is excluded because of the if condition. Vector2 centerOfTableAfterZoom = zoomSteps == -(int)zoomState.CurrentTargetZoomSteps ? rootTransform.position.XZ() : cursor.Cursor.ComputeCenter().XZ(); Vector2 toCenterOfTable = clippingPlane.CenterXZ - centerOfTableAfterZoom; - Vector2 zoomCenter = clippingPlane.CenterXZ - (toCenterOfTable * (zoomFactor / (zoomFactor - 1.0f))); + Vector2 zoomCenter = clippingPlane.CenterXZ - toCenterOfTable * (zoomFactor / (zoomFactor - 1.0f)); const float duration = 2.0f * ZoomState.DefaultZoomDuration; zoomState.PushZoomCommand(zoomCenter, zoomSteps, duration); } diff --git a/Assets/SEE/Controls/Actions/ZoomActionDesktop.cs.meta b/Assets/SEE/Controls/CodeCityActions/ZoomActionDesktop.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ZoomActionDesktop.cs.meta rename to Assets/SEE/Controls/CodeCityActions/ZoomActionDesktop.cs.meta diff --git a/Assets/SEE/Controls/Controls.cs b/Assets/SEE/Controls/Controls.cs new file mode 100644 index 0000000000..6c5d8f04f7 --- /dev/null +++ b/Assets/SEE/Controls/Controls.cs @@ -0,0 +1,6 @@ +/// +/// Controllers reacting to user interactions. +/// +namespace SEE.Controls +{ +} diff --git a/Assets/SEE/Controls/Controls.cs.meta b/Assets/SEE/Controls/Controls.cs.meta new file mode 100644 index 0000000000..929fd2e672 --- /dev/null +++ b/Assets/SEE/Controls/Controls.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c82881d266f867a41a95732dfea9f6ea \ No newline at end of file diff --git a/Assets/SEE/Controls/Interactables/InteractableBaseObject.cs b/Assets/SEE/Controls/Interactables/InteractableBaseObject.cs index ed99753829..55fe70d3bd 100644 --- a/Assets/SEE/Controls/Interactables/InteractableBaseObject.cs +++ b/Assets/SEE/Controls/Interactables/InteractableBaseObject.cs @@ -1,5 +1,5 @@ using SEE.Game; -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; using UnityEngine; namespace SEE.Controls diff --git a/Assets/SEE/Controls/Interactables/InteractableGraphElement.cs b/Assets/SEE/Controls/Interactables/InteractableGraphElement.cs index e9a56ecc24..04b8aded8e 100644 --- a/Assets/SEE/Controls/Interactables/InteractableGraphElement.cs +++ b/Assets/SEE/Controls/Interactables/InteractableGraphElement.cs @@ -1,5 +1,6 @@ using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using UnityEngine; namespace SEE.Controls.Interactables diff --git a/Assets/SEE/Controls/Interactables/InteractableObject.cs b/Assets/SEE/Controls/Interactables/InteractableObject.cs index 032e0b6e00..aec63adc08 100644 --- a/Assets/SEE/Controls/Interactables/InteractableObject.cs +++ b/Assets/SEE/Controls/Interactables/InteractableObject.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using SEE.GO; using SEE.Utils; using UnityEngine; using UnityEngine.Assertions; @@ -9,26 +8,49 @@ using SEE.Audio; using SEE.Game; using SEE.Game.Avatars; +using SEE.UserSettings; namespace SEE.Controls { /// - /// components can be attached to different kinds of objects such as game - /// nodes or edges but also markers or scroll views in metric charts. A HoverFlag indicates - /// to which kind of game object the hovering event relates to. A HoverFlag is used as a - /// single bit that occurs in hovering flags. + /// components can be attached to + /// different kinds of objects such as game nodes or edges but also + /// markers or scroll views in metric charts. A + /// indicates to which kind of game object the hovering event relates to. + /// A is used as a single bit that occurs in + /// hovering flags. /// public enum HoverFlag { - None = 0x0, // nothing is being hovered over - World = 0x1, // an object in the city world is being hovered over (game nodes or edges and the like) - ChartMarker = 0x2, // a marker in a chart is being hovered over - ChartMultiSelect = 0x4, // multiple markers in a chart are being hovered over (within a rectangular bound) - ChartScrollViewToggle = 0x8, // the scroll view of a metric chart is being hovered over + /// + /// Nothing is being hovered over. + /// + None = 0x0, + /// + /// An object in the city world is being hovered over (game nodes or edges + /// and the like). + /// + World = 0x1, + /// + /// A marker in a chart is being hovered over. + /// + ChartMarker = 0x2, + /// + /// Multiple markers in a chart are being hovered over (within a + /// rectangular bound). + /// + ChartMultiSelect = 0x4, + /// + /// The scroll view of a metric chart is being hovered over. + /// + ChartScrollViewToggle = 0x8, } /// - /// User-interactable graph elements. + /// User-interactable objects reacting to hovering, selecting, grabbing. + /// components can be attached to + /// different kinds of objects such as game nodes or edges but also + /// markers or scroll views in metric charts. /// public abstract class InteractableObject : InteractableObjectBase { @@ -784,7 +806,7 @@ public delegate void MulitPlayerReplaceSelectAction(List rep /// private void OnMouseEnter() { - if (User.UserSettings.IsDesktop + if (UserSetting.IsDesktop && !Raycasting.IsMouseOverGUI() && IsInteractable()) { SetHoverFlag(HoverFlag.World, true, true); @@ -800,7 +822,7 @@ private void OnMouseEnter() /// private void OnMouseOver() { - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { bool isFlagSet = IsHoverFlagSet(HoverFlag.World); bool isMouseOverGUI = Raycasting.IsMouseOverGUI(); @@ -825,7 +847,7 @@ private void OnMouseOver() /// private void OnMouseExit() { - if (User.UserSettings.IsDesktop + if (UserSetting.IsDesktop && IsHoverFlagSet(HoverFlag.World)) { SetHoverFlag(HoverFlag.World, false, true); diff --git a/Assets/SEE/Controls/Interactables/Interactables.cs b/Assets/SEE/Controls/Interactables/Interactables.cs new file mode 100644 index 0000000000..be182d6499 --- /dev/null +++ b/Assets/SEE/Controls/Interactables/Interactables.cs @@ -0,0 +1,8 @@ +/// +/// Home of and its subclasses. +/// An handles hovering, selection, +/// and grabbing of interactable game objects. +/// +namespace SEE.Controls.Interactables +{ +} diff --git a/Assets/SEE/Controls/Interactables/Interactables.cs.meta b/Assets/SEE/Controls/Interactables/Interactables.cs.meta new file mode 100644 index 0000000000..74f60f5355 --- /dev/null +++ b/Assets/SEE/Controls/Interactables/Interactables.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fe30c80f38bdcdd4a9524a7ef5df9a40 \ No newline at end of file diff --git a/Assets/SEE/Controls/KeyActions/KeyActions.cs b/Assets/SEE/Controls/KeyActions/KeyActions.cs new file mode 100644 index 0000000000..1264921235 --- /dev/null +++ b/Assets/SEE/Controls/KeyActions/KeyActions.cs @@ -0,0 +1,6 @@ +/// +/// Manages user actions that can be triggered by a key on the keyboard. +/// +namespace SEE.Controls.KeyActions +{ +} diff --git a/Assets/SEE/Controls/KeyActions/KeyActions.cs.meta b/Assets/SEE/Controls/KeyActions/KeyActions.cs.meta new file mode 100644 index 0000000000..0278b6d823 --- /dev/null +++ b/Assets/SEE/Controls/KeyActions/KeyActions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: dde136b9257ada444b95352b7674940b \ No newline at end of file diff --git a/Assets/SEE/Controls/MouseButton.cs b/Assets/SEE/Controls/KeyActions/MouseButton.cs similarity index 86% rename from Assets/SEE/Controls/MouseButton.cs rename to Assets/SEE/Controls/KeyActions/MouseButton.cs index 36ca1cc242..7b40c9b91d 100644 --- a/Assets/SEE/Controls/MouseButton.cs +++ b/Assets/SEE/Controls/KeyActions/MouseButton.cs @@ -1,4 +1,4 @@ -namespace SEE.Controls +namespace SEE.Controls.KeyActions { /// /// Enum representing the different mouse buttons. diff --git a/Assets/SEE/Controls/MouseButton.cs.meta b/Assets/SEE/Controls/KeyActions/MouseButton.cs.meta similarity index 100% rename from Assets/SEE/Controls/MouseButton.cs.meta rename to Assets/SEE/Controls/KeyActions/MouseButton.cs.meta diff --git a/Assets/SEE/Controls/SEEInput.cs b/Assets/SEE/Controls/KeyActions/SEEInput.cs similarity index 99% rename from Assets/SEE/Controls/SEEInput.cs rename to Assets/SEE/Controls/KeyActions/SEEInput.cs index d37bb24aa3..9af4e2c974 100644 --- a/Assets/SEE/Controls/SEEInput.cs +++ b/Assets/SEE/Controls/KeyActions/SEEInput.cs @@ -1,12 +1,13 @@ -using SEE.Controls.Actions; -using SEE.Controls.KeyActions; +using SEE.Controls.ReversibleActions; +using SEE.Controls.Players; using SEE.Tools.OpenTelemetry; +using SEE.UserSettings; using SEE.Utils; using SEE.XR; using UnityEditor; using UnityEngine; -namespace SEE.Controls +namespace SEE.Controls.KeyActions { /// /// Provides a logical abstraction of raw Unity inputs by the user. @@ -181,7 +182,7 @@ public static bool DigitKeyPressed(int digit) /// True if the user requests this action and . public static bool Undo() { - if (User.UserSettings.IsVR && XRSEEActions.UndoToggle) + if (UserSetting.IsVR && XRSEEActions.UndoToggle) { bool undo = XRSEEActions.UndoToggle; XRSEEActions.UndoToggle = false; @@ -221,7 +222,7 @@ public static bool Undo() /// True if the user requests this action and . public static bool Redo() { - if (User.UserSettings.IsVR && XRSEEActions.RedoToggle) + if (UserSetting.IsVR && XRSEEActions.RedoToggle) { bool redo = XRSEEActions.RedoToggle; XRSEEActions.RedoToggle = false; @@ -661,7 +662,7 @@ public static bool MoveDown() public static bool RotateCamera() { return Input.GetMouseButton(rightMouseButton) - || (Input.GetKey(KeyCode.LeftControl) && Input.GetMouseButton(leftMouseButton)); + || Input.GetKey(KeyCode.LeftControl) && Input.GetMouseButton(leftMouseButton); } /// diff --git a/Assets/SEE/Controls/SEEInput.cs.meta b/Assets/SEE/Controls/KeyActions/SEEInput.cs.meta similarity index 100% rename from Assets/SEE/Controls/SEEInput.cs.meta rename to Assets/SEE/Controls/KeyActions/SEEInput.cs.meta diff --git a/Assets/SEE/Controls/MetricCharts.meta b/Assets/SEE/Controls/MetricCharts.meta new file mode 100644 index 0000000000..da7cb369a5 --- /dev/null +++ b/Assets/SEE/Controls/MetricCharts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0ba191bc3691155479027baf9d94b0fd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/Actions/ChartAction.cs b/Assets/SEE/Controls/MetricCharts/ChartAction.cs similarity index 97% rename from Assets/SEE/Controls/Actions/ChartAction.cs rename to Assets/SEE/Controls/MetricCharts/ChartAction.cs index 19ec486f69..57b831b3b7 100644 --- a/Assets/SEE/Controls/Actions/ChartAction.cs +++ b/Assets/SEE/Controls/MetricCharts/ChartAction.cs @@ -21,7 +21,7 @@ using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.MetricCharts { /// /// Abstract super class of the actions applied to metric charts. diff --git a/Assets/SEE/Controls/Actions/ChartAction.cs.meta b/Assets/SEE/Controls/MetricCharts/ChartAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ChartAction.cs.meta rename to Assets/SEE/Controls/MetricCharts/ChartAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/DesktopChartAction.cs b/Assets/SEE/Controls/MetricCharts/DesktopChartAction.cs similarity index 90% rename from Assets/SEE/Controls/Actions/DesktopChartAction.cs rename to Assets/SEE/Controls/MetricCharts/DesktopChartAction.cs index d20616ff55..58bf6a49fe 100644 --- a/Assets/SEE/Controls/Actions/DesktopChartAction.cs +++ b/Assets/SEE/Controls/MetricCharts/DesktopChartAction.cs @@ -19,13 +19,15 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +using SEE.Controls.KeyActions; using SEE.Game.Charts; -namespace SEE.Controls.Actions +namespace SEE.Controls.MetricCharts { /// /// Handles the toggling of metric charts. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class DesktopChartAction : ChartAction { /// diff --git a/Assets/SEE/Controls/Actions/DesktopChartAction.cs.meta b/Assets/SEE/Controls/MetricCharts/DesktopChartAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/DesktopChartAction.cs.meta rename to Assets/SEE/Controls/MetricCharts/DesktopChartAction.cs.meta diff --git a/Assets/SEE/Controls/Modifiers.meta b/Assets/SEE/Controls/Modifiers.meta new file mode 100644 index 0000000000..f4d8ff1ade --- /dev/null +++ b/Assets/SEE/Controls/Modifiers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6867ead5eb8439645902d9600218522c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/Actions/InteractableObjectAction.cs b/Assets/SEE/Controls/Modifiers/InteractableObjectModifier.cs similarity index 62% rename from Assets/SEE/Controls/Actions/InteractableObjectAction.cs rename to Assets/SEE/Controls/Modifiers/InteractableObjectModifier.cs index 647425b78a..73a3520b47 100644 --- a/Assets/SEE/Controls/Actions/InteractableObjectAction.cs +++ b/Assets/SEE/Controls/Modifiers/InteractableObjectModifier.cs @@ -1,13 +1,16 @@ -using SEE.GO; +using SEE.Extensions; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// - /// Common abstract superclass of all actions relating to a game object that + /// Common abstract superclass of all modifiers relating to a game object that /// has an component attached to them. + /// A modifier is one that modifies the appearance (e.g., + /// by an outline) or shows additional information (e.g., erosion icons) + /// for a picked interactable object. /// - public abstract class InteractableObjectAction : MonoBehaviour + public abstract class InteractableObjectModifier : MonoBehaviour { /// /// The interactable component attached to the same object as a sibling of this action. @@ -25,4 +28,4 @@ protected virtual void Awake() } } } -} \ No newline at end of file +} diff --git a/Assets/SEE/Controls/Modifiers/InteractableObjectModifier.cs.meta b/Assets/SEE/Controls/Modifiers/InteractableObjectModifier.cs.meta new file mode 100644 index 0000000000..f7f79f6dd6 --- /dev/null +++ b/Assets/SEE/Controls/Modifiers/InteractableObjectModifier.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 77e0dd9df07d1d94785e49ea91795be0 \ No newline at end of file diff --git a/Assets/SEE/Controls/Modifiers/Modifiers.cs b/Assets/SEE/Controls/Modifiers/Modifiers.cs new file mode 100644 index 0000000000..5481c3c49a --- /dev/null +++ b/Assets/SEE/Controls/Modifiers/Modifiers.cs @@ -0,0 +1,11 @@ +/// +/// Namespace for all modifiers s. +/// These modifiers are attached to a game object that has an +/// component. +/// A modifier is one that modifies the appearance (e.g., +/// by an outline) or shows additional information (e.g., erosion icons) +/// for a picked interactable object. +/// +namespace SEE.Controls.Modifiers +{ +} diff --git a/Assets/SEE/Controls/Modifiers/Modifiers.cs.meta b/Assets/SEE/Controls/Modifiers/Modifiers.cs.meta new file mode 100644 index 0000000000..0fe1ad9357 --- /dev/null +++ b/Assets/SEE/Controls/Modifiers/Modifiers.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 08456316f41bdcd48917f276b9269695 \ No newline at end of file diff --git a/Assets/SEE/Controls/ShowAuthorEdges.cs b/Assets/SEE/Controls/Modifiers/ShowAuthorEdges.cs similarity index 96% rename from Assets/SEE/Controls/ShowAuthorEdges.cs rename to Assets/SEE/Controls/Modifiers/ShowAuthorEdges.cs index dd3561804c..5f80fbc9de 100644 --- a/Assets/SEE/Controls/ShowAuthorEdges.cs +++ b/Assets/SEE/Controls/Modifiers/ShowAuthorEdges.cs @@ -1,7 +1,7 @@ using System; -using SEE.GameObjects.BranchCity; +using SEE.Components.GameNodes.BranchCity; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// /// This action shows/animates edges connecting authors spheres and nodes when @@ -9,7 +9,7 @@ namespace SEE.Controls.Actions /// This script can be added to both s and game objects /// representing graph nodes (aka game nodes). /// - internal class ShowAuthorEdges : InteractableObjectAction, IDisposable + internal class ShowAuthorEdges : InteractableObjectModifier, IDisposable { /// /// Disposes the CancellationTokenSource. diff --git a/Assets/SEE/Controls/ShowAuthorEdges.cs.meta b/Assets/SEE/Controls/Modifiers/ShowAuthorEdges.cs.meta similarity index 100% rename from Assets/SEE/Controls/ShowAuthorEdges.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowAuthorEdges.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowEdges.cs b/Assets/SEE/Controls/Modifiers/ShowEdges.cs similarity index 99% rename from Assets/SEE/Controls/Actions/ShowEdges.cs rename to Assets/SEE/Controls/Modifiers/ShowEdges.cs index 752d40f68c..e2b5d03712 100644 --- a/Assets/SEE/Controls/Actions/ShowEdges.cs +++ b/Assets/SEE/Controls/Modifiers/ShowEdges.cs @@ -7,18 +7,18 @@ using SEE.DataModel.DG; using SEE.Game.City; using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; using Node = SEE.DataModel.DG.Node; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// /// Shows connected edges when the user hovers over or selects a node. /// /// This component is assumed to be attached to a game node. - public class ShowEdges : InteractableObjectAction + public class ShowEdges : InteractableObjectModifier { /// /// True if the object is currently being hovered over. diff --git a/Assets/SEE/Controls/Actions/ShowEdges.cs.meta b/Assets/SEE/Controls/Modifiers/ShowEdges.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowEdges.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowEdges.cs.meta diff --git a/Assets/SEE/Controls/Actions/HighlightErosion.cs b/Assets/SEE/Controls/Modifiers/ShowErosions.cs similarity index 92% rename from Assets/SEE/Controls/Actions/HighlightErosion.cs rename to Assets/SEE/Controls/Modifiers/ShowErosions.cs index fe2a307e1e..5b749bbb91 100644 --- a/Assets/SEE/Controls/Actions/HighlightErosion.cs +++ b/Assets/SEE/Controls/Modifiers/ShowErosions.cs @@ -1,22 +1,26 @@ using System; using DG.Tweening; using SEE.DataModel.DG; +using SEE.Factories; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using TMPro; using UnityEngine; using UnityEngine.Assertions; using UnityEngine.UI; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// - /// Highlights the corresponding erosion icons of the node this component is attached to. - /// If no erosion icons are present, this component won't do anything. + /// Shows the corresponding erosion icons of the node this + /// component is attached to. If no erosion icons are + /// present, this component won't do anything. /// - public class HighlightErosion : InteractableObjectAction + public class ShowErosions : InteractableObjectModifier { - // TODO: This file heavily clones code from ShowLabel.cs. It may be worthwhile to put this common behavior + // TODO: This file heavily clones code from ShowLabel.cs. + // It may be worthwhile to put this common behavior // into a shared superclass. /// @@ -41,7 +45,7 @@ protected void OnEnable() { if (Interactable == null) { - Debug.LogError($"HighlightErosion.OnEnable for {name} has no interactable.\n"); + Debug.LogError($"{nameof(ShowErosions)}.{nameof(OnEnable)} for {name} has no interactable.\n"); enabled = false; } else @@ -67,7 +71,7 @@ protected void OnDisable() } else { - Debug.LogError($"HighlightErosion.OnDisable for {name} has no interactable.\n"); + Debug.LogError($"{nameof(ShowErosions)}.{nameof(OnDisable)} for {name} has no interactable.\n"); enabled = false; } } @@ -224,7 +228,7 @@ private void ForEachErosion(Action(); SpriteRenderer spriteRenderer = childTransform.GetComponentInChildren(); @@ -237,4 +241,4 @@ private void ForEachErosion(Action /// Draws or modifies, respectively, an outline around a game object being grabbed and /// makes it opaque. /// - internal class ShowGrabbing : HighlightedInteractableObjectAction + internal class ShowGrabbing : ShowOutline { /// /// Initializes the local and remote outline color. diff --git a/Assets/SEE/Controls/Actions/ShowGrabbing.cs.meta b/Assets/SEE/Controls/Modifiers/ShowGrabbing.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowGrabbing.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowGrabbing.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowHoverInfo.cs b/Assets/SEE/Controls/Modifiers/ShowHoverInfo.cs similarity index 96% rename from Assets/SEE/Controls/Actions/ShowHoverInfo.cs rename to Assets/SEE/Controls/Modifiers/ShowHoverInfo.cs index 379dd0be03..50af39a621 100644 --- a/Assets/SEE/Controls/Actions/ShowHoverInfo.cs +++ b/Assets/SEE/Controls/Modifiers/ShowHoverInfo.cs @@ -1,16 +1,17 @@ using SEE.Game.City; using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using SEE.UI; using UnityEngine; +using SEE.Controls.ReversibleActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// /// Shows a tooltip with a short block of information about the object when it is hovered over. /// The content of the tooltip is configurable through the city's . /// - public class ShowHoverInfo : InteractableObjectAction + public class ShowHoverInfo : InteractableObjectModifier { /// /// Operator component for this object. diff --git a/Assets/SEE/Controls/Actions/ShowHoverInfo.cs.meta b/Assets/SEE/Controls/Modifiers/ShowHoverInfo.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowHoverInfo.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowHoverInfo.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowHovering.cs b/Assets/SEE/Controls/Modifiers/ShowHovering.cs similarity index 97% rename from Assets/SEE/Controls/Actions/ShowHovering.cs rename to Assets/SEE/Controls/Modifiers/ShowHovering.cs index fb0452d5d6..48c503286e 100644 --- a/Assets/SEE/Controls/Actions/ShowHovering.cs +++ b/Assets/SEE/Controls/Modifiers/ShowHovering.cs @@ -1,12 +1,12 @@ using SEE.Utils; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// /// Draws or modifies, respectively, an outline around a game object being hovered over and makes it opaque. /// - internal class ShowHovering : HighlightedInteractableObjectAction + internal class ShowHovering : ShowOutline { /// /// Initializes the local and remote outline color. diff --git a/Assets/SEE/Controls/Actions/ShowHovering.cs.meta b/Assets/SEE/Controls/Modifiers/ShowHovering.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowHovering.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowHovering.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowLabel.cs b/Assets/SEE/Controls/Modifiers/ShowLabel.cs similarity index 95% rename from Assets/SEE/Controls/Actions/ShowLabel.cs rename to Assets/SEE/Controls/Modifiers/ShowLabel.cs index e7f5d42855..cc8e036370 100644 --- a/Assets/SEE/Controls/Actions/ShowLabel.cs +++ b/Assets/SEE/Controls/Modifiers/ShowLabel.cs @@ -1,20 +1,21 @@ -using System; -using SEE.DataModel.DG; +using SEE.Controls.Players; +using SEE.Extensions; using SEE.Game; using SEE.Game.Avatars; using SEE.Game.City; using SEE.Game.Operator; -using SEE.GO; -using UnityEngine; +using SEE.UserSettings; using SEE.XR; +using System; +using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// /// Shows the source name of the hovered or selected object as a text label above the /// object. In between that label and the game object, a connecting line will be shown. /// - public class ShowLabel : InteractableObjectAction + public class ShowLabel : InteractableObjectModifier { // There can be two reasons why the label needs to be shown: because it is selected // or because it is hovered over. Those two conditions are not mutually exclusive. @@ -38,7 +39,7 @@ public class ShowLabel : InteractableObjectAction /// /// The laser pointer component of the local player. /// - private readonly Lazy pointer = new(() => SceneQueries.GetLocalPlayer().MustGetComponent()); + private readonly Lazy pointer = new(() => WindowSpaceManager.GetLocalPlayer().MustGetComponent()); /// /// Registers On() and Off() for the respective hovering and selection events. @@ -160,7 +161,7 @@ public void On() if (nodeOperator.Node != null) { LabelAttributes settings = nodeOperator.City.LabelSettings; - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { if (settings.Show && pointer.Value.On && nodeOperator.LabelIsNotEmpty()) { @@ -207,7 +208,7 @@ private void Update() { if ((isHovered || isSelected) && nodeOperator != null && nodeOperator.Node != null) { - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { XRSEEActions.RayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit raycasthit); nodeOperator.UpdateLabelLayout(raycasthit.point); diff --git a/Assets/SEE/Controls/Actions/ShowLabel.cs.meta b/Assets/SEE/Controls/Modifiers/ShowLabel.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowLabel.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowLabel.cs.meta diff --git a/Assets/SEE/Controls/Actions/HighlightedInteractableObjectAction.cs b/Assets/SEE/Controls/Modifiers/ShowOutline.cs similarity index 92% rename from Assets/SEE/Controls/Actions/HighlightedInteractableObjectAction.cs rename to Assets/SEE/Controls/Modifiers/ShowOutline.cs index 6ad9acf914..2ebce99461 100644 --- a/Assets/SEE/Controls/Actions/HighlightedInteractableObjectAction.cs +++ b/Assets/SEE/Controls/Modifiers/ShowOutline.cs @@ -1,9 +1,13 @@ -using SEE.Controls.Interactables; +using SEE.Components.GraphElements; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { - public abstract class HighlightedInteractableObjectAction : InteractableObjectAction + /// + /// Adds an outline to a game object when it is selected, hovered, or grabbed. + /// When the outline is actually activated depends upon the subclasses. + /// + public abstract class ShowOutline : InteractableObjectModifier { /// /// The local color of the outline. Is expected to be assigned by the static diff --git a/Assets/SEE/Controls/Modifiers/ShowOutline.cs.meta b/Assets/SEE/Controls/Modifiers/ShowOutline.cs.meta new file mode 100644 index 0000000000..938f150345 --- /dev/null +++ b/Assets/SEE/Controls/Modifiers/ShowOutline.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0959bf2b2abb1f442af4ba16144c582b \ No newline at end of file diff --git a/Assets/SEE/Controls/Actions/ShowSelection.cs b/Assets/SEE/Controls/Modifiers/ShowSelection.cs similarity index 97% rename from Assets/SEE/Controls/Actions/ShowSelection.cs rename to Assets/SEE/Controls/Modifiers/ShowSelection.cs index 59e164c905..f134f9ee99 100644 --- a/Assets/SEE/Controls/Actions/ShowSelection.cs +++ b/Assets/SEE/Controls/Modifiers/ShowSelection.cs @@ -1,12 +1,12 @@ using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.Modifiers { /// /// Draws or modifies, respectively, an outline around a selected game object /// and makes it opaque. /// - public class ShowSelection : HighlightedInteractableObjectAction + public class ShowSelection : ShowOutline { /// /// Initializes the local and remote outline color. diff --git a/Assets/SEE/Controls/Actions/ShowSelection.cs.meta b/Assets/SEE/Controls/Modifiers/ShowSelection.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowSelection.cs.meta rename to Assets/SEE/Controls/Modifiers/ShowSelection.cs.meta diff --git a/Assets/SEE/Game/City/TooltipContentBuilder.cs b/Assets/SEE/Controls/Modifiers/TooltipContentBuilder.cs similarity index 99% rename from Assets/SEE/Game/City/TooltipContentBuilder.cs rename to Assets/SEE/Controls/Modifiers/TooltipContentBuilder.cs index 82777bc04b..e660ecb88e 100644 --- a/Assets/SEE/Game/City/TooltipContentBuilder.cs +++ b/Assets/SEE/Controls/Modifiers/TooltipContentBuilder.cs @@ -1,7 +1,8 @@ using SEE.DataModel.DG; +using SEE.Game.City; using System.Text; -namespace SEE.Game.City +namespace SEE.Controls.ReversibleActions { /// /// Utility class for building tooltip content based on . diff --git a/Assets/SEE/Game/City/TooltipContentBuilder.cs.meta b/Assets/SEE/Controls/Modifiers/TooltipContentBuilder.cs.meta similarity index 100% rename from Assets/SEE/Game/City/TooltipContentBuilder.cs.meta rename to Assets/SEE/Controls/Modifiers/TooltipContentBuilder.cs.meta diff --git a/Assets/SEE/Controls/Players.meta b/Assets/SEE/Controls/Players.meta new file mode 100644 index 0000000000..34fac99ece --- /dev/null +++ b/Assets/SEE/Controls/Players.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 815a54293227e4a40a39018fa6e9ede9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/DesktopPlayerMovement.cs b/Assets/SEE/Controls/Players/DesktopPlayerMovement.cs similarity index 98% rename from Assets/SEE/Controls/DesktopPlayerMovement.cs rename to Assets/SEE/Controls/Players/DesktopPlayerMovement.cs index 0c3cbbe248..debe6e7ca2 100644 --- a/Assets/SEE/Controls/DesktopPlayerMovement.cs +++ b/Assets/SEE/Controls/Players/DesktopPlayerMovement.cs @@ -1,13 +1,16 @@ -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Extensions; using SEE.Tools.OpenTelemetry; using UnityEngine; -using Plane = SEE.GO.Plane; +using Plane = SEE.Cities.Plane; -namespace SEE.Controls +namespace SEE.Controls.Players { /// /// Moves a player in a desktop environment (based on keyboard and mouse input). /// + /// This component is expected to be attached to the game object representing + /// the local player. public class DesktopPlayerMovement : PlayerMovement { /// diff --git a/Assets/SEE/Controls/DesktopPlayerMovement.cs.meta b/Assets/SEE/Controls/Players/DesktopPlayerMovement.cs.meta similarity index 100% rename from Assets/SEE/Controls/DesktopPlayerMovement.cs.meta rename to Assets/SEE/Controls/Players/DesktopPlayerMovement.cs.meta diff --git a/Assets/SEE/Controls/PlayerMovement.cs b/Assets/SEE/Controls/Players/PlayerMovement.cs similarity index 54% rename from Assets/SEE/Controls/PlayerMovement.cs rename to Assets/SEE/Controls/Players/PlayerMovement.cs index 1e15118615..b62c353ddc 100644 --- a/Assets/SEE/Controls/PlayerMovement.cs +++ b/Assets/SEE/Controls/Players/PlayerMovement.cs @@ -1,10 +1,12 @@ using UnityEngine; -namespace SEE.Controls +namespace SEE.Controls.Players { /// /// Common abstract superclass of all player movements. /// + /// This component is expected to be attached to the game object representing + /// the local player. public abstract class PlayerMovement : MonoBehaviour { } diff --git a/Assets/SEE/Controls/PlayerMovement.cs.meta b/Assets/SEE/Controls/Players/PlayerMovement.cs.meta similarity index 100% rename from Assets/SEE/Controls/PlayerMovement.cs.meta rename to Assets/SEE/Controls/Players/PlayerMovement.cs.meta diff --git a/Assets/SEE/Controls/Players/Players.cs b/Assets/SEE/Controls/Players/Players.cs new file mode 100644 index 0000000000..d246f6137f --- /dev/null +++ b/Assets/SEE/Controls/Players/Players.cs @@ -0,0 +1,7 @@ +/// +/// Namespace for components to be attached to a game object representing +/// a player. +/// +namespace SEE.Controls.Players +{ +} diff --git a/Assets/SEE/Controls/Players/Players.cs.meta b/Assets/SEE/Controls/Players/Players.cs.meta new file mode 100644 index 0000000000..edf4fd05d5 --- /dev/null +++ b/Assets/SEE/Controls/Players/Players.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6bb4628d72bde19419cd2a93150ab54d \ No newline at end of file diff --git a/Assets/SEE/Controls/Actions/SelectAction.cs b/Assets/SEE/Controls/Players/SelectAction.cs similarity index 91% rename from Assets/SEE/Controls/Actions/SelectAction.cs rename to Assets/SEE/Controls/Players/SelectAction.cs index 971b7fc2d8..1fddd7433f 100644 --- a/Assets/SEE/Controls/Actions/SelectAction.cs +++ b/Assets/SEE/Controls/Players/SelectAction.cs @@ -3,10 +3,11 @@ using SEE.Utils; using UnityEngine; using SEE.Audio; -using SEE.GO; using SEE.XR; +using SEE.UserSettings; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.Players { /// /// Provides the ability to select graph elements (nodes or edges). @@ -14,6 +15,7 @@ namespace SEE.Controls.Actions /// object. Generally, it will be added to prefabs for such player /// objects. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class SelectAction : MonoBehaviour { /// @@ -46,7 +48,7 @@ private void Update() obj = interactableObject; } if (Input.GetKey(KeyCode.LeftControl) - || (User.UserSettings.IsVR && XRSEEActions.SelectedFlag)) + || UserSetting.IsVR && XRSEEActions.SelectedFlag) { if (obj != null) { diff --git a/Assets/SEE/Controls/Actions/SelectAction.cs.meta b/Assets/SEE/Controls/Players/SelectAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/SelectAction.cs.meta rename to Assets/SEE/Controls/Players/SelectAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowTree.cs b/Assets/SEE/Controls/Players/ShowTree.cs similarity index 94% rename from Assets/SEE/Controls/Actions/ShowTree.cs rename to Assets/SEE/Controls/Players/ShowTree.cs index 2a8cf5be6e..7f0b0f9c31 100644 --- a/Assets/SEE/Controls/Actions/ShowTree.cs +++ b/Assets/SEE/Controls/Players/ShowTree.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; using Cysharp.Threading.Tasks; +using SEE.Controls.KeyActions; using SEE.Game; using SEE.Game.City; -using SEE.GO; using SEE.UI.Window; using SEE.UI.Window.TreeWindow; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.Players { /// /// Shows or hides the tree view over a code city. @@ -61,8 +61,8 @@ private void ShowTreeView() async UniTaskVoid SetupManager() { // We need to wait until the WindowSpaceManager has been initialized. - await UniTask.WaitUntil(() => WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer] != null); - space = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + await UniTask.WaitUntil(() => WindowSpaceManager.WindowSpaceOfLocalPlayer != null); + space = WindowSpaceManager.WindowSpaceOfLocalPlayer; foreach (string city in treeWindows.Keys) { if (!space.Windows.Contains(treeWindows[city])) diff --git a/Assets/SEE/Controls/Actions/ShowTree.cs.meta b/Assets/SEE/Controls/Players/ShowTree.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowTree.cs.meta rename to Assets/SEE/Controls/Players/ShowTree.cs.meta diff --git a/Assets/SEE/Controls/Actions/VRPointerAction.cs b/Assets/SEE/Controls/Players/VRPointerAction.cs similarity index 80% rename from Assets/SEE/Controls/Actions/VRPointerAction.cs rename to Assets/SEE/Controls/Players/VRPointerAction.cs index 4be85cffc1..6bc1c24199 100644 --- a/Assets/SEE/Controls/Actions/VRPointerAction.cs +++ b/Assets/SEE/Controls/Players/VRPointerAction.cs @@ -1,14 +1,16 @@ using UnityEngine; using UnityEngine.XR; +using SEE.Controls.Modifiers; -namespace SEE.Controls.Actions +namespace SEE.Controls.Players { /// /// Implements actions that can be triggered by the laser pointer in XR. /// Currently, the label of the hit game object is shown if the game object /// has a . /// - /// This component is attached to the XR rig prefab. + /// This component is attached to the XR rig prefab, which is + /// the game object representing the local player in a VR environment. public class VRPointerAction : MonoBehaviour { /// @@ -29,10 +31,10 @@ public class VRPointerAction : MonoBehaviour /// void Update() { - UnityEngine.XR.InputDevice handRDevice = InputDevices.GetDeviceAtXRNode(XRNode.RightHand); - handRDevice.TryGetFeatureValue(UnityEngine.XR.CommonUsages.devicePosition, out Vector3 posR); + InputDevice handRDevice = InputDevices.GetDeviceAtXRNode(XRNode.RightHand); + handRDevice.TryGetFeatureValue(CommonUsages.devicePosition, out Vector3 posR); Vector3 vPosition = transform.TransformPoint(posR); //to world coords - handRDevice.TryGetFeatureValue(UnityEngine.XR.CommonUsages.deviceRotation, out Quaternion rotR); + handRDevice.TryGetFeatureValue(CommonUsages.deviceRotation, out Quaternion rotR); Vector3 vGazeDirection = rotR * Vector3.forward; vGazeDirection = transform.TransformDirection(vGazeDirection); if (Physics.Raycast(vPosition, vGazeDirection, out RaycastHit hit, rayLength)) diff --git a/Assets/SEE/Controls/Actions/VRPointerAction.cs.meta b/Assets/SEE/Controls/Players/VRPointerAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/VRPointerAction.cs.meta rename to Assets/SEE/Controls/Players/VRPointerAction.cs.meta diff --git a/Assets/SEE/Controls/WindowSpaceManager.cs b/Assets/SEE/Controls/Players/WindowSpaceManager.cs similarity index 79% rename from Assets/SEE/Controls/WindowSpaceManager.cs rename to Assets/SEE/Controls/Players/WindowSpaceManager.cs index cadf7c80d4..1d67ee8736 100644 --- a/Assets/SEE/Controls/WindowSpaceManager.cs +++ b/Assets/SEE/Controls/Players/WindowSpaceManager.cs @@ -3,36 +3,40 @@ using SEE.UI.Window; using SEE.UI.Menu; using SEE.UI.StateIndicator; -using SEE.GO; +using SEE.Extensions; using UnityEngine; using UnityEngine.Events; using UnityEngine.Serialization; +using SEE.Controls.KeyActions; +using System; -namespace SEE.Controls +namespace SEE.Controls.Players { /// /// Manages the association from players to s. /// Will also display a menu which can be opened using TAB. The player whose code window shall be displayed /// can be selected from this menu. /// Note that only one instance of this class may be active in the scene. This instance can be retrieved - /// using . + /// using . /// + /// This component is expected to be attached to the game object representing + /// the local player. public class WindowSpaceManager : MonoBehaviour { /// /// String representing the local player. /// - public const string LocalPlayer = "Local player"; + private const string localPlayer = "Local player"; /// /// String representing no player, i.e. no windows being displayed. /// - public const string NoPlayer = "None"; + private const string noPlayer = "None"; /// /// The name of the player whose window is currently displayed. /// - public string CurrentPlayer { get; private set; } = LocalPlayer; + private string CurrentPlayer { get; set; } = localPlayer; /// /// A dictionary mapping player names to their code spaces. @@ -40,7 +44,7 @@ public class WindowSpaceManager : MonoBehaviour private readonly Dictionary windowSpaces = new(); /// - /// This event will be invoked whenever the active window for the is changed. + /// This event will be invoked whenever the active window for the is changed. /// This includes changing the active window to nothing (i.e. closing all of them.) /// [FormerlySerializedAs("OnActiveCodeWindowChanged")] @@ -59,19 +63,42 @@ public class WindowSpaceManager : MonoBehaviour /// /// Represents the space manager currently active in the scene. /// - public static WindowSpaceManager ManagerInstance; + public static WindowSpaceManager Instance; /// /// Accesses the space for the given . /// If the given does not exist, null will be returned. /// /// The name of the player whose space should be returned. - public WindowSpace this[string playerName] + private WindowSpace this[string playerName] { get => windowSpaces.ContainsKey(playerName) ? windowSpaces[playerName] : null; set => windowSpaces[playerName] = value; } + /// + /// Returns the of the local player. + /// May be null during initialization. + /// + public static WindowSpace WindowSpaceOfLocalPlayer => Instance[localPlayer]; + + /// + /// True if the current player is the local player. + /// + public static bool CurrentPlayerIsLocalPlayer => Instance.CurrentPlayer == localPlayer; + + /// + /// Returns the local player game object. + /// + /// Local player game object. + /// This method should not belong here. Retrieving the local player + /// via an arbitrary component attached to the local player is akward. + [Obsolete("Do not use. We will replace it by a better way to retrieve the local player.")] + public static GameObject GetLocalPlayer() + { + return Instance.gameObject; + } + /// Updates the space of the player specified by using the values /// from . /// @@ -128,12 +155,13 @@ public void UpdateSpaceFromValueObject(string playerName, WindowSpace.WindowSpac private void Start() { - if (FindObjectsOfType().Length > 1) + WindowSpaceManager[] windowSpaceManagers = FindObjectsByType(FindObjectsSortMode.None); + if (windowSpaceManagers.Length > 1) { Debug.LogError($"More than one {nameof(WindowSpaceManager)} is present in the scene! " + "This will lead to undefined behaviour when synchronizing " + "windows across the network! No new indicator will be created.\n"); - foreach (WindowSpaceManager manager in FindObjectsOfType()) + foreach (WindowSpaceManager manager in windowSpaceManagers) { Debug.LogError($"{typeof(WindowSpaceManager)} at game object {manager.gameObject.FullName()}.\n"); } @@ -145,14 +173,14 @@ private void Start() spaceIndicator.AnchorMin = Vector2.zero; spaceIndicator.AnchorMax = Vector2.zero; spaceIndicator.Pivot = Vector2.zero; - ManagerInstance = this; + Instance = this; } // Create local code space and associate it with current player - WindowSpace space = windowSpaces[LocalPlayer] = gameObject.AddOrGetComponent(); + WindowSpace space = windowSpaces[localPlayer] = gameObject.AddOrGetComponent(); space.OnActiveWindowChanged.AddListener(OnActiveWindowChanged.Invoke); - ManagerInstance.spaceIndicator.ChangeState(LocalPlayer, Color.black); + Instance.spaceIndicator.ChangeState(localPlayer, Color.black); SetUpWindowSelectionMenu(); } @@ -172,17 +200,17 @@ private void Update() private void SetUpWindowSelectionMenu() { windowMenu = gameObject.AddComponent(); - MenuEntry localEntry = new(SelectAction: () => ActivateSpace(LocalPlayer), + MenuEntry localEntry = new(SelectAction: () => ActivateSpace(localPlayer), UnselectAction: DeactivateCurrentSpace, - Title: LocalPlayer, + Title: localPlayer, Description: "Windows for the local player (you).", EntryColor: Color.black); - MenuEntry noneEntry = new(() => CurrentPlayer = NoPlayer, NoPlayer, + MenuEntry noneEntry = new(() => CurrentPlayer = noPlayer, noPlayer, Description: "This option hides all windows.", EntryColor: Color.grey); windowMenu.AddEntry(noneEntry); windowMenu.AddEntry(localEntry); windowMenu.SelectEntry(localEntry); - foreach (KeyValuePair space in windowSpaces.Where(space => space.Key != LocalPlayer)) + foreach (KeyValuePair space in windowSpaces.Where(space => space.Key != localPlayer)) { windowMenu.AddEntry(new MenuEntry(() => ActivateSpace(space.Key), space.Key, DeactivateCurrentSpace, @@ -198,7 +226,7 @@ private void SetUpWindowSelectionMenu() private void DeactivateCurrentSpace() { windowSpaces[CurrentPlayer].enabled = false; - ManagerInstance.spaceIndicator.enabled = false; + Instance.spaceIndicator.enabled = false; } /// @@ -210,8 +238,8 @@ private void ActivateSpace(string playerName) { windowSpaces[playerName].enabled = true; CurrentPlayer = playerName; - ManagerInstance.spaceIndicator.enabled = true; - ManagerInstance.spaceIndicator.ChangeState(playerName, Color.black); + Instance.spaceIndicator.enabled = true; + Instance.spaceIndicator.ChangeState(playerName, Color.black); } } } diff --git a/Assets/SEE/Controls/WindowSpaceManager.cs.meta b/Assets/SEE/Controls/Players/WindowSpaceManager.cs.meta similarity index 100% rename from Assets/SEE/Controls/WindowSpaceManager.cs.meta rename to Assets/SEE/Controls/Players/WindowSpaceManager.cs.meta diff --git a/Assets/SEE/Controls/ReversibleActions.meta b/Assets/SEE/Controls/ReversibleActions.meta new file mode 100644 index 0000000000..e7fa102d9f --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65e59bf1b0790e64bbc55a5c61dcf2f1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/Actions/AbstractActionStateType.cs b/Assets/SEE/Controls/ReversibleActions/AbstractActionStateType.cs similarity index 98% rename from Assets/SEE/Controls/Actions/AbstractActionStateType.cs rename to Assets/SEE/Controls/ReversibleActions/AbstractActionStateType.cs index fd3c2cd50d..ebf3a7d54d 100644 --- a/Assets/SEE/Controls/Actions/AbstractActionStateType.cs +++ b/Assets/SEE/Controls/ReversibleActions/AbstractActionStateType.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Super class of and . diff --git a/Assets/SEE/Controls/Actions/AbstractActionStateType.cs.meta b/Assets/SEE/Controls/ReversibleActions/AbstractActionStateType.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/AbstractActionStateType.cs.meta rename to Assets/SEE/Controls/ReversibleActions/AbstractActionStateType.cs.meta diff --git a/Assets/SEE/Controls/Actions/AbstractPlayerAction.cs b/Assets/SEE/Controls/ReversibleActions/AbstractPlayerAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/AbstractPlayerAction.cs rename to Assets/SEE/Controls/ReversibleActions/AbstractPlayerAction.cs index fbcca98493..bf27c7bd15 100644 --- a/Assets/SEE/Controls/Actions/AbstractPlayerAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/AbstractPlayerAction.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; -using SEE.Utils.History; using UnityEngine; using UnityEngine.Assertions; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// An abstract superclass of all PlayerActions such as NewNodeAction, ScaleNodeAction, EditNodeAction and AddEdgeAction. diff --git a/Assets/SEE/Controls/Actions/AbstractPlayerAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/AbstractPlayerAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/AbstractPlayerAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/AbstractPlayerAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/AcceptDivergenceAction.cs b/Assets/SEE/Controls/ReversibleActions/AcceptDivergenceAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/AcceptDivergenceAction.cs rename to Assets/SEE/Controls/ReversibleActions/AcceptDivergenceAction.cs index 51da702a66..9c514c91a5 100644 --- a/Assets/SEE/Controls/Actions/AcceptDivergenceAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/AcceptDivergenceAction.cs @@ -1,21 +1,21 @@ using SEE.Audio; using SEE.DataModel.DG; -using SEE.Game; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Net.Actions; using SEE.Net.Actions.GraphElement; using SEE.Tools.ReflexionAnalysis; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using SEE.XR; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; +using SEE.GraphElementRefs; +using SEE.UserSettings; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to solve a divergence (see ) between @@ -115,7 +115,7 @@ public override void Stop() /// True if completed. public override bool Update() { - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { if (XRSEEActions.Selected && XRSEEActions.RayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit hit)) diff --git a/Assets/SEE/Controls/Actions/AcceptDivergenceAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/AcceptDivergenceAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/AcceptDivergenceAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/AcceptDivergenceAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ActionStateType.cs b/Assets/SEE/Controls/ReversibleActions/ActionStateType.cs similarity index 97% rename from Assets/SEE/Controls/Actions/ActionStateType.cs rename to Assets/SEE/Controls/ReversibleActions/ActionStateType.cs index a03f66515a..58d5a4039c 100644 --- a/Assets/SEE/Controls/Actions/ActionStateType.cs +++ b/Assets/SEE/Controls/ReversibleActions/ActionStateType.cs @@ -1,9 +1,7 @@ -using SEE.Utils.History; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { - /// /// The type of a state-based action. /// diff --git a/Assets/SEE/Controls/Actions/ActionStateType.cs.meta b/Assets/SEE/Controls/ReversibleActions/ActionStateType.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ActionStateType.cs.meta rename to Assets/SEE/Controls/ReversibleActions/ActionStateType.cs.meta diff --git a/Assets/SEE/Controls/Actions/ActionStateTypeGroup.cs b/Assets/SEE/Controls/ReversibleActions/ActionStateTypeGroup.cs similarity index 97% rename from Assets/SEE/Controls/Actions/ActionStateTypeGroup.cs rename to Assets/SEE/Controls/ReversibleActions/ActionStateTypeGroup.cs index 8ce6273b5e..862bc73d84 100644 --- a/Assets/SEE/Controls/Actions/ActionStateTypeGroup.cs +++ b/Assets/SEE/Controls/ReversibleActions/ActionStateTypeGroup.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// A group of other s. It is not itself executable but diff --git a/Assets/SEE/Controls/Actions/ActionStateTypeGroup.cs.meta b/Assets/SEE/Controls/ReversibleActions/ActionStateTypeGroup.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ActionStateTypeGroup.cs.meta rename to Assets/SEE/Controls/ReversibleActions/ActionStateTypeGroup.cs.meta diff --git a/Assets/SEE/Controls/Actions/ActionStateTypes.cs b/Assets/SEE/Controls/ReversibleActions/ActionStateTypes.cs similarity index 98% rename from Assets/SEE/Controls/Actions/ActionStateTypes.cs rename to Assets/SEE/Controls/ReversibleActions/ActionStateTypes.cs index 2d38fec8de..0bae54379a 100644 --- a/Assets/SEE/Controls/Actions/ActionStateTypes.cs +++ b/Assets/SEE/Controls/ReversibleActions/ActionStateTypes.cs @@ -1,15 +1,16 @@ using UnityEngine; using SEE.Utils; -using SEE.Controls.Actions.HolisticMetrics; -using SEE.Controls.Actions.Drawable; -using SEE.Controls.Actions.Table; +using SEE.Extensions; +using SEE.Controls.ReversibleActions.HolisticMetrics; +using SEE.Controls.ReversibleActions.Drawable; +using SEE.Controls.ReversibleActions.Tables; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Provides all available s. /// - /// These are used for . + /// These are used for . public static class ActionStateTypes { /// diff --git a/Assets/SEE/Controls/Actions/ActionStateTypes.cs.meta b/Assets/SEE/Controls/ReversibleActions/ActionStateTypes.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ActionStateTypes.cs.meta rename to Assets/SEE/Controls/ReversibleActions/ActionStateTypes.cs.meta diff --git a/Assets/SEE/Controls/Actions/AddEdgeAction.cs b/Assets/SEE/Controls/ReversibleActions/AddEdgeAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/AddEdgeAction.cs rename to Assets/SEE/Controls/ReversibleActions/AddEdgeAction.cs index 9b4024e1c0..369f52e295 100644 --- a/Assets/SEE/Controls/Actions/AddEdgeAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/AddEdgeAction.cs @@ -1,19 +1,19 @@ using System.Collections.Generic; -using SEE.Game; using SEE.UI.Notification; -using SEE.GO; -using SEE.Net.Actions; +using SEE.Extensions; using SEE.Utils; -using SEE.Utils.History; using System; using UnityEngine; using SEE.Audio; using SEE.DataModel.DG; -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; using SEE.XR; +using SEE.UserSettings; +using SEE.GraphElementRefs; using SEE.Net.Actions.GraphElement; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to create an edge between two selected nodes. @@ -143,7 +143,7 @@ public override bool Update() // Assigning the game objects to be connected. // Checking whether the two game objects are not null and whether they are // actually nodes. - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { if (XRSEEActions.Selected && InteractableObject.HoveredObjectWithWorldFlag.gameObject != null diff --git a/Assets/SEE/Controls/Actions/AddEdgeAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/AddEdgeAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/AddEdgeAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/AddEdgeAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/AddNodeAction.cs b/Assets/SEE/Controls/ReversibleActions/AddNodeAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/AddNodeAction.cs rename to Assets/SEE/Controls/ReversibleActions/AddNodeAction.cs index 269e5c9dad..4e9b2cedfe 100644 --- a/Assets/SEE/Controls/Actions/AddNodeAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/AddNodeAction.cs @@ -4,19 +4,19 @@ using UnityEngine; using SEE.Audio; using SEE.DataModel.DG; -using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GO; -using SEE.Net.Actions; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.UI.Notification; using SEE.UI.PropertyDialog; using SEE.Utils; -using SEE.Utils.History; using SEE.XR; +using SEE.GraphElementRefs; +using SEE.UserSettings; using SEE.Net.Actions.GraphElement; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to create a new node for a selected city. @@ -79,14 +79,14 @@ public override bool Update() switch (progress) { case ProgressState.NoNodeSelected: - if (User.UserSettings.IsDesktop && Input.GetMouseButtonDown(0) + if (UserSetting.IsDesktop && Input.GetMouseButtonDown(0) && Raycasting.RaycastGraphElement(out RaycastHit raycastHit, out GraphElementRef ger, false) == HitGraphElement.Node && ger.gameObject.TryGetComponent(out InteractableObject io) && io.IsInteractable(raycastHit.point)) { CheckAddNode(raycastHit.collider.gameObject, raycastHit.transform.InverseTransformPoint(raycastHit.point)); } - else if (User.UserSettings.IsVR + else if (UserSetting.IsVR && XRSEEActions.Selected && InteractableObject.HoveredObjectWithWorldFlag.gameObject != null && InteractableObject.HoveredObjectWithWorldFlag.gameObject.HasNodeRef() diff --git a/Assets/SEE/Controls/Actions/AddNodeAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/AddNodeAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/AddNodeAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/AddNodeAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/DeleteAction.cs b/Assets/SEE/Controls/ReversibleActions/DeleteAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/DeleteAction.cs rename to Assets/SEE/Controls/ReversibleActions/DeleteAction.cs index aec7d9d604..a49d4569c7 100644 --- a/Assets/SEE/Controls/Actions/DeleteAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/DeleteAction.cs @@ -4,21 +4,24 @@ using SEE.DataModel.DG; using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Net.Actions; using SEE.Net.Actions.GraphElement; using SEE.UI.Menu; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using SEE.XR; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; +using SEE.GraphElementRefs; +using SEE.UserSettings; +using SEE.Controls.KeyActions; +using SEE.Controls.Players; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to delete the currently selected game object (edge or node) @@ -219,7 +222,7 @@ public override bool Update() /// private void HandleInputSelection() { - if (User.UserSettings.IsDesktop && Input.GetMouseButtonDown(0) + if (UserSetting.IsDesktop && Input.GetMouseButtonDown(0) && Raycasting.RaycastGraphElement(out RaycastHit raycastHit, out GraphElementRef _) != HitGraphElement.None) { // the hit object is the one to be deleted @@ -228,7 +231,7 @@ private void HandleInputSelection() validationViaContextMenu = false; progress = ProgressState.Validation; } - else if (User.UserSettings.IsVR && XRSEEActions.Selected) + else if (UserSetting.IsVR && XRSEEActions.Selected) { // the hit object is the one to be deleted hitGraphElements.Add(InteractableObject.HoveredObjectWithWorldFlag.gameObject); diff --git a/Assets/SEE/Controls/Actions/DeleteAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/DeleteAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/DeleteAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/DeleteAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable.meta b/Assets/SEE/Controls/ReversibleActions/Drawable.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/AddImageAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/AddImageAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/AddImageAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/AddImageAction.cs index 8f4d064a71..ef95ab5ed6 100644 --- a/Assets/SEE/Controls/Actions/Drawable/AddImageAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/AddImageAction.cs @@ -8,15 +8,14 @@ using System.Collections.Generic; using System.IO; using UnityEngine; -using SEE.Utils.History; using SEE.UI.PropertyDialog.Drawable; using SEE.UI.Drawable; using SEE.UI.Menu.Drawable; -using SEE.GO; +using SEE.Extensions; using SEE.Game.Drawable.ValueHolders; using SEE.UI; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides an action to add an image to a drawable. diff --git a/Assets/SEE/Controls/Actions/Drawable/AddImageAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/AddImageAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/AddImageAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/AddImageAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/ClearAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/ClearAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/ClearAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/ClearAction.cs index 1bed16b47f..f7a2d0c27e 100644 --- a/Assets/SEE/Controls/Actions/Drawable/ClearAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/ClearAction.cs @@ -5,13 +5,13 @@ using SEE.Utils; using System.Collections.Generic; using UnityEngine; -using SEE.Utils.History; using SEE.Game.Drawable.ValueHolders; using SEE.Game.Drawable.ActionHelpers; using SEE.UI.Menu.Drawable; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides an action to clear a whole drawable. diff --git a/Assets/SEE/Controls/Actions/Drawable/ClearAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/ClearAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/ClearAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/ClearAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/ColorPickerAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/ColorPickerAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/ColorPickerAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/ColorPickerAction.cs index 233ba3c2fc..ff5b619f10 100644 --- a/Assets/SEE/Controls/Actions/Drawable/ColorPickerAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/ColorPickerAction.cs @@ -2,17 +2,17 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using SEE.UI; using SEE.UI.Drawable; using SEE.UI.Menu.Drawable; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using TMPro; using UnityEngine; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides a color picker action for objects. diff --git a/Assets/SEE/Controls/Actions/Drawable/ColorPickerAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/ColorPickerAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/ColorPickerAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/ColorPickerAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/CutCopyPasteAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/CutCopyPasteAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/CutCopyPasteAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/CutCopyPasteAction.cs index 5ecbf0a98a..a265029d8c 100644 --- a/Assets/SEE/Controls/Actions/Drawable/CutCopyPasteAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/CutCopyPasteAction.cs @@ -4,17 +4,17 @@ using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI; using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This action provides the cut, copy, and paste functionality diff --git a/Assets/SEE/Controls/Actions/Drawable/CutCopyPasteAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/CutCopyPasteAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/CutCopyPasteAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/CutCopyPasteAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/DrawFreehandAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawFreehandAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/DrawFreehandAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/DrawFreehandAction.cs index 94909f4492..cac0eff5fc 100644 --- a/Assets/SEE/Controls/Actions/Drawable/DrawFreehandAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawFreehandAction.cs @@ -1,16 +1,16 @@ +using SEE.Controls.KeyActions; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Net.Actions.Drawable; using SEE.UI.Menu.Drawable; using SEE.Utils; -using SEE.Utils.History; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This action allows drawing on a drawable. diff --git a/Assets/SEE/Controls/Actions/Drawable/DrawFreehandAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawFreehandAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/DrawFreehandAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/DrawFreehandAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/DrawShapesAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawShapesAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/DrawShapesAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/DrawShapesAction.cs index 2962251b00..6649270f92 100644 --- a/Assets/SEE/Controls/Actions/Drawable/DrawShapesAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawShapesAction.cs @@ -1,21 +1,21 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; +using SEE.Extensions; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; using SEE.Net.Actions.Drawable; using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; +using SEE.Controls.KeyActions; using static SEE.Game.Drawable.ActionHelpers.LineCapPointsCalculator; using static SEE.Game.Drawable.GameDrawer; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Allows the user to draw a shape. diff --git a/Assets/SEE/Controls/Actions/Drawable/DrawShapesAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawShapesAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/DrawShapesAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/DrawShapesAction.cs.meta diff --git a/Assets/SEE/Controls/ReversibleActions/Drawable/Drawable.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/Drawable.cs new file mode 100644 index 0000000000..8bfe70e898 --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/Drawable.cs @@ -0,0 +1,6 @@ +/// +/// Actions for drawing. +/// +namespace SEE.Controls.ReversibleActions.Drawable +{ +} diff --git a/Assets/SEE/Controls/ReversibleActions/Drawable/Drawable.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/Drawable.cs.meta new file mode 100644 index 0000000000..2f2a77e966 --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/Drawable.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 931b568f360f1c946a099c460b613a56 \ No newline at end of file diff --git a/Assets/SEE/Controls/Actions/Drawable/DrawableAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawableAction.cs similarity index 89% rename from Assets/SEE/Controls/Actions/Drawable/DrawableAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/DrawableAction.cs index cdb0ef8a6e..eff4f0b929 100644 --- a/Assets/SEE/Controls/Actions/Drawable/DrawableAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawableAction.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Super class of all actions dealing with drawables. Provides the diff --git a/Assets/SEE/Controls/Actions/Drawable/DrawableAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/DrawableAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/DrawableAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/DrawableAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/EditAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/EditAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/EditAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/EditAction.cs index de4b716c75..d926ffb45d 100644 --- a/Assets/SEE/Controls/Actions/Drawable/EditAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/EditAction.cs @@ -8,11 +8,11 @@ using System.Collections.Generic; using UnityEngine; using TextConf = SEE.Game.Drawable.Configurations.TextConf; -using SEE.Utils.History; using SEE.Game.Drawable.ActionHelpers; using SEE.UI; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides the option to edit a object. diff --git a/Assets/SEE/Controls/Actions/Drawable/EditAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/EditAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/EditAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/EditAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/EraseAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/EraseAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/EraseAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/EraseAction.cs index bf362d23cc..9556f7dc49 100644 --- a/Assets/SEE/Controls/Actions/Drawable/EraseAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/EraseAction.cs @@ -1,3 +1,4 @@ +using SEE.Controls.KeyActions; using SEE.Game; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; @@ -5,12 +6,11 @@ using SEE.Game.Drawable.ValueHolders; using SEE.Net.Actions.Drawable; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using System.Linq; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides the action to erase (delete) a object. diff --git a/Assets/SEE/Controls/Actions/Drawable/EraseAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/EraseAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/EraseAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/EraseAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/LayerChangeAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/LayerChangeAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/Drawable/LayerChangeAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/LayerChangeAction.cs index 77091ab13a..892612d6b7 100644 --- a/Assets/SEE/Controls/Actions/Drawable/LayerChangeAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/LayerChangeAction.cs @@ -7,12 +7,12 @@ using SEE.Utils; using System.Collections.Generic; using UnityEngine; -using SEE.Utils.History; -using SEE.GO; +using SEE.Extensions; using SEE.Game.Drawable.ActionHelpers; using SEE.UI; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class is responsible for changing the layer order of a diff --git a/Assets/SEE/Controls/Actions/Drawable/LayerChangeAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/LayerChangeAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/LayerChangeAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/LayerChangeAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/LineAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/LineAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/Drawable/LineAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/LineAction.cs index 38526f40d3..5981d075ae 100644 --- a/Assets/SEE/Controls/Actions/Drawable/LineAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/LineAction.cs @@ -9,7 +9,7 @@ using System.Linq; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This abstract class is the base for all actions that work with lines. diff --git a/Assets/SEE/Controls/Actions/Drawable/LineAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/LineAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/LineAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/LineAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/LineConnectionEraseAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/LineConnectionEraseAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/Drawable/LineConnectionEraseAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/LineConnectionEraseAction.cs index 8745ea01b3..8c2c757256 100644 --- a/Assets/SEE/Controls/Actions/Drawable/LineConnectionEraseAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/LineConnectionEraseAction.cs @@ -1,14 +1,14 @@ +using SEE.Controls.KeyActions; using SEE.Game; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Net.Actions.Drawable; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This action allows the user to delete a line connector between two points. diff --git a/Assets/SEE/Controls/Actions/Drawable/LineConnectionEraseAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/LineConnectionEraseAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/LineConnectionEraseAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/LineConnectionEraseAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/LinePointEraseAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/LinePointEraseAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/Drawable/LinePointEraseAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/LinePointEraseAction.cs index 0a93cbb5c5..30c58b00a7 100644 --- a/Assets/SEE/Controls/Actions/Drawable/LinePointEraseAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/LinePointEraseAction.cs @@ -1,14 +1,14 @@ +using SEE.Controls.KeyActions; using SEE.Game; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Net.Actions.Drawable; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides an action to erase only some points of a . diff --git a/Assets/SEE/Controls/Actions/Drawable/LinePointEraseAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/LinePointEraseAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/LinePointEraseAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/LinePointEraseAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/LineSplitAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/LineSplitAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/LineSplitAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/LineSplitAction.cs index 80bc95d72c..1697ba7af0 100644 --- a/Assets/SEE/Controls/Actions/Drawable/LineSplitAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/LineSplitAction.cs @@ -3,16 +3,16 @@ using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using System.Linq; using UnityEngine; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This action allows the user to split a . diff --git a/Assets/SEE/Controls/Actions/Drawable/LineSplitAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/LineSplitAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/LineSplitAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/LineSplitAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/LoadAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/LoadAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/LoadAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/LoadAction.cs index 6139337a34..4b17ceca5f 100644 --- a/Assets/SEE/Controls/Actions/Drawable/LoadAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/LoadAction.cs @@ -4,21 +4,21 @@ using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI; using SEE.UI.Drawable; using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using SEE.Utils.Paths; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Events; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Adds the to the scene from one or more drawable configs saved diff --git a/Assets/SEE/Controls/Actions/Drawable/LoadAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/LoadAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/LoadAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/LoadAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/MindMapAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/MindMapAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/MindMapAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/MindMapAction.cs index 3c5108761a..364b6d3f5a 100644 --- a/Assets/SEE/Controls/Actions/Drawable/MindMapAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/MindMapAction.cs @@ -3,18 +3,18 @@ using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.UI.PropertyDialog.Drawable; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; using static SEE.UI.Menu.Drawable.MindMapMenu; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides the operations for a mind map. diff --git a/Assets/SEE/Controls/Actions/Drawable/MindMapAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/MindMapAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/MindMapAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/MindMapAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/MovePointAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/MovePointAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/MovePointAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/MovePointAction.cs index d3b8d33b5d..13ece09d4c 100644 --- a/Assets/SEE/Controls/Actions/Drawable/MovePointAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/MovePointAction.cs @@ -3,14 +3,14 @@ using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.UI.Notification; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.Utils; using System.Collections.Generic; using UnityEngine; -using SEE.Utils.History; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This action allows the user to move a point of a . diff --git a/Assets/SEE/Controls/Actions/Drawable/MovePointAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/MovePointAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/MovePointAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/MovePointAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/MoveRotateAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/MoveRotateAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/MoveRotateAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/MoveRotateAction.cs index 54ebfc4d36..a346be514e 100644 --- a/Assets/SEE/Controls/Actions/Drawable/MoveRotateAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/MoveRotateAction.cs @@ -1,4 +1,5 @@ using Michsky.UI.ModernUIPack; +using SEE.Controls.KeyActions; using SEE.Game; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; @@ -9,12 +10,11 @@ using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; using MoveNetAction = SEE.Net.Actions.Drawable.MoveNetAction; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Moves or rotate a drawable type object. diff --git a/Assets/SEE/Controls/Actions/Drawable/MoveRotateAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/MoveRotateAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/MoveRotateAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/MoveRotateAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/SaveAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/SaveAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/SaveAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/SaveAction.cs index 0a7ede8af9..7558486a88 100644 --- a/Assets/SEE/Controls/Actions/Drawable/SaveAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/SaveAction.cs @@ -3,21 +3,20 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; +using SEE.UI.Notification; +using SEE.Extensions; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; using SEE.UI; using SEE.UI.Drawable; using SEE.UI.Menu.Drawable; -using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using SEE.Utils.Paths; -using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Saves one or more drawable configurations to a file. diff --git a/Assets/SEE/Controls/Actions/Drawable/SaveAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/SaveAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/SaveAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/SaveAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/ScaleAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/ScaleAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/ScaleAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/ScaleAction.cs index 8622f5fff4..be1b622e86 100644 --- a/Assets/SEE/Controls/Actions/Drawable/ScaleAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/ScaleAction.cs @@ -1,4 +1,5 @@ -using SEE.Game.Drawable; +using SEE.Controls.KeyActions; +using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Net.Actions.Drawable; @@ -7,11 +8,10 @@ using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Scales a drawable type object. diff --git a/Assets/SEE/Controls/Actions/Drawable/ScaleAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/ScaleAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/ScaleAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/ScaleAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/ShowDrawableManager.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/ShowDrawableManager.cs similarity index 90% rename from Assets/SEE/Controls/Actions/Drawable/ShowDrawableManager.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/ShowDrawableManager.cs index 584be6ae07..3c66daa23b 100644 --- a/Assets/SEE/Controls/Actions/Drawable/ShowDrawableManager.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/ShowDrawableManager.cs @@ -1,12 +1,13 @@ using Cysharp.Threading.Tasks; -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Controls.Players; +using SEE.Extensions; using SEE.UI; -using SEE.UI.Drawable; using SEE.UI.Window; using SEE.UI.Window.DrawableManagerWindow; using UnityEngine; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Allows the user to show or hide the drawable manager window. @@ -41,8 +42,8 @@ internal void ShowDrawableManagerWindow() async UniTaskVoid SetupManager() { - await UniTask.WaitUntil(() => WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer] != null); - space = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + await UniTask.WaitUntil(() => WindowSpaceManager.WindowSpaceOfLocalPlayer != null); + space = WindowSpaceManager.WindowSpaceOfLocalPlayer; space.AddWindow(window); space.ActiveWindow = window; } diff --git a/Assets/SEE/Controls/Actions/Drawable/ShowDrawableManager.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/ShowDrawableManager.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/ShowDrawableManager.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/ShowDrawableManager.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/StickyNoteAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/StickyNoteAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/StickyNoteAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/StickyNoteAction.cs index 35290b65bb..c1a1e1a548 100644 --- a/Assets/SEE/Controls/Actions/Drawable/StickyNoteAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/StickyNoteAction.cs @@ -2,16 +2,16 @@ using SEE.Game; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Menu.Drawable; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// This class provides all operations for sticky notes. diff --git a/Assets/SEE/Controls/Actions/Drawable/StickyNoteAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/StickyNoteAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/StickyNoteAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/StickyNoteAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Drawable/WriteTextAction.cs b/Assets/SEE/Controls/ReversibleActions/Drawable/WriteTextAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Drawable/WriteTextAction.cs rename to Assets/SEE/Controls/ReversibleActions/Drawable/WriteTextAction.cs index 803c4b62b8..686580e298 100644 --- a/Assets/SEE/Controls/Actions/Drawable/WriteTextAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Drawable/WriteTextAction.cs @@ -8,12 +8,11 @@ using SEE.Utils; using System.Collections.Generic; using UnityEngine; -using SEE.Utils.History; using SEE.Game.Drawable.ValueHolders; using SEE.Game.Drawable.ActionHelpers; using SEE.UI; -namespace SEE.Controls.Actions.Drawable +namespace SEE.Controls.ReversibleActions.Drawable { /// /// Adds a text to a drawable. diff --git a/Assets/SEE/Controls/Actions/Drawable/WriteTextAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Drawable/WriteTextAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Drawable/WriteTextAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Drawable/WriteTextAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/EditNodeAction.cs b/Assets/SEE/Controls/ReversibleActions/EditNodeAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/EditNodeAction.cs rename to Assets/SEE/Controls/ReversibleActions/EditNodeAction.cs index 316a261c41..222089f2b5 100644 --- a/Assets/SEE/Controls/Actions/EditNodeAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/EditNodeAction.cs @@ -1,15 +1,16 @@ using SEE.DataModel.DG; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Net.Actions.GraphElement; using SEE.UI.PropertyDialog; using SEE.Utils; -using SEE.Utils.History; using System; using System.Collections.Generic; using UnityEngine; +using SEE.GraphElementRefs; +using SEE.Controls.KeyActions; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to edit an existing node's attributes. diff --git a/Assets/SEE/Controls/Actions/EditNodeAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/EditNodeAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/EditNodeAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/EditNodeAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HideAction.cs b/Assets/SEE/Controls/ReversibleActions/HideAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/HideAction.cs rename to Assets/SEE/Controls/ReversibleActions/HideAction.cs index 10b633610e..6d2f8b2bb2 100644 --- a/Assets/SEE/Controls/Actions/HideAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HideAction.cs @@ -1,15 +1,16 @@ using SEE.DataModel.DG; using SEE.Game; -using SEE.GO; +using SEE.Extensions; using System.Collections.Generic; using System.Linq; using SEE.UI.PropertyDialog; using UnityEngine; using UnityEngine.Assertions; -using SEE.Utils.History; using SEE.XR; +using SEE.GraphElementRefs; +using SEE.UserSettings; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to hide/show the currently selected game object (edge or node). @@ -79,7 +80,7 @@ public override IReversibleAction NewInstance() /// public override void Start() { - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { base.Stop(); OpenDialog(); @@ -131,11 +132,11 @@ public override void Stop() /// True if completed. public override bool Update() { - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { MakeUnselectedTransparent(); } - if (User.UserSettings.IsVR) + else if (UserSetting.IsVR) { mode = RadialSelection.HideMode; } diff --git a/Assets/SEE/Controls/Actions/HideAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HideAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HideAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HideAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HideModeSelector.cs b/Assets/SEE/Controls/ReversibleActions/HideModeSelector.cs similarity index 92% rename from Assets/SEE/Controls/Actions/HideModeSelector.cs rename to Assets/SEE/Controls/ReversibleActions/HideModeSelector.cs index 2e337db77f..da85e78abc 100644 --- a/Assets/SEE/Controls/Actions/HideModeSelector.cs +++ b/Assets/SEE/Controls/ReversibleActions/HideModeSelector.cs @@ -1,4 +1,4 @@ -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Represents the various modes for hiding nodes and edges diff --git a/Assets/SEE/Controls/Actions/HideModeSelector.cs.meta b/Assets/SEE/Controls/ReversibleActions/HideModeSelector.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HideModeSelector.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HideModeSelector.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/AddBoardAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddBoardAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/HolisticMetrics/AddBoardAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddBoardAction.cs index 37e046ddfb..ec4c66c91d 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/AddBoardAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddBoardAction.cs @@ -6,11 +6,9 @@ using SEE.Net.Actions.HolisticMetrics; using SEE.Utils; using UnityEngine; -using SEE.Utils.History; -using SEE.UI.Drawable; using SEE.UI; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// This action manages the creation of a specific metrics board. diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/AddBoardAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddBoardAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/AddBoardAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddBoardAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/AddWidgetAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddWidgetAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/HolisticMetrics/AddWidgetAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddWidgetAction.cs index d7011bdfd5..dbf90cc720 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/AddWidgetAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddWidgetAction.cs @@ -5,9 +5,8 @@ using SEE.UI.PropertyDialog.HolisticMetrics; using SEE.Net.Actions.HolisticMetrics; using UnityEngine; -using SEE.Utils.History; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// This class manages the creation of a holistic metrics widget. It is needed so we can also revert the deletion. diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/AddWidgetAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddWidgetAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/AddWidgetAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/AddWidgetAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/DeleteBoardAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteBoardAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/HolisticMetrics/DeleteBoardAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteBoardAction.cs index a17630b7ba..b15dc17c3b 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/DeleteBoardAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteBoardAction.cs @@ -2,10 +2,9 @@ using SEE.Game.HolisticMetrics; using SEE.Net.Actions.HolisticMetrics; using SEE.Utils; -using SEE.Utils.History; using UnityEngine; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// This class manages the delete action deleting one metrics board. When deleting a board, you should use this diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/DeleteBoardAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteBoardAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/DeleteBoardAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteBoardAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/DeleteWidgetAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteWidgetAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/HolisticMetrics/DeleteWidgetAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteWidgetAction.cs index e92ccce715..f5cba9fd9d 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/DeleteWidgetAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteWidgetAction.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; using SEE.Game.HolisticMetrics; using SEE.Net.Actions.HolisticMetrics; -using SEE.Utils.History; using UnityEngine; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// This class is responsible for executing or reverting widget deletions. (holistic metric widgets) diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/DeleteWidgetAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteWidgetAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/DeleteWidgetAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/DeleteWidgetAction.cs.meta diff --git a/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/HolisticMetrics.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/HolisticMetrics.cs new file mode 100644 index 0000000000..fbca1af384 --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/HolisticMetrics.cs @@ -0,0 +1,6 @@ +/// +/// Actions for the metric board. +/// +namespace SEE.Controls.ReversibleActions.HolisticMetrics +{ +} diff --git a/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/HolisticMetrics.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/HolisticMetrics.cs.meta new file mode 100644 index 0000000000..87943707cb --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/HolisticMetrics.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: edbeba3f87d2cd445b3ebb3a904b359e \ No newline at end of file diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/LoadBoardAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/LoadBoardAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/HolisticMetrics/LoadBoardAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/LoadBoardAction.cs index 14716d32f0..9eafa4c15a 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/LoadBoardAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/LoadBoardAction.cs @@ -7,10 +7,9 @@ using SEE.Net.Actions.HolisticMetrics; using SEE.Utils; using UnityEngine; -using SEE.Utils.History; using SEE.UI; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// Adds a board to the scene from a board config saved in a file on the disk. diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/LoadBoardAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/LoadBoardAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/LoadBoardAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/LoadBoardAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/MoveBoardAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveBoardAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/HolisticMetrics/MoveBoardAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveBoardAction.cs index 9697f21133..6211bc5a57 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/MoveBoardAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveBoardAction.cs @@ -1,10 +1,9 @@ using System.Collections.Generic; using SEE.Game.HolisticMetrics; using SEE.Net.Actions.HolisticMetrics; -using SEE.Utils.History; using UnityEngine; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// Each instance of this class manages one concrete move action of a metrics board from an old position and diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/MoveBoardAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveBoardAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/MoveBoardAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveBoardAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/MoveWidgetAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveWidgetAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/HolisticMetrics/MoveWidgetAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveWidgetAction.cs index 72c2edf045..cb9f54a079 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/MoveWidgetAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveWidgetAction.cs @@ -2,10 +2,9 @@ using System.Collections.Generic; using SEE.Game.HolisticMetrics; using SEE.Net.Actions.HolisticMetrics; -using SEE.Utils.History; using UnityEngine; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// This class manages a move action of a metrics widget from its old position to a new position where the player diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/MoveWidgetAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveWidgetAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/MoveWidgetAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/MoveWidgetAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/SaveBoardAction.cs b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/SaveBoardAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/HolisticMetrics/SaveBoardAction.cs rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/SaveBoardAction.cs index dd6bd62e8e..d2ea6820cd 100644 --- a/Assets/SEE/Controls/Actions/HolisticMetrics/SaveBoardAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/SaveBoardAction.cs @@ -5,9 +5,8 @@ using SEE.UI.Notification; using SEE.UI.PropertyDialog.HolisticMetrics; using SEE.Utils; -using SEE.Utils.History; -namespace SEE.Controls.Actions.HolisticMetrics +namespace SEE.Controls.ReversibleActions.HolisticMetrics { /// /// Saves a metrics board's configuration to a file. diff --git a/Assets/SEE/Controls/Actions/HolisticMetrics/SaveBoardAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/HolisticMetrics/SaveBoardAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/HolisticMetrics/SaveBoardAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/HolisticMetrics/SaveBoardAction.cs.meta diff --git a/Assets/SEE/Utils/History/IReversibleAction.cs b/Assets/SEE/Controls/ReversibleActions/IReversibleAction.cs similarity index 98% rename from Assets/SEE/Utils/History/IReversibleAction.cs rename to Assets/SEE/Controls/ReversibleActions/IReversibleAction.cs index 9caa31c7f1..676e7f23c6 100644 --- a/Assets/SEE/Utils/History/IReversibleAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/IReversibleAction.cs @@ -1,7 +1,6 @@ -using SEE.Controls.Actions; -using System.Collections.Generic; +using System.Collections.Generic; -namespace SEE.Utils.History +namespace SEE.Controls.ReversibleActions { /// /// Creates a new instance of . diff --git a/Assets/SEE/Utils/History/IReversibleAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/IReversibleAction.cs.meta similarity index 100% rename from Assets/SEE/Utils/History/IReversibleAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/IReversibleAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/MoveAction.cs b/Assets/SEE/Controls/ReversibleActions/MoveAction.cs similarity index 86% rename from Assets/SEE/Controls/Actions/MoveAction.cs rename to Assets/SEE/Controls/ReversibleActions/MoveAction.cs index 21953138c0..0afcf2a6c3 100644 --- a/Assets/SEE/Controls/Actions/MoveAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/MoveAction.cs @@ -2,22 +2,24 @@ using System.Collections.Generic; using UnityEngine; using SEE.Audio; -using SEE.Controls.Interactables; using SEE.DataModel.DG; using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GO; -using SEE.Net.Actions; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Tools.OpenTelemetry; using SEE.Tools.ReflexionAnalysis; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using SEE.XR; +using SEE.GraphElementRefs; +using SEE.UserSettings; using SEE.Net.Actions.GraphElement; +using SEE.Controls.Modifiers; +using SEE.Controls.KeyActions; +using SEE.Components.GraphElements; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// An action to grab, move, and drop nodes. @@ -32,7 +34,7 @@ internal class MoveAction : AbstractPlayerAction /// /// The object to move which was selected via context menu. /// - private GameObject contextMenuObjectToMove; + private GameObject contextMenuGameNodeToMove; /// /// The offset of the cursor to the pivot of . @@ -128,16 +130,16 @@ public override bool Update() return false; } } - else if ((!movementRequested || User.UserSettings.IsVR) && ExecuteViaContextMenu) + else if ((!movementRequested || UserSetting.IsVR) && ExecuteViaContextMenu) { // User starts dragging object selected via context menu. // Override the initial cursorOffset based on new mouse position to reduce jump - if (contextMenuObjectToMove.TryGetNodeRef(out NodeRef nodeRef) + if (contextMenuGameNodeToMove.TryGetNodeRef(out NodeRef nodeRef) && Raycasting.RaycastLowestNode(out RaycastHit? targetObjectHit, out Node _, nodeRef)) { // Calculate position on object and close to the cursor - Vector3 objectSize = contextMenuObjectToMove.WorldSpaceSize(); - Vector3 objectPosition = contextMenuObjectToMove.transform.position; + Vector3 objectSize = contextMenuGameNodeToMove.WorldSpaceSize(); + Vector3 objectPosition = contextMenuGameNodeToMove.transform.position; Vector3 anchorPosition = targetObjectHit.Value.point; anchorPosition.x = Mathf.Clamp(anchorPosition.x, objectPosition.x - 0.5f * objectSize.x, @@ -148,15 +150,15 @@ public override bool Update() cursorOffset = anchorPosition - objectPosition; } XRSEEActions.Selected = false; - grabbedObject.Grab(contextMenuObjectToMove); + grabbedObject.Grab(contextMenuGameNodeToMove); activeAction = true; CurrentState = IReversibleAction.Progress.InProgress; } } // Drag grabbed object else if ( - ((User.UserSettings.IsDesktop && (movementRequested ^ ExecuteViaContextMenu)) // exclusive OR - || (User.UserSettings.IsVR && !XRSEEActions.Selected)) + ((UserSetting.IsDesktop && (movementRequested ^ ExecuteViaContextMenu)) // exclusive OR + || (UserSetting.IsVR && !XRSEEActions.Selected)) && activeAction) { Raycasting.RaycastLowestNode(out RaycastHit? targetObjectHit, out Node _, grabbedObject.Node, false); @@ -175,10 +177,10 @@ public override bool Update() // End dragging else { - if (grabbedObject.GrabbedGameObject != null) + if (grabbedObject.GrabbedGameNode != null) { AudioManagerImpl.EnqueueSoundEffect(IAudioManager.SoundEffect.DropSound, - grabbedObject.GrabbedGameObject, true); + grabbedObject.GrabbedGameNode, true); } activeAction = false; ExecuteViaContextMenu = false; @@ -186,10 +188,10 @@ public override bool Update() bool wasMoved = grabbedObject.UnGrab(); // Action is finished. CurrentState = wasMoved ? IReversibleAction.Progress.Completed : IReversibleAction.Progress.NoEffect; - if (wasMoved && grabbedObject.GrabbedGameObject != null) + if (wasMoved && grabbedObject.GrabbedGameNode != null) { - TracingHelperService.Instance?.TrackMoveAction(grabbedObject.GrabbedGameObject, - grabbedObject.GrabbedGameObject.transform.position, grabbedObject.NewParent); + TracingHelperService.Instance?.TrackMoveAction(grabbedObject.GrabbedGameNode, + grabbedObject.GrabbedGameNode.transform.position, grabbedObject.NewParent); } return wasMoved; @@ -228,7 +230,7 @@ public void ContextMenuExecution(GameObject objToMove, Vector3 raycastHitPositio { ExecuteViaContextMenu = true; cursorOffset = raycastHitPosition - objToMove.transform.position; - contextMenuObjectToMove = objToMove; + contextMenuGameNodeToMove = objToMove; } /// @@ -238,9 +240,9 @@ public void ContextMenuExecution(GameObject objToMove, Vector3 raycastHitPositio private struct GrabbedObject { /// - /// The game object that is currently grabbed. + /// The game node that is currently grabbed. /// - public GameObject GrabbedGameObject + public GameObject GrabbedGameNode { get; private set; @@ -263,13 +265,13 @@ public GameObject GrabbedGameObject /// /// The name of the grabbed object if any was grabbed; otherwise the empty string. /// - internal readonly string Name => GrabbedGameObject != null ? GrabbedGameObject.name : string.Empty; + internal readonly string Name => GrabbedGameNode != null ? GrabbedGameNode.name : string.Empty; /// /// The node reference associated with the grabbed object. May be null if no /// node is associated with the grabbed object. /// - public readonly NodeRef Node => GrabbedGameObject.TryGetNodeRef(out NodeRef result) ? result : null; + public readonly NodeRef Node => GrabbedGameNode.TryGetNodeRef(out NodeRef result) ? result : null; /// /// Memorizes the new parent of after it was moved. @@ -321,9 +323,9 @@ public void Grab(GameObject gameObject) { if (gameObject != null) { - GrabbedGameObject = gameObject; + GrabbedGameNode = gameObject; grabbedObjID = gameObject.name; - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { originalParent = XRSEEActions.OldParent; } @@ -388,11 +390,11 @@ public bool UnGrab() } } - if (GrabbedGameObject.TryGetComponent(out InteractableObject interactableObject)) + if (GrabbedGameNode.TryGetComponent(out InteractableObject interactableObject)) { interactableObject.SetGrab(grab: false, isInitiator: true); } - ShowLabel.Off(GrabbedGameObject); + ShowLabel.Off(GrabbedGameNode); IsGrabbed = false; // Note: We do not set grabbedObject to null because we may need its // value later for Undo/Redo. @@ -414,10 +416,10 @@ public bool UnGrab() public readonly bool CanBePlaced() { Bounds2D parentBounds = new(NewParent); - Bounds2D grabbedBounds = new(GrabbedGameObject); + Bounds2D grabbedBounds = new(GrabbedGameNode); bool portalCheckPassed = true; - if (Portal.GetPortal(GrabbedGameObject, out Vector2 leftFront, out Vector2 rightBack)) + if (Portal.GetPortal(GrabbedGameNode, out Vector2 leftFront, out Vector2 rightBack)) { Bounds2D portalBounds = Bounds2D.FromPortal(leftFront, rightBack); portalCheckPassed = portalBounds.Contains(grabbedBounds); @@ -425,7 +427,50 @@ public readonly bool CanBePlaced() return parentBounds.Contains(grabbedBounds) && portalCheckPassed - && !GrabbedGameObject.OverlapsWithSiblings(); + && !OverlapsWithSiblings(GrabbedGameNode); + } + + /// + /// Checks if overlaps with any other active direct child node of its parent. + /// + /// Overlap is checked based on the components. Objects with no + /// component and inactive nodes are ignored. + /// + /// + /// + /// The must be a node, i.e., coantain a NodeRef component. + /// + /// The game object whose operator to retrieve. + /// False if does not have a component, + /// or does not overlap with its siblings. + /// + /// Thrown when the object the method is called on is not a node, i.e., has no + /// component. + /// + private static bool OverlapsWithSiblings(GameObject gameObject) + { + if (!gameObject.HasNodeRef()) + { + throw new InvalidOperationException("GameObject must be a node!"); + } + if (!gameObject.TryGetComponent(out Collider collider)) + { + return false; + } + foreach (Transform sibling in gameObject.transform.parent) + { + if (sibling.gameObject == gameObject || !sibling.gameObject.IsNodeAndActiveSelf() + || !sibling.gameObject.TryGetComponent(out Collider siblingCollider)) + { + continue; + } + + if (collider.bounds.Intersects(siblingCollider.bounds)) + { + return true; + } + } + return false; } /// @@ -434,11 +479,11 @@ public readonly bool CanBePlaced() /// private readonly void MoveToOrigin() { - if (GrabbedGameObject == null) + if (GrabbedGameNode == null) { return; } - MoveTo(GrabbedGameObject, originalWorldPosition); + MoveTo(GrabbedGameNode, originalWorldPosition); } /// @@ -448,11 +493,11 @@ private readonly void MoveToOrigin() /// private readonly void MoveToNewPosition() { - if (GrabbedGameObject == null) + if (GrabbedGameNode == null) { return; } - MoveTo(GrabbedGameObject, currentPositionOfGrabbedObject, 1); + MoveTo(GrabbedGameNode, currentPositionOfGrabbedObject, 1); } /// @@ -466,20 +511,20 @@ private readonly void MoveToNewPosition() /// The will be updated to reflect the actual target /// world-space position after the move operation. /// - /// The will NOT be reparented to the . + /// The will NOT be reparented to the . /// /// /// The game object to place the grabbed node on. /// The world-space position where the grabbed node should be moved. internal void MoveToTarget(GameObject targetGameObject, Vector3 targetPosition) { - if (GrabbedGameObject == null) + if (GrabbedGameNode == null) { return; } - currentPositionOfGrabbedObject = GameNodeMover.GetCoordinatesOn(GrabbedGameObject.WorldSpaceSize(), + currentPositionOfGrabbedObject = GameNodeMover.GetCoordinatesOn(GrabbedGameNode.WorldSpaceSize(), targetPosition, targetGameObject); - MoveTo(GrabbedGameObject, currentPositionOfGrabbedObject, 0); + MoveTo(GrabbedGameNode, currentPositionOfGrabbedObject, 0); } #region HitColor @@ -551,9 +596,9 @@ internal void Undo() { originalParent = GraphElementIDMap.Find(originalParentID).transform; } - if (GrabbedGameObject == null) + if (GrabbedGameNode == null) { - GrabbedGameObject = GraphElementIDMap.Find(grabbedObjID); + GrabbedGameNode = GraphElementIDMap.Find(grabbedObjID); } UnReparent(); } @@ -621,7 +666,7 @@ internal void Reparent(GameObject target, bool isProvisional, bool isUnOrRedo = if (isProvisional) { HighlightTarget(); - if (GrabbedGameObject.TryGetComponent(out Outline outline)) + if (GrabbedGameNode.TryGetComponent(out Outline outline)) { outline.OutlineColor = CanBePlaced() ? Color.green : Color.red; } @@ -636,11 +681,11 @@ internal void Reparent(GameObject target, bool isProvisional, bool isUnOrRedo = // and the mapping target is not the root of the graph. if (withinReflexionCity && !target.IsRoot()) { - ReflexionMapperSetParent(GrabbedGameObject, target); + ReflexionMapperSetParent(GrabbedGameNode, target); } else { - GameNodeMoverSetParent(GrabbedGameObject, target); + GameNodeMoverSetParent(GrabbedGameNode, target); } } diff --git a/Assets/SEE/Controls/Actions/MoveAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/MoveAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/MoveAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/MoveAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ResizeNodeAction.cs b/Assets/SEE/Controls/ReversibleActions/ResizeNodeAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/ResizeNodeAction.cs rename to Assets/SEE/Controls/ReversibleActions/ResizeNodeAction.cs index 3a6fc24c80..4e0abfbdc4 100644 --- a/Assets/SEE/Controls/Actions/ResizeNodeAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/ResizeNodeAction.cs @@ -4,15 +4,15 @@ using UnityEngine; using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Utils; -using SEE.Utils.History; using Plane = UnityEngine.Plane; -using SEE.GO.Factories; +using SEE.Factories; +using SEE.GraphElementRefs; using SEE.Net.Actions.GraphElement; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to resize a node. diff --git a/Assets/SEE/Controls/Actions/ResizeNodeAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/ResizeNodeAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ResizeNodeAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/ResizeNodeAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowCodeAction.cs b/Assets/SEE/Controls/ReversibleActions/ShowCodeAction.cs similarity index 95% rename from Assets/SEE/Controls/Actions/ShowCodeAction.cs rename to Assets/SEE/Controls/ReversibleActions/ShowCodeAction.cs index f6eb42b3ca..ab128cdb81 100644 --- a/Assets/SEE/Controls/Actions/ShowCodeAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/ShowCodeAction.cs @@ -3,7 +3,7 @@ using System.Linq; using SEE.UI.Window.CodeWindow; using SEE.UI.Notification; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions; using SEE.Utils; using UnityEngine; @@ -11,25 +11,22 @@ using System; using Cysharp.Threading.Tasks; using SEE.UI.Window; -using SEE.Utils.History; using SEE.Game.City; using SEE.VCS; using SEE.XR; -using GraphElementRef = SEE.GO.GraphElementRef; using Range = SEE.DataModel.DG.Range; +using SEE.GraphProviders.VCS; +using SEE.GraphElementRefs; +using SEE.Controls.KeyActions; +using SEE.Controls.Players; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Action to display the source code of the currently selected node using s. /// internal class ShowCodeAction : AbstractPlayerAction { - /// - /// Manager object which takes care of the player selection menu and window space dictionary for us. - /// - private WindowSpaceManager spaceManager; - /// /// Action responsible for synchronizing the window spaces across the network. /// @@ -51,16 +48,11 @@ public override HashSet GetChangedObjects() public override IReversibleAction NewInstance() => CreateReversibleAction(); - public override void Awake() - { - spaceManager = WindowSpaceManager.ManagerInstance; - } - public override void Start() { syncAction = new SyncWindowSpaceAction(); - spaceManager.OnActiveWindowChanged.AddListener(UpdateSpace); - spaceManager[WindowSpaceManager.LocalPlayer].OnWindowAdded.AddListener(w => + WindowSpaceManager.Instance.OnActiveWindowChanged.AddListener(UpdateSpace); + WindowSpaceManager.WindowSpaceOfLocalPlayer.OnWindowAdded.AddListener(w => { if (w is CodeWindow codeWindow) { @@ -71,7 +63,7 @@ public override void Start() void UpdateSpace() { - syncAction.UpdateSpace(spaceManager[WindowSpaceManager.LocalPlayer]); + syncAction.UpdateSpace(WindowSpaceManager.WindowSpaceOfLocalPlayer); } } @@ -318,7 +310,7 @@ async UniTask EnterWindowContent() public override bool Update() { // Only allow local player to open new code windows - if (spaceManager.CurrentPlayer == WindowSpaceManager.LocalPlayer + if (WindowSpaceManager.CurrentPlayerIsLocalPlayer && (SEEInput.Select() || XRSEEActions.Selected) && Raycasting.RaycastGraphElement(out RaycastHit _, out GraphElementRef graphElementRef) != HitGraphElement.None) { @@ -341,7 +333,7 @@ void ShowCodeWindow() ? ShowUnifiedDiff(edgeRef) : ShowCode(graphElementRef); // Add code window to our space of code window, if it isn't in there yet - WindowSpace manager = spaceManager[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; if (!manager.Windows.Contains(codeWindow)) { manager.AddWindow(codeWindow); diff --git a/Assets/SEE/Controls/Actions/ShowCodeAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/ShowCodeAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowCodeAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/ShowCodeAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/ShowSnapshotWindow.cs b/Assets/SEE/Controls/ReversibleActions/ShowSnapshotWindow.cs similarity index 87% rename from Assets/SEE/Controls/Actions/ShowSnapshotWindow.cs rename to Assets/SEE/Controls/ReversibleActions/ShowSnapshotWindow.cs index 0b8eefdfc6..6a84669d43 100644 --- a/Assets/SEE/Controls/Actions/ShowSnapshotWindow.cs +++ b/Assets/SEE/Controls/ReversibleActions/ShowSnapshotWindow.cs @@ -1,4 +1,6 @@ using System.Linq; +using SEE.Controls.KeyActions; +using SEE.Controls.Players; using SEE.UI.Window; using SEE.UI.Window.SnapshotsWindow; using UnityEngine; @@ -17,7 +19,7 @@ private void Update() { if (SEEInput.OpenSnapshotsView()) { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; if (manager.Windows.OfType().FirstOrDefault() is { } snapshotWindow) { diff --git a/Assets/SEE/Controls/Actions/ShowSnapshotWindow.cs.meta b/Assets/SEE/Controls/ReversibleActions/ShowSnapshotWindow.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ShowSnapshotWindow.cs.meta rename to Assets/SEE/Controls/ReversibleActions/ShowSnapshotWindow.cs.meta diff --git a/Assets/SEE/Controls/Actions/Table.meta b/Assets/SEE/Controls/ReversibleActions/Table.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Table.meta rename to Assets/SEE/Controls/ReversibleActions/Table.meta diff --git a/Assets/SEE/Controls/Actions/Table/ModifyTableAction.cs b/Assets/SEE/Controls/ReversibleActions/Table/ModifyTableAction.cs similarity index 99% rename from Assets/SEE/Controls/Actions/Table/ModifyTableAction.cs rename to Assets/SEE/Controls/ReversibleActions/Table/ModifyTableAction.cs index 1f210cbada..71953340d2 100644 --- a/Assets/SEE/Controls/Actions/Table/ModifyTableAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Table/ModifyTableAction.cs @@ -2,21 +2,22 @@ using MoreLinq; using SEE.Game; using SEE.Game.City; -using SEE.Game.Table; -using SEE.GameObjects; -using SEE.GO; +using SEE.Game.Tables; +using SEE.Extensions; using SEE.Net.Actions.Table; using SEE.UI.Menu; using SEE.UI.Menu.Table; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using System.Linq; using UnityEngine; using ModifyOperation = SEE.UI.Menu.Table.ModifyTableMenu.ModifyOperation; +using SEE.Cities; +using SEE.Controls.KeyActions; +using SEE.Controls.CodeCityActions; -namespace SEE.Controls.Actions.Table +namespace SEE.Controls.ReversibleActions.Tables { /// /// This action provides functionality to move, rotate, scale and delete diff --git a/Assets/SEE/Controls/Actions/Table/ModifyTableAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Table/ModifyTableAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Table/ModifyTableAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Table/ModifyTableAction.cs.meta diff --git a/Assets/SEE/Controls/Actions/Table/SpawnTableAction.cs b/Assets/SEE/Controls/ReversibleActions/Table/SpawnTableAction.cs similarity index 98% rename from Assets/SEE/Controls/Actions/Table/SpawnTableAction.cs rename to Assets/SEE/Controls/ReversibleActions/Table/SpawnTableAction.cs index 31be45a6d8..e26917cf8d 100644 --- a/Assets/SEE/Controls/Actions/Table/SpawnTableAction.cs +++ b/Assets/SEE/Controls/ReversibleActions/Table/SpawnTableAction.cs @@ -1,13 +1,13 @@ using Cysharp.Threading.Tasks; -using SEE.Game.Table; +using SEE.Controls.KeyActions; +using SEE.Game.Tables; using SEE.Net.Actions.Table; using SEE.UI.Notification; using SEE.Utils; -using SEE.Utils.History; using System.Collections.Generic; using UnityEngine; -namespace SEE.Controls.Actions.Table +namespace SEE.Controls.ReversibleActions.Tables { /// /// This class provides the option to spawn a new table. diff --git a/Assets/SEE/Controls/Actions/Table/SpawnTableAction.cs.meta b/Assets/SEE/Controls/ReversibleActions/Table/SpawnTableAction.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/Table/SpawnTableAction.cs.meta rename to Assets/SEE/Controls/ReversibleActions/Table/SpawnTableAction.cs.meta diff --git a/Assets/SEE/Controls/ReversibleActions/Table/Table.cs b/Assets/SEE/Controls/ReversibleActions/Table/Table.cs new file mode 100644 index 0000000000..5ea75f5c4d --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions/Table/Table.cs @@ -0,0 +1,6 @@ +/// +/// Actions for tables upon which code cities are placed. +/// +namespace SEE.Controls.ReversibleActions.Tables +{ +} diff --git a/Assets/SEE/Controls/ReversibleActions/Table/Table.cs.meta b/Assets/SEE/Controls/ReversibleActions/Table/Table.cs.meta new file mode 100644 index 0000000000..94d9a96f5d --- /dev/null +++ b/Assets/SEE/Controls/ReversibleActions/Table/Table.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: de10f533b6afce04f807244187945f52 \ No newline at end of file diff --git a/Assets/SEE/Controls/RoomObjects.meta b/Assets/SEE/Controls/RoomObjects.meta new file mode 100644 index 0000000000..96f80d470c --- /dev/null +++ b/Assets/SEE/Controls/RoomObjects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5e397ef7ef6d75d47951058c5fbd1f91 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/RoomObjects/RoomObjects.cs b/Assets/SEE/Controls/RoomObjects/RoomObjects.cs new file mode 100644 index 0000000000..2406ede1fe --- /dev/null +++ b/Assets/SEE/Controls/RoomObjects/RoomObjects.cs @@ -0,0 +1,8 @@ +/// +/// Namespace for controls of room objects, such as a mirror or a browser. +/// +/// Game objects representing graph elements are not room objects. +/// +namespace SEE.Controls.RoomObjects +{ +} diff --git a/Assets/SEE/Controls/RoomObjects/RoomObjects.cs.meta b/Assets/SEE/Controls/RoomObjects/RoomObjects.cs.meta new file mode 100644 index 0000000000..5a2021e8d9 --- /dev/null +++ b/Assets/SEE/Controls/RoomObjects/RoomObjects.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 940f02d1a6ead7d47a4c95ca077ad8d5 \ No newline at end of file diff --git a/Assets/SEE/Controls/ToggleBrowser.cs b/Assets/SEE/Controls/RoomObjects/ToggleBrowser.cs similarity index 95% rename from Assets/SEE/Controls/ToggleBrowser.cs rename to Assets/SEE/Controls/RoomObjects/ToggleBrowser.cs index 80d3fcfd22..5350e60c23 100644 --- a/Assets/SEE/Controls/ToggleBrowser.cs +++ b/Assets/SEE/Controls/RoomObjects/ToggleBrowser.cs @@ -1,6 +1,7 @@ +using SEE.Controls.KeyActions; using UnityEngine; -namespace SEE.Controls +namespace SEE.Controls.RoomObjects { /// /// Toggles the browser on and off if the user requests so. diff --git a/Assets/SEE/Controls/ToggleBrowser.cs.meta b/Assets/SEE/Controls/RoomObjects/ToggleBrowser.cs.meta similarity index 100% rename from Assets/SEE/Controls/ToggleBrowser.cs.meta rename to Assets/SEE/Controls/RoomObjects/ToggleBrowser.cs.meta diff --git a/Assets/SEE/Controls/ToggleChildren.cs b/Assets/SEE/Controls/RoomObjects/ToggleChildren.cs similarity index 97% rename from Assets/SEE/Controls/ToggleChildren.cs rename to Assets/SEE/Controls/RoomObjects/ToggleChildren.cs index 9e754a91c8..7e1a65537a 100644 --- a/Assets/SEE/Controls/ToggleChildren.cs +++ b/Assets/SEE/Controls/RoomObjects/ToggleChildren.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.Controls +namespace SEE.Controls.RoomObjects { /// /// Toggles the children of the game object this component is attached to. diff --git a/Assets/SEE/Controls/ToggleChildren.cs.meta b/Assets/SEE/Controls/RoomObjects/ToggleChildren.cs.meta similarity index 100% rename from Assets/SEE/Controls/ToggleChildren.cs.meta rename to Assets/SEE/Controls/RoomObjects/ToggleChildren.cs.meta diff --git a/Assets/SEE/Controls/ToggleMirror.cs b/Assets/SEE/Controls/RoomObjects/ToggleMirror.cs similarity index 97% rename from Assets/SEE/Controls/ToggleMirror.cs rename to Assets/SEE/Controls/RoomObjects/ToggleMirror.cs index 600828ca17..ed566ae93d 100644 --- a/Assets/SEE/Controls/ToggleMirror.cs +++ b/Assets/SEE/Controls/RoomObjects/ToggleMirror.cs @@ -1,7 +1,8 @@ -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Extensions; using UnityEngine; -namespace SEE.Controls +namespace SEE.Controls.RoomObjects { /// /// Toggles the mirror. diff --git a/Assets/SEE/Controls/ToggleMirror.cs.meta b/Assets/SEE/Controls/RoomObjects/ToggleMirror.cs.meta similarity index 100% rename from Assets/SEE/Controls/ToggleMirror.cs.meta rename to Assets/SEE/Controls/RoomObjects/ToggleMirror.cs.meta diff --git a/Assets/SEE/Controls/SpeechInputs.meta b/Assets/SEE/Controls/SpeechInputs.meta new file mode 100644 index 0000000000..901193705c --- /dev/null +++ b/Assets/SEE/Controls/SpeechInputs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f5a083f7ffd5fc048b22146e69128099 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Controls/DictationInput.cs b/Assets/SEE/Controls/SpeechInputs/DictationInput.cs similarity index 99% rename from Assets/SEE/Controls/DictationInput.cs rename to Assets/SEE/Controls/SpeechInputs/DictationInput.cs index ec6e8b69f7..4f6b604f27 100644 --- a/Assets/SEE/Controls/DictationInput.cs +++ b/Assets/SEE/Controls/SpeechInputs/DictationInput.cs @@ -2,7 +2,7 @@ using UnityEngine.Windows.Speech; using static UnityEngine.Windows.Speech.DictationRecognizer; -namespace SEE.Controls +namespace SEE.Controls.SpeechInput { /// /// Speech input for arbitrary spoken text. Unlike and diff --git a/Assets/SEE/Controls/DictationInput.cs.meta b/Assets/SEE/Controls/SpeechInputs/DictationInput.cs.meta similarity index 100% rename from Assets/SEE/Controls/DictationInput.cs.meta rename to Assets/SEE/Controls/SpeechInputs/DictationInput.cs.meta diff --git a/Assets/SEE/Controls/GrammarInput.cs b/Assets/SEE/Controls/SpeechInputs/GrammarInput.cs similarity index 99% rename from Assets/SEE/Controls/GrammarInput.cs rename to Assets/SEE/Controls/SpeechInputs/GrammarInput.cs index c9f5e3a97a..2d5adf0877 100644 --- a/Assets/SEE/Controls/GrammarInput.cs +++ b/Assets/SEE/Controls/SpeechInputs/GrammarInput.cs @@ -1,7 +1,7 @@ using UnityEngine.Windows.Speech; using static UnityEngine.Windows.Speech.PhraseRecognizer; -namespace SEE.Controls +namespace SEE.Controls.SpeechInput { /// /// Speech input based on a Speech Recognition Grammar Specification (SRGS). diff --git a/Assets/SEE/Controls/GrammarInput.cs.meta b/Assets/SEE/Controls/SpeechInputs/GrammarInput.cs.meta similarity index 100% rename from Assets/SEE/Controls/GrammarInput.cs.meta rename to Assets/SEE/Controls/SpeechInputs/GrammarInput.cs.meta diff --git a/Assets/SEE/Controls/KeywordInput.cs b/Assets/SEE/Controls/SpeechInputs/KeywordInput.cs similarity index 98% rename from Assets/SEE/Controls/KeywordInput.cs rename to Assets/SEE/Controls/SpeechInputs/KeywordInput.cs index 0fc7e03d14..3b0b561dd3 100644 --- a/Assets/SEE/Controls/KeywordInput.cs +++ b/Assets/SEE/Controls/SpeechInputs/KeywordInput.cs @@ -1,7 +1,7 @@ using UnityEngine.Windows.Speech; using static UnityEngine.Windows.Speech.PhraseRecognizer; -namespace SEE.Controls +namespace SEE.Controls.SpeechInput { /// /// Speech input based on a predefined set of keywords. diff --git a/Assets/SEE/Controls/KeywordInput.cs.meta b/Assets/SEE/Controls/SpeechInputs/KeywordInput.cs.meta similarity index 100% rename from Assets/SEE/Controls/KeywordInput.cs.meta rename to Assets/SEE/Controls/SpeechInputs/KeywordInput.cs.meta diff --git a/Assets/SEE/Controls/SpeechInput.cs b/Assets/SEE/Controls/SpeechInputs/SpeechInput.cs similarity index 94% rename from Assets/SEE/Controls/SpeechInput.cs rename to Assets/SEE/Controls/SpeechInputs/SpeechInput.cs index 0b80673a68..7a02234981 100644 --- a/Assets/SEE/Controls/SpeechInput.cs +++ b/Assets/SEE/Controls/SpeechInputs/SpeechInput.cs @@ -1,4 +1,4 @@ -namespace SEE.Controls +namespace SEE.Controls.SpeechInput { /// /// Super class for speech input. @@ -24,4 +24,4 @@ public abstract class SpeechInput /// public abstract void Dispose(); } -} \ No newline at end of file +} diff --git a/Assets/SEE/Controls/SpeechInput.cs.meta b/Assets/SEE/Controls/SpeechInputs/SpeechInput.cs.meta similarity index 100% rename from Assets/SEE/Controls/SpeechInput.cs.meta rename to Assets/SEE/Controls/SpeechInputs/SpeechInput.cs.meta diff --git a/Assets/SEE/Controls/XRInput.cs b/Assets/SEE/Controls/XRInput.cs deleted file mode 100644 index 0e11cd8b92..0000000000 --- a/Assets/SEE/Controls/XRInput.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace SEE.Controls -{ - public static class XRInput - { - /// - /// Name of the action set defined by VR Steam Input. - /// - public const string DefaultActionSetName = "default"; - - /// - /// Name of the throttle action defined by VR Steam Input. - /// - public const string ThrottleActionName = "Throttle"; - - /// - /// Name of the reset charts action defined by VR Steam Input - /// - public const string ResetChartsName = "ResetCharts"; - - /// - /// Name of the create chart action defined by VR Steam Input. - /// - public const string CreateChartActionName = "CreateChart"; - - /// - /// Name of the create chart action defined by VR Steam Input. - /// - public const string ClickActionName = "InteractUI"; - - /// - /// Name of the move chart action defined by VR Steam Input. - /// - public const string MoveActionName = "Move"; - } -} \ No newline at end of file diff --git a/Assets/SEE/Controls/XRInput.cs.meta b/Assets/SEE/Controls/XRInput.cs.meta deleted file mode 100644 index 572a2e1da0..0000000000 --- a/Assets/SEE/Controls/XRInput.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a490ccfd0fc3e344aac87cf5e67eed17 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/DataModel/DG/Attributable.cs b/Assets/SEE/DataModel/DG/Attributable.cs index 135756bea3..6708aac831 100644 --- a/Assets/SEE/DataModel/DG/Attributable.cs +++ b/Assets/SEE/DataModel/DG/Attributable.cs @@ -1,4 +1,5 @@ using SEE.Utils; +using SEE.Events; using System; using System.Collections.Generic; using System.Linq; diff --git a/Assets/SEE/DataModel/DG/GraphElementExtensions.cs b/Assets/SEE/DataModel/DG/GraphElementExtensions.cs index 77809aeaae..e742a5dbb6 100644 --- a/Assets/SEE/DataModel/DG/GraphElementExtensions.cs +++ b/Assets/SEE/DataModel/DG/GraphElementExtensions.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.Linq; using SEE.DataModel.DG; -using SEE.Game; using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using UnityEngine; +using SEE.GraphElementRefs; namespace SEE.Utils { diff --git a/Assets/SEE/DataModel/GraphElementIDComparer.cs b/Assets/SEE/DataModel/DG/GraphElementIDComparer.cs similarity index 95% rename from Assets/SEE/DataModel/GraphElementIDComparer.cs rename to Assets/SEE/DataModel/DG/GraphElementIDComparer.cs index 2c463281ca..317e174036 100644 --- a/Assets/SEE/DataModel/GraphElementIDComparer.cs +++ b/Assets/SEE/DataModel/DG/GraphElementIDComparer.cs @@ -1,7 +1,6 @@ -using SEE.DataModel.DG; -using System.Collections.Generic; +using System.Collections.Generic; -namespace SEE.DataModel +namespace SEE.DataModel.DG { /// /// A comparer for that considers only the diff --git a/Assets/SEE/DataModel/GraphElementIDComparer.cs.meta b/Assets/SEE/DataModel/DG/GraphElementIDComparer.cs.meta similarity index 100% rename from Assets/SEE/DataModel/GraphElementIDComparer.cs.meta rename to Assets/SEE/DataModel/DG/GraphElementIDComparer.cs.meta diff --git a/Assets/SEE/DataModel/DG/GraphIndex/GraphIndex.cs b/Assets/SEE/DataModel/DG/GraphIndex/GraphIndex.cs new file mode 100644 index 0000000000..c4b9ef6080 --- /dev/null +++ b/Assets/SEE/DataModel/DG/GraphIndex/GraphIndex.cs @@ -0,0 +1,6 @@ +/// +/// An index to graph nodes. Allows to look up nodes by their source location. +/// +namespace SEE.DataModel.DG.GraphIndex +{ +} diff --git a/Assets/SEE/DataModel/DG/GraphIndex/GraphIndex.cs.meta b/Assets/SEE/DataModel/DG/GraphIndex/GraphIndex.cs.meta new file mode 100644 index 0000000000..af56d9c090 --- /dev/null +++ b/Assets/SEE/DataModel/DG/GraphIndex/GraphIndex.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3b45df06409e5e8429e04c10470b4416 \ No newline at end of file diff --git a/Assets/SEE/DataModel/DG/GraphSearch/GraphFilter.cs b/Assets/SEE/DataModel/DG/GraphSearch/GraphFilter.cs index 0e9f1948ce..a71e88ed5c 100644 --- a/Assets/SEE/DataModel/DG/GraphSearch/GraphFilter.cs +++ b/Assets/SEE/DataModel/DG/GraphSearch/GraphFilter.cs @@ -4,7 +4,7 @@ namespace SEE.DataModel.DG.GraphSearch { /// - /// A configurable filter for graph elements, mainly intended for use with . + /// A configurable filter for graph elements, mainly intended for use with . /// public record GraphFilter : IGraphModifier { diff --git a/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs b/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs index f71a2c65cf..92b16f5dfe 100644 --- a/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs +++ b/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs @@ -1,172 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using FuzzySharp; - +/// +/// Offers search capability for s. +/// namespace SEE.DataModel.DG.GraphSearch { - /// - /// Allows searching for nodes by their source name. - /// The graph associated to this search may be dynamic – that is, when the graph changes - /// (for example, when a node is added), the search index will be updated accordingly. - /// Searches are fuzzy, i.e., they will return results even if the query does not match the - /// element's name exactly. - /// - /// To perform a search on the associated graph, call . - /// - public class GraphSearch : IObserver - { - /// - /// A mapping from names to a list of nodes with that name. - /// Is constructed in the constructor in order not to have to descend into the graph every - /// time a search is executed. - /// - private readonly IDictionary> elements; - - /// - /// The graph to be searched. - /// - public readonly Graph Graph; - - /// - /// The filter that is applied to the graph elements when they are searched. - /// - public GraphFilter Filter { get; } = new(); - - /// - /// The sorter that is applied to the graph elements when they are searched. - /// - public GraphSorter Sorter { get; } = new(); - - /// - /// Returns all graph modifiers that shall be applied to the search results. - /// - private IEnumerable Modifiers => new IGraphModifier[] { Filter, Sorter }; - - /// - /// Creates a new instance of for the given . - /// - /// The graph to be searched. - public GraphSearch(Graph graph) - { - Graph = graph; - elements = graph.Nodes().GroupBy(ElementToString).ToDictionary(g => g.Key, g => g.ToList()); - graph.Subscribe(this); - } - - /// - /// Performs a fuzzy search for the given in the graph, - /// by comparing it to the source name of the nodes. - /// Case will be ignored, and the query may be a substring of the source name (this is a fuzzy search). - /// - /// The query to be searched for. - /// A list of nodes which match the query. - public IEnumerable Search(string query, int limit = 10, int cutoff = 40) - { - IEnumerable<(int Score, Node Element)> results = Process.ExtractTop(FilterString(query), elements.Keys, limit: limit, cutoff: cutoff) - .SelectMany(x => Modifiers.ApplyAll(elements[x.Value]).Select(element => (x.Score, element))); - if (!Sorter.IsActive()) - { - // If we don't sort by any custom attribute, we sort by the fuzzy score. - results = results.OrderByDescending(x => x.Score); - } - return results.Select(x => x.Element); - } - - /// - /// Removes zero-width-spaces from the given , as well as whitespace at the - /// beginning and end, and converts the string to lowercase. - /// - /// The string which shall be filtered. - /// The filtered string. - public static string FilterString(string input) - { - const string zeroWidthSpace = "\u200B"; - return input.Trim().Replace(zeroWidthSpace, string.Empty).ToLowerInvariant(); - } - - /// - /// Adds the given to the dictionary. - /// - /// The element to be added. - private void AddElement(Node element) - { - string elementString = ElementToString(element); - if (elements.TryGetValue(elementString, out List list)) - { - list.Add(element); - } - else - { - elements.Add(elementString, new List { element }); - } - } - - /// - /// Removes the given from the dictionary. - /// - /// The element to be removed. - private void RemoveElement(Node element) - { - string elementString = ElementToString(element); - if (elements.TryGetValue(elementString, out List list)) - { - list.Remove(element); - if (list.Count == 0) - { - elements.Remove(elementString); - } - } - } - - /// - /// Converts the given to a searchable string. - /// - /// The element to be converted. - /// The string representation of the element. - private static string ElementToString(Node element) - { - return element.SourceName.ToLowerInvariant(); - } - - /// - /// Called when no more events will be fired from the graph. - /// - public void OnCompleted() - { - // Nothing to be done. - } - - /// - /// Called when an error occurs in the graph. - /// - /// The error which occurred. - public void OnError(Exception error) - { - throw error; - } - - /// - /// Called when a new event is fired from the graph. - /// - /// The event which was fired. - public void OnNext(ChangeEvent changeEvent) - { - // We want to update our mapping of names to nodes whenever a node is added or removed. - switch (changeEvent) - { - case NodeEvent { Change: ChangeType.Addition } nodeEvent: - AddElement(nodeEvent.Node); - break; - case NodeEvent { Change: ChangeType.Removal } nodeEvent: - RemoveElement(nodeEvent.Node); - break; - case IAttributeEvent { AttributeName: Node.SourceNameAttribute, Attributable: Node node }: - // If the source name of a node changes, we need to update the mapping. - RemoveElement(node); - AddElement(node); - break; - } - } - } } diff --git a/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs.meta b/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs.meta index eb6e0e3de4..e8d7e4d38c 100644 --- a/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs.meta +++ b/Assets/SEE/DataModel/DG/GraphSearch/GraphSearch.cs.meta @@ -1,3 +1,2 @@ fileFormatVersion: 2 -guid: e2bc5cd2ba5f498dbb66dc802641b47d -timeCreated: 1700171671 \ No newline at end of file +guid: 27ab88a2bde9eda4c82a7f0d8ddc98e5 \ No newline at end of file diff --git a/Assets/SEE/DataModel/DG/GraphSearch/GraphSorter.cs b/Assets/SEE/DataModel/DG/GraphSearch/GraphSorter.cs index a53a55976e..372bcaf7f6 100644 --- a/Assets/SEE/DataModel/DG/GraphSearch/GraphSorter.cs +++ b/Assets/SEE/DataModel/DG/GraphSearch/GraphSorter.cs @@ -5,7 +5,7 @@ namespace SEE.DataModel.DG.GraphSearch { /// - /// A configurable sorter for graph elements, mainly intended for use with . + /// A configurable sorter for graph elements, mainly intended for use with . /// public class GraphSorter : IGraphModifier { diff --git a/Assets/SEE/DataModel/DG/GraphSearch/IGraphModifier.cs b/Assets/SEE/DataModel/DG/GraphSearch/IGraphModifier.cs index f4b053be3e..efffcc1eb5 100644 --- a/Assets/SEE/DataModel/DG/GraphSearch/IGraphModifier.cs +++ b/Assets/SEE/DataModel/DG/GraphSearch/IGraphModifier.cs @@ -4,7 +4,7 @@ namespace SEE.DataModel.DG.GraphSearch { /// /// Modifies a collection of graph elements by filtering, sorting, or otherwise transforming it. - /// Intended for use with . + /// Intended for use with . /// public interface IGraphModifier { diff --git a/Assets/SEE/DataModel/DG/GraphSearch/NodeSearch.cs b/Assets/SEE/DataModel/DG/GraphSearch/NodeSearch.cs new file mode 100644 index 0000000000..4c9732508f --- /dev/null +++ b/Assets/SEE/DataModel/DG/GraphSearch/NodeSearch.cs @@ -0,0 +1,172 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using FuzzySharp; + +namespace SEE.DataModel.DG.GraphSearch +{ + /// + /// Allows searching for nodes by their source name. + /// The graph associated to this search may be dynamic – that is, when the graph changes + /// (for example, when a node is added), the search index will be updated accordingly. + /// Searches are fuzzy, i.e., they will return results even if the query does not match the + /// element's name exactly. + /// + /// To perform a search on the associated graph, call . + /// + public class NodeSearch : IObserver + { + /// + /// A mapping from names to a list of nodes with that name. + /// Is constructed in the constructor in order not to have to descend into the graph every + /// time a search is executed. + /// + private readonly IDictionary> elements; + + /// + /// The graph to be searched. + /// + public readonly Graph Graph; + + /// + /// The filter that is applied to the graph elements when they are searched. + /// + public GraphFilter Filter { get; } = new(); + + /// + /// The sorter that is applied to the graph elements when they are searched. + /// + public GraphSorter Sorter { get; } = new(); + + /// + /// Returns all graph modifiers that shall be applied to the search results. + /// + private IEnumerable Modifiers => new IGraphModifier[] { Filter, Sorter }; + + /// + /// Creates a new instance of for the given . + /// + /// The graph to be searched. + public NodeSearch(Graph graph) + { + Graph = graph; + elements = graph.Nodes().GroupBy(ElementToString).ToDictionary(g => g.Key, g => g.ToList()); + graph.Subscribe(this); + } + + /// + /// Performs a fuzzy search for the given in the graph, + /// by comparing it to the source name of the nodes. + /// Case will be ignored, and the query may be a substring of the source name (this is a fuzzy search). + /// + /// The query to be searched for. + /// A list of nodes which match the query. + public IEnumerable Search(string query, int limit = 10, int cutoff = 40) + { + IEnumerable<(int Score, Node Element)> results = Process.ExtractTop(FilterString(query), elements.Keys, limit: limit, cutoff: cutoff) + .SelectMany(x => Modifiers.ApplyAll(elements[x.Value]).Select(element => (x.Score, element))); + if (!Sorter.IsActive()) + { + // If we don't sort by any custom attribute, we sort by the fuzzy score. + results = results.OrderByDescending(x => x.Score); + } + return results.Select(x => x.Element); + } + + /// + /// Removes zero-width-spaces from the given , as well as whitespace at the + /// beginning and end, and converts the string to lowercase. + /// + /// The string which shall be filtered. + /// The filtered string. + public static string FilterString(string input) + { + const string zeroWidthSpace = "\u200B"; + return input.Trim().Replace(zeroWidthSpace, string.Empty).ToLowerInvariant(); + } + + /// + /// Adds the given to the dictionary. + /// + /// The element to be added. + private void AddElement(Node element) + { + string elementString = ElementToString(element); + if (elements.TryGetValue(elementString, out List list)) + { + list.Add(element); + } + else + { + elements.Add(elementString, new List { element }); + } + } + + /// + /// Removes the given from the dictionary. + /// + /// The element to be removed. + private void RemoveElement(Node element) + { + string elementString = ElementToString(element); + if (elements.TryGetValue(elementString, out List list)) + { + list.Remove(element); + if (list.Count == 0) + { + elements.Remove(elementString); + } + } + } + + /// + /// Converts the given to a searchable string. + /// + /// The element to be converted. + /// The string representation of the element. + private static string ElementToString(Node element) + { + return element.SourceName.ToLowerInvariant(); + } + + /// + /// Called when no more events will be fired from the graph. + /// + public void OnCompleted() + { + // Nothing to be done. + } + + /// + /// Called when an error occurs in the graph. + /// + /// The error which occurred. + public void OnError(Exception error) + { + throw error; + } + + /// + /// Called when a new event is fired from the graph. + /// + /// The event which was fired. + public void OnNext(ChangeEvent changeEvent) + { + // We want to update our mapping of names to nodes whenever a node is added or removed. + switch (changeEvent) + { + case NodeEvent { Change: ChangeType.Addition } nodeEvent: + AddElement(nodeEvent.Node); + break; + case NodeEvent { Change: ChangeType.Removal } nodeEvent: + RemoveElement(nodeEvent.Node); + break; + case IAttributeEvent { AttributeName: Node.SourceNameAttribute, Attributable: Node node }: + // If the source name of a node changes, we need to update the mapping. + RemoveElement(node); + AddElement(node); + break; + } + } + } +} diff --git a/Assets/SEE/DataModel/DG/GraphSearch/NodeSearch.cs.meta b/Assets/SEE/DataModel/DG/GraphSearch/NodeSearch.cs.meta new file mode 100644 index 0000000000..eb6e0e3de4 --- /dev/null +++ b/Assets/SEE/DataModel/DG/GraphSearch/NodeSearch.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e2bc5cd2ba5f498dbb66dc802641b47d +timeCreated: 1700171671 \ No newline at end of file diff --git a/Assets/SEE/DataModel/DG/IO/CSV.meta b/Assets/SEE/DataModel/DG/IO/CSV.meta new file mode 100644 index 0000000000..5cf5e21ac3 --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/CSV.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f2beb6baae89d7c4caa92f617ba48097 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/DataModel/DG/IO/CSV/CSV.cs b/Assets/SEE/DataModel/DG/IO/CSV/CSV.cs new file mode 100644 index 0000000000..2b532d162b --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/CSV/CSV.cs @@ -0,0 +1,6 @@ +/// +/// Import and export of graph element metrics in CSV. +/// +namespace SEE.DataModel.DG.IO.CSV +{ +} diff --git a/Assets/SEE/DataModel/DG/IO/CSV/CSV.cs.meta b/Assets/SEE/DataModel/DG/IO/CSV/CSV.cs.meta new file mode 100644 index 0000000000..f8614055fa --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/CSV/CSV.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 47f0ab4ace5fa664bbaaf46bc529354e \ No newline at end of file diff --git a/Assets/SEE/DataModel/DG/IO/MetricExporter.cs b/Assets/SEE/DataModel/DG/IO/CSV/MetricExporter.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/MetricExporter.cs rename to Assets/SEE/DataModel/DG/IO/CSV/MetricExporter.cs index be34c9f08d..23a2a48381 100644 --- a/Assets/SEE/DataModel/DG/IO/MetricExporter.cs +++ b/Assets/SEE/DataModel/DG/IO/CSV/MetricExporter.cs @@ -3,7 +3,7 @@ using System.Text; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.CSV { /// /// Exports node metrics of a graph to CSV files. diff --git a/Assets/SEE/DataModel/DG/IO/MetricExporter.cs.meta b/Assets/SEE/DataModel/DG/IO/CSV/MetricExporter.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MetricExporter.cs.meta rename to Assets/SEE/DataModel/DG/IO/CSV/MetricExporter.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/MetricImporter.cs b/Assets/SEE/DataModel/DG/IO/CSV/MetricImporter.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/MetricImporter.cs rename to Assets/SEE/DataModel/DG/IO/CSV/MetricImporter.cs index 5f7d8a5ed4..f1235a2a08 100644 --- a/Assets/SEE/DataModel/DG/IO/MetricImporter.cs +++ b/Assets/SEE/DataModel/DG/IO/CSV/MetricImporter.cs @@ -15,7 +15,7 @@ using CsvHelper.Configuration; using SEE.Utils; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.CSV { /// /// Imports node metrics from CSV files into the graph. diff --git a/Assets/SEE/DataModel/DG/IO/MetricImporter.cs.meta b/Assets/SEE/DataModel/DG/IO/CSV/MetricImporter.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MetricImporter.cs.meta rename to Assets/SEE/DataModel/DG/IO/CSV/MetricImporter.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/MetricsIO.cs b/Assets/SEE/DataModel/DG/IO/CSV/MetricsIO.cs similarity index 89% rename from Assets/SEE/DataModel/DG/IO/MetricsIO.cs rename to Assets/SEE/DataModel/DG/IO/CSV/MetricsIO.cs index 5c6344e71a..de815df4b6 100644 --- a/Assets/SEE/DataModel/DG/IO/MetricsIO.cs +++ b/Assets/SEE/DataModel/DG/IO/CSV/MetricsIO.cs @@ -1,4 +1,4 @@ -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.CSV { /// /// Input and output of node metrics in CSV. diff --git a/Assets/SEE/DataModel/DG/IO/MetricsIO.cs.meta b/Assets/SEE/DataModel/DG/IO/CSV/MetricsIO.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MetricsIO.cs.meta rename to Assets/SEE/DataModel/DG/IO/CSV/MetricsIO.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/GXL.meta b/Assets/SEE/DataModel/DG/IO/GXL.meta new file mode 100644 index 0000000000..69c72a04fb --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/GXL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e261ea4321ed5b49a1bfe170b46476d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/DataModel/DG/IO/GXL/GXL.cs b/Assets/SEE/DataModel/DG/IO/GXL/GXL.cs new file mode 100644 index 0000000000..cb1eb1f807 --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/GXL/GXL.cs @@ -0,0 +1,6 @@ +/// +/// Import and export of graphs in GXL. +/// +namespace SEE.DataModel.DG.IO.GXL +{ +} diff --git a/Assets/SEE/DataModel/DG/IO/GXL/GXL.cs.meta b/Assets/SEE/DataModel/DG/IO/GXL/GXL.cs.meta new file mode 100644 index 0000000000..e5f2ade927 --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/GXL/GXL.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3a6854ef8c24e6741b10bc92799f1326 \ No newline at end of file diff --git a/Assets/SEE/DataModel/DG/IO/GXLParser.cs b/Assets/SEE/DataModel/DG/IO/GXL/GXLParser.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/GXLParser.cs rename to Assets/SEE/DataModel/DG/IO/GXL/GXLParser.cs index 9bd09a04bb..cf858ac233 100644 --- a/Assets/SEE/DataModel/DG/IO/GXLParser.cs +++ b/Assets/SEE/DataModel/DG/IO/GXL/GXLParser.cs @@ -7,7 +7,7 @@ using Cysharp.Threading.Tasks; using SEE.Utils; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.GXL { /// /// Class responsible for parsing GXL files. diff --git a/Assets/SEE/DataModel/DG/IO/GXLParser.cs.meta b/Assets/SEE/DataModel/DG/IO/GXL/GXLParser.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/GXLParser.cs.meta rename to Assets/SEE/DataModel/DG/IO/GXL/GXLParser.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/GraphIO.cs b/Assets/SEE/DataModel/DG/IO/GXL/GraphIO.cs similarity index 95% rename from Assets/SEE/DataModel/DG/IO/GraphIO.cs rename to Assets/SEE/DataModel/DG/IO/GXL/GraphIO.cs index 52c5dcb06a..bf0a4a0fc8 100644 --- a/Assets/SEE/DataModel/DG/IO/GraphIO.cs +++ b/Assets/SEE/DataModel/DG/IO/GXL/GraphIO.cs @@ -1,4 +1,4 @@ -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.GXL { /// /// Input and output of graph data in GXL format. diff --git a/Assets/SEE/DataModel/DG/IO/GraphIO.cs.meta b/Assets/SEE/DataModel/DG/IO/GXL/GraphIO.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/GraphIO.cs.meta rename to Assets/SEE/DataModel/DG/IO/GXL/GraphIO.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/GraphReader.cs b/Assets/SEE/DataModel/DG/IO/GXL/GraphReader.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/GraphReader.cs rename to Assets/SEE/DataModel/DG/IO/GXL/GraphReader.cs index 90c5db0e05..efe2ece66b 100644 --- a/Assets/SEE/DataModel/DG/IO/GraphReader.cs +++ b/Assets/SEE/DataModel/DG/IO/GXL/GraphReader.cs @@ -6,7 +6,7 @@ using SEE.Utils.Paths; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.GXL { /// /// Reads a graph from a GXL file and returns it as a graph. diff --git a/Assets/SEE/DataModel/DG/IO/GraphReader.cs.meta b/Assets/SEE/DataModel/DG/IO/GXL/GraphReader.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/GraphReader.cs.meta rename to Assets/SEE/DataModel/DG/IO/GXL/GraphReader.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/GraphWriter.cs b/Assets/SEE/DataModel/DG/IO/GXL/GraphWriter.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/GraphWriter.cs rename to Assets/SEE/DataModel/DG/IO/GXL/GraphWriter.cs index b65cc24cc1..055b74a956 100644 --- a/Assets/SEE/DataModel/DG/IO/GraphWriter.cs +++ b/Assets/SEE/DataModel/DG/IO/GXL/GraphWriter.cs @@ -8,7 +8,7 @@ using Stream = System.IO.Stream; using XmlElement = System.Xml.XmlElement; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.GXL { /// /// Saves graphs in GXL format on disk. diff --git a/Assets/SEE/DataModel/DG/IO/GraphWriter.cs.meta b/Assets/SEE/DataModel/DG/IO/GXL/GraphWriter.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/GraphWriter.cs.meta rename to Assets/SEE/DataModel/DG/IO/GXL/GraphWriter.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/GraphsReader.cs b/Assets/SEE/DataModel/DG/IO/GXL/GraphsReader.cs similarity index 96% rename from Assets/SEE/DataModel/DG/IO/GraphsReader.cs rename to Assets/SEE/DataModel/DG/IO/GXL/GraphsReader.cs index 066b29e6db..1236c3e9be 100644 --- a/Assets/SEE/DataModel/DG/IO/GraphsReader.cs +++ b/Assets/SEE/DataModel/DG/IO/GXL/GraphsReader.cs @@ -7,7 +7,7 @@ using SEE.Utils.Paths; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.GXL { /// /// Loads and stores multiple GXL files from a directory. @@ -75,7 +75,7 @@ public async UniTask LoadAsync(string directory, HashSet hierarchicalEdg if (File.Exists(csvFilename)) { Debug.Log($"Loading CSV file {csvFilename}.\n"); - int numberOfErrors = await MetricImporter.LoadCsvAsync(graph, csvFilename); + int numberOfErrors = await CSV.MetricImporter.LoadCsvAsync(graph, csvFilename); if (numberOfErrors > 0) { Debug.LogError($"CSV file {csvFilename} has {numberOfErrors} many errors.\n"); diff --git a/Assets/SEE/DataModel/DG/IO/GraphsReader.cs.meta b/Assets/SEE/DataModel/DG/IO/GXL/GraphsReader.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/GraphsReader.cs.meta rename to Assets/SEE/DataModel/DG/IO/GXL/GraphsReader.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/IO.cs b/Assets/SEE/DataModel/DG/IO/IO.cs index eb29105ca2..17c8fbe7ff 100644 --- a/Assets/SEE/DataModel/DG/IO/IO.cs +++ b/Assets/SEE/DataModel/DG/IO/IO.cs @@ -1,6 +1,6 @@ /// -/// SEE.DataModel.DG.IO provides input/output for persistent storage -/// and retrieval of data structures in SEE.DataModel.DG. +/// provides input/output for persistent storage +/// and retrieval of graph data structures in . /// namespace SEE.DataModel.DG.IO { diff --git a/Assets/SEE/DataModel/DG/IO/JaCoCoImporter.cs b/Assets/SEE/DataModel/DG/IO/JaCoCoImporter.cs deleted file mode 100644 index 9bb413da50..0000000000 --- a/Assets/SEE/DataModel/DG/IO/JaCoCoImporter.cs +++ /dev/null @@ -1,537 +0,0 @@ -using Cysharp.Threading.Tasks; -using SEE.Utils.Paths; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Xml; -using SEE.DataModel.DG.GraphIndex; -using UnityEngine; - -namespace SEE.DataModel.DG.IO -{ - /// - /// This class implements everything that is necessary to read a JaCoCo test report in - /// XML and adds the metrics to the graph nodes. - /// - internal static class JaCoCoImporter - { - /// - /// A report XML node is currently processed. - /// - private const string reportContext = "report"; - /// - /// A package XML node is currently processed. - /// - private const string packageContext = "package"; - /// - /// A class XML node is currently processed. - /// - private const string classContext = "class"; - /// - /// A method XML node is currently processed. - /// - private const string methodContext = "method"; - - /// - /// Loads a JaCoCo test report from the given assumed to - /// conform to the JaCoCo coverage report syntax. - /// The retrieved coverage metrics will be added to nodes of . - /// - /// Graph for which node metrics are to be imported. - /// Path to a data file containing JaCoCo data from which to import node metrics. - /// If is null. - /// If is null or empty. - public static async UniTask LoadAsync(Graph graph, DataPath path) - { - if (string.IsNullOrEmpty(path.Path)) - { - throw new ArgumentException("Data path must neither be null nor empty."); - } - Stream stream = await path.LoadAsync(); - await LoadAsync(graph, stream, path.Path); - } - - /// - /// Loads a JaCoCo test report from the given . - /// The retrieved coverage metrics will be added to nodes of . - /// - /// Graph where to add the metrics. - /// Where to read the JaCoCo input data from. - /// The name of the original JaCoCo file; used only for reporting. - /// If is null. - private static async UniTask LoadAsync(Graph graph, Stream stream, string jaCoCoFilename) - { - if (graph == null) - { - throw new ArgumentNullException(nameof(graph)); - } - if (graph.GetRoots().Count == 0) - { - // graph is empty. Nothing to do. - return; - } - - SourceRangeIndex index = new(graph, IndexPath); - - XmlReaderSettings settings = new() - { - CloseInput = true, - IgnoreWhitespace = true, - IgnoreComments = true, - Async = true, - DtdProcessing = DtdProcessing.Parse - }; - using XmlReader xmlReader = XmlReader.Create(stream, settings); - - // The fully qualified name of the package currently processed. - // The name is retrieved from JaCoCo's XML report, where - // a forward slash / is used as a separator, e.g., mypackage/mysubpackage. - // A package name may be empty (in cases where the default package was - // intended by a developer). - string packageName = string.Empty; - - // The fully qualified name of the currently processed class in JaCoCo's XML report, - // where a foward slash / is used as a separator, e.g., CodeFacts/CountConsonants. - // - // The qualifiedClassName contains the name of the path prefixed by the - // packages it is contained in. In Java, the name of a source file is - // the name of the main class in this file, appended by the file extension ".java". - // A Java file, however, may have other classes - inner classes as well as classes - // at the top level of the file. JaCoCo will report both kinds of non-main classes - // with the same filename (obviously) as the filename of the main class. Only the - // qualified name of non-main classes will differ. For instance, if we have a main - // class C in package P, the filename will be C.java and the qualified name will - // be P/C. If there is another class D in C.java that is not the main class, - // the file of that class will be C.java, too, and its qualified name will be - // P/D. If there is another class I nested in class C, the file of I will again - // be C.java, but its qualified name will be P/D$I. The delimiter $ is used - // to separate inner classes from the classes they are nested in. - string qualifiedClassName = null; - - // Name of the currently processed method. This value is used only for error messages. - string methodName = string.Empty; - - // The name of the source-code file for a class in JaCoCo's report, - // e.g. CountConsonants.java. This filename is apparently always a - // non-qualified name, that is, the directories this file is contained in - // are not part of this name. - string sourceFilename = null; - - // Source line as retrieved from JaCoCo's XML report, -1 if not set. - // - // Note that classes do not have a source line in JaCoCo's XML report, - // only methods have. - int sourceLine = -1; - - // Type of the XML node in JaCoCo's report currently processed, that is, the - // one to add the metrics, to. This can be any of reportContext, packageContext, - // classContext, or methodContext. - string nodeType; - - // Note: A report clause is the outermost XML node and may have immediate - // counter clauses itself. E.g.: - // - // - // - // - // - // - - // Stack to store the XML node type, that is, the values of nodeType. - // The inner-most XML node type is at the top. This gives us the context - // we are currently working in. The XML nodes may be nested deeply. - Stack nodeTypeStack = new(); - - // True if the currently processed XML node type is "sourcefile". If true, the - // read metrics will be ignored. - bool inSourcefile = false; - - while (await xmlReader.ReadAsync()) - { - switch (xmlReader.NodeType) - { - case XmlNodeType.Element: - if (xmlReader.Name is reportContext or packageContext or classContext or methodContext) - { - if (xmlReader.Name == classContext) - { - // Attribute sourcefilename consists of the simple filename including the - // file extension ".java" but excluding the directories this file is - // contained in. - sourceFilename = xmlReader.GetAttribute("sourcefilename"); - // Attribute 'name' consists of the fully qualified class name where - // a slash / is used as a separator. - qualifiedClassName = xmlReader.GetAttribute("name"); - } - else if (xmlReader.Name == methodContext) - { - // Attribute line refers to the line in which the opening curly bracket - // of the method's body occurs within its source file. - sourceLine = int.Parse(xmlReader.GetAttribute("line")); - methodName = xmlReader.GetAttribute("name"); - } - else if (xmlReader.Name == packageContext) - { - packageName = xmlReader.GetAttribute("name"); - if (string.IsNullOrWhiteSpace(packageName)) - { - Debug.LogWarning($"{XMLSourcePosition(jaCoCoFilename, xmlReader)}: " - + "Data for the default Java package (without name) were given. These will be ignored.\n"); - } - } - if (!xmlReader.IsEmptyElement) - { - // This is not a self-closing (empty) element, e.g., . - // Note: A corresponding EndElement node is not generated for empty elements. - // That is why we push a context onto the context stack only if the element is - // not self-closing. - nodeTypeStack.Push(xmlReader.Name); - } - else - { - Debug.LogWarning($"{XMLSourcePosition(jaCoCoFilename, xmlReader)}: " - + "Report does not provide coverage data for this entity.\n"); - } - - } - // skip sourcefile and its counter XML nodes - else if (xmlReader.Name == "sourcefile") - { - // From now on we are in the section where the executed lines are listed - // in the XML report. - inSourcefile = true; - } - else if (!inSourcefile && xmlReader.Name == "counter") - { - // An XML node 'counter' may occur both nested in a sourcefile clause and - // in a class clause. When we arrive here, the counter is one in - // a class clause. These counters are processed and added to a graph node. - nodeType = nodeTypeStack.Peek(); - - try - { - if (nodeType == packageContext) - { - if (string.IsNullOrWhiteSpace(packageName)) - { - // There is no chance to add metrics if we have an empty link name. - // It is not an error, though, because a developer could have nested - // a class within the default package, which does not have a name. - // If we encounter this case, we have already reported it above. - } - else - { - // Packages have no source range and, hence, are not represented in the - // source-range index. We need to use a different approach to retrieve their - // node from the graph. - // We do that via the unique ID of a package node, which is assumed to be - // the fully qualified name of the packages where individual packages are - // separated by a period. - AddMetricsToClassOrPackage(graph, xmlReader, packageName, jaCoCoFilename); - } - } - else if (nodeType == classContext) - { - // JaCoCo uses a similar way to represent the qualified name of a class - // as how our graph does for unique IDs for classes - except that JaCoCo - // uses / as a delimiter between simple names and our graph uses a period - // as a delimiter. Also inner classes are named equally: both JaCoCo and - // our unique IDs for graph nodes uses $ to separate the name of the inner - // class from its nesting class. That allows us to retrieve classes directly - // from the graph without the need for source positions. - // Note also that non-main classes in Java (top-level classes declared non-public - // in a file which already declares a public top-level class) will not cause any - // problem. For instance, if a non-main class C were declared in a file X.java - // which declares a main class X contained in package P, there cannot be another - // file declaring a main class C as a sibling to X within P in the package hierarchy. - // Both would have the name P.C in our graph. Yet, that would be illegal Java - // code and, hence, cannot happen. - AddMetricsToClassOrPackage(graph, xmlReader, qualifiedClassName, jaCoCoFilename); - } - else if (nodeType == reportContext) - { - // We add all metrics reported at the report level to the root of the graph. - // A non-empty graph has always a root node. - // Note that we might override the values of another node -- happened to be the - // root -- that we processed previously and for which we added metrics. - AddMetrics(xmlReader, graph.GetRoots()[0]); - } - else if (index.TryGetValue(MainTypeName(AsJavaQualifiedName(qualifiedClassName), sourceFilename), - sourceLine, out Node nodeToAddMetrics)) - { - AddMetrics(xmlReader, nodeToAddMetrics); - } - else - { - // We are in a method context. - Debug.LogError($"{XMLSourcePosition(jaCoCoFilename, xmlReader)}: " - + $"No node found for {nodeType} {AsJavaQualifiedName(qualifiedClassName)}.{methodName}:{sourceLine} " - + $"using key {MainTypeName(AsJavaQualifiedName(qualifiedClassName), sourceFilename)}.\n"); - } - } - catch (Exception e) - { - Debug.LogError($"{XMLSourcePosition(jaCoCoFilename, xmlReader)}: {e.Message}.\n"); - throw; - } - } - break; - - // re-sets attributes to default when tag is closed - case XmlNodeType.EndElement: - if (xmlReader.Name is reportContext or packageContext or classContext or methodContext) - { - // Only for the XML nodes listed in the condition above, we pushed a context. - nodeTypeStack.Pop(); - - if (xmlReader.Name == classContext) - { - qualifiedClassName = null; - sourceFilename = null; - methodName = string.Empty; - } - else if (xmlReader.Name == methodContext) - { - sourceLine = -1; - } - else if (xmlReader.Name == packageContext) - { - packageName = string.Empty; - } - } - else if (xmlReader.Name == "sourcefile") - { - inSourcefile = false; - } - break; - } - } - return; - - // Retrieves the counter metrics from xmlReader and adds them to nodeToAddMetrics - static void AddMetrics(XmlReader xmlReader, Node nodeToAddMetrics) - { - int missed = int.Parse(xmlReader.GetAttribute("missed")!, CultureInfo.InvariantCulture.NumberFormat); - int covered = int.Parse(xmlReader.GetAttribute("covered")!, CultureInfo.InvariantCulture.NumberFormat); - - string metricNamePrefix = JaCoCo.Prefix + xmlReader.GetAttribute("type"); - - nodeToAddMetrics.SetInt(metricNamePrefix + "_missed", missed); - nodeToAddMetrics.SetInt(metricNamePrefix + "_covered", covered); - - float percentage = covered + missed > 0 ? (float)covered / (covered + missed) * 100 : 0; - nodeToAddMetrics.SetFloat(metricNamePrefix + "_percentage", percentage); - } - - // Retrieves the counter metrics from xmlReader and adds them to a package or class - // node retrieved from the given graph having the given uniqueID. - // Note: the actually used node ID is uniqueID where every / is replaced by a period. - static void AddMetricsToClassOrPackage(Graph graph, XmlReader xmlReader, string uniqueID, string jaCoCoFilename) - { - // JaCoCo uses "/" as a separator for packages and classes while our graph is - // assumed to use a period "." to separate package/class names in unique IDs. - if (uniqueID == null) - { - Debug.LogError($"{XMLSourcePosition(jaCoCoFilename, xmlReader)}: uniqueID is null.\n"); - } - Node packageOrClassNode = graph.GetNode(uniqueID.Replace("/", ".")); - if (packageOrClassNode != null) - { - AddMetrics(xmlReader, packageOrClassNode); - } - else - { - Debug.LogError($"{XMLSourcePosition(jaCoCoFilename, xmlReader)}: No node found for package/class {uniqueID}.\n"); - } - } - } - - /// - /// Returns the source position of the XML code currently processed by . - /// The position is reported as :line:column. In case no source position - /// can be retrieved : will returned. - /// - /// name of the XML file currently processed - /// the XML reader processing the XML file - /// the source position of the XML file - private static string XMLSourcePosition(string filepath, XmlReader xmlReader) - { - string position = ""; - - if (xmlReader is IXmlLineInfo xmlLineInfo && xmlLineInfo.HasLineInfo()) - { - position = $"{xmlLineInfo.LineNumber}:{xmlLineInfo.LinePosition}"; - } - - return $"{filepath}:{position}"; - } - - /// - /// The character used to separate elements in a path. This separator is used - /// both in the JaCoCo XML report for qualified class names and the prefix. - /// - private const char jacocoSeparator = '/'; - - /// - /// A qualified name in Java is a set of words separated by a period as a delimiter. - /// JaCoCo, however, uses a forward slash as a delimiter. This method returns - /// where each forward slash has - /// been replaced by a period. - /// - /// Qualified name in JaCoCo syntax to be converted. - /// where each forward slash was replaced - /// by a period. - /// Thrown in case - /// is null or empty. - private static string AsJavaQualifiedName(string qualifiedJaCoCoTypeName) - { - if (string.IsNullOrEmpty(qualifiedJaCoCoTypeName)) - { - throw new ArgumentException("The qualified name of a class must not be empty."); - } - return qualifiedJaCoCoTypeName.Replace(jacocoSeparator, '.'); - } - - /// - /// The name of all node types representing types in Java. - /// - private static readonly HashSet typeNodeTypes - = new() { "Class", "Interface", "Class_Template", "Interface_Template"}; - - /// - /// Yields the path name of . - /// - /// If is a type, that is, its - /// is contained in , the fully qualified name of the - /// main type corresponding to this type is returned. - /// - /// The fully qualified name of a main type is the name of the type including - /// all the packages it is contained in, e.g., org.uni-bremen.mypackage.myclass - /// for a class named myclass declared in package org.uni-bremen.mypackage. A - /// period is used as a delimiter. - /// - /// What is a main type corresponding to a type? Java allows a file to declare multiple - /// types in the same file even at the top level. Only one of those declared at top - /// level may be public, however. - /// If there is only one type declared at the top level, that type is the main type. - /// If there are multiple types declared at the top level, the one declared as - /// public is the main type. - /// Other type declarations may be nested in types in Java. For inner (nested, not at - /// the top level) types, the main type is the main type corresponding to the - /// outer-most (top-level) type the inner type is contained in. - /// - /// For instance, if we have a file T.java with a main class T in package p - /// and a non-main class Z which in turn contains a nested class W, then the - /// result for T would be p.T, the result for Z would be p.T, too, the result for - /// W would again be p.T. - /// - /// Note: The filename for a main type T must be T.java in Java. This fact allows - /// us to distinguish the main type from other top-level types in a file. - /// - /// If is a method with p (obviously - /// a type in which the method is declared), then applied - /// to p is returned. For instance, if W had a method m in the example above, - /// then again p.T would be returned. - /// - /// For all other node types, null is returned. - /// - /// Node whose fully qualified name is to be retrieved. - /// Fully qualified name of the main type for the given . - private static string IndexPath(Node node) - { - if (node.Type == "Method") - { - // A Java method can be declared only within a type, thus, its - // parent node must be a type. - return IndexPath(node.Parent); - } - else if (typeNodeTypes.Contains(node.Type)) - { - return MainTypeName(node.ID, node.Filename); - } - else - { - // Node types different from a type and method will be ignored. - return null; - } - } - - /// - /// Returns a fully qualified Java name for the main type corresponding to the - /// given . - /// - /// Fully qualified Java name of a type. - /// The Java filename in which the type is declared. - /// Fully qualified Java name for main type corresponding to the - /// given . - private static string MainTypeName(string qualifiedJavaTypeName, string filename) - { - // The ID (Linkage.Name) of a main type Y declared in package p - // is p.Y. - // - // Likewise, the ID of a type Z declared at top level, but - // different from the main type, is p.Z where p is the package - // the corresponding main type is declared in. Whether a top-level - // type is the main type can be determined by checking the - // source filename. A main type T is contained in a file named - // T.java; if that is not the case, the type is not a main type. - // - // The ID of an inner type W nested in a type Z declared in a - // package p is p.Z$W. The delimiter $ is used to separate inner - // types from their containing type. - - string outerMostType = OuterMostType(qualifiedJavaTypeName); - // outerMostType could denote a main type or another top-level - // type that is not a main type. The two can be distinguished - // using the source filename. - (string parentName, string simpleName) = SimpleName(outerMostType); - string typeAccordingToFilename = Path.GetFileNameWithoutExtension(filename); - if (simpleName == typeAccordingToFilename) - { - // It is a main type. - return outerMostType; - } - else - { - // It is a top-level type that is not the main type. The filename - // gives us the name of the main type this type corresponds to. - return parentName.Length == 0 ? - typeAccordingToFilename : parentName + "." + typeAccordingToFilename; - } - - // If id does not contain the delimiter $, id is returned. - // Otherwise the substring from the first character of id - // until (and excluding) the first occurrence of the delimiter $ - // is returned. - static string OuterMostType(string id) - { - // First occurrence of the delimiter for a nested type. - int i = id.IndexOf('$'); - if (i == -1) - { - // This type is already an outer-most type. - return id; - } - // Note: i == 0 is impossible; otherwise the type's name were only $. - return id[..i]; - } - - // Returns the last name in the given qualified name. - // The first element of the result is the fully qualified name - // of the parent and the second element is the last simple name. - static (string, string) SimpleName(string qualifiedName) - { - int i = qualifiedName.LastIndexOf(".", StringComparison.Ordinal); - if (i == -1) - { - return (string.Empty, qualifiedName); - } - else - { - return (qualifiedName[..i], qualifiedName[..^i]); - } - } - } - } -} diff --git a/Assets/SEE/DataModel/DG/IO/JaCoCoImporter.cs.meta b/Assets/SEE/DataModel/DG/IO/JaCoCoImporter.cs.meta deleted file mode 100644 index fdbbc32ab6..0000000000 --- a/Assets/SEE/DataModel/DG/IO/JaCoCoImporter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5fe793c0a72899e4fab4851bbd5d70ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/DataModel/DG/IO/ReportImports.meta b/Assets/SEE/DataModel/DG/IO/ReportImports.meta new file mode 100644 index 0000000000..6227e71e1a --- /dev/null +++ b/Assets/SEE/DataModel/DG/IO/ReportImports.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b282170af5dc7cb4694f5ed1a27110b6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/DataModel/DG/IO/CSharpIndexNodeStrategy.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/CSharpIndexNodeStrategy.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/CSharpIndexNodeStrategy.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/CSharpIndexNodeStrategy.cs index 1c3b0ec3ae..47cd473bf7 100644 --- a/Assets/SEE/DataModel/DG/IO/CSharpIndexNodeStrategy.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/CSharpIndexNodeStrategy.cs @@ -2,7 +2,7 @@ using System; using System.IO; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Tool-agnostic index strategy for C# reports. diff --git a/Assets/SEE/DataModel/DG/IO/CSharpIndexNodeStrategy.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/CSharpIndexNodeStrategy.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/CSharpIndexNodeStrategy.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/CSharpIndexNodeStrategy.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/CheckstyleParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/CheckstyleParsingConfig.cs similarity index 97% rename from Assets/SEE/DataModel/DG/IO/CheckstyleParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/CheckstyleParsingConfig.cs index 67f386babc..e76f8beda4 100644 --- a/Assets/SEE/DataModel/DG/IO/CheckstyleParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/CheckstyleParsingConfig.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Contains parser configuration and node-indexing helpers for importing external analysis reports. @@ -17,6 +18,7 @@ namespace SEE.DataModel.DG.IO /// Metrics are configured per context (see ), /// so the parser does not need XPath hacks that force irrelevant metrics to evaluate to NaN. /// + [Serializable] internal sealed class CheckstyleParsingConfig : XmlParsingConfig { /// diff --git a/Assets/SEE/DataModel/DG/IO/CheckstyleParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/CheckstyleParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/CheckstyleParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/CheckstyleParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/Finding.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/Finding.cs similarity index 97% rename from Assets/SEE/DataModel/DG/IO/Finding.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/Finding.cs index dbeddfcbbe..b169551295 100644 --- a/Assets/SEE/DataModel/DG/IO/Finding.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/Finding.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Represents a single parsed report element together with its metrics and optional location data. diff --git a/Assets/SEE/DataModel/DG/IO/Finding.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/Finding.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/Finding.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/Finding.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/IIndexNodeStrategy.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/IIndexNodeStrategy.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/IIndexNodeStrategy.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/IIndexNodeStrategy.cs index 6b0db279d2..7e24c35c93 100644 --- a/Assets/SEE/DataModel/DG/IO/IIndexNodeStrategy.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/IIndexNodeStrategy.cs @@ -1,4 +1,4 @@ -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Strategy interface for normalizing code element identifiers from external tools diff --git a/Assets/SEE/DataModel/DG/IO/IIndexNodeStrategy.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/IIndexNodeStrategy.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/IIndexNodeStrategy.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/IIndexNodeStrategy.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/IReportParser.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/IReportParser.cs similarity index 96% rename from Assets/SEE/DataModel/DG/IO/IReportParser.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/IReportParser.cs index 71bc310fa6..c13e6fef41 100644 --- a/Assets/SEE/DataModel/DG/IO/IReportParser.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/IReportParser.cs @@ -2,7 +2,7 @@ using System.Threading; using SEE.Utils.Paths; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Defines the contract for components that transform raw report files into diff --git a/Assets/SEE/DataModel/DG/IO/IReportParser.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/IReportParser.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/IReportParser.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/IReportParser.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/JaCoCoParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/JaCoCoParsingConfig.cs similarity index 97% rename from Assets/SEE/DataModel/DG/IO/JaCoCoParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/JaCoCoParsingConfig.cs index 78d7af2fb2..92ce40df46 100644 --- a/Assets/SEE/DataModel/DG/IO/JaCoCoParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/JaCoCoParsingConfig.cs @@ -1,14 +1,16 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; /// /// Contains types for parsing external tool reports and applying their metrics to SEE dependency graphs. /// -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Parsing configuration for JaCoCo XML reports. /// /// Preconditions: An instance must be used only with JaCoCo-compatible XML input. + [Serializable] internal sealed class JaCoCoParsingConfig : XmlParsingConfig { /// diff --git a/Assets/SEE/DataModel/DG/IO/JaCoCoParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/JaCoCoParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/JaCoCoParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/JaCoCoParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/JavaIndexNodeStrategy.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/JavaIndexNodeStrategy.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/JavaIndexNodeStrategy.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/JavaIndexNodeStrategy.cs index ffd7610e46..33d2c00c8d 100644 --- a/Assets/SEE/DataModel/DG/IO/JavaIndexNodeStrategy.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/JavaIndexNodeStrategy.cs @@ -2,7 +2,7 @@ using System; using System.IO; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Strategy for normalizing Java code element identifiers to logical Identifiers for node lookup in . diff --git a/Assets/SEE/DataModel/DG/IO/JavaIndexNodeStrategy.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/JavaIndexNodeStrategy.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/JavaIndexNodeStrategy.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/JavaIndexNodeStrategy.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/JsonParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonParsingConfig.cs similarity index 58% rename from Assets/SEE/DataModel/DG/IO/JsonParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/JsonParsingConfig.cs index 1ca65b03d6..48db41eacc 100644 --- a/Assets/SEE/DataModel/DG/IO/JsonParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonParsingConfig.cs @@ -1,13 +1,21 @@ -namespace SEE.DataModel.DG.IO +using System; +using UnityEngine; + +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Configuration for parsing JSON-based reports using JSONPath mappings. /// + [Serializable] public abstract class JsonParsingConfig : ParsingConfig { /// /// Describes which JSON tokens to visit and how to interpret them. /// + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] public JsonPathMapping JsonMapping = new(); internal override IReportParser CreateParser() diff --git a/Assets/SEE/DataModel/DG/IO/JsonParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/JsonParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/JsonParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/JsonPathMapping.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonPathMapping.cs similarity index 100% rename from Assets/SEE/DataModel/DG/IO/JsonPathMapping.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/JsonPathMapping.cs diff --git a/Assets/SEE/DataModel/DG/IO/JsonPathMapping.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonPathMapping.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/JsonPathMapping.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/JsonPathMapping.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/JsonReportParser.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonReportParser.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/JsonReportParser.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/JsonReportParser.cs index f2df54b2e4..73cdeb2be3 100644 --- a/Assets/SEE/DataModel/DG/IO/JsonReportParser.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonReportParser.cs @@ -8,7 +8,7 @@ using System.Threading; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Generic JSON parser that uses a to translate report files diff --git a/Assets/SEE/DataModel/DG/IO/JsonReportParser.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/JsonReportParser.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/JsonReportParser.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/JsonReportParser.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/MSBuildParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/MSBuildParsingConfig.cs similarity index 96% rename from Assets/SEE/DataModel/DG/IO/MSBuildParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/MSBuildParsingConfig.cs index 6bebf2f35b..db9f07a12c 100644 --- a/Assets/SEE/DataModel/DG/IO/MSBuildParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/MSBuildParsingConfig.cs @@ -1,7 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Text.RegularExpressions; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Parsing configuration for MSBuild C# compiler output (warnings and errors). @@ -17,6 +18,7 @@ namespace SEE.DataModel.DG.IO /// ...\PlayerController.cs(42,15): warning CS0219: Variable is assigned but never used [...csproj] /// /// + [Serializable] internal sealed class MSBuildParsingConfig : TextParsingConfig { /// diff --git a/Assets/SEE/DataModel/DG/IO/MSBuildParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/MSBuildParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MSBuildParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/MSBuildParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/MetricApplier.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricApplier.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/MetricApplier.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/MetricApplier.cs index 4b0b560721..61a6e060ac 100644 --- a/Assets/SEE/DataModel/DG/IO/MetricApplier.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricApplier.cs @@ -4,7 +4,7 @@ using SEE.DataModel.DG.GraphIndex; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Translates parsed findings into node metrics on a instance. diff --git a/Assets/SEE/DataModel/DG/IO/MetricApplier.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricApplier.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MetricApplier.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/MetricApplier.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/MetricLocation.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricLocation.cs similarity index 94% rename from Assets/SEE/DataModel/DG/IO/MetricLocation.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/MetricLocation.cs index e3c776e9e1..91b082fb9d 100644 --- a/Assets/SEE/DataModel/DG/IO/MetricLocation.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricLocation.cs @@ -1,4 +1,4 @@ -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Optional source-code location for a finding. diff --git a/Assets/SEE/DataModel/DG/IO/MetricLocation.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricLocation.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MetricLocation.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/MetricLocation.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/MetricSchema.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricSchema.cs similarity index 93% rename from Assets/SEE/DataModel/DG/IO/MetricSchema.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/MetricSchema.cs index 007f8ee853..da64e69689 100644 --- a/Assets/SEE/DataModel/DG/IO/MetricSchema.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricSchema.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Container for all findings extracted from a single metrics report. diff --git a/Assets/SEE/DataModel/DG/IO/MetricSchema.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/MetricSchema.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/MetricSchema.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/MetricSchema.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/NUnitJsonParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/NUnitJsonParsingConfig.cs similarity index 96% rename from Assets/SEE/DataModel/DG/IO/NUnitJsonParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/NUnitJsonParsingConfig.cs index 9c63087f9f..7c068d0a45 100644 --- a/Assets/SEE/DataModel/DG/IO/NUnitJsonParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/NUnitJsonParsingConfig.cs @@ -1,11 +1,13 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Parsing configuration for OpenCover/ReportGenerator JSON summary reports. /// Supports 'class' contexts. /// + [Serializable] internal sealed class NUnitJsonParsingConfig : JsonParsingConfig { /// diff --git a/Assets/SEE/DataModel/DG/IO/NUnitJsonParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/NUnitJsonParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/NUnitJsonParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/NUnitJsonParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/ParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfig.cs similarity index 83% rename from Assets/SEE/DataModel/DG/IO/ParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfig.cs index 07f0706b0b..e8e39f3cd7 100644 --- a/Assets/SEE/DataModel/DG/IO/ParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfig.cs @@ -3,26 +3,35 @@ using SEE.Utils.Config; using System; using System.Collections.Generic; +using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Base configuration that describes how a specific tool's report should be interpreted. /// + [Serializable] public abstract class ParsingConfig { /// /// Identifier that ties parsed metrics to their origin (for example, "JaCoCo"). /// This value must not be null when a parser uses this configuration. /// + /// This is not a user setting, yet it must be saved to a configuration file. + /// It will be used to identify what type of must + /// instantiated when reading a configuration file. It depends solely on the type + /// of report data and will be set by the subclasses appropriately. + [HideInInspector] public string ToolId = string.Empty; /// - /// Optional marker used to normalize file paths between the GLX graph and the external tool report. + /// Optional marker used to normalize file paths between the internal graph + /// and the external tool report. /// - /// Some tools emit absolute paths or paths rooted differently than the GLX input. When this value is set, - /// tries to cut off everything up to - /// the last occurrence of this marker and returns the remaining path relative to that "source root". + /// Some tools emit absolute paths or paths rooted differently than the + /// internal graph. When this value is set, + /// tries to cut off everything up to the last occurrence of this marker and + /// returns the remaining path relative to that "source root". /// /// Example: /// @@ -31,8 +40,14 @@ public abstract class ParsingConfig /// result = "com/acme/Foo.java" /// /// - /// Leave this empty if report paths and GLX paths already match. + /// Leave this empty if report paths and paths in the graph already match. /// + /// This is a user setting. It must be saved to a configuration file. + [Tooltip("Marks the root of external paths of the import. " + + "If set, it will be used to normalize imported paths to match the paths in the the current graph. " + + "For instance, if an external path is 'C:/work/proj/src/main/java/com/acme/Foo.java' " + + "and this setting is 'src/main/java', the normalized path will be 'com/acme/Foo.java'. " + + "Leave empty if the paths match already.")] public string SourceRootMarker = string.Empty; /// diff --git a/Assets/SEE/DataModel/DG/IO/ParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/ParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/ParsingConfigFactory.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfigFactory.cs similarity index 98% rename from Assets/SEE/DataModel/DG/IO/ParsingConfigFactory.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfigFactory.cs index de6fc15d76..d34f2bc084 100644 --- a/Assets/SEE/DataModel/DG/IO/ParsingConfigFactory.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfigFactory.cs @@ -4,7 +4,7 @@ using System.Reflection; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// A factory for creating instances of . diff --git a/Assets/SEE/DataModel/DG/IO/ParsingConfigFactory.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfigFactory.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/ParsingConfigFactory.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/ParsingConfigFactory.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/TextParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/TextParsingConfig.cs similarity index 61% rename from Assets/SEE/DataModel/DG/IO/TextParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/TextParsingConfig.cs index 7a2f6e192e..a28aff65c6 100644 --- a/Assets/SEE/DataModel/DG/IO/TextParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/TextParsingConfig.cs @@ -1,7 +1,9 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Text.RegularExpressions; +using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Configuration for parsing line-oriented text reports using regular expressions. @@ -31,6 +33,7 @@ namespace SEE.DataModel.DG.IO /// } /// /// + [Serializable] public abstract class TextParsingConfig : ParsingConfig { /// @@ -40,60 +43,89 @@ public abstract class TextParsingConfig : ParsingConfig /// Each pattern should use named capture groups that can be referenced in other mappings. /// Preconditions: Must not be null when a text parser uses this configuration. /// - public Dictionary LinePatterns { get; set; } = new Dictionary(); + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] + public Dictionary LinePatterns { get; set; } = new(); /// /// Maps context names to template strings that build the full path identifier. /// Templates can reference named groups from using ${groupName} syntax. + /// + /// Preconditions: Dictionary keys must match contexts defined in . /// - /// Preconditions: Dictionary keys must match contexts defined in . - public Dictionary PathBuilders { get; set; } = new Dictionary(); + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] + public Dictionary PathBuilders { get; set; } = new(); /// /// Maps context names to template strings that extract the file name. /// Templates can reference named groups from using ${groupName} syntax. + /// + /// May be empty if file names are already captured in PathBuilders. /// - /// May be empty if file names are already captured in PathBuilders. - public Dictionary FileNameTemplates { get; set; } = new Dictionary(); + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] + public Dictionary FileNameTemplates { get; set; } = new(); /// /// Maps standard location field names to capture group names from the line patterns. - /// - /// /// Supported keys: StartLine, EndLine, StartColumn, EndColumn. /// Values should be capture group names (without ${} syntax). /// May be null if the report format does not provide explicit locations. - /// + /// + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] public Dictionary? LocationMapping { get; set; } /// /// Metric definitions keyed by context, each containing metric names mapped to template strings. /// Templates can reference named groups from using ${groupName} syntax. + /// + /// Preconditions: Outer dictionary keys must match contexts defined in . /// - /// Preconditions: Outer dictionary keys must match contexts defined in . - public Dictionary> MetricsByContext { get; set; } - = new Dictionary>(); + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] + public Dictionary> MetricsByContext { get; set; } = new(); /// /// Optional regex options applied to all patterns in . + /// + /// Defaults to RegexOptions.None if not specified. /// - /// Defaults to RegexOptions.None if not specified. + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] public RegexOptions RegexOptions { get; set; } = RegexOptions.None; /// /// Optional filter that determines which lines should be processed. /// If null, all lines are processed. If set, only lines matching this pattern are considered. + /// Useful for skipping header lines or filtering out noise in verbose reports. /// - /// Useful for skipping header lines or filtering out noise in verbose reports. + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] public string? LineFilter { get; set; } /// /// Creates a configured for text input. /// + /// An instance for text reports. /// /// Preconditions: and must be initialized. /// - /// An instance for text reports. internal override IReportParser CreateParser() { return new TextReportParser(this); diff --git a/Assets/SEE/DataModel/DG/IO/TextParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/TextParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/TextParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/TextParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/TextReportParser.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/TextReportParser.cs similarity index 99% rename from Assets/SEE/DataModel/DG/IO/TextReportParser.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/TextReportParser.cs index bfdb781263..14f45e27ad 100644 --- a/Assets/SEE/DataModel/DG/IO/TextReportParser.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/TextReportParser.cs @@ -8,7 +8,7 @@ using System.Threading; using UnityEngine; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Parser for line-oriented text reports that uses regular expressions to extract diff --git a/Assets/SEE/DataModel/DG/IO/TextReportParser.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/TextReportParser.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/TextReportParser.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/TextReportParser.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/XPathMapping.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/XPathMapping.cs similarity index 90% rename from Assets/SEE/DataModel/DG/IO/XPathMapping.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/XPathMapping.cs index ae351cb3fa..317c26d992 100644 --- a/Assets/SEE/DataModel/DG/IO/XPathMapping.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/XPathMapping.cs @@ -1,14 +1,16 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; /// /// Contains data model types for parsing and interpreting external tool reports in a . /// -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Encapsulates the XPath expressions used to traverse and interpret a report. /// All XPath expressions must be valid for the corresponding report format. /// + [Serializable] public class XPathMapping { /// @@ -21,13 +23,13 @@ public class XPathMapping /// Maps XML element names to XPath expressions that produce the full path identifier. /// /// Preconditions: Dictionary keys and values must not be null. - public Dictionary PathBuilders { get; set; } = new Dictionary(); + public Dictionary PathBuilders { get; set; } = new(); /// /// Maps XML element names (context) to XPath expressions that select the file name of a node. /// /// Preconditions: Dictionary keys and values must not be null. - public Dictionary FileName { get; set; } = new Dictionary(); + public Dictionary FileName { get; set; } = new(); /// /// Optional mapping from location field names to XPath expressions. @@ -39,8 +41,7 @@ public class XPathMapping /// Metric definitions keyed by their output name, each pointing to a context-specific XPath expression. /// /// Preconditions: Dictionary keys and values must not be null. - public Dictionary> MetricsByContext { get; set; } = - new Dictionary>(); + public Dictionary> MetricsByContext { get; set; } = new(); /// /// Optional namespace prefix or URI map for XPath evaluation. diff --git a/Assets/SEE/DataModel/DG/IO/XPathMapping.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/XPathMapping.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/XPathMapping.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/XPathMapping.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/XmlParsingConfig.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/XmlParsingConfig.cs similarity index 67% rename from Assets/SEE/DataModel/DG/IO/XmlParsingConfig.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/XmlParsingConfig.cs index 45b8a4c355..3edc1a4c6f 100644 --- a/Assets/SEE/DataModel/DG/IO/XmlParsingConfig.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/XmlParsingConfig.cs @@ -1,15 +1,23 @@ -namespace SEE.DataModel.DG.IO +using System; +using UnityEngine; + +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Configuration for parsing XML-based reports using XPath mappings. /// + [Serializable] public abstract class XmlParsingConfig : ParsingConfig { /// /// Describes which XML nodes to visit and how to interpret them. /// Must not be null when an XML parser uses this configuration. /// - public XPathMapping XPathMapping = new (); + /// This is not a user setting. It will not be saved to a configuration file. + /// It depends solely on the type of report data and will be set by the subclasses + /// appropriately. + [HideInInspector] + public XPathMapping XPathMapping = new(); /// /// Creates an configured for XML input. diff --git a/Assets/SEE/DataModel/DG/IO/XmlParsingConfig.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/XmlParsingConfig.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/XmlParsingConfig.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/XmlParsingConfig.cs.meta diff --git a/Assets/SEE/DataModel/DG/IO/XmlReportParser.cs b/Assets/SEE/DataModel/DG/IO/ReportImports/XmlReportParser.cs similarity index 98% rename from Assets/SEE/DataModel/DG/IO/XmlReportParser.cs rename to Assets/SEE/DataModel/DG/IO/ReportImports/XmlReportParser.cs index b53d63a796..608c767fff 100644 --- a/Assets/SEE/DataModel/DG/IO/XmlReportParser.cs +++ b/Assets/SEE/DataModel/DG/IO/ReportImports/XmlReportParser.cs @@ -12,7 +12,7 @@ /// /// Contains types for parsing external tool reports and applying their metrics to SEE dependency graphs. /// -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.ReportImports { /// /// Generic XML parser that uses a to translate report files @@ -124,7 +124,7 @@ private static MetricSchema ParseCore(XmlReader xmlReader, XmlParsingConfig pars throw new ArgumentNullException(nameof(parsingConfig.XPathMapping)); } - XPathDocument report = new XPathDocument(xmlReader); + XPathDocument report = new(xmlReader); XPathNavigator navigator = report.CreateNavigator(); // Optional: configure namespaces if provided by the mapping. @@ -139,7 +139,7 @@ private static MetricSchema ParseCore(XmlReader xmlReader, XmlParsingConfig pars } } - MetricSchema metricSchema = new MetricSchema + MetricSchema metricSchema = new() { ToolId = parsingConfig.ToolId ?? string.Empty }; diff --git a/Assets/SEE/DataModel/DG/IO/XmlReportParser.cs.meta b/Assets/SEE/DataModel/DG/IO/ReportImports/XmlReportParser.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/IO/XmlReportParser.cs.meta rename to Assets/SEE/DataModel/DG/IO/ReportImports/XmlReportParser.cs.meta diff --git a/Assets/SEE/Dissonance/ChatInputController.cs b/Assets/SEE/Dissonance/ChatInputController.cs index 1c73bea142..ad51c47980 100644 --- a/Assets/SEE/Dissonance/ChatInputController.cs +++ b/Assets/SEE/Dissonance/ChatInputController.cs @@ -1,5 +1,5 @@ -using SEE.Controls; -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Extensions; using System.Linq; using UnityEngine; using UnityEngine.EventSystems; diff --git a/Assets/SEE/Dissonance/Dissonance.cs b/Assets/SEE/Dissonance/Dissonance.cs new file mode 100644 index 0000000000..ec3eb20ea3 --- /dev/null +++ b/Assets/SEE/Dissonance/Dissonance.cs @@ -0,0 +1,6 @@ +/// +/// Dissonance voice and text chat components. +/// +namespace SEE.Dissonance +{ +} diff --git a/Assets/SEE/Dissonance/Dissonance.cs.meta b/Assets/SEE/Dissonance/Dissonance.cs.meta new file mode 100644 index 0000000000..4a26ec86e5 --- /dev/null +++ b/Assets/SEE/Dissonance/Dissonance.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cb9eeaffb39edb045bd7c6ac354159b4 \ No newline at end of file diff --git a/Assets/SEE/Dissonance/VoiceChatInputController.cs b/Assets/SEE/Dissonance/VoiceChatInputController.cs index 9fc132755c..35380f35c9 100644 --- a/Assets/SEE/Dissonance/VoiceChatInputController.cs +++ b/Assets/SEE/Dissonance/VoiceChatInputController.cs @@ -1,5 +1,5 @@ using Dissonance; -using SEE.Controls; +using SEE.Controls.KeyActions; using UnityEngine; namespace SEE.Dissonance diff --git a/Assets/SEE/Events.meta b/Assets/SEE/Events.meta new file mode 100644 index 0000000000..cabb8b8279 --- /dev/null +++ b/Assets/SEE/Events.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 908f5442409c3e349b1cdc61b157b65b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Events/Events.cs b/Assets/SEE/Events/Events.cs new file mode 100644 index 0000000000..12be0c39ef --- /dev/null +++ b/Assets/SEE/Events/Events.cs @@ -0,0 +1,6 @@ +/// +/// Events triggered when an observable changes. +/// +namespace SEE.Events +{ +} diff --git a/Assets/SEE/Events/Events.cs.meta b/Assets/SEE/Events/Events.cs.meta new file mode 100644 index 0000000000..baa10d1430 --- /dev/null +++ b/Assets/SEE/Events/Events.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e268efc92fa8a68488908d8c44cad69b \ No newline at end of file diff --git a/Assets/SEE/DataModel/Observable.cs b/Assets/SEE/Events/Observable.cs similarity index 99% rename from Assets/SEE/DataModel/Observable.cs rename to Assets/SEE/Events/Observable.cs index 6768d634bb..a14f366376 100644 --- a/Assets/SEE/DataModel/Observable.cs +++ b/Assets/SEE/Events/Observable.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace SEE.DataModel +namespace SEE.Events { /// /// Represents an observable class, that is, a class which emits events that subscribers can be notified of. @@ -114,4 +114,4 @@ protected void NotifyError(Exception error) } } } -} \ No newline at end of file +} diff --git a/Assets/SEE/DataModel/Observable.cs.meta b/Assets/SEE/Events/Observable.cs.meta similarity index 100% rename from Assets/SEE/DataModel/Observable.cs.meta rename to Assets/SEE/Events/Observable.cs.meta diff --git a/Assets/SEE/DataModel/ProxyObserver.cs b/Assets/SEE/Events/ProxyObserver.cs similarity index 99% rename from Assets/SEE/DataModel/ProxyObserver.cs rename to Assets/SEE/Events/ProxyObserver.cs index 498fa3a71f..e636450390 100644 --- a/Assets/SEE/DataModel/ProxyObserver.cs +++ b/Assets/SEE/Events/ProxyObserver.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace SEE.DataModel +namespace SEE.Events { public abstract partial class Observable { diff --git a/Assets/SEE/DataModel/ProxyObserver.cs.meta b/Assets/SEE/Events/ProxyObserver.cs.meta similarity index 100% rename from Assets/SEE/DataModel/ProxyObserver.cs.meta rename to Assets/SEE/Events/ProxyObserver.cs.meta diff --git a/Assets/SEE/Extensions.meta b/Assets/SEE/Extensions.meta new file mode 100644 index 0000000000..dd1eac99ea --- /dev/null +++ b/Assets/SEE/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b0081808ad67f754a93f7103158b226d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Extensions/CodeCityExtensions.cs b/Assets/SEE/Extensions/CodeCityExtensions.cs new file mode 100644 index 0000000000..c37842233d --- /dev/null +++ b/Assets/SEE/Extensions/CodeCityExtensions.cs @@ -0,0 +1,154 @@ +using SEE.Game; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Extension methods for code-city game objects. A code-city game object + /// is a under which game nodes and + /// game edges are placed to render a code city. + /// + internal static class CodeCityExtensions + { + /// + /// Returns true if a code city was drawn for this . + /// A code city is assumed to be drawn in there is at least one immediate child + /// of this that represents a graph node, i.e., has a + /// (checked by predicate . + /// + /// This predicate can be queried for game objects representing a code city, + /// that is, game objects that have an attached to + /// them. + /// + /// The code city to checked. + /// True if a code city was drawn. + /// Applicable to a game object representing a code city. + public static bool IsCodeCityDrawn(this GameObject codeCity) + { + return codeCity.transform.Cast().Any(child => child.gameObject.IsNode()); + } + + /// + /// Returns true if a code city was drawn for this and is active. + /// A code city is assumed to be drawn in there is at least one immediate child + /// of this game object that represents a graph node, i.e., has a + /// (checked by predicate . + /// + /// This predicate can be queried for game objects representing a code city, + /// that is, game objects that have an attached to + /// them. + /// + /// The code city to checked. + /// True if a code city was drawn and is active. + /// Applicable to a game object representing a code city. + public static bool IsCodeCityDrawnAndActive(this GameObject codeCity) + { + return codeCity.transform.Cast().Any(child => child.gameObject.IsNode() + && child.gameObject.activeInHierarchy); + } + + /// + /// Returns true if there is any edge in the given . + /// + /// The code city to checked. + /// True if there is any edge in the given . + /// Applicable to a game object representing a code city. + public static bool CodeCityHasAnyEdges(this GameObject codeCity) + { + // Edges are immediate children of the code-city game object. + return codeCity.transform.Cast().Any(child => child.gameObject.IsEdge() + && child.gameObject.activeInHierarchy); + } + + /// + /// Returns first child of tagged by + /// or null if none can be found. + /// + /// Object representing a code city (tagged by ). + /// Game object representing the root of the graph or null if there is none. + /// If is a node representing a code city, + /// the first child tagged as is considered the root of the graph. + /// + /// Thrown if is null. + /// + /// Applicable to a game object representing a code city. + public static GameObject GetCityRootNode(this GameObject codeCity) + { + if (codeCity == null) + { + throw new ArgumentNullException(nameof(codeCity)); + } + foreach (Transform child in codeCity.transform) + { + if (child.CompareTag(Tags.Node)) + { + return child.transform.gameObject; + } + } + return null; + } + + /// + /// Returns all game objects tagged as that are descendants + /// of . + /// + /// Root game object to be traversed. + /// All game objects tagged as . + /// Applicable to a game object representing a code city. + internal static IEnumerable AllEdges(this GameObject codeCity) + { + return codeCity.AllDescendants(Tags.Edge); + } + + /// + /// Returns all transitive children of tagged by + /// given (including itself). + /// + /// The game object whose children are requested. + /// The tag the descendants must have. + /// All transitive children with . + /// Although this method primarily intended for code cities, it is + /// also applicable to a game node. + public static List AllDescendants(this GameObject gameObject, string tag) + { + List result = new(); + if (gameObject.CompareTag(tag)) + { + result.Add(gameObject); + } + + foreach (Transform child in gameObject.transform) + { + result.AddRange(child.gameObject.AllDescendants(tag)); + } + + return result; + } + + /// + /// Applies to all (transitive) descendants of + /// (including ) if they have the given . + /// + /// The game object on which to apply the . + /// The tag the descendants must have. + /// The action to be applied. + /// Although this method primarily intended for code cities, it is + /// also applicable to a game node. + public static void ApplyToAllDescendants(this GameObject root, string tag, Action action) + { + if (root.CompareTag(tag)) + { + action(root); + } + + foreach (Transform child in root.transform) + { + child.gameObject.ApplyToAllDescendants(tag, action); + } + } + + } +} diff --git a/Assets/SEE/Extensions/CodeCityExtensions.cs.meta b/Assets/SEE/Extensions/CodeCityExtensions.cs.meta new file mode 100644 index 0000000000..8378441d76 --- /dev/null +++ b/Assets/SEE/Extensions/CodeCityExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 28c71a4eea3267f40893c793c2a399ae \ No newline at end of file diff --git a/Assets/SEE/Utils/ColorExtensions.cs b/Assets/SEE/Extensions/ColorExtensions.cs similarity index 90% rename from Assets/SEE/Utils/ColorExtensions.cs rename to Assets/SEE/Extensions/ColorExtensions.cs index 826ab6dbe9..0ca6c13368 100644 --- a/Assets/SEE/Utils/ColorExtensions.cs +++ b/Assets/SEE/Extensions/ColorExtensions.cs @@ -3,7 +3,7 @@ using System.Linq; using UnityEngine; -namespace SEE.Utils +namespace SEE.Extensions { /// /// Provides various extensions methods for the Color class. @@ -88,16 +88,5 @@ public static IEnumerable ToGradientColorKeys(this ICollection var n => colors.Select((c, i) => new GradientColorKey(c, (float)i / (n - 1))) }; } - - /// - /// Converts the given to a list of colors. - /// This simply extracts the colors from the keys. - /// - /// The keys to convert. - /// The converted keys as colors. - public static IEnumerable ToColors(this IEnumerable keys) - { - return keys.Select(c => c.color); - } } } diff --git a/Assets/SEE/Utils/ColorExtensions.cs.meta b/Assets/SEE/Extensions/ColorExtensions.cs.meta similarity index 100% rename from Assets/SEE/Utils/ColorExtensions.cs.meta rename to Assets/SEE/Extensions/ColorExtensions.cs.meta diff --git a/Assets/SEE/Extensions/Components.cs b/Assets/SEE/Extensions/Components.cs new file mode 100644 index 0000000000..29324c61e7 --- /dev/null +++ b/Assets/SEE/Extensions/Components.cs @@ -0,0 +1,68 @@ +using Sirenix.Utilities; +using System; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Provides extension methods to manage s + /// of . + /// + public static class Components + { + /// + /// Tries to get the component of the given type of this . + /// If the component was found, it will be stored in and true will be returned. + /// If it wasn't found, will be null, false will be returned, + /// and an error message will be logged indicating that the component type wasn't present on the GameObject. + /// + /// The game object the component should be gotten from. Must not be null. + /// The variable in which to save the component. + /// The type of the component. + /// True if the component was present on the , false otherwise. + public static bool TryGetComponentOrLog(this GameObject gameObject, out T component) + { + if (!gameObject.TryGetComponent(out component)) + { + Debug.LogError($"Couldn't find component '{typeof(T).GetNiceName()}' " + + $"on game object '{gameObject.FullName()}'.\n"); + return false; + } + + return true; + } + + /// + /// Tries to get the component of the given type of this . + /// If a component of the type was found, it will be returned, otherwise a new component of the type + /// will be added and returned. + /// + /// The gameobject whose component of type + /// we wish to return. + /// The component to get / add + /// The existing or newly created component. + public static T AddOrGetComponent(this GameObject gameObject) where T : Component + { + return gameObject.TryGetComponent(out T component) ? component : gameObject.AddComponent(); + } + + /// + /// Tries to get the component of the given type of this . + /// If the component was found, it will be returned. + /// If it wasn't found, will be thrown. + /// + /// The game object the component should be gotten from. Must not be null. + /// The type of the component. + /// Thrown if has no + /// component of type . + public static T MustGetComponent(this GameObject gameObject) + { + if (!gameObject.TryGetComponent(out T component)) + { + throw new InvalidOperationException($"Couldn't find component '{typeof(T).GetNiceName()}' on game object '{gameObject.FullName()}'"); + } + return component; + } + + } +} diff --git a/Assets/SEE/Extensions/Components.cs.meta b/Assets/SEE/Extensions/Components.cs.meta new file mode 100644 index 0000000000..4380833192 --- /dev/null +++ b/Assets/SEE/Extensions/Components.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b892cac513096ef43a983b45276b13cb \ No newline at end of file diff --git a/Assets/SEE/Extensions/Extensions.cs b/Assets/SEE/Extensions/Extensions.cs new file mode 100644 index 0000000000..e0fb89cd13 --- /dev/null +++ b/Assets/SEE/Extensions/Extensions.cs @@ -0,0 +1,7 @@ +/// +/// Provides extension methods for game objects (not limited to +/// game nodes and game edges; there are extensions for Color, too. +/// +namespace SEE.Extensions +{ +} diff --git a/Assets/SEE/Extensions/Extensions.cs.meta b/Assets/SEE/Extensions/Extensions.cs.meta new file mode 100644 index 0000000000..4b915a835f --- /dev/null +++ b/Assets/SEE/Extensions/Extensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5cac39b4fa4dd334d83220ea5aa90b4a \ No newline at end of file diff --git a/Assets/SEE/Extensions/GameEdgeExtensions.cs b/Assets/SEE/Extensions/GameEdgeExtensions.cs new file mode 100644 index 0000000000..6fca0a1709 --- /dev/null +++ b/Assets/SEE/Extensions/GameEdgeExtensions.cs @@ -0,0 +1,156 @@ +using SEE.DataModel.DG; +using SEE.Game; +using SEE.Game.Operator; +using SEE.GraphElementRefs; +using System; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Extension methods for game edges. A game edge is a + /// representing a . + /// + internal static class GameEdgeExtensions + { + /// + /// Returns true if has an + /// component attached to it whose edge is not null. + /// + /// The game object whose EdgeRef is checked. + /// True if has an + /// component attached to it whose edge is not null. + public static bool HasEdgeRef(this GameObject gameEdge) + { + return gameEdge.TryGetComponent(out EdgeRef edgeRef) && edgeRef.Value != null; + } + + /// + /// Returns true if is tagged by . + /// + /// The game object to check. + /// True if is tagged by . + public static bool IsEdge(this GameObject gameEdge) + { + return gameEdge.CompareTag(Tags.Edge); + } + + /// + /// Returns true if has an + /// component attached to it that is not null. + /// + /// The game object whose EdgeRef is checked. + /// The edge referenced by the attached EdgeRef; defined only if this method + /// returns true. + /// True if has an + /// component attached to it that is not null. + public static bool TryGetEdge(this GameObject gameEdge, out Edge edge) + { + edge = null; + if (gameEdge.TryGetComponent(out EdgeRef edgeRef)) + { + edge = edgeRef.Value; + } + return edge != null; + } + + /// + /// Returns the graph edge represented by this . + /// + /// Precondition: must have an + /// attached to it referring to a valid edge; if not, an exception is raised. + /// + /// The game object whose is requested. + /// The corresponding graph edge (will never be null). + /// Thrown if has + /// no valid or . + /// This method is similar to , but throws an exception + /// if the edge is not found. It is analogous to . + public static Edge GetEdge(this GameObject gameEdge) + { + if (gameEdge.TryGetComponent(out EdgeRef edgeRef)) + { + if (edgeRef != null) + { + if (edgeRef.Value != null) + { + return edgeRef.Value; + } + else + { + throw new NullReferenceException($"Edge referenced by game object {gameEdge.name} is null."); + } + } + else + { + throw new NullReferenceException($"Edge reference of game object {gameEdge.name} is null."); + } + } + else + { + throw new NullReferenceException($"Game object {gameEdge.name} has no {nameof(EdgeRef)}."); + } + } + + /// + /// Returns the source node of the given . + /// The is assumed to represent an edge, that is, + /// is tagged by and has an . + /// If this is not the case, an exception is thrown. If the source node + /// of this edge does not exist, an exception is thrown, too. + /// + /// Game object representing an edge. + /// The game object representing the source of this edge. + public static GameObject Source(this GameObject gameEdge) + { + if (gameEdge.CompareTag(Tags.Edge) && gameEdge.TryGetComponent(out EdgeRef edgeRef)) + { + return GraphElementIDMap.Find(edgeRef.SourceNodeID, mustFindElement: true); + } + else + { + throw new Exception($"Game object {gameEdge.name} is not an edge. It has no source node."); + } + } + + /// + /// Returns the target node of the given . + /// The is assumed to represent an edge, that is, + /// is tagged by and has an . + /// If this is not the case, an exception is thrown. If the target node + /// of this edge does not exist, an exception is thrown, too. + /// + /// Game object representing an edge. + /// The game object representing the target of this edge. + public static GameObject Target(this GameObject gameEdge) + { + if (gameEdge.CompareTag(Tags.Edge) && gameEdge.TryGetComponent(out EdgeRef edgeRef)) + { + return GraphElementIDMap.Find(edgeRef.SourceNodeID, mustFindElement: true); + } + else + { + throw new Exception($"Game object {gameEdge.name} is not an edge. It has no target node."); + } + } + + /// + /// Returns the for this . + /// If no operator exists yet, it will be added. + /// If the game object is not an edge, an exception will be thrown. + /// + /// The game object whose operator to retrieve. + /// The responsible for this . + public static EdgeOperator EdgeOperator(this GameObject gameEdge) + { + if (gameEdge.CompareTag(Tags.Edge)) + { + return gameEdge.AddOrGetComponent(); + } + else + { + throw new InvalidOperationException($"Cannot get {nameof(EdgeOperator)} for game object {gameEdge.name} because it is not an edge."); + } + } + } +} diff --git a/Assets/SEE/Extensions/GameEdgeExtensions.cs.meta b/Assets/SEE/Extensions/GameEdgeExtensions.cs.meta new file mode 100644 index 0000000000..8c6486bc28 --- /dev/null +++ b/Assets/SEE/Extensions/GameEdgeExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2738d7e1517978a4891fd580e8dc8718 \ No newline at end of file diff --git a/Assets/SEE/Extensions/GameNodeExtensions.cs b/Assets/SEE/Extensions/GameNodeExtensions.cs new file mode 100644 index 0000000000..1e438af5f4 --- /dev/null +++ b/Assets/SEE/Extensions/GameNodeExtensions.cs @@ -0,0 +1,395 @@ +using SEE.DataModel.DG; +using SEE.Game; +using SEE.Game.Operator; +using SEE.GraphElementRefs; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Extension methods for game nodes. A game node is a + /// representing a . + /// + internal static class GameNodeExtensions + { + /// + /// Returns the first immediate child of that + /// is a graph node, i.e., has a attached to it + /// (checked by predicate ) or null if there + /// is none. + /// + /// The game object whose child is to be retrieved. + /// First immediate child representing a node or null if there is none. + /// Applicable to game nodes only. + public static GameObject FirstChildNode(this GameObject gameObject) + { + foreach (Transform child in gameObject.transform) + { + if (child.gameObject.IsNode()) + { + return child.gameObject; + } + } + return null; + } + + /// + /// True if represents a leaf in the graph. + /// + /// Precondition: has a component + /// attached to it that is a valid graph node reference. + /// + /// Game object representing a Node to be queried whether it is a leaf. + /// True if represents a leaf in the graph. + /// Applicable to game nodes only. + public static bool IsLeaf(this GameObject gameNode) + { + return gameNode.TryGetNode(out Node node) && node.IsLeaf(); + } + + /// + /// True if represents the root of the graph. + /// + /// Precondition: has a component + /// attached to it that is a valid graph node reference. + /// + /// Game object representing a Node to be queried whether it is a root node. + /// True if represents a root in the graph. + /// Applicable to game nodes only. + public static bool IsRoot(this GameObject gameNode) + { + return gameNode.TryGetNode(out Node node) && node.IsRoot(); + } + + /// + /// True if represents the implementation or architecture root of + /// the graph. + /// + /// Precondition: has a component + /// attached to it that is a valid graph node reference. + /// + /// Game object representing a Node to be queried whether it is an implementation or architecture root. + /// True if represents an implementation or architecture root in the graph. + /// Applicable to game nodes only. + public static bool IsArchitectureOrImplementationRoot(this GameObject gameNode) + { + return gameNode.TryGetNode(out Node node) && node.IsArchitectureOrImplementationRoot(); + } + + /// + /// Returns the world-space y position of the roof of this . + /// + /// Game object whose roof has to be determined. + /// World-space y position of the roof of this . + /// This does not consider the position of descendants if there are any. + /// Consider if you want to + /// take descendants into account, too. + public static float GetRoof(this GameObject gameNode) + { + return gameNode.transform.position.y + gameNode.WorldSpaceSize().y / 2.0f; + } + + /// + /// Returns the maximal world-space position (y co-ordinate) of the roof of + /// this or any of its active descendants. + /// Unlike , this method recurses into + /// the game-object hierarchy rooted by . + /// + /// Note: only descendants that are currently active in the scene are considered. + /// + /// Game object whose height has to be determined. + /// Function returning true for descendant transforms that shall be taken into + /// account. By default, this is a constant function which always returns true. + /// World-space position of the roof of this + /// or any of its active descendants. + public static float GetMaxY(this GameObject gameNode, Func filterTransform = null) + { + float result = float.NegativeInfinity; + filterTransform ??= _ => true; + Recurse(gameNode, ref result); + return result; + + void Recurse(GameObject root, ref float max) + { + float roof = root.GetRoof(); + if (max < roof) + { + max = roof; + } + + foreach (Transform child in root.transform) + { + if (child.gameObject.activeInHierarchy && filterTransform(child)) + { + Recurse(child.gameObject, ref max); + } + } + } + } + + /// + /// Returns the maximal world-space center position of the hull of + /// this . The hull includes + /// and any of its active descendants. + /// Unlike , this method recurses into + /// the game-object hierarchy rooted by . + /// + /// Note: only descendants that are currently active in the scene are considered. + /// + /// Game object whose center top has to be determined. + /// Function returning true for descendant transforms that shall be taken into + /// account. By default, this is a constant function which always returns true. + /// World-space position of the center top of the hull of this . + /// + /// The result is in world space of . If your are interested + /// in local space, use instead. + public static Vector3 GetTop(this GameObject gameNode, Func filterTransform = null) + { + Vector3 result = gameNode.transform.position; + result.y = gameNode.GetMaxY(filterTransform); + return result; + } + + /// + /// Returns the maximal local-space center position of the hull of + /// this . The hull includes + /// and any of its active descendants. + /// Note: only descendants that are currently active in the scene are considered. + /// + /// Game object whose center top has to be determined. + /// Function returning true for descendant transforms that shall be taken into + /// account. By default, this is a constant function which always returns true. + /// Local-space position of the center top of the hull of this . + /// + /// The result is in local space of . If your are interested + /// in world space, use instead. + public static float GetRelativeTop(this GameObject gameNode, Func filterTransform = null) + { + float top = gameNode.GetMaxY(filterTransform); + return top - gameNode.transform.position.y; + } + + /// + /// Returns the world-space center position of the ground of this . + /// + /// Game object whose ground has to be determined. + /// World-space center position of the ground of this . + public static Vector3 GetGroundCenter(this GameObject gameNode) + { + Vector3 result = gameNode.transform.position; + result.y -= gameNode.WorldSpaceSize().y / 2.0f; + return result; + } + + /// + /// Sets the scale of this to independent from + /// the local scale of its parent. + /// + /// Object whose scale should be set. + /// The new scale in world space. + /// If true and is a graph node, + /// a will be used to animate the scaling; otherwise the + /// scale of is set immediately without any animation. + /// Is intended primarily for game nodes but also applicable to other kinds of + /// s. + public static void SetAbsoluteScale(this GameObject gameObject, Vector3 worldScale, bool animate = true) + { + Transform parent = gameObject.transform.parent; + gameObject.transform.parent = null; + if (animate && gameObject.HasNodeRef()) + { + NodeOperator @operator = gameObject.NodeOperator(); + @operator.ScaleTo(worldScale, 0f); + } + else + { + gameObject.transform.localScale = worldScale; + } + gameObject.transform.parent = parent; + } + + /// + /// Returns true if has a + /// component attached to it that is actually referring to a valid node + /// (i.e., its Value is not null). + /// + /// The game object whose NodeRef is checked. + /// True if has a + /// component attached to it whose node is non-null. + public static bool HasNodeRef(this GameObject gameNode) + { + return gameNode.TryGetComponent(out NodeRef nodeRef) && nodeRef.Value != null; + } + + /// + /// Returns true if is tagged by . + /// + /// The game object to check. + /// True if is tagged by . + public static bool IsNode(this GameObject gameNode) + { + return gameNode.CompareTag(Tags.Node); + } + + /// + /// Returns true if 's + /// is true and it is tagged by . + /// + /// The game object to check. + /// True if is an active node. + public static bool IsNodeAndActiveSelf(this GameObject gameNode) + { + return gameNode.activeSelf && gameNode.CompareTag(Tags.Node); + } + + /// + /// Returns true if 's + /// is true and it is tagged by . + /// + /// The game object to check. + /// True if is an active node. + public static bool IsNodeAndActiveInHierarchy(this GameObject gameNode) + { + return gameNode.CompareTag(Tags.Node) && gameNode.activeInHierarchy; + } + + /// + /// Retrieves the node reference component, if possible. + /// + /// The game object whose NodeRef is checked. + /// The attached NodeRef; defined only if this method + /// returns true. + /// True if has a + /// component attached to it. + public static bool TryGetNodeRef(this GameObject gameNode, out NodeRef nodeRef) + { + return gameNode.TryGetComponent(out nodeRef); + } + + /// + /// Returns true if has a + /// component attached to it that is not null. + /// + /// The game object whose NodeRef is checked. + /// The node referenced by the attached NodeRef; defined only if this method + /// returns true. + /// True if has a + /// component attached to it that is not null. + public static bool TryGetNode(this GameObject gameNode, out Node node) + { + node = null; + if (gameNode.TryGetComponent(out NodeRef nodeRef)) + { + node = nodeRef.Value; + } + return node != null; + } + + /// + /// Returns the graph node represented by this . + /// + /// Precondition: must have a + /// attached to it referring to a valid node; if not, an exception is raised. + /// + /// The game object whose is requested. + /// The correponding graph node (will never be null). + /// Thrown if has + /// no valid or . + /// This method is similar to , + /// but throws an exception if the node is not found. It is analogous to + /// . + public static Node GetNode(this GameObject gameNode) + { + if (gameNode.TryGetComponent(out NodeRef nodeRef)) + { + if (nodeRef != null) + { + if (nodeRef.Value != null) + { + return nodeRef.Value; + } + else + { + throw new NullReferenceException($"Node referenced by game object {gameNode.name} is null."); + } + } + else + { + throw new NullReferenceException($"Node reference of game object {gameNode.name} is null."); + } + } + else + { + throw new NullReferenceException($"Game object {gameNode.name} has no NodeRef."); + } + } + + /// + /// Returns the graph containing the node represented by this . + /// + /// Precondition: must have a + /// attached to it referring to a valid node; if not, an exception is raised. + /// + /// The game object whose graph is requested. + /// The correponding graph. + public static Graph ItsGraph(this GameObject gameNode) + { + return gameNode.GetNode().ItsGraph; + } + + /// + /// Returns all active descendants of given tagged by + /// including itself. + /// + /// The root of the node hierarchy to be collected. + /// All descendants of including . + public static IList AllDescendants(this GameObject gameNode) + { + IList result = new List() { gameNode }; + AllDescendants(gameNode, result); + return result; + } + + /// + /// Adds all active descendants of to + /// (only if tagged by ). + /// + /// Note: is assumed to be contained in + /// already. + /// + /// The root of the game-object hierarchy to be collected. + /// Where to add the descendants. + private static void AllDescendants(GameObject gameNode, IList result) + { + foreach (Transform child in gameNode.transform) + { + if (child.gameObject.activeInHierarchy && child.gameObject.CompareTag(Tags.Node)) + { + result.Add(child.gameObject); + AllDescendants(child.gameObject, result); + } + } + } + + /// + /// Returns the for this . + /// If no operator exists yet, it will be added. + /// If the game object is not a node, an exception will be thrown. + /// + /// The game object whose operator to retrieve. + /// The responsible for this . + public static NodeOperator NodeOperator(this GameObject gameNode) + { + if (gameNode.CompareTag(Tags.Node)) + { + return gameNode.AddOrGetComponent(); + } + else + { + throw new InvalidOperationException($"Cannot get {nameof(NodeOperator)} for game object {gameNode.name} because it is not a node."); + } + } + } +} diff --git a/Assets/SEE/Extensions/GameNodeExtensions.cs.meta b/Assets/SEE/Extensions/GameNodeExtensions.cs.meta new file mode 100644 index 0000000000..c43ab789ba --- /dev/null +++ b/Assets/SEE/Extensions/GameNodeExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f38c01471d4058e4ca3d1e40c25dfd43 \ No newline at end of file diff --git a/Assets/SEE/Extensions/GameObjectColorExtensions.cs b/Assets/SEE/Extensions/GameObjectColorExtensions.cs new file mode 100644 index 0000000000..c40f47b5b0 --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectColorExtensions.cs @@ -0,0 +1,74 @@ +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Provides extension methods for + /// regarding color. + /// + internal static class GameObjectColorExtensions + { + /// + /// Sets the color for this to given . + /// + /// Precondition: has a renderer whose material has a color attribute. + /// + /// + /// Object whose color is to be set. + /// The new color to be set. + public static void SetColor(this GameObject gameObject, Color color) + { + if (gameObject.TryGetComponent(out Renderer renderer)) + { + renderer.sharedMaterial.color = color; + } + } + + /// + /// Retrieves the color from this . + /// + /// Precondition: has a renderer whose material has a color attribute. + /// + /// Object whose color is to be returned. + /// Color of this . + /// + /// If this has no renderer attached to it. + /// + public static Color GetColor(this GameObject gameObject) + { + return gameObject.MustGetComponent().sharedMaterial.color; + } + + /// + /// Sets the alpha value (transparency) of the given + /// to . + /// + /// Game objects whose transparency is to be set. + /// A value in between 0 and 1 for transparency. + public static void SetTransparency(this GameObject gameObject, float alpha) + { + if (gameObject.TryGetComponent(out Renderer renderer)) + { + Color oldColor = renderer.material.color; + renderer.material.color = oldColor.WithAlpha(alpha); + } + } + + /// + /// Sets the start and end line color of . + /// + /// Precondition: must have a line renderer. + /// + /// Object holding a line renderer whose start and end color is to be set. + /// Start color of the line. + /// End color of the line. + public static void SetLineColor(this GameObject gameObject, Color startColor, Color endColor) + { + if (gameObject.TryGetComponent(out LineRenderer renderer)) + { + renderer.startColor = startColor; + renderer.endColor = endColor; + } + } + } +} diff --git a/Assets/SEE/Extensions/GameObjectColorExtensions.cs.meta b/Assets/SEE/Extensions/GameObjectColorExtensions.cs.meta new file mode 100644 index 0000000000..9ddc1f5ef6 --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectColorExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: de3e66da21c85c648bf91bd889b4b6d5 \ No newline at end of file diff --git a/Assets/SEE/Extensions/GameObjectExtensions.cs b/Assets/SEE/Extensions/GameObjectExtensions.cs new file mode 100644 index 0000000000..698abfee7e --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectExtensions.cs @@ -0,0 +1,83 @@ +using SEE.Game; +using UnityEngine; +using static SEE.Game.Portal.IncludeDescendants; + +namespace SEE.Extensions +{ + /// + /// Provides extensions for s. + /// + public static class GameObjectExtensions + { + /// + /// Enables/disables the renderers of and all its + /// descendants so that they become visible/invisible. + /// + /// Objects whose renderer (and those of its children) is to be enabled/disabled. + /// Iff true, the renderers will be enabled. + /// Applicable only to a and its descendants + /// with a + private static void SetVisible(this GameObject gameObject, bool isVisible) + { + gameObject.GetComponent().enabled = isVisible; + foreach (Transform child in gameObject.transform) + { + SetVisible(child.gameObject, isVisible); + } + } + + /// + /// Returns the full name of the game object, that is, its name and the + /// names of its ancestors in the game-object hierarchy separated by /. + /// If is null, "" will be returned. + /// + /// Game object for which to retrieve the full name. + /// Can be null. + public static string FullName(this GameObject gameObject) + { + if (gameObject == null) + { + return ""; + } + string result = gameObject.name; + while (gameObject.transform.parent != null) + { + gameObject = gameObject.transform.parent.gameObject; + result = gameObject.name + "/" + result; + } + return result; + } + + /// + /// Updates the portal of this game object by setting the portal boundaries of itself + /// (and its descendants, depending on ) + /// to the code city they're contained in. + /// If they're not contained in a code city and is true, + /// a warning log message will be emitted, otherwise nothing will happen. + /// + /// The game object whose portal shall be updated. + /// + /// Whether a warning log message shall be emitted if the + /// is not attached to any code city. + /// + /// + /// Whether the portal of the descendants of this shall be updated too. + /// + /// The can be a game node or game edge + /// or anything else that has a portal. + public static void UpdatePortal(this GameObject gameObject, bool warnOnFailure = false, + Portal.IncludeDescendants includeDescendants = OnlySelf) + { + GameObject rootCity = gameObject.GetCodeCity(); + if (rootCity != null) + { + Portal.SetPortal(rootCity, gameObject, includeDescendants); + } + else if (warnOnFailure) + { + Debug.LogWarning("Couldn't update portal: No code city has been found" + + $" attached to game object {gameObject.FullName()}.\n"); + } + } + } +} diff --git a/Assets/SEE/GameObjects/GameObjectExtensions.cs.meta b/Assets/SEE/Extensions/GameObjectExtensions.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/GameObjectExtensions.cs.meta rename to Assets/SEE/Extensions/GameObjectExtensions.cs.meta diff --git a/Assets/SEE/Extensions/GameObjectHierarchyExtensions.cs b/Assets/SEE/Extensions/GameObjectHierarchyExtensions.cs new file mode 100644 index 0000000000..8224be4503 --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectHierarchyExtensions.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Extensions methods dealing with the hierarchy of general s. + /// + internal static class GameObjectHierarchyExtensions + { + /// + /// Searches for the first descendant with the specified + /// within the hierarchy of the given . + /// + /// The game object whose descendants will be searched. + /// The name of the descendant to search for. + /// If set to true, the search wil include inactive s. + /// Otherwise, only active ones will be considered. + /// The first matching descendant with the specified , + /// or null if none is found. + public static GameObject FindDescendant(this GameObject gameObject, string descendantName, bool includeInactive = true) + { + return gameObject + .GetComponentsInChildren(includeInactive) + .FirstOrDefault(t => t.gameObject.name == descendantName)? + .gameObject; + } + + /// + /// Searches for the first descendant with the specified + /// within the hierarchy of the given . + /// + /// The game object whose descendants will be searched. + /// The tag to search for. + /// If set to true, the search will include inactive s. + /// Otherwise, only active ones will be considered. + /// The first matching descendant with the specified tag, or null if none is found. + public static GameObject FindDescendantWithTag(this GameObject gameObject, string tag, bool includeInactive = true) + { + return gameObject + .GetComponentsInChildren(includeInactive) + .FirstOrDefault(t => t.gameObject.CompareTag(tag))? + .gameObject; + } + + /// + /// QDetermines whether the has any descendant + /// with the specified . + /// + /// The root to search from. + /// The tag to search for. + /// True if a descendant with the specified tag is found; otherwise, false. + public static bool HasDescendantWithTag(this GameObject gameObject, string tag) + { + return gameObject.FindDescendantWithTag(tag) != null; + } + + /// + /// Finds all descendant s of the given + /// that have the specified tag. + /// + /// The root to start the search from. + /// The tag that matching descendants must have. + /// Whether to include inactive s in the search. + /// A list of all descendant s with the specified tag. + public static IList FindAllDescendantsWithTag(this GameObject gameObject, string tag, bool includeInactive = true) + { + return gameObject + .GetComponentsInChildren(includeInactive) + .Where(t => t.CompareTag(tag)) + .Select(t => t.gameObject) + .ToList(); + } + /// + /// Finds all descendant s with the specified , + /// exluding those whose immediate parent has the specified . + /// + /// The root to search from. + /// The tag that matching descendants must have. + /// If the immediate parent has this tag, the child will be excluded from the result. + /// Whether inactive s should be included in the search. + /// A list of matching descendant s, excluding those whose parent has the specified tag. + public static List FindAllDescendantsWithTagExcludingSpecificParentTag(this GameObject gameObject, + string descendantTag, string immediateParentTag, bool includeInactive = true) + { + return gameObject + .GetComponentsInChildren(includeInactive) + .Where(t => t.CompareTag(descendantTag) && + t.parent != null && + !t.parent.CompareTag(immediateParentTag)) + .Select(t => t.gameObject) + .ToList(); + } + + /// + /// Determines whether the specified has any ancestor + /// with the given . + /// + /// The starting whose parent hierarhcy will be searched. + /// The tag to search for. + /// True if a parent or ancestor with the specified tag is found; otherwise, false. + public static bool HasParentWithTag(this GameObject gameObject, string tag) + { + Transform transform = gameObject.transform; + while (transform.parent != null) + { + if (transform.parent.gameObject.CompareTag(tag)) + { + return true; + } + transform = transform.parent; + } + return false; + } + + /// + /// Searches upward through the transform hierarchy to find the first parent GameObject + /// with the specified name. + /// + /// The starting GameObject from which the search begins. + /// The exact name of the parent GameObject to look for. + /// + /// The first matching parent GameObject, or null if no parent with the given name is found. + /// + public static GameObject FindParentWithName(this GameObject gameObject, string name) + { + if (gameObject.transform.parent == null) + { + return null; + } + else + { + return gameObject.transform.parent.name == name ? + gameObject.transform.parent.gameObject + : FindParentWithName(gameObject.transform.parent.gameObject, name); + } + } + + /// + /// Finds all descendant s whose names start with the given prefix. + /// + /// Root object to search in. + /// Name prefix to match. + /// Whether inactive objects are included. + /// List of matching descendants (empty if none found). + public static List FindAllDescendantWithStartingName + (this GameObject gameObject, string startName, bool includeInactive = true) + { + return gameObject + .GetComponentsInChildren(includeInactive) + .Select(t => t.gameObject) + .Where(go => go.name.StartsWith(startName, StringComparison.Ordinal)) + .ToList(); + } + + /// + /// Checks recursively whether the specified GameObject has any parent + /// with the given layer. + /// + /// The starting GameObject from which the search begins. + /// The layer number to check against. + /// + /// True if any parent GameObject has the specified layer; + /// otherwise, false. + /// + public static bool HasParentWithLayer(this GameObject gameObject, uint layer) + { + if (gameObject.transform.parent == null) + { + return false; + } + else + { + return gameObject.transform.parent.gameObject.layer == layer + || HasParentWithLayer(gameObject.transform.parent.gameObject, layer); + } + } + + /// + /// Traverses up the hierachy from the given + /// and returns the highest parent. + /// + /// The starting in the hierarchy. + /// The root at the top of the hierarchy. + /// If the given object has no parent, it is returned itself. + public static GameObject GetRootParent(this GameObject gameObject) + { + Transform parent = gameObject.transform.parent; + return parent != null ? GetRootParent(parent.gameObject) : gameObject; + } + } +} diff --git a/Assets/SEE/Extensions/GameObjectHierarchyExtensions.cs.meta b/Assets/SEE/Extensions/GameObjectHierarchyExtensions.cs.meta new file mode 100644 index 0000000000..fc9f57b679 --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectHierarchyExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8a714d65183958140b06fb60fe4e6b33 \ No newline at end of file diff --git a/Assets/SEE/Extensions/GameObjectScaleExtensions.cs b/Assets/SEE/Extensions/GameObjectScaleExtensions.cs new file mode 100644 index 0000000000..4511bcf970 --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectScaleExtensions.cs @@ -0,0 +1,297 @@ +using SEE.Utils; +using System; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Provides extensions for s regarding size (scale). + /// + public static class GameObjectScaleExtensions + { + /// + /// Provides the size and the mesh offset of the given in world space. + /// This does not include the size of descendants if there are any. + /// + /// This value reflects the actual world-space bounds of the axis-aligned cuboid that contains the rendered + /// object. + /// Please note that the is only the scale factor and not the actual size of + /// a rendered object. + /// Similarly, is not necessarily the center point of the rendered object. + /// + /// + /// + /// If a is attached, the will be used. + /// + /// If a is attached, the bounds will be calculated based on its positions with a + /// performance penalty (see ). + /// + /// If a is attached, the will be used. + /// + /// Else, and are provided and a warning + /// is logged. + /// It means that either the object is not rendered at all or this method needs to be extended. + /// + /// + /// + /// Local-space counterpart: + /// + /// + /// Object whose scale is requested. + /// Out parameter for the world-space position of the object. + /// Out parameter for the world-space size of the object. + /// True if the size was successfully retrieved, false if the fallback was used. + /// Applicable to different kinds of game objects (with , + /// , general , or none of these). + public static bool WorldSpaceSize(this GameObject gameObject, out Vector3 size, out Vector3 position) + { + // Rely on collider bounds if available. + if (gameObject.TryGetComponent(out Collider collider)) + { + size = collider.bounds.size; + position = collider.bounds.center; + return true; + } + + // For objects with a LineRenderer, we can use its positions to determine its bounds. + // Otherwise Unity will return overly large bounds. + if (gameObject.TryGetComponent(out LineRenderer lineRenderer)) + { + Bounds lineBounds = GeometryUtils.CalculateLineBounds(lineRenderer, true); + size = lineBounds.size; + position = lineBounds.center; + return true; + } + + // For some objects, such as capsules or custom meshes, lossyScale gives wrong results. + // The more reliable option to determine the size is using the + // object's renderer if it has one. + if (gameObject.TryGetComponent(out Renderer renderer)) + { + size = renderer.bounds.size; + position = renderer.bounds.center; + return true; + } + + // No renderer, so we use lossyScale as a fallback. + // Note: This may happen for container objects that have no mesh. + size = gameObject.transform.lossyScale; + position = gameObject.transform.position; + return false; + } + + /// + /// Returns the size of the given in world space. + /// This does not include the size of descendants if there are any. + /// + /// This is a shorthand method for that only returns the size. + /// See there for additional documentation. + /// + /// Use directly if you need both position and size. + /// + /// Local-space counterpart: + /// + /// + /// Object whose size is requested. + /// Size of given . + public static Vector3 WorldSpaceSize(this GameObject gameObject) + { + WorldSpaceSize(gameObject, out Vector3 size, out Vector3 _); + return size; + } + + /// + /// Provides the size and the mesh offset of the given in local space, + /// i.e., in relation to its parent. + /// This does not include the size of descendants if there are any. + /// + /// This value should often be used instead of the because the scale only + /// reflects the size for objects with a standardized size like cube primitives. Similarly, the + /// can be significantly off the object's center. + /// + /// + /// + /// If a is attached, the will be used and converted into + /// local space. + /// + /// If a is attached, the bounds will be calculated based on its positions with a + /// performance penalty (see ). + /// + /// If a is attached, the will be used. + /// + /// Else, and are provided and a + /// warning is logged. + /// It means that either the object is not rendered at all or this method needs to be extended. + /// + /// + /// + /// World-space counterpart: + /// + /// + /// Object whose scale is requested. + /// Out parameter for the local size of the object. + /// Out parameter for the local position of the object. + /// True if the has a size, false if the fallback was used. + /// Applicable to game objects having a or + /// and others (in the latter case, the localScale is used as a fallback. + public static bool LocalSize(this GameObject gameObject, out Vector3 size, out Vector3 position) + { + // Rely on collider bounds if available. + if (gameObject.TryGetComponent(out Collider collider)) + { + size = getLocalColliderSize(collider); + position = collider.transform.InverseTransformPoint(collider.bounds.center) + gameObject.transform.localPosition; + return true; + } + + // For objects with a LineRenderer, we can use its positions to determine its bounds. + // Otherwise Unity will return overly large bounds. + if (gameObject.TryGetComponent(out LineRenderer lineRenderer)) + { + Bounds lineBounds = GeometryUtils.CalculateLineBounds(lineRenderer, false); + size = lineBounds.size; + position = lineBounds.center; + return true; + } + + // For some objects, such as capsules or custom meshes, localScale gives wrong results. + // The more reliable option to determine the size is using the object's mesh if it has one. + Mesh sharedMesh; + if (gameObject.TryGetComponent(out MeshFilter meshFilter) && (sharedMesh = meshFilter.sharedMesh) != null) + { + size = Vector3.Scale(sharedMesh.bounds.size, gameObject.transform.localScale); + position = sharedMesh.bounds.center + gameObject.transform.localPosition; + return true; + } + + // No mesh, so we use localScale as a fallback. + // Note: This should not happen. If the object has no mesh, it has no size at all. + Debug.LogWarning($"GameObject {gameObject.FullName()} has neither a {nameof(Mesh)} nor {nameof(LineRenderer)}, " + + "using localScale as fallback.\n"); + size = gameObject.transform.localScale; + position = gameObject.transform.localPosition; + return false; + + Vector3 getLocalColliderSize(Collider collider) + { + Vector3 localScale = collider.transform.localScale; + + if (collider is BoxCollider box) + { + return Vector3.Scale(box.size, localScale); + } + else if (collider is SphereCollider sphere) + { + float diameter = sphere.radius * 2f; + // Sphere scales uniformly in all axes + return new Vector3(diameter, diameter, diameter) * Mathf.Max(localScale.x, Mathf.Max(localScale.y, localScale.z)); + } + else if (collider is CapsuleCollider capsule) + { + float diameter = capsule.radius * 2f; + Vector3 size = Vector3.zero; + switch (capsule.direction) + { + case 0: // X axis + size = new Vector3(capsule.height, diameter, diameter); + break; + case 1: // Y axis + size = new Vector3(diameter, capsule.height, diameter); + break; + case 2: // Z axis + size = new Vector3(diameter, diameter, capsule.height); + break; + default: + // This should never happen + throw new NotImplementedException(); + } + size.x *= localScale.x; + size.y *= localScale.y; + size.z *= localScale.z; + return size; + } + else if (collider is MeshCollider meshCollider) + { + Mesh mesh = meshCollider.sharedMesh; + if (mesh != null) + { + return Vector3.Scale(mesh.bounds.size, localScale); + } + else + { + return Vector3.zero; + } + } + else + { + // Fallback: bounds.size is in world space, convert to local by dividing by scale + Debug.LogWarning($"GameObject has unknown collider type, using localScale as fallback: {gameObject.name}"); + Bounds worldBounds = collider.bounds; + Vector3 worldSize = worldBounds.size; + return new Vector3( + localScale.x != 0 ? worldSize.x / localScale.x : 0, + localScale.y != 0 ? worldSize.y / localScale.y : 0, + localScale.z != 0 ? worldSize.z / localScale.z : 0); + } + } + } + + /// + /// Returns the size of the given in local space, + /// i.e., in relation to its parent. + /// + /// This is a shorthand method for that only returns the size. + /// See there for additional documentation. + /// + /// Use directly if you need both position and size. + /// + /// World-space counterpart: + /// + /// + /// Object whose size is requested. + /// Size of given . + /// Applicable to game objects having a or + /// and others (in the latter case, the localScale is used as a fallback. + public static Vector3 LocalSize(this GameObject gameObject) + { + LocalSize(gameObject, out Vector3 size, out Vector3 _); + return size; + } + + /// + /// Returns the bounds of the given in its own + /// local coordinate system. + /// + /// Note: A primitive cube has a size of (1,1,1), and a coordinate center (pivot) + /// of (0,0,0). + /// However, that does not apply for all primitives or models in general. + /// + /// + /// The game object. + /// Local-space bounds of . + /// Applicable to game objects having a , + /// a and others (in the latter case, the (Vector2.zero, Vector3.one) + /// is used as a fallback. + public static Bounds LocalBounds(this GameObject gameObject) + { + // For objects with a LineRenderer, we can use its positions to determine its bounds. + // Otherwise Unity will return overly large bounds. + if (gameObject.TryGetComponent(out LineRenderer lineRenderer)) + { + return GeometryUtils.CalculateLineBounds(lineRenderer, false); + } + if (gameObject.TryGetComponent(out MeshFilter meshFilter)) + { + return meshFilter.sharedMesh.bounds; + } + if (gameObject.TryGetComponent(out Renderer renderer)) + { + return new( + gameObject.transform.InverseTransformPoint(renderer.bounds.center), + gameObject.transform.InverseTransformVector(renderer.bounds.size)); + } + // This fallback works for uniform primitives like cubes, but not for non-uniforms like cylinders. + return new(Vector3.zero, Vector3.one); + } + } +} diff --git a/Assets/SEE/Extensions/GameObjectScaleExtensions.cs.meta b/Assets/SEE/Extensions/GameObjectScaleExtensions.cs.meta new file mode 100644 index 0000000000..b9f52be86d --- /dev/null +++ b/Assets/SEE/Extensions/GameObjectScaleExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: bed86c68a0065c24c846f929d4d007a2 \ No newline at end of file diff --git a/Assets/SEE/Extensions/GraphElementObjectExtensions.cs b/Assets/SEE/Extensions/GraphElementObjectExtensions.cs new file mode 100644 index 0000000000..ebe69fa1ec --- /dev/null +++ b/Assets/SEE/Extensions/GraphElementObjectExtensions.cs @@ -0,0 +1,218 @@ +using SEE.Components.GameEdges; +using SEE.Game; +using SEE.Game.City; +using SEE.Game.Operator; +using SEE.GraphElementRefs; +using System; +using UnityEngine; + +namespace SEE.Extensions +{ + /// + /// Extension methods for game nodes and game edges alike. A game node is a + /// representing a . A game edge is a + /// representing a + /// + internal static class GraphElementObjectExtensions + { + /// + /// An extension of GameObjects to retrieve their IDs. If + /// has a attached to it, the corresponding node's ID is returned. + /// If has an attached to it, the corresponding + /// edge's ID is returned. Otherwise the name of is + /// returned. + /// + /// ID for . + /// Applicable to game nodes and game edges. + public static string ID(this GameObject gameObject) + { + NodeRef nodeRef = gameObject.GetComponent(); + if (nodeRef == null) + { + EdgeRef edgeRef = gameObject.GetComponent(); + if (edgeRef == null) + { + return gameObject.name; + } + else + { + return edgeRef.Value.ID; + } + } + return nodeRef.Value.ID; + } + + /// + /// Returns the city this is contained in. + /// If is null or if it is not contained in a city of type, null is returned. + /// + /// Object whose containing city is requested. + /// The containing city of or null. + /// Applicable to game nodes and game edges. + public static AbstractSEECity ContainingCity(this GameObject gameObject) => ContainingCity(gameObject); + + /// + /// Returns the city of type this is contained. + /// If is null or if it is not contained in a city of type, null is returned. + /// + /// Object whose containing city of type + /// is requested. + /// The containing city of type of + /// or null. + /// Type of the code city that shall be returned + /// Applicable to game nodes and game edges. + public static T ContainingCity(this GameObject gameObject) where T : AbstractSEECity + { + if (gameObject == null) + { + return null; + } + else + { + GameObject codeCityObject = gameObject.GetCodeCity(); + if (codeCityObject != null && codeCityObject.TryGetComponent(out T city)) + { + return city; + } + else + { + /// We do not log the fact that does not have the + /// expected type of city, as some clients are using this method just as a predicate. + return null; + } + } + } + + /// + /// Returns the closest ancestor of that + /// represents a code city, that is, is tagged by . + /// This ancestor is assumed to carry the settings (layout information etc.). + /// If none can be found, null will be returned. + /// If is tagged by , + /// it will be returned. + /// + /// Game object at which to start the search. + /// Closest ancestor game object in the game-object hierarchy tagged by + /// or null. + /// + /// Thrown if is null. + /// + /// Applicable to game nodes and game edges. + public static GameObject GetCodeCity(this GameObject gameObject) + { + if (gameObject == null) + { + throw new ArgumentNullException(nameof(gameObject)); + } + Transform result = gameObject.transform; + while (result != null) + { + if (result.CompareTag(Tags.CodeCity)) + { + return result.gameObject; + } + result = result.parent; + } + return null; + } + + /// + /// Sets the visibility and the collider of this to . + /// If is false, the object becomes invisible. If it is true + /// instead, it becomes visible. + /// + /// If is false, only the renderer of + /// is turned on/off, which will not affect whether the + /// is active or inactive. If has children, their + /// renderers will not be changed. + /// + /// If is true, the operation applies to all descendants, too. + /// + /// Precondition: must have a Renderer. + /// + /// Object whose visibility is to be changed. + /// Whether or not to make the object visible. + /// If true, the operation applies to all descendants, too. + /// Applicable to both game nodes and game edges. + public static void SetVisibility(this GameObject gameObject, bool show, bool includingChildren = true) + { + if (gameObject.TryGetComponent(out Renderer renderer)) + { + renderer.enabled = show; + } + + if (gameObject.TryGetComponent(out Collider collider)) + { + collider.enabled = show; + } + + if (includingChildren) + { + foreach (Transform child in gameObject.transform) + { + child.gameObject.SetVisibility(show, includingChildren); + } + } + } + + /// + /// Returns the world-space center position of the roof of this . + /// + /// Game object whose roof has to be determined. + /// World-space center position of the roof of this . + /// This does not consider the position of descendants if there are any. + /// Consider if you want to + /// take descendants into account, too. This method is applicable to game nodes + /// and game edges having a . + public static Vector3 GetRoofCenter(this GameObject gameObject) + { + Vector3 result; + if (gameObject.TryGetComponent(out SEESpline spline)) + { + // Splines aren't actually positioned at their game object's position, + // but their position can be determined by their middle control point. + result = spline.GetMiddleControlPoint(); + result.y += spline.Radius; + } + else + { + result = gameObject.transform.position; + result.y += gameObject.WorldSpaceSize().y / 2.0f; + } + return result; + } + + /// + /// Returns the for this . + /// If no operator exists yet, a fitting operator will be added. + /// If the game object is neither a node nor an edge, an exception will be thrown. + /// + /// The game object whose operator to retrieve. + /// The responsible for this . + /// Applicable to both game nodes and game edges. + public static GraphElementOperator Operator(this GameObject gameObject) + { + if (gameObject.TryGetComponent(out GraphElementOperator elementOperator)) + { + return elementOperator; + } + else + { + // We may need to add the appropriate operator first. + if (gameObject.IsNode()) + { + return gameObject.AddComponent(); + } + else if (gameObject.IsEdge()) + { + return gameObject.AddComponent(); + } + else + { + throw new InvalidOperationException($"Cannot get {nameof(GraphElementOperator)} for game object " + + $"{gameObject.name} because it is neither a node nor an edge."); + } + } + } + } +} diff --git a/Assets/SEE/Extensions/GraphElementObjectExtensions.cs.meta b/Assets/SEE/Extensions/GraphElementObjectExtensions.cs.meta new file mode 100644 index 0000000000..7b161a4da1 --- /dev/null +++ b/Assets/SEE/Extensions/GraphElementObjectExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4a53503583b1a3840850434d424275dc \ No newline at end of file diff --git a/Assets/SEE/GameObjects/Factories.meta b/Assets/SEE/Factories.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories.meta rename to Assets/SEE/Factories.meta diff --git a/Assets/SEE/GameObjects/Decorators/AntennaDecorator.cs b/Assets/SEE/Factories/AntennaFactory.cs similarity index 94% rename from Assets/SEE/GameObjects/Decorators/AntennaDecorator.cs rename to Assets/SEE/Factories/AntennaFactory.cs index 2a0bc65bf4..56c84a9e85 100644 --- a/Assets/SEE/GameObjects/Decorators/AntennaDecorator.cs +++ b/Assets/SEE/Factories/AntennaFactory.cs @@ -1,20 +1,20 @@ using SEE.DataModel.DG; using SEE.Game; using SEE.Game.City; -using SEE.GO.Factories; -using SEE.GO.Factories.NodeFactories; +using SEE.Factories.NodeFactories; using SEE.Utils; using System; using System.Collections.Generic; using UnityEngine; +using SEE.Extensions; +using SEE.MetricScales; -namespace SEE.GO.Decorators +namespace SEE.Factories { /// - /// A decorator for game nodes generating an antenna representing various metrics - /// above a game node (leaf or inner alike). + /// A factory for antennas representing various metrics above a game node (leaf or inner alike). /// - internal class AntennaDecorator + internal class AntennaFactory { /// /// Constructor. @@ -24,11 +24,11 @@ internal class AntennaDecorator /// The width of every antenna segment. /// The maximal height of an individual antenna segment. /// A mapping of metric names onto colors. - public AntennaDecorator(IScale scaler, - AntennaAttributes antennaAttributes, - float antennaWidth, - float maximalAntennaSegmentHeight, - ColorMap metricToColor) + public AntennaFactory(IScale scaler, + AntennaAttributes antennaAttributes, + float antennaWidth, + float maximalAntennaSegmentHeight, + ColorMap metricToColor) { this.scaler = scaler; this.antennaAttributes = antennaAttributes; diff --git a/Assets/SEE/Factories/AntennaFactory.cs.meta b/Assets/SEE/Factories/AntennaFactory.cs.meta new file mode 100644 index 0000000000..7c469a3d2a --- /dev/null +++ b/Assets/SEE/Factories/AntennaFactory.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4b233739135e23d4183ece901da956c7 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/Factories/DynamicMarkerFactory.cs b/Assets/SEE/Factories/DynamicMarkerFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/DynamicMarkerFactory.cs rename to Assets/SEE/Factories/DynamicMarkerFactory.cs index 44b1b1094b..99869a9e0e 100644 --- a/Assets/SEE/GameObjects/Factories/DynamicMarkerFactory.cs +++ b/Assets/SEE/Factories/DynamicMarkerFactory.cs @@ -1,11 +1,12 @@ using SEE.Game; +using SEE.Extensions; using SEE.Utils; using System; using System.Collections.Generic; using System.IO; using UnityEngine; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// A factory for dynamic markers. diff --git a/Assets/SEE/GameObjects/Factories/DynamicMarkerFactory.cs.meta b/Assets/SEE/Factories/DynamicMarkerFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/DynamicMarkerFactory.cs.meta rename to Assets/SEE/Factories/DynamicMarkerFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/EdgeFactory.cs b/Assets/SEE/Factories/EdgeFactory.cs similarity index 98% rename from Assets/SEE/GameObjects/Factories/EdgeFactory.cs rename to Assets/SEE/Factories/EdgeFactory.cs index 8a377527a7..0e25ef19a8 100644 --- a/Assets/SEE/GameObjects/Factories/EdgeFactory.cs +++ b/Assets/SEE/Factories/EdgeFactory.cs @@ -1,13 +1,15 @@ using System.Collections.Generic; using System.Linq; +using SEE.Components.GameEdges; using SEE.Game; using SEE.Game.CityRendering; +using SEE.GraphElementRefs; using SEE.Layout; using SEE.Layout.EdgeLayouts; using SEE.Utils; using UnityEngine; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// A factory to create game objects for laid out edges. diff --git a/Assets/SEE/GameObjects/Factories/EdgeFactory.cs.meta b/Assets/SEE/Factories/EdgeFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/EdgeFactory.cs.meta rename to Assets/SEE/Factories/EdgeFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/EdgeMaterial.cs b/Assets/SEE/Factories/EdgeMaterial.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/EdgeMaterial.cs rename to Assets/SEE/Factories/EdgeMaterial.cs index 4517d96f8e..95822a53bb 100644 --- a/Assets/SEE/GameObjects/Factories/EdgeMaterial.cs +++ b/Assets/SEE/Factories/EdgeMaterial.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// Handles the properties of materials for our diff --git a/Assets/SEE/GameObjects/Factories/EdgeMaterial.cs.meta b/Assets/SEE/Factories/EdgeMaterial.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/EdgeMaterial.cs.meta rename to Assets/SEE/Factories/EdgeMaterial.cs.meta diff --git a/Assets/SEE/GameObjects/ErosionIssues.cs b/Assets/SEE/Factories/ErosionFactory.cs similarity index 98% rename from Assets/SEE/GameObjects/ErosionIssues.cs rename to Assets/SEE/Factories/ErosionFactory.cs index 23987c2508..4b5b838716 100644 --- a/Assets/SEE/GameObjects/ErosionIssues.cs +++ b/Assets/SEE/Factories/ErosionFactory.cs @@ -2,16 +2,18 @@ using System.Globalization; using System.Linq; using SEE.DataModel.DG; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.GraphElementRefs; +using SEE.MetricScales; using SEE.Tools; using UnityEngine; -namespace SEE.GO +namespace SEE.Factories { /// /// Allows to add erosion issues as sprites atop of game objects. /// - internal class ErosionIssues + internal class ErosionFactory { /// /// Constructor. @@ -19,7 +21,7 @@ internal class ErosionIssues /// The relevant metrics for the erosion issues. /// Scaling to be applied on the metrics for the erosion issues. /// The factor by which the erosion icons shall be scaled. - public ErosionIssues(Dictionary issueMap, + public ErosionFactory(Dictionary issueMap, IScale scaler, float erosionScalingFactor, bool aggregated = false) { this.issueMap = issueMap; diff --git a/Assets/SEE/Factories/ErosionFactory.cs.meta b/Assets/SEE/Factories/ErosionFactory.cs.meta new file mode 100644 index 0000000000..48d40eb4ed --- /dev/null +++ b/Assets/SEE/Factories/ErosionFactory.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 67cf4cb4956252c4fa9b27674befef3b \ No newline at end of file diff --git a/Assets/SEE/Factories/Factories.cs b/Assets/SEE/Factories/Factories.cs new file mode 100644 index 0000000000..55b78a1523 --- /dev/null +++ b/Assets/SEE/Factories/Factories.cs @@ -0,0 +1,6 @@ +/// +/// Factories for game nodes and game edges and their decorations. +/// +namespace SEE.Factories +{ +} diff --git a/Assets/SEE/Factories/Factories.cs.meta b/Assets/SEE/Factories/Factories.cs.meta new file mode 100644 index 0000000000..228f2f5602 --- /dev/null +++ b/Assets/SEE/Factories/Factories.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b57f3ddb5522f774d89799a70bc89b06 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/Factories/IconFactory.cs b/Assets/SEE/Factories/IconFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/IconFactory.cs rename to Assets/SEE/Factories/IconFactory.cs index 0192b6386a..1810be55c0 100644 --- a/Assets/SEE/GameObjects/Factories/IconFactory.cs +++ b/Assets/SEE/Factories/IconFactory.cs @@ -6,7 +6,7 @@ using UnityEngine.Assertions; using UnityEngine.UI; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// A factory to generate sprites from sprite prefab files for all types of diff --git a/Assets/SEE/GameObjects/Factories/IconFactory.cs.meta b/Assets/SEE/Factories/IconFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/IconFactory.cs.meta rename to Assets/SEE/Factories/IconFactory.cs.meta diff --git a/Assets/SEE/Game/InteractionDecorator.cs b/Assets/SEE/Factories/InteractionDecorator.cs similarity index 57% rename from Assets/SEE/Game/InteractionDecorator.cs rename to Assets/SEE/Factories/InteractionDecorator.cs index 92111a7309..f76df863f4 100644 --- a/Assets/SEE/Game/InteractionDecorator.cs +++ b/Assets/SEE/Factories/InteractionDecorator.cs @@ -3,14 +3,14 @@ using System.Threading; using Cysharp.Threading.Tasks; using SEE.Controls; -using SEE.Controls.Actions; using SEE.Controls.Interactables; -using SEE.GO; +using SEE.Controls.Modifiers; +using SEE.Extensions; using SEE.Utils; using UnityEngine; using UnityEngine.XR.Interaction.Toolkit.Interactables; -namespace SEE.Game +namespace SEE.Factories { /// /// Adds components required for interacting with a game object. @@ -18,7 +18,7 @@ namespace SEE.Game internal static class InteractionDecorator { /// - /// Adds the following components to given : + /// Adds the following components to given : /// , /// , /// , @@ -26,38 +26,38 @@ internal static class InteractionDecorator /// , /// . /// - /// If has a , then the following + /// If has a , then the following /// components are added in addition to the ones above: /// , /// /// /// - /// . + /// . /// - /// Note: The is assumed to represent a graph node + /// Note: The is assumed to represent a graph node /// or edge. /// - /// Game object where the components are to be added to. - public static void PrepareGraphElementForInteraction(GameObject gameObject) + /// Game node or edge where the components are to be added to. + public static void PrepareGraphElementForInteraction(GameObject gameNodeOrEdge) { - gameObject.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); - gameObject.isStatic = false; // we want to move the object during the game + gameNodeOrEdge.isStatic = false; // we want to move the object during the game // The following additions of components must come after the addition of InteractableObject // because they require the presence of an InteractableObject. - AddGeneralComponents(gameObject); - if (gameObject.HasNodeRef()) + AddGeneralComponents(gameNodeOrEdge); + if (gameNodeOrEdge.HasNodeRef()) { - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); } } /// - /// Addes the following components to given : + /// Addes the following components to given : /// , /// , /// , @@ -65,52 +65,55 @@ public static void PrepareGraphElementForInteraction(GameObject gameObject) /// , /// , /// . + /// + /// is assumed to be a game object representing + /// an author in a . /// - /// Where the components should be added to. - public static void PrepareAuthorForInteraction(GameObject gameObject) + /// Where the components should be added to. + public static void PrepareAuthorForInteraction(GameObject authorSphere) { - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); - AddGeneralComponents(gameObject); + authorSphere.AddOrGetComponent(); + authorSphere.AddOrGetComponent(); + AddGeneralComponents(authorSphere); } /// - /// Adds the following components to given : + /// Adds the following components to given : /// , /// , /// , /// , /// . /// - /// Where the components should be added to. - private static void AddGeneralComponents(GameObject gameObject) + /// A game node or edge where the components should be added to. + private static void AddGeneralComponents(GameObject gameNodeOrEdge) { - gameObject.AddOrGetComponent().colliders.Add(gameObject.GetComponent()); - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); - gameObject.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent().colliders.Add(gameNodeOrEdge.GetComponent()); + gameNodeOrEdge.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); + gameNodeOrEdge.AddOrGetComponent(); } /// /// Adds the same components as - /// to all . + /// to all . /// - /// Note: All are assumed to represent a graph node + /// Note: All are assumed to represent a graph node /// or edge. /// - /// Game objects where the components are to be added to. + /// Game objects where the components are to be added to. /// Action that updates the progress of the preparation. /// Token with which to cancel the preparation. - public static async UniTask PrepareForInteractionAsync(ICollection gameObjects, + public static async UniTask PrepareForInteractionAsync(ICollection gameNodesOrEdges, Action updateProgress, CancellationToken token = default) { - int totalGameObjects = gameObjects.Count; + int totalGameObjects = gameNodesOrEdges.Count; // The batch size controls the compromise between FPS and processing speed. // In the editor, requirements for FPS are significantly lower than in-game. int batchSize = Application.isPlaying ? 200 : 1000; float i = 0; - await foreach (GameObject go in gameObjects.BatchPerFrame(batchSize, token: token)) + await foreach (GameObject go in gameNodesOrEdges.BatchPerFrame(batchSize, token: token)) { PrepareGraphElementForInteraction(go); updateProgress(++i / totalGameObjects); diff --git a/Assets/SEE/Game/InteractionDecorator.cs.meta b/Assets/SEE/Factories/InteractionDecorator.cs.meta similarity index 100% rename from Assets/SEE/Game/InteractionDecorator.cs.meta rename to Assets/SEE/Factories/InteractionDecorator.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/LineFactory.cs b/Assets/SEE/Factories/LineFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/LineFactory.cs rename to Assets/SEE/Factories/LineFactory.cs index e5eca1e7be..2425ad75f8 100644 --- a/Assets/SEE/GameObjects/Factories/LineFactory.cs +++ b/Assets/SEE/Factories/LineFactory.cs @@ -1,6 +1,7 @@ -using UnityEngine; +using SEE.Extensions; +using UnityEngine; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// Sets attributes of lines. diff --git a/Assets/SEE/GameObjects/Factories/LineFactory.cs.meta b/Assets/SEE/Factories/LineFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/LineFactory.cs.meta rename to Assets/SEE/Factories/LineFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/MarkerFactory.cs b/Assets/SEE/Factories/MarkerFactory.cs similarity index 98% rename from Assets/SEE/GameObjects/Factories/MarkerFactory.cs rename to Assets/SEE/Factories/MarkerFactory.cs index 1171c55c64..8fc7a71def 100644 --- a/Assets/SEE/GameObjects/Factories/MarkerFactory.cs +++ b/Assets/SEE/Factories/MarkerFactory.cs @@ -3,12 +3,13 @@ using DG.Tweening; using SEE.Game; using SEE.Game.City; -using SEE.GO.Factories.NodeFactories; +using SEE.Factories.NodeFactories; using SEE.Utils; using UnityEngine; -using static SEE.GO.Factories.MaterialsFactory.ShaderType; +using static SEE.Factories.MaterialsFactory.ShaderType; +using SEE.Extensions; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// A factory for markers to highlight added, changed, and deleted nodes. diff --git a/Assets/SEE/GameObjects/Factories/MarkerFactory.cs.meta b/Assets/SEE/Factories/MarkerFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/MarkerFactory.cs.meta rename to Assets/SEE/Factories/MarkerFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/MaterialsFactory.cs b/Assets/SEE/Factories/MaterialsFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/MaterialsFactory.cs rename to Assets/SEE/Factories/MaterialsFactory.cs index 4d3c1b368d..8a4c98edcd 100644 --- a/Assets/SEE/GameObjects/Factories/MaterialsFactory.cs +++ b/Assets/SEE/Factories/MaterialsFactory.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.Assertions; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// Provides default material that can be shared among game objects to diff --git a/Assets/SEE/GameObjects/Factories/MaterialsFactory.cs.meta b/Assets/SEE/Factories/MaterialsFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/MaterialsFactory.cs.meta rename to Assets/SEE/Factories/MaterialsFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories.meta b/Assets/SEE/Factories/NodeFactories.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories.meta rename to Assets/SEE/Factories/NodeFactories.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/BarsFactory.cs b/Assets/SEE/Factories/NodeFactories/BarsFactory.cs similarity index 98% rename from Assets/SEE/GameObjects/Factories/NodeFactories/BarsFactory.cs rename to Assets/SEE/Factories/NodeFactories/BarsFactory.cs index 8d9bf23397..2a17c370cf 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/BarsFactory.cs +++ b/Assets/SEE/Factories/NodeFactories/BarsFactory.cs @@ -2,7 +2,7 @@ using System.Linq; using UnityEngine; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A factory for bar charts as visual representations of graph nodes diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/BarsFactory.cs.meta b/Assets/SEE/Factories/NodeFactories/BarsFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/BarsFactory.cs.meta rename to Assets/SEE/Factories/NodeFactories/BarsFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/CubeFactory.cs b/Assets/SEE/Factories/NodeFactories/CubeFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/NodeFactories/CubeFactory.cs rename to Assets/SEE/Factories/NodeFactories/CubeFactory.cs index 6c4fa1778a..c4898889d3 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/CubeFactory.cs +++ b/Assets/SEE/Factories/NodeFactories/CubeFactory.cs @@ -1,7 +1,7 @@ using SEE.Game; using UnityEngine; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A factory for cubes as visual representations of graph nodes in the scene. diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/CubeFactory.cs.meta b/Assets/SEE/Factories/NodeFactories/CubeFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/CubeFactory.cs.meta rename to Assets/SEE/Factories/NodeFactories/CubeFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/CylinderFactory.cs b/Assets/SEE/Factories/NodeFactories/CylinderFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/NodeFactories/CylinderFactory.cs rename to Assets/SEE/Factories/NodeFactories/CylinderFactory.cs index e39d0b78f0..4de4177f9f 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/CylinderFactory.cs +++ b/Assets/SEE/Factories/NodeFactories/CylinderFactory.cs @@ -1,7 +1,7 @@ using SEE.Game; using UnityEngine; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A factory for cylinder game objects. diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/CylinderFactory.cs.meta b/Assets/SEE/Factories/NodeFactories/CylinderFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/CylinderFactory.cs.meta rename to Assets/SEE/Factories/NodeFactories/CylinderFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactories.cs b/Assets/SEE/Factories/NodeFactories/NodeFactories.cs similarity index 65% rename from Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactories.cs rename to Assets/SEE/Factories/NodeFactories/NodeFactories.cs index f97556d94a..5597939821 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactories.cs +++ b/Assets/SEE/Factories/NodeFactories/NodeFactories.cs @@ -1,9 +1,9 @@ /// -/// SEE.GO.NodeFactories contains factories that create +/// contains factories that create /// game objects representing graph nodes to be shown in the scene. /// These factories may be used at design time (in the Unity editor) /// as well as run time (during the game). /// -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { } diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactories.cs.meta b/Assets/SEE/Factories/NodeFactories/NodeFactories.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactories.cs.meta rename to Assets/SEE/Factories/NodeFactories/NodeFactories.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactory.cs b/Assets/SEE/Factories/NodeFactories/NodeFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactory.cs rename to Assets/SEE/Factories/NodeFactories/NodeFactory.cs index b9ddcfb1ad..838f421ffe 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactory.cs +++ b/Assets/SEE/Factories/NodeFactories/NodeFactory.cs @@ -4,7 +4,7 @@ using System.Linq; using UnityEngine; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A factory for visual representations of graph nodes in the scene. diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactory.cs.meta b/Assets/SEE/Factories/NodeFactories/NodeFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/NodeFactory.cs.meta rename to Assets/SEE/Factories/NodeFactories/NodeFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/PolygonFactory.cs b/Assets/SEE/Factories/NodeFactories/PolygonFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/NodeFactories/PolygonFactory.cs rename to Assets/SEE/Factories/NodeFactories/PolygonFactory.cs index 7743cbca7d..24194bf19c 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/PolygonFactory.cs +++ b/Assets/SEE/Factories/NodeFactories/PolygonFactory.cs @@ -3,7 +3,7 @@ using System.Linq; using UnityEngine; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A factory for shapes with a irregular closed polygon as a floor space diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/PolygonFactory.cs.meta b/Assets/SEE/Factories/NodeFactories/PolygonFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/PolygonFactory.cs.meta rename to Assets/SEE/Factories/NodeFactories/PolygonFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/SpiderFactory.cs b/Assets/SEE/Factories/NodeFactories/SpiderFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/NodeFactories/SpiderFactory.cs rename to Assets/SEE/Factories/NodeFactories/SpiderFactory.cs index a0e7c4c2be..09cc9ed86e 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/SpiderFactory.cs +++ b/Assets/SEE/Factories/NodeFactories/SpiderFactory.cs @@ -2,7 +2,7 @@ using System.Linq; using UnityEngine; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A factory for shapes with a spider-chart floor space as visual representations diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/SpiderFactory.cs.meta b/Assets/SEE/Factories/NodeFactories/SpiderFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/SpiderFactory.cs.meta rename to Assets/SEE/Factories/NodeFactories/SpiderFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/Triangulator.cs b/Assets/SEE/Factories/NodeFactories/Triangulator.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/NodeFactories/Triangulator.cs rename to Assets/SEE/Factories/NodeFactories/Triangulator.cs index 5aabad955f..248e2690c4 100644 --- a/Assets/SEE/GameObjects/Factories/NodeFactories/Triangulator.cs +++ b/Assets/SEE/Factories/NodeFactories/Triangulator.cs @@ -1,7 +1,7 @@ using UnityEngine; using System.Collections.Generic; -namespace SEE.GO.Factories.NodeFactories +namespace SEE.Factories.NodeFactories { /// /// A utility class to generate a set of triangles from a list of points diff --git a/Assets/SEE/GameObjects/Factories/NodeFactories/Triangulator.cs.meta b/Assets/SEE/Factories/NodeFactories/Triangulator.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/NodeFactories/Triangulator.cs.meta rename to Assets/SEE/Factories/NodeFactories/Triangulator.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/PlaneFactory.cs b/Assets/SEE/Factories/PlaneFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/PlaneFactory.cs rename to Assets/SEE/Factories/PlaneFactory.cs index b6195e641e..7e36d0af2b 100644 --- a/Assets/SEE/GameObjects/Factories/PlaneFactory.cs +++ b/Assets/SEE/Factories/PlaneFactory.cs @@ -3,7 +3,7 @@ using UnityEngine; using UnityEngine.Rendering; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// A factory for planes where blocks can be put on. diff --git a/Assets/SEE/GameObjects/Factories/PlaneFactory.cs.meta b/Assets/SEE/Factories/PlaneFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/PlaneFactory.cs.meta rename to Assets/SEE/Factories/PlaneFactory.cs.meta diff --git a/Assets/SEE/GameObjects/Factories/TextFactory.cs b/Assets/SEE/Factories/TextFactory.cs similarity index 99% rename from Assets/SEE/GameObjects/Factories/TextFactory.cs rename to Assets/SEE/Factories/TextFactory.cs index 1807e4a4da..c3ac8df968 100644 --- a/Assets/SEE/GameObjects/Factories/TextFactory.cs +++ b/Assets/SEE/Factories/TextFactory.cs @@ -5,7 +5,7 @@ using TMPro; using UnityEngine; -namespace SEE.GO.Factories +namespace SEE.Factories { /// /// A factory for text objects that rotate towards the camera. diff --git a/Assets/SEE/GameObjects/Factories/TextFactory.cs.meta b/Assets/SEE/Factories/TextFactory.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Factories/TextFactory.cs.meta rename to Assets/SEE/Factories/TextFactory.cs.meta diff --git a/Assets/SEE/Game/Avatars/AvatarAdapter.cs b/Assets/SEE/Game/Avatars/AvatarAdapter.cs index 88c6ed0beb..140c362b1c 100644 --- a/Assets/SEE/Game/Avatars/AvatarAdapter.cs +++ b/Assets/SEE/Game/Avatars/AvatarAdapter.cs @@ -3,13 +3,18 @@ using CrazyMinnow.SALSA; using Dissonance; using Dissonance.Audio.Playback; -using SEE.Controls; -using SEE.GO; -using SEE.GO.Menu; +using SEE.Extensions; +using SEE.UI; using SEE.Tools.OpenTelemetry; using SEE.Utils; using Unity.Netcode; using UnityEngine; +using SEE.Game.Drawable; +using SEE.UserSettings; +using SEE.Controls.Players; + + + #if ENABLE_VR using UnityEngine.Assertions; using SEE.XR; @@ -57,13 +62,13 @@ private void Start() gameObject.AddComponent(); } - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { gameObject.AddOrGetComponent(); gameObject.AddOrGetComponent(); } - switch (User.UserSettings.Instance.InputType) + switch (UserSetting.Instance.InputType) { case PlayerInputType.DesktopPlayer: case PlayerInputType.TouchGamepadPlayer: @@ -73,7 +78,7 @@ private void Start() PrepareLocalPlayerForXR(); break; default: - throw new NotImplementedException($"Unhandled case {User.UserSettings.Instance.InputType}"); + throw new NotImplementedException($"Unhandled case {UserSetting.Instance.InputType}"); } gameObject.name = "Local " + gameObject.name; diff --git a/Assets/SEE/Game/Avatars/AvatarAimingSystem.cs b/Assets/SEE/Game/Avatars/AvatarAimingSystem.cs index 9c13027d40..8d749a950e 100644 --- a/Assets/SEE/Game/Avatars/AvatarAimingSystem.cs +++ b/Assets/SEE/Game/Avatars/AvatarAimingSystem.cs @@ -1,9 +1,9 @@ using UnityEngine; using RootMotion.FinalIK; -using SEE.GO; -using SEE.Controls; +using SEE.Extensions; using SEE.Net.Actions; using Unity.Netcode; +using SEE.Controls.KeyActions; namespace SEE.Game.Avatars { diff --git a/Assets/SEE/Game/Avatars/AvatarHandAnimationsSync.cs b/Assets/SEE/Game/Avatars/AvatarHandAnimationsSync.cs index 9e4976b611..b4981b0509 100644 --- a/Assets/SEE/Game/Avatars/AvatarHandAnimationsSync.cs +++ b/Assets/SEE/Game/Avatars/AvatarHandAnimationsSync.cs @@ -1,7 +1,7 @@ using UnityEngine; using Unity.Netcode; using RootMotion.FinalIK; -using SEE.GO; +using SEE.Extensions; namespace SEE.Game.Avatars { diff --git a/Assets/SEE/Game/Avatars/BodyAnimator.cs b/Assets/SEE/Game/Avatars/BodyAnimator.cs index a3e6492fbc..ca077b0cbf 100644 --- a/Assets/SEE/Game/Avatars/BodyAnimator.cs +++ b/Assets/SEE/Game/Avatars/BodyAnimator.cs @@ -16,9 +16,7 @@ using Mediapipe.Tasks.Vision.PoseLandmarker; using Mediapipe.Unity.Experimental; using RootMotion.FinalIK; -using SEE.Controls; -using SEE.GO; -using SEE.UI; +using SEE.Extensions; using SEE.Utils; using System; using System.Collections.Generic; @@ -28,6 +26,12 @@ /// These namespaces are imported to be able to use MediaPipe solutions /// using Stopwatch = System.Diagnostics.Stopwatch; +using Mediapipe.Tasks.Vision.PoseLandmarker; +using Mediapipe.Tasks.Vision.HandLandmarker; +using Mediapipe.Unity.Experimental; +using Mediapipe.Tasks.Vision.GestureRecognizer; +using SEE.UI; +using SEE.Controls.KeyActions; namespace SEE.Game.Avatars { diff --git a/Assets/SEE/Game/Avatars/LaserPointer.cs b/Assets/SEE/Game/Avatars/LaserPointer.cs index 51abff4552..dab85276db 100644 --- a/Assets/SEE/Game/Avatars/LaserPointer.cs +++ b/Assets/SEE/Game/Avatars/LaserPointer.cs @@ -2,7 +2,7 @@ using SEE.Utils; using System; using SEE.Controls; -using SEE.GO.Factories; +using SEE.Factories; namespace SEE.Game.Avatars { diff --git a/Assets/SEE/Game/Avatars/NetSynchronizer.cs b/Assets/SEE/Game/Avatars/NetSynchronizer.cs index b89873485e..4764365f1a 100644 --- a/Assets/SEE/Game/Avatars/NetSynchronizer.cs +++ b/Assets/SEE/Game/Avatars/NetSynchronizer.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using Unity.Netcode; using UnityEngine; diff --git a/Assets/SEE/Game/Avatars/PersonalAssistantSpeechInput.cs b/Assets/SEE/Game/Avatars/PersonalAssistantSpeechInput.cs index 0a85248a2f..613c7fad49 100644 --- a/Assets/SEE/Game/Avatars/PersonalAssistantSpeechInput.cs +++ b/Assets/SEE/Game/Avatars/PersonalAssistantSpeechInput.cs @@ -1,5 +1,5 @@ -using SEE.Controls; -using SEE.GO; +using SEE.Controls.SpeechInput; +using SEE.Extensions; using SEE.Utils.Paths; using System; using System.Collections.Generic; @@ -12,6 +12,7 @@ using UnityEngine; using UnityEngine.Windows.Speech; using Sirenix.OdinInspector; +using SEE.Controls.KeyActions; namespace SEE.Game.Avatars { diff --git a/Assets/SEE/Game/Avatars/PlayerName.cs b/Assets/SEE/Game/Avatars/PlayerName.cs index 4f5a9c145b..2abea86534 100644 --- a/Assets/SEE/Game/Avatars/PlayerName.cs +++ b/Assets/SEE/Game/Avatars/PlayerName.cs @@ -1,7 +1,8 @@ using UnityEngine; using TMPro; using Unity.Netcode; -using SEE.GO; +using SEE.Extensions; +using SEE.UserSettings; namespace SEE.Game.Avatars { @@ -48,7 +49,7 @@ private void Start() if (IsLocalPlayer) { Log($"{nameof(Start)}() uses GetLocalPlayerName()\n"); - SetPlayerName(User.UserSettings.Instance.Player.PlayerName); + SetPlayerName(UserSetting.Instance.Player.PlayerName); } else { diff --git a/Assets/SEE/Game/Avatars/VRAvatarAimingSystem.cs b/Assets/SEE/Game/Avatars/VRAvatarAimingSystem.cs index 359e567816..bd1c77fd2d 100644 --- a/Assets/SEE/Game/Avatars/VRAvatarAimingSystem.cs +++ b/Assets/SEE/Game/Avatars/VRAvatarAimingSystem.cs @@ -1,5 +1,5 @@ using SEE.Controls; -using SEE.GO; +using SEE.Extensions; using SEE.Tools.OpenTelemetry; using Sirenix.OdinInspector; using UnityEngine; diff --git a/Assets/SEE/Game/Avatars/VRIKActions.cs b/Assets/SEE/Game/Avatars/VRIKActions.cs index 1dc66dccda..2600bc3633 100644 --- a/Assets/SEE/Game/Avatars/VRIKActions.cs +++ b/Assets/SEE/Game/Avatars/VRIKActions.cs @@ -1,5 +1,5 @@ using RootMotion.FinalIK; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using Unity.Netcode; using UnityEngine; diff --git a/Assets/SEE/Game/Charts/ChartContent.cs b/Assets/SEE/Game/Charts/ChartContent.cs index de00ddab26..3da534d482 100644 --- a/Assets/SEE/Game/Charts/ChartContent.cs +++ b/Assets/SEE/Game/Charts/ChartContent.cs @@ -22,8 +22,10 @@ using System.Collections.Generic; using System.Linq; using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.DataModel.DG; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using SEE.Utils; using TMPro; using UnityEngine; @@ -701,12 +703,38 @@ void FindForTree(Node root) } hierarchy--; } - foreach (Node root in SceneQueries.GetRoots(listDataObjects).Where(root => !removedNodeIDs.Contains(root.ID))) + foreach (Node root in GetRoots(listDataObjects).Where(root => !removedNodeIDs.Contains(root.ID))) { FindForTree(root); } } + + /// + /// Returns the roots of all graphs currently referenced by any of the . + /// + /// References to nodes in any graphs whose roots are to be returned. + /// All root nodes of the graphs containing any node referenced in . + private static HashSet GetRoots(IEnumerable nodeRefs) + { + HashSet result = new(); + foreach (NodeRef nodeRef in nodeRefs) + { + IEnumerable nodes = nodeRef?.Value?.ItsGraph?.GetRoots(); + if (nodes != null) + { + foreach (Node node in nodes) + { + if (node != null) + { + result.Add(node); + } + } + } + } + return result; + } + /// /// Fills the chart with data depending on the values of /// and . diff --git a/Assets/SEE/Game/Charts/ChartManager.cs b/Assets/SEE/Game/Charts/ChartManager.cs index e244c33e70..eeb68ba8d1 100644 --- a/Assets/SEE/Game/Charts/ChartManager.cs +++ b/Assets/SEE/Game/Charts/ChartManager.cs @@ -19,8 +19,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -using SEE.Controls; -using SEE.GO; +using SEE.UserSettings; using SEE.Utils; using UnityEngine; @@ -170,7 +169,7 @@ public static ChartManager Instance /// private void Start() { - isVirtualReality = User.UserSettings.IsVR; + isVirtualReality = UserSetting.IsVR; if (!isVirtualReality) { chartsOpen = GameObject.Find("ChartCanvas") != null diff --git a/Assets/SEE/Game/Charts/ChartMarker.cs b/Assets/SEE/Game/Charts/ChartMarker.cs index 472796a035..9d35782598 100644 --- a/Assets/SEE/Game/Charts/ChartMarker.cs +++ b/Assets/SEE/Game/Charts/ChartMarker.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Text; using SEE.Controls; +using SEE.Controls.KeyActions; using TMPro; using UnityEngine; using UnityEngine.Assertions; diff --git a/Assets/SEE/Game/Charts/ChartMultiSelectHandler.cs b/Assets/SEE/Game/Charts/ChartMultiSelectHandler.cs index 0125c5e165..a8a72d261a 100644 --- a/Assets/SEE/Game/Charts/ChartMultiSelectHandler.cs +++ b/Assets/SEE/Game/Charts/ChartMultiSelectHandler.cs @@ -20,6 +20,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using SEE.Controls; +using SEE.Controls.KeyActions; using UnityEngine; using UnityEngine.EventSystems; diff --git a/Assets/SEE/Game/Charts/VR/ChartMoveHandlerVr.cs b/Assets/SEE/Game/Charts/VR/ChartMoveHandlerVr.cs index b2cf9ea5e7..682f987751 100644 --- a/Assets/SEE/Game/Charts/VR/ChartMoveHandlerVr.cs +++ b/Assets/SEE/Game/Charts/VR/ChartMoveHandlerVr.cs @@ -19,7 +19,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -using SEE.Controls.Actions; +using SEE.Controls.MetricCharts; using SEE.Utils; using UnityEngine; using UnityEngine.EventSystems; diff --git a/Assets/SEE/Game/Charts/VR/VrInputModule.cs b/Assets/SEE/Game/Charts/VR/VrInputModule.cs index bd536493cd..7125e57e34 100644 --- a/Assets/SEE/Game/Charts/VR/VrInputModule.cs +++ b/Assets/SEE/Game/Charts/VR/VrInputModule.cs @@ -19,7 +19,7 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -using SEE.Controls.Actions; +using SEE.Controls.MetricCharts; using UnityEngine; using UnityEngine.EventSystems; diff --git a/Assets/SEE/Game/City/AbstractSEECity.cs b/Assets/SEE/Game/City/AbstractSEECity.cs index 1073be9e2b..a2b68e65e9 100644 --- a/Assets/SEE/Game/City/AbstractSEECity.cs +++ b/Assets/SEE/Game/City/AbstractSEECity.cs @@ -1,9 +1,9 @@ using MoreLinq; using SEE.DataModel.DG; using SEE.Game.CityRendering; -using SEE.Game.Table; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Game.Tables; +using SEE.Extensions; +using SEE.Factories; using SEE.UI.Notification; using SEE.UI.RuntimeConfigMenu; using SEE.Utils; @@ -16,6 +16,8 @@ using System.Linq; using UnityEngine; using Debug = UnityEngine.Debug; +using Plane = SEE.Cities.Plane; +using SEE.GraphElementRefs; namespace SEE.Game.City { @@ -736,9 +738,9 @@ private void ListNodeMetrics() /// True if user is hovering over the code city represented by . public static bool UserIsHoveringCity(GameObject gameObject) { - if (!gameObject.TryGetComponent(out GO.Plane clippingPlane) || clippingPlane == null) + if (!gameObject.TryGetComponent(out Plane clippingPlane) || clippingPlane == null) { - Debug.LogError($"Code city {gameObject.FullName()} has no {typeof(GO.Plane)}.\n"); + Debug.LogError($"Code city {gameObject.FullName()} has no {typeof(Plane)}.\n"); return false; } diff --git a/Assets/SEE/Game/City/BranchCity.cs b/Assets/SEE/Game/City/BranchCity.cs index 8b805f63fb..49740f236d 100644 --- a/Assets/SEE/Game/City/BranchCity.cs +++ b/Assets/SEE/Game/City/BranchCity.cs @@ -1,10 +1,8 @@ using Cysharp.Threading.Tasks; using SEE.DataModel.DG; using SEE.Game.CityRendering; -using SEE.GameObjects; -using SEE.GameObjects.BranchCity; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.GraphProviders; using SEE.UI.Notification; using SEE.UI.RuntimeConfigMenu; @@ -15,6 +13,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using SEE.Components.GameNodes.BranchCity; namespace SEE.Game.City { diff --git a/Assets/SEE/Game/City/CityAdder.cs b/Assets/SEE/Game/City/CityAdder.cs index ea91b5a4a7..c018ca5851 100644 --- a/Assets/SEE/Game/City/CityAdder.cs +++ b/Assets/SEE/Game/City/CityAdder.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System; using UnityEngine; diff --git a/Assets/SEE/Game/City/EdgeMeshScheduler.cs b/Assets/SEE/Game/City/EdgeMeshScheduler.cs index b708b45e30..b968a1b672 100644 --- a/Assets/SEE/Game/City/EdgeMeshScheduler.cs +++ b/Assets/SEE/Game/City/EdgeMeshScheduler.cs @@ -1,6 +1,5 @@ using System; using Sirenix.OdinInspector; -using SEE.GO; using SEE.Utils; using System.Collections.Generic; using MoreLinq.Extensions; @@ -8,6 +7,8 @@ using SEE.DataModel.DG; using SEE.UI; using UnityEngine; +using SEE.GraphElementRefs; +using SEE.Components.GameEdges; namespace SEE.Game.City { diff --git a/Assets/SEE/Game/LabelAttributes.cs b/Assets/SEE/Game/City/LabelAttributes.cs similarity index 99% rename from Assets/SEE/Game/LabelAttributes.cs rename to Assets/SEE/Game/City/LabelAttributes.cs index 85a3274b0c..79ea66aad0 100644 --- a/Assets/SEE/Game/LabelAttributes.cs +++ b/Assets/SEE/Game/City/LabelAttributes.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.Serialization; -namespace SEE.Game +namespace SEE.Game.City { /// /// Setting for labels to be shown above game nodes. diff --git a/Assets/SEE/Game/LabelAttributes.cs.meta b/Assets/SEE/Game/City/LabelAttributes.cs.meta similarity index 100% rename from Assets/SEE/Game/LabelAttributes.cs.meta rename to Assets/SEE/Game/City/LabelAttributes.cs.meta diff --git a/Assets/SEE/Game/City/ReflexionVisualization.cs b/Assets/SEE/Game/City/ReflexionVisualization.cs index 5cded45a46..fba97b0f10 100644 --- a/Assets/SEE/Game/City/ReflexionVisualization.cs +++ b/Assets/SEE/Game/City/ReflexionVisualization.cs @@ -6,10 +6,11 @@ using SEE.DataModel.DG; using SEE.Game.Operator; using SEE.UI.Notification; -using SEE.GO; +using SEE.Extensions; using SEE.Tools.ReflexionAnalysis; using SEE.Utils; using UnityEngine; +using SEE.Components.GameEdges; namespace SEE.Game.City { diff --git a/Assets/SEE/Game/City/SEECity.cs b/Assets/SEE/Game/City/SEECity.cs index efeb81829f..a6b335d850 100644 --- a/Assets/SEE/Game/City/SEECity.cs +++ b/Assets/SEE/Game/City/SEECity.cs @@ -1,12 +1,10 @@ using Cysharp.Threading.Tasks; using MoreLinq; -using SEE.DataModel; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Game.CityRendering; -using SEE.GameObjects; -using SEE.GameObjects.BranchCity; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using SEE.GraphProviders; using SEE.Layout; using SEE.Layout.IO; @@ -15,7 +13,7 @@ using SEE.UI; using SEE.UI.Notification; using SEE.UI.RuntimeConfigMenu; -using SEE.User; +using SEE.UserSettings; using SEE.Utils; using SEE.Utils.Config; using SEE.Utils.Paths; @@ -28,6 +26,8 @@ using System.Threading; using UnityEngine; using UnityEngine.Assertions; +using SEE.Cities; +using SEE.Components.GameNodes.BranchCity; namespace SEE.Game.City { @@ -673,7 +673,7 @@ public virtual void SaveSnapshot() { SaveData(); SaveLayout(); - if (!string.IsNullOrEmpty(UserSettings.BackendServerAPI)) + if (!string.IsNullOrEmpty(UserSetting.BackendServerAPI)) { SEECitySnapshot snapshot = new() { diff --git a/Assets/SEE/Game/City/SEECityEvolution.cs b/Assets/SEE/Game/City/SEECityEvolution.cs index 5ab7fb539e..4e3fb232d0 100644 --- a/Assets/SEE/Game/City/SEECityEvolution.cs +++ b/Assets/SEE/Game/City/SEECityEvolution.cs @@ -6,7 +6,7 @@ using SEE.DataModel.DG; using SEE.Game.Evolution; using SEE.UI.RuntimeConfigMenu; -using SEE.GO; +using SEE.Extensions; using Sirenix.OdinInspector; using UnityEngine; using SEE.Game.CityRendering; diff --git a/Assets/SEE/Game/City/SEEReflexionCity.cs b/Assets/SEE/Game/City/SEEReflexionCity.cs index 9c49cfffc4..0711fd446f 100644 --- a/Assets/SEE/Game/City/SEEReflexionCity.cs +++ b/Assets/SEE/Game/City/SEEReflexionCity.cs @@ -1,9 +1,10 @@ using Cysharp.Threading.Tasks; using MoreLinq; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Game.CityRendering; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using SEE.GraphProviders; using SEE.Layout; using SEE.Net; @@ -11,7 +12,7 @@ using SEE.Tools.ReflexionAnalysis; using SEE.UI; using SEE.UI.RuntimeConfigMenu; -using SEE.User; +using SEE.UserSettings; using SEE.Utils; using SEE.Utils.Config; using SEE.Utils.Paths; @@ -23,6 +24,7 @@ using System.Threading; using TMPro; using UnityEngine; +using SEE.SceneManipulation; namespace SEE.Game.City { @@ -421,7 +423,7 @@ override public void SaveSnapshot() { SaveData(); SaveLayout(); - if (!string.IsNullOrEmpty(UserSettings.BackendServerAPI)) + if (!string.IsNullOrEmpty(UserSetting.BackendServerAPI)) { SEEReflexionCitySnapshot snapshot = new() { @@ -522,9 +524,9 @@ await UniTask.WaitUntil(() => gameObject.IsCodeCityDrawn()) if (node.IsInArchitecture()) { // Case for decorative texts that start with the prefix "Text". - if (gameObject.FindChildWithPrefix(Prefix) != null) + if (FindChildWithPrefix(gameObject, Prefix) != null) { - RectTransform text = (RectTransform)gameObject.FindChildWithPrefix(Prefix).transform; + RectTransform text = (RectTransform)FindChildWithPrefix(gameObject, Prefix).transform; textValues.Add(node.ID, (text.localPosition, text.rect.size, text.localScale)); } // Case for label texts that start with the prefix "Label". @@ -601,6 +603,24 @@ void RestoreMapping(ICollection layoutGraphNodes, } } + /// + /// Searches for the first child that starts with the . + /// + /// The game object whose children should be examined. + /// The prefix to search for. + /// The found child or null. + private static GameObject FindChildWithPrefix(GameObject gameObject, string prefix) + { + foreach (Transform child in gameObject.transform) + { + if (child.name.StartsWith(prefix)) + { + return child.gameObject; + } + } + return null; + } + /// /// Resets the selected node types to be visualized. /// diff --git a/Assets/SEE/Game/City/VisualNodeAttributes.cs b/Assets/SEE/Game/City/VisualNodeAttributes.cs index 32ef55a939..9999ba7523 100644 --- a/Assets/SEE/Game/City/VisualNodeAttributes.cs +++ b/Assets/SEE/Game/City/VisualNodeAttributes.cs @@ -4,6 +4,7 @@ using Sirenix.OdinInspector; using UnityEngine; using SEE.Utils.Config; +using SEE.Components.GraphElements; namespace SEE.Game.City { @@ -147,7 +148,7 @@ public string DepthMetric /// Width of the outline for leaf and inner nodes. /// [Tooltip("The outline width when a node is hovered.")] - public float OutlineWidth = Controls.Interactables.Outline.DefaultWidth; + public float OutlineWidth = Outline.DefaultWidth; /// /// If true, persistent text labels will be added to the node representation. /// diff --git a/Assets/SEE/Game/CityRendering/AuthorSphereRenderer.cs b/Assets/SEE/Game/CityRendering/AuthorSphereRenderer.cs index 5bedf97500..c8cbd18601 100644 --- a/Assets/SEE/Game/CityRendering/AuthorSphereRenderer.cs +++ b/Assets/SEE/Game/CityRendering/AuthorSphereRenderer.cs @@ -1,13 +1,13 @@ using SEE.DataModel.DG; using SEE.Game.City; -using SEE.GameObjects.BranchCity; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.GraphProviders.VCS; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; +using SEE.Components.GameNodes.BranchCity; namespace SEE.Game.CityRendering { diff --git a/Assets/SEE/Game/CityRendering/EdgeRenderer.cs b/Assets/SEE/Game/CityRendering/EdgeRenderer.cs index 1a735948ba..6a35f8c509 100644 --- a/Assets/SEE/Game/CityRendering/EdgeRenderer.cs +++ b/Assets/SEE/Game/CityRendering/EdgeRenderer.cs @@ -7,13 +7,14 @@ using MoreLinq.Extensions; using SEE.DataModel.DG; using SEE.Game.City; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.Layout; using SEE.Layout.EdgeLayouts; using SEE.Utils; using UnityEngine; using UnityEngine.Assertions; +using SEE.GraphElementRefs; namespace SEE.Game.CityRendering { diff --git a/Assets/SEE/Game/CityRendering/GameNodeHierarchy.cs b/Assets/SEE/Game/CityRendering/GameNodeHierarchy.cs deleted file mode 100644 index 4c3c8697a2..0000000000 --- a/Assets/SEE/Game/CityRendering/GameNodeHierarchy.cs +++ /dev/null @@ -1,60 +0,0 @@ -using SEE.DataModel.DG; -using SEE.GO; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace SEE.Game.CityRendering -{ - /// - /// Updates the hierarchy of game nodes in a code city so that it is isomorphic - /// to the node hierarchy. - /// - internal class GameNodeHierarchy - { - /// - /// Updates the hierarchy of game nodes under so that it is - /// isomorphic to the node hierarchy of the underlying graph. - /// - /// The game object representing the code city. - public static void Update(GameObject codeCity) - { - Dictionary nodeMap = new(); - CollectNodes(codeCity, nodeMap); - GraphRenderer.CreateGameNodeHierarchy(nodeMap, codeCity); - - /// - /// Collects all graph nodes and their corresponding game nodes that are (transitive) - /// descendants of . The result is added to , - /// where the itself will not be added. - /// - /// Root of the game-node hierarchy whose hierarchy members are to be collected. - /// The mapping of graph nodes onto their corresponding game nodes. - /// Thrown if a game node has no valid node reference. - static void CollectNodes(GameObject root, IDictionary nodeMap) - { - if (root != null) - { - foreach (Transform childTransform in root.transform) - { - GameObject child = childTransform.gameObject; - /// If a game node was deleted, it may have been marked inactive, but - /// not yet destroyed. We need to ignore such game nodes. - if (child.activeInHierarchy && child.CompareTag(Tags.Node)) - { - if (child.TryGetNodeRef(out NodeRef nodeRef)) - { - nodeMap[nodeRef.Value] = child; - CollectNodes(child, nodeMap); - } - else - { - throw new Exception($"Game node {child.name} without valid node reference."); - } - } - } - } - } - } - } -} diff --git a/Assets/SEE/Game/CityRendering/GameNodeHierarchy.cs.meta b/Assets/SEE/Game/CityRendering/GameNodeHierarchy.cs.meta deleted file mode 100644 index 553486216e..0000000000 --- a/Assets/SEE/Game/CityRendering/GameNodeHierarchy.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: b8b8487e665021b45b41fc8e14283c38 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/GraphElementReattacher.cs b/Assets/SEE/Game/CityRendering/GraphElementReattacher.cs similarity index 99% rename from Assets/SEE/GameObjects/GraphElementReattacher.cs rename to Assets/SEE/Game/CityRendering/GraphElementReattacher.cs index 976aaeb681..45cc578af0 100644 --- a/Assets/SEE/GameObjects/GraphElementReattacher.cs +++ b/Assets/SEE/Game/CityRendering/GraphElementReattacher.cs @@ -1,8 +1,8 @@ using SEE.DataModel.DG; -using SEE.GO; +using SEE.GraphElementRefs; using UnityEngine; -namespace SEE.GameObjects +namespace SEE.Game.CityRendering { /// /// Allows to re-attach graph elements for game nodes and edges. diff --git a/Assets/SEE/GameObjects/GraphElementReattacher.cs.meta b/Assets/SEE/Game/CityRendering/GraphElementReattacher.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/GraphElementReattacher.cs.meta rename to Assets/SEE/Game/CityRendering/GraphElementReattacher.cs.meta diff --git a/Assets/SEE/Game/CityRendering/GraphRenderer.cs b/Assets/SEE/Game/CityRendering/GraphRenderer.cs index 0a313947dd..96c4177770 100644 --- a/Assets/SEE/Game/CityRendering/GraphRenderer.cs +++ b/Assets/SEE/Game/CityRendering/GraphRenderer.cs @@ -6,15 +6,15 @@ using SEE.DataModel.DG; using SEE.Game.City; using SEE.Game.HolisticMetrics; -using SEE.GO; -using SEE.GO.Decorators; -using SEE.GO.Factories; -using SEE.GO.Factories.NodeFactories; +using SEE.Extensions; +using SEE.Factories; +using SEE.Factories.NodeFactories; using SEE.Layout; using SEE.Layout.NodeLayouts; using SEE.Utils; using UnityEngine; -using Plane = SEE.GO.Plane; +using Plane = SEE.Cities.Plane; +using SEE.MetricScales; namespace SEE.Game.CityRendering { @@ -195,12 +195,12 @@ ColorRange GetColorRangeForNodeType(Color baseColor) } /// - /// Returns a new according to the given + /// Returns a new according to the given /// value and the and . /// - AntennaDecorator GetAntennaDecorator(VisualNodeAttributes value) + AntennaFactory GetAntennaDecorator(VisualNodeAttributes value) { - return new AntennaDecorator + return new AntennaFactory (scaler, value.AntennaSettings, Settings.AntennaWidth, Settings.MaximalAntennaSegmentHeight, Settings.MetricToColor); @@ -253,9 +253,9 @@ public void AddNewNodeType(string nodeType) /// /// A mapping of the name of node types of onto the - /// s creating the antennas of those nodes. + /// s creating the antennas of those nodes. /// - private readonly Dictionary nodeTypeToAntennaDectorator = new(); + private readonly Dictionary nodeTypeToAntennaDectorator = new(); /// /// The scale used to normalize the metrics determining the lengths of the blocks. diff --git a/Assets/SEE/Game/CityRendering/LayoutGameNode.cs b/Assets/SEE/Game/CityRendering/LayoutGameNode.cs index 30d1fe12e8..75b202834c 100644 --- a/Assets/SEE/Game/CityRendering/LayoutGameNode.cs +++ b/Assets/SEE/Game/CityRendering/LayoutGameNode.cs @@ -1,4 +1,5 @@ -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using SEE.Layout; using UnityEngine; diff --git a/Assets/SEE/Game/CityRendering/NodeRenderer.cs b/Assets/SEE/Game/CityRendering/NodeRenderer.cs index 63d89a4bf6..3ebfef8b6e 100644 --- a/Assets/SEE/Game/CityRendering/NodeRenderer.cs +++ b/Assets/SEE/Game/CityRendering/NodeRenderer.cs @@ -1,10 +1,8 @@ -using SEE.Controls.Interactables; -using SEE.DataModel.DG; +using SEE.DataModel.DG; using SEE.Game.City; -using SEE.GO; -using SEE.GO.Decorators; -using SEE.GO.Factories; -using SEE.GO.Factories.NodeFactories; +using SEE.Extensions; +using SEE.Factories; +using SEE.Factories.NodeFactories; using SEE.Utils; using System; using System.Collections.Generic; @@ -12,6 +10,8 @@ using UnityEngine; using UnityEngine.Assertions; using InvalidOperationException = System.InvalidOperationException; +using SEE.GraphElementRefs; +using SEE.Components.GraphElements; namespace SEE.Game.CityRendering { @@ -242,7 +242,7 @@ public void AdjustAntenna(GameObject gameNode) { if (gameNode.TryGetComponent(out NodeRef nodeRef)) { - if (nodeTypeToAntennaDectorator.TryGetValue(nodeRef.Value.Type, out AntennaDecorator decorator)) + if (nodeTypeToAntennaDectorator.TryGetValue(nodeRef.Value.Type, out AntennaFactory decorator)) { decorator.AddAntenna(gameNode); } @@ -481,7 +481,7 @@ protected void AddDecorations(ICollection gameNodes) // Add software erosion decorators for all nodes if requested. if (Settings.ErosionSettings.ShowLeafErosions) { - ErosionIssues issueDecorator = new(Settings.IssueMap(), scaler, + ErosionFactory issueDecorator = new(Settings.IssueMap(), scaler, Settings.ErosionSettings.ErosionScalingFactor * 5); // Leaf erosions can even be present on inner nodes, hence, we add all nodes. // "Leaf" just refers to the lowest level the erosion type can be present on, which may not be @@ -490,7 +490,7 @@ protected void AddDecorations(ICollection gameNodes) } if (Settings.ErosionSettings.ShowInnerErosions) { - ErosionIssues issueDecorator = new(Settings.IssueMap(), scaler, + ErosionFactory issueDecorator = new(Settings.IssueMap(), scaler, Settings.ErosionSettings.ErosionScalingFactor, aggregated: true); issueDecorator.Add(FindInnerNodes(gameNodes)); } diff --git a/Assets/SEE/Game/CityRendering/TransitionRenderer.cs b/Assets/SEE/Game/CityRendering/TransitionRenderer.cs index aa012554bb..b622be0a62 100644 --- a/Assets/SEE/Game/CityRendering/TransitionRenderer.cs +++ b/Assets/SEE/Game/CityRendering/TransitionRenderer.cs @@ -2,9 +2,8 @@ using SEE.DataModel.DG; using SEE.Game.City; using SEE.Game.Operator; -using SEE.GameObjects; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.Layout; using SEE.Layout.NodeLayouts; using SEE.Utils; @@ -14,6 +13,9 @@ using System.Threading; using UnityEngine; using UnityEngine.Assertions; +using SEE.SceneManipulation; +using SEE.GraphElementRefs; +using SEE.Components.GameEdges; namespace SEE.Game.CityRendering { diff --git a/Assets/SEE/Game/ColorRange.cs b/Assets/SEE/Game/ColorRange.cs index 230ac4aad6..158e098a56 100644 --- a/Assets/SEE/Game/ColorRange.cs +++ b/Assets/SEE/Game/ColorRange.cs @@ -6,7 +6,8 @@ namespace SEE.Game { /// - /// A discrete range of numberOfColors colors from lower to upper. + /// A discrete range of colors from + /// to . /// [Serializable] public struct ColorRange @@ -27,6 +28,12 @@ public struct ColorRange [SerializeField] public uint NumberOfColors; + /// + /// Constructor. + /// + /// Lower color. + /// Upper color. + /// Number of colors. public ColorRange(Color lower, Color upper, uint numberOfColors) { Lower = lower; @@ -34,6 +41,12 @@ public ColorRange(Color lower, Color upper, uint numberOfColors) NumberOfColors = numberOfColors; } + /// + /// Constructor for a color range of exactly one color. + /// + /// will be one. + /// + /// Lower and upper color. public ColorRange(Color color) { Lower = color; @@ -51,8 +64,18 @@ public static ColorRange Default() return new ColorRange(Color.white, Color.black, 10); } + #region Config I/O + /// + /// Label for in the configuration file. + /// private const string lowerLabel = "Lower"; + /// + /// Label for in the configuration file. + /// private const string upperLabel = "Upper"; + /// + /// Label for in the configuration file. + /// private const string numberOfColorsLabel = "NumberOfColors"; /// @@ -95,5 +118,6 @@ internal bool Restore(Dictionary attributes, string label) } return false; } + #endregion Config I/O } -} \ No newline at end of file +} diff --git a/Assets/SEE/Game/Drawable/ActionHelpers/ActionHelpers.cs b/Assets/SEE/Game/Drawable/ActionHelpers/ActionHelpers.cs new file mode 100644 index 0000000000..f5bb14943b --- /dev/null +++ b/Assets/SEE/Game/Drawable/ActionHelpers/ActionHelpers.cs @@ -0,0 +1,6 @@ +/// +/// Utilities for drawables. +/// +namespace SEE.Game.Drawable.ActionHelpers +{ +} diff --git a/Assets/SEE/Game/Drawable/ActionHelpers/ActionHelpers.cs.meta b/Assets/SEE/Game/Drawable/ActionHelpers/ActionHelpers.cs.meta new file mode 100644 index 0000000000..5005f046fe --- /dev/null +++ b/Assets/SEE/Game/Drawable/ActionHelpers/ActionHelpers.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 06dea07b9fed0c443990b18e78ce180e \ No newline at end of file diff --git a/Assets/SEE/Game/Drawable/ActionHelpers/CollisionDetectionManager.cs b/Assets/SEE/Game/Drawable/ActionHelpers/CollisionDetectionManager.cs index f25c7eda38..5a79b2bf5f 100644 --- a/Assets/SEE/Game/Drawable/ActionHelpers/CollisionDetectionManager.cs +++ b/Assets/SEE/Game/Drawable/ActionHelpers/CollisionDetectionManager.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using SEE.UI.Drawable; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/Game/Drawable/ActionHelpers/Selector.cs b/Assets/SEE/Game/Drawable/ActionHelpers/Selector.cs index 5d23ff7650..4fd5cb36f8 100644 --- a/Assets/SEE/Game/Drawable/ActionHelpers/Selector.cs +++ b/Assets/SEE/Game/Drawable/ActionHelpers/Selector.cs @@ -1,10 +1,10 @@ -using SEE.Controls; -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Drawable; using SEE.Utils; using UnityEngine; +using SEE.Controls.KeyActions; namespace SEE.Game.Drawable.ActionHelpers { diff --git a/Assets/SEE/Game/Drawable/BlinkEffect.cs b/Assets/SEE/Game/Drawable/BlinkEffect.cs index e1b9d8f087..8b410b9b7d 100644 --- a/Assets/SEE/Game/Drawable/BlinkEffect.cs +++ b/Assets/SEE/Game/Drawable/BlinkEffect.cs @@ -1,5 +1,5 @@ using HighlightPlus; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System; using System.Collections; diff --git a/Assets/SEE/Game/Drawable/Configurations/Configurations.cs b/Assets/SEE/Game/Drawable/Configurations/Configurations.cs new file mode 100644 index 0000000000..a2f3cd0a54 --- /dev/null +++ b/Assets/SEE/Game/Drawable/Configurations/Configurations.cs @@ -0,0 +1,6 @@ +/// +/// Configurations for drawables. +/// +namespace SEE.Game.Drawable.Configurations +{ +} diff --git a/Assets/SEE/Game/Drawable/Configurations/Configurations.cs.meta b/Assets/SEE/Game/Drawable/Configurations/Configurations.cs.meta new file mode 100644 index 0000000000..11c3f5424f --- /dev/null +++ b/Assets/SEE/Game/Drawable/Configurations/Configurations.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c5b9e017d5fec0847b696ef369a6e913 \ No newline at end of file diff --git a/Assets/SEE/Game/Drawable/Configurations/LineVisualConfFactory.cs b/Assets/SEE/Game/Drawable/Configurations/LineVisualConfFactory.cs index 3b6797b6f9..96d411a56f 100644 --- a/Assets/SEE/Game/Drawable/Configurations/LineVisualConfFactory.cs +++ b/Assets/SEE/Game/Drawable/Configurations/LineVisualConfFactory.cs @@ -1,5 +1,5 @@ -using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; +using SEE.Game.Drawable.ValueHolders; using UnityEngine; namespace SEE.Game.Drawable.Configurations diff --git a/Assets/SEE/Game/Drawable/Configurations/MindMapNodeConf.cs b/Assets/SEE/Game/Drawable/Configurations/MindMapNodeConf.cs index de4d44356b..1a87fd7769 100644 --- a/Assets/SEE/Game/Drawable/Configurations/MindMapNodeConf.cs +++ b/Assets/SEE/Game/Drawable/Configurations/MindMapNodeConf.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Utils.Config; using System; using System.Collections.Generic; diff --git a/Assets/SEE/Game/Drawable/Drawable.cs b/Assets/SEE/Game/Drawable/Drawable.cs new file mode 100644 index 0000000000..9a0cff8310 --- /dev/null +++ b/Assets/SEE/Game/Drawable/Drawable.cs @@ -0,0 +1,7 @@ +/// +/// Home of drawables. A drawable is a visual entity that can be +/// drawn on the whiteboard or is a sticky note. +/// +namespace SEE.Game.Drawable +{ +} diff --git a/Assets/SEE/Game/Drawable/Drawable.cs.meta b/Assets/SEE/Game/Drawable/Drawable.cs.meta new file mode 100644 index 0000000000..44a6c3a402 --- /dev/null +++ b/Assets/SEE/Game/Drawable/Drawable.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 09dd91364b1c9e04682ad86995b7f747 \ No newline at end of file diff --git a/Assets/SEE/Game/Drawable/DrawableConfigManager.cs b/Assets/SEE/Game/Drawable/DrawableConfigManager.cs index d0c21ae6f8..ff29ce3662 100644 --- a/Assets/SEE/Game/Drawable/DrawableConfigManager.cs +++ b/Assets/SEE/Game/Drawable/DrawableConfigManager.cs @@ -1,6 +1,6 @@ using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Notification; using SEE.Utils; using SEE.Utils.Config; diff --git a/Assets/SEE/Game/Drawable/DrawableSetupManager.cs b/Assets/SEE/Game/Drawable/DrawableSetupManager.cs index 4045aa2d26..8dde3bc517 100644 --- a/Assets/SEE/Game/Drawable/DrawableSetupManager.cs +++ b/Assets/SEE/Game/Drawable/DrawableSetupManager.cs @@ -1,6 +1,6 @@ using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/DataModel/Drawable/DrawableSurface.cs b/Assets/SEE/Game/Drawable/DrawableSurface.cs similarity index 98% rename from Assets/SEE/DataModel/Drawable/DrawableSurface.cs rename to Assets/SEE/Game/Drawable/DrawableSurface.cs index 478c53c058..0f7d03f228 100644 --- a/Assets/SEE/DataModel/Drawable/DrawableSurface.cs +++ b/Assets/SEE/Game/Drawable/DrawableSurface.cs @@ -1,11 +1,11 @@ using Cysharp.Threading.Tasks; -using SEE.Game; -using SEE.Game.Drawable; +using SEE.DataModel; using SEE.Game.Drawable.Configurations; +using SEE.Events; using System; using UnityEngine; -namespace SEE.DataModel.Drawable +namespace SEE.Game.Drawable { /// /// Class used by the to detect changes to a drawable surface. diff --git a/Assets/SEE/DataModel/Drawable/DrawableSurface.cs.meta b/Assets/SEE/Game/Drawable/DrawableSurface.cs.meta similarity index 100% rename from Assets/SEE/DataModel/Drawable/DrawableSurface.cs.meta rename to Assets/SEE/Game/Drawable/DrawableSurface.cs.meta diff --git a/Assets/SEE/Game/Drawable/DrawableSurfaceController.cs b/Assets/SEE/Game/Drawable/DrawableSurfaceController.cs index 071af70510..59bf185d75 100644 --- a/Assets/SEE/Game/Drawable/DrawableSurfaceController.cs +++ b/Assets/SEE/Game/Drawable/DrawableSurfaceController.cs @@ -1,5 +1,4 @@ -using SEE.DataModel.Drawable; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Game.Drawable diff --git a/Assets/SEE/DataModel/DrawableSurfaceEvents.cs b/Assets/SEE/Game/Drawable/DrawableSurfaceEvents.cs similarity index 98% rename from Assets/SEE/DataModel/DrawableSurfaceEvents.cs rename to Assets/SEE/Game/Drawable/DrawableSurfaceEvents.cs index 79f8bcff4f..5bed80c6ff 100644 --- a/Assets/SEE/DataModel/DrawableSurfaceEvents.cs +++ b/Assets/SEE/Game/Drawable/DrawableSurfaceEvents.cs @@ -1,8 +1,8 @@ -using SEE.DataModel.Drawable; +using SEE.DataModel; using SEE.Tools.ReflexionAnalysis; using System; -namespace SEE.DataModel +namespace SEE.Game.Drawable { /// /// An event representing a change to a drawable surface component. diff --git a/Assets/SEE/DataModel/DrawableSurfaceEvents.cs.meta b/Assets/SEE/Game/Drawable/DrawableSurfaceEvents.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DrawableSurfaceEvents.cs.meta rename to Assets/SEE/Game/Drawable/DrawableSurfaceEvents.cs.meta diff --git a/Assets/SEE/GameObjects/DrawableSurfaceRef.cs b/Assets/SEE/Game/Drawable/DrawableSurfaceRef.cs similarity index 69% rename from Assets/SEE/GameObjects/DrawableSurfaceRef.cs rename to Assets/SEE/Game/Drawable/DrawableSurfaceRef.cs index 82369aa3e0..85423dbece 100644 --- a/Assets/SEE/GameObjects/DrawableSurfaceRef.cs +++ b/Assets/SEE/Game/Drawable/DrawableSurfaceRef.cs @@ -1,11 +1,11 @@ -using SEE.DataModel.Drawable; -using UnityEngine; +using UnityEngine; -namespace SEE.GO +namespace SEE.Game.Drawable { /// /// A reference to a drawable surface that can be attached to a game object as a component. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class DrawableSurfaceRef : MonoBehaviour { /// diff --git a/Assets/SEE/GameObjects/DrawableSurfaceRef.cs.meta b/Assets/SEE/Game/Drawable/DrawableSurfaceRef.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/DrawableSurfaceRef.cs.meta rename to Assets/SEE/Game/Drawable/DrawableSurfaceRef.cs.meta diff --git a/Assets/SEE/Game/DrawableSurfaces.cs b/Assets/SEE/Game/Drawable/DrawableSurfaces.cs similarity index 94% rename from Assets/SEE/Game/DrawableSurfaces.cs rename to Assets/SEE/Game/Drawable/DrawableSurfaces.cs index e94ba71b52..5340a34ef0 100644 --- a/Assets/SEE/Game/DrawableSurfaces.cs +++ b/Assets/SEE/Game/Drawable/DrawableSurfaces.cs @@ -1,7 +1,7 @@ using SEE.DataModel; -using SEE.DataModel.Drawable; +using SEE.Events; -namespace SEE.Game +namespace SEE.Game.Drawable { /// /// Class used by the to detect added or @@ -27,4 +27,4 @@ public void Remove(DrawableSurface surface) Notify(new RemoveSurfaceEvent(surface.ID, surface)); } } -} \ No newline at end of file +} diff --git a/Assets/SEE/Game/DrawableSurfaces.cs.meta b/Assets/SEE/Game/Drawable/DrawableSurfaces.cs.meta similarity index 100% rename from Assets/SEE/Game/DrawableSurfaces.cs.meta rename to Assets/SEE/Game/Drawable/DrawableSurfaces.cs.meta diff --git a/Assets/SEE/GameObjects/DrawableSurfacesRef.cs b/Assets/SEE/Game/Drawable/DrawableSurfacesRef.cs similarity index 92% rename from Assets/SEE/GameObjects/DrawableSurfacesRef.cs rename to Assets/SEE/Game/Drawable/DrawableSurfacesRef.cs index 98023c62ce..894983a391 100644 --- a/Assets/SEE/GameObjects/DrawableSurfacesRef.cs +++ b/Assets/SEE/Game/Drawable/DrawableSurfacesRef.cs @@ -1,7 +1,6 @@ -using SEE.Game; -using UnityEngine; +using UnityEngine; -namespace SEE.GO +namespace SEE.Game.Drawable { /// /// Class that provides a list of all drawable surfaces in the scene. diff --git a/Assets/SEE/GameObjects/DrawableSurfacesRef.cs.meta b/Assets/SEE/Game/Drawable/DrawableSurfacesRef.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/DrawableSurfacesRef.cs.meta rename to Assets/SEE/Game/Drawable/DrawableSurfacesRef.cs.meta diff --git a/Assets/SEE/Game/Drawable/Extensions.cs b/Assets/SEE/Game/Drawable/Extensions.cs new file mode 100644 index 0000000000..0f8389b30b --- /dev/null +++ b/Assets/SEE/Game/Drawable/Extensions.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace SEE.Game.Drawable +{ + /// + /// Extension methods for s holding a . + /// + internal static class Extensions + { + /// + /// Returns true if has a + /// component attached to it that is not null. + /// + /// The game object whose DrawableSurfaceRef is checked. + /// The surface referenced by the attached DrawableSurfaceRef; defined only if this method + /// returns true. + /// True if has a + /// component attached to it that is not null. + public static bool TryGetDrawableSurface(this GameObject gameObject, out DrawableSurface surface) + { + surface = null; + if (gameObject.TryGetComponent(out DrawableSurfaceRef surfaceRef)) + { + surface = surfaceRef.Surface; + } + return surface != null; + } + } +} diff --git a/Assets/SEE/Game/Drawable/Extensions.cs.meta b/Assets/SEE/Game/Drawable/Extensions.cs.meta new file mode 100644 index 0000000000..1b1e49e148 --- /dev/null +++ b/Assets/SEE/Game/Drawable/Extensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 467050f69bc717e43b8b222e696ebb5e \ No newline at end of file diff --git a/Assets/SEE/Game/Drawable/GameDrawableManager.cs b/Assets/SEE/Game/Drawable/GameDrawableManager.cs index 6acd69b30e..a043faef74 100644 --- a/Assets/SEE/Game/Drawable/GameDrawableManager.cs +++ b/Assets/SEE/Game/Drawable/GameDrawableManager.cs @@ -1,7 +1,6 @@ -using SEE.DataModel.Drawable; -using SEE.Game.Drawable.Configurations; +using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Drawable; using SEE.Utils; using System.Linq; @@ -9,6 +8,10 @@ namespace SEE.Game.Drawable { + /// + /// Provides methods to change visual properties of s + /// such as color, lighting, layering, etc. + /// public static class GameDrawableManager { /// diff --git a/Assets/SEE/Game/Drawable/GameDrawer.cs b/Assets/SEE/Game/Drawable/GameDrawer.cs index 3179efa846..bec0a068d7 100644 --- a/Assets/SEE/Game/Drawable/GameDrawer.cs +++ b/Assets/SEE/Game/Drawable/GameDrawer.cs @@ -1,7 +1,7 @@ using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.UI.Notification; using SEE.Utils; using System; diff --git a/Assets/SEE/Game/Drawable/GameEdit.cs b/Assets/SEE/Game/Drawable/GameEdit.cs index d80634dad4..e05f8f8170 100644 --- a/Assets/SEE/Game/Drawable/GameEdit.cs +++ b/Assets/SEE/Game/Drawable/GameEdit.cs @@ -1,7 +1,6 @@ -using SEE.Game.Drawable.ActionHelpers; -using SEE.Game.Drawable.Configurations; +using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using System.Collections.Generic; using TMPro; using UnityEngine; diff --git a/Assets/SEE/Game/Drawable/GameFinder.cs b/Assets/SEE/Game/Drawable/GameFinder.cs index 0777389721..381835ea01 100644 --- a/Assets/SEE/Game/Drawable/GameFinder.cs +++ b/Assets/SEE/Game/Drawable/GameFinder.cs @@ -1,6 +1,6 @@ using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/SEE/Game/Drawable/GameMindMap.cs b/Assets/SEE/Game/Drawable/GameMindMap.cs index 55a2ddeb22..674fe1c39c 100644 --- a/Assets/SEE/Game/Drawable/GameMindMap.cs +++ b/Assets/SEE/Game/Drawable/GameMindMap.cs @@ -1,7 +1,7 @@ using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System; using System.Collections.Generic; diff --git a/Assets/SEE/Game/Drawable/GameMoveRotator.cs b/Assets/SEE/Game/Drawable/GameMoveRotator.cs index 1ad317c1fd..bc3fd2ad36 100644 --- a/Assets/SEE/Game/Drawable/GameMoveRotator.cs +++ b/Assets/SEE/Game/Drawable/GameMoveRotator.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Drawable; using SEE.Utils; diff --git a/Assets/SEE/Game/Drawable/GameStickyNoteManager.cs b/Assets/SEE/Game/Drawable/GameStickyNoteManager.cs index a096679bc7..c5abc72acd 100644 --- a/Assets/SEE/Game/Drawable/GameStickyNoteManager.cs +++ b/Assets/SEE/Game/Drawable/GameStickyNoteManager.cs @@ -1,7 +1,7 @@ using Cysharp.Threading.Tasks; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/Game/Drawable/ValueHolders/ValueHolders.cs b/Assets/SEE/Game/Drawable/ValueHolders/ValueHolders.cs new file mode 100644 index 0000000000..213a2f0ea2 --- /dev/null +++ b/Assets/SEE/Game/Drawable/ValueHolders/ValueHolders.cs @@ -0,0 +1,7 @@ +/// +/// Value holders for drawables. A value holder is a component designed to store, +/// manage, and display data within a UI element. +/// +namespace SEE.Game.Drawable.ValueHolders +{ +} diff --git a/Assets/SEE/Game/Drawable/ValueHolders/ValueHolders.cs.meta b/Assets/SEE/Game/Drawable/ValueHolders/ValueHolders.cs.meta new file mode 100644 index 0000000000..bf3cc9141a --- /dev/null +++ b/Assets/SEE/Game/Drawable/ValueHolders/ValueHolders.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e8f1b93fda614474ba8f738aeb0ef92e \ No newline at end of file diff --git a/Assets/SEE/Game/Evolution/AnimationInteraction.cs b/Assets/SEE/Game/Evolution/AnimationInteraction.cs index d05c74ef10..507627a563 100644 --- a/Assets/SEE/Game/Evolution/AnimationInteraction.cs +++ b/Assets/SEE/Game/Evolution/AnimationInteraction.cs @@ -22,13 +22,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using SEE.Controls; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Animation; using SEE.Utils; using UnityEngine; using UnityEngine.UI; +using SEE.Controls.KeyActions; namespace SEE.Game.Evolution { diff --git a/Assets/SEE/Game/GameWindowManager.cs b/Assets/SEE/Game/GameWindowManager.cs index d2d7cadee0..99aa697a1a 100644 --- a/Assets/SEE/Game/GameWindowManager.cs +++ b/Assets/SEE/Game/GameWindowManager.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.Players; using SEE.UI.Window; namespace SEE.Game @@ -20,7 +20,7 @@ public static class GameWindowManager /// public static void ActivateWindow(BaseWindow window) { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; if (!manager.Windows.Contains(window)) { manager.AddWindow(window); diff --git a/Assets/SEE/Game/Highlighter.cs b/Assets/SEE/Game/Highlighter.cs index ca7ad11d3d..ae34887224 100644 --- a/Assets/SEE/Game/Highlighter.cs +++ b/Assets/SEE/Game/Highlighter.cs @@ -1,6 +1,5 @@ using HighlightPlus; -using SEE.GO; -using SEE.Utils; +using SEE.Extensions; using UnityEngine; namespace SEE.Game diff --git a/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetAdder.cs b/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetAdder.cs index f1aadb9e9a..0e98f725c5 100644 --- a/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetAdder.cs +++ b/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetAdder.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.HolisticMetrics; +using SEE.Controls.ReversibleActions.HolisticMetrics; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetMover.cs b/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetMover.cs index e061991655..5a7fb36b25 100644 --- a/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetMover.cs +++ b/Assets/SEE/Game/HolisticMetrics/ActionHelpers/WidgetMover.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.HolisticMetrics; +using SEE.Controls.ReversibleActions.HolisticMetrics; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/Game/HolisticMetrics/BoardsManager.cs b/Assets/SEE/Game/HolisticMetrics/BoardsManager.cs index b1267e4218..a6d17e55d3 100644 --- a/Assets/SEE/Game/HolisticMetrics/BoardsManager.cs +++ b/Assets/SEE/Game/HolisticMetrics/BoardsManager.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using SEE.Controls.Actions.HolisticMetrics; +using SEE.Controls.ReversibleActions.HolisticMetrics; using SEE.Game.HolisticMetrics.ActionHelpers; using SEE.UI.Notification; using UnityEngine; diff --git a/Assets/SEE/Game/HolisticMetrics/WidgetsManager.cs b/Assets/SEE/Game/HolisticMetrics/WidgetsManager.cs index 426ec87507..d2ed39cffd 100644 --- a/Assets/SEE/Game/HolisticMetrics/WidgetsManager.cs +++ b/Assets/SEE/Game/HolisticMetrics/WidgetsManager.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions.HolisticMetrics; +using SEE.Controls.ReversibleActions.HolisticMetrics; using SEE.DataModel; using SEE.Game.City; using SEE.Game.HolisticMetrics.ActionHelpers; diff --git a/Assets/SEE/Game/LocalPlayer.cs b/Assets/SEE/Game/LocalPlayer.cs index 2e2e0402a1..20d58614a1 100644 --- a/Assets/SEE/Game/LocalPlayer.cs +++ b/Assets/SEE/Game/LocalPlayer.cs @@ -1,12 +1,10 @@ -using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions; -using SEE.GameObjects; -using SEE.GO; -using SEE.GO.Menu; +using SEE.Game.Drawable; using SEE.Tools.LiveKit; using SEE.UI; using SEE.UI.RuntimeConfigMenu; using UnityEngine; +using SEE.Cities; +using SEE.Controls.CodeCityActions; namespace SEE.Game { diff --git a/Assets/SEE/Game/Operator/AlwaysFalseEqualityComparer.cs b/Assets/SEE/Game/Operator/AlwaysFalseEqualityComparer.cs index cb8da1d9c0..fbdc37b6cf 100644 --- a/Assets/SEE/Game/Operator/AlwaysFalseEqualityComparer.cs +++ b/Assets/SEE/Game/Operator/AlwaysFalseEqualityComparer.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using Random = UnityEngine.Random; namespace SEE.Game.Operator { diff --git a/Assets/SEE/Game/Operator/EdgeOperator.cs b/Assets/SEE/Game/Operator/EdgeOperator.cs index 6c0786dd4b..9af896a2c6 100644 --- a/Assets/SEE/Game/Operator/EdgeOperator.cs +++ b/Assets/SEE/Game/Operator/EdgeOperator.cs @@ -3,11 +3,12 @@ using System.Linq; using DG.Tweening; using SEE.Game.City; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.Utils; using TinySpline; using UnityEngine; +using SEE.Components.GameEdges; namespace SEE.Game.Operator { diff --git a/Assets/SEE/Game/Operator/GraphElementOperator.cs b/Assets/SEE/Game/Operator/GraphElementOperator.cs index d06be9c96e..d2cd672220 100644 --- a/Assets/SEE/Game/Operator/GraphElementOperator.cs +++ b/Assets/SEE/Game/Operator/GraphElementOperator.cs @@ -3,8 +3,8 @@ using HighlightPlus; using SEE.DataModel; using SEE.Game.City; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.UI.Notification; using SEE.Utils; using System; @@ -14,6 +14,7 @@ using UnityEngine; using UnityEngine.Assertions; using ArgumentException = System.ArgumentException; +using SEE.GraphElementRefs; namespace SEE.Game.Operator { diff --git a/Assets/SEE/Game/Operator/LabelOperator.cs b/Assets/SEE/Game/Operator/LabelOperator.cs index c10cd59012..2799c8d9f9 100644 --- a/Assets/SEE/Game/Operator/LabelOperator.cs +++ b/Assets/SEE/Game/Operator/LabelOperator.cs @@ -1,6 +1,6 @@ using DG.Tweening; -using SEE.GO; -using SEE.GO.Factories; +using SEE.Extensions; +using SEE.Factories; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/Game/Operator/MorphismOperation.cs b/Assets/SEE/Game/Operator/MorphismOperation.cs index 48e6dfadf1..e0559c7f45 100644 --- a/Assets/SEE/Game/Operator/MorphismOperation.cs +++ b/Assets/SEE/Game/Operator/MorphismOperation.cs @@ -1,6 +1,6 @@ using System; using DG.Tweening; -using SEE.GO; +using SEE.Components.GameEdges; using SEE.Utils; using TinySpline; using UnityEngine; diff --git a/Assets/SEE/Game/Operator/NodeOperator.cs b/Assets/SEE/Game/Operator/NodeOperator.cs index d155e63874..8eae2d6c0d 100644 --- a/Assets/SEE/Game/Operator/NodeOperator.cs +++ b/Assets/SEE/Game/Operator/NodeOperator.cs @@ -2,8 +2,10 @@ using SEE.Controls; using SEE.DataModel.DG; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using SEE.Layout; +using SEE.SceneManipulation; using SEE.Tools.ReflexionAnalysis; using SEE.Utils; using System; @@ -149,7 +151,33 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); + } + } + } + + /// + /// Updates the interaction layer of the game object, and optionally its children. + /// + /// The affected game object. + /// Should children be updated as well?. + private static void UpdateInteractableLayers(GameObject gameObject, bool recurse = true) + { + if (gameObject.TryGetComponent(out InteractableObjectBase io)) + { + io.UpdateLayer(); + } + else + { + Debug.LogWarning($"GameObject {gameObject.name} is not an interactable object!"); + } + + if (recurse) + { + InteractableObjectBase[] children = gameObject.transform.GetComponentsInChildren(); + foreach (InteractableObjectBase child in children) + { + child.UpdateLayer(); } } } @@ -183,7 +211,7 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); } } } @@ -217,7 +245,7 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); } } } @@ -255,7 +283,7 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); } } } @@ -319,7 +347,7 @@ void OnEnd(Transform originalParent) } if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); updateLayers = false; } } @@ -349,7 +377,7 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); } } } @@ -381,7 +409,7 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); } } } @@ -416,7 +444,7 @@ void OnEnd() { if (updateLayers) { - transform.gameObject.UpdateInteractableLayers(); + UpdateInteractableLayers(transform.gameObject); } } } diff --git a/Assets/SEE/Game/Operator/Operator.cs b/Assets/SEE/Game/Operator/Operator.cs new file mode 100644 index 0000000000..7f8be7f60c --- /dev/null +++ b/Assets/SEE/Game/Operator/Operator.cs @@ -0,0 +1,11 @@ +/// +/// Home of operators. An operator is a component managing operations done on a +/// single game object it is attached to, such as a node or an edge. +/// They allow to manipulate the object they operate on for things like +/// movement, color changes, etc. Their underlying object should be manipulated +/// only by the operator, such that the operator can identify conflicting +/// attempts to manipulate the object. +/// +namespace SEE.Game.Operator +{ +} diff --git a/Assets/SEE/Game/Operator/Operator.cs.meta b/Assets/SEE/Game/Operator/Operator.cs.meta new file mode 100644 index 0000000000..03d7f62e0e --- /dev/null +++ b/Assets/SEE/Game/Operator/Operator.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 765400b97070db84ca18dc375cf84eec \ No newline at end of file diff --git a/Assets/SEE/Game/Portal.cs b/Assets/SEE/Game/Portal.cs index 5329a2eb30..11cb22bb37 100644 --- a/Assets/SEE/Game/Portal.cs +++ b/Assets/SEE/Game/Portal.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using Plane = SEE.Cities.Plane; namespace SEE.Game { @@ -144,7 +145,7 @@ public static bool InPortal(Vector3 point, Vector2 leftFrontCorner, Vector2 righ /// Yields the and /// of the plane attached to . /// - /// Precondition: must have a component + /// Precondition: must have a component /// attached to it. /// /// @@ -153,7 +154,7 @@ public static bool InPortal(Vector3 point, Vector2 leftFrontCorner, Vector2 righ /// The right back corner in the X/Z plane of the plane component. public static void GetDimensions(GameObject gameObject, out Vector2 leftFrontCorner, out Vector2 rightBackCorner) { - if (gameObject.TryGetComponent(out GO.Plane cullingPlane)) + if (gameObject.TryGetComponent(out Plane cullingPlane)) { // Apply a minimal offset to slightly expand the bounds. // Without this, floating-point precision issues can cause objects @@ -166,7 +167,7 @@ public static void GetDimensions(GameObject gameObject, out Vector2 leftFrontCor } else { - Debug.LogWarning($"Game object {gameObject.name} has no {nameof(GO.Plane)}.\n"); + Debug.LogWarning($"Game object {gameObject.name} has no {nameof(Plane)}.\n"); leftFrontCorner = Vector2.zero; rightBackCorner = Vector2.zero; } diff --git a/Assets/SEE/Game/SceneQueries.cs b/Assets/SEE/Game/SceneQueries.cs index 687b05001d..b676e2c39a 100644 --- a/Assets/SEE/Game/SceneQueries.cs +++ b/Assets/SEE/Game/SceneQueries.cs @@ -1,6 +1,6 @@ -using SEE.Controls; using SEE.DataModel.DG; -using SEE.GO; +using SEE.GraphElementRefs; +using SEE.Controls; using System; using System.Collections.Generic; using UnityEngine; @@ -19,6 +19,8 @@ internal static class SceneQueries /// All game objects representing graph nodes in the scene. public static ICollection AllGameNodesInScene(bool includeLeaves, bool includeInnerNodes) { + /// FIXME: This could be done by iterating over . + /// FIXME: Can be moved to . It's used only there. List result = new(); foreach (GameObject go in GameObject.FindGameObjectsWithTag(Tags.Node)) { @@ -52,6 +54,7 @@ public static ICollection AllGameNodesInScene(bool includeLeaves, bo /// All game objects representing graph nodes in the scene. public static List AllNodeRefsInScene(bool includeLeaves, bool includeInnerNodes) { + /// FIXME: Very similar to . Should be consolidated. List result = new(); foreach (GameObject go in GameObject.FindGameObjectsWithTag(Tags.Node)) { @@ -78,31 +81,6 @@ public static List AllNodeRefsInScene(bool includeLeaves, bool includeI return result; } - /// - /// Returns the roots of all graphs currently referenced by any of the . - /// - /// References to nodes in any graphs whose roots are to be returned. - /// All root nodes of the graphs containing any node referenced in . - public static HashSet GetRoots(IEnumerable nodeRefs) - { - HashSet result = new(); - foreach (NodeRef nodeRef in nodeRefs) - { - IEnumerable nodes = nodeRef?.Value?.ItsGraph?.GetRoots(); - if (nodes != null) - { - foreach (Node node in nodes) - { - if (node != null) - { - result.Add(node); - } - } - } - } - return result; - } - /// /// Returns the farthest ancestor in the game-object hierarchy that is tagged by /// . @@ -116,6 +94,7 @@ public static HashSet GetRoots(IEnumerable nodeRefs) /// is null. public static Transform GetCityRootTransformUpwards(Transform cityChildTransform) { + /// FIXME: This is similar to . Could be moved there. if (cityChildTransform == null) { throw new ArgumentNullException(nameof(cityChildTransform)); @@ -139,6 +118,8 @@ public static Transform GetCityRootTransformUpwards(Transform cityChildTransform /// Found game objects. public static ISet Find(ISet gameObjectNames) { + /// FIXME: This should be implemented by iterating over . + /// FIXME: It should be moved there. ISet result = new HashSet(); UnityEngine.SceneManagement.Scene activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); @@ -151,12 +132,27 @@ public static ISet Find(ISet gameObjectNames) } /// - /// Returns the local player game object. + /// Returns all descendants of having a name contained in . + /// The result will also include inactive game objects, but does not contain itself. + /// This method will descend into the game-object hierarchy rooted by . + /// + /// Precondition: is not null. /// - /// Local player game object. - public static GameObject GetLocalPlayer() + /// Root of the game-object hierarchy to be searched. + /// List of names any of the game objects to be retrieved should have. + /// Found game objects. + private static IList Descendants(this GameObject gameObject, ISet gameObjectIDs) { - return WindowSpaceManager.ManagerInstance.gameObject; + List result = new(); + foreach (Transform child in gameObject.transform) + { + if (gameObjectIDs.Contains(child.name)) + { + result.Add(child.gameObject); + } + result.AddRange(child.gameObject.Descendants(gameObjectIDs)); + } + return result; } } } diff --git a/Assets/SEE/Game/Table.meta b/Assets/SEE/Game/Tables.meta similarity index 100% rename from Assets/SEE/Game/Table.meta rename to Assets/SEE/Game/Tables.meta diff --git a/Assets/SEE/Game/Table/CollisionDetectionManager.cs b/Assets/SEE/Game/Tables/CollisionDetectionManager.cs similarity index 95% rename from Assets/SEE/Game/Table/CollisionDetectionManager.cs rename to Assets/SEE/Game/Tables/CollisionDetectionManager.cs index 68a0a6c65f..bb3bbf3b6e 100644 --- a/Assets/SEE/Game/Table/CollisionDetectionManager.cs +++ b/Assets/SEE/Game/Tables/CollisionDetectionManager.cs @@ -1,11 +1,12 @@ using SEE.Utils; using UnityEngine; -namespace SEE.Game.Table +namespace SEE.Game.Tables { /// /// This class manages collision detection for a universal table. /// + /// This component is attached to a table upon which a code city is rendered. public class CollisionDetectionManager : MonoBehaviour { /// diff --git a/Assets/SEE/Game/Table/CollisionDetectionManager.cs.meta b/Assets/SEE/Game/Tables/CollisionDetectionManager.cs.meta similarity index 100% rename from Assets/SEE/Game/Table/CollisionDetectionManager.cs.meta rename to Assets/SEE/Game/Tables/CollisionDetectionManager.cs.meta diff --git a/Assets/SEE/Game/Table/GameTableManager.cs b/Assets/SEE/Game/Tables/GameTableManager.cs similarity index 99% rename from Assets/SEE/Game/Table/GameTableManager.cs rename to Assets/SEE/Game/Tables/GameTableManager.cs index b0d37337c4..3e68d32dfc 100644 --- a/Assets/SEE/Game/Table/GameTableManager.cs +++ b/Assets/SEE/Game/Tables/GameTableManager.cs @@ -2,14 +2,14 @@ using MoreLinq; using SEE.DataModel.DG; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GameObjects; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Utils; using System.Linq; using UnityEngine; +using SEE.Cities; -namespace SEE.Game.Table +namespace SEE.Game.Tables { /// /// This class manages table modifications. diff --git a/Assets/SEE/Game/Table/GameTableManager.cs.meta b/Assets/SEE/Game/Tables/GameTableManager.cs.meta similarity index 100% rename from Assets/SEE/Game/Table/GameTableManager.cs.meta rename to Assets/SEE/Game/Tables/GameTableManager.cs.meta diff --git a/Assets/SEE/Game/Tables/Tables.cs b/Assets/SEE/Game/Tables/Tables.cs new file mode 100644 index 0000000000..8222a4ee66 --- /dev/null +++ b/Assets/SEE/Game/Tables/Tables.cs @@ -0,0 +1,6 @@ +/// +/// Contains components attached to a table on which a code city is drawn. +/// +namespace SEE.Game.Tables +{ +} diff --git a/Assets/SEE/Game/Tables/Tables.cs.meta b/Assets/SEE/Game/Tables/Tables.cs.meta new file mode 100644 index 0000000000..606002b4e6 --- /dev/null +++ b/Assets/SEE/Game/Tables/Tables.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3b2ca503196548c47be7eae85840255e \ No newline at end of file diff --git a/Assets/SEE/Game/VRStatus.cs b/Assets/SEE/Game/VRStatus.cs deleted file mode 100644 index 8186cd51ce..0000000000 --- a/Assets/SEE/Game/VRStatus.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using UnityEngine.XR; - -namespace SEE.Game -{ - /// - /// Provides answers on the VR status. Allows to enable and disable VR. - /// - public static class VRStatus - { - /// - /// Enables/disables the VR subsystem depending upon . - /// - /// If true, VR will be enabled. - [System.Obsolete] - public static void Enable(bool enable) - { - // FIXME: Temporarily disabled. Whether we need/want to re-enable it, depends - // upon the migration to Unity's new XR API. At the moment, VR will be started - // when a local VR player is spawned in AvatarAdapter. - return; - - if (!enable) - { - // Note: For some reason, disabling an XRDisplaySubsystem will also - // disable the camera of the desktop player. For this reason, - // we will bail out here. - // FIXME: This needs further investigation and better handling. - return; // nothing to done. - } - - List xrDisplays = new List(); - SubsystemManager.GetSubsystems(xrDisplays); - foreach (XRDisplaySubsystem display in xrDisplays) - { - if (enable) - { - Debug.Log($"Starting VR display {display}\n"); - display.Start(); - } - else - { - Debug.Log($"Stopping VR display {display}\n"); - display.Stop(); - } - } - } - - /// - /// True if VR is enabled. - /// - /// True if VR is enabled. - public static bool IsActive() - { - List displaysDescs = new List(); - SubsystemManager.GetSubsystemDescriptors(displaysDescs); - - // If there are registered display descriptors that is a good indication that VR is most likely "enabled" - return displaysDescs.Count > 0; - } - - /// - /// True if VR is running. - /// - /// True if VR is running. - public static bool IsVRRunning() - { - List displays = new List(); - SubsystemManager.GetSubsystems(displays); - return displays.Any(display => display.running); - } - } -} diff --git a/Assets/SEE/Game/VRStatus.cs.meta b/Assets/SEE/Game/VRStatus.cs.meta deleted file mode 100644 index 6a2353ed7b..0000000000 --- a/Assets/SEE/Game/VRStatus.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 459d6c4cb9f1a3243aef6b4ffb6131f7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/Game/Worlds/PlayerSpawner.cs b/Assets/SEE/Game/Worlds/PlayerSpawner.cs index f3b82d0110..42528cba3f 100644 --- a/Assets/SEE/Game/Worlds/PlayerSpawner.cs +++ b/Assets/SEE/Game/Worlds/PlayerSpawner.cs @@ -1,6 +1,7 @@ using Dissonance; using SEE.Game.Avatars; -using SEE.GO; +using SEE.Extensions; +using SEE.UserSettings; using Sirenix.OdinInspector; using System; using System.Collections.Generic; @@ -161,7 +162,7 @@ private void SpawnOnServerRpc(ulong clientId, string playerName, uint avatarInde /// private void SpawnPlayer() { - Net.Network networkConfig = User.UserSettings.Instance.Network + Net.Network networkConfig = UserSetting.Instance.Network ?? throw new Exception("Network configuration not found.\n"); // Wait until Dissonance is created. @@ -171,7 +172,7 @@ private void SpawnPlayer() // We need to set the local player name in DissonanceComms // before Dissonance is started. That is why we cannot afford // to wait until the next frame. - dissonanceComms.LocalPlayerName = User.UserSettings.Instance.Player.PlayerName; + dissonanceComms.LocalPlayerName = UserSetting.Instance.Player.PlayerName; } NetworkManager networkManager = NetworkManager.Singleton; @@ -201,7 +202,7 @@ private void SpawnPlayer() if (networkManager.IsHost) { // Spawn the local player for this host. - Spawn(networkManager.LocalClientId, User.UserSettings.Instance.Player.PlayerName, User.UserSettings.Instance.Player.AvatarIndex); + Spawn(networkManager.LocalClientId, UserSetting.Instance.Player.PlayerName, UserSetting.Instance.Player.AvatarIndex); } } @@ -248,7 +249,7 @@ private static void ClientDisconnects(ulong clientId) private void OnClientIsConnected(ulong clientId) { Log($"Player with client {clientId} is connected with server (client side).\n"); - SpawnOnServerRpc(clientId, User.UserSettings.Instance.Player.PlayerName, User.UserSettings.Instance.Player.AvatarIndex); + SpawnOnServerRpc(clientId, UserSetting.Instance.Player.PlayerName, UserSetting.Instance.Player.AvatarIndex); } /// diff --git a/Assets/SEE/GameObjects/BranchCity/VCSDecorator.cs.meta b/Assets/SEE/GameObjects/BranchCity/VCSDecorator.cs.meta deleted file mode 100644 index 90491540f6..0000000000 --- a/Assets/SEE/GameObjects/BranchCity/VCSDecorator.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 3e3c5d77d829c8f49a0190bfe5061c92 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/Decorators.meta b/Assets/SEE/GameObjects/Decorators.meta deleted file mode 100644 index 8ea8b82f85..0000000000 --- a/Assets/SEE/GameObjects/Decorators.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: b429fb69fba64eb0b73cc241d203cfa5 -timeCreated: 1626113754 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/Decorators/AntennaDecorator.cs.meta b/Assets/SEE/GameObjects/Decorators/AntennaDecorator.cs.meta deleted file mode 100644 index 8db2513eb7..0000000000 --- a/Assets/SEE/GameObjects/Decorators/AntennaDecorator.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 5562ce0db1915474fb08caff2d551a92 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/GameObjects/ErosionIssues.cs.meta b/Assets/SEE/GameObjects/ErosionIssues.cs.meta deleted file mode 100644 index 6b18e20620..0000000000 --- a/Assets/SEE/GameObjects/ErosionIssues.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 09902848d88f07841a4b34b712b378a1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/GameObjects/GO.cs b/Assets/SEE/GameObjects/GO.cs deleted file mode 100644 index 7e88e799b9..0000000000 --- a/Assets/SEE/GameObjects/GO.cs +++ /dev/null @@ -1,9 +0,0 @@ -/// -/// SEE.GO (GO for GameObjects) contains factories that create game objects -/// to be shown in the scene. These factories may be used at -/// design time (in the Unity editor) as well as run time -/// (during the game). -/// -namespace SEE.GO -{ -} \ No newline at end of file diff --git a/Assets/SEE/GameObjects/GO.cs.meta b/Assets/SEE/GameObjects/GO.cs.meta deleted file mode 100644 index c52dc34f52..0000000000 --- a/Assets/SEE/GameObjects/GO.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d8ab0a45c112f7748832ad202480df6c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/GameObjects/GameObjectExtensions.cs b/Assets/SEE/GameObjects/GameObjectExtensions.cs deleted file mode 100644 index ff9e391009..0000000000 --- a/Assets/SEE/GameObjects/GameObjectExtensions.cs +++ /dev/null @@ -1,1731 +0,0 @@ -using SEE.Controls; -using SEE.DataModel.DG; -using SEE.DataModel.Drawable; -using SEE.Game; -using SEE.Game.City; -using SEE.Game.Operator; -using SEE.Utils; -using Sirenix.Utilities; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using static SEE.Game.Portal.IncludeDescendants; - -namespace SEE.GO -{ - /// - /// Provides extensions for GameObjects. - /// - public static class GameObjectExtensions - { - /// - /// An extension of GameObjects to retrieve their IDs. If - /// has a NodeRef attached to it, the corresponding node's ID is returned. - /// If has an EdgeRef attached to it, the corresponding - /// edge's ID is returned. Otherwise the name of is - /// returned. - /// - /// ID for . - public static string ID(this GameObject gameObject) - { - if (gameObject.TryGetNode(out Node node)) - { - return node.ID; - } - else if (gameObject.TryGetEdge(out Edge edge)) - { - return edge.ID; - } - else - { - return gameObject.name; - } - } - - /// - /// Returns the first immediate child of that - /// is a graph node, i.e., has a attached to it - /// (checked by predicate ) or null if there - /// is none. - /// - /// The game object whose child is to be retrieved. - /// First immediate child representing a node or null if there is none. - public static GameObject FirstChildNode(this GameObject gameObject) - { - foreach (Transform child in gameObject.transform) - { - if (child.gameObject.IsNode()) - { - return child.gameObject; - } - } - return null; - } - - /// - /// Returns true if a code city was drawn for this . - /// A code city is assumed to be drawn in there is at least one immediate child - /// of this that represents a graph node, i.e., has a - /// (checked by predicate . - /// - /// This predicate can be queried for game objects representing a code city, - /// that is, game objects that have an attached to - /// them. - /// - /// The code city to checked. - /// True if a code city was drawn. - public static bool IsCodeCityDrawn(this GameObject codeCity) - { - return codeCity.transform.Cast().Any(child => child.gameObject.IsNode()); - } - - /// - /// Returns true if a code city was drawn for this and is active. - /// A code city is assumed to be drawn in there is at least one immediate child - /// of this game object that represents a graph node, i.e., has a - /// (checked by predicate . - /// - /// This predicate can be queried for game objects representing a code city, - /// that is, game objects that have an attached to - /// them. - /// - /// The code city to checked. - /// True if a code city was drawn and is active. - public static bool IsCodeCityDrawnAndActive(this GameObject codeCity) - { - return codeCity.transform.Cast().Any(child => child.gameObject.IsNode() - && child.gameObject.activeInHierarchy); - } - - /// - /// Returns true if there is any edge in the given . - /// - /// The code city to checked. - /// True if there is any edge in the given . - public static bool CodeCityHasAnyEdges(this GameObject codeCity) - { - // Edges are immediate children of the code-city game object. - return codeCity.transform.Cast().Any(child => child.gameObject.IsEdge() - && child.gameObject.activeInHierarchy); - } - - /// - /// Returns the city this is contained in. - /// If is null or if it is not contained in a city of type, null is returned. - /// - /// Object whose containing city is requested. - /// The containing city of or null. - public static AbstractSEECity ContainingCity(this GameObject gameObject) => ContainingCity(gameObject); - - /// - /// Returns the city of type this is contained. - /// If is null or if it is not contained in a city of type, null is returned. - /// - /// Object whose containing city of type - /// is requested. - /// The containing city of type of - /// or null. - /// Type of the code city that shall be returned - public static T ContainingCity(this GameObject gameObject) where T : AbstractSEECity - { - if (gameObject == null) - { - return null; - } - else - { - GameObject codeCityObject = gameObject.GetCodeCity(); - if (codeCityObject != null && codeCityObject.TryGetComponent(out T city)) - { - return city; - } - else - { - /// We do not log the fact that does not have the - /// expected type of city, as some clients are using this method just as a predicate. - return null; - } - } - } - - /// - /// Returns the closest ancestor of that - /// represents a code city, that is, is tagged by . - /// This ancestor is assumed to carry the settings (layout information etc.). - /// If none can be found, null will be returned. - /// If is tagged by , - /// it will be returned. - /// - /// Game object at which to start the search. - /// Closest ancestor game object in the game-object hierarchy tagged by - /// or null. - /// - /// Thrown if is null. - /// - public static GameObject GetCodeCity(this GameObject gameObject) - { - if (gameObject == null) - { - throw new ArgumentNullException(nameof(gameObject)); - } - Transform result = gameObject.transform; - while (result != null) - { - if (result.CompareTag(Tags.CodeCity)) - { - return result.gameObject; - } - result = result.parent; - } - return null; - } - - /// - /// Returns first child of tagged by - /// or null if none can be found. - /// - /// Object representing a code city (tagged by ). - /// Game object representing the root of the graph or null if there is none. - /// If is a node representing a code city, - /// the first child tagged as is considered the root of the graph. - /// - /// Thrown if is null. - /// - public static GameObject GetCityRootNode(this GameObject codeCity) - { - if (codeCity == null) - { - throw new ArgumentNullException(nameof(codeCity)); - } - foreach (Transform child in codeCity.transform) - { - if (child.CompareTag(Tags.Node)) - { - return child.transform.gameObject; - } - } - return null; - } - - /// - /// True if represents a leaf in the graph. - /// - /// Precondition: has a component - /// attached to it that is a valid graph node reference. - /// - /// Game object representing a Node to be queried whether it is a leaf. - /// True if represents a leaf in the graph. - public static bool IsLeaf(this GameObject gameNode) - { - return gameNode.TryGetNode(out Node node) && node.IsLeaf(); - } - - /// - /// True if represents the root of the graph. - /// - /// Precondition: has a component - /// attached to it that is a valid graph node reference. - /// - /// Game object representing a Node to be queried whether it is a root node. - /// True if represents a root in the graph. - public static bool IsRoot(this GameObject gameNode) - { - return gameNode.TryGetNode(out Node node) && node.IsRoot(); - } - - /// - /// True if represents the implementation or architecture root of - /// the graph. - /// - /// Precondition: has a component - /// attached to it that is a valid graph node reference. - /// - /// Game object representing a Node to be queried whether it is an implementation or architecture root. - /// True if represents an implementation or architecture root in the graph. - public static bool IsArchitectureOrImplementationRoot(this GameObject gameNode) - { - return gameNode.TryGetNode(out Node node) && node.IsArchitectureOrImplementationRoot(); - } - - /// - /// Returns all game objects tagged as that are descendants - /// of . - /// - /// Root game object to be traversed. - /// All game objects tagged as . - internal static IEnumerable AllEdges(this GameObject gameObject) - { - return gameObject.AllDescendants(Tags.Edge); - } - - /// - /// Returns all transitive children of tagged by - /// given (including itself). - /// - /// The game object whose children are requested. - /// The tag the descendants must have. - /// All transitive children with . - public static List AllDescendants(this GameObject gameObject, string tag) - { - List result = new(); - if (gameObject.CompareTag(tag)) - { - result.Add(gameObject); - } - - foreach (Transform child in gameObject.transform) - { - result.AddRange(child.gameObject.AllDescendants(tag)); - } - - return result; - } - - /// - /// Applies to all (transitive) descendants of - /// (including ) if they have the given . - /// - /// The game object on which to apply the . - /// The tag the descendants must have. - /// The action to be applied. - public static void ApplyToAllDescendants(this GameObject root, string tag, Action action) - { - if (root.CompareTag(tag)) - { - action(root); - } - - foreach (Transform child in root.transform) - { - child.gameObject.ApplyToAllDescendants(tag, action); - } - } - - /// - /// Returns the first descendant of the given with the given - /// (attribute 'name' of a GameObject). - /// Will also return inactive game objects. If no such descendant exists, null will be returned. - /// Unlike , this method will descend into the game-object hierarchy. - /// - /// Root object. - /// Name of the descendant to be found. - /// Found game object or null. - public static GameObject Descendant(this GameObject gameObject, string name) - { - foreach (Transform child in gameObject.transform) - { - if (child.name == name) - { - return child.gameObject; - } - else - { - GameObject ancestor = child.gameObject.Descendant(name); - if (ancestor != null) - { - return ancestor; - } - } - } - - return null; - } - - /// - /// Returns all descendants of having a name contained in . - /// The result will also include inactive game objects, but does not contain itself. - /// This method will descend into the game-object hierarchy rooted by . - /// - /// Precondition: is not null. - /// - /// Root of the game-object hierarchy to be searched. - /// List of names any of the game objects to be retrieved should have. - /// Found game objects. - public static IList Descendants(this GameObject gameObject, ISet gameObjectIDs) - { - List result = new(); - foreach (Transform child in gameObject.transform) - { - if (gameObjectIDs.Contains(child.name)) - { - result.Add(child.gameObject); - } - - result.AddRange(child.gameObject.Descendants(gameObjectIDs)); - } - - return result; - } - - /// - /// Sets the color for this to given . - /// - /// Precondition: has a renderer whose material has a color attribute. - /// - /// - /// Object whose color is to be set. - /// The new color to be set. - public static void SetColor(this GameObject gameObject, Color color) - { - if (gameObject.TryGetComponent(out Renderer renderer)) - { - renderer.sharedMaterial.color = color; - } - } - - /// - /// Retrieves the color from this . - /// - /// Precondition: has a renderer whose material has a color attribute. - /// - /// Object whose color is to be returned. - /// Color of this . - /// - /// If this has no renderer attached to it. - /// - public static Color GetColor(this GameObject gameObject) - { - return gameObject.MustGetComponent().sharedMaterial.color; - } - - /// - /// Sets the alpha value (transparency) of the given - /// to . - /// - /// Game objects whose transparency is to be set. - /// A value in between 0 and 1 for transparency. - public static void SetTransparency(this GameObject gameObject, float alpha) - { - if (gameObject.TryGetComponent(out Renderer renderer)) - { - Color oldColor = renderer.material.color; - renderer.material.color = oldColor.WithAlpha(alpha); - } - } - - /// - /// Sets the start and end line color of . - /// - /// Precondition: must have a line renderer. - /// - /// Object holding a line renderer whose start and end color is to be set. - /// Start color of the line. - /// End color of the line. - public static void SetLineColor(this GameObject gameObject, Color startColor, Color endColor) - { - if (gameObject.TryGetComponent(out LineRenderer renderer)) - { - renderer.startColor = startColor; - renderer.endColor = endColor; - } - } - - /// - /// Sets the visibility and the collider of this to . - /// If is false, the object becomes invisible. If it is true - /// instead, it becomes visible. - /// - /// If is false, only the renderer of - /// is turned on/off, which will not affect whether the - /// is active or inactive. If has children, their - /// renderers will not be changed. - /// - /// If is true, the operation applies to all descendants, too. - /// - /// Precondition: must have a Renderer. - /// - /// Object whose visibility is to be changed. - /// Whether or not to make the object visible. - /// If true, the operation applies to all descendants, too. - public static void SetVisibility(this GameObject gameObject, bool show, bool includingChildren = true) - { - if (gameObject.TryGetComponent(out Renderer renderer)) - { - renderer.enabled = show; - } - - if (gameObject.TryGetComponent(out Collider collider)) - { - collider.enabled = show; - } - - if (includingChildren) - { - foreach (Transform child in gameObject.transform) - { - child.gameObject.SetVisibility(show, includingChildren); - } - } - } - - /// - /// Sets the scale of this to independent from - /// the local scale of its parent. - /// - /// Object whose scale should be set. - /// The new scale in world space. - /// If true and is a graph node, - /// a will be used to animate the scaling; otherwise the - /// scale of is set immediately without any animation. - public static void SetAbsoluteScale(this GameObject gameObject, Vector3 worldScale, bool animate = true) - { - Transform parent = gameObject.transform.parent; - gameObject.transform.parent = null; - if (animate && gameObject.HasNodeRef()) - { - NodeOperator @operator = gameObject.NodeOperator(); - @operator.ScaleTo(worldScale, 0f); - } - else - { - gameObject.transform.localScale = worldScale; - } - gameObject.transform.parent = parent; - } - - /// - /// Returns the world-space y position of the roof of this . - /// - /// Game object whose roof has to be determined. - /// World-space y position of the roof of this . - /// This does not consider the position of descendants if there are any. - /// Consider if you want to - /// take descendants into account, too. - public static float GetRoof(this GameObject gameObject) - { - return gameObject.transform.position.y + gameObject.WorldSpaceSize().y / 2.0f; - } - - /// - /// Returns the world-space center position of the roof of this . - /// - /// Game object whose roof has to be determined. - /// World-space center position of the roof of this . - /// This does not consider the position of descendants if there are any. - /// Consider if you want to - /// take descendants into account, too. - public static Vector3 GetRoofCenter(this GameObject gameObject) - { - Vector3 result; - if (gameObject.TryGetComponent(out SEESpline spline)) - { - // Splines aren't actually positioned at their game object's position, - // but their position can be determined by their middle control point. - result = spline.GetMiddleControlPoint(); - result.y += spline.Radius; - } - else - { - result = gameObject.transform.position; - result.y += gameObject.WorldSpaceSize().y / 2.0f; - } - return result; - } - - /// - /// Returns the world-space center position of the ground of this . - /// - /// Game object whose ground has to be determined. - /// World-space center position of the ground of this . - public static Vector3 GetGroundCenter(this GameObject gameObject) - { - Vector3 result = gameObject.transform.position; - result.y -= gameObject.WorldSpaceSize().y / 2.0f; - return result; - } - - /// - /// Returns the maximal world-space position (y co-ordinate) of the roof of - /// this or any of its active descendants. - /// Unlike , this method recurses into - /// the game-object hierarchy rooted by . - /// - /// Note: only descendants that are currently active in the scene are considered. - /// - /// Game object whose height has to be determined. - /// Function returning true for descendant transforms that shall be taken into - /// account. By default, this is a constant function which always returns true. - /// World-space position of the roof of this - /// or any of its active descendants. - public static float GetMaxY(this GameObject gameObject, Func filterTransform = null) - { - float result = float.NegativeInfinity; - filterTransform ??= _ => true; - Recurse(gameObject, ref result); - return result; - - void Recurse(GameObject root, ref float max) - { - float roof = root.GetRoof(); - if (max < roof) - { - max = roof; - } - - foreach (Transform child in root.transform) - { - if (child.gameObject.activeInHierarchy && filterTransform(child)) - { - Recurse(child.gameObject, ref max); - } - } - } - } - - /// - /// Returns the maximal world-space center position of the hull of - /// this . The hull includes - /// and any of its active descendants. - /// Unlike , this method recurses into - /// the game-object hierarchy rooted by . - /// - /// Note: only descendants that are currently active in the scene are considered. - /// - /// Game object whose center top has to be determined. - /// Function returning true for descendant transforms that shall be taken into - /// account. By default, this is a constant function which always returns true. - /// World-space position of the center top of the hull of this . - /// - /// The result is in world space of . If your are interested - /// in local space, use instead. - public static Vector3 GetTop(this GameObject gameObject, Func filterTransform = null) - { - Vector3 result = gameObject.transform.position; - result.y = gameObject.GetMaxY(filterTransform); - return result; - } - - /// - /// Returns the maximal local-space center position of the hull of - /// this . The hull includes - /// and any of its active descendants. - /// Note: only descendants that are currently active in the scene are considered. - /// - /// Game object whose center top has to be determined. - /// Function returning true for descendant transforms that shall be taken into - /// account. By default, this is a constant function which always returns true. - /// Local-space position of the center top of the hull of this . - /// - /// The result is in local space of . If your are interested - /// in world space, use instead. - public static float GetRelativeTop(this GameObject gameObject, Func filterTransform = null) - { - float top = gameObject.GetMaxY(filterTransform); - return top - gameObject.transform.position.y; - } - /// - /// Provides the size and the mesh offset of the given in world space. - /// This does not include the size of descendants if there are any. - /// - /// This value reflects the actual world-space bounds of the axis-aligned cuboid that contains the rendered - /// object. - /// Please note that the is only the scale factor and not the actual size of - /// a rendered object. - /// Similarly, is not necessarily the center point of the rendered object. - /// - /// - /// - /// If a is attached, the will be used. - /// - /// If a is attached, the bounds will be calculated based on its positions with a - /// performance penalty (see ). - /// - /// If a is attached, the will be used. - /// - /// Else, and are provided and a warning - /// is logged. - /// It means that either the object is not rendered at all or this method needs to be extended. - /// - /// - /// - /// Local-space counterpart: - /// - /// - /// Object whose scale is requested. - /// Out parameter for the world-space position of the object. - /// Out parameter for the world-space size of the object. - /// True if the size was successfully retrieved, false if the fallback was used. - public static bool WorldSpaceSize(this GameObject gameObject, out Vector3 size, out Vector3 position) - { - // Rely on collider bounds if available. - if (gameObject.TryGetComponent(out Collider collider)) - { - size = collider.bounds.size; - position = collider.bounds.center; - return true; - } - - // For objects with a LineRenderer, we can use its positions to determine its bounds. - // Otherwise Unity will return overly large bounds. - if (gameObject.TryGetComponent(out LineRenderer lineRenderer)) - { - Bounds lineBounds = GeometryUtils.CalculateLineBounds(lineRenderer, true); - size = lineBounds.size; - position = lineBounds.center; - return true; - } - - // For some objects, such as capsules or custom meshes, lossyScale gives wrong results. - // The more reliable option to determine the size is using the - // object's renderer if it has one. - if (gameObject.TryGetComponent(out Renderer renderer)) - { - size = renderer.bounds.size; - position = renderer.bounds.center; - return true; - } - - // No renderer, so we use lossyScale as a fallback. - // Note: This may happen for container objects that have no mesh. - size = gameObject.transform.lossyScale; - position = gameObject.transform.position; - return false; - } - - /// - /// Returns the size of the given in world space. - /// This does not include the size of descendants if there are any. - /// - /// This is a shorthand method for that only returns the size. - /// See there for additional documentation. - /// - /// Use directly if you need both position and size. - /// - /// Local-space counterpart: - /// - /// - /// Object whose size is requested. - /// Size of given . - public static Vector3 WorldSpaceSize(this GameObject gameObject) - { - WorldSpaceSize(gameObject, out Vector3 size, out Vector3 _); - return size; - } - - /// - /// Provides the size and the mesh offset of the given in local space, - /// i.e., in relation to its parent. - /// This does not include the size of descendants if there are any. - /// - /// This value should often be used instead of the because the scale only - /// reflects the size for objects with a standardized size like cube primitives. Similarly, the - /// can be significantly off the object's center. - /// - /// - /// - /// If a is attached, the will be used and converted into - /// local space. - /// - /// If a is attached, the bounds will be calculated based on its positions with a - /// performance penalty (see ). - /// - /// If a is attached, the will be used. - /// - /// Else, and are provided and a - /// warning is logged. - /// It means that either the object is not rendered at all or this method needs to be extended. - /// - /// - /// - /// World-space counterpart: - /// - /// - /// Object whose scale is requested. - /// Out parameter for the local size of the object. - /// Out parameter for the local position of the object. - /// True if the has a size, false if the fallback was used. - public static bool LocalSize(this GameObject gameObject, out Vector3 size, out Vector3 position) - { - // Rely on collider bounds if available. - if (gameObject.TryGetComponent(out Collider collider)) - { - size = getLocalColliderSize(collider); - position = collider.transform.InverseTransformPoint(collider.bounds.center) + gameObject.transform.localPosition; - return true; - } - - // For objects with a LineRenderer, we can use its positions to determine its bounds. - // Otherwise Unity will return overly large bounds. - if (gameObject.TryGetComponent(out LineRenderer lineRenderer)) - { - Bounds lineBounds = GeometryUtils.CalculateLineBounds(lineRenderer, false); - size = lineBounds.size; - position = lineBounds.center; - return true; - } - - // For some objects, such as capsules or custom meshes, localScale gives wrong results. - // The more reliable option to determine the size is using the object's mesh if it has one. - Mesh sharedMesh; - if (gameObject.TryGetComponent(out MeshFilter meshFilter) && (sharedMesh = meshFilter.sharedMesh) != null) - { - size = Vector3.Scale(sharedMesh.bounds.size, gameObject.transform.localScale); - position = sharedMesh.bounds.center + gameObject.transform.localPosition; - return true; - } - - // No mesh, so we use localScale as a fallback. - // Note: This should not happen. If the object has no mesh, it has no size at all. - Debug.LogWarning($"GameObject has no mesh or LineRenderer, using localScale as fallback: {gameObject.name}"); - size = gameObject.transform.localScale; - position = gameObject.transform.localPosition; - return false; - - Vector3 getLocalColliderSize(Collider collider) - { - Vector3 localScale = collider.transform.localScale; - - if (collider is BoxCollider box) - { - return Vector3.Scale(box.size, localScale); - } - else if (collider is SphereCollider sphere) - { - float diameter = sphere.radius * 2f; - // Sphere scales uniformly in all axes - return new Vector3(diameter, diameter, diameter) * Mathf.Max(localScale.x, Mathf.Max(localScale.y, localScale.z)); - } - else if (collider is CapsuleCollider capsule) - { - float diameter = capsule.radius * 2f; - Vector3 size = Vector3.zero; - switch (capsule.direction) - { - case 0: // X axis - size = new Vector3(capsule.height, diameter, diameter); - break; - case 1: // Y axis - size = new Vector3(diameter, capsule.height, diameter); - break; - case 2: // Z axis - size = new Vector3(diameter, diameter, capsule.height); - break; - default: - // This should never happen - throw new NotImplementedException(); - } - size.x *= localScale.x; - size.y *= localScale.y; - size.z *= localScale.z; - return size; - } - else if (collider is MeshCollider meshCollider) - { - Mesh mesh = meshCollider.sharedMesh; - if (mesh != null) - { - return Vector3.Scale(mesh.bounds.size, localScale); - } - else - { - return Vector3.zero; - } - } - else - { - // Fallback: bounds.size is in world space, convert to local by dividing by scale - Debug.LogWarning($"GameObject has unknown collider type, using localScale as fallback: {gameObject.name}"); - Bounds worldBounds = collider.bounds; - Vector3 worldSize = worldBounds.size; - return new Vector3( - localScale.x != 0 ? worldSize.x / localScale.x : 0, - localScale.y != 0 ? worldSize.y / localScale.y : 0, - localScale.z != 0 ? worldSize.z / localScale.z : 0); - } - } - } - - /// - /// Returns the size of the given in local space, - /// i.e., in relation to its parent. - /// - /// This is a shorthand method for that only returns the size. - /// See there for additional documentation. - /// - /// Use directly if you need both position and size. - /// - /// World-space counterpart: - /// - /// - /// Object whose size is requested. - /// Size of given . - public static Vector3 LocalSize(this GameObject gameObject) - { - LocalSize(gameObject, out Vector3 size, out Vector3 _); - return size; - } - - /// - /// Returns the bounds of the given in its own - /// local coordinate system. - /// - /// Note: A primitive cube has a size of (1,1,1), and a coordinate center (pivot) - /// of (0,0,0). - /// However, that does not apply for all primitives or models in general. - /// - /// - /// The game object. - /// Local-space bounds of . - public static Bounds LocalBounds(this GameObject gameObject) - { - // For objects with a LineRenderer, we can use its positions to determine its bounds. - // Otherwise Unity will return overly large bounds. - if (gameObject.TryGetComponent(out LineRenderer lineRenderer)) - { - return GeometryUtils.CalculateLineBounds(lineRenderer, false); - } - if (gameObject.TryGetComponent(out MeshFilter meshFilter)) - { - return meshFilter.sharedMesh.bounds; - } - if (gameObject.TryGetComponent(out Renderer renderer)) - { - return new( - gameObject.transform.InverseTransformPoint(renderer.bounds.center), - gameObject.transform.InverseTransformVector(renderer.bounds.size)); - } - // This fallback works for uniform primitives like cubes, but not for non-uniforms like cylinders. - return new(Vector3.zero, Vector3.one); - } - - /// - /// Returns true if this is within the spatial area of , - /// that is, if the bounding box of plus the extra padding - /// is fully contained in the bounding box of . - /// - /// Note that this only checks on the XZ-plane, and ignores any height difference between the two blocks. - /// - /// We check whether this block is included in 's area. - /// - /// The block whose area shall be checked. - /// Additional margins that should be added inward the area. - /// True if this is within the area of . - /// - public static bool IsInArea(this GameObject block, GameObject parentBlock, float outerEdgeMargin) - { - // FIXME: Support node types other than cubes - Collider collider = block.MustGetComponent(); - Vector3 blockCenter = collider.bounds.center; - // We only care about the XZ-plane. Setting z to zero here makes it consistent with the bounds setup below. - Bounds blockBounds = new(new Vector3(blockCenter.x, blockCenter.z, 0), collider.bounds.extents); - Collider parentCollider = parentBlock.MustGetComponent(); - Bounds parentBlockBounds = parentCollider.bounds; - - Vector2 topRight = parentBlockBounds.max.XZ(); - Vector2 bottomLeft = parentBlockBounds.min.XZ(); - Vector2 topLeft = topRight.WithXY(x: bottomLeft.x); - Vector2 bottomRight = topRight.WithXY(y: bottomLeft.y); - - // These represent the outer edge regions of the parent block with the margins applied. - Bounds left = new(bottomLeft, Vector3.zero); - left.Encapsulate(topLeft.WithXY(x: topLeft.x + outerEdgeMargin)); - if (left.Intersects(blockBounds)) - { - return true; - } - - Bounds right = new(bottomRight, Vector3.zero); - right.Encapsulate(topRight.WithXY(x: topRight.x - outerEdgeMargin)); - if (right.Intersects(blockBounds)) - { - return true; - } - - Bounds bottom = new(bottomLeft, Vector3.zero); - bottom.Encapsulate(bottomRight.WithXY(y: bottomRight.y + outerEdgeMargin)); - if (bottom.Intersects(blockBounds)) - { - return true; - } - - Bounds top = new(topLeft, Vector3.zero); - top.Encapsulate(topRight.WithXY(y: topRight.y - outerEdgeMargin)); - return top.Intersects(blockBounds); - } - - - /// - /// Tries to get the component of the given type of this . - /// If the component was found, it will be stored in and true will be returned. - /// If it wasn't found, will be null, false will be returned, - /// and an error message will be logged indicating that the component type wasn't present on the GameObject. - /// - /// The game object the component should be gotten from. Must not be null. - /// The variable in which to save the component. - /// The type of the component. - /// True if the component was present on the , false otherwise. - public static bool TryGetComponentOrLog(this GameObject gameObject, out T component) - { - if (!gameObject.TryGetComponent(out component)) - { - Debug.LogError($"Couldn't find component '{typeof(T).GetNiceName()}' " - + $"on game object '{gameObject.FullName()}'.\n"); - return false; - } - - return true; - } - - /// - /// Tries to get the component of the given type of this . - /// If a component of the type was found, it will be returned, otherwise a new component of the type - /// will be added and returned. - /// - /// The gameobject whose component of type - /// we wish to return. - /// The component to get / add - /// The existing or newly created component. - public static T AddOrGetComponent(this GameObject gameObject) where T : Component - { - return gameObject.TryGetComponent(out T component) ? component : gameObject.AddComponent(); - } - - /// - /// Tries to get the component of the given type of this . - /// If the component was found, it will be returned. - /// If it wasn't found, will be thrown. - /// - /// The game object the component should be gotten from. Must not be null. - /// The type of the component. - /// Thrown if has no - /// component of type . - public static T MustGetComponent(this GameObject gameObject) - { - if (!gameObject.TryGetComponent(out T component)) - { - throw new InvalidOperationException($"Couldn't find component '{typeof(T).GetNiceName()}' on game object '{gameObject.FullName()}'"); - } - return component; - } - - /// - /// Returns true if has a - /// component attached to it that is actually referring to a valid node - /// (i.e., its Value is not null). - /// - /// The game object whose NodeRef is checked. - /// True if has a - /// component attached to it whose node is non-null. - public static bool HasNodeRef(this GameObject gameObject) - { - return gameObject.TryGetComponent(out NodeRef nodeRef) && nodeRef.Value != null; - } - - /// - /// Returns true if is tagged by . - /// - /// The game object to check. - /// True if is tagged by . - public static bool IsNode(this GameObject gameObject) - { - return gameObject.CompareTag(Tags.Node); - } - - /// - /// Returns true if 's - /// is true and it is tagged by . - /// - /// The game object to check. - /// True if is an active node. - public static bool IsNodeAndActiveSelf(this GameObject gameObject) - { - return gameObject.activeSelf && gameObject.CompareTag(Tags.Node); - } - - /// - /// Returns true if 's - /// is true and it is tagged by . - /// - /// The game object to check. - /// True if is an active node. - public static bool IsNodeAndActiveInHierarchy(this GameObject gameObject) - { - return gameObject.CompareTag(Tags.Node) && gameObject.activeInHierarchy; - } - - /// - /// Retrieves the node reference component, if possible. - /// - /// The game object whose NodeRef is checked. - /// The attached NodeRef; defined only if this method - /// returns true. - /// True if has a - /// component attached to it. - public static bool TryGetNodeRef(this GameObject gameObject, out NodeRef nodeRef) - { - return gameObject.TryGetComponent(out nodeRef); - } - - /// - /// Returns true if has a - /// component attached to it that is not null. - /// - /// The game object whose NodeRef is checked. - /// The node referenced by the attached NodeRef; defined only if this method - /// returns true. - /// True if has a - /// component attached to it that is not null. - public static bool TryGetNode(this GameObject gameObject, out Node node) - { - node = null; - if (gameObject.TryGetComponent(out NodeRef nodeRef)) - { - node = nodeRef.Value; - } - return node != null; - } - - /// - /// Returns true if has a - /// component attached to it that is not null. - /// - /// The game object whose DrawableSurfaceRef is checked. - /// The surface referenced by the attached DrawableSurfaceRef; defined only if this method - /// returns true. - /// True if has a - /// component attached to it that is not null. - public static bool TryGetDrawableSurface(this GameObject gameObject, out DrawableSurface surface) - { - surface = null; - if (gameObject.TryGetComponent(out DrawableSurfaceRef surfaceRef)) - { - surface = surfaceRef.Surface; - } - return surface != null; - } - - /// - /// Returns the graph node represented by this . - /// - /// Precondition: must have a - /// attached to it referring to a valid node; if not, an exception is raised. - /// - /// The game object whose is requested. - /// The correponding graph node (will never be null). - /// Thrown if has - /// no valid or . - /// This method is similar to , but throws an exception - /// if the node is not found. It is analogous to . - public static Node GetNode(this GameObject gameObject) - { - if (gameObject.TryGetComponent(out NodeRef nodeRef)) - { - if (nodeRef != null) - { - if (nodeRef.Value != null) - { - return nodeRef.Value; - } - else - { - throw new NullReferenceException($"Node referenced by game object {gameObject.name} is null."); - } - } - else - { - throw new NullReferenceException($"Node reference of game object {gameObject.name} is null."); - } - } - else - { - throw new NullReferenceException($"Game object {gameObject.name} has no NodeRef."); - } - } - - /// - /// Returns true if has an - /// component attached to it whose edge is not null. - /// - /// The game object whose EdgeRef is checked. - /// True if has an - /// component attached to it whose edge is not null. - public static bool HasEdgeRef(this GameObject gameObject) - { - return gameObject.TryGetComponent(out EdgeRef edgeRef) && edgeRef.Value != null; - } - - /// - /// Returns true if is tagged by . - /// - /// The game object to check. - /// True if is tagged by . - public static bool IsEdge(this GameObject gameObject) - { - return gameObject.CompareTag(Tags.Edge); - } - - /// - /// Returns true if has an - /// component attached to it that is not null. - /// - /// The game object whose EdgeRef is checked. - /// The edge referenced by the attached EdgeRef; defined only if this method - /// returns true. - /// True if has an - /// component attached to it that is not null. - public static bool TryGetEdge(this GameObject gameObject, out Edge edge) - { - edge = null; - if (gameObject.TryGetComponent(out EdgeRef edgeRef)) - { - edge = edgeRef.Value; - } - - return edge != null; - } - - /// - /// Returns the graph edge represented by this . - /// - /// Precondition: must have an - /// attached to it referring to a valid edge; if not, an exception is raised. - /// - /// The game object whose is requested. - /// The corresponding graph edge (will never be null). - /// Thrown if has - /// no valid or . - /// This method is similar to , but throws an exception - /// if the edge is not found. It is analogous to . - public static Edge GetEdge(this GameObject gameObject) - { - if (gameObject.TryGetComponent(out EdgeRef edgeRef)) - { - if (edgeRef != null) - { - if (edgeRef.Value != null) - { - return edgeRef.Value; - } - else - { - throw new NullReferenceException($"Edge referenced by game object {gameObject.name} is null."); - } - } - else - { - throw new NullReferenceException($"Edge reference of game object {gameObject.name} is null."); - } - } - else - { - throw new NullReferenceException($"Game object {gameObject.name} has no EdgeRef."); - } - } - - /// - /// Returns the graph containing the node represented by this . - /// - /// Precondition: must have a - /// attached to it referring to a valid node; if not, an exception is raised. - /// - /// The game object whose graph is requested. - /// The correponding graph. - public static Graph ItsGraph(this GameObject gameObject) - { - return gameObject.GetNode().ItsGraph; - } - - /// - /// Enables/disables the renderers of and all its - /// descendants so that they become visible/invisible. - /// - /// Objects whose renderer (and those of its children) is to be enabled/disabled. - /// Iff true, the renderers will be enabled. - private static void SetVisible(this GameObject gameObject, bool isVisible) - { - gameObject.GetComponent().enabled = isVisible; - foreach (Transform child in gameObject.transform) - { - SetVisible(child.gameObject, isVisible); - } - } - - /// - /// Returns the full name of the game object, that is, its name and the - /// names of its ancestors in the game-object hierarchy separated by /. - /// If is null, "" will be returned. - /// - /// Game object for which to retrieve the full name. - /// Can be null. - public static string FullName(this GameObject gameObject) - { - if (gameObject == null) - { - return ""; - } - string result = gameObject.name; - while (gameObject.transform.parent != null) - { - gameObject = gameObject.transform.parent.gameObject; - result = gameObject.name + "/" + result; - } - - return result; - } - - /// - /// Returns all active descendants of given tagged by - /// including itself. - /// - /// The root of the node hierarchy to be collected. - /// All descendants of including . - public static IList AllDescendants(this GameObject rootNode) - { - IList result = new List() { rootNode }; - AllDescendants(rootNode, result); - return result; - } - - /// - /// Adds all active descendants of to - /// (only if tagged by ). - /// - /// Note: is assumed to be contained in - /// already. - /// - /// The root of the game-object hierarchy to be collected. - /// Where to add the descendants. - private static void AllDescendants(GameObject root, IList result) - { - foreach (Transform child in root.transform) - { - if (child.gameObject.activeInHierarchy && child.gameObject.CompareTag(Tags.Node)) - { - result.Add(child.gameObject); - AllDescendants(child.gameObject, result); - } - } - } - - /// - /// Returns the source node of the given . - /// The is assumed to represent an edge, that is, - /// is tagged by and has an . - /// If this is not the case, an exception is thrown. If the source node - /// of this edge does not exist, an exception is thrown, too. - /// - /// Game object representing an edge. - /// The game object representing the source of this edge. - public static GameObject Source(this GameObject gameObject) - { - if (gameObject.CompareTag(Tags.Edge) && gameObject.TryGetComponent(out EdgeRef edgeRef)) - { - return GraphElementIDMap.Find(edgeRef.SourceNodeID, mustFindElement: true); - } - else - { - throw new Exception($"Game object {gameObject.name} is not an edge. It has no source node."); - } - } - - /// - /// Returns the target node of the given . - /// The is assumed to represent an edge, that is, - /// is tagged by and has an . - /// If this is not the case, an exception is thrown. If the target node - /// of this edge does not exist, an exception is thrown, too. - /// - /// Game object representing an edge. - /// The game object representing the target of this edge. - public static GameObject Target(this GameObject gameObject) - { - if (gameObject.CompareTag(Tags.Edge) && gameObject.TryGetComponent(out EdgeRef edgeRef)) - { - return GraphElementIDMap.Find(edgeRef.SourceNodeID, mustFindElement: true); - } - else - { - throw new Exception($"Game object {gameObject.name} is not an edge. It has no target node."); - } - } - - /// - /// Updates the portal of this game object by setting the boundaries of itself - /// (and its descendants, depending on ) - /// to the code city they're contained in. - /// If they're not contained in a code city and is true, - /// a warning log message will be emitted, otherwise nothing will happen. - /// - /// The game object whose portal shall be updated. - /// - /// Whether a warning log message shall be emitted if the - /// is not attached to any code city. - /// - /// - /// Whether the portal of the descendants of this shall be updated too. - /// - public static void UpdatePortal(this GameObject gameObject, bool warnOnFailure = false, - Portal.IncludeDescendants includeDescendants = OnlySelf) - { - GameObject rootCity = gameObject.GetCodeCity(); - if (rootCity != null) - { - Portal.SetPortal(rootCity, gameObject, includeDescendants); - } - else if (warnOnFailure) - { - Debug.LogWarning("Couldn't update portal: No code city has been found" - + $" attached to game object {gameObject.FullName()}.\n"); - } - } - - /// - /// Enables/disables the child of with . - /// - /// Object whose child is to be enabled/disabled. - /// The name of the child; may be a composite name. - /// Whether to enable it. - public static void SetChildActive(this GameObject gameObject, string childName, bool active) - { - Transform child = gameObject.transform.Find(childName); - if (child) - { - child.gameObject.SetActive(active); - } - else - { - Debug.LogError($"Game object '{gameObject.FullName()}' does not have child with name '{childName}'.\n"); - } - } - - /// - /// Returns the for this . - /// If no operator exists yet, it will be added. - /// If the game object is not a node, an exception will be thrown. - /// - /// The game object whose operator to retrieve. - /// The responsible for this . - public static NodeOperator NodeOperator(this GameObject gameObject) - { - if (gameObject.CompareTag(Tags.Node)) - { - return gameObject.AddOrGetComponent(); - } - else - { - throw new InvalidOperationException($"Cannot get {nameof(NodeOperator)} for game object {gameObject.name} because it is not a node."); - } - } - - /// - /// Returns the for this . - /// If no operator exists yet, it will be added. - /// If the game object is not an edge, an exception will be thrown. - /// - /// The game object whose operator to retrieve. - /// The responsible for this . - public static EdgeOperator EdgeOperator(this GameObject gameObject) - { - if (gameObject.CompareTag(Tags.Edge)) - { - return gameObject.AddOrGetComponent(); - } - else - { - throw new InvalidOperationException($"Cannot get {nameof(EdgeOperator)} for game object {gameObject.name} because it is not an edge."); - } - } - - /// - /// Returns the for this . - /// If no operator exists yet, a fitting operator will be added. - /// If the game object is neither a node nor an edge, an exception will be thrown. - /// - /// The game object whose operator to retrieve. - /// The responsible for this . - public static GraphElementOperator Operator(this GameObject gameObject) - { - if (gameObject.TryGetComponent(out GraphElementOperator elementOperator)) - { - return elementOperator; - } - else - { - // We may need to add the appropriate operator first. - if (gameObject.IsNode()) - { - return gameObject.AddComponent(); - } - else if (gameObject.IsEdge()) - { - return gameObject.AddComponent(); - } - else - { - throw new InvalidOperationException($"Cannot get {nameof(GraphElementOperator)} for game object " - + $"{gameObject.name} because it is neither a node nor an edge."); - } - } - } - - /// - /// Checks if overlaps with any other active direct child node of its parent. - /// - /// Overlap is checked based on the components. Objects with no - /// component and inactive nodes are ignored. - /// - /// - /// - /// The must be a node, i.e., coantain a NodeRef component. - /// - /// The game object whose operator to retrieve. - /// False if does not have a component, - /// or does not overlap with its siblings. - /// - /// Thrown when the object the method is called on is not a node, i.e., has no - /// component. - /// - public static bool OverlapsWithSiblings(this GameObject gameObject) - { - if (!gameObject.HasNodeRef()) - { - throw new InvalidOperationException("GameObject must be a node!"); - } - if (!gameObject.TryGetComponent(out Collider collider)) - { - return false; - } - foreach (Transform sibling in gameObject.transform.parent) - { - if (sibling.gameObject == gameObject || !sibling.gameObject.IsNodeAndActiveSelf() - || !sibling.gameObject.TryGetComponent(out Collider siblingCollider)) - { - continue; - } - - if (collider.bounds.Intersects(siblingCollider.bounds)) - { - return true; - } - } - - return false; - } - - /// - /// Searches for the first child that starts with the . - /// - /// The game object whose children should be examined. - /// The prefix to search for. - /// The found child or null. - public static GameObject FindChildWithPrefix(this GameObject gameObject, string prefix) - { - foreach (Transform child in gameObject.transform) - { - if (child.name.StartsWith(prefix)) - { - return child.gameObject; - } - } - return null; - } - - /// - /// Searches for the first descendant with the specified - /// within the hierarchy of the given . - /// - /// The game object whose descendants will be searched. - /// The name of the descendant to search for. - /// If set to true, the search wil include inactive s. - /// Otherwise, only active ones will be considered. - /// The frist matching descendant with the specified , - /// or null if none is found. - public static GameObject FindDescendant(this GameObject gameObject, string descendantName, bool includeInactive = true) - { - return gameObject - .GetComponentsInChildren(includeInactive) - .FirstOrDefault(t => t.gameObject.name == descendantName)? - .gameObject; - } - - /// - /// Searches for the first descendant with the specified - /// within the hierarchy of the given . - /// - /// The game object whose descendants will be searched. - /// The tag to search for. - /// If set to true, the search will include inactive s. - /// Otherwise, only active ones will be considered. - /// The first matching descendant with the specified tag, or null if none is found. - public static GameObject FindDescendantWithTag(this GameObject gameObject, string tag, bool includeInactive = true) - { - return gameObject - .GetComponentsInChildren(includeInactive) - .FirstOrDefault(t => t.gameObject.CompareTag(tag))? - .gameObject; - } - - /// - /// QDetermines whether the has any descendant - /// with the specified . - /// - /// The root to search from. - /// The tag to search for. - /// True if a descendant with the specified tag is found; otherwise, false. - public static bool HasDescendantWithTag(this GameObject gameObject, string tag) - { - return gameObject.FindDescendantWithTag(tag) != null; - } - - /// - /// Finds all descendant s of the given - /// that have the specified tag. - /// - /// The root to start the search from. - /// The tag that matching descendants must have. - /// Whether to include inactive s in the search. - /// A list of all descendant s with the specified tag. - public static IList FindAllDescendantsWithTag(this GameObject gameObject, string tag, bool includeInactive = true) - { - return gameObject - .GetComponentsInChildren(includeInactive) - .Where(t => t.CompareTag(tag)) - .Select(t => t.gameObject) - .ToList(); - } - - /// - /// Finds all descendant s with the specified , - /// exluding those whose immediate parent has the specified . - /// - /// The root to search from. - /// The tag that matching descendants must have. - /// If the immediate parent has this tag, the child will be excluded from the result. - /// Whether inactive s should be included in the search. - /// A list of matching descendant s, excluding those whose parent has the specified tag. - public static List FindAllDescendantsWithTagExcludingSpecificParentTag(this GameObject gameObject, - string descendantTag, string immediateParentTag, bool includeInactive = true) - { - return gameObject - .GetComponentsInChildren(includeInactive) - .Where(t => t.CompareTag(descendantTag) && - t.parent != null && - !t.parent.CompareTag(immediateParentTag)) - .Select(t => t.gameObject) - .ToList(); - } - - /// - /// Finds all descendant s whose names start with the given prefix. - /// - /// Root object to search in. - /// Name prefix to match. - /// Whether inactive objects are included. - /// List of matching descendants (empty if none found). - public static List FindAllDescendantWithStartingName(this GameObject gameObject, string startName, bool includeInactive = true) - { - return gameObject - .GetComponentsInChildren(includeInactive) - .Select(t => t.gameObject) - .Where(go => go.name.StartsWith(startName, StringComparison.Ordinal)) - .ToList(); - } - - /// - /// Determines whether the specified has any ancestor - /// with the given . - /// - /// The starting whose parent hierarhcy will be searched. - /// The tag to search for. - /// True if a parent or ancestor with the specified tag is found; otherwise, false. - public static bool HasParentWithTag(this GameObject gameObject, string tag) - { - Transform transform = gameObject.transform; - while (transform.parent != null) - { - if (transform.parent.gameObject.CompareTag(tag)) - { - return true; - } - transform = transform.parent; - } - return false; - } - - /// - /// Searches upward through the transform hierarchy to find the first parent GameObject - /// with the specified name. - /// - /// The starting GameObject from which the search begins. - /// The exact name of the parent GameObject to look for. - /// - /// The first matching parent GameObject, or null if no parent with the given name is found. - /// - public static GameObject FindParentWithName(this GameObject gameObject, string name) - { - if (gameObject.transform.parent == null) - { - return null; - } - else - { - return gameObject.transform.parent.name == name ? - gameObject.transform.parent.gameObject - : FindParentWithName(gameObject.transform.parent.gameObject, name); - } - } - - /// - /// Checks recursively whether the specified GameObject has any parent - /// with the given layer. - /// - /// The starting GameObject from which the search begins. - /// The layer number to check against. - /// - /// True if any parent GameObject has the specified layer; - /// otherwise, false. - /// - public static bool HasParentWithLayer(this GameObject gameObject, uint layer) - { - if (gameObject.transform.parent == null) - { - return false; - } - else - { - return gameObject.transform.parent.gameObject.layer == layer - || HasParentWithLayer(gameObject.transform.parent.gameObject, layer); - } - } - - /// - /// Traverses up the hierachy from the given - /// and returns the highest parent. - /// - /// The starting in the hierarchy. - /// The root at the top of the hierarchy. - /// If the given object has no parent, it is returned itself. - public static GameObject GetRootParent(this GameObject gameObject) - { - Transform parent = gameObject.transform.parent; - return parent != null ? GetRootParent(parent.gameObject) : gameObject; - } - - /// - /// Updates the interaction layer of the game object, and optionally its children. - /// - /// The affected game object. - /// Should children be updated as well?. - public static void UpdateInteractableLayers(this GameObject gameObject, bool recurse = true) - { - if (gameObject.TryGetComponent(out InteractableObjectBase io)) - { - io.UpdateLayer(); - } - else - { - Debug.LogWarning($"GameObject {gameObject.name} is not an interactable object!"); - } - - if (recurse) - { - InteractableObjectBase[] children = gameObject.transform.GetComponentsInChildren(); - foreach (InteractableObjectBase child in children) - { - child.UpdateLayer(); - } - } - } - } -} diff --git a/Assets/SEE/GameObjects/GlobalGameObjectNames.cs b/Assets/SEE/GameObjects/GlobalGameObjectNames.cs deleted file mode 100644 index e9fa8f08f5..0000000000 --- a/Assets/SEE/GameObjects/GlobalGameObjectNames.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SEE.GO -{ - /// - /// Defines names for game objects expected in a scene that are used - /// in multiple places in the code. - /// - public static class GlobalGameObjectNames - { - } -} \ No newline at end of file diff --git a/Assets/SEE/GameObjects/GlobalGameObjectNames.cs.meta b/Assets/SEE/GameObjects/GlobalGameObjectNames.cs.meta deleted file mode 100644 index dbbf36b957..0000000000 --- a/Assets/SEE/GameObjects/GlobalGameObjectNames.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2b38647fa284d3e4390b11c9c6a005a9 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/GameObjects/HideSourceCodeAndPaper.cs b/Assets/SEE/GameObjects/HideSourceCodeAndPaper.cs deleted file mode 100644 index 20b0fd283f..0000000000 --- a/Assets/SEE/GameObjects/HideSourceCodeAndPaper.cs +++ /dev/null @@ -1,25 +0,0 @@ -using UnityEngine; - -namespace SEE.GO -{ - [ExecuteInEditMode] - public class HideSourceCodeAndPaper : MonoBehaviour - { - private void Start() - { - GameObject textObject = transform.Find("SourceCode").gameObject; - GameObject paperObject = transform.Find("Paper").gameObject; - - if ((textObject != null) && (paperObject != null)) - { - // Debug.Log("Hide SourceCode."); - //textObject.hideFlags = HideFlags.HideInHierarchy; - //paperObject.hideFlags = HideFlags.HideInHierarchy; - } - else - { - Debug.Log("No SourceCode or Paper object found."); - } - } - } -} diff --git a/Assets/SEE/GameObjects/HideSourceCodeAndPaper.cs.meta b/Assets/SEE/GameObjects/HideSourceCodeAndPaper.cs.meta deleted file mode 100644 index 2f346d941c..0000000000 --- a/Assets/SEE/GameObjects/HideSourceCodeAndPaper.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c9f3ca71a754ef440ab05dc1619136a3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/GameObjects/TextGUIAndPaperResizer.cs b/Assets/SEE/GameObjects/TextGUIAndPaperResizer.cs deleted file mode 100644 index 582c275f46..0000000000 --- a/Assets/SEE/GameObjects/TextGUIAndPaperResizer.cs +++ /dev/null @@ -1,151 +0,0 @@ -using TMPro; -using UnityEngine; - -namespace SEE.GO -{ - /// - /// Scales the text area and the paper background so that a given text fits into. - /// We assume this component is attached to a game object that contains two more - /// child game objects: one named "Text" having a TextMeshPro component - /// used to show the text and one named "Paper" which provides the background - /// of the text to be shown. - /// - /// This scaling works both in the editor mode and during the game. - /// - [ExecuteInEditMode] - public class TextGUIAndPaperResizer : MonoBehaviour - { - [SerializeField, Tooltip("Text to be shown")] - private string text = ""; - - /// - /// The text to be shown. When new text is assigned, the object resizes - /// so that the text fits. - /// - public string Text - { - get => text; - set - { - text = value; - Resize(); - } - } - - [SerializeField, Tooltip("Text margin")] - public Vector2 Margin = new Vector2(1, 1); // default margin - - [Tooltip("Scale of the font")] - public float FontScale = 1.0f; - - private const float distanceBetweenPaperAndText = 0.0001f; - - /// - /// Scaling factor for line width of 89 chars on a 1 m line (without margins). - /// - private const float fontScaleFactor = 0.00458f; - - /// - /// The name of the game object representing the background paper (paperObject). - /// - private const string paperName = "Paper"; - /// - /// The child game object used as a background for the text to be shown. - /// - protected GameObject PaperObject = null; - /// - /// The bounds of the mesh of paperObject. It is used to scale the background. - /// - protected Bounds PaperObjectMeshBounds = new Bounds(); - - /// - /// The name of the game object representing the text (textObject). - /// - private const string textName = "Text"; - /// - /// The child game object containing a TextMeshPro component for showing the text. - /// - protected GameObject TextObject = null; - /// - /// The TextMeshPro component contained in textObject, which is used to show the text. - /// - protected TMP_Text TextComponent = null; - - /// - /// Sets paperObject, paperObjectMeshBounds, textObject, and textComponent. - /// textComponent is set to resize to its content automatically. - /// - private void OnEnable() - { - PaperObject = transform.Find(paperName).gameObject; - if (PaperObject == null) - { - Debug.LogErrorFormat("Game object {0} does not have a child named {1}.\n", gameObject.name, paperName); - } - Mesh paperObjectMesh = PaperObject.GetComponent().sharedMesh; - PaperObjectMeshBounds = paperObjectMesh.bounds; - TextObject = transform.Find(textName).gameObject; - if (TextObject == null) - { - Debug.LogErrorFormat("Game object {0} does not have a child named {1}.\n", gameObject.name, textName); - } - TextComponent = TextObject.GetComponent(); - if (TextComponent == null) - { - Debug.LogErrorFormat("The child {0} of game object {0} does not have a TextMeshPro component.\n", textName, gameObject.name); - } - TextComponent.autoSizeTextContainer = true; - Resize(); - } - - /// - /// This method will be called in the editor mode by TextGUIAndPaperResizerEditor when - /// the user enters a text. Then the textComponent, paperObject, and textObject - /// are adjusted so that the text fits. - /// - public void OnGuiChangedHandler() - { - Resize(); - } - - /// - /// Resizes textComponent, paperObject, and textObject so that the text fits. - /// - private void Resize() - { - TextComponent.margin = new Vector4(Margin[0], Margin[1], Margin[0], Margin[1]); - TextComponent.SetText(text, true); - TextComponent.transform.localScale = new Vector3(FontScale * fontScaleFactor, FontScale * fontScaleFactor, 1); - TextComponent.ComputeMarginSize(); - TextComponent.ClearMesh(); - - float overallScale = FontScale * fontScaleFactor; - - // Set preferredWidth and preferredHeight including margins. - // x = paper width, y = paper depth, z = paper height - Vector3 newPaperScale = new Vector3(TextComponent.preferredWidth * overallScale / PaperObjectMeshBounds.size.x, - 0.000001f, - TextComponent.preferredHeight * overallScale / PaperObjectMeshBounds.size.z); - PaperObject.transform.localScale = newPaperScale; - - // set new rect width and height for fitting together with paper - TextObject.GetComponent().sizeDelta = new Vector2(TextComponent.preferredWidth, TextComponent.preferredHeight); - } - - /// - /// Returns the height (y axis) of the given . - /// - /// Precondition: must meet the assumption - /// described above: it must have a child named "Paper" with a MeshRenderer - /// from which the height can be derived. - /// - /// Object whose height is requested. - /// Height. - public static float Height(GameObject textOnPaper) - { - GameObject paper = textOnPaper.transform.Find(paperName).gameObject; - MeshRenderer paperRenderer = paper.GetComponent(); - return paperRenderer != null ? paperRenderer.bounds.size.y : 0.0f; - } - } -} \ No newline at end of file diff --git a/Assets/SEE/GameObjects/TextGUIAndPaperResizer.cs.meta b/Assets/SEE/GameObjects/TextGUIAndPaperResizer.cs.meta deleted file mode 100644 index ab9455be1c..0000000000 --- a/Assets/SEE/GameObjects/TextGUIAndPaperResizer.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7767bf3a70fb88c41b861d5199a5e6f3 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/Gizmos.meta b/Assets/SEE/Gizmos.meta new file mode 100644 index 0000000000..40af15a17f --- /dev/null +++ b/Assets/SEE/Gizmos.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c9e8bc8fc4300994fad594601aabc88c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/GameObjects/CityCursor.cs b/Assets/SEE/Gizmos/CityCursor.cs similarity index 99% rename from Assets/SEE/GameObjects/CityCursor.cs rename to Assets/SEE/Gizmos/CityCursor.cs index c7bbd153cd..094cd9bfda 100644 --- a/Assets/SEE/GameObjects/CityCursor.cs +++ b/Assets/SEE/Gizmos/CityCursor.cs @@ -5,12 +5,12 @@ using SEE.Controls.Interactables; using SEE.DataModel.DG; using SEE.Game.City; +using SEE.GraphElementRefs; using SEE.Tools.OpenTelemetry; -using SEE.UI3D; using SEE.Utils; using UnityEngine; -namespace SEE.GO +namespace SEE.Gizmos { /// /// Cursor for a code city that captures the city's objects when they are hovered over. diff --git a/Assets/SEE/GameObjects/CityCursor.cs.meta b/Assets/SEE/Gizmos/CityCursor.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/CityCursor.cs.meta rename to Assets/SEE/Gizmos/CityCursor.cs.meta diff --git a/Assets/SEE/Game/Cursor3D.cs b/Assets/SEE/Gizmos/Cursor3D.cs similarity index 99% rename from Assets/SEE/Game/Cursor3D.cs rename to Assets/SEE/Gizmos/Cursor3D.cs index 667ee2d9ac..f5ca63a140 100644 --- a/Assets/SEE/Game/Cursor3D.cs +++ b/Assets/SEE/Gizmos/Cursor3D.cs @@ -1,11 +1,10 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.Assertions; -using SEE.GO; using SEE.Utils; using SEE.Controls; -namespace SEE.UI3D +namespace SEE.Gizmos { /// /// The cursor representing the center of the selected elements of a city visually. May be used diff --git a/Assets/SEE/Game/Cursor3D.cs.meta b/Assets/SEE/Gizmos/Cursor3D.cs.meta similarity index 100% rename from Assets/SEE/Game/Cursor3D.cs.meta rename to Assets/SEE/Gizmos/Cursor3D.cs.meta diff --git a/Assets/SEE/Gizmos/Gizmos.cs b/Assets/SEE/Gizmos/Gizmos.cs new file mode 100644 index 0000000000..ef87a222c2 --- /dev/null +++ b/Assets/SEE/Gizmos/Gizmos.cs @@ -0,0 +1,9 @@ +/// +/// Home of gizmos. A gizmo is a specific interactive graphical overlay. +/// It is a visual tool that appears on top of a selected object, allowing +/// the user to manipulate that object directly in the workspace. +/// Examples are or . +/// +namespace SEE.Gizmos +{ +} diff --git a/Assets/SEE/Gizmos/Gizmos.cs.meta b/Assets/SEE/Gizmos/Gizmos.cs.meta new file mode 100644 index 0000000000..56587a0c18 --- /dev/null +++ b/Assets/SEE/Gizmos/Gizmos.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5ab343e42b6c843449fa73d815e24b76 \ No newline at end of file diff --git a/Assets/SEE/Game/MoveGizmo.cs b/Assets/SEE/Gizmos/MoveGizmo.cs similarity index 99% rename from Assets/SEE/Game/MoveGizmo.cs rename to Assets/SEE/Gizmos/MoveGizmo.cs index d74dee469f..6f580d1805 100644 --- a/Assets/SEE/Game/MoveGizmo.cs +++ b/Assets/SEE/Gizmos/MoveGizmo.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.UI3D +namespace SEE.Gizmos { /// /// This gizmo represents the movement of elements of a city visually. diff --git a/Assets/SEE/Game/MoveGizmo.cs.meta b/Assets/SEE/Gizmos/MoveGizmo.cs.meta similarity index 100% rename from Assets/SEE/Game/MoveGizmo.cs.meta rename to Assets/SEE/Gizmos/MoveGizmo.cs.meta diff --git a/Assets/SEE/Game/RotateGizmo.cs b/Assets/SEE/Gizmos/RotateGizmo.cs similarity index 98% rename from Assets/SEE/Game/RotateGizmo.cs rename to Assets/SEE/Gizmos/RotateGizmo.cs index 7c96c3dc86..376b64effd 100644 --- a/Assets/SEE/Game/RotateGizmo.cs +++ b/Assets/SEE/Gizmos/RotateGizmo.cs @@ -1,8 +1,8 @@ using UnityEngine; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; -namespace SEE.UI3D +namespace SEE.Gizmos { /// /// This gizmo visually represents a rotation of an object. diff --git a/Assets/SEE/Game/RotateGizmo.cs.meta b/Assets/SEE/Gizmos/RotateGizmo.cs.meta similarity index 100% rename from Assets/SEE/Game/RotateGizmo.cs.meta rename to Assets/SEE/Gizmos/RotateGizmo.cs.meta diff --git a/Assets/SEE/GameObjects/TextureGenerator.cs b/Assets/SEE/Gizmos/TextureGenerator.cs similarity index 95% rename from Assets/SEE/GameObjects/TextureGenerator.cs rename to Assets/SEE/Gizmos/TextureGenerator.cs index 50a502dd0c..c7ddb14ad0 100644 --- a/Assets/SEE/GameObjects/TextureGenerator.cs +++ b/Assets/SEE/Gizmos/TextureGenerator.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.GO +namespace SEE.Gizmos { /// /// Creates various textures. @@ -16,8 +16,8 @@ public static class TextureGenerator /// The created texture. public static Texture2D CreateColoredTextureR8(int width, int height, float color) { - Texture2D result = new Texture2D(width, height, TextureFormat.R8, false); - Color c = new Color(color, 0.0f, 0.0f, 0.0f); + Texture2D result = new(width, height, TextureFormat.R8, false); + Color c = new(color, 0.0f, 0.0f, 0.0f); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) @@ -48,8 +48,8 @@ public static Texture2D CreateColoredTextureR8(int width, int height, float colo /// A with the line drawn on it. public static Texture2D CreateLineTextureR8(int textureWidth, int textureHeight, Vector2Int p0, Vector2Int p1, float thickness, float lineColor, float backgroundColor) { - Color c0 = new Color(lineColor, 0.0f, 0.0f, 0.0f); - Color c1 = new Color(backgroundColor, 0.0f, 0.0f, 0.0f); + Color c0 = new(lineColor, 0.0f, 0.0f, 0.0f); + Color c1 = new(backgroundColor, 0.0f, 0.0f, 0.0f); Texture2D result = CreateColoredTextureR8(textureWidth, textureHeight, backgroundColor); @@ -204,8 +204,8 @@ void BresenhamLineDraw(Vector2Int p0, int d1) /// The created circle outline texture. public static Texture2D CreateCircleOutlineTextureR8(int outerRadius, int innerRadius, float circleColor, float backgroundColor) { - Color c0 = new Color(circleColor, 0.0f, 0.0f, 0.0f); - Color c1 = new Color(backgroundColor, 0.0f, 0.0f, 0.0f); + Color c0 = new(circleColor, 0.0f, 0.0f, 0.0f); + Color c1 = new(backgroundColor, 0.0f, 0.0f, 0.0f); int size = 2 * outerRadius + 1; Texture2D result = CreateColoredTextureR8(size + 1, size + 1, backgroundColor); diff --git a/Assets/SEE/GameObjects/TextureGenerator.cs.meta b/Assets/SEE/Gizmos/TextureGenerator.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/TextureGenerator.cs.meta rename to Assets/SEE/Gizmos/TextureGenerator.cs.meta diff --git a/Assets/SEE/Game/UI3DProperties.cs b/Assets/SEE/Gizmos/UI3DProperties.cs similarity index 98% rename from Assets/SEE/Game/UI3DProperties.cs rename to Assets/SEE/Gizmos/UI3DProperties.cs index 89d0516b9e..b5c41ee22d 100644 --- a/Assets/SEE/Game/UI3DProperties.cs +++ b/Assets/SEE/Gizmos/UI3DProperties.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.UI3D +namespace SEE.Gizmos { /// /// Properties of 3D UI elements. diff --git a/Assets/SEE/Game/UI3DProperties.cs.meta b/Assets/SEE/Gizmos/UI3DProperties.cs.meta similarity index 100% rename from Assets/SEE/Game/UI3DProperties.cs.meta rename to Assets/SEE/Gizmos/UI3DProperties.cs.meta diff --git a/Assets/SEE/GraphElementRefs.meta b/Assets/SEE/GraphElementRefs.meta new file mode 100644 index 0000000000..3b77e19cc7 --- /dev/null +++ b/Assets/SEE/GraphElementRefs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 99b0d21445102c34bbf6d5954c5f68e6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/GameObjects/EdgeRef.cs b/Assets/SEE/GraphElementRefs/EdgeRef.cs similarity index 97% rename from Assets/SEE/GameObjects/EdgeRef.cs rename to Assets/SEE/GraphElementRefs/EdgeRef.cs index c81cebe368..3caff8dbfe 100644 --- a/Assets/SEE/GameObjects/EdgeRef.cs +++ b/Assets/SEE/GraphElementRefs/EdgeRef.cs @@ -1,6 +1,6 @@ using SEE.DataModel.DG; -namespace SEE.GO +namespace SEE.GraphElementRefs { /// /// A reference to a graph edge that can be attached to a game object as a component. diff --git a/Assets/SEE/GameObjects/EdgeRef.cs.meta b/Assets/SEE/GraphElementRefs/EdgeRef.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/EdgeRef.cs.meta rename to Assets/SEE/GraphElementRefs/EdgeRef.cs.meta diff --git a/Assets/SEE/Game/GraphElementIDMap.cs b/Assets/SEE/GraphElementRefs/GraphElementIDMap.cs similarity index 99% rename from Assets/SEE/Game/GraphElementIDMap.cs rename to Assets/SEE/GraphElementRefs/GraphElementIDMap.cs index c319566beb..2e73626aeb 100644 --- a/Assets/SEE/Game/GraphElementIDMap.cs +++ b/Assets/SEE/GraphElementRefs/GraphElementIDMap.cs @@ -1,10 +1,10 @@ -using SEE.GO; +using SEE.Extensions; using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Assertions; -namespace SEE.Game +namespace SEE.GraphElementRefs { /// /// A mapping of IDs (name) of GameObjects representing nodes or edges onto those GameObjects. diff --git a/Assets/SEE/Game/GraphElementIDMap.cs.meta b/Assets/SEE/GraphElementRefs/GraphElementIDMap.cs.meta similarity index 100% rename from Assets/SEE/Game/GraphElementIDMap.cs.meta rename to Assets/SEE/GraphElementRefs/GraphElementIDMap.cs.meta diff --git a/Assets/SEE/Game/GraphElementRef.cs b/Assets/SEE/GraphElementRefs/GraphElementRef.cs similarity index 92% rename from Assets/SEE/Game/GraphElementRef.cs rename to Assets/SEE/GraphElementRefs/GraphElementRef.cs index dc3542aa3c..582748c2d0 100644 --- a/Assets/SEE/Game/GraphElementRef.cs +++ b/Assets/SEE/GraphElementRefs/GraphElementRef.cs @@ -2,7 +2,7 @@ using System; using Sirenix.OdinInspector; -namespace SEE.GO +namespace SEE.GraphElementRefs { /// /// A reference to a graph element that can be attached to a game object as a component. diff --git a/Assets/SEE/Game/GraphElementRef.cs.meta b/Assets/SEE/GraphElementRefs/GraphElementRef.cs.meta similarity index 100% rename from Assets/SEE/Game/GraphElementRef.cs.meta rename to Assets/SEE/GraphElementRefs/GraphElementRef.cs.meta diff --git a/Assets/SEE/GameObjects/NodeRef.cs b/Assets/SEE/GraphElementRefs/NodeRef.cs similarity index 98% rename from Assets/SEE/GameObjects/NodeRef.cs rename to Assets/SEE/GraphElementRefs/NodeRef.cs index 4a6748bb08..e200fa5fa0 100644 --- a/Assets/SEE/GameObjects/NodeRef.cs +++ b/Assets/SEE/GraphElementRefs/NodeRef.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using SEE.DataModel.DG; -namespace SEE.GO +namespace SEE.GraphElementRefs { /// /// A reference to a graph node that can be attached to a game object as a component. diff --git a/Assets/SEE/GameObjects/NodeRef.cs.meta b/Assets/SEE/GraphElementRefs/NodeRef.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/NodeRef.cs.meta rename to Assets/SEE/GraphElementRefs/NodeRef.cs.meta diff --git a/Assets/SEE/GraphProviders/CSVGraphProvider.cs b/Assets/SEE/GraphProviders/CSVGraphProvider.cs index 609b8e81d9..a10aaceaf0 100644 --- a/Assets/SEE/GraphProviders/CSVGraphProvider.cs +++ b/Assets/SEE/GraphProviders/CSVGraphProvider.cs @@ -1,5 +1,5 @@ using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.CSV; using SEE.Game.City; using System; using System.IO; diff --git a/Assets/SEE/GraphProviders/DashboardGraphProvider.cs b/Assets/SEE/GraphProviders/DashboardGraphProvider.cs index b82463b26a..80abc4adb6 100644 --- a/Assets/SEE/GraphProviders/DashboardGraphProvider.cs +++ b/Assets/SEE/GraphProviders/DashboardGraphProvider.cs @@ -3,7 +3,7 @@ using System.Threading; using Cysharp.Threading.Tasks; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.CSV; using SEE.Game.City; using SEE.UI.RuntimeConfigMenu; using SEE.Utils.Config; diff --git a/Assets/SEE/GraphProviders/Evolution/GXLEvolutionGraphProvider.cs b/Assets/SEE/GraphProviders/Evolution/GXLEvolutionGraphProvider.cs index a05842b695..2adf0f3258 100644 --- a/Assets/SEE/GraphProviders/Evolution/GXLEvolutionGraphProvider.cs +++ b/Assets/SEE/GraphProviders/Evolution/GXLEvolutionGraphProvider.cs @@ -3,7 +3,7 @@ using System.Threading; using Cysharp.Threading.Tasks; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Game.City; using SEE.UI.RuntimeConfigMenu; using SEE.Utils.Config; diff --git a/Assets/SEE/GraphProviders/GXLGraphProvider.cs b/Assets/SEE/GraphProviders/GXLGraphProvider.cs index 4aac4d0061..db69b1a8a0 100644 --- a/Assets/SEE/GraphProviders/GXLGraphProvider.cs +++ b/Assets/SEE/GraphProviders/GXLGraphProvider.cs @@ -1,5 +1,5 @@ using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Game.City; using System; using System.IO; diff --git a/Assets/SEE/GraphProviders/GraphProviderFactory.cs b/Assets/SEE/GraphProviders/GraphProviderFactory.cs index 56130e617f..bb03bced9d 100644 --- a/Assets/SEE/GraphProviders/GraphProviderFactory.cs +++ b/Assets/SEE/GraphProviders/GraphProviderFactory.cs @@ -26,7 +26,6 @@ internal static SingleGraphProvider NewSingleGraphProviderInstance(SingleGraphPr SingleGraphProviderKind.CSV => new CSVGraphProvider(), SingleGraphProviderKind.Reflexion => new ReflexionGraphProvider(), SingleGraphProviderKind.SinglePipeline => new SingleGraphPipelineProvider(), - SingleGraphProviderKind.JaCoCo => new JaCoCoGraphProvider(), SingleGraphProviderKind.MergeDiff => new MergeDiffGraphProvider(), SingleGraphProviderKind.VCS => new BetweenCommitsGraphProvider(), SingleGraphProviderKind.LSP => new LSPGraphProvider(), diff --git a/Assets/SEE/GraphProviders/GraphProviders.cs b/Assets/SEE/GraphProviders/GraphProviders.cs new file mode 100644 index 0000000000..0f29b789f3 --- /dev/null +++ b/Assets/SEE/GraphProviders/GraphProviders.cs @@ -0,0 +1,7 @@ +/// +/// Home of graph providers. Graph providers import data that will +/// be represented in . +/// +namespace SEE.GraphProviders +{ +} diff --git a/Assets/SEE/GraphProviders/GraphProviders.cs.meta b/Assets/SEE/GraphProviders/GraphProviders.cs.meta new file mode 100644 index 0000000000..4024e104f0 --- /dev/null +++ b/Assets/SEE/GraphProviders/GraphProviders.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 212d452f342232441bfc6a5bd9a11b40 \ No newline at end of file diff --git a/Assets/SEE/GraphProviders/JaCoCoGraphProvider.cs b/Assets/SEE/GraphProviders/JaCoCoGraphProvider.cs deleted file mode 100644 index 8a7da3ecc6..0000000000 --- a/Assets/SEE/GraphProviders/JaCoCoGraphProvider.cs +++ /dev/null @@ -1,53 +0,0 @@ -using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; -using SEE.Game.City; -using System; -using System.IO; -using System.Threading; -using Cysharp.Threading.Tasks; - -namespace SEE.GraphProviders -{ - /// - /// Reads metrics from a JaCoCo XML report file and adds these to a graph. - /// - [Serializable] - public class JaCoCoGraphProvider : FileBasedSingleGraphProvider - { - /// - /// Reads metrics from a JaCoCo XML report file and adds these to . - /// The resulting graph is returned. - /// - /// An existing graph where to add the metrics. - /// This value is currently ignored. - /// This parameter is currently ignored. - /// This parameter is currently ignored. - /// The input with metrics added. - /// Thrown in case - /// is undefined or does not exist or is null. - /// Thrown in case is - /// null; this is currently not supported. - public override async UniTask ProvideAsync(Graph graph, AbstractSEECity city, - Action changePercentage = null, - CancellationToken token = default) - { - CheckArguments(city); - if (graph == null) - { - throw new NotImplementedException(); - } - else - { - await UniTask.SwitchToThreadPool(); - await JaCoCoImporter.LoadAsync(graph, Path); - await UniTask.SwitchToMainThread(); - return graph; - } - } - - public override SingleGraphProviderKind GetKind() - { - return SingleGraphProviderKind.JaCoCo; - } - } -} diff --git a/Assets/SEE/GraphProviders/JaCoCoGraphProvider.cs.meta b/Assets/SEE/GraphProviders/JaCoCoGraphProvider.cs.meta deleted file mode 100644 index 52715012bb..0000000000 --- a/Assets/SEE/GraphProviders/JaCoCoGraphProvider.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4f11436df3db8c546b8148560c2d17ea -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/GraphProviders/LSPGraphProvider.cs b/Assets/SEE/GraphProviders/LSPGraphProvider.cs index 91843fe163..33fd8016ef 100644 --- a/Assets/SEE/GraphProviders/LSPGraphProvider.cs +++ b/Assets/SEE/GraphProviders/LSPGraphProvider.cs @@ -13,6 +13,7 @@ using SEE.Utils; using SEE.Utils.Config; using SEE.Utils.Paths; +using SEE.Extensions; using Sirenix.OdinInspector; using UnityEngine; using Debug = UnityEngine.Debug; diff --git a/Assets/SEE/GraphProviders/ReflexionGraphProvider.cs b/Assets/SEE/GraphProviders/ReflexionGraphProvider.cs index fe5ceb2f07..782551f851 100644 --- a/Assets/SEE/GraphProviders/ReflexionGraphProvider.cs +++ b/Assets/SEE/GraphProviders/ReflexionGraphProvider.cs @@ -1,6 +1,6 @@ using Cysharp.Threading.Tasks; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Game.City; using SEE.Tools.ReflexionAnalysis; using SEE.Utils.Config; diff --git a/Assets/SEE/GraphProviders/ReportGraphProvider.cs b/Assets/SEE/GraphProviders/ReportGraphProvider.cs index bcbdc6e1bc..c4133f33c6 100644 --- a/Assets/SEE/GraphProviders/ReportGraphProvider.cs +++ b/Assets/SEE/GraphProviders/ReportGraphProvider.cs @@ -5,7 +5,7 @@ using Cysharp.Threading.Tasks; using Sirenix.OdinInspector; using UnityEngine; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; using SEE.Utils.Config; using System.Collections.Generic; @@ -22,6 +22,8 @@ public class ReportGraphProvider : FileBasedSingleGraphProvider /// This value must not be null when a report is provided. /// [SerializeReference, InlineProperty] + [Tooltip("Specifies how the selected report should be parsed. " + + "It depends on the tool that generated the report to be imported. Must be set.")] public ParsingConfig ParsingConfig; /// diff --git a/Assets/SEE/DataModel/DG/VCSExtensions.cs b/Assets/SEE/GraphProviders/VCS/VCSExtensions.cs similarity index 72% rename from Assets/SEE/DataModel/DG/VCSExtensions.cs rename to Assets/SEE/GraphProviders/VCS/VCSExtensions.cs index 327815fcb3..88c019d9e5 100644 --- a/Assets/SEE/DataModel/DG/VCSExtensions.cs +++ b/Assets/SEE/GraphProviders/VCS/VCSExtensions.cs @@ -1,4 +1,6 @@ -namespace SEE.DataModel.DG +using SEE.DataModel.DG; + +namespace SEE.GraphProviders.VCS { /// /// Provides convenience extension properties for the VCS related attributes. @@ -8,16 +10,7 @@ public static class VCSExtensions /// /// The attribute name for the commitID. /// - private const string CommitIDAttribute = "CommitID"; - - /// - /// Returns the commit ID of the . - /// - /// Graph whose commit ID is requested. - public static bool TryGetCommitID(this Graph graph, out string commitID) - { - return graph.TryGetString(CommitIDAttribute, out commitID); - } + private const string commitIDAttribute = "CommitID"; /// /// Sets the commit ID of the to @@ -26,7 +19,7 @@ public static bool TryGetCommitID(this Graph graph, out string commitID) /// Value to be set. public static void SetCommitID(this Graph graph, string value) { - graph.SetString(CommitIDAttribute, value); + graph.SetString(commitIDAttribute, value); } /// @@ -35,13 +28,13 @@ public static void SetCommitID(this Graph graph, string value) /// Graph element whose commit ID is requested. public static bool TryGetCommitID(this GraphElement graphElement, out string commitID) { - return graphElement.ItsGraph.TryGetString(CommitIDAttribute, out commitID); + return graphElement.ItsGraph.TryGetString(commitIDAttribute, out commitID); } /// /// The attribute name for the repository path. /// - private const string RepositoryPathAttribute = "RepositoryPath"; + private const string repositoryPathAttribute = "RepositoryPath"; /// /// Sets the repository path of the to @@ -50,7 +43,7 @@ public static bool TryGetCommitID(this GraphElement graphElement, out string com /// Value to be set. public static void SetRepositoryPath(this Graph graph, string repositoryPath) { - graph.SetString(RepositoryPathAttribute, repositoryPath); + graph.SetString(repositoryPathAttribute, repositoryPath); } /// @@ -61,7 +54,7 @@ public static void SetRepositoryPath(this Graph graph, string repositoryPath) /// method returns false. public static bool TryGetRepositoryPath(this GraphElement graphElement, out string repositoryPath) { - return graphElement.ItsGraph.TryGetString(RepositoryPathAttribute, out repositoryPath); + return graphElement.ItsGraph.TryGetString(repositoryPathAttribute, out repositoryPath); } } } diff --git a/Assets/SEE/DataModel/DG/VCSExtensions.cs.meta b/Assets/SEE/GraphProviders/VCS/VCSExtensions.cs.meta similarity index 100% rename from Assets/SEE/DataModel/DG/VCSExtensions.cs.meta rename to Assets/SEE/GraphProviders/VCS/VCSExtensions.cs.meta diff --git a/Assets/SEE/IDE/IDE.cs b/Assets/SEE/IDE/IDE.cs new file mode 100644 index 0000000000..24dba7ea45 --- /dev/null +++ b/Assets/SEE/IDE/IDE.cs @@ -0,0 +1,6 @@ +/// +/// Binding to Visual Studio IDE. +/// +namespace SEE.IDE +{ +} diff --git a/Assets/SEE/IDE/IDE.cs.meta b/Assets/SEE/IDE/IDE.cs.meta new file mode 100644 index 0000000000..d78f26d00e --- /dev/null +++ b/Assets/SEE/IDE/IDE.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 1c939a6842e67e04092ab1b765315d62 \ No newline at end of file diff --git a/Assets/SEE/IDE/IDECalls.cs b/Assets/SEE/IDE/IDECalls.cs index a9ac2cc0e9..90d57b9c36 100644 --- a/Assets/SEE/IDE/IDECalls.cs +++ b/Assets/SEE/IDE/IDECalls.cs @@ -22,7 +22,6 @@ using Cysharp.Threading.Tasks; using SEE.Utils.IdeRPC; -using UnityEngine; namespace SEE.IDE { diff --git a/Assets/SEE/IDE/IDEIntegration.cs b/Assets/SEE/IDE/IDEIntegration.cs index 072fcc3989..0853c0c6f8 100644 --- a/Assets/SEE/IDE/IDEIntegration.cs +++ b/Assets/SEE/IDE/IDEIntegration.cs @@ -34,11 +34,12 @@ using SEE.Game; using SEE.Game.City; using SEE.UI.Notification; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; using Debug = UnityEngine.Debug; using SEE.Utils.IdeRPC; +using SEE.Controls.KeyActions; namespace SEE.IDE { diff --git a/Assets/SEE/IDE/RemoteProcedureCalls.cs b/Assets/SEE/IDE/RemoteProcedureCalls.cs index aabff4dc5e..d5ff37ddad 100644 --- a/Assets/SEE/IDE/RemoteProcedureCalls.cs +++ b/Assets/SEE/IDE/RemoteProcedureCalls.cs @@ -26,7 +26,7 @@ using Cysharp.Threading.Tasks; using SEE.Controls; using SEE.Game; -using SEE.GO; +using SEE.Extensions; using SEE.Utils.IdeRPC; using UnityEngine; diff --git a/Assets/SEE/Layout/IO/GVLWriter.cs b/Assets/SEE/Layout/IO/GVLWriter.cs index acc0b6c33f..8e97651433 100644 --- a/Assets/SEE/Layout/IO/GVLWriter.cs +++ b/Assets/SEE/Layout/IO/GVLWriter.cs @@ -1,5 +1,5 @@ using SEE.Game; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System.Collections.Generic; using System.Globalization; diff --git a/Assets/SEE/Layout/IO/SLDWriter.cs b/Assets/SEE/Layout/IO/SLDWriter.cs index 0ebcd03e4a..64a0041b94 100644 --- a/Assets/SEE/Layout/IO/SLDWriter.cs +++ b/Assets/SEE/Layout/IO/SLDWriter.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using SEE.GO; +using SEE.GraphElementRefs; using UnityEngine; namespace SEE.Layout.IO diff --git a/Assets/SEE/Layout/Layout.cs b/Assets/SEE/Layout/Layout.cs index 408c86582f..3015431ff3 100644 --- a/Assets/SEE/Layout/Layout.cs +++ b/Assets/SEE/Layout/Layout.cs @@ -1,8 +1,7 @@ /// -/// SEE.Layout contains code of node and edge layouts. Code contained -/// therein must not depend on SEE.DataModel, SEE.GameObjects or -/// SEE.GO. Is should be able to serve as a general layout library -/// outside of SEE. +/// contains code of node and edge layouts. Code contained +/// therein must not depend on or other namespaces. +/// Is should be able to serve as a general layout library outside of SEE. /// namespace SEE.Layout { diff --git a/Assets/SEE/GameObjects/Scales.meta b/Assets/SEE/MetricScales.meta similarity index 100% rename from Assets/SEE/GameObjects/Scales.meta rename to Assets/SEE/MetricScales.meta diff --git a/Assets/SEE/GameObjects/Scales/IScale.cs b/Assets/SEE/MetricScales/IScale.cs similarity index 99% rename from Assets/SEE/GameObjects/Scales/IScale.cs rename to Assets/SEE/MetricScales/IScale.cs index 6bd0ad9e7e..1c6194a70f 100644 --- a/Assets/SEE/GameObjects/Scales/IScale.cs +++ b/Assets/SEE/MetricScales/IScale.cs @@ -4,7 +4,7 @@ using SEE.DataModel.DG; using UnityEngine; -namespace SEE.GO +namespace SEE.MetricScales { /// /// Abstract super class of all classes providing normalized node metrics. diff --git a/Assets/SEE/GameObjects/Scales/IScale.cs.meta b/Assets/SEE/MetricScales/IScale.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Scales/IScale.cs.meta rename to Assets/SEE/MetricScales/IScale.cs.meta diff --git a/Assets/SEE/GameObjects/Scales/LinearScale.cs b/Assets/SEE/MetricScales/LinearScale.cs similarity index 99% rename from Assets/SEE/GameObjects/Scales/LinearScale.cs rename to Assets/SEE/MetricScales/LinearScale.cs index c445fbbdba..bfb9eb6c8f 100644 --- a/Assets/SEE/GameObjects/Scales/LinearScale.cs +++ b/Assets/SEE/MetricScales/LinearScale.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using SEE.DataModel.DG; -namespace SEE.GO +namespace SEE.MetricScales { /// /// Provides x, y, z lengths of a node based on a linear interpolation diff --git a/Assets/SEE/GameObjects/Scales/LinearScale.cs.meta b/Assets/SEE/MetricScales/LinearScale.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Scales/LinearScale.cs.meta rename to Assets/SEE/MetricScales/LinearScale.cs.meta diff --git a/Assets/SEE/MetricScales/MetricScales.cs b/Assets/SEE/MetricScales/MetricScales.cs new file mode 100644 index 0000000000..552a3d4909 --- /dev/null +++ b/Assets/SEE/MetricScales/MetricScales.cs @@ -0,0 +1,7 @@ +/// +/// Provides scaling of metrics (e.g., linear scaling or scaling based on z-score). +/// + +namespace SEE.MetricScales +{ +} diff --git a/Assets/SEE/MetricScales/MetricScales.cs.meta b/Assets/SEE/MetricScales/MetricScales.cs.meta new file mode 100644 index 0000000000..2df48ea5c0 --- /dev/null +++ b/Assets/SEE/MetricScales/MetricScales.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cd8e420f682451b439e5beb4674d88d0 \ No newline at end of file diff --git a/Assets/SEE/GameObjects/Scales/ZScoreScale.cs b/Assets/SEE/MetricScales/ZScoreScale.cs similarity index 99% rename from Assets/SEE/GameObjects/Scales/ZScoreScale.cs rename to Assets/SEE/MetricScales/ZScoreScale.cs index d417ad308f..5587dd20eb 100644 --- a/Assets/SEE/GameObjects/Scales/ZScoreScale.cs +++ b/Assets/SEE/MetricScales/ZScoreScale.cs @@ -2,7 +2,7 @@ using SEE.DataModel.DG; using UnityEngine; -namespace SEE.GO +namespace SEE.MetricScales { /// /// Scaling based on z-score. The z-score of a value v that is an element of diff --git a/Assets/SEE/GameObjects/Scales/ZScoreScale.cs.meta b/Assets/SEE/MetricScales/ZScoreScale.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Scales/ZScoreScale.cs.meta rename to Assets/SEE/MetricScales/ZScoreScale.cs.meta diff --git a/Assets/SEE/Net/ActionNetwork.cs b/Assets/SEE/Net/ActionNetwork.cs index b7c2f10348..4f243c9575 100644 --- a/Assets/SEE/Net/ActionNetwork.cs +++ b/Assets/SEE/Net/ActionNetwork.cs @@ -2,18 +2,18 @@ using SEE.Game; using SEE.Game.City; using SEE.Game.Drawable; -using SEE.GameObjects; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions; using SEE.Net.Actions.City; using SEE.Net.Actions.Table; using SEE.Net.Util; -using SEE.User; +using SEE.UserSettings; using System.Collections.Generic; using System.Linq; using Unity.Collections; using Unity.Netcode; using UnityEngine; +using SEE.Cities; namespace SEE.Net { @@ -211,7 +211,7 @@ public void RequestSynchronizationServerRpc(RpcParams rpcParams = default) } ulong senderId = rpcParams.Receive.SenderClientId; - SyncFilesClientRpc(Network.ServerId, UserSettings.Instance.Network.BackendServerAPI, UserSettings.Instance.Video.LiveKitUrl, UserSettings.Instance.Video.RoomName, RpcTarget.Single(senderId, RpcTargetUse.Temp)); + SyncFilesClientRpc(Network.ServerId, UserSetting.Instance.Network.BackendServerAPI, UserSetting.Instance.Video.LiveKitUrl, UserSetting.Instance.Video.RoomName, RpcTarget.Single(senderId, RpcTargetUse.Temp)); } /// @@ -463,9 +463,9 @@ private void SyncFilesClientRpc(string backendServerId, string backendDomain, st } Network.ServerId = backendServerId; - UserSettings.Instance.Network.BackendServerAPI = backendDomain; - UserSettings.Instance.Video.LiveKitUrl = livekitUrl; - UserSettings.Instance.Video.RoomName = livekitRoom; + UserSetting.Instance.Network.BackendServerAPI = backendDomain; + UserSetting.Instance.Video.LiveKitUrl = livekitUrl; + UserSetting.Instance.Video.RoomName = livekitRoom; BackendSyncUtil.InitializeClientAsync().Forget(); } diff --git a/Assets/SEE/Net/Actions/AbstractNetAction.cs b/Assets/SEE/Net/Actions/AbstractNetAction.cs index 5c3e56adc8..9b42e64fbc 100644 --- a/Assets/SEE/Net/Actions/AbstractNetAction.cs +++ b/Assets/SEE/Net/Actions/AbstractNetAction.cs @@ -1,4 +1,4 @@ -using System; +using System; using Unity.Netcode; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Animation/AnimationNetAction.cs b/Assets/SEE/Net/Actions/Animation/AnimationNetAction.cs index ac8230ced7..826b217e28 100644 --- a/Assets/SEE/Net/Actions/Animation/AnimationNetAction.cs +++ b/Assets/SEE/Net/Actions/Animation/AnimationNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Evolution; -using SEE.GO; +using SEE.Extensions; using System; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/City/CityNetAction.cs b/Assets/SEE/Net/Actions/City/CityNetAction.cs index 85008a4b1a..053f01e93c 100644 --- a/Assets/SEE/Net/Actions/City/CityNetAction.cs +++ b/Assets/SEE/Net/Actions/City/CityNetAction.cs @@ -1,6 +1,5 @@ using SEE.Game; -using SEE.GameObjects; -using SEE.Net.Actions; +using SEE.Cities; using System; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/AddBlinkEffectNetAction.cs b/Assets/SEE/Net/Actions/Drawable/AddBlinkEffectNetAction.cs index 908973436a..3b21c5aa3e 100644 --- a/Assets/SEE/Net/Actions/Drawable/AddBlinkEffectNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/AddBlinkEffectNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; namespace SEE.Net.Actions.Drawable { diff --git a/Assets/SEE/Net/Actions/Drawable/AddImageNetAction.cs b/Assets/SEE/Net/Actions/Drawable/AddImageNetAction.cs index 5d4065b9b6..798ab07de0 100644 --- a/Assets/SEE/Net/Actions/Drawable/AddImageNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/AddImageNetAction.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/ChangeColorKindNetAction.cs b/Assets/SEE/Net/Actions/Drawable/ChangeColorKindNetAction.cs index 1092c6bfe7..a4b60f237e 100644 --- a/Assets/SEE/Net/Actions/Drawable/ChangeColorKindNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/ChangeColorKindNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/ChangeLineKindNetAction.cs b/Assets/SEE/Net/Actions/Drawable/ChangeLineKindNetAction.cs index 4566d24f60..6a498a38f2 100644 --- a/Assets/SEE/Net/Actions/Drawable/ChangeLineKindNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/ChangeLineKindNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/DeleteFillOutNetAction.cs b/Assets/SEE/Net/Actions/Drawable/DeleteFillOutNetAction.cs index d15f388349..30f41cca52 100644 --- a/Assets/SEE/Net/Actions/Drawable/DeleteFillOutNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/DeleteFillOutNetAction.cs @@ -1,5 +1,5 @@ -using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; +using SEE.Game.Drawable; using SEE.Utils; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/DrawNetAction.cs b/Assets/SEE/Net/Actions/Drawable/DrawNetAction.cs index de638bb891..eac155be04 100644 --- a/Assets/SEE/Net/Actions/Drawable/DrawNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/DrawNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/DrawableNetAction.cs b/Assets/SEE/Net/Actions/Drawable/DrawableNetAction.cs index 2160dc8281..3bf2c71f15 100644 --- a/Assets/SEE/Net/Actions/Drawable/DrawableNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/DrawableNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; using Unity.Netcode; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/DrawingFinishNetAction.cs b/Assets/SEE/Net/Actions/Drawable/DrawingFinishNetAction.cs index 432dea8db6..9433e549d9 100644 --- a/Assets/SEE/Net/Actions/Drawable/DrawingFinishNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/DrawingFinishNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/EditImageNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditImageNetAction.cs index 144b0221c4..fa0ff1c93c 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditImageNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditImageNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/EditLayerNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLayerNetAction.cs index b39144bf62..941c88b113 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLayerNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLayerNetAction.cs @@ -1,7 +1,7 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineCapStyleNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineCapStyleNetAction.cs index 0f245ac1aa..a394951807 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineCapStyleNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineCapStyleNetAction.cs @@ -1,5 +1,4 @@ -using SEE.Controls.Actions.Drawable; -using SEE.Game.Drawable; +using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineCapsNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineCapsNetAction.cs index e1a7425dee..5192ebeeec 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineCapsNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineCapsNetAction.cs @@ -1,5 +1,4 @@ -using SEE.Controls.Actions.Drawable; -using SEE.Game.Drawable; +using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using static SEE.Game.Drawable.ActionHelpers.LineCapPointsCalculator; diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineFillOutColorNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineFillOutColorNetAction.cs index 24f7e7da50..b663107251 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineFillOutColorNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineFillOutColorNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineLoopNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineLoopNetAction.cs index c76ad724d0..9dc4d098d4 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineLoopNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineLoopNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineNetAction.cs index 5c437474c9..b84c087950 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/EditLinePrimaryColorNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLinePrimaryColorNetAction.cs index 3cd00749ee..b505fa8039 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLinePrimaryColorNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLinePrimaryColorNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineSecondaryColorNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineSecondaryColorNetAction.cs index b977b5e92e..6d1173ab57 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineSecondaryColorNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineSecondaryColorNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/EditLineThicknessNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditLineThicknessNetAction.cs index b1a236dca5..63b11c6233 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditLineThicknessNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditLineThicknessNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/EditMMNodeNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditMMNodeNetAction.cs index ec852b6414..12ac9ffb0b 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditMMNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditMMNodeNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/EditTextNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EditTextNetAction.cs index 33b3f92946..4c8cb8ebaa 100644 --- a/Assets/SEE/Net/Actions/Drawable/EditTextNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EditTextNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/EraseNetAction.cs b/Assets/SEE/Net/Actions/Drawable/EraseNetAction.cs index 1c63bf6da6..0fa4a3e095 100644 --- a/Assets/SEE/Net/Actions/Drawable/EraseNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/EraseNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Utils; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/LayerChangerNetAction.cs b/Assets/SEE/Net/Actions/Drawable/LayerChangerNetAction.cs index 1edb15357f..d60d701a72 100644 --- a/Assets/SEE/Net/Actions/Drawable/LayerChangerNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/LayerChangerNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/MindMapChangeNodeKindNetAction.cs b/Assets/SEE/Net/Actions/Drawable/MindMapChangeNodeKindNetAction.cs index 1e252943c0..d37822387e 100644 --- a/Assets/SEE/Net/Actions/Drawable/MindMapChangeNodeKindNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/MindMapChangeNodeKindNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/MindMapChangeParentNetAction.cs b/Assets/SEE/Net/Actions/Drawable/MindMapChangeParentNetAction.cs index 069150ef46..8e51942edc 100644 --- a/Assets/SEE/Net/Actions/Drawable/MindMapChangeParentNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/MindMapChangeParentNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/MindMapCreateNodeNetAction.cs b/Assets/SEE/Net/Actions/Drawable/MindMapCreateNodeNetAction.cs index d6b36c1456..d280858476 100644 --- a/Assets/SEE/Net/Actions/Drawable/MindMapCreateNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/MindMapCreateNodeNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable; diff --git a/Assets/SEE/Net/Actions/Drawable/MoveNetAction.cs b/Assets/SEE/Net/Actions/Drawable/MoveNetAction.cs index 4df96ca11d..2dae1672d2 100644 --- a/Assets/SEE/Net/Actions/Drawable/MoveNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/MoveNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/MovePointNetAction.cs b/Assets/SEE/Net/Actions/Drawable/MovePointNetAction.cs index 24dbf24cfc..711fb85409 100644 --- a/Assets/SEE/Net/Actions/Drawable/MovePointNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/MovePointNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/RotateYNetAction.cs b/Assets/SEE/Net/Actions/Drawable/RotateYNetAction.cs index c1da70495e..6b38ed4a54 100644 --- a/Assets/SEE/Net/Actions/Drawable/RotateYNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/RotateYNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/RotatorNetAction.cs b/Assets/SEE/Net/Actions/Drawable/RotatorNetAction.cs index e55fdb4caa..93a386c034 100644 --- a/Assets/SEE/Net/Actions/Drawable/RotatorNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/RotatorNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/ScaleNetAction.cs b/Assets/SEE/Net/Actions/Drawable/ScaleNetAction.cs index 544156ef9d..581a4a6552 100644 --- a/Assets/SEE/Net/Actions/Drawable/ScaleNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/ScaleNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/Drawable/StickyNoteDeleterNetAction.cs b/Assets/SEE/Net/Actions/Drawable/StickyNoteDeleterNetAction.cs index 5cf993d958..4dc454be8a 100644 --- a/Assets/SEE/Net/Actions/Drawable/StickyNoteDeleterNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/StickyNoteDeleterNetAction.cs @@ -1,6 +1,6 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/StickyNoteMoveNetAction.cs b/Assets/SEE/Net/Actions/Drawable/StickyNoteMoveNetAction.cs index 3bcdd663c7..f9b8f38368 100644 --- a/Assets/SEE/Net/Actions/Drawable/StickyNoteMoveNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/StickyNoteMoveNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateXNetAction.cs b/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateXNetAction.cs index d7dc93884f..508820e580 100644 --- a/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateXNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateXNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; namespace SEE.Net.Actions.Drawable { diff --git a/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateYNetAction.cs b/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateYNetAction.cs index 251c643311..d5d02c5427 100644 --- a/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateYNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/StickyNoteRotateYNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.Drawable diff --git a/Assets/SEE/Net/Actions/Drawable/StickyNoteSpawnNetAction.cs b/Assets/SEE/Net/Actions/Drawable/StickyNoteSpawnNetAction.cs index 604d9019f9..7b615e1f1b 100644 --- a/Assets/SEE/Net/Actions/Drawable/StickyNoteSpawnNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/StickyNoteSpawnNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/Drawable/WriteTextNetAction.cs b/Assets/SEE/Net/Actions/Drawable/WriteTextNetAction.cs index 25a8ec6b29..fe12359881 100644 --- a/Assets/SEE/Net/Actions/Drawable/WriteTextNetAction.cs +++ b/Assets/SEE/Net/Actions/Drawable/WriteTextNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/Net/Actions/GraphElement/AcceptDivergenceNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/AcceptDivergenceNetAction.cs index bc0cb83354..e2d9e56d18 100644 --- a/Assets/SEE/Net/Actions/GraphElement/AcceptDivergenceNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/AcceptDivergenceNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/AddEdgeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/AddEdgeNetAction.cs index 79cb33955d..2df8451b41 100644 --- a/Assets/SEE/Net/Actions/GraphElement/AddEdgeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/AddEdgeNetAction.cs @@ -1,5 +1,5 @@ -using SEE.Game; -using SEE.Game.SceneManipulation; +using SEE.GraphElementRefs; +using SEE.SceneManipulation; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/AddNodeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/AddNodeNetAction.cs index 963d6ec676..ae7e223fbf 100644 --- a/Assets/SEE/Net/Actions/GraphElement/AddNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/AddNodeNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; using UnityEngine; namespace SEE.Net.Actions.GraphElement diff --git a/Assets/SEE/Net/Actions/GraphElement/DeleteNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/DeleteNetAction.cs index 2c1a2b0979..69b7380269 100644 --- a/Assets/SEE/Net/Actions/GraphElement/DeleteNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/DeleteNetAction.cs @@ -1,6 +1,6 @@ using SEE.DataModel.DG; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.GraphElement diff --git a/Assets/SEE/Net/Actions/GraphElement/EditNodeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/EditNodeNetAction.cs index 73755624ac..de16448ce7 100644 --- a/Assets/SEE/Net/Actions/GraphElement/EditNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/EditNodeNetAction.cs @@ -1,6 +1,6 @@ using SEE.DataModel.DG; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/GraphElementNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/GraphElementNetAction.cs index 0a19e84283..27698d3c9c 100644 --- a/Assets/SEE/Net/Actions/GraphElement/GraphElementNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/GraphElementNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game; +using SEE.GraphElementRefs; using System; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/GraphElement/HighlightNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/HighlightNetAction.cs index 5346296280..54ef230915 100644 --- a/Assets/SEE/Net/Actions/GraphElement/HighlightNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/HighlightNetAction.cs @@ -1,4 +1,5 @@ using SEE.Game; +using SEE.GraphElementRefs; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/MoveNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/MoveNetAction.cs index 22ad8c444f..f623fc130c 100644 --- a/Assets/SEE/Net/Actions/GraphElement/MoveNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/MoveNetAction.cs @@ -1,5 +1,5 @@ -using SEE.Game; -using SEE.Game.SceneManipulation; +using SEE.GraphElementRefs; +using SEE.SceneManipulation; using UnityEngine; namespace SEE.Net.Actions.GraphElement diff --git a/Assets/SEE/Net/Actions/GraphElement/ResizeNodeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/ResizeNodeNetAction.cs index 93aae335b6..11bb0f7cef 100644 --- a/Assets/SEE/Net/Actions/GraphElement/ResizeNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/ResizeNodeNetAction.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.GraphElement diff --git a/Assets/SEE/Net/Actions/GraphElement/RotateNodeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/RotateNodeNetAction.cs index 39a274cf77..cd216ae313 100644 --- a/Assets/SEE/Net/Actions/GraphElement/RotateNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/RotateNodeNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.GraphElement diff --git a/Assets/SEE/Net/Actions/GraphElement/ScaleNodeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/ScaleNodeNetAction.cs index 73b2c5cf0e..7ff13f7b67 100644 --- a/Assets/SEE/Net/Actions/GraphElement/ScaleNodeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/ScaleNodeNetAction.cs @@ -1,5 +1,5 @@ -using SEE.GO; -using UnityEngine; +using SEE.Extensions; +using UnityEngine; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/SetParentNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/SetParentNetAction.cs index a16f1a1895..349c856d3c 100644 --- a/Assets/SEE/Net/Actions/GraphElement/SetParentNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/SetParentNetAction.cs @@ -1,5 +1,5 @@ -using SEE.Game; -using SEE.Game.SceneManipulation; +using SEE.GraphElementRefs; +using SEE.SceneManipulation; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/ShowCodeNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/ShowCodeNetAction.cs index 31329a47ac..6c3bd9dd76 100644 --- a/Assets/SEE/Net/Actions/GraphElement/ShowCodeNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/ShowCodeNetAction.cs @@ -1,6 +1,7 @@ -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; +using SEE.Extensions; using SEE.Game; -using SEE.GO; +using SEE.GraphElementRefs; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/ShowInCityNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/ShowInCityNetAction.cs index 0529477bc6..c993a5e7f2 100644 --- a/Assets/SEE/Net/Actions/GraphElement/ShowInCityNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/ShowInCityNetAction.cs @@ -1,5 +1,4 @@ -using SEE.Game; -using SEE.GO; +using SEE.Extensions; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/GraphElement/ShuffleNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/ShuffleNetAction.cs index 5b761175ca..d8c1903d50 100644 --- a/Assets/SEE/Net/Actions/GraphElement/ShuffleNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/ShuffleNetAction.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Net.Actions.GraphElement diff --git a/Assets/SEE/Net/Actions/GraphElement/VersionNetAction.cs b/Assets/SEE/Net/Actions/GraphElement/VersionNetAction.cs index 1c1776dee7..6fe3452fbd 100644 --- a/Assets/SEE/Net/Actions/GraphElement/VersionNetAction.cs +++ b/Assets/SEE/Net/Actions/GraphElement/VersionNetAction.cs @@ -1,5 +1,4 @@ -using SEE.Game; -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; namespace SEE.Net.Actions.GraphElement { diff --git a/Assets/SEE/Net/Actions/LiveKitSettingsNetAction.cs b/Assets/SEE/Net/Actions/LiveKitSettingsNetAction.cs index 35c78ed793..1f8e9fe567 100644 --- a/Assets/SEE/Net/Actions/LiveKitSettingsNetAction.cs +++ b/Assets/SEE/Net/Actions/LiveKitSettingsNetAction.cs @@ -1,7 +1,7 @@ using Cysharp.Threading.Tasks; using SEE.Tools.LiveKit; using SEE.UI.Menu; -using SEE.User; +using SEE.UserSettings; namespace SEE.Net.Actions { @@ -51,7 +51,7 @@ public override void ExecuteOnClient() /// /// Ask the user whether the received LiveKit configuration should be applied. - /// If confirmed, the local is updated. + /// If confirmed, the local is updated. /// private async UniTask ApplyLiveKitUpdateAsync() { @@ -62,8 +62,8 @@ private async UniTask ApplyLiveKitUpdateAsync() if (await ConfirmDialog.ConfirmAsync(ConfirmConfiguration.YesNo(message, showCloseButton: false))) { - UserSettings.Instance.Video.UpdateLiveKitSettings(LiveKitUrl, TokenUrl, RoomName); - UserSettings.Instance.Save(); + UserSetting.Instance.Video.UpdateLiveKitSettings(LiveKitUrl, TokenUrl, RoomName); + UserSetting.Instance.Save(); } } } diff --git a/Assets/SEE/Net/Actions/NetActionHistory.cs b/Assets/SEE/Net/Actions/NetActionHistory.cs index 1073538bc6..0f4725fadc 100644 --- a/Assets/SEE/Net/Actions/NetActionHistory.cs +++ b/Assets/SEE/Net/Actions/NetActionHistory.cs @@ -1,8 +1,7 @@ -using SEE.Utils.History; -using SEE.Controls.Actions; +using SEE.ReversibleActionHistory; using System.Collections.Generic; -using static SEE.Utils.History.ActionHistory; using System.Linq; +using static SEE.ReversibleActionHistory.ActionHistory; namespace SEE.Net.Actions { diff --git a/Assets/SEE/Net/Actions/RestoreNetAction.cs b/Assets/SEE/Net/Actions/RestoreNetAction.cs index 5337fa6d42..f26463c2cd 100644 --- a/Assets/SEE/Net/Actions/RestoreNetAction.cs +++ b/Assets/SEE/Net/Actions/RestoreNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.City; -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; using SEE.Utils; using System.Collections.Generic; diff --git a/Assets/SEE/Net/Actions/ReviveNetAction.cs b/Assets/SEE/Net/Actions/ReviveNetAction.cs index 4a06fb6f83..51e032103f 100644 --- a/Assets/SEE/Net/Actions/ReviveNetAction.cs +++ b/Assets/SEE/Net/Actions/ReviveNetAction.cs @@ -1,6 +1,6 @@ using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; using SEE.Utils; using System.Collections.Generic; diff --git a/Assets/SEE/Net/Actions/SyncWindowSpaceAction.cs b/Assets/SEE/Net/Actions/SyncWindowSpaceAction.cs index 88d29c94c0..1e87933721 100644 --- a/Assets/SEE/Net/Actions/SyncWindowSpaceAction.cs +++ b/Assets/SEE/Net/Actions/SyncWindowSpaceAction.cs @@ -1,5 +1,5 @@ using System; -using SEE.Controls; +using SEE.Controls.Players; using SEE.UI.Window; using UnityEngine; @@ -46,9 +46,9 @@ public override void ExecuteOnServer() public override void ExecuteOnClient() { // If no space manager exists, there is nothing we can (or should) do. - if (WindowSpaceManager.ManagerInstance) + if (WindowSpaceManager.Instance) { - WindowSpaceManager.ManagerInstance.UpdateSpaceFromValueObject(Requester.ToString(), space); + WindowSpaceManager.Instance.UpdateSpaceFromValueObject(Requester.ToString(), space); } } } diff --git a/Assets/SEE/Net/Actions/Table/DestroyTableNetAction.cs b/Assets/SEE/Net/Actions/Table/DestroyTableNetAction.cs index cc9759d2dd..74dc0988a2 100644 --- a/Assets/SEE/Net/Actions/Table/DestroyTableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/DestroyTableNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.Table; +using SEE.Game.Tables; namespace SEE.Net.Actions.Table { diff --git a/Assets/SEE/Net/Actions/Table/DisableCSMTableNetAction.cs b/Assets/SEE/Net/Actions/Table/DisableCSMTableNetAction.cs index a57ed49912..2660bc431a 100644 --- a/Assets/SEE/Net/Actions/Table/DisableCSMTableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/DisableCSMTableNetAction.cs @@ -1,5 +1,4 @@ -using SEE.Game.Table; -using SEE.GameObjects; +using SEE.Game.Tables; namespace SEE.Net.Actions.Table { diff --git a/Assets/SEE/Net/Actions/Table/EnableCityTableNetAction.cs b/Assets/SEE/Net/Actions/Table/EnableCityTableNetAction.cs index 069ed70b24..854bd4fd96 100644 --- a/Assets/SEE/Net/Actions/Table/EnableCityTableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/EnableCityTableNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.Table; +using SEE.Game.Tables; namespace SEE.Net.Actions.Table { diff --git a/Assets/SEE/Net/Actions/Table/MoveTableAndPortalNetAction.cs b/Assets/SEE/Net/Actions/Table/MoveTableAndPortalNetAction.cs index c3ef8cbef7..10db0b54ff 100644 --- a/Assets/SEE/Net/Actions/Table/MoveTableAndPortalNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/MoveTableAndPortalNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.Table; +using SEE.Game.Tables; using UnityEngine; namespace SEE.Net.Actions.Table diff --git a/Assets/SEE/Net/Actions/Table/MoveTableOnlyNetAction.cs b/Assets/SEE/Net/Actions/Table/MoveTableOnlyNetAction.cs index a7814970e8..bde2659002 100644 --- a/Assets/SEE/Net/Actions/Table/MoveTableOnlyNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/MoveTableOnlyNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.Table; +using SEE.Game.Tables; using UnityEngine; namespace SEE.Net.Actions.Table diff --git a/Assets/SEE/Net/Actions/Table/ScaleTableNetAction.cs b/Assets/SEE/Net/Actions/Table/ScaleTableNetAction.cs index 1b69c57768..e1c220e8c2 100644 --- a/Assets/SEE/Net/Actions/Table/ScaleTableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/ScaleTableNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.Table; +using SEE.Game.Tables; using UnityEngine; namespace SEE.Net.Actions.Table diff --git a/Assets/SEE/Net/Actions/Table/SetInfinitePortalTableNetAction.cs b/Assets/SEE/Net/Actions/Table/SetInfinitePortalTableNetAction.cs index 624f56416d..3196a42467 100644 --- a/Assets/SEE/Net/Actions/Table/SetInfinitePortalTableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/SetInfinitePortalTableNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game; -using SEE.GO; +using SEE.Extensions; namespace SEE.Net.Actions.Table { diff --git a/Assets/SEE/Net/Actions/Table/SpawnTableNetAction.cs b/Assets/SEE/Net/Actions/Table/SpawnTableNetAction.cs index cfbf1afaf2..f6d054b6e3 100644 --- a/Assets/SEE/Net/Actions/Table/SpawnTableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/SpawnTableNetAction.cs @@ -1,4 +1,4 @@ -using SEE.Game.Table; +using SEE.Game.Tables; using UnityEngine; namespace SEE.Net.Actions.Table diff --git a/Assets/SEE/Net/Actions/Table/TableNetAction.cs b/Assets/SEE/Net/Actions/Table/TableNetAction.cs index 5a5778a160..db4321e84c 100644 --- a/Assets/SEE/Net/Actions/Table/TableNetAction.cs +++ b/Assets/SEE/Net/Actions/Table/TableNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game; -using SEE.GameObjects; +using SEE.Cities; using System; using UnityEngine; diff --git a/Assets/SEE/Net/Actions/TogglePointingNetAction.cs b/Assets/SEE/Net/Actions/TogglePointingNetAction.cs index 1220ddca9e..6db08b48eb 100644 --- a/Assets/SEE/Net/Actions/TogglePointingNetAction.cs +++ b/Assets/SEE/Net/Actions/TogglePointingNetAction.cs @@ -1,5 +1,5 @@ using SEE.Game.Avatars; -using SEE.GO; +using SEE.Extensions; using Unity.Netcode; using UnityEngine; diff --git a/Assets/SEE/Net/Network.cs b/Assets/SEE/Net/Network.cs index 22a3705afa..64fcc8721d 100644 --- a/Assets/SEE/Net/Network.cs +++ b/Assets/SEE/Net/Network.cs @@ -1,6 +1,6 @@ using Cysharp.Threading.Tasks; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using SEE.Tools.OpenTelemetry; using SEE.UI.Notification; using SEE.Utils; @@ -476,7 +476,7 @@ private void InitializeGame() { if (NetworkManager.Singleton.IsHost && NetworkManager.Singleton.IsClient) { - TracingHelperService.Initialize(SEE.User.UserSettings.Instance.Player.PlayerName); + TracingHelperService.Initialize(SEE.UserSettings.UserSetting.Instance.Player.PlayerName); } AsyncUtils.MainThreadId = Thread.CurrentThread.ManagedThreadId; @@ -740,7 +740,7 @@ private void OnClientConnectedCallback(ulong owner) { callbackToMenu?.Invoke(true, $"You are connected to {ServerAddress}."); callbackToMenu = null; - TracingHelperService.Initialize(SEE.User.UserSettings.Instance.Player.PlayerName); + TracingHelperService.Initialize(SEE.UserSettings.UserSetting.Instance.Player.PlayerName); } /// diff --git a/Assets/SEE/Net/Util/BackendSyncUtil.cs b/Assets/SEE/Net/Util/BackendSyncUtil.cs index 7d142a2325..9bf8f25fdc 100644 --- a/Assets/SEE/Net/Util/BackendSyncUtil.cs +++ b/Assets/SEE/Net/Util/BackendSyncUtil.cs @@ -1,9 +1,9 @@ using Cysharp.Threading.Tasks; using Newtonsoft.Json; using SEE.Game.City; +using SEE.UserSettings; using SEE.Net.Util.FileSync; using SEE.UI.Notification; -using SEE.User; using SEE.Utils; using SEE.Utils.Paths; using System; @@ -241,7 +241,7 @@ public static async UniTask> LoadSnapshotsAsync() return new List(); } - string url = $"{UserSettings.BackendServerAPI}server/snapshots?id={Network.ServerId}"; + string url = $"{UserSetting.BackendServerAPI}server/snapshots?id={Network.ServerId}"; using UnityWebRequest request = UnityWebRequest.Get(url); await request.SendWebRequest().ToUniTask(); @@ -279,7 +279,7 @@ public static async UniTask DownloadSnapshotAsync(Guid snapshotId, string return false; } - string url = $"{UserSettings.BackendServerAPI}serversnapshot/{snapshotId}/download"; + string url = $"{UserSetting.BackendServerAPI}serversnapshot/{snapshotId}/download"; using UnityWebRequest request = UnityWebRequest.Get(url); request.downloadHandler = new DownloadHandlerFile(targetFileName); UnityWebRequestAsyncOperation asyncOp = request.SendWebRequest(); @@ -313,7 +313,7 @@ public static async UniTask SaveSnapshotsAsync(SEECitySnapshot snapshot) return; } - string url = UserSettings.BackendServerAPI + "server/snapshots?id=" + Network.ServerId + "&city_name=" + snapshot.CityName; + string url = UserSetting.BackendServerAPI + "server/snapshots?id=" + Network.ServerId + "&city_name=" + snapshot.CityName; byte[] bytes = File.ReadAllBytes(snapshotZipPath); using UnityWebRequest request = CreateFileUploadRequest(url, bytes, snapshotZipPath); @@ -335,7 +335,7 @@ public static async UniTask SaveSnapshotsAsync(SEECitySnapshot snapshot) /// internal static async UniTask InitializeCitiesAsync() { - if (!string.IsNullOrWhiteSpace(Network.ServerId) && !string.IsNullOrWhiteSpace(UserSettings.BackendDomain)) + if (!string.IsNullOrWhiteSpace(Network.ServerId) && !string.IsNullOrWhiteSpace(UserSetting.BackendDomain)) { ClearMultiplayerData(); await DownloadAllFilesAsync(); @@ -363,7 +363,7 @@ private static void ClearMultiplayerData() /// private static async UniTask DownloadAllFilesAsync() { - Logger.Log($"Backend API URL is: {UserSettings.BackendServerAPI}.\n"); + Logger.Log($"Backend API URL is: {UserSetting.BackendServerAPI}.\n"); if (!await LogInAsync()) { @@ -413,7 +413,7 @@ private static async UniTask OnMultiplayerFileDeletedAsync(string fileName) string projectType = Filenames.GetRootFolder(fileName.Substring(MultiplayerDataPath.Length)); string relativePath = fileName.Substring(MultiplayerDataPath.Length + projectType.Length + 1); - string url = UserSettings.BackendServerAPI + $"server/deleteProjectFile?id={Network.ServerId}&projectType={projectType}&filePath={relativePath}"; + string url = UserSetting.BackendServerAPI + $"server/deleteProjectFile?id={Network.ServerId}&projectType={projectType}&filePath={relativePath}"; UnityWebRequest request = new UnityWebRequest(url, "POST"); @@ -482,7 +482,7 @@ private static async UniTask OnMultiplayerFileRenamedAsync(string oldFilePath, s string relativeOldPath = oldFilePath.Substring(MultiplayerDataPath.Length + projectType.Length + 1); string relativeNewPath = newFilePath.Substring(MultiplayerDataPath.Length + projectType.Length + 1); - string url = UserSettings.BackendServerAPI + $"server/renameProjectFile?id={Network.ServerId}&projectType={projectType}&oldFilePath={relativeOldPath}&newFilePath={relativeNewPath}"; + string url = UserSetting.BackendServerAPI + $"server/renameProjectFile?id={Network.ServerId}&projectType={projectType}&oldFilePath={relativeOldPath}&newFilePath={relativeNewPath}"; UnityWebRequest request = new UnityWebRequest(url, "POST"); @@ -509,7 +509,7 @@ public static async UniTask SendFileChangeToServerAsync(string filePath) string projectType = Filenames.GetRootFolder(filePath.Substring(MultiplayerDataPath.Length)); string relativePath = filePath.Substring(MultiplayerDataPath.Length + projectType.Length + 1); - string url = UserSettings.BackendServerAPI + $"server/updateProjectFile?id={Network.ServerId}&projectType={projectType}&filePath={relativePath}"; + string url = UserSetting.BackendServerAPI + $"server/updateProjectFile?id={Network.ServerId}&projectType={projectType}&filePath={relativePath}"; using UnityWebRequest request = CreateFileUploadRequest(url, File.ReadAllBytes(filePath), relativePath); await request.SendWebRequest().ToUniTask(); @@ -615,7 +615,7 @@ private static async UniTask DownloadFileAsync(string id, string path) throw new IOException($"The file already exists: '{targetPath}'"); } - string url = UserSettings.BackendServerAPI + "file/download?id=" + id; + string url = UserSetting.BackendServerAPI + "file/download?id=" + id; using UnityWebRequest getRequest = UnityWebRequest.Get(url); getRequest.downloadHandler = new DownloadHandlerFile(targetPath); UnityWebRequestAsyncOperation asyncOp = getRequest.SendWebRequest(); @@ -653,13 +653,13 @@ public static async UniTask LogInAsync() ShowNotification.Error(title, "There is no server id.\n"); return false; } - if (UserSettings.Instance.Network.RoomPassword == null) + if (UserSetting.Instance.Network.RoomPassword == null) { ShowNotification.Error(title, "Password must not be null.\n"); return false; } - string url = UserSettings.BackendServerAPI + "user/signin"; - string postBody = new LoginData(Network.ServerId, UserSettings.Instance.Network.RoomPassword); + string url = UserSetting.BackendServerAPI + "user/signin"; + string postBody = new LoginData(Network.ServerId, UserSetting.Instance.Network.RoomPassword); UnityWebRequest.ClearCookieCache(new Uri(url)); using UnityWebRequest signinRequest = UnityWebRequest.Post(url, postBody, "application/json"); UnityWebRequestAsyncOperation asyncOp = signinRequest.SendWebRequest(); @@ -683,7 +683,7 @@ public static async UniTask LogInAsync() /// A list of file metadata objects if the request was successful, or null if not. private static async UniTask> GetFilesAsync(string serverId) { - string url = UserSettings.BackendServerAPI + "server/files?id=" + serverId; + string url = UserSetting.BackendServerAPI + "server/files?id=" + serverId; using UnityWebRequest fetchRequest = UnityWebRequest.Get(url); UnityWebRequestAsyncOperation operation = fetchRequest.SendWebRequest(); await operation.ToUniTask(); diff --git a/Assets/SEE/Net/Util/FileSync/FileEvent.cs.meta b/Assets/SEE/Net/Util/FileSync/FileEvent.cs.meta index 7aff3a9622..502f40e5a7 100644 --- a/Assets/SEE/Net/Util/FileSync/FileEvent.cs.meta +++ b/Assets/SEE/Net/Util/FileSync/FileEvent.cs.meta @@ -1,2 +1,3 @@ fileFormatVersion: 2 guid: 43933cd05ac35e0469e16a75c19e0fb5 + diff --git a/Assets/SEE/Game/SceneManipulation.meta b/Assets/SEE/SceneManipulation.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation.meta rename to Assets/SEE/SceneManipulation.meta diff --git a/Assets/SEE/Game/SceneManipulation/AcceptDivergence.cs b/Assets/SEE/SceneManipulation/AcceptDivergence.cs similarity index 98% rename from Assets/SEE/Game/SceneManipulation/AcceptDivergence.cs rename to Assets/SEE/SceneManipulation/AcceptDivergence.cs index 081bb60aaa..d5d7f43693 100644 --- a/Assets/SEE/Game/SceneManipulation/AcceptDivergence.cs +++ b/Assets/SEE/SceneManipulation/AcceptDivergence.cs @@ -1,9 +1,9 @@ using SEE.DataModel.DG; -using SEE.GO; +using SEE.Extensions; using SEE.Tools.ReflexionAnalysis; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Adds an edge to a reflexion graph allowing a currently divergent implementation diff --git a/Assets/SEE/Game/SceneManipulation/AcceptDivergence.cs.meta b/Assets/SEE/SceneManipulation/AcceptDivergence.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/AcceptDivergence.cs.meta rename to Assets/SEE/SceneManipulation/AcceptDivergence.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/BoundsChecker.cs b/Assets/SEE/SceneManipulation/BoundsChecker.cs similarity index 99% rename from Assets/SEE/Game/SceneManipulation/BoundsChecker.cs rename to Assets/SEE/SceneManipulation/BoundsChecker.cs index 3d1e65204a..5bb0723443 100644 --- a/Assets/SEE/Game/SceneManipulation/BoundsChecker.cs +++ b/Assets/SEE/SceneManipulation/BoundsChecker.cs @@ -3,7 +3,7 @@ using SEE.DataModel.DG; using SEE.Utils; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Provides utility methods to compute and evaluate diff --git a/Assets/SEE/Game/SceneManipulation/BoundsChecker.cs.meta b/Assets/SEE/SceneManipulation/BoundsChecker.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/BoundsChecker.cs.meta rename to Assets/SEE/SceneManipulation/BoundsChecker.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/GameEdgeAdder.cs b/Assets/SEE/SceneManipulation/GameEdgeAdder.cs similarity index 97% rename from Assets/SEE/Game/SceneManipulation/GameEdgeAdder.cs rename to Assets/SEE/SceneManipulation/GameEdgeAdder.cs index 474a86acf4..070dc99b24 100644 --- a/Assets/SEE/Game/SceneManipulation/GameEdgeAdder.cs +++ b/Assets/SEE/SceneManipulation/GameEdgeAdder.cs @@ -1,10 +1,11 @@ using System; using SEE.DataModel.DG; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using UnityEngine; +using SEE.GraphElementRefs; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Creates new game objects representing graph edges or deletes these again, diff --git a/Assets/SEE/Game/SceneManipulation/GameEdgeAdder.cs.meta b/Assets/SEE/SceneManipulation/GameEdgeAdder.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/GameEdgeAdder.cs.meta rename to Assets/SEE/SceneManipulation/GameEdgeAdder.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/GameElementDeleter.cs b/Assets/SEE/SceneManipulation/GameElementDeleter.cs similarity index 99% rename from Assets/SEE/Game/SceneManipulation/GameElementDeleter.cs rename to Assets/SEE/SceneManipulation/GameElementDeleter.cs index 2419442a68..e8536328d8 100644 --- a/Assets/SEE/Game/SceneManipulation/GameElementDeleter.cs +++ b/Assets/SEE/SceneManipulation/GameElementDeleter.cs @@ -1,9 +1,10 @@ using Cysharp.Threading.Tasks; using MoreLinq; using SEE.DataModel.DG; +using SEE.Game; using SEE.Game.City; -using SEE.GameObjects; -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using SEE.Tools.ReflexionAnalysis; using SEE.UI.Notification; using SEE.UI.RuntimeConfigMenu; @@ -12,8 +13,9 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; +using SEE.Cities; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Allows to delete nodes and edges. diff --git a/Assets/SEE/Game/SceneManipulation/GameElementDeleter.cs.meta b/Assets/SEE/SceneManipulation/GameElementDeleter.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/GameElementDeleter.cs.meta rename to Assets/SEE/SceneManipulation/GameElementDeleter.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/GameNodeAdder.cs b/Assets/SEE/SceneManipulation/GameNodeAdder.cs similarity index 98% rename from Assets/SEE/Game/SceneManipulation/GameNodeAdder.cs rename to Assets/SEE/SceneManipulation/GameNodeAdder.cs index c9529fb641..66ff4c396a 100644 --- a/Assets/SEE/Game/SceneManipulation/GameNodeAdder.cs +++ b/Assets/SEE/SceneManipulation/GameNodeAdder.cs @@ -1,10 +1,11 @@ using System; using SEE.DataModel.DG; +using SEE.Game; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Creates new game objects representing graph nodes or deleting these again, diff --git a/Assets/SEE/Game/SceneManipulation/GameNodeAdder.cs.meta b/Assets/SEE/SceneManipulation/GameNodeAdder.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/GameNodeAdder.cs.meta rename to Assets/SEE/SceneManipulation/GameNodeAdder.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/GameNodeEditor.cs b/Assets/SEE/SceneManipulation/GameNodeEditor.cs similarity index 98% rename from Assets/SEE/Game/SceneManipulation/GameNodeEditor.cs rename to Assets/SEE/SceneManipulation/GameNodeEditor.cs index 8e7fbb376c..97ae4d70aa 100644 --- a/Assets/SEE/Game/SceneManipulation/GameNodeEditor.cs +++ b/Assets/SEE/SceneManipulation/GameNodeEditor.cs @@ -1,12 +1,12 @@ using SEE.DataModel.DG; using SEE.Game.City; using SEE.Game.CityRendering; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Provides methods to edit a node, that is, to change its name or type. diff --git a/Assets/SEE/Game/SceneManipulation/GameNodeEditor.cs.meta b/Assets/SEE/SceneManipulation/GameNodeEditor.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/GameNodeEditor.cs.meta rename to Assets/SEE/SceneManipulation/GameNodeEditor.cs.meta diff --git a/Assets/SEE/GameObjects/GameNodeHierarchy.cs b/Assets/SEE/SceneManipulation/GameNodeHierarchy.cs similarity index 98% rename from Assets/SEE/GameObjects/GameNodeHierarchy.cs rename to Assets/SEE/SceneManipulation/GameNodeHierarchy.cs index f15acc7a04..d85ac33860 100644 --- a/Assets/SEE/GameObjects/GameNodeHierarchy.cs +++ b/Assets/SEE/SceneManipulation/GameNodeHierarchy.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -namespace SEE.GO +namespace SEE.SceneManipulation { /// /// Provides extensions for game objects representing game nodes regarding diff --git a/Assets/SEE/GameObjects/GameNodeHierarchy.cs.meta b/Assets/SEE/SceneManipulation/GameNodeHierarchy.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/GameNodeHierarchy.cs.meta rename to Assets/SEE/SceneManipulation/GameNodeHierarchy.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/GameNodeMover.cs b/Assets/SEE/SceneManipulation/GameNodeMover.cs similarity index 98% rename from Assets/SEE/Game/SceneManipulation/GameNodeMover.cs rename to Assets/SEE/SceneManipulation/GameNodeMover.cs index ea197ddfac..51924d8c8f 100644 --- a/Assets/SEE/Game/SceneManipulation/GameNodeMover.cs +++ b/Assets/SEE/SceneManipulation/GameNodeMover.cs @@ -1,7 +1,8 @@ -using SEE.GO; +using SEE.Extensions; +using SEE.GraphElementRefs; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Allows to move game nodes (game objects representing a graph node). diff --git a/Assets/SEE/Game/SceneManipulation/GameNodeMover.cs.meta b/Assets/SEE/SceneManipulation/GameNodeMover.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/GameNodeMover.cs.meta rename to Assets/SEE/SceneManipulation/GameNodeMover.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/GameObjectFader.cs b/Assets/SEE/SceneManipulation/GameObjectFader.cs similarity index 99% rename from Assets/SEE/Game/SceneManipulation/GameObjectFader.cs rename to Assets/SEE/SceneManipulation/GameObjectFader.cs index 77391d7322..7e123d0a5a 100644 --- a/Assets/SEE/Game/SceneManipulation/GameObjectFader.cs +++ b/Assets/SEE/SceneManipulation/GameObjectFader.cs @@ -1,11 +1,11 @@ using System; using System.Collections; using DG.Tweening; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Provides fading in and out for game objects. There are static as well as instance methods diff --git a/Assets/SEE/Game/SceneManipulation/GameObjectFader.cs.meta b/Assets/SEE/SceneManipulation/GameObjectFader.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/GameObjectFader.cs.meta rename to Assets/SEE/SceneManipulation/GameObjectFader.cs.meta diff --git a/Assets/SEE/Game/ReflexionMapper.cs b/Assets/SEE/SceneManipulation/ReflexionMapper.cs similarity index 76% rename from Assets/SEE/Game/ReflexionMapper.cs rename to Assets/SEE/SceneManipulation/ReflexionMapper.cs index b00a1df40b..902a431c05 100644 --- a/Assets/SEE/Game/ReflexionMapper.cs +++ b/Assets/SEE/SceneManipulation/ReflexionMapper.cs @@ -1,12 +1,11 @@ using SEE.DataModel.DG; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using SEE.Tools.ReflexionAnalysis; using System; -using System.Linq; using UnityEngine; -namespace SEE.Game +namespace SEE.SceneManipulation { /// /// Helper class for mapping game nodes for the reflexion analysis. @@ -86,8 +85,8 @@ internal static void SetParent(GameObject mappingSource, GameObject mappingTarge mappingSource.transform.SetParent(mappingTarget.transform); } // (implementation -> implementation) or (architecture -> architecture) - else if ((source.IsInImplementation() && target.IsInImplementation()) - || (source.IsInArchitecture() && target.IsInArchitecture())) + else if (source.IsInImplementation() && target.IsInImplementation() + || source.IsInArchitecture() && target.IsInArchitecture()) { if (reflexionCity.ReflexionGraph.IsExplicitlyMapped(source)) { @@ -108,32 +107,5 @@ internal static void SetParent(GameObject mappingSource, GameObject mappingTarge // Nothing to be done. } } - - /// - /// Returns true if there is an outgoing maps-to edge of - /// . That edge will be set in the out - /// parameter . If no such edge - /// exists, false is returned and - /// will be null. - /// - /// Node whose outgoing maps-to edge is requested. - /// The outgoing maps-to edge of or null. - /// True if and only if has a single - /// outgoing maps-to edge. - /// Thrown in case has more - /// than one outgoing maps-to edge. - private static bool TryGetMapsToEdge(Node node, out Edge mapsToEdge) - { - try - { - mapsToEdge = node.OutgoingsOfType(ReflexionGraph.MapsToType).SingleOrDefault(); - return mapsToEdge != null; - } - catch (InvalidOperationException) - { - // Rethrow with more helpful error message. - throw new InvalidOperationException($"The node {node.ID} has more than one mapping."); - } - } } } diff --git a/Assets/SEE/Game/ReflexionMapper.cs.meta b/Assets/SEE/SceneManipulation/ReflexionMapper.cs.meta similarity index 100% rename from Assets/SEE/Game/ReflexionMapper.cs.meta rename to Assets/SEE/SceneManipulation/ReflexionMapper.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/RestoreGraphElement.cs b/Assets/SEE/SceneManipulation/RestoreGraphElement.cs similarity index 98% rename from Assets/SEE/Game/SceneManipulation/RestoreGraphElement.cs rename to Assets/SEE/SceneManipulation/RestoreGraphElement.cs index be815cd3be..b36ef61fe8 100644 --- a/Assets/SEE/Game/SceneManipulation/RestoreGraphElement.cs +++ b/Assets/SEE/SceneManipulation/RestoreGraphElement.cs @@ -1,7 +1,7 @@ using System; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Abstract base class representing a helper for restoring diff --git a/Assets/SEE/Game/SceneManipulation/RestoreGraphElement.cs.meta b/Assets/SEE/SceneManipulation/RestoreGraphElement.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/RestoreGraphElement.cs.meta rename to Assets/SEE/SceneManipulation/RestoreGraphElement.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/SceneManipulation.cs b/Assets/SEE/SceneManipulation/SceneManipulation.cs similarity index 90% rename from Assets/SEE/Game/SceneManipulation/SceneManipulation.cs rename to Assets/SEE/SceneManipulation/SceneManipulation.cs index 7442f512f1..933123388e 100644 --- a/Assets/SEE/Game/SceneManipulation/SceneManipulation.cs +++ b/Assets/SEE/SceneManipulation/SceneManipulation.cs @@ -5,6 +5,6 @@ /// The intention here is to avoid redundancy among Actions and /// NetActions as both need to change the scene the same way. /// -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { } \ No newline at end of file diff --git a/Assets/SEE/Game/SceneManipulation/SceneManipulation.cs.meta b/Assets/SEE/SceneManipulation/SceneManipulation.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/SceneManipulation.cs.meta rename to Assets/SEE/SceneManipulation/SceneManipulation.cs.meta diff --git a/Assets/SEE/Game/SceneManipulation/SpatialMetrics.cs b/Assets/SEE/SceneManipulation/SpatialMetrics.cs similarity index 99% rename from Assets/SEE/Game/SceneManipulation/SpatialMetrics.cs rename to Assets/SEE/SceneManipulation/SpatialMetrics.cs index ea08388b83..b841067b07 100644 --- a/Assets/SEE/Game/SceneManipulation/SpatialMetrics.cs +++ b/Assets/SEE/SceneManipulation/SpatialMetrics.cs @@ -1,9 +1,9 @@ -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System; using UnityEngine; -namespace SEE.Game.SceneManipulation +namespace SEE.SceneManipulation { /// /// Stores metrics that are used for working with node placement. diff --git a/Assets/SEE/Game/SceneManipulation/SpatialMetrics.cs.meta b/Assets/SEE/SceneManipulation/SpatialMetrics.cs.meta similarity index 100% rename from Assets/SEE/Game/SceneManipulation/SpatialMetrics.cs.meta rename to Assets/SEE/SceneManipulation/SpatialMetrics.cs.meta diff --git a/Assets/SEE/Tools/LiveKit/LiveKitVideo.cs b/Assets/SEE/Tools/LiveKit/LiveKitVideo.cs index a37f28655c..fc6943ab68 100644 --- a/Assets/SEE/Tools/LiveKit/LiveKitVideo.cs +++ b/Assets/SEE/Tools/LiveKit/LiveKitVideo.cs @@ -1,7 +1,7 @@ using UnityEngine; using Unity.Netcode; -using SEE.Controls; using SEE.Utils; +using SEE.Controls.KeyActions; namespace SEE.Tools.LiveKit { diff --git a/Assets/SEE/Tools/LiveKit/LivekitVideoManager.cs b/Assets/SEE/Tools/LiveKit/LivekitVideoManager.cs index 89b4e26b8d..5c34c91400 100644 --- a/Assets/SEE/Tools/LiveKit/LivekitVideoManager.cs +++ b/Assets/SEE/Tools/LiveKit/LivekitVideoManager.cs @@ -3,16 +3,14 @@ using LiveKit; using LiveKit.Proto; using Newtonsoft.Json; -using SEE.Controls; -using SEE.GO; +using SEE.Controls.KeyActions; using SEE.Net; using SEE.Net.Util; using SEE.Net.Util.FileSync; using SEE.UI; using SEE.UI.Notification; -using SEE.User; +using SEE.UserSettings; using SEE.Utils; -using System; using System.Collections; using System.Collections.Generic; using System.Text; @@ -31,7 +29,7 @@ namespace SEE.Tools.LiveKit /// This component is attached to the DesktopPlayer. /// /// The initial LiveKit settings (LiveKit URL, Token URL, Room Name) - /// can be edited in the component in the SEEStart scene, + /// can be edited in the component in the SEEStart scene, /// where the UserSettings component is attached to the NetworkManager. /// /remarks> public class LiveKitVideoManager : MonoBehaviour @@ -98,7 +96,7 @@ public enum ConnectionStatus /// private void Start() { - if (!UserSettings.IsDesktop) + if (!UserSetting.IsDesktop) { gameObject.SetActive(false); } @@ -235,7 +233,7 @@ public async UniTask FetchTokenAndJoinRoomAsync() } ConnectionState = ConnectionStatus.Disconnected; // Send a GET request to the token server to retrieve the token for this client. - string uri = $"{UserSettings.BackendServerAPI}" + + string uri = $"{UserSetting.BackendServerAPI}" + $"server/livekitToken?id={Network.ServerId}"; using UnityEngine.Networking.UnityWebRequest www = UnityEngine.Networking.UnityWebRequest.Get(uri); // Wait for the request to complete. @@ -295,7 +293,7 @@ private async UniTask JoinRoomAsync(string token) RoomOptions options = new(); // Attempt to connect to the room using the LiveKit server URL and the provided token.; - ConnectInstruction connect = room.Connect(UserSettings.Instance.Video.LiveKitUrl, token, options); + ConnectInstruction connect = room.Connect(UserSetting.Instance.Video.LiveKitUrl, token, options); float elapsed = 0f; float timeoutSeconds = 10f; while (!connect.IsDone) @@ -303,7 +301,7 @@ private async UniTask JoinRoomAsync(string token) if (elapsed >= timeoutSeconds) { ShowNotification.Error("LiveKit", - $"Connection to room \"{UserSettings.Instance.Video.RoomName}\" timed out after {timeoutSeconds} seconds."); + $"Connection to room \"{UserSetting.Instance.Video.RoomName}\" timed out after {timeoutSeconds} seconds."); ConnectionState = ConnectionStatus.RoomConnectionFailed; room.Disconnect(); room = null; @@ -316,7 +314,7 @@ private async UniTask JoinRoomAsync(string token) // Check if the connection was successful. if (connect.IsError) { - ShowNotification.Error("LiveKit", $"Failed to connect to room: \"{UserSettings.Instance.Video.RoomName}\" {connect}."); + ShowNotification.Error("LiveKit", $"Failed to connect to room: \"{UserSetting.Instance.Video.RoomName}\" {connect}."); ConnectionState = ConnectionStatus.RoomConnectionFailed; room.Disconnect(); room = null; diff --git a/Assets/SEE/Tools/OpenTelemetry/OpenTelemetryManager.cs b/Assets/SEE/Tools/OpenTelemetry/OpenTelemetryManager.cs index 99dbf26c6b..52187024b5 100644 --- a/Assets/SEE/Tools/OpenTelemetry/OpenTelemetryManager.cs +++ b/Assets/SEE/Tools/OpenTelemetry/OpenTelemetryManager.cs @@ -4,6 +4,7 @@ using OpenTelemetry.Exporter; using OpenTelemetry.Resources; using OpenTelemetry.Trace; +using SEE.UserSettings; using UnityEngine; using Debug = UnityEngine.Debug; @@ -53,7 +54,7 @@ public void Initialize() return; } - switch (User.UserSettings.Instance?.Telemetry.Mode) + switch (UserSetting.Instance?.Telemetry.Mode) { case TelemetryMode.Disabled: Debug.Log("Telemetry is disabled. Skipping OpenTelemetry initialization.\n"); @@ -64,7 +65,7 @@ public void Initialize() break; case TelemetryMode.Remote: - InitializeRemoteExporter(User.UserSettings.Instance?.Telemetry.ServerURL); + InitializeRemoteExporter(UserSetting.Instance?.Telemetry.ServerURL); break; } } diff --git a/Assets/SEE/Tools/OpenTelemetry/TracingHelper.cs b/Assets/SEE/Tools/OpenTelemetry/TracingHelper.cs index 46646cbf40..6e340edc84 100644 --- a/Assets/SEE/Tools/OpenTelemetry/TracingHelper.cs +++ b/Assets/SEE/Tools/OpenTelemetry/TracingHelper.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using SEE.Controls.Actions; -using SEE.Utils.History; +using SEE.Controls.ReversibleActions; +using SEE.ReversibleActionHistory; using UnityEngine; using Debug = UnityEngine.Debug; diff --git a/Assets/SEE/UI/ConfigMenu/ConfigMenu.cs b/Assets/SEE/UI/ConfigMenu/ConfigMenu.cs index 91690877a6..41ebffa528 100644 --- a/Assets/SEE/UI/ConfigMenu/ConfigMenu.cs +++ b/Assets/SEE/UI/ConfigMenu/ConfigMenu.cs @@ -26,7 +26,7 @@ using Cysharp.Threading.Tasks; using Michsky.UI.ModernUIPack; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; using UnityEngine.Events; diff --git a/Assets/SEE/UI/ConfigMenu/ConfigMenuFactory.cs b/Assets/SEE/UI/ConfigMenu/ConfigMenuFactory.cs index d2cde02b15..82bd9261de 100644 --- a/Assets/SEE/UI/ConfigMenu/ConfigMenuFactory.cs +++ b/Assets/SEE/UI/ConfigMenu/ConfigMenuFactory.cs @@ -20,8 +20,9 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using SEE.Controls; -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Extensions; +using SEE.UserSettings; using SEE.Utils; using System; using UnityEngine; @@ -56,7 +57,7 @@ private void Awake() private void Start() { - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { try { @@ -99,7 +100,7 @@ private void ReplaceMenu(EditableInstance newInstance) private void Update() { - switch (User.UserSettings.Instance.InputType) + switch (UserSetting.Instance.InputType) { case PlayerInputType.DesktopPlayer: HandleDesktopUpdate(); @@ -108,7 +109,7 @@ private void Update() HandleVRUpdate(); break; default: - throw new System.NotImplementedException($"ConfigMenuFactory.Update not implemented for {User.UserSettings.Instance.InputType}."); + throw new System.NotImplementedException($"ConfigMenuFactory.Update not implemented for {UserSetting.Instance.InputType}."); } } diff --git a/Assets/SEE/UI/ConfigMenu/Dictaphone.cs b/Assets/SEE/UI/ConfigMenu/Dictaphone.cs index 3cb130a17d..262d438d97 100644 --- a/Assets/SEE/UI/ConfigMenu/Dictaphone.cs +++ b/Assets/SEE/UI/ConfigMenu/Dictaphone.cs @@ -21,7 +21,7 @@ // SOFTWARE. using Michsky.UI.ModernUIPack; -using SEE.Controls; +using SEE.Controls.SpeechInput; using UnityEngine; using UnityEngine.UI; using UnityEngine.Windows.Speech; diff --git a/Assets/SEE/UI/ConfigMenu/DynamicUIBehaviour.cs b/Assets/SEE/UI/ConfigMenu/DynamicUIBehaviour.cs index e7d9c22307..d18c67c921 100644 --- a/Assets/SEE/UI/ConfigMenu/DynamicUIBehaviour.cs +++ b/Assets/SEE/UI/ConfigMenu/DynamicUIBehaviour.cs @@ -20,7 +20,7 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using SEE.GO; +using SEE.Extensions; using System; using UnityEngine; diff --git a/Assets/SEE/UI/ConfigMenu/EditableInstance.cs b/Assets/SEE/UI/ConfigMenu/EditableInstance.cs index 6245be474e..ac0e50d49f 100644 --- a/Assets/SEE/UI/ConfigMenu/EditableInstance.cs +++ b/Assets/SEE/UI/ConfigMenu/EditableInstance.cs @@ -20,7 +20,7 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using SEE.GO; +using SEE.Extensions; using System.Collections.Generic; using SEE.Game; using SEE.Game.City; diff --git a/Assets/SEE/UI/ConfigMenu/FilePicker.cs b/Assets/SEE/UI/ConfigMenu/FilePicker.cs index 84594ddd84..66001a3434 100644 --- a/Assets/SEE/UI/ConfigMenu/FilePicker.cs +++ b/Assets/SEE/UI/ConfigMenu/FilePicker.cs @@ -21,8 +21,7 @@ // SOFTWARE. using Michsky.UI.ModernUIPack; -using SEE.Controls; -using SEE.GO; +using SEE.UserSettings; using SEE.Utils.Paths; using SimpleFileBrowser; using System; @@ -106,7 +105,7 @@ private void Start() // Find the newly opened file browser and optimize it for VR. GameObject fileBrowser = GameObject.FindWithTag("FileBrowser"); fileBrowser.transform.Find("EventSystem").gameObject.SetActive(false); - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { Canvas parentCanvas = GetComponentInParent(); RectTransform fileBrowserRect = fileBrowser.GetComponent(); diff --git a/Assets/SEE/UI/ConfigMenu/UIBuilder.cs b/Assets/SEE/UI/ConfigMenu/UIBuilder.cs index d3690b78d2..eebc696687 100644 --- a/Assets/SEE/UI/ConfigMenu/UIBuilder.cs +++ b/Assets/SEE/UI/ConfigMenu/UIBuilder.cs @@ -20,7 +20,7 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEditor; using UnityEngine; diff --git a/Assets/SEE/Controls/Actions/ContextMenuAction.cs b/Assets/SEE/UI/ContextMenu.cs similarity index 97% rename from Assets/SEE/Controls/Actions/ContextMenuAction.cs rename to Assets/SEE/UI/ContextMenu.cs index 869bbdadb6..14640919dd 100644 --- a/Assets/SEE/Controls/Actions/ContextMenuAction.cs +++ b/Assets/SEE/UI/ContextMenu.cs @@ -4,35 +4,41 @@ using SEE.DataModel.DG; using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GameObjects.BranchCity; -using SEE.GO; -using SEE.GO.Menu; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Net.Actions.City; using SEE.Net.Actions.GraphElement; using SEE.Tools.ReflexionAnalysis; using SEE.UI.Menu; using SEE.UI.Notification; -using SEE.UI.PopupMenu; +using SEE.UI.PopupMenus; using SEE.UI.PropertyDialog.CitySelection; using SEE.UI.Window; using SEE.UI.Window.PropertyWindow; using SEE.UI.Window.TreeWindow; using SEE.Utils; -using SEE.Utils.History; using SEE.Utils.Paths; using SEE.XR; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; - -namespace SEE.Controls.Actions +using SEE.GraphElementRefs; +using SEE.UserSettings; +using SEE.Controls.KeyActions; +using SEE.ReversibleActionHistory; +using SEE.Controls; +using SEE.Controls.ReversibleActions; +using SEE.Controls.Players; +using SEE.Components.GameNodes.BranchCity; + +namespace SEE.UI { /// /// Shows a context menu with available actions when the user requests it. /// - public class ContextMenuAction : MonoBehaviour + /// This component is attached to a player via DesktopPlayer.prefab./> + public class ContextMenu : MonoBehaviour { /// /// The popup menu that is shown when the user requests the context menu. @@ -68,17 +74,17 @@ private void Start() /// Is true when the context-menu is open. /// This is used in VR to open and close the menu. /// - bool onSelect; + private bool onSelect; private void Update() { - if (SEEInput.OpenContextMenuStart() || (XRSEEActions.TooltipToggle && !XRSEEActions.OnSelectToggle)) + if (SEEInput.OpenContextMenuStart() || XRSEEActions.TooltipToggle && !XRSEEActions.OnSelectToggle) { if (InteractableObject.SelectedObjects.Count <= 1) { Raycasting.RaycastInteractableObject(out _, out InteractableObject o); startObject = o; - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { startMousePosition = Input.mousePosition; } @@ -102,7 +108,7 @@ private void Update() } } } - if (SEEInput.OpenContextMenuEnd() || (XRSEEActions.OnSelectToggle && onSelect)) + if (SEEInput.OpenContextMenuEnd() || XRSEEActions.OnSelectToggle && onSelect) { if (!multiselection) { @@ -111,10 +117,10 @@ private void Update() { return; } - if (User.UserSettings.IsVR - || (hitObject == startObject && (Input.mousePosition - startMousePosition).magnitude < 1)) + if (UserSetting.IsVR + || hitObject == startObject && (Input.mousePosition - startMousePosition).magnitude < 1) { - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { position = Input.mousePosition; } @@ -137,7 +143,7 @@ private void Update() } if (InteractableObject.SelectedObjects.Contains(o)) { - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { position = Input.mousePosition; } @@ -876,8 +882,8 @@ void AcceptDivergence() /// The activated tree window. private static TreeWindow ActivateTreeWindow(GraphElement graphElement, Transform transform, string title = null) { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; - TreeWindow openWindow = manager.Windows.OfType() + WindowSpace windowSpaceOfLocalPlayer = WindowSpaceManager.WindowSpaceOfLocalPlayer; + TreeWindow openWindow = windowSpaceOfLocalPlayer.Windows.OfType() .FirstOrDefault(x => x.Graph == graphElement.ItsGraph && (title == null || x.Title == title)); if (openWindow == null) @@ -890,9 +896,9 @@ private static TreeWindow ActivateTreeWindow(GraphElement graphElement, Transfor { openWindow.Title = title; } - manager.AddWindow(openWindow); + windowSpaceOfLocalPlayer.AddWindow(openWindow); } - manager.ActiveWindow = openWindow; + windowSpaceOfLocalPlayer.ActiveWindow = openWindow; return openWindow; } diff --git a/Assets/SEE/Controls/Actions/ContextMenuAction.cs.meta b/Assets/SEE/UI/ContextMenu.cs.meta similarity index 100% rename from Assets/SEE/Controls/Actions/ContextMenuAction.cs.meta rename to Assets/SEE/UI/ContextMenu.cs.meta diff --git a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolManager.cs b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolManager.cs index ece9621537..1543445bf9 100644 --- a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolManager.cs +++ b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolManager.cs @@ -1,14 +1,14 @@ using Michsky.UI.ModernUIPack; -using SEE.Controls; using SEE.Game; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using SEE.UI.DebugAdapterProtocol.DebugAdapter; using SEE.UI.PropertyDialog; using SEE.Utils; using System.Collections.Generic; using System.Linq; using UnityEngine; +using SEE.Controls.KeyActions; namespace SEE.UI.DebugAdapterProtocol { diff --git a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSession.cs b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSession.cs index 6d3938596a..4f100480ed 100644 --- a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSession.cs +++ b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSession.cs @@ -1,6 +1,6 @@ using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol; using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; -using SEE.Controls; +using SEE.Controls.Players; using SEE.DataModel.DG; using SEE.DataModel.DG.GraphIndex; using SEE.Game.City; @@ -477,7 +477,7 @@ private void UpdateVariables() threadVariables.Add(stackFrame, stackVariables); } } - variablesWindow ??= WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer].Windows.OfType().FirstOrDefault(); + variablesWindow ??= WindowSpaceManager.WindowSpaceOfLocalPlayer.Windows.OfType().FirstOrDefault(); if (variablesWindow != null) { variablesWindow.RetrieveNestedVariables = RetrieveNestedVariables; diff --git a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionCodePosition.cs b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionCodePosition.cs index 0e1fa44116..57c03794ff 100644 --- a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionCodePosition.cs +++ b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionCodePosition.cs @@ -1,6 +1,5 @@ -using SEE.Controls; using SEE.DataModel.DG; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Window; using SEE.UI.Window.CodeWindow; using SEE.Utils; @@ -8,6 +7,7 @@ using System.Linq; using Cysharp.Threading.Tasks; using StackFrame = Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages.StackFrame; +using SEE.Controls.Players; namespace SEE.UI.DebugAdapterProtocol { @@ -82,7 +82,7 @@ private void UpdateCodePosition() /// The highlight duration (seconds) in the city. private void ShowCodePosition(bool makeActive = false, bool scroll = false, float highlightDuration = highlightDurationInitial) { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; CodeWindow codeWindow = manager.Windows.OfType().FirstOrDefault(window => Filenames.OnCurrentPlatform(window.FilePath) == Filenames.OnCurrentPlatform(lastCodePath)); if (codeWindow == null) { diff --git a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionControls.cs b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionControls.cs index 0a76b81d2e..8f6020ec35 100644 --- a/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionControls.cs +++ b/Assets/SEE/UI/DebugAdapterProtocol/DebugAdapterProtocolSessionControls.cs @@ -1,8 +1,8 @@ using Michsky.UI.ModernUIPack; using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol; using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; -using SEE.Controls; -using SEE.GO; +using SEE.Controls.Players; +using SEE.Extensions; using SEE.UI.Window; using SEE.UI.Window.ConsoleWindow; using SEE.UI.Window.VariablesWindow; @@ -86,7 +86,7 @@ void UpdateVisibility() /// private void OpenConsole(bool start = false) { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; ConsoleWindow console = manager.Windows.OfType().FirstOrDefault(); if (console == null) { @@ -116,7 +116,7 @@ private void OpenConsole(bool start = false) /// private void OpenVariables() { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; if (variablesWindow == null) { variablesWindow = manager.Windows.OfType().FirstOrDefault() ?? Canvas.AddComponent(); diff --git a/Assets/SEE/UI/Drawable/BorderTriggerController.cs b/Assets/SEE/UI/Drawable/BorderTriggerController.cs index 57aec0dcce..78869503cb 100644 --- a/Assets/SEE/UI/Drawable/BorderTriggerController.cs +++ b/Assets/SEE/UI/Drawable/BorderTriggerController.cs @@ -2,7 +2,7 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using UnityEngine; diff --git a/Assets/SEE/UI/Drawable/CollisionController.cs b/Assets/SEE/UI/Drawable/CollisionController.cs index b781b697c0..d78451717e 100644 --- a/Assets/SEE/UI/Drawable/CollisionController.cs +++ b/Assets/SEE/UI/Drawable/CollisionController.cs @@ -1,6 +1,6 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.UI.Drawable diff --git a/Assets/SEE/UI/Drawable/ColorPickerMenuDisabler.cs b/Assets/SEE/UI/Drawable/ColorPickerMenuDisabler.cs index e44d604c1f..a15c5d988a 100644 --- a/Assets/SEE/UI/Drawable/ColorPickerMenuDisabler.cs +++ b/Assets/SEE/UI/Drawable/ColorPickerMenuDisabler.cs @@ -1,5 +1,6 @@ -using SEE.Controls.Actions; -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions; +using SEE.Controls.ReversibleActions.Drawable; +using SEE.ReversibleActionHistory; using SEE.UI.Menu.Drawable; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/UI/Drawable/DrawableActionBar.cs b/Assets/SEE/UI/Drawable/DrawableActionBar.cs index 10864fafae..00946c0759 100644 --- a/Assets/SEE/UI/Drawable/DrawableActionBar.cs +++ b/Assets/SEE/UI/Drawable/DrawableActionBar.cs @@ -1,9 +1,9 @@ using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions; -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game; using SEE.Game.Drawable; -using SEE.GO.Menu; +using SEE.ReversibleActionHistory; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/UI/Drawable/DrawableFileBrowser.cs b/Assets/SEE/UI/Drawable/DrawableFileBrowser.cs index b47ec66c12..28e19b410b 100644 --- a/Assets/SEE/UI/Drawable/DrawableFileBrowser.cs +++ b/Assets/SEE/UI/Drawable/DrawableFileBrowser.cs @@ -2,8 +2,8 @@ using SEE.UI.FilePicker; using SEE.Utils; using UnityEngine; -using static SEE.Controls.Actions.Drawable.LoadAction; -using static SEE.Controls.Actions.Drawable.SaveAction; +using static SEE.Controls.ReversibleActions.Drawable.LoadAction; +using static SEE.Controls.ReversibleActions.Drawable.SaveAction; namespace SEE.UI.Drawable { diff --git a/Assets/SEE/UI/Drawable/InputFieldEventTriggerController.cs b/Assets/SEE/UI/Drawable/InputFieldEventTriggerController.cs index e039962e17..ff680f655f 100644 --- a/Assets/SEE/UI/Drawable/InputFieldEventTriggerController.cs +++ b/Assets/SEE/UI/Drawable/InputFieldEventTriggerController.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/Drawable/SurfacePageController.cs b/Assets/SEE/UI/Drawable/SurfacePageController.cs index 689e18434d..1fbf62a3d2 100644 --- a/Assets/SEE/UI/Drawable/SurfacePageController.cs +++ b/Assets/SEE/UI/Drawable/SurfacePageController.cs @@ -3,7 +3,7 @@ using SEE.Game.Drawable.ValueHolders; using SEE.Net.Actions.Drawable; using SEE.UI.Notification; -using SEE.UI.PopupMenu; +using SEE.UI.PopupMenus; using SEE.Utils; using System.Collections.Generic; using System.Linq; @@ -40,7 +40,7 @@ public class SurfacePageController : MonoBehaviour /// /// The popup menu for chosing a page. /// - private PopupMenu.PopupMenu popupMenu; + private PopupMenu popupMenu; /// /// The drawable holder of the depending surface. @@ -56,7 +56,7 @@ private void Awake() backward = transform.Find("BackButton").GetComponent(); display = transform.Find("CurrentButton").GetComponent(); displayMesh = transform.Find("CurrentButton").GetComponentInChildren(); - popupMenu = gameObject.AddComponent(); + popupMenu = gameObject.AddComponent(); holder = GameFinder.GetDrawableSurface(gameObject).GetComponent(); displayMesh.text = holder.CurrentPage.ToString(); diff --git a/Assets/SEE/UI/Drawable/ValueResetter.cs b/Assets/SEE/UI/Drawable/ValueResetter.cs index 2da617f52d..68c2f40e77 100644 --- a/Assets/SEE/UI/Drawable/ValueResetter.cs +++ b/Assets/SEE/UI/Drawable/ValueResetter.cs @@ -1,6 +1,7 @@ -using SEE.Controls.Actions; -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable.Configurations; +using SEE.ReversibleActionHistory; using UnityEngine; namespace SEE.UI.Drawable diff --git a/Assets/SEE/UI/Extensions.meta b/Assets/SEE/UI/Extensions.meta new file mode 100644 index 0000000000..aa47459174 --- /dev/null +++ b/Assets/SEE/UI/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7bcf83661bb954b4d81e6f45990482e3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SEE/Utils/Extensions/TMPInputFieldExtensions.cs b/Assets/SEE/UI/Extensions/TMPInputFieldExtensions.cs similarity index 99% rename from Assets/SEE/Utils/Extensions/TMPInputFieldExtensions.cs rename to Assets/SEE/UI/Extensions/TMPInputFieldExtensions.cs index 37b3854e23..6429b13e4d 100644 --- a/Assets/SEE/Utils/Extensions/TMPInputFieldExtensions.cs +++ b/Assets/SEE/UI/Extensions/TMPInputFieldExtensions.cs @@ -2,7 +2,7 @@ using UnityEngine; using UnityEngine.UI; -namespace SEE.Utils.Extensions +namespace SEE.UI.Extensions { /// /// Provides extension methods for to simplify UI state handling, diff --git a/Assets/SEE/Utils/Extensions/TMPInputFieldExtensions.cs.meta b/Assets/SEE/UI/Extensions/TMPInputFieldExtensions.cs.meta similarity index 100% rename from Assets/SEE/Utils/Extensions/TMPInputFieldExtensions.cs.meta rename to Assets/SEE/UI/Extensions/TMPInputFieldExtensions.cs.meta diff --git a/Assets/SEE/UI/FilePicker/DataPathPickerDesktop.cs b/Assets/SEE/UI/FilePicker/DataPathPickerDesktop.cs index 092bf11046..7357ad2cfe 100644 --- a/Assets/SEE/UI/FilePicker/DataPathPickerDesktop.cs +++ b/Assets/SEE/UI/FilePicker/DataPathPickerDesktop.cs @@ -1,7 +1,8 @@ using System; using Michsky.UI.ModernUIPack; -using SEE.Controls; -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Extensions; +using SEE.UserSettings; using SEE.Utils; using SEE.Utils.Paths; using SimpleFileBrowser; @@ -117,7 +118,7 @@ protected override void StartDesktop() // Find the newly opened file browser and optimize it for VR. GameObject fileBrowser = GameObject.FindWithTag("FileBrowser"); fileBrowser.transform.Find("EventSystem").gameObject.SetActive(false); - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { Canvas parentCanvas = GetComponentInParent(); RectTransform fileBrowserRect = fileBrowser.GetComponent(); diff --git a/Assets/SEE/UI/FilePicker/PathPicker.cs b/Assets/SEE/UI/FilePicker/PathPicker.cs index 92a8f44a8b..fcd8cdadf3 100644 --- a/Assets/SEE/UI/FilePicker/PathPicker.cs +++ b/Assets/SEE/UI/FilePicker/PathPicker.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SimpleFileBrowser; using System; diff --git a/Assets/SEE/UI/HandAnimationsActions.cs b/Assets/SEE/UI/HandAnimationsActions.cs index 2aaf5a445a..65c6b2ee7f 100644 --- a/Assets/SEE/UI/HandAnimationsActions.cs +++ b/Assets/SEE/UI/HandAnimationsActions.cs @@ -1,10 +1,10 @@ using UnityEngine; using System.Collections; -using SEE.GO; using SEE.Utils; using Michsky.UI.ModernUIPack; using SEE.Game.Avatars; using TMPro; +using SEE.Extensions; namespace SEE.UI { diff --git a/Assets/SEE/UI/HandAnimationsMenu.cs b/Assets/SEE/UI/HandAnimationsMenu.cs index 149548a13f..0b66d1ed77 100644 --- a/Assets/SEE/UI/HandAnimationsMenu.cs +++ b/Assets/SEE/UI/HandAnimationsMenu.cs @@ -4,6 +4,8 @@ using SEE.Controls; using UnityEngine; using SEE.Game.Avatars; +using SEE.Controls.KeyActions; +using SEE.Extensions; namespace SEE.UI { diff --git a/Assets/SEE/UI/HelpSystem/HelpSystemEntry.cs b/Assets/SEE/UI/HelpSystem/HelpSystemEntry.cs index 4ca5056fcf..82f56541a0 100644 --- a/Assets/SEE/UI/HelpSystem/HelpSystemEntry.cs +++ b/Assets/SEE/UI/HelpSystem/HelpSystemEntry.cs @@ -22,7 +22,7 @@ using DynamicPanels; using Michsky.UI.ModernUIPack; using SEE.Game.Avatars; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/HelpSystem/HelpSystemMenu.cs b/Assets/SEE/UI/HelpSystem/HelpSystemMenu.cs index 9ddfabc14c..ecf99ccb9f 100644 --- a/Assets/SEE/UI/HelpSystem/HelpSystemMenu.cs +++ b/Assets/SEE/UI/HelpSystem/HelpSystemMenu.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json.Linq; -using SEE.Controls; using SEE.Controls.KeyActions; using SEE.UI.Menu; using SEE.UI.Notification; diff --git a/Assets/SEE/UI/LoadingSpinner.cs b/Assets/SEE/UI/LoadingSpinner.cs index a2a2a16eb2..5503227404 100644 --- a/Assets/SEE/UI/LoadingSpinner.cs +++ b/Assets/SEE/UI/LoadingSpinner.cs @@ -5,7 +5,7 @@ using System.Text; using Cysharp.Threading.Tasks; using DG.Tweening; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; @@ -48,6 +48,7 @@ namespace SEE.UI /// end of your loading process and hide the spinner. /// You can also call manually with your unique message to hide the spinner. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class LoadingSpinner : PlatformDependentComponent { /// diff --git a/Assets/SEE/UI/Menu/ConfirmDialog.cs b/Assets/SEE/UI/Menu/ConfirmDialog.cs index 289ebd87e9..e7b6cb9025 100644 --- a/Assets/SEE/UI/Menu/ConfirmDialog.cs +++ b/Assets/SEE/UI/Menu/ConfirmDialog.cs @@ -3,7 +3,7 @@ using Cysharp.Threading.Tasks; using DG.Tweening; using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/Menu/Desktop/SimpleListMenuDesktop.cs b/Assets/SEE/UI/Menu/Desktop/SimpleListMenuDesktop.cs index ff9dc285b8..004bfd13bd 100644 --- a/Assets/SEE/UI/Menu/Desktop/SimpleListMenuDesktop.cs +++ b/Assets/SEE/UI/Menu/Desktop/SimpleListMenuDesktop.cs @@ -1,7 +1,7 @@ using System.Linq; using Michsky.UI.ModernUIPack; using MoreLinq; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/Menu/Drawable/ColorPickerMenu.cs b/Assets/SEE/UI/Menu/Drawable/ColorPickerMenu.cs index 52b66ef099..481896bcf0 100644 --- a/Assets/SEE/UI/Menu/Drawable/ColorPickerMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/ColorPickerMenu.cs @@ -1,6 +1,6 @@ using HSVPicker; using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using UnityEngine; diff --git a/Assets/SEE/UI/Menu/Drawable/LineMenu.cs b/Assets/SEE/UI/Menu/Drawable/LineMenu.cs index de5a5cb7ec..3e9a30e575 100644 --- a/Assets/SEE/UI/Menu/Drawable/LineMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/LineMenu.cs @@ -1,6 +1,6 @@ +using Michsky.UI.ModernUIPack; +using SEE.Controls.ReversibleActions.Drawable; using Cysharp.Threading.Tasks; -using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; diff --git a/Assets/SEE/UI/Menu/Drawable/MindMapEditMenu.cs b/Assets/SEE/UI/Menu/Drawable/MindMapEditMenu.cs index f71b3fab8c..cd77d2d32b 100644 --- a/Assets/SEE/UI/Menu/Drawable/MindMapEditMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/MindMapEditMenu.cs @@ -2,7 +2,7 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Drawable; using SEE.UI.Menu.Drawable; diff --git a/Assets/SEE/UI/Menu/Drawable/MindMapParentSelectionMenu.cs b/Assets/SEE/UI/Menu/Drawable/MindMapParentSelectionMenu.cs index e91282b2f2..326e1660a4 100644 --- a/Assets/SEE/UI/Menu/Drawable/MindMapParentSelectionMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/MindMapParentSelectionMenu.cs @@ -3,7 +3,7 @@ using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using SEE.Game.Drawable.ValueHolders; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Notification; using System.Collections.Generic; diff --git a/Assets/SEE/UI/Menu/Drawable/ShapeMenu.cs b/Assets/SEE/UI/Menu/Drawable/ShapeMenu.cs index 09244cdcdf..2f32e845ec 100644 --- a/Assets/SEE/UI/Menu/Drawable/ShapeMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/ShapeMenu.cs @@ -1,5 +1,5 @@ using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions.Drawable; +using SEE.Controls.ReversibleActions.Drawable; using SEE.Game.Drawable; using SEE.Game.Drawable.ActionHelpers; using SEE.Game.Drawable.Configurations; diff --git a/Assets/SEE/UI/Menu/Drawable/StickyNoteEditMenu.cs b/Assets/SEE/UI/Menu/Drawable/StickyNoteEditMenu.cs index 52a4158575..6cf7c32dc7 100644 --- a/Assets/SEE/UI/Menu/Drawable/StickyNoteEditMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/StickyNoteEditMenu.cs @@ -1,7 +1,7 @@ using Michsky.UI.ModernUIPack; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; using SEE.UI.Drawable; using UnityEngine; diff --git a/Assets/SEE/UI/Menu/Drawable/StickyNoteMenu.cs b/Assets/SEE/UI/Menu/Drawable/StickyNoteMenu.cs index 78af3ee690..60701b9666 100644 --- a/Assets/SEE/UI/Menu/Drawable/StickyNoteMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/StickyNoteMenu.cs @@ -1,7 +1,7 @@ using Michsky.UI.ModernUIPack; using SEE.Game.Drawable; using SEE.UI.Notification; -using static SEE.Controls.Actions.Drawable.StickyNoteAction; +using static SEE.Controls.ReversibleActions.Drawable.StickyNoteAction; namespace SEE.UI.Menu.Drawable { diff --git a/Assets/SEE/UI/Menu/Drawable/TextMenu.cs b/Assets/SEE/UI/Menu/Drawable/TextMenu.cs index 617f1aee11..14fd41577a 100644 --- a/Assets/SEE/UI/Menu/Drawable/TextMenu.cs +++ b/Assets/SEE/UI/Menu/Drawable/TextMenu.cs @@ -1,5 +1,4 @@ using Michsky.UI.ModernUIPack; -using SEE.Controls; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; using SEE.UI.Notification; @@ -14,6 +13,7 @@ using UnityEngine.UI; using TextConf = SEE.Game.Drawable.Configurations.TextConf; using SEE.Game.Drawable.ValueHolders; +using SEE.Controls.KeyActions; namespace SEE.UI.Menu.Drawable { diff --git a/Assets/SEE/UI/Menu/MenuEntry.cs b/Assets/SEE/UI/Menu/MenuEntry.cs index 4690a82fbd..314890bd5b 100644 --- a/Assets/SEE/UI/Menu/MenuEntry.cs +++ b/Assets/SEE/UI/Menu/MenuEntry.cs @@ -1,5 +1,6 @@ using System; using SEE.Utils; +using SEE.Extensions; using UnityEngine; namespace SEE.UI.Menu diff --git a/Assets/SEE/UI/Menu/NestedListMenu.cs b/Assets/SEE/UI/Menu/NestedListMenu.cs index 0c3ac8e541..20aadb6ba2 100644 --- a/Assets/SEE/UI/Menu/NestedListMenu.cs +++ b/Assets/SEE/UI/Menu/NestedListMenu.cs @@ -4,9 +4,9 @@ using System.Threading; using Cysharp.Threading.Tasks; using FuzzySharp; -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.DataModel.DG.GraphSearch; -using SEE.GO; +using SEE.Extensions; using TMPro; using UnityEngine; using UnityEngine.Windows.Speech; @@ -315,7 +315,7 @@ private async UniTaskVoid SearchTextEnteredAsync() } allEntries ??= GetAllEntries().ToDictionary(x => x.Title, x => x); - IEnumerable results = Process.ExtractTop(GraphSearch.FilterString(searchInput.text), allEntries.Keys, cutoff: 10) + IEnumerable results = Process.ExtractTop(NodeSearch.FilterString(searchInput.text), allEntries.Keys, cutoff: 10) .OrderByDescending(x => x.Score) .Select(x => allEntries[x.Value]) .ToList(); diff --git a/Assets/SEE/UI/Menu/SelectionMenu.cs b/Assets/SEE/UI/Menu/SelectionMenu.cs index 550fe1a9bd..750ff50d02 100644 --- a/Assets/SEE/UI/Menu/SelectionMenu.cs +++ b/Assets/SEE/UI/Menu/SelectionMenu.cs @@ -1,5 +1,5 @@ using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using TMPro; using UnityEngine; using UnityEngine.Events; diff --git a/Assets/SEE/UI/Menu/SimpleMenu.cs b/Assets/SEE/UI/Menu/SimpleMenu.cs index 119be1003c..c0b8acadd3 100644 --- a/Assets/SEE/UI/Menu/SimpleMenu.cs +++ b/Assets/SEE/UI/Menu/SimpleMenu.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; -using SEE.Controls; -using SEE.Utils; +using SEE.Controls.SpeechInput; using UnityEngine; using UnityEngine.Events; using UnityEngine.Windows.Speech; diff --git a/Assets/SEE/UI/Menu/Table/ModifyTableMenu.cs b/Assets/SEE/UI/Menu/Table/ModifyTableMenu.cs index 7b6d774962..4b9fe6211a 100644 --- a/Assets/SEE/UI/Menu/Table/ModifyTableMenu.cs +++ b/Assets/SEE/UI/Menu/Table/ModifyTableMenu.cs @@ -1,5 +1,5 @@ using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/UI/Menu/Table/ScaleTableMenu.cs b/Assets/SEE/UI/Menu/Table/ScaleTableMenu.cs index 71763b200a..fe77911ec6 100644 --- a/Assets/SEE/UI/Menu/Table/ScaleTableMenu.cs +++ b/Assets/SEE/UI/Menu/Table/ScaleTableMenu.cs @@ -1,6 +1,6 @@ using Michsky.UI.ModernUIPack; -using SEE.Game.Table; -using SEE.GO; +using SEE.Game.Tables; +using SEE.Extensions; using SEE.Net.Actions.Table; using SEE.UI.Drawable; using SEE.Utils; diff --git a/Assets/SEE/UI/Notification/Notification.cs b/Assets/SEE/UI/Notification/Notification.cs index c081b7395f..e31548a534 100644 --- a/Assets/SEE/UI/Notification/Notification.cs +++ b/Assets/SEE/UI/Notification/Notification.cs @@ -2,7 +2,7 @@ using System.Linq; using Michsky.UI.ModernUIPack; using SEE.Game.Operator; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/Notification/SEENotificationManager.cs b/Assets/SEE/UI/Notification/SEENotificationManager.cs index 61ecd0ae38..f43e1b42e8 100644 --- a/Assets/SEE/UI/Notification/SEENotificationManager.cs +++ b/Assets/SEE/UI/Notification/SEENotificationManager.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Threading; using Cysharp.Threading.Tasks; -using SEE.Controls; +using SEE.Controls.KeyActions; using UnityEngine; namespace SEE.UI.Notification diff --git a/Assets/SEE/UI/OpeningDialog.cs b/Assets/SEE/UI/OpeningDialog.cs index 1b34c9fad3..685d5dc500 100644 --- a/Assets/SEE/UI/OpeningDialog.cs +++ b/Assets/SEE/UI/OpeningDialog.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; -using SEE.GO; using SEE.UI.Menu; using SEE.UI.Notification; using SEE.UI.PropertyDialog; +using SEE.UserSettings; using SEE.Utils; +using SEE.Extensions; using Sirenix.Utilities; using UnityEngine; @@ -73,7 +74,7 @@ private IList SelectionEntries() new( SelectAction: TelemetrySettings, Title: "Telemetry Mode", - Description: $"Currently: {User.UserSettings.Instance ?.Telemetry.Mode}", + Description: $"Currently: {UserSetting.Instance ?.Telemetry.Mode}", EntryColor: NextColor(), Icon: Icons.Export), @@ -104,8 +105,8 @@ private void StartHost() // not want the user to start any other network setting until this // process has come to an end. menu.ShowMenu = false; - User.UserSettings.Instance.InputType = inputType; - User.UserSettings.Instance.Network.StartHost(NetworkCallBack); + UserSetting.Instance.InputType = inputType; + UserSetting.Instance.Network.StartHost(NetworkCallBack); } catch (Exception exception) { @@ -127,8 +128,8 @@ private void StartClient() // not want the user to start any other network setting until this // process has come to an end. menu.ShowMenu = false; - User.UserSettings.Instance.InputType = inputType; - User.UserSettings.Instance.Network.StartClient(NetworkCallBack); + UserSetting.Instance.InputType = inputType; + UserSetting.Instance.Network.StartClient(NetworkCallBack); } catch (Exception exception) { @@ -150,8 +151,8 @@ private void StartServer() // not want the user to start any other network setting until this // process has come to an end. menu.ShowMenu = false; - User.UserSettings.Instance.InputType = PlayerInputType.None; - User.UserSettings.Instance.Network.StartServer(NetworkCallBack); + UserSetting.Instance.InputType = PlayerInputType.None; + UserSetting.Instance.Network.StartServer(NetworkCallBack); } catch (Exception exception) { @@ -187,7 +188,7 @@ private void UserSettings() /// menu, which - in turn - will call menu.ShowMenuAsync(false). Thus /// at this time, menu is no longer visible. When the following dialog /// is finished, will be called to turn the menu on again. - UserSettingsDialog dialog = new(User.UserSettings.Instance?.Network, Reactivate); + UserSettingsDialog dialog = new(UserSetting.Instance?.Network, Reactivate); dialog.Open(); menu.ShowMenu = false; } @@ -222,10 +223,10 @@ private void Reactivate() /// private void Awake() { - if (User.UserSettings.Instance == null) + if (UserSetting.Instance == null) { - Debug.LogWarning($"No {typeof(User.UserSettings)} component exists in the scene! " - + $"{typeof(OpeningDialog)} requires a {typeof(User.UserSettings)} component to be present. " + Debug.LogWarning($"No {typeof(UserSetting)} component exists in the scene! " + + $"{typeof(OpeningDialog)} requires a {typeof(UserSetting)} component to be present. " + "Disabling this component.\n"); enabled = false; return; @@ -238,8 +239,8 @@ private void Awake() private void Start() { menu = CreateMenu(); - User.UserSettings.Instance.Load(); - inputType = User.UserSettings.Instance.InputType; + UserSetting.Instance.Load(); + inputType = UserSetting.Instance.InputType; // While this OpeningDialog is open, we want to run in a desktop environment, // because our GUI implementation is not yet complete for VR. The NetworkPropertyDialog // uses widgets that are not implemented for VR. Neither are ShowNotifications not @@ -247,8 +248,8 @@ private void Start() // We reset the InputType here to a desktop environment. // The loaded settings for the input type is kept in inputType. This field // will be toggled by request of the user and only when the host or client is - // actually started, we assign the value of inputType to User.UserSettings.Instance.InputType. - User.UserSettings.Instance.InputType = PlayerInputType.DesktopPlayer; + // actually started, we assign the value of inputType to UserSettings.Instance.InputType. + UserSetting.Instance.InputType = PlayerInputType.DesktopPlayer; menu.ShowMenu = true; ShowEnvironment(); } @@ -273,7 +274,7 @@ private void ToggleEnvironment() inputType = PlayerInputType.DesktopPlayer; } - User.UserSettings.Instance.Save(); + UserSetting.Instance.Save(); ShowEnvironment(); } diff --git a/Assets/SEE/UI/PlatformDependentComponent.cs b/Assets/SEE/UI/PlatformDependentComponent.cs index 197c9c787e..653a932850 100644 --- a/Assets/SEE/UI/PlatformDependentComponent.cs +++ b/Assets/SEE/UI/PlatformDependentComponent.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Reflection; using MoreLinq; -using SEE.GO; +using SEE.UserSettings; using SEE.Utils; using UnityEngine; using UnityEngine.Events; @@ -157,7 +157,7 @@ protected virtual void Start() } // calls the start method for the current platform - Platform = User.UserSettings.Instance.InputType; + Platform = UserSetting.Instance.InputType; switch (Platform) { case PlayerInputType.DesktopPlayer: diff --git a/Assets/SEE/GameObjects/Menu/PlayerMenu.cs b/Assets/SEE/UI/PlayerMenu.cs similarity index 98% rename from Assets/SEE/GameObjects/Menu/PlayerMenu.cs rename to Assets/SEE/UI/PlayerMenu.cs index 0257fc316e..dc82d2e657 100644 --- a/Assets/SEE/GameObjects/Menu/PlayerMenu.cs +++ b/Assets/SEE/UI/PlayerMenu.cs @@ -1,21 +1,23 @@ using System.Collections.Generic; using System.Linq; -using SEE.Controls; -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; using SEE.Controls.KeyActions; using SEE.Game; using SEE.UI.Menu; using SEE.UI.StateIndicator; using SEE.Utils; +using SEE.Extensions; using UnityEngine; using SEE.XR; using MoreLinq; +using SEE.ReversibleActionHistory; -namespace SEE.GO.Menu +namespace SEE.UI { /// /// Implements the behaviour of the in-game player menu, in which action states can be selected. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class PlayerMenu : MonoBehaviour { /// diff --git a/Assets/SEE/GameObjects/Menu/PlayerMenu.cs.meta b/Assets/SEE/UI/PlayerMenu.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/Menu/PlayerMenu.cs.meta rename to Assets/SEE/UI/PlayerMenu.cs.meta diff --git a/Assets/SEE/UI/PopupMenu.meta b/Assets/SEE/UI/PopupMenus.meta similarity index 100% rename from Assets/SEE/UI/PopupMenu.meta rename to Assets/SEE/UI/PopupMenus.meta diff --git a/Assets/SEE/UI/PopupMenu/PopupMenu.cs b/Assets/SEE/UI/PopupMenus/PopupMenu.cs similarity index 98% rename from Assets/SEE/UI/PopupMenu/PopupMenu.cs rename to Assets/SEE/UI/PopupMenus/PopupMenu.cs index e71edcf3af..c40dd254ff 100644 --- a/Assets/SEE/UI/PopupMenu/PopupMenu.cs +++ b/Assets/SEE/UI/PopupMenus/PopupMenu.cs @@ -1,7 +1,7 @@ using Cysharp.Threading.Tasks; using DG.Tweening; using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System; using System.Collections.Generic; @@ -10,8 +10,9 @@ using UnityEngine; using UnityEngine.UI; using SEE.XR; +using SEE.UserSettings; -namespace SEE.UI.PopupMenu +namespace SEE.UI.PopupMenus { /// /// A popup menu that can be used to display a list of actions to the user. @@ -107,7 +108,7 @@ private float GetHeight() protected override void StartDesktop() { // Instantiate the menu. - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { menu = (RectTransform)GameObject.Find(xrMenuPrefabPath).transform; } @@ -119,7 +120,7 @@ protected override void StartDesktop() menuCanvasGroup = menu.gameObject.MustGetComponent(); scrollView = (RectTransform)menu.Find("Scroll View"); actionList = (RectTransform)scrollView.Find("Viewport/Action List"); - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { RectTransform background = (RectTransform)menu.Find("Background"); RectTransform shadow = (RectTransform)menu.Find("Shadow"); @@ -129,7 +130,7 @@ protected override void StartDesktop() } // The menu should be hidden when the user moves the mouse away from it. PointerHelper pointerHelper = menu.gameObject.MustGetComponent(); - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { pointerHelper.ExitEvent.AddListener(x => { @@ -404,7 +405,7 @@ public void ShowWith(IEnumerable entries = null, Vector2? positi } if (position.HasValue) { - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { MoveTo(position.Value); } diff --git a/Assets/SEE/UI/PopupMenu/PopupMenu.cs.meta b/Assets/SEE/UI/PopupMenus/PopupMenu.cs.meta similarity index 100% rename from Assets/SEE/UI/PopupMenu/PopupMenu.cs.meta rename to Assets/SEE/UI/PopupMenus/PopupMenu.cs.meta diff --git a/Assets/SEE/UI/PopupMenu/PopupMenuEntry.cs b/Assets/SEE/UI/PopupMenus/PopupMenuEntry.cs similarity index 98% rename from Assets/SEE/UI/PopupMenu/PopupMenuEntry.cs rename to Assets/SEE/UI/PopupMenus/PopupMenuEntry.cs index 1977ea9047..67aed65c1a 100644 --- a/Assets/SEE/UI/PopupMenu/PopupMenuEntry.cs +++ b/Assets/SEE/UI/PopupMenus/PopupMenuEntry.cs @@ -1,6 +1,6 @@ using System; -namespace SEE.UI.PopupMenu +namespace SEE.UI.PopupMenus { /// /// An entry in a . diff --git a/Assets/SEE/UI/PopupMenu/PopupMenuEntry.cs.meta b/Assets/SEE/UI/PopupMenus/PopupMenuEntry.cs.meta similarity index 100% rename from Assets/SEE/UI/PopupMenu/PopupMenuEntry.cs.meta rename to Assets/SEE/UI/PopupMenus/PopupMenuEntry.cs.meta diff --git a/Assets/SEE/UI/PopupMenu/PriorityHolder.cs b/Assets/SEE/UI/PopupMenus/PriorityHolder.cs similarity index 92% rename from Assets/SEE/UI/PopupMenu/PriorityHolder.cs rename to Assets/SEE/UI/PopupMenus/PriorityHolder.cs index 60ad2db2f5..65db76e9c9 100644 --- a/Assets/SEE/UI/PopupMenu/PriorityHolder.cs +++ b/Assets/SEE/UI/PopupMenus/PriorityHolder.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace SEE.UI.PopupMenu +namespace SEE.UI.PopupMenus { /// /// Component which holds the priority of a . diff --git a/Assets/SEE/UI/PopupMenu/PriorityHolder.cs.meta b/Assets/SEE/UI/PopupMenus/PriorityHolder.cs.meta similarity index 100% rename from Assets/SEE/UI/PopupMenu/PriorityHolder.cs.meta rename to Assets/SEE/UI/PopupMenus/PriorityHolder.cs.meta diff --git a/Assets/SEE/UI/PropertyDialog/BasePropertyDialog.cs b/Assets/SEE/UI/PropertyDialog/BasePropertyDialog.cs index 14c97e11bc..f3489140db 100644 --- a/Assets/SEE/UI/PropertyDialog/BasePropertyDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/BasePropertyDialog.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEE/UI/PropertyDialog/BooleanProperty.cs b/Assets/SEE/UI/PropertyDialog/BooleanProperty.cs index 4ce838eac3..b8ac2623bc 100644 --- a/Assets/SEE/UI/PropertyDialog/BooleanProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/BooleanProperty.cs @@ -1,5 +1,5 @@ using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/PropertyDialog/ButtonProperty.cs b/Assets/SEE/UI/PropertyDialog/ButtonProperty.cs index 14801b35f0..b17aa2a65d 100644 --- a/Assets/SEE/UI/PropertyDialog/ButtonProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/ButtonProperty.cs @@ -1,6 +1,6 @@ using Michsky.UI.ModernUIPack; -using SEE.Controls.Actions; -using SEE.GO; +using SEE.Controls.ReversibleActions; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/PropertyDialog/CitySelection/CitySelectionProperty.cs b/Assets/SEE/UI/PropertyDialog/CitySelection/CitySelectionProperty.cs index f02062c8cf..720d39099a 100644 --- a/Assets/SEE/UI/PropertyDialog/CitySelection/CitySelectionProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/CitySelection/CitySelectionProperty.cs @@ -1,10 +1,10 @@ -using SEE.Controls; -using SEE.Game; +using SEE.Game; using SEE.Game.City; -using SEE.GameObjects; +using SEE.Cities; using SEE.Utils; using System; using UnityEngine; +using SEE.Controls.KeyActions; namespace SEE.UI.PropertyDialog.CitySelection { diff --git a/Assets/SEE/UI/PropertyDialog/CitySelection/LoadReflexionDataProperty.cs b/Assets/SEE/UI/PropertyDialog/CitySelection/LoadReflexionDataProperty.cs index b81f860574..322c3de258 100644 --- a/Assets/SEE/UI/PropertyDialog/CitySelection/LoadReflexionDataProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/CitySelection/LoadReflexionDataProperty.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.Game.City; using SEE.Utils; using SEE.Utils.Paths; diff --git a/Assets/SEE/UI/PropertyDialog/DesktopPropertyDialog.cs b/Assets/SEE/UI/PropertyDialog/DesktopPropertyDialog.cs index f88d222b72..dc365a96df 100644 --- a/Assets/SEE/UI/PropertyDialog/DesktopPropertyDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/DesktopPropertyDialog.cs @@ -1,5 +1,6 @@ using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; +using SEE.UserSettings; using SEE.Utils; using System; using System.Linq; @@ -54,7 +55,7 @@ protected override void StartDesktop() try { dialog = PrefabInstantiator.InstantiatePrefab(dialogPrefab, Canvas.transform, false); - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { dialog.transform.Find("Background").gameObject.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); } diff --git a/Assets/SEE/UI/PropertyDialog/Drawable/WebImageDialog.cs b/Assets/SEE/UI/PropertyDialog/Drawable/WebImageDialog.cs index c5a3371b1d..c6c07b434e 100644 --- a/Assets/SEE/UI/PropertyDialog/Drawable/WebImageDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/Drawable/WebImageDialog.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using UnityEngine; namespace SEE.UI.PropertyDialog.Drawable diff --git a/Assets/SEE/UI/PropertyDialog/Drawable/WriteEditTextDialog.cs b/Assets/SEE/UI/PropertyDialog/Drawable/WriteEditTextDialog.cs index 40457ed6bd..6926f0b6f6 100644 --- a/Assets/SEE/UI/PropertyDialog/Drawable/WriteEditTextDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/Drawable/WriteEditTextDialog.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using UnityEngine; using UnityEngine.Events; diff --git a/Assets/SEE/UI/PropertyDialog/FilePathProperty.cs b/Assets/SEE/UI/PropertyDialog/FilePathProperty.cs index f0314b4674..390a356dfc 100644 --- a/Assets/SEE/UI/PropertyDialog/FilePathProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/FilePathProperty.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using SimpleFileBrowser; using TMPro; diff --git a/Assets/SEE/UI/PropertyDialog/HidePropertyDialog.cs b/Assets/SEE/UI/PropertyDialog/HidePropertyDialog.cs index c0c092d3ad..e81621fffc 100644 --- a/Assets/SEE/UI/PropertyDialog/HidePropertyDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/HidePropertyDialog.cs @@ -1,9 +1,10 @@ -using SEE.Controls; -using UnityEngine; +using UnityEngine; using UnityEngine.Events; -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; using SEE.UI.StateIndicator; using SEE.Utils; +using SEE.Extensions; +using SEE.Controls.KeyActions; namespace SEE.UI.PropertyDialog { diff --git a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddBoardDialog.cs b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddBoardDialog.cs index f588d4dfa5..95b6b3ac06 100644 --- a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddBoardDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddBoardDialog.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using UnityEngine; namespace SEE.UI.PropertyDialog.HolisticMetrics diff --git a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddWidgetDialog.cs b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddWidgetDialog.cs index 9ec0a67cf8..313d7e71af 100644 --- a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddWidgetDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/AddWidgetDialog.cs @@ -1,6 +1,6 @@ using System; using System.Linq; -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.Game.HolisticMetrics.Metrics; using UnityEngine; diff --git a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/LoadBoardDialog.cs b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/LoadBoardDialog.cs index bc7ae0d435..3a20ad2d76 100644 --- a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/LoadBoardDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/LoadBoardDialog.cs @@ -1,8 +1,8 @@ -using SEE.Controls; using SEE.Game.HolisticMetrics; using UnityEngine; using SEE.Utils; using SEE.UI.Notification; +using SEE.Controls.KeyActions; namespace SEE.UI.PropertyDialog.HolisticMetrics { diff --git a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/SaveBoardDialog.cs b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/SaveBoardDialog.cs index df437942e6..32d3d413f7 100644 --- a/Assets/SEE/UI/PropertyDialog/HolisticMetrics/SaveBoardDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/HolisticMetrics/SaveBoardDialog.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.Game.HolisticMetrics; using SEE.UI.Notification; using UnityEngine; diff --git a/Assets/SEE/UI/PropertyDialog/NodePropertyDialog.cs b/Assets/SEE/UI/PropertyDialog/NodePropertyDialog.cs index c042f0ce2a..a5e66c0063 100644 --- a/Assets/SEE/UI/PropertyDialog/NodePropertyDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/NodePropertyDialog.cs @@ -1,15 +1,15 @@ -using SEE.Controls; -using SEE.Controls.Actions; -/// Reference in comment. +using SEE.Controls.ReversibleActions; using SEE.DataModel.DG; -using SEE.Game.SceneManipulation; -using SEE.GO; +/// Reference in comment. +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.Net.Actions.GraphElement; using SEE.Utils; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Events; +using SEE.Controls.KeyActions; namespace SEE.UI.PropertyDialog { diff --git a/Assets/SEE/UI/PropertyDialog/PropertyDialog.cs b/Assets/SEE/UI/PropertyDialog/PropertyDialog.cs index d3ca8ffe16..58fbec68f0 100644 --- a/Assets/SEE/UI/PropertyDialog/PropertyDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/PropertyDialog.cs @@ -1,10 +1,9 @@ -using SEE.GO; -using System; +using System; using System.Collections.Generic; using System.Linq; -using SEE.Utils; using UnityEngine; using UnityEngine.Events; +using SEE.UserSettings; namespace SEE.UI.PropertyDialog { diff --git a/Assets/SEE/UI/PropertyDialog/RuntimeMenuAddDictEntryProperty.cs b/Assets/SEE/UI/PropertyDialog/RuntimeMenuAddDictEntryProperty.cs index 5d84a7048b..a549e4177e 100644 --- a/Assets/SEE/UI/PropertyDialog/RuntimeMenuAddDictEntryProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/RuntimeMenuAddDictEntryProperty.cs @@ -1,4 +1,4 @@ -using SEE.Controls; +using SEE.Controls.KeyActions; using SEE.DataModel.DG; using SEE.Utils; using System.Collections; diff --git a/Assets/SEE/UI/PropertyDialog/StringProperty.cs b/Assets/SEE/UI/PropertyDialog/StringProperty.cs index 904c276cfb..894775ddf6 100644 --- a/Assets/SEE/UI/PropertyDialog/StringProperty.cs +++ b/Assets/SEE/UI/PropertyDialog/StringProperty.cs @@ -1,5 +1,5 @@ using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using System; using TMPro; diff --git a/Assets/SEE/UI/PropertyDialog/TelemetryPropertyDialog.cs b/Assets/SEE/UI/PropertyDialog/TelemetryPropertyDialog.cs index 534f82298e..b3f9e44829 100644 --- a/Assets/SEE/UI/PropertyDialog/TelemetryPropertyDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/TelemetryPropertyDialog.cs @@ -1,10 +1,11 @@ using System; -using SEE.Controls; using SEE.UI.Notification; using SEE.Utils; using UnityEngine; using UnityEngine.UI; using SEE.Tools.OpenTelemetry; +using SEE.UserSettings; +using SEE.Controls.KeyActions; namespace SEE.UI.PropertyDialog { @@ -90,7 +91,7 @@ public void Open() urlField = dialog.AddComponent(); urlField.Name = "URL"; urlField.Description = "Used when telemetry mode is set to 'Remote'."; - urlField.Value = User.UserSettings.Instance?.Telemetry.ServerURL ?? defaultRemoteURL; + urlField.Value = UserSetting.Instance?.Telemetry.ServerURL ?? defaultRemoteURL; group.AddProperty(urlField); propertyDialog = dialog.AddComponent(); @@ -121,7 +122,7 @@ public void Open() /// private string GetInitialSelectionName() { - return User.UserSettings.Instance?.Telemetry.Mode.ToString(); + return UserSetting.Instance?.Telemetry.Mode.ToString(); } /// @@ -134,18 +135,18 @@ private void ConfirmPressed() { if (Enum.TryParse(telemetryModeSelection.Value, out TelemetryMode selectedMode)) { - User.UserSettings.Instance.Telemetry.Mode = selectedMode; + UserSetting.Instance.Telemetry.Mode = selectedMode; } else { ShowNotification.Error("Invalid Selection", "The selected telemetry mode is not recognized."); return; } - if (User.UserSettings.Instance?.Telemetry.Mode == TelemetryMode.Remote) + if (UserSetting.Instance?.Telemetry.Mode == TelemetryMode.Remote) { if (!string.IsNullOrWhiteSpace(urlField.Value)) { - User.UserSettings.Instance.Telemetry.ServerURL = urlField.Value.Trim(); + UserSetting.Instance.Telemetry.ServerURL = urlField.Value.Trim(); } else { @@ -153,7 +154,7 @@ private void ConfirmPressed() return; } } - User.UserSettings.Instance?.Save(); + UserSetting.Instance?.Save(); Close(); callback?.Invoke(); SEEInput.KeyboardShortcutsEnabled = true; diff --git a/Assets/SEE/UI/PropertyDialog/UserSettingsDialog.cs b/Assets/SEE/UI/PropertyDialog/UserSettingsDialog.cs index 804682f3e9..2d98b1d621 100644 --- a/Assets/SEE/UI/PropertyDialog/UserSettingsDialog.cs +++ b/Assets/SEE/UI/PropertyDialog/UserSettingsDialog.cs @@ -1,5 +1,4 @@ -using SEE.Controls; -using SEE.UI.Notification; +using SEE.UI.Notification; using System; using System.Collections.Generic; using System.Linq; @@ -8,6 +7,8 @@ using UnityEngine; using UnityEngine.Events; using SEE.Game.Worlds; +using SEE.UserSettings; +using SEE.Controls.KeyActions; namespace SEE.UI.PropertyDialog { @@ -104,6 +105,7 @@ public UserSettingsDialog(Net.Network networkConfig, Action callBack = null) /// public void Open() { + UserSetting.Instance.Load(); dialog = new GameObject("User settings"); // Group for network properties (one group for all). @@ -133,7 +135,7 @@ public void Open() { playerName = dialog.AddComponent(); playerName.Name = "User name"; - playerName.Value = User.UserSettings.Instance.Player.PlayerName.ToString(); + playerName.Value = UserSetting.Instance.Player.PlayerName.ToString(); playerName.Description = "Name of the player to be shown to others"; group.AddProperty(playerName); } @@ -142,7 +144,7 @@ public void Open() avatarSelector.Name = "Avatar"; avatarSelector.Description = "Select an avatar"; avatarSelector.AddOptions(PlayerSpawner.Prefabs); - avatarSelector.Value = PlayerSpawner.Prefabs[(int)User.UserSettings.Instance.Player.AvatarIndex % PlayerSpawner.Prefabs.Count]; + avatarSelector.Value = PlayerSpawner.Prefabs[(int)UserSetting.Instance.Player.AvatarIndex % PlayerSpawner.Prefabs.Count]; group.AddProperty(avatarSelector); } { @@ -150,7 +152,7 @@ public void Open() voiceChatSelector.Name = "Voice Chat"; voiceChatSelector.Description = "Select a voice chat system"; voiceChatSelector.AddOptions(VoiceChatSystemsToStrings()); - voiceChatSelector.Value = User.UserSettings.Instance.VoiceChat.ToString(); + voiceChatSelector.Value = UserSetting.Instance.VoiceChat.ToString(); group.AddProperty(voiceChatSelector); } { @@ -187,7 +189,7 @@ public void Open() /// Enum values of as a list of strings. private static IList VoiceChatSystemsToStrings() { - return Enum.GetNames(typeof(User.VoiceChatSystems)).ToList(); + return Enum.GetNames(typeof(VoiceChatSystems)).ToList(); } /// @@ -242,7 +244,7 @@ private void OKButtonPressed() string playerNameValue = playerName.Value.Trim(); if (!string.IsNullOrWhiteSpace(playerNameValue)) { - User.UserSettings.Instance.Player.PlayerName = playerNameValue; + UserSetting.Instance.Player.PlayerName = playerNameValue; } else { @@ -253,7 +255,7 @@ private void OKButtonPressed() { // Avatar string value = avatarSelector.Value.Trim(); - User.UserSettings.Instance.Player.AvatarIndex = (uint)PlayerSpawner.Prefabs.IndexOf(value); + UserSetting.Instance.Player.AvatarIndex = (uint)PlayerSpawner.Prefabs.IndexOf(value); } { // Room Password @@ -283,9 +285,9 @@ private void OKButtonPressed() { // Voice Chat string value = voiceChatSelector.Value.Trim(); - if (Enum.TryParse(value, out User.VoiceChatSystems voiceChat)) + if (Enum.TryParse(value, out VoiceChatSystems voiceChat)) { - User.UserSettings.Instance.VoiceChat = voiceChat; + UserSetting.Instance.VoiceChat = voiceChat; } else { @@ -297,7 +299,7 @@ private void OKButtonPressed() if (!errorOccurred) { propertyDialog.Close(); - User.UserSettings.Instance.Save(); + UserSetting.Instance.Save(); OnConfirm.Invoke(); SEEInput.KeyboardShortcutsEnabled = true; Close(); diff --git a/Assets/SEE/UI/RuntimeConfigMenu/ContentSizeWatcher.cs b/Assets/SEE/UI/RuntimeConfigMenu/ContentSizeWatcher.cs index 7ec37fcd3f..bb467d89b1 100644 --- a/Assets/SEE/UI/RuntimeConfigMenu/ContentSizeWatcher.cs +++ b/Assets/SEE/UI/RuntimeConfigMenu/ContentSizeWatcher.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using SEE.GO; +using SEE.Extensions; using UnityEngine; using UnityEngine.UI; diff --git a/Assets/SEE/UI/RuntimeConfigMenu/RuntimeConfigMenu.cs b/Assets/SEE/UI/RuntimeConfigMenu/RuntimeConfigMenu.cs index 4d66c92b44..8d54edc064 100644 --- a/Assets/SEE/UI/RuntimeConfigMenu/RuntimeConfigMenu.cs +++ b/Assets/SEE/UI/RuntimeConfigMenu/RuntimeConfigMenu.cs @@ -1,13 +1,13 @@ using Cysharp.Threading.Tasks; using MoreLinq; -using SEE.Controls; using SEE.Game; using SEE.Game.City; -using SEE.GameObjects; +using SEE.Cities; using SEE.Utils; using System; using System.Linq; using UnityEngine; +using SEE.Controls.KeyActions; namespace SEE.UI.RuntimeConfigMenu { @@ -17,6 +17,7 @@ namespace SEE.UI.RuntimeConfigMenu /// /// Instantiates the s for each table and handles switching between the tables. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class RuntimeConfigMenu : MonoBehaviour { /// diff --git a/Assets/SEE/UI/RuntimeConfigMenu/RuntimeTabMenu.cs b/Assets/SEE/UI/RuntimeConfigMenu/RuntimeTabMenu.cs index c3a701dbdf..254f8a3dd6 100644 --- a/Assets/SEE/UI/RuntimeConfigMenu/RuntimeTabMenu.cs +++ b/Assets/SEE/UI/RuntimeConfigMenu/RuntimeTabMenu.cs @@ -2,12 +2,11 @@ using HSVPicker; using Michsky.UI.ModernUIPack; using MoreLinq; -using SEE.Controls; using SEE.DataModel.DG; using SEE.Game; using SEE.Game.City; -using SEE.Game.SceneManipulation; -using SEE.GO; +using SEE.SceneManipulation; +using SEE.Extensions; using SEE.GraphProviders; using SEE.Net.Actions.RuntimeConfig; using SEE.UI.Menu; @@ -27,6 +26,7 @@ using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; +using SEE.Controls.KeyActions; namespace SEE.UI.RuntimeConfigMenu { @@ -974,7 +974,7 @@ private void CreateSetting case CSVGraphProvider: case DashboardGraphProvider: case GXLSingleGraphProvider: - case JaCoCoGraphProvider: + case ReportGraphProvider: case ReflexionGraphProvider: parent = CreateNestedSetting(settingName, parent, removable); createdObj = parent.transform.parent.gameObject; diff --git a/Assets/SEE/UI/SettingsMenu.cs b/Assets/SEE/UI/SettingsMenu.cs index bd6b463aaf..9a890d9be1 100644 --- a/Assets/SEE/UI/SettingsMenu.cs +++ b/Assets/SEE/UI/SettingsMenu.cs @@ -5,17 +5,16 @@ using Cysharp.Threading.Tasks; using Michsky.UI.ModernUIPack; using SEE.Audio; -using SEE.Controls; using SEE.Controls.KeyActions; using SEE.Game; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions; using SEE.Tools.LiveKit; using SEE.UI.Menu; using SEE.UI.Notification; -using SEE.User; +using SEE.UserSettings; using SEE.Utils; -using SEE.Utils.Extensions; +using SEE.UI.Extensions; using TMPro; using UnityEditor; using UnityEngine; @@ -26,6 +25,7 @@ namespace SEE.UI /// /// Handles the user interactions with the settings menu. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class SettingsMenu : PlatformDependentComponent { /// @@ -276,7 +276,7 @@ private void InitializeVideoSettings() /// /// Initializes the LiveKit settings UI in the SettingsMenu. - /// This includes binding input fields to , + /// This includes binding input fields to , /// setting up connect/disconnect/share buttons, and disabling keyboard shortcuts /// while typing in the fields. /// @@ -311,27 +311,27 @@ private void InitializeLiveKitSettings() // Bind input fields to depending attributes liveKitURLInputField.onEndEdit.AddListener(input => { - UserSettings.Instance.Video.LiveKitUrl = input; - UserSettings.Instance.Save(); + UserSetting.Instance.Video.LiveKitUrl = input; + UserSetting.Instance.Save(); }); tokenURLInputField.onEndEdit.AddListener(input => { - UserSettings.Instance.Video.TokenUrl = input; - UserSettings.Instance.Save(); + UserSetting.Instance.Video.TokenUrl = input; + UserSetting.Instance.Save(); }); roomNameInputField.onEndEdit.AddListener(input => { - UserSettings.Instance.Video.RoomName = input; - UserSettings.Instance.Save(); + UserSetting.Instance.Video.RoomName = input; + UserSetting.Instance.Save(); }); share.clickEvent.AddListener(() => { - new LiveKitSettingsNetAction(UserSettings.Instance.Video.LiveKitUrl, - UserSettings.Instance.Video.TokenUrl, - UserSettings.Instance.Video.RoomName).Execute(); + new LiveKitSettingsNetAction(UserSetting.Instance.Video.LiveKitUrl, + UserSetting.Instance.Video.TokenUrl, + UserSetting.Instance.Video.RoomName).Execute(); }); connect.clickEvent.AddListener(() => @@ -392,15 +392,15 @@ static void DisableShortcutsWhileTyping(TMP_InputField inputField) /// /// Updates the UI input fields with the current LiveKit configuration - /// retrieved from the . + /// retrieved from the . /// public void UpdateLiveKitSettings() { if (liveKitURLInputField != null && tokenURLInputField != null && roomNameInputField != null) { - liveKitURLInputField.text = UserSettings.Instance.Video.LiveKitUrl; - tokenURLInputField.text = UserSettings.Instance.Video.TokenUrl; - roomNameInputField.text = UserSettings.Instance.Video.RoomName; + liveKitURLInputField.text = UserSetting.Instance.Video.LiveKitUrl; + tokenURLInputField.text = UserSetting.Instance.Video.TokenUrl; + roomNameInputField.text = UserSetting.Instance.Video.RoomName; } } diff --git a/Assets/SEE/UI/StateIndicator/AbstractStateIndicator.cs b/Assets/SEE/UI/StateIndicator/AbstractStateIndicator.cs index 81704e0cb3..8f7e154190 100644 --- a/Assets/SEE/UI/StateIndicator/AbstractStateIndicator.cs +++ b/Assets/SEE/UI/StateIndicator/AbstractStateIndicator.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/StateIndicator/ActionStateIndicator.cs b/Assets/SEE/UI/StateIndicator/ActionStateIndicator.cs index 9a75b0b700..9acb18ed7f 100644 --- a/Assets/SEE/UI/StateIndicator/ActionStateIndicator.cs +++ b/Assets/SEE/UI/StateIndicator/ActionStateIndicator.cs @@ -1,5 +1,5 @@ -using SEE.Controls.Actions; -using SEE.Utils; +using SEE.Controls.ReversibleActions; +using SEE.Extensions; namespace SEE.UI.StateIndicator { diff --git a/Assets/SEE/UI/StateIndicator/HideStateIndicator.cs b/Assets/SEE/UI/StateIndicator/HideStateIndicator.cs index f64453a4eb..a7020e44dd 100644 --- a/Assets/SEE/UI/StateIndicator/HideStateIndicator.cs +++ b/Assets/SEE/UI/StateIndicator/HideStateIndicator.cs @@ -1,10 +1,10 @@ -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; using Michsky.UI.ModernUIPack; namespace SEE.UI.StateIndicator diff --git a/Assets/SEE/UI/Tooltip.cs b/Assets/SEE/UI/Tooltip.cs index c871769c9e..96070531b9 100644 --- a/Assets/SEE/UI/Tooltip.cs +++ b/Assets/SEE/UI/Tooltip.cs @@ -2,7 +2,7 @@ using System.Linq; using DG.Tweening; using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; diff --git a/Assets/SEE/UI/UIOverlay.cs b/Assets/SEE/UI/UIOverlay.cs index b457779c65..194a7be9e3 100644 --- a/Assets/SEE/UI/UIOverlay.cs +++ b/Assets/SEE/UI/UIOverlay.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; @@ -10,6 +10,7 @@ namespace SEE.UI /// for any system or component. Designed to remain visible independently of other /// UI elements, providing real-time feedback to the user. /// + /// This component is attached to a player via DesktopPlayer.prefab./> public class UIOverlay : PlatformDependentComponent { /// diff --git a/Assets/SEE/UI/Window/BaseWindow.cs b/Assets/SEE/UI/Window/BaseWindow.cs index 49bca7148b..184f930be6 100644 --- a/Assets/SEE/UI/Window/BaseWindow.cs +++ b/Assets/SEE/UI/Window/BaseWindow.cs @@ -1,10 +1,10 @@ using System; -using SEE.Game; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using TMPro; using UnityEngine; using UnityEngine.UI; +using SEE.GraphElementRefs; namespace SEE.UI.Window { diff --git a/Assets/SEE/UI/Window/CodeWindow/CodeWindow.cs b/Assets/SEE/UI/Window/CodeWindow/CodeWindow.cs index d434a6c9a3..1030a7cf76 100644 --- a/Assets/SEE/UI/Window/CodeWindow/CodeWindow.cs +++ b/Assets/SEE/UI/Window/CodeWindow/CodeWindow.cs @@ -4,7 +4,7 @@ using DG.Tweening; using MoreLinq; using SEE.Tools.LSP; -using SEE.Utils; +using SEE.Extensions; using TMPro; using UnityEngine; using UnityEngine.Events; diff --git a/Assets/SEE/UI/Window/CodeWindow/CodeWindowContextMenu.cs b/Assets/SEE/UI/Window/CodeWindow/CodeWindowContextMenu.cs index c48e49a9ce..da51148f2e 100644 --- a/Assets/SEE/UI/Window/CodeWindow/CodeWindowContextMenu.cs +++ b/Assets/SEE/UI/Window/CodeWindow/CodeWindowContextMenu.cs @@ -4,12 +4,12 @@ using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks.Linq; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -using SEE.Controls; -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; +using SEE.Controls.Players; using SEE.Tools.LSP; using SEE.UI.Menu; using SEE.UI.Notification; -using SEE.UI.PopupMenu; +using SEE.UI.PopupMenus; using SEE.Utils; using UnityEngine; using UnityEngine.Assertions; @@ -34,7 +34,7 @@ public partial class CodeWindow /// The context menu that this class manages. /// A callback that opens the given URI and range in a new code window /// or scrolls to the range if the URI is the same as the current file. - private record ContextMenuHandler(string path, LSPHandler lspHandler, PopupMenu.PopupMenu contextMenu, + private record ContextMenuHandler(string path, LSPHandler lspHandler, PopupMenu contextMenu, SimpleListMenu simpleListMenu, Action OpenSelection) { /// @@ -44,7 +44,7 @@ private record ContextMenuHandler(string path, LSPHandler lspHandler, PopupMenu. /// The created context menu handler. public static ContextMenuHandler FromCodeWindow(CodeWindow codeWindow) { - PopupMenu.PopupMenu contextMenu = codeWindow.gameObject.AddComponent(); + PopupMenu contextMenu = codeWindow.gameObject.AddComponent(); SimpleListMenu simpleListMenu = codeWindow.gameObject.AddComponent(); return new ContextMenuHandler(codeWindow.FilePath, codeWindow.lspHandler, contextMenu, simpleListMenu, codeWindow.OpenSelection); @@ -300,7 +300,7 @@ private void OpenSelection(Uri uri, Range range) w => w.ScrolledVisibleLine = range.Start.Line); if (window != null) { - WindowSpace manager = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace manager = WindowSpaceManager.WindowSpaceOfLocalPlayer; if (!manager.Windows.Contains(window)) { manager.AddWindow(window); diff --git a/Assets/SEE/UI/Window/CodeWindow/CodeWindowInput.cs b/Assets/SEE/UI/Window/CodeWindow/CodeWindowInput.cs index cbab2fbddd..79a679b508 100644 --- a/Assets/SEE/UI/Window/CodeWindow/CodeWindowInput.cs +++ b/Assets/SEE/UI/Window/CodeWindow/CodeWindowInput.cs @@ -6,7 +6,7 @@ using SEE.DataModel.DG; using SEE.Game; using SEE.Game.City; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Notification; using SEE.Net.Dashboard; using SEE.Net.Dashboard.Model.Issues; diff --git a/Assets/SEE/UI/Window/CodeWindow/DesktopCodeWindow.cs b/Assets/SEE/UI/Window/CodeWindow/DesktopCodeWindow.cs index 5b73602359..44423aff54 100644 --- a/Assets/SEE/UI/Window/CodeWindow/DesktopCodeWindow.cs +++ b/Assets/SEE/UI/Window/CodeWindow/DesktopCodeWindow.cs @@ -3,7 +3,7 @@ using Cysharp.Threading.Tasks; using SEE.Game.City; using SEE.UI.Notification; -using SEE.GO; +using SEE.Extensions; using SEE.IDE; using SEE.Utils; using TMPro; @@ -13,11 +13,10 @@ using System.Collections.Generic; using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; using OmniSharp.Extensions.LanguageServer.Protocol.Models; -using SEE.Controls; using SEE.UI.DebugAdapterProtocol; using SEE.Utils.Markdown; using UnityEngine.Assertions; -using SEE.Net.Actions; +using SEE.Controls.Players; using SEE.Net.Actions.GraphElement; namespace SEE.UI.Window.CodeWindow @@ -180,7 +179,7 @@ private void SetupBreakpoints() protected override void UpdateDesktop() { - if (WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer].ActiveWindow == this) + if (WindowSpaceManager.WindowSpaceOfLocalPlayer.ActiveWindow == this) { // Right-click opens menu with LSP actions. if (Input.GetMouseButtonDown(1)) diff --git a/Assets/SEE/UI/Window/ConsoleWindow/ConsoleWindow.cs b/Assets/SEE/UI/Window/ConsoleWindow/ConsoleWindow.cs index 1d8271575e..aefb5edfd9 100644 --- a/Assets/SEE/UI/Window/ConsoleWindow/ConsoleWindow.cs +++ b/Assets/SEE/UI/Window/ConsoleWindow/ConsoleWindow.cs @@ -1,8 +1,8 @@ using Cysharp.Threading.Tasks; using Michsky.UI.ModernUIPack; -using SEE.Controls; -using SEE.GO; -using SEE.UI.PopupMenu; +using SEE.Controls.KeyActions; +using SEE.Extensions; +using SEE.UI.PopupMenus; using SEE.Utils; using System; using System.Collections.Generic; @@ -95,7 +95,7 @@ public class ConsoleWindow : BaseWindow /// /// The popup menu. /// - private PopupMenu.PopupMenu popupMenu; + private PopupMenu popupMenu; /// /// The button to open the search options. @@ -302,7 +302,7 @@ protected override void StartDesktop() searchField.onDeselect.AddListener(_ => SEEInput.KeyboardShortcutsEnabled = true); searchField.onValueChanged.AddListener(_ => UpdateFilters()); - popupMenu = gameObject.AddComponent(); + popupMenu = gameObject.AddComponent(); searchOptionsButton = root.Find("Search/SearchOptions").gameObject.MustGetComponent(); searchOptionsButton.clickEvent.AddListener(() => ShowSearchOptionsPopup()); diff --git a/Assets/SEE/UI/Window/DesktopWindowSpace.cs b/Assets/SEE/UI/Window/DesktopWindowSpace.cs index 20335ac845..9b4320468f 100644 --- a/Assets/SEE/UI/Window/DesktopWindowSpace.cs +++ b/Assets/SEE/UI/Window/DesktopWindowSpace.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using DynamicPanels; -using SEE.GO; +using SEE.Extensions; using SEE.Utils; using UnityEngine; using UnityEngine.XR.Interaction.Toolkit.UI; diff --git a/Assets/SEE/UI/Window/DrawableManagerWindow/DesktopDrawableManagerWindow.cs b/Assets/SEE/UI/Window/DrawableManagerWindow/DesktopDrawableManagerWindow.cs index 952633555b..b1810fa08b 100644 --- a/Assets/SEE/UI/Window/DrawableManagerWindow/DesktopDrawableManagerWindow.cs +++ b/Assets/SEE/UI/Window/DrawableManagerWindow/DesktopDrawableManagerWindow.cs @@ -1,12 +1,12 @@ using DG.Tweening; using HighlightPlus; using Michsky.UI.ModernUIPack; -using SEE.Controls; using SEE.Game; using SEE.Game.Drawable; using SEE.Game.Drawable.Configurations; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Actions.Drawable; +using SEE.UI.PopupMenus; using SEE.UI.Drawable; using SEE.UI.Menu.Drawable; using SEE.UI.PropertyDialog.Drawable; @@ -18,6 +18,7 @@ using UnityEngine.Events; using UnityEngine.UI; using Image = UnityEngine.UI.Image; +using SEE.Controls.KeyActions; namespace SEE.UI.Window.DrawableManagerWindow { @@ -99,7 +100,7 @@ protected override void StartDesktop() filterButton = root.Find("Search/Filter").gameObject.MustGetComponent(); sortButton = root.Find("Search/Sort").gameObject.MustGetComponent(); groupButton = root.Find("Search/Group").gameObject.MustGetComponent(); - PopupMenu.PopupMenu popupMenu = gameObject.AddComponent(); + PopupMenu popupMenu = gameObject.AddComponent(); UnityEvent> rebuild = new(); rebuild.AddListener(list => { Rebuild(list); }); contextMenu = new DrawableWindowContextMenu(popupMenu, rebuild, diff --git a/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableManagerWindow.cs b/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableManagerWindow.cs index e7bbce2a20..99252c3d6d 100644 --- a/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableManagerWindow.cs +++ b/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableManagerWindow.cs @@ -1,9 +1,8 @@ using Cysharp.Threading.Tasks; using SEE.DataModel; -using SEE.DataModel.Drawable; using SEE.Game; using SEE.Game.Drawable; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Menu.Drawable; using SEE.Utils; using System; diff --git a/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableWindowContextMenu.cs b/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableWindowContextMenu.cs index 1c14915d49..1e2d31d979 100644 --- a/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableWindowContextMenu.cs +++ b/Assets/SEE/UI/Window/DrawableManagerWindow/DrawableWindowContextMenu.cs @@ -1,5 +1,5 @@ using Michsky.UI.ModernUIPack; -using SEE.UI.PopupMenu; +using SEE.UI.PopupMenus; using System; using System.Collections.Generic; using UnityEngine; @@ -22,7 +22,7 @@ public class DrawableWindowContextMenu /// /// The context menu that this class manages. /// - private readonly PopupMenu.PopupMenu contextMenu; + private readonly PopupMenu contextMenu; /// /// The function to call to rebuild the tree window. @@ -67,7 +67,7 @@ public class DrawableWindowContextMenu /// The button that opens the filter menu. /// The button that opens the sort menu. /// The button that opens the group menu. - public DrawableWindowContextMenu(PopupMenu.PopupMenu contextMenu, + public DrawableWindowContextMenu(PopupMenu contextMenu, UnityEvent> rebuild, ButtonManagerBasic filterButton, ButtonManagerBasic sortButton, ButtonManagerBasic groupButton) { diff --git a/Assets/SEE/UI/Window/PropertyWindow/AuthorPropertyWindow.cs b/Assets/SEE/UI/Window/PropertyWindow/AuthorPropertyWindow.cs index 9009ba1f88..3ede8e0236 100644 --- a/Assets/SEE/UI/Window/PropertyWindow/AuthorPropertyWindow.cs +++ b/Assets/SEE/UI/Window/PropertyWindow/AuthorPropertyWindow.cs @@ -1,7 +1,7 @@ -using SEE.GameObjects.BranchCity; -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; using System.Linq; +using SEE.Components.GameNodes.BranchCity; namespace SEE.UI.Window.PropertyWindow { diff --git a/Assets/SEE/UI/Window/PropertyWindow/PropertyWindow.cs b/Assets/SEE/UI/Window/PropertyWindow/PropertyWindow.cs index 479a0d6b12..5a05d91ade 100644 --- a/Assets/SEE/UI/Window/PropertyWindow/PropertyWindow.cs +++ b/Assets/SEE/UI/Window/PropertyWindow/PropertyWindow.cs @@ -1,8 +1,9 @@ using DG.Tweening; using Michsky.UI.ModernUIPack; using MoreLinq; -using SEE.Controls; -using SEE.GO; +using SEE.Controls.KeyActions; +using SEE.Extensions; +using SEE.UI.PopupMenus; using SEE.Utils; using System; using System.Collections.Generic; @@ -337,7 +338,7 @@ public void CreateUIInstance() ButtonManagerBasic filterButton = propertyWindow.transform.Find("Search/Filter").gameObject.MustGetComponent(); ButtonManagerBasic sortButton = propertyWindow.transform.Find("Search/Sort").gameObject.MustGetComponent(); ButtonManagerBasic groupButton = propertyWindow.transform.Find("Search/Group").gameObject.MustGetComponent(); - PopupMenu.PopupMenu popupMenu = gameObject.AddComponent(); + PopupMenu popupMenu = gameObject.AddComponent(); UnityEvent rebuild = new(); rebuild.AddListener(Rebuild); contextMenu = new PropertyWindowContextMenu(popupMenu, rebuild, filterButton, sortButton, groupButton); diff --git a/Assets/SEE/UI/Window/PropertyWindow/PropertyWindowContextMenu.cs b/Assets/SEE/UI/Window/PropertyWindow/PropertyWindowContextMenu.cs index 517053385b..78f7c5bbbf 100644 --- a/Assets/SEE/UI/Window/PropertyWindow/PropertyWindowContextMenu.cs +++ b/Assets/SEE/UI/Window/PropertyWindow/PropertyWindowContextMenu.cs @@ -1,6 +1,6 @@ using Michsky.UI.ModernUIPack; -using SEE.GO; -using SEE.UI.PopupMenu; +using SEE.Extensions; +using SEE.UI.PopupMenus; using SEE.UI.Window.DrawableManagerWindow; using SEE.Utils; using SEE.XR; @@ -20,7 +20,7 @@ public class PropertyWindowContextMenu /// /// The context menu that this class manages. /// - private readonly PopupMenu.PopupMenu contextMenu; + private readonly PopupMenu contextMenu; /// /// The button that opens the filter menu. @@ -66,7 +66,7 @@ public class PropertyWindowContextMenu /// The button that opens the filter menu. /// The button that opens the sort menu. /// The button that opens the group menu. - public PropertyWindowContextMenu(PopupMenu.PopupMenu contextMenu, + public PropertyWindowContextMenu(PopupMenu contextMenu, UnityEvent rebuild, ButtonManagerBasic filterButton, ButtonManagerBasic sortButton, ButtonManagerBasic groupButton) { diff --git a/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindow.cs b/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindow.cs index 758d497825..aff5e3b80a 100644 --- a/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindow.cs +++ b/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindow.cs @@ -3,8 +3,8 @@ using System.Net.Http; using Cysharp.Threading.Tasks; using Michsky.UI.ModernUIPack; +using SEE.Extensions; using SEE.Game.City; -using SEE.GO; using SEE.Net.Util; using SEE.UI.Notification; using SEE.Utils; diff --git a/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindowItem.cs b/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindowItem.cs index 592d6a288d..5a7e615f94 100644 --- a/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindowItem.cs +++ b/Assets/SEE/UI/Window/SnapshotsWindow/SnapshotsWindowItem.cs @@ -2,7 +2,7 @@ using System.IO; using Cysharp.Threading.Tasks; using Michsky.UI.ModernUIPack; -using SEE.GO; +using SEE.Extensions; using SEE.Net.Util; using SEE.UI.Notification; using SEE.Utils; diff --git a/Assets/SEE/UI/Window/TreeWindow/DesktopTreeWindow.cs b/Assets/SEE/UI/Window/TreeWindow/DesktopTreeWindow.cs index 8835794038..fa9e016e1f 100644 --- a/Assets/SEE/UI/Window/TreeWindow/DesktopTreeWindow.cs +++ b/Assets/SEE/UI/Window/TreeWindow/DesktopTreeWindow.cs @@ -1,13 +1,11 @@ using Cysharp.Threading.Tasks; using DG.Tweening; using Michsky.UI.ModernUIPack; -using SEE.Controls; -using SEE.Controls.Actions; using SEE.DataModel.DG; -using SEE.Game; -using SEE.GO; +using SEE.Extensions; using SEE.UI.Notification; -using SEE.UI.PopupMenu; +using SEE.UI.PopupMenus; +using SEE.UserSettings; using SEE.Utils; using SEE.XR; using System; @@ -20,6 +18,8 @@ using ArgumentException = System.ArgumentException; using Edge = SEE.DataModel.DG.Edge; using Node = SEE.DataModel.DG.Node; +using SEE.GraphElementRefs; +using SEE.Controls.KeyActions; namespace SEE.UI.Window.TreeWindow { @@ -393,7 +393,7 @@ void RegisterClickHandler() { if (item.TryGetComponentOrLog(out PointerHelper pointerHelper)) { - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { pointerHelper.EnterEvent.AddListener(_ => { @@ -463,7 +463,7 @@ IEnumerable CreateContextMenuActions(TreeWindowContextMenu conte }, Icons.Hide) }; - IEnumerable actions = ContextMenuAction + IEnumerable actions = ContextMenu .GetOptionsForTreeView(contextMenu.ContextMenu, position, representedGraphElement, representedGameObject, appends); return actions.Concat(appends); @@ -739,7 +739,7 @@ private void SearchFor(string searchTerm) expandItem: (_, _) => RevealElementAsync(node).Forget()); } - if (User.UserSettings.IsDesktop) + if (UserSetting.IsDesktop) { items.position = items.position.WithXYZ(y: 0); } @@ -901,7 +901,7 @@ protected override void StartDesktop() groupButton.clickEvent.AddListener(() => { XRSEEActions.OnSelectToggle = true; }); - PopupMenu.PopupMenu popupMenu = gameObject.AddComponent(); + PopupMenu popupMenu = gameObject.AddComponent(); contextMenu = new TreeWindowContextMenu(popupMenu, searcher, grouper, Rebuild, filterButton, sortButton, groupButton); diff --git a/Assets/SEE/UI/Window/TreeWindow/TreeWindow.cs b/Assets/SEE/UI/Window/TreeWindow/TreeWindow.cs index f73b531e51..6226810f70 100644 --- a/Assets/SEE/UI/Window/TreeWindow/TreeWindow.cs +++ b/Assets/SEE/UI/Window/TreeWindow/TreeWindow.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Cysharp.Threading.Tasks; -using SEE.Controls; +using SEE.Controls.Players; using SEE.DataModel; using SEE.DataModel.DG; using SEE.DataModel.DG.GraphSearch; @@ -44,7 +44,7 @@ public partial class TreeWindow : BaseWindow, IObserver /// public bool MainWindow = true; - private GraphSearch searcher; + private NodeSearch searcher; /// /// Transform of the object containing the items of the tree window. @@ -69,7 +69,7 @@ public partial class TreeWindow : BaseWindow, IObserver protected override void Start() { - searcher = new GraphSearch(Graph); + searcher = new NodeSearch(Graph); grouper = new TreeWindowGrouper(searcher.Filter, Graph); subscription = Graph.Subscribe(this); base.Start(); @@ -192,7 +192,7 @@ public void OnNext(ChangeEvent value) case NodeEvent nodeEvent: if (nodeEvent.Node.IsRoot() && nodeEvent.Change == ChangeType.Removal) { - WindowSpace winSpace = WindowSpaceManager.ManagerInstance[WindowSpaceManager.LocalPlayer]; + WindowSpace winSpace = WindowSpaceManager.WindowSpaceOfLocalPlayer; winSpace.CloseWindow(this); } else diff --git a/Assets/SEE/UI/Window/TreeWindow/TreeWindowContextMenu.cs b/Assets/SEE/UI/Window/TreeWindow/TreeWindowContextMenu.cs index 4816409cad..ba0b8e7c31 100644 --- a/Assets/SEE/UI/Window/TreeWindow/TreeWindowContextMenu.cs +++ b/Assets/SEE/UI/Window/TreeWindow/TreeWindowContextMenu.cs @@ -6,8 +6,9 @@ using SEE.DataModel.DG.GraphSearch; using SEE.Game.City; using SEE.Tools.ReflexionAnalysis; -using SEE.UI.PopupMenu; +using SEE.UI.PopupMenus; using SEE.Utils; +using SEE.Extensions; using UnityEngine; using ArgumentOutOfRangeException = System.ArgumentOutOfRangeException; using State = SEE.Tools.ReflexionAnalysis.State; @@ -22,13 +23,13 @@ public class TreeWindowContextMenu /// /// The context menu that this class manages. /// - public readonly PopupMenu.PopupMenu ContextMenu; + public readonly PopupMenu ContextMenu; /// /// The graph search associated with the tree window. /// We also retrieve the graph from this. /// - private readonly GraphSearch searcher; + private readonly NodeSearch searcher; /// /// The grouper that is used to group the elements in the tree window. @@ -65,7 +66,7 @@ public class TreeWindowContextMenu /// The button that opens the filter menu. /// The button that opens the sort menu. /// The button that opens the group menu. - public TreeWindowContextMenu(PopupMenu.PopupMenu contextMenu, GraphSearch searcher, TreeWindowGrouper grouper, + public TreeWindowContextMenu(PopupMenu contextMenu, NodeSearch searcher, TreeWindowGrouper grouper, Action rebuild, ButtonManagerBasic filterButton, ButtonManagerBasic sortButton, ButtonManagerBasic groupButton) { @@ -86,7 +87,7 @@ public TreeWindowContextMenu(PopupMenu.PopupMenu contextMenu, GraphSearch search } /// - /// Forwards to . + /// Forwards to . /// public void ShowWith(IEnumerable entries, Vector2 position) => ContextMenu.ShowWith(entries, position); diff --git a/Assets/SEE/UI/Window/VariablesWindow/VariablesWindow.cs b/Assets/SEE/UI/Window/VariablesWindow/VariablesWindow.cs index 3c50122b8e..a1d2cf0f42 100644 --- a/Assets/SEE/UI/Window/VariablesWindow/VariablesWindow.cs +++ b/Assets/SEE/UI/Window/VariablesWindow/VariablesWindow.cs @@ -1,5 +1,6 @@ using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; using SEE.Utils; +using SEE.Extensions; using System; using System.Collections.Generic; using UnityEngine; diff --git a/Assets/SEE/UI/Window/VariablesWindow/VariablesWindowItem.cs b/Assets/SEE/UI/Window/VariablesWindow/VariablesWindowItem.cs index 62b77485fa..31d9949273 100644 --- a/Assets/SEE/UI/Window/VariablesWindow/VariablesWindowItem.cs +++ b/Assets/SEE/UI/Window/VariablesWindow/VariablesWindowItem.cs @@ -3,7 +3,7 @@ using DG.Tweening; using System.Collections.Generic; using TMPro; -using SEE.GO; +using SEE.Extensions; using Michsky.UI.ModernUIPack; using System.Linq; using System; diff --git a/Assets/SEE/UserSettings/Audio.cs b/Assets/SEE/UserSettings/Audio.cs index 6262b4be89..dee1d97541 100644 --- a/Assets/SEE/UserSettings/Audio.cs +++ b/Assets/SEE/UserSettings/Audio.cs @@ -2,7 +2,7 @@ using SEE.Utils.Config; using System.Collections.Generic; -namespace SEE.User +namespace SEE.UserSettings { /// /// Represents the audio settings for the SEE application. These are attributes diff --git a/Assets/SEE/UserSettings/Player.cs b/Assets/SEE/UserSettings/Player.cs index b3e969aa89..5eda64edfd 100644 --- a/Assets/SEE/UserSettings/Player.cs +++ b/Assets/SEE/UserSettings/Player.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; -namespace SEE.User +namespace SEE.UserSettings { /// /// Represents a local player in the SEE environment (player name and avatar). diff --git a/Assets/SEE/GameObjects/PlayerInputType.cs b/Assets/SEE/UserSettings/PlayerInputType.cs similarity index 93% rename from Assets/SEE/GameObjects/PlayerInputType.cs rename to Assets/SEE/UserSettings/PlayerInputType.cs index 90dc4691c7..773b52bfd0 100644 --- a/Assets/SEE/GameObjects/PlayerInputType.cs +++ b/Assets/SEE/UserSettings/PlayerInputType.cs @@ -1,4 +1,4 @@ -namespace SEE.GO +namespace SEE.UserSettings { /// /// What kind of input devices the player uses. diff --git a/Assets/SEE/GameObjects/PlayerInputType.cs.meta b/Assets/SEE/UserSettings/PlayerInputType.cs.meta similarity index 100% rename from Assets/SEE/GameObjects/PlayerInputType.cs.meta rename to Assets/SEE/UserSettings/PlayerInputType.cs.meta diff --git a/Assets/SEE/UserSettings/Telemetry.cs b/Assets/SEE/UserSettings/Telemetry.cs index 87a75d3042..86af3ef31a 100644 --- a/Assets/SEE/UserSettings/Telemetry.cs +++ b/Assets/SEE/UserSettings/Telemetry.cs @@ -1,10 +1,9 @@ using SEE.Tools.OpenTelemetry; using SEE.Utils.Config; -using Sirenix.OdinInspector; using System.Collections.Generic; using UnityEngine; -namespace SEE.User +namespace SEE.UserSettings { /// /// Represents the telemetry configuration for the application, including the mode of operation and the server diff --git a/Assets/SEE/UserSettings/UserSetting.cs b/Assets/SEE/UserSettings/UserSetting.cs new file mode 100644 index 0000000000..4504e8860a --- /dev/null +++ b/Assets/SEE/UserSettings/UserSetting.cs @@ -0,0 +1,385 @@ +using DG.Tweening; +using SEE.Net; +using SEE.Tools.OpenTelemetry; +using SEE.Utils.Config; +using SEE.Utils.Paths; +using Sirenix.OdinInspector; +using Sirenix.Serialization; +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using UnityEngine; +using UnityEngine.Assertions; +using UnityEngine.SceneManagement; + +namespace SEE.UserSettings +{ + /// + /// Represents the user settings for the SEE application. These are attributes + /// that are generally set by the user at the start of the application. + /// + /// This component is assumed to be attached to a game object in the + /// start scene. The user can select the environment in the Unity editor. + /// The selection can also be made during run-time. + internal class UserSetting : MonoBehaviour + { + /// + /// Settings of the player. + /// + [Tooltip("Settings of the player.")] + public readonly Player Player = new(); + + /// + /// Settings of the network. + /// + [Tooltip("Settings of the network.")] + public readonly Network Network = new(); + + /// + /// The voice chat system as selected by the user. Note: This attribute + /// can be changed in the editor via as well + /// as at the start up in the . + /// + [Tooltip("The voice chat system to be used. 'None' for no voice chat.")] + public VoiceChatSystems VoiceChat = VoiceChatSystems.None; + + /// + /// The kind of environment the game is running (Desktop, VR, etc). + /// + [Tooltip("The kind of environment the game is running (Desktop, VR, etc).")] + public PlayerInputType InputType = PlayerInputType.DesktopPlayer; + + /// + /// Settings for telemetry. + /// + [Tooltip("Telemetry settings.")] + public readonly Telemetry Telemetry = new(); + + /// + /// Settings for video. + /// + [Tooltip("Video settings.")] + public readonly Video Video = new(); + + /// + /// Settings for audio. + /// + [Tooltip("Audio settings.")] + public readonly Audio Audio = new(); + + /// + /// Default path of the configuration file (path and filename). + /// + [PropertyTooltip("Path of the file containing the settings.")] + [OdinSerialize, HideReferenceObjectPicker] + public DataPath ConfigPath = new(); + + /// + /// Backing field of . + /// + private static UserSetting instance; + + /// + /// The single unique instance of the user settings. + /// There can be only one. + /// + public static UserSetting Instance + { + get + { + if (instance != null) + { + return instance; + } + instance = FindAnyObjectByType(); + if (instance == null) + { + Debug.LogError($"There is no {typeof(UserSetting)} component in the current scene!\n"); + } + return instance; + } + } + + /// + /// Sets to the current thread and loads the user settings + /// from the configuration file. + /// + private void Awake() + { + /// The field is supposed to denote Unity's main thread. + /// The function is guaranteed to be executed by Unity's main + /// thread, that is, represents Unity's + /// main thread here. + MainThread = Thread.CurrentThread; + + // Sets the Unity-dependent default values. + Video.InitializeDefaults(); + + Load(); + } + + /// + /// Initializes the application by setting up scene loading callbacks, configuring default animation easing, and + /// initializing the network. + /// + private void Start() + { + SceneManager.sceneLoaded -= OnSceneLoaded; + SceneManager.sceneLoaded += OnSceneLoaded; + + DOTween.defaultEaseType = Ease.OutExpo; + + Network.SetUp(); + Video.SetUp(); + } + + /// + /// Starts the voice-chat system selected. Unregisters itself from + /// . + /// Note: This method is assumed to be called when the new scene is fully loaded. + /// + /// Scene that was loaded. + /// The mode in which the scene was loaded. + private void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + // Now we have loaded the scene that is supposed to contain settings for the voice chat + // system. We can now turn on the voice chat system. + Debug.Log($"Loaded scene {scene.name} in mode {mode}.\n"); + SceneManager.sceneLoaded -= OnSceneLoaded; + UserSettings.VoiceChat.StartVoiceChat(VoiceChat); + } + + /// + /// Shuts down the voice-chat system and OpenTelemetry, + /// and saves all user settings. + /// This ensures that any changes made during the session are persisted + /// when the application quits. + /// + private void OnApplicationQuit() + { + TracingHelperService.Shutdown(true); + UserSettings.VoiceChat.EndVoiceChat(VoiceChat); + } + + /// + /// Registers the quit callback when the object becomes enabled. + /// This ensures that application shutdown can be handled gracefully. + /// + private void OnEnable() + { + Application.wantsToQuit += SaveOnQuit; + } + + /// + /// Unregisters the quit callback when the object is disabled. + /// This prevents callbacks from being invoked on inactive objects. + /// + private void OnDisable() + { + Application.wantsToQuit -= SaveOnQuit; + } + + /// + /// Called when the application is about to quit. + /// Attempts to save the current instance state before shutdown. + /// + /// + /// Returns true to allow the application to quit. + /// + private bool SaveOnQuit() + { + try + { + Instance.Save(); + } + catch (Exception e) + { + Debug.LogError($"Error during quit: {e}\n"); + } + return true; + } + + /// + /// The Unity main thread. Note that we cannot initialize its value here + /// because the elaboration code initializing static attributes may be + /// executed by a thread different from Unity's main thread. This attribute + /// will be initialized in for this reason. + /// + private static Thread mainThread = null; + /// + /// Contains the Unity main thread of the application. + /// + public static Thread MainThread + { + get + { + Assert.IsNotNull(mainThread, "The main Unity thread must not have been determined as of now!"); + return mainThread; + } + private set + { + Assert.IsNotNull(value, "The main Unity thread must not be null!"); + if (mainThread != value) + { + Assert.IsNull(mainThread, "The main Unity thread has already been determined!"); + mainThread = value; + } + } + } + + /// + /// True if the user is using a VR headset. + /// + public static bool IsVR => Instance.InputType == PlayerInputType.VRPlayer; + + /// + /// True if the user is using a desktop computer. + /// + public static bool IsDesktop => Instance.InputType == PlayerInputType.DesktopPlayer; + + /// + /// The backend domain to be used for network connections to the SEE backend. + /// + public static string BackendDomain => Instance?.Network.BackendDomain; + + /// + /// The complete backend server API endpoint to be used for network connections to + /// the SEE backend. + /// + public static string BackendServerAPI => Instance?.Network.BackendServerAPI; + + /// + /// The name of the group for the Inspector buttons loading and saving the configuration file. + /// + private const string configurationButtonsGroup = "ConfigurationButtonsGroup"; + + /// + /// Saves the settings of this network configuration to . + /// If the configuration file exists already, it will be overridden. + /// + [Button(ButtonSizes.Small)] + [PropertyTooltip("Saves the user settings in a configuration file.")] + [ButtonGroup(configurationButtonsGroup)] + public void Save() + { + Save(ConfigPath.Path); + } + + /// + /// Loads the settings of this network configuration from + /// if it exists. If it does not exist, nothing happens. + /// + [Button(ButtonSizes.Small)] + [PropertyTooltip("Loads the user configuration file.")] + [ButtonGroup(configurationButtonsGroup)] + public void Load() + { + Load(ConfigPath.Path); + } + + /// + /// Saves the settings of this network configuration to . + /// + /// Name of the file in which the settings are stored. + public void Save(string filename) + { + using ConfigWriter writer = new(filename); + Save(writer); + } + + /// + /// Reads the settings of this network configuration from . + /// + /// Name of the file from which the settings are restored. + private void Load(string filename) + { + if (File.Exists(filename)) + { + Debug.Log($"Loading user settings from {filename}.\n"); + using ConfigReader stream = new(filename); + Restore(stream.Read()); + } + else + { + Debug.LogError($"User settings file {filename} does not exist.\n"); + } + } + + #region Configuration I/O + /// + /// Label of attribute in the configuration file. + /// + private const string playerLabel = "Player"; + + /// + /// Label of attribute in the configuration file. + /// + private const string networkLabel = "Network"; + + /// + /// Label of attribute in the configuration file. + /// + private const string voiceChatLabel = "VoiceChat"; + + /// + /// Label of attribute in the configuration file. + /// + private const string telemetryLabel = "Telemetry"; + + /// + /// Label of attribute in the configuration file. + /// + private const string inputTypeLabel = "InputType"; + + /// + /// Label of attribute in the configuration file. + /// + private const string videoLabel = "Video"; + + /// + /// Label of attribute in the confiugration file. + /// + private const string audioLabel = "Audio"; + + /// + /// Saves the settings of this network configuration using . + /// + /// The writer to be used to save the settings. + protected virtual void Save(ConfigWriter writer) + { + Player.Save(writer, playerLabel); + writer.Save(VoiceChat.ToString(), voiceChatLabel); + Telemetry.Save(writer, telemetryLabel); + writer.Save(InputType.ToString(), inputTypeLabel); + Video.Save(writer, videoLabel); + Audio.Save(writer, audioLabel); + try + { + Network.Save(writer, networkLabel); + } + catch (System.Exception) + { + Debug.LogError("Network settings could not be saved.\n"); + throw; + } + } + + /// + /// Restores the settings from . + /// + /// The attributes from which to restore the settings. + protected virtual void Restore(Dictionary attributes) + { + Player.Restore(attributes, playerLabel); + ConfigIO.RestoreEnum(attributes, voiceChatLabel, ref VoiceChat); + Telemetry.Restore(attributes, telemetryLabel); + ConfigIO.RestoreEnum(attributes, inputTypeLabel, ref InputType); + Video.Restore(attributes, videoLabel); + Audio.Restore(attributes, audioLabel); + Network.Restore(attributes, networkLabel); + } + + #endregion Configuration I/O + } +} diff --git a/Assets/SEE/UserSettings/UserSetting.cs.meta b/Assets/SEE/UserSettings/UserSetting.cs.meta new file mode 100644 index 0000000000..81d55fcc16 --- /dev/null +++ b/Assets/SEE/UserSettings/UserSetting.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2ffddefd7964be745be7c5cc0be0eb03 \ No newline at end of file diff --git a/Assets/SEE/UserSettings/UserSettings.cs b/Assets/SEE/UserSettings/UserSettings.cs index f0ec18e952..63f9a79c0c 100644 --- a/Assets/SEE/UserSettings/UserSettings.cs +++ b/Assets/SEE/UserSettings/UserSettings.cs @@ -1,386 +1,6 @@ -using DG.Tweening; -using SEE.GO; -using SEE.Net; -using SEE.Tools.OpenTelemetry; -using SEE.Utils.Config; -using SEE.Utils.Paths; -using Sirenix.OdinInspector; -using Sirenix.Serialization; -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using UnityEngine; -using UnityEngine.Assertions; -using UnityEngine.SceneManagement; - -namespace SEE.User +/// +/// Contains classes related to configurations set by a user. +/// +namespace SEE.UserSettings { - /// - /// Represents the user settings for the SEE application. These are attributes - /// that are generally set by the user at the start of the application. - /// - /// This component is assumed to be attached to a game object in the - /// start scene. The user can select the environment in the Unity editor. - /// The selection can also be made during run-time. - internal class UserSettings : MonoBehaviour - { - /// - /// Settings of the player. - /// - [Tooltip("Settings of the player.")] - public readonly Player Player = new(); - - /// - /// Settings of the network. - /// - [Tooltip("Settings of the network.")] - public readonly Network Network = new(); - - /// - /// The voice chat system as selected by the user. Note: This attribute - /// can be changed in the editor via as well - /// as at the start up in the . - /// - [Tooltip("The voice chat system to be used. 'None' for no voice chat.")] - public VoiceChatSystems VoiceChat = VoiceChatSystems.None; - - /// - /// The kind of environment the game is running (Desktop, VR, etc). - /// - [Tooltip("The kind of environment the game is running (Desktop, VR, etc).")] - public PlayerInputType InputType = PlayerInputType.DesktopPlayer; - - /// - /// Settings for telemetry. - /// - [Tooltip("Telemetry settings.")] - public readonly Telemetry Telemetry = new(); - - /// - /// Settings for video. - /// - [Tooltip("Video settings.")] - public readonly Video Video = new(); - - /// - /// Settings for audio. - /// - [Tooltip("Audio settings.")] - public readonly Audio Audio = new(); - - /// - /// Default path of the configuration file (path and filename). - /// - [PropertyTooltip("Path of the file containing the settings.")] - [OdinSerialize, HideReferenceObjectPicker] - public DataPath ConfigPath = new(); - - /// - /// Backing field of . - /// - private static UserSettings instance; - - /// - /// The single unique instance of the user settings. - /// There can be only one. - /// - public static UserSettings Instance - { - get - { - if (instance != null) - { - return instance; - } - instance = FindAnyObjectByType(); - if (instance == null) - { - Debug.LogError($"There is no {typeof(UserSettings)} component in the current scene!\n"); - } - return instance; - } - } - - /// - /// Sets to the current thread and loads the user settings - /// from the configuration file. - /// - private void Awake() - { - /// The field is supposed to denote Unity's main thread. - /// The function is guaranteed to be executed by Unity's main - /// thread, that is, represents Unity's - /// main thread here. - MainThread = Thread.CurrentThread; - - // Sets the Unity-dependent default values. - Video.InitializeDefaults(); - - Load(); - } - - /// - /// Initializes the application by setting up scene loading callbacks, configuring default animation easing, and - /// initializing the network. - /// - private void Start() - { - SceneManager.sceneLoaded -= OnSceneLoaded; - SceneManager.sceneLoaded += OnSceneLoaded; - - DOTween.defaultEaseType = Ease.OutExpo; - - Network.SetUp(); - Video.SetUp(); - } - - /// - /// Starts the voice-chat system selected. Unregisters itself from - /// . - /// Note: This method is assumed to be called when the new scene is fully loaded. - /// - /// Scene that was loaded. - /// The mode in which the scene was loaded. - private void OnSceneLoaded(Scene scene, LoadSceneMode mode) - { - // Now we have loaded the scene that is supposed to contain settings for the voice chat - // system. We can now turn on the voice chat system. - Debug.Log($"Loaded scene {scene.name} in mode {mode}.\n"); - SceneManager.sceneLoaded -= OnSceneLoaded; - User.VoiceChat.StartVoiceChat(VoiceChat); - } - - /// - /// Shuts down the voice-chat system and OpenTelemetry, - /// and saves all user settings. - /// This ensures that any changes made during the session are persisted - /// when the application quits. - /// - private void OnApplicationQuit() - { - TracingHelperService.Shutdown(true); - User.VoiceChat.EndVoiceChat(VoiceChat); - } - - /// - /// Registers the quit callback when the object becomes enabled. - /// This ensures that application shutdown can be handled gracefully. - /// - private void OnEnable() - { - Application.wantsToQuit += SaveOnQuit; - } - - /// - /// Unregisters the quit callback when the object is disabled. - /// This prevents callbacks from being invoked on inactive objects. - /// - private void OnDisable() - { - Application.wantsToQuit -= SaveOnQuit; - } - - /// - /// Called when the application is about to quit. - /// Attempts to save the current instance state before shutdown. - /// - /// - /// Returns true to allow the application to quit. - /// - private bool SaveOnQuit() - { - try - { - Instance.Save(); - } - catch (Exception e) - { - Debug.LogError($"Error during quit: {e}\n"); - } - return true; - } - - /// - /// The Unity main thread. Note that we cannot initialize its value here - /// because the elaboration code initializing static attributes may be - /// executed by a thread different from Unity's main thread. This attribute - /// will be initialized in for this reason. - /// - private static Thread mainThread = null; - /// - /// Contains the Unity main thread of the application. - /// - public static Thread MainThread - { - get - { - Assert.IsNotNull(mainThread, "The main Unity thread must not have been determined as of now!"); - return mainThread; - } - private set - { - Assert.IsNotNull(value, "The main Unity thread must not be null!"); - if (mainThread != value) - { - Assert.IsNull(mainThread, "The main Unity thread has already been determined!"); - mainThread = value; - } - } - } - - /// - /// True if the user is using a VR headset. - /// - public static bool IsVR => Instance.InputType == PlayerInputType.VRPlayer; - - /// - /// True if the user is using a desktop computer. - /// - public static bool IsDesktop => Instance.InputType == PlayerInputType.DesktopPlayer; - - /// - /// The backend domain to be used for network connections to the SEE backend. - /// - public static string BackendDomain => Instance?.Network.BackendDomain; - - /// - /// The complete backend server API endpoint to be used for network connections to - /// the SEE backend. - /// - public static string BackendServerAPI => Instance?.Network.BackendServerAPI; - - /// - /// The name of the group for the Inspector buttons loading and saving the configuration file. - /// - private const string configurationButtonsGroup = "ConfigurationButtonsGroup"; - - /// - /// Saves the settings of this network configuration to . - /// If the configuration file exists already, it will be overridden. - /// - [Button(ButtonSizes.Small)] - [PropertyTooltip("Saves the user settings in a configuration file.")] - [ButtonGroup(configurationButtonsGroup)] - public void Save() - { - Save(ConfigPath.Path); - } - - /// - /// Loads the settings of this network configuration from - /// if it exists. If it does not exist, nothing happens. - /// - [Button(ButtonSizes.Small)] - [PropertyTooltip("Loads the user configuration file.")] - [ButtonGroup(configurationButtonsGroup)] - public void Load() - { - Load(ConfigPath.Path); - } - - /// - /// Saves the settings of this network configuration to . - /// - /// Name of the file in which the settings are stored. - public void Save(string filename) - { - using ConfigWriter writer = new(filename); - Save(writer); - } - - /// - /// Reads the settings of this network configuration from . - /// - /// Name of the file from which the settings are restored. - private void Load(string filename) - { - if (File.Exists(filename)) - { - Debug.Log($"Loading user settings from {filename}.\n"); - using ConfigReader stream = new(filename); - Restore(stream.Read()); - } - else - { - Debug.LogWarning($"User settings file {filename} does not exist. Using scene defaults.\n"); - } - } - - #region Configuration I/O - /// - /// Label of attribute in the configuration file. - /// - private const string playerLabel = "Player"; - - /// - /// Label of attribute in the configuration file. - /// - private const string networkLabel = "Network"; - - /// - /// Label of attribute in the configuration file. - /// - private const string voiceChatLabel = "VoiceChat"; - - /// - /// Label of attribute in the configuration file. - /// - private const string telemetryLabel = "Telemetry"; - - /// - /// Label of attribute in the configuration file. - /// - private const string inputTypeLabel = "InputType"; - - /// - /// Label of attribute in the configuration file. - /// - private const string videoLabel = "Video"; - - /// - /// Label of attribute in the confiugration file. - /// - private const string audioLabel = "Audio"; - - /// - /// Saves the settings of this network configuration using . - /// - /// The writer to be used to save the settings. - protected virtual void Save(ConfigWriter writer) - { - Player.Save(writer, playerLabel); - writer.Save(VoiceChat.ToString(), voiceChatLabel); - Telemetry.Save(writer, telemetryLabel); - writer.Save(InputType.ToString(), inputTypeLabel); - Video.Save(writer, videoLabel); - Audio.Save(writer, audioLabel); - try - { - Network.Save(writer, networkLabel); - } - catch (System.Exception) - { - Debug.LogError("Network settings could not be saved.\n"); - throw; - } - } - - /// - /// Restores the settings from . - /// - /// The attributes from which to restore the settings. - protected virtual void Restore(Dictionary attributes) - { - Player.Restore(attributes, playerLabel); - ConfigIO.RestoreEnum(attributes, voiceChatLabel, ref VoiceChat); - Telemetry.Restore(attributes, telemetryLabel); - ConfigIO.RestoreEnum(attributes, inputTypeLabel, ref InputType); - Video.Restore(attributes, videoLabel); - Audio.Restore(attributes, audioLabel); - Network.Restore(attributes, networkLabel); - } - - #endregion Configuration I/O - } } diff --git a/Assets/SEE/UserSettings/UserSettings.cs.meta b/Assets/SEE/UserSettings/UserSettings.cs.meta index 91948d9844..ca007e3c88 100644 --- a/Assets/SEE/UserSettings/UserSettings.cs.meta +++ b/Assets/SEE/UserSettings/UserSettings.cs.meta @@ -1,2 +1,2 @@ fileFormatVersion: 2 -guid: eccf4ad3f8d39cc46bd0331d97b4c692 \ No newline at end of file +guid: f5feecbc98a08eb4cb186a7aeb75529a \ No newline at end of file diff --git a/Assets/SEE/UserSettings/Video.cs b/Assets/SEE/UserSettings/Video.cs index 096f9c0a42..b99120a174 100644 --- a/Assets/SEE/UserSettings/Video.cs +++ b/Assets/SEE/UserSettings/Video.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using UnityEngine; -namespace SEE.User +namespace SEE.UserSettings { /// /// Represents the video settings for the SEE application. These are attributes diff --git a/Assets/SEE/UserSettings/VoiceChat.cs b/Assets/SEE/UserSettings/VoiceChat.cs index d3858255c7..e64b51ad81 100644 --- a/Assets/SEE/UserSettings/VoiceChat.cs +++ b/Assets/SEE/UserSettings/VoiceChat.cs @@ -2,7 +2,7 @@ using System; using UnityEngine; -namespace SEE.User +namespace SEE.UserSettings { /// /// The kinds of voice-chats system we support. None means no voice diff --git a/Assets/SEE/Utils/Assertions.cs b/Assets/SEE/Utils/Assertions.cs index 100ce9bad9..ca1f188e8e 100644 --- a/Assets/SEE/Utils/Assertions.cs +++ b/Assets/SEE/Utils/Assertions.cs @@ -17,7 +17,7 @@ //TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE //USE OR OTHER DEALINGS IN THE SOFTWARE. -using SEE.GO; +using SEE.Extensions; using System; using System.Diagnostics; diff --git a/Assets/SEE/Utils/BoundingBox.cs b/Assets/SEE/Utils/BoundingBox.cs deleted file mode 100644 index 88fbb3ff4d..0000000000 --- a/Assets/SEE/Utils/BoundingBox.cs +++ /dev/null @@ -1,92 +0,0 @@ -using SEE.GO; -using System.Collections.Generic; -using UnityEngine; - -namespace SEE.Utils -{ - /// - /// Calculation of bounding boxes containing game objects. - /// - public static class BoundingBox - { - /// - /// Returns the bounding box (2D rectangle) enclosing all given - /// in terms of world space. - /// - /// Precondition: All have a renderer component attached to them. - /// - /// The list of objects that are enclosed in the resulting bounding box. - /// The left lower front corner (x axis in 3D space) of the bounding box. - /// The right lower back corner (z axis in 3D space) of the bounding box. - public static void Get(ICollection gameObjects, out Vector2 leftLowerCorner, out Vector2 rightUpperCorner) - { - if (gameObjects.Count == 0) - { - leftLowerCorner = Vector2.zero; - rightUpperCorner = Vector2.zero; - } - else - { - leftLowerCorner = new Vector2(Mathf.Infinity, Mathf.Infinity); - rightUpperCorner = new Vector2(Mathf.NegativeInfinity, Mathf.NegativeInfinity); - - foreach (GameObject go in gameObjects) - { - Vector3 extent = go.WorldSpaceSize() / 2.0f; - // Note: position denotes the center of the object - Vector3 position = go.transform.position; - { - // x co-ordinate of lower left corner - float x = position.x - extent.x; - if (x < leftLowerCorner.x) - { - leftLowerCorner.x = x; - } - } - { - // z co-ordinate of lower left corner - float z = position.z - extent.z; - if (z < leftLowerCorner.y) - { - leftLowerCorner.y = z; - } - } - { // x co-ordinate of upper right corner - float x = position.x + extent.x; - if (x > rightUpperCorner.x) - { - rightUpperCorner.x = x; - } - } - { - // z co-ordinate of upper right corner - float z = position.z + extent.z; - if (z > rightUpperCorner.y) - { - rightUpperCorner.y = z; - } - } - } - } - } - - /// - /// Returns the maximal y co-ordinate of all given in world space. - /// - /// The game objects whose maximal y co-ordinate is requested. - /// Maximal y co-ordinate. - public static float GetRoof(ICollection gameObjects) - { - float result = float.NegativeInfinity; - foreach (GameObject gameObject in gameObjects) - { - float yTop = gameObject.transform.position.y + gameObject.WorldSpaceSize().y / 2.0f; - if (yTop > result) - { - result = yTop; - } - } - return result; - } - } -} diff --git a/Assets/SEE/Utils/BoundingBox.cs.meta b/Assets/SEE/Utils/BoundingBox.cs.meta deleted file mode 100644 index 0e5c72ce92..0000000000 --- a/Assets/SEE/Utils/BoundingBox.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a9e1c4e24e75ac347a8c2b8be6eb2aac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEE/Utils/Destroyer.cs b/Assets/SEE/Utils/Destroyer.cs index 528b87a6db..88aaa63611 100644 --- a/Assets/SEE/Utils/Destroyer.cs +++ b/Assets/SEE/Utils/Destroyer.cs @@ -1,6 +1,6 @@ -using SEE.Game; -using SEE.GO; +using SEE.Extensions; using UnityEngine; +using SEE.GraphElementRefs; namespace SEE.Utils { diff --git a/Assets/SEE/Utils/MainCamera.cs b/Assets/SEE/Utils/MainCamera.cs index cd9c42d691..d8e2c03367 100644 --- a/Assets/SEE/Utils/MainCamera.cs +++ b/Assets/SEE/Utils/MainCamera.cs @@ -1,5 +1,5 @@ using SEE.Game; -using SEE.GO; +using SEE.Extensions; using System; using UnityEngine; diff --git a/Assets/SEE/Utils/Paths/DataPath.cs b/Assets/SEE/Utils/Paths/DataPath.cs index f265f63c4b..37691897af 100644 --- a/Assets/SEE/Utils/Paths/DataPath.cs +++ b/Assets/SEE/Utils/Paths/DataPath.cs @@ -1,5 +1,5 @@ using Cysharp.Threading.Tasks; -using SEE.User; +using SEE.UserSettings; using SEE.Utils.Config; using Sirenix.OdinInspector; using System; @@ -237,7 +237,7 @@ private string Get() // absolutePath is set only for foreign servers, in which case relativePath // will be empty. If the absolutePath is empty, the relativePath is interpreted relative // to our server. - Uri baseUri = AbsolutePath.Length > 0 ? new(AbsolutePath) : new(UserSettings.BackendServerAPI); + Uri baseUri = AbsolutePath.Length > 0 ? new(AbsolutePath) : new(UserSetting.BackendServerAPI); Uri relativeUri = new(RelativePath, UriKind.Relative); return new Uri(baseUri, relativeUri).ToString(); } @@ -296,7 +296,7 @@ private void Set(string path) Uri uri = new(path); if (uri.IsAbsoluteUri) { - string backendServerAPI = UserSettings.BackendServerAPI; + string backendServerAPI = UserSetting.BackendServerAPI; if (backendServerAPI != null && path.Contains(backendServerAPI)) { // The path relates to our server. diff --git a/Assets/SEE/Utils/Raycasting.cs b/Assets/SEE/Utils/Raycasting.cs index 999677a5a8..57263c2533 100644 --- a/Assets/SEE/Utils/Raycasting.cs +++ b/Assets/SEE/Utils/Raycasting.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using SEE.Controls; using SEE.DataModel.DG; -using SEE.GO; +using SEE.Extensions; using UnityEngine; using UnityEngine.Assertions; using UnityEngine.EventSystems; @@ -11,6 +11,8 @@ using SEE.Game; using SEE.UI; using SEE.Controls.Interactables; +using SEE.GraphElementRefs; +using SEE.UserSettings; namespace SEE.Utils { @@ -364,7 +366,7 @@ public static bool RaycastInteractableObjectBase( /// Whether the mouse currently hovers over a GUI element. public static bool IsMouseOverGUI() { - if (User.UserSettings.Instance.InputType != PlayerInputType.DesktopPlayer) + if (UserSetting.Instance.InputType != PlayerInputType.DesktopPlayer) { return false; } @@ -396,7 +398,7 @@ public static bool IsMouseOverGUI() /// Whether the clipping plane was hit inside of its clipping area. /// The hit position on the plane or , if the plane was not hit. public static void RaycastClippingPlane( - GO.Plane clippingPlane, + Cities.Plane clippingPlane, out bool hit, out bool hitInsideClippingArea, out Vector3 hitPointOnPlane) @@ -450,7 +452,7 @@ public static Ray UserPointsTo() { Camera mainCamera = MainCamera.Camera; Vector3 screenPoint; - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { XRSEEActions.RayInteractor.TryGetCurrent3DRaycastHit(out RaycastHit hit); screenPoint = mainCamera.WorldToScreenPoint(hit.point); diff --git a/Assets/SEE/Utils/RestoreGraphElementListSerializer.cs b/Assets/SEE/Utils/RestoreGraphElementListSerializer.cs index 8acb7b87a6..b3881ac510 100644 --- a/Assets/SEE/Utils/RestoreGraphElementListSerializer.cs +++ b/Assets/SEE/Utils/RestoreGraphElementListSerializer.cs @@ -1,5 +1,5 @@ using Newtonsoft.Json; -using SEE.Game.SceneManipulation; +using SEE.SceneManipulation; using System.Collections.Generic; namespace SEE.Utils diff --git a/Assets/SEE/Utils/Tweens.cs b/Assets/SEE/Utils/Tweens.cs index 1a648b78b9..5f5723f9ab 100644 --- a/Assets/SEE/Utils/Tweens.cs +++ b/Assets/SEE/Utils/Tweens.cs @@ -1,6 +1,6 @@ using System; using DG.Tweening; -using SEE.GO; +using SEE.Extensions; using UnityEngine; namespace SEE.Utils diff --git a/Assets/SEE/Utils/WebcamManager.cs b/Assets/SEE/Utils/WebcamManager.cs index 3c08ea5d54..77443bc888 100644 --- a/Assets/SEE/Utils/WebcamManager.cs +++ b/Assets/SEE/Utils/WebcamManager.cs @@ -1,7 +1,7 @@ using Cysharp.Threading.Tasks; using SEE.UI; using SEE.UI.Notification; -using SEE.User; +using SEE.UserSettings; using System; using System.Collections.Generic; using UnityEngine; @@ -108,7 +108,7 @@ private static void Initialize() } // Try to load previous selected webcam device from PlayerPrefs. - string savedCamera = UserSettings.Instance.Video.WebcamName; + string savedCamera = UserSetting.Instance.Video.WebcamName; // Initialize the remaining webcams (not played yet) for (int i = 0; i < devices.Length; i++) @@ -212,8 +212,8 @@ public static void SwitchCamera(int index) OnActiveWebcamChanged?.Invoke(webcams[activeIndex]); // Saves the selected camera. - UserSettings.Instance.Video.WebcamName = webcams[activeIndex].deviceName; - UserSettings.Instance.Save(); + UserSetting.Instance.Video.WebcamName = webcams[activeIndex].deviceName; + UserSetting.Instance.Save(); } static async UniTask StopWebcamAsync(int index) diff --git a/Assets/SEE/XR/KeyboardInputHandler.cs b/Assets/SEE/XR/KeyboardInputHandler.cs index 7b0ea706ac..f46f07e792 100644 --- a/Assets/SEE/XR/KeyboardInputHandler.cs +++ b/Assets/SEE/XR/KeyboardInputHandler.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.UserSettings; using TMPro; using UnityEngine; using UnityEngine.EventSystems; @@ -20,7 +20,7 @@ public class KeyboardInputHandler : MonoBehaviour, IPointerClickHandler private void Start() { // Cache the reference to the keyboard GameObject - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { keyboardGameObject = KeyboardManager.instance.gameObject.transform.Find("Keyboard").gameObject; } @@ -33,7 +33,7 @@ private void Start() /// Event data associated with the event when the user clicks on the inputfield. public void OnPointerClick(PointerEventData eventdata) { - if (User.UserSettings.IsVR) + if (UserSetting.IsVR) { KeyboardManager.instance.inputField = GetComponent(); keyboardGameObject.SetActive(true); diff --git a/Assets/SEE/XR/KeyboardManager.cs b/Assets/SEE/XR/KeyboardManager.cs index 079429d2a8..ef0fc90f02 100644 --- a/Assets/SEE/XR/KeyboardManager.cs +++ b/Assets/SEE/XR/KeyboardManager.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using TMPro; using UnityEngine; using UnityEngine.UI; diff --git a/Assets/SEE/XR/RadialSelection.cs b/Assets/SEE/XR/RadialSelection.cs index a546791bad..8a73e1d8e8 100644 --- a/Assets/SEE/XR/RadialSelection.cs +++ b/Assets/SEE/XR/RadialSelection.cs @@ -1,5 +1,5 @@ -using SEE.Controls.Actions; -using SEE.GO; +using SEE.Controls.ReversibleActions; +using SEE.Extensions; using System.Collections.Generic; using System.Linq; using TMPro; @@ -9,6 +9,7 @@ using UnityEngine.UI; using SEE.Utils; using System; +using SEE.ReversibleActionHistory; namespace SEE.XR { diff --git a/Assets/SEE/XR/XRCameraRigManager.cs b/Assets/SEE/XR/XRCameraRigManager.cs index 8c4a13c657..af2626d54b 100644 --- a/Assets/SEE/XR/XRCameraRigManager.cs +++ b/Assets/SEE/XR/XRCameraRigManager.cs @@ -1,4 +1,4 @@ -using SEE.GO; +using SEE.Extensions; using System.Collections; using UnityEngine; @@ -46,8 +46,27 @@ private IEnumerator EnableControllersCoroutine() } Debug.Log($"[{nameof(XRCameraRigManager)}] Enabling controllers.\n"); - gameObject.SetChildActive(LeftControllerName, true); - gameObject.SetChildActive(RightControllerName, true); + SetChildActive(gameObject, LeftControllerName, true); + SetChildActive(gameObject, RightControllerName, true); + } + + /// + /// Enables/disables the child of with . + /// + /// Object whose child is to be enabled/disabled. + /// The name of the child; may be a composite name. + /// Whether to enable it. + private static void SetChildActive(GameObject gameObject, string childName, bool active) + { + Transform child = gameObject.transform.Find(childName); + if (child) + { + child.gameObject.SetActive(active); + } + else + { + Debug.LogError($"Game object '{gameObject.FullName()}' does not have child with name '{childName}'.\n"); + } } } #endif diff --git a/Assets/SEE/XR/XRSEEActions.cs b/Assets/SEE/XR/XRSEEActions.cs index 2f33e5b78b..9c37b79ea2 100644 --- a/Assets/SEE/XR/XRSEEActions.cs +++ b/Assets/SEE/XR/XRSEEActions.cs @@ -1,6 +1,8 @@ using SEE.Controls; -using SEE.Controls.Actions; -using SEE.GO; +using SEE.Controls.ReversibleActions; +using SEE.Controls.Modifiers; +using SEE.Extensions; +using SEE.ReversibleActionHistory; using SEE.Utils; using UnityEngine; using UnityEngine.EventSystems; diff --git a/Assets/SEEPlayModeTests/TestKeywordInput.cs b/Assets/SEEPlayModeTests/TestKeywordInput.cs index d641da47f3..6a2dfd715e 100644 --- a/Assets/SEEPlayModeTests/TestKeywordInput.cs +++ b/Assets/SEEPlayModeTests/TestKeywordInput.cs @@ -7,7 +7,7 @@ using NUnit.Framework; using System.Linq; -namespace SEE.Controls +namespace SEE.Controls.SpeechInput { /// /// Test cases for . diff --git a/Assets/SEEPlayModeTests/TestSEEGame.cs b/Assets/SEEPlayModeTests/TestSEEGame.cs index 6172cc22fe..9dd8936135 100644 --- a/Assets/SEEPlayModeTests/TestSEEGame.cs +++ b/Assets/SEEPlayModeTests/TestSEEGame.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using SEE.UserSettings; using System.Collections; using UnityEngine; using UnityEngine.EventSystems; @@ -120,8 +121,8 @@ public IEnumerator SetUp() PressButton(HostButtonPath); yield return new WaitForEndOfFrame(); - Assert.That(User.UserSettings.Instance, Is.Not.Null, - $"There is no {nameof(User.UserSettings)} instance after pressing {HostButtonPath}."); + Assert.That(UserSetting.Instance, Is.Not.Null, + $"There is no {nameof(UserSetting.Instance)} instance after pressing {HostButtonPath}."); Debug.Log($"[SetUp] Finished.\n"); yield return null; } diff --git a/Assets/SEEPlayModeTests/TestUI.cs b/Assets/SEEPlayModeTests/TestUI.cs index 3281a1ef0a..3f19d3a061 100644 --- a/Assets/SEEPlayModeTests/TestUI.cs +++ b/Assets/SEEPlayModeTests/TestUI.cs @@ -5,6 +5,7 @@ using NUnit.Framework.Interfaces; using NUnit.Framework; using UnityEngine; +using SEE.UserSettings; namespace SEE.UI { @@ -17,8 +18,7 @@ internal abstract class TestUI /// /// Setup for a test. /// The playmode will be entered. - /// The UserSettings.Instance.InputType - /// will be . + /// The will be . /// /// Note: Subclasses may have their own method tagged by UnitySetUp, /// which will then be called after this method. @@ -34,7 +34,7 @@ internal abstract class TestUI public IEnumerator SetUp() { LogAssert.ignoreFailingMessages = true; - User.UserSettings.Instance.InputType = GO.PlayerInputType.DesktopPlayer; + UserSetting.Instance.InputType = PlayerInputType.DesktopPlayer; yield return new EnterPlayMode(); } diff --git a/Assets/SEEPlayModeTests/TextDictationInput.cs b/Assets/SEEPlayModeTests/TextDictationInput.cs index 5c5d9d7e04..08f3d9748a 100644 --- a/Assets/SEEPlayModeTests/TextDictationInput.cs +++ b/Assets/SEEPlayModeTests/TextDictationInput.cs @@ -4,7 +4,7 @@ using UnityEngine.TestTools; using UnityEngine.Windows.Speech; -namespace SEE.Controls +namespace SEE.Controls.SpeechInput { /// /// Test cases for . diff --git a/Assets/SEETests/TestActionHistory.cs b/Assets/SEETests/TestActionHistory.cs index ed5cb8b9d2..74a91267a3 100644 --- a/Assets/SEETests/TestActionHistory.cs +++ b/Assets/SEETests/TestActionHistory.cs @@ -1,9 +1,9 @@ using NUnit.Framework; -using SEE.Controls.Actions; +using SEE.Controls.ReversibleActions; using System; using System.Collections.Generic; -namespace SEE.Utils.History +namespace SEE.ReversibleActionHistory { /// /// Test cases for . diff --git a/Assets/SEETests/TestActionStateType.cs b/Assets/SEETests/TestActionStateType.cs index aa9200ab49..86af911ba9 100644 --- a/Assets/SEETests/TestActionStateType.cs +++ b/Assets/SEETests/TestActionStateType.cs @@ -6,7 +6,7 @@ using NUnit.Framework; using SEE.Utils; -namespace SEE.Controls.Actions +namespace SEE.Controls.ReversibleActions { /// /// Tests for the class and its subclasses diff --git a/Assets/SEETests/TestConfigIO.cs b/Assets/SEETests/TestConfigIO.cs index 8f092f401e..1a72c585d6 100644 --- a/Assets/SEETests/TestConfigIO.cs +++ b/Assets/SEETests/TestConfigIO.cs @@ -6,6 +6,7 @@ using SEE.GraphProviders; using SEE.Tools.RandomGraphs; using SEE.Utils.Config; +using SEE.Extensions; using UnityEngine; namespace SEE.Utils diff --git a/Assets/SEETests/TestDataPath.cs b/Assets/SEETests/TestDataPath.cs index 50cd168dff..3caa9f2085 100644 --- a/Assets/SEETests/TestDataPath.cs +++ b/Assets/SEETests/TestDataPath.cs @@ -1,6 +1,6 @@ using Cysharp.Threading.Tasks; using NUnit.Framework; -using SEE.User; +using SEE.UserSettings; using System.Collections; using System.IO; using System.Text.RegularExpressions; @@ -22,7 +22,7 @@ internal class TestDataPath public IEnumerator LoadFromForeignServer() => UniTask.ToCoroutine(async () => { - LogAssert.Expect(LogType.Error, new Regex($".*There is no {typeof(UserSettings)} component in the current scene!.*")); + LogAssert.Expect(LogType.Error, new Regex($".*There is no {typeof(UserSetting)} component in the current scene!.*")); const string filename = "psnfss2e.pdf"; DataPath dataPath = new() @@ -52,7 +52,7 @@ public IEnumerator LoadFromForeignServer() => public IEnumerator LoadFromOurBackend() => UniTask.ToCoroutine(async () => { - LogAssert.Expect(LogType.Error, new Regex($".*There is no {typeof(UserSettings)} component in the current scene!.*")); + LogAssert.Expect(LogType.Error, new Regex($".*There is no {typeof(UserSetting)} component in the current scene!.*")); const string filename = "solution.sln"; DataPath dataPath = new() diff --git a/Assets/SEETests/TestGameObjectDimensions.cs b/Assets/SEETests/TestGameObjectDimensions.cs index 1a9c05fb72..aabb9b4a83 100644 --- a/Assets/SEETests/TestGameObjectDimensions.cs +++ b/Assets/SEETests/TestGameObjectDimensions.cs @@ -1,10 +1,10 @@ using NUnit.Framework; using UnityEngine; -namespace SEE.GO +namespace SEE.Extensions { /// - /// Tests for regarding dimensions. + /// Tests for regarding dimensions. /// internal class TestGameObjectDimensions { diff --git a/Assets/SEETests/TestGraphIO.cs b/Assets/SEETests/TestGraphIO.cs index 7dba0779ba..f0da456c6a 100644 --- a/Assets/SEETests/TestGraphIO.cs +++ b/Assets/SEETests/TestGraphIO.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Cysharp.Threading.Tasks; using NUnit.Framework; +using SEE.DataModel.DG.IO.GXL; using SEE.Tools.RandomGraphs; using SEE.Utils; using SEE.Utils.Paths; diff --git a/Assets/SEETests/TestGraphProviderIO.cs b/Assets/SEETests/TestGraphProviderIO.cs index dfbfa54a7b..bcf56804fa 100644 --- a/Assets/SEETests/TestGraphProviderIO.cs +++ b/Assets/SEETests/TestGraphProviderIO.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using SEE.DataModel.DG.IO.ReportImports; using SEE.GraphProviders.Evolution; using SEE.Utils; using SEE.Utils.Config; @@ -98,9 +99,9 @@ public static void AreEqual(SingleGraphProvider expected, SingleGraphProvider ac { AreEqualReflexionGraphProviders(reflexionGraphProvider, actual); } - else if (expected is JaCoCoGraphProvider jacocoGraphProvider) + else if (expected is ReportGraphProvider reportGraphProvider) { - AreEqualJaCoCoGraphProviders(jacocoGraphProvider, actual); + AreEqualReportGraphProviders(reportGraphProvider, actual); } else if (expected is MergeDiffGraphProvider diffMergeGraphProvider) { @@ -112,8 +113,17 @@ public static void AreEqual(SingleGraphProvider expected, SingleGraphProvider ac } } + /// + /// The configuration label under which the graph provider configuration + /// will be stored in the configuration file. + /// private const string providerLabel = "provider"; + /// + /// Name of the temporary file to which the graph provider configuration + /// will be written and from which it will be read. Will be created + /// on and deleted on . + /// private string filename; [SetUp] @@ -128,6 +138,49 @@ public void TearDown() FileIO.DeleteIfExists(filename); } + #region Report provider + + [Test] + public void TestReportGraphProvider() + { + ReportGraphProvider saved = GetReportGraphProvider(); + Save(saved); + AreEqualReportGraphProviders(saved, LoadSingleGraph()); + } + + private ReportGraphProvider GetReportGraphProvider() + { + return new ReportGraphProvider() + { + Path = new DataPath(Application.streamingAssetsPath + "/mydir/myfile.xml"), + ParsingConfig = GetParsingConfig() + }; + + static ParsingConfig GetParsingConfig() + { + return new MSBuildParsingConfig(); + } + } + + private static void AreEqualReportGraphProviders(ReportGraphProvider expected, SingleGraphProvider actual) + { + Assert.That(actual.GetType(), Is.EqualTo(expected.GetType())); + ReportGraphProvider reportLoaded = actual as ReportGraphProvider; + AreEqual(expected.Path, reportLoaded.Path); + AreEqual(expected.ParsingConfig, reportLoaded.ParsingConfig); + } + + private static void AreEqual(ParsingConfig expected, ParsingConfig actual) + { + Assert.That(actual.GetType(), Is.EqualTo(expected.GetType())); + Assert.That(actual.ToolId, Is.EqualTo(expected.ToolId)); + Assert.That(actual.SourceRootMarker, Is.EqualTo(expected.SourceRootMarker)); + /// Note: The subclasses of may have additional + /// attributes, but they are not saved to the configuration file. + } + + #endregion Report provider + #region GXL provider [Test] @@ -199,33 +252,6 @@ private static void AreEqualCSVProviders(CSVGraphProvider expected, SingleGraphP #endregion - #region JaCoCo provider - - [Test] - public void TestJaCoCoGraphProvider() - { - JaCoCoGraphProvider saved = GetJaCoCoProvider(); - Save(saved); - AreEqualJaCoCoGraphProviders(saved, LoadSingleGraph()); - } - - private JaCoCoGraphProvider GetJaCoCoProvider() - { - return new JaCoCoGraphProvider() - { - Path = new DataPath(Application.streamingAssetsPath + "/mydir/jacoco.xml") - }; - } - - private static void AreEqualJaCoCoGraphProviders(JaCoCoGraphProvider expected, SingleGraphProvider actual) - { - Assert.That(actual, Is.TypeOf(expected.GetType())); - JaCoCoGraphProvider loadedProvider = actual as JaCoCoGraphProvider; - AreEqual(expected.Path, loadedProvider.Path); - } - - #endregion - #region Pipeline provider [Test] @@ -393,9 +419,10 @@ private MergeDiffGraphProvider GetDiffMergeProvider() { return new MergeDiffGraphProvider() { - OldGraph = new JaCoCoGraphProvider() + OldGraph = new ReportGraphProvider() { - Path = new DataPath(Application.streamingAssetsPath + "/mydir/jacoco.xml") + Path = new DataPath(Application.streamingAssetsPath + "/mydir/jacoco.xml"), + ParsingConfig = new JaCoCoParsingConfig() } }; } diff --git a/Assets/SEETests/TestGraphProviders.cs b/Assets/SEETests/TestGraphProviders.cs index cc6a5cc084..761b713b3b 100644 --- a/Assets/SEETests/TestGraphProviders.cs +++ b/Assets/SEETests/TestGraphProviders.cs @@ -1,11 +1,11 @@ using NUnit.Framework; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; +using SEE.DataModel.DG.IO.GXL; using SEE.Game.City; using SEE.Utils; using SEE.Utils.Paths; using SEE.VCS; -using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -26,16 +26,35 @@ internal class TestGraphProviders { private string TestDataPath => Application.dataPath + "/../Data"; + /// + /// Path to JaCoCo GXL file relative to . + /// + private const string jacocoGXL = "/jacoco/jacoco.gxl.xz"; + + /// + /// Path to the JaCoCo report file for the JaCoCo code relative to . + /// + private const string jacocoXML = "/jacoco/jacoco-results.xml"; + + /// + /// Path to the additional metric file for the JaCoCo code relative to . + /// + private const string jacocoCSV = "/jacoco/jacoco.csv"; + [Test] public async Task TestGXLGraphProviderAsync() { SingleGraphProvider provider = new GXLSingleGraphProvider() - { Path = new DataPath(TestDataPath + "/JLGExample/CodeFacts.gxl.xz") }; + { Path = new DataPath(TestDataPath + jacocoGXL) }; Graph loaded = await provider.ProvideAsync(new Graph(""), NewCity()); Assert.That(loaded, Is.Not.Null); - Assert.That(loaded.NodeCount, Is.GreaterThan(0)); - Assert.That(loaded.EdgeCount, Is.GreaterThan(0)); + // The number of nodes in the JaCoCo GXL file can be determined by running the + // following command in our project root of SEE: + // xz -dc ./Data/jacoco.gxl.xz | grep " GetVCSGraphAsync(bool simplifyGraph = false) } /// - /// Returns a new instance. + /// Returns a new instance (attached to a new, + /// otherwise empty . /// - /// + /// New instance. private static SEECity NewCity() { return new GameObject().AddComponent(); diff --git a/Assets/SEETests/TestJacocoImporter.cs b/Assets/SEETests/TestJacocoImporter.cs deleted file mode 100644 index 49fa68c3d4..0000000000 --- a/Assets/SEETests/TestJacocoImporter.cs +++ /dev/null @@ -1,223 +0,0 @@ -using Cysharp.Threading.Tasks; -using NUnit.Framework; -using SEE.DataModel.DG.IO; -using SEE.Utils.Paths; -using System.Collections.Generic; -using System.Threading.Tasks; -using UnityEngine.TestTools; - -namespace SEE.DataModel.DG -{ - /// - /// Unit-Tests for JaCoCoImporter - /// - internal class TestJacocoImporter - { - /// - /// The name of the hierarchical edge type we use for emitting the parent-child - /// relation among nodes. - /// - private const string hierarchicalEdgeType = "Enclosing"; - - /// - /// Load Graph from GXL file . - /// - /// data path of GXL file - /// loaded graph - private static async UniTask LoadGraphAsync(DataPath path) - { - return await GraphReader.LoadAsync(path, new HashSet { hierarchicalEdgeType }, basePath: ""); - } - - /// - /// Folder where the JLGExample data reside. - /// - private static readonly string JLGExampleFolder = DataPath.ProjectFolder() + "/Data/JLGExample"; - - /// - /// The graph that was loaded by before each test case is executed. - /// - private Graph graph; - - [SetUp] - public async Task SetUpAsync() - { - GraphIndex.FileRanges.ReportMissingSourceRange = false; - DataPath gxlPath = new(JLGExampleFolder + "/CodeFacts.gxl.xz"); - DataPath xmlPath = new(JLGExampleFolder + "/jacoco.xml"); - - graph = await LoadGraphAsync(gxlPath); - await JaCoCoImporter.LoadAsync(graph, xmlPath); - } - - [TearDown] - public void TearDown() - { - GraphIndex.FileRanges.ReportMissingSourceRange = true; - graph = null; - } - - /// - /// Test if metrics are set for the project root. In JaCoCo-Test-Report it is named "report". - /// - [Test] - public void AddMetricToRootNode() - { - Node nodeToTest = graph.GetRoots()[0]; - Assert.That(nodeToTest, Is.Not.Null, "The graph must have a root node."); - - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionMissed), Is.EqualTo(1313)); - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionCovered), Is.EqualTo(441)); - - Assert.That(nodeToTest.GetInt(JaCoCo.BranchMissed), Is.EqualTo(101)); - Assert.That(nodeToTest.GetInt(JaCoCo.BranchCovered), Is.EqualTo(27)); - - Assert.That(nodeToTest.GetInt(JaCoCo.LineMissed), Is.EqualTo(330)); - Assert.That(nodeToTest.GetInt(JaCoCo.LineCovered), Is.EqualTo(83)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityMissed), Is.EqualTo(107)); - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityCovered), Is.EqualTo(20)); - - Assert.That(nodeToTest.GetInt(JaCoCo.MethodMissed), Is.EqualTo(55)); - Assert.That(nodeToTest.GetInt(JaCoCo.MethodCovered), Is.EqualTo(8)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ClassMissed), Is.EqualTo(6)); - Assert.That(nodeToTest.GetInt(JaCoCo.ClassCovered), Is.EqualTo(4)); - } - - /// - /// Test if metrics are set for a class node. In JaCoCo-Test-Report it is named "class". - /// - [Test] - public void AddMetricToClassNode() - { - Node nodeToTest = graph.GetNode("counter.CountConsonants"); - Assert.That(nodeToTest, Is.Not.Null, "There is no node counter.CountConsonants."); - - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionMissed), Is.EqualTo(7)); - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionCovered), Is.EqualTo(130)); - - Assert.That(nodeToTest.GetInt(JaCoCo.BranchMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.BranchCovered), Is.EqualTo(6)); - - Assert.That(nodeToTest.GetInt(JaCoCo.LineMissed), Is.EqualTo(3)); - Assert.That(nodeToTest.GetInt(JaCoCo.LineCovered), Is.EqualTo(11)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityMissed), Is.EqualTo(2)); - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityCovered), Is.EqualTo(5)); - - Assert.That(nodeToTest.GetInt(JaCoCo.MethodMissed), Is.EqualTo(2)); - Assert.That(nodeToTest.GetInt(JaCoCo.MethodCovered), Is.EqualTo(2)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ClassMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.ClassCovered), Is.EqualTo(1)); - } - - /// - /// Test if metrics are set for a package node. In JaCoCo-Test-Report it is named "package". - /// - [Test] - public void AddMetricToPackageNode() - { - Node nodeToTest = graph.GetNode("counter"); - Assert.That(nodeToTest, Is.Not.Null, "There is no node counter."); - - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionMissed), Is.EqualTo(31)); - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionCovered), Is.EqualTo(313)); - - Assert.That(nodeToTest.GetInt(JaCoCo.BranchMissed), Is.EqualTo(1)); - Assert.That(nodeToTest.GetInt(JaCoCo.BranchCovered), Is.EqualTo(17)); - - Assert.That(nodeToTest.GetInt(JaCoCo.LineMissed), Is.EqualTo(13)); - Assert.That(nodeToTest.GetInt(JaCoCo.LineCovered), Is.EqualTo(45)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityMissed), Is.EqualTo(9)); - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityCovered), Is.EqualTo(14)); - - Assert.That(nodeToTest.GetInt(JaCoCo.MethodMissed), Is.EqualTo(8)); - Assert.That(nodeToTest.GetInt(JaCoCo.MethodCovered), Is.EqualTo(6)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ClassMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.ClassCovered), Is.EqualTo(3)); - } - - /// - /// Test if metrics are set for a method node. In JaCoCo-Test-Report it is named "method". - /// - [Test] - public void AddMetricToMethodNode() - { - Node nodeToTest = graph.GetNode("counter.CountConsonants.countConsonants(java.lang.String;)"); - Assert.That(nodeToTest, Is.Not.Null, - "There is no node counter.CountConsonants.countConsonants(java.lang.String;)."); - - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionCovered), Is.EqualTo(39)); - - Assert.That(nodeToTest.GetInt(JaCoCo.BranchMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.BranchCovered), Is.EqualTo(6)); - - Assert.That(nodeToTest.GetInt(JaCoCo.LineMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.LineCovered), Is.EqualTo(8)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityCovered), Is.EqualTo(4)); - - Assert.That(nodeToTest.GetInt(JaCoCo.MethodMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.MethodCovered), Is.EqualTo(1)); - } - - /// - /// Here we only test whether data can be read from a URL. The nodes in the - /// referenced file are not actually in the graph. So we expect error - /// messages. Yet, we will add one package node to the graph that we - /// know is contained in the JaCoCo XML file. We will then check whether - /// the metrics are set correctly. There are more nodes in the file, but - /// we will ignore these. - /// - [Test] - public async Task TestLoadAsyncMethodAsync() - { - // Note: LogAssert.Expect(LogType.Error, new Regex(".*No node found for.*")) - // does not work as expected in combination with awaiting an asynchronous - // message. So we have to ignore all error messages. - LogAssert.ignoreFailingMessages = true; - - DataPath path = new() - { - Root = DataPath.RootKind.Url, - Path = "https://raw.githubusercontent.com/vokal/jacoco-parse/master/test/assets/sample.xml" - }; - - // We know this package node exists in the JaCoCo XML file. - Node nodeToTest = new() - { - // Note: In the graph, the separator for qualified names is a dot, whereas a / is used in the - // JaCoCo XML file. - ID = "com.wmbest.myapplicationtest", - Type = "package" - }; - graph.AddNode(nodeToTest); - - await JaCoCoImporter.LoadAsync(graph, path); - - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionMissed), Is.EqualTo(30)); - Assert.That(nodeToTest.GetInt(JaCoCo.InstructionCovered), Is.EqualTo(10)); - - Assert.That(nodeToTest.GetInt(JaCoCo.BranchMissed), Is.EqualTo(3)); - Assert.That(nodeToTest.GetInt(JaCoCo.BranchCovered), Is.EqualTo(1)); - - Assert.That(nodeToTest.GetInt(JaCoCo.LineMissed), Is.EqualTo(10)); - Assert.That(nodeToTest.GetInt(JaCoCo.LineCovered), Is.EqualTo(3)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityMissed), Is.EqualTo(6)); - Assert.That(nodeToTest.GetInt(JaCoCo.ComplexityCovered), Is.EqualTo(1)); - - Assert.That(nodeToTest.GetInt(JaCoCo.MethodMissed), Is.EqualTo(4)); - Assert.That(nodeToTest.GetInt(JaCoCo.MethodCovered), Is.EqualTo(1)); - - Assert.That(nodeToTest.GetInt(JaCoCo.ClassMissed), Is.EqualTo(0)); - Assert.That(nodeToTest.GetInt(JaCoCo.ClassCovered), Is.EqualTo(1)); - } - } -} diff --git a/Assets/SEETests/TestJacocoImporter.cs.meta b/Assets/SEETests/TestJacocoImporter.cs.meta deleted file mode 100644 index 9ff9d22764..0000000000 --- a/Assets/SEETests/TestJacocoImporter.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 537b4d23e882c7f48bfc976a70648aa8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/SEETests/TestMetricImporter.cs b/Assets/SEETests/TestMetricImporter.cs index 796695c2fa..24df146467 100644 --- a/Assets/SEETests/TestMetricImporter.cs +++ b/Assets/SEETests/TestMetricImporter.cs @@ -1,13 +1,13 @@ using Cysharp.Threading.Tasks; using NUnit.Framework; -using SEE.User; +using SEE.UserSettings; using SEE.Utils.Paths; using System.Collections; using System.Text.RegularExpressions; using UnityEngine; using UnityEngine.TestTools; -namespace SEE.DataModel.DG.IO +namespace SEE.DataModel.DG.IO.CSV { /// /// Tests of . @@ -26,7 +26,7 @@ internal class TestMetricImporter public IEnumerator TestLoadCsvAsyncMethod() => UniTask.ToCoroutine(async () => { - LogAssert.Expect(LogType.Error, new Regex($".*There is no {typeof(UserSettings)} component in the current scene!.*")); + LogAssert.Expect(LogType.Error, new Regex($".*There is no {typeof(UserSetting)} component in the current scene!.*")); DataPath path = new() { diff --git a/Assets/SEETests/TestReflexionAnalysis.cs b/Assets/SEETests/TestReflexionAnalysis.cs index d61743f24e..25803434e7 100644 --- a/Assets/SEETests/TestReflexionAnalysis.cs +++ b/Assets/SEETests/TestReflexionAnalysis.cs @@ -5,7 +5,7 @@ using NUnit.Framework.Interfaces; using SEE.DataModel; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Tools.ReflexionAnalysis; using SEE.Utils; using UnityEngine; diff --git a/Assets/SEETests/TestReflexionAnalysisStress.cs b/Assets/SEETests/TestReflexionAnalysisStress.cs index efd061b861..6c71f4acfc 100644 --- a/Assets/SEETests/TestReflexionAnalysisStress.cs +++ b/Assets/SEETests/TestReflexionAnalysisStress.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using UnityEngine; using SEE.DataModel.DG; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.GXL; using SEE.Tools.ReflexionAnalysis; using SEE.Utils; using SEE.Utils.Paths; diff --git a/Assets/SEETests/TestReportGraphProvider/TestCheckstyleReport.cs b/Assets/SEETests/TestReportGraphProvider/TestCheckstyleReport.cs index 747bce1c2a..2583ce6256 100644 --- a/Assets/SEETests/TestReportGraphProvider/TestCheckstyleReport.cs +++ b/Assets/SEETests/TestReportGraphProvider/TestCheckstyleReport.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; /// /// Contains graph provider implementations and related integration tests. diff --git a/Assets/SEETests/TestReportGraphProvider/TestJaCoCoReport.cs b/Assets/SEETests/TestReportGraphProvider/TestJaCoCoReport.cs index 3bebce74ad..e952239394 100644 --- a/Assets/SEETests/TestReportGraphProvider/TestJaCoCoReport.cs +++ b/Assets/SEETests/TestReportGraphProvider/TestJaCoCoReport.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; namespace SEE.GraphProviders { @@ -46,9 +46,9 @@ protected override Dictionary GetTestFindings() { return CreateTestFindings(); } - + public record MetricValue(int? Missed, int? Covered); - + /// /// Builds a metric dictionary for a JaCoCo node. /// For each metric, *_missed, *_covered und *_percentage are entered. @@ -132,7 +132,7 @@ private static Dictionary CreateTestFindings() // COMPLEXITY {missed=3, covered=18} // METHOD {missed=2, covered=16} // CLASS {missed=0, covered=2} - Finding packageFinding = new Finding + Finding packageFinding = new() { FullPath = "org/jacoco/core/tools", FileName = string.Empty, @@ -202,7 +202,7 @@ private static Dictionary CreateTestFindings() methodCovered: 1) }; - Finding execDumpClientClassFinding = new Finding + Finding execDumpClientClassFinding = new() { FullPath = "org/jacoco/core/tools/ExecDumpClient", FileName = "ExecDumpClient.java", @@ -222,7 +222,7 @@ private static Dictionary CreateTestFindings() }; - Finding execDumpClientSleepMethodFinding = new Finding + Finding execDumpClientSleepMethodFinding = new() { FullPath = "org/jacoco/core/tools/ExecDumpClient#sleep", FileName = "ExecDumpClient.java", diff --git a/Assets/SEETests/TestReportGraphProvider/TestMSBuildReport.cs b/Assets/SEETests/TestReportGraphProvider/TestMSBuildReport.cs index c22107ecbe..c29d077fc1 100644 --- a/Assets/SEETests/TestReportGraphProvider/TestMSBuildReport.cs +++ b/Assets/SEETests/TestReportGraphProvider/TestMSBuildReport.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; namespace SEE.GraphProviders { /// - /// Integration-style tests for parsing an MSBuild (C# Compiler) text report and applying the + /// Integration-style tests for parsing an MSBuild (C# Compiler) text report and applying the /// resulting metrics to a graph. /// /// This test class verifies that: @@ -13,8 +13,8 @@ namespace SEE.GraphProviders /// - The regex patterns correctly extract file paths, line numbers, and error details. /// - The individual attributes are correctly formatted into a single, UI-safe ContextLevel.Issue metric string. /// - /// The test data is based on a real-world `errors.log`. The test focuses exclusively on - /// actual syntax errors (CS1002) found within the Assets/SEE directory, + /// The test data is based on a real-world `errors.log`. The test focuses exclusively on + /// actual syntax errors (CS1002) found within the Assets/SEE directory, /// ignoring noise from system assemblies. /// /// Preconditions: @@ -45,8 +45,8 @@ protected override string GetRelativeGlxPath() /// /// Provides the parsing configuration. - /// - /// This uses the updated which maps all capture groups + /// + /// This uses the updated which maps all capture groups /// to a single formatted string metric (ContextLevel.Issue). /// /// A instance configured for MSBuild reports. diff --git a/Assets/SEETests/TestReportGraphProvider/TestNUnitReport.cs b/Assets/SEETests/TestReportGraphProvider/TestNUnitReport.cs index 32b4497b55..259a332ab0 100644 --- a/Assets/SEETests/TestReportGraphProvider/TestNUnitReport.cs +++ b/Assets/SEETests/TestReportGraphProvider/TestNUnitReport.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.Globalization; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; /// /// Providers that load graph data from various sources (files, version control, etc.). diff --git a/Assets/SEETests/TestReportGraphProvider/TestReportGraphProviderBase.cs b/Assets/SEETests/TestReportGraphProvider/TestReportGraphProviderBase.cs index d31de1feaf..c6507fd994 100644 --- a/Assets/SEETests/TestReportGraphProvider/TestReportGraphProviderBase.cs +++ b/Assets/SEETests/TestReportGraphProvider/TestReportGraphProviderBase.cs @@ -2,7 +2,8 @@ using NUnit.Framework; using SEE.DataModel.DG; using SEE.DataModel.DG.GraphIndex; -using SEE.DataModel.DG.IO; +using SEE.DataModel.DG.IO.ReportImports; +using SEE.DataModel.DG.IO.GXL; using SEE.Utils.Paths; using System; using System.Collections.Generic; @@ -404,7 +405,7 @@ public async Task TestMetricAppliedToGraphAsync() // 2. Build Fallback Index (Type/File Map) - REPLICATION of MetricApplier logic. // We need to build this index manually in the test to ensure we can locate the "Container" node // when we only possess the "Clean Logical ID" from the report, but the graph uses "Technical IDs". - Dictionary typeIndex = new Dictionary(); + Dictionary typeIndex = new(); foreach (Node node in graph.Nodes()) { string logicalId = indexNodeStrategy.ToLogicalIdentifier(node); diff --git a/Assets/Scenes/SEENewWorld.unity b/Assets/Scenes/SEENewWorld.unity index 2a79a1c651..4668c3d665 100644 --- a/Assets/Scenes/SEENewWorld.unity +++ b/Assets/Scenes/SEENewWorld.unity @@ -18461,10 +18461,10 @@ MonoBehaviour: Data: 1 - Name: Entry: 4 - Data: 0.921568632 + Data: 0.9215686 - Name: Entry: 4 - Data: 0.0156862754 + Data: 0.01568628 - Name: Entry: 4 Data: 1 @@ -18685,7 +18685,7 @@ MonoBehaviour: Data: - Name: Entry: 7 - Data: 68|SEE.GraphProviders.JaCoCoGraphProvider, SEE + Data: 68|SEE.GraphProviders.ReportGraphProvider, SEE - Name: Path Entry: 7 Data: 69|SEE.Utils.Paths.DataPath, SEE @@ -18701,6 +18701,27 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: ParsingConfig + Entry: 7 + Data: 70|SEE.DataModel.DG.IO.ReportImports.JaCoCoParsingConfig, SEE + - Name: ToolId + Entry: 1 + Data: JaCoCo + - Name: SourceRootMarker + Entry: 1 + Data: + - Name: XPathMapping + Entry: 7 + Data: 71|SEE.DataModel.DG.IO.ReportImports.XPathMapping, SEE + - Name: MetricLocation + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: - Name: Entry: 8 Data: diff --git a/Assets/Scenes/SEEStart.unity b/Assets/Scenes/SEEStart.unity index f6f0ca7455..ccea15d2a8 100644 --- a/Assets/Scenes/SEEStart.unity +++ b/Assets/Scenes/SEEStart.unity @@ -660,7 +660,7 @@ MonoBehaviour: m_GameObject: {fileID: 831127263} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: eccf4ad3f8d39cc46bd0331d97b4c692, type: 3} + m_Script: {fileID: 11500000, guid: 2ffddefd7964be745be7c5cc0be0eb03, type: 3} m_Name: m_EditorClassIdentifier: VoiceChat: 1 diff --git a/Assets/StreamingAssets/jacoco/jacoco.cfg b/Assets/StreamingAssets/jacoco/jacoco.cfg index b00da12f1a..65c12ee46a 100644 --- a/Assets/StreamingAssets/jacoco/jacoco.cfg +++ b/Assets/StreamingAssets/jacoco/jacoco.cfg @@ -51,13 +51,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -90,13 +83,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -129,13 +115,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -168,13 +147,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -207,13 +179,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -246,13 +211,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -285,13 +243,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -324,13 +275,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -363,13 +307,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -402,13 +339,6 @@ NodeTypes : [ }; MinimalBlockLength : 0.00100000; MaximalBlockLength : 1.00000000; - LabelSettings : { - Show : True; - Distance : 0.20000000; - FontSize : 0.40000000; - AnimationDuration : 0.50000000; - LabelAlpha : 1.00000000; - }; AntennnaSettings : { AntennaSections : [ ]; @@ -423,6 +353,7 @@ IgnoreSelfLoopsInLifting : False; MaximalAntennaSegmentHeight : 0.50000000; AntennaWidth : 0.10000000; BaseAnimationDuration : 1.00000000; +Blinks : 5; MetricToColor : [ { name : "Metric.JaCoCo.INSTRUCTION_percentage"; @@ -503,6 +434,7 @@ NodeLayout : { EdgeLayout : { EdgeLayout : "None"; ShowEdges : "Never"; + AnimateEdgeFlow : False; AnimationKind : "None"; AnimateInnerEdges : False; AnimateTransitiveSourceEdges : False; @@ -538,13 +470,28 @@ Markers : { Alpha : 1.00000000; }; }; +LabelSettings : { + Show : True; + Distance : 0.20000000; + FontSize : 0.40000000; + FontColor : { + Red : 1.00000000; + Green : 1.00000000; + Blue : 1.00000000; + Alpha : 1.00000000; + }; + AnimationDuration : 0.50000000; + LabelAlpha : 1.00000000; +}; TooltipSettings : { ShowName : True; ShowType : True; ShowIncomingEdges : False; ShowOutgoingEdges : False; ShowNodeKind : False; - ShowMetric : "Metric.Lines.LOC"; + ShownMetrics : [ + "Metric.Lines.LOC"; + ]; }; data : { kind : "SinglePipeline"; @@ -574,12 +521,16 @@ data : { }; }; { - kind : "JaCoCo"; + kind : "Report"; path : { Root : "StreamingAssets"; RelativePath : "/jacoco/jacoco-2-f5c5b1f831903c9c2f771e467916ce9664aedb1b.xml"; AbsolutePath : ""; }; + ParsingConfig : { + ToolId : "JaCoCo"; + SourceRootMarker : ""; + }; }; ]; }; diff --git a/Axivion/architecture/README.txt b/Axivion/architecture/README.txt new file mode 100644 index 0000000000..d07cbd62ea --- /dev/null +++ b/Axivion/architecture/README.txt @@ -0,0 +1,50 @@ +Runs Axivion's Architecture Verification on SEE + +Please use in the following way: + +1. Set JAVA_HOME + + set "JAVA_HOME=C:\Program Files\Java\jdk-21.0.1" + +2. open an Axivion command prompt + - on Linux / macOS: in a shell source bauhaus-kshrc or bauhaus-cshrc + from the installation directory + - on Windows: open an "Axivion Command Prompt" from the Start Menu + or open a standard command prompt window and run absvars.bat + from the Axivion Installation Directory + +3. optionally start a local dashboard server with the following commands. + This step is only required if you are interested in seeing the Dashboard + presentation of architecture violations. + + - on Linux / macOS: + cd dashboard + ./start_dashboard.sh + - on Windows: + cd dashboard + start_dashboard.sh + + after this, point your browser to http://localhost:9090/axivion to + see the Axivion Dashboard running on your local machine. + +4. cd into the root directory "architecture". + In this location, you can find the following subdirectories: + + rules/ - Python modules that will be executed as part of the Axivion CI + or after by yourself + +5. from the "architecture" directory + (please use the command "cd" to switch into the directory), you can: + + - run the analysis with the command: + start_analysis.bat (Windows) + ./start_analysis.sh (Linux/macOS) + - inspect the project configuration in the Axivion Project Configuration GUI + start_analysis config (Windows) + ./start_analysis.sh config (Linux/macOS) + +7. after the analysis of one project configuration has been executed, + you can inspect results on the Dashboard. + Additionally, you can open the RFG files in Gravis and run the architecture + analysis manually. The RFG files are automatically placed into the + the Axivion\architecture directory within the SEE project folder. diff --git a/Axivion/architecture/config/architecture_config.json b/Axivion/architecture/config/architecture_config.json new file mode 100644 index 0000000000..f3b58793a8 --- /dev/null +++ b/Axivion/architecture/config/architecture_config.json @@ -0,0 +1,66 @@ +{ + "Analysis": { + "Architecture": { + "child_order": [ + "Architecture-ScriptedArchitecture 1", + "ArchitectureCheck", + "Architecture-SaveRFG 1", + "Architecture-Create-Dependencies" + ] + }, + "Architecture-Create-Dependencies": { + "_active": true, + "_copy_from": "Architecture-CustomRFGFunction" + }, + "Architecture-SaveRFG 1": { + "_active": true, + "_copy_from": "Architecture-SaveRFG", + "rfg_file": "../SEE-result.rfg" + }, + "Architecture-ScriptedArchitecture 1": { + "_active": true, + "_copy_from": "Architecture-ScriptedArchitecture", + "architecture_files": [ + "../rules/architecture_common.py", + "../rules/setup_initial.py", + "../rules/create_architecture.py", + "../rules/create_mapping.py", + "../rules/setup_final.py" + ] + }, + "ArchitectureCheck": { + "_active": true, + "_copy_from": "Architecture-ArchitectureCheck", + "base_view_name": "Code Facts", + "csv_output_file": "../reflexion-results.csv", + "declaration_forwarding": false, + "hierarchy_view_name": "Code Facts" + } + }, + "Project": { + "AxivionCompiler 1": { + "_active": false + }, + "Project-GlobalOptions": { + "directory": "../../../", + "ir": null, + "rfg": "SEE.rfg" + } + }, + "Results": { + "Dashboard": { + "ci_mode": { + "provide_ir": { + "provide_in_dashboard": false + } + } + } + }, + "_Format": "1.0", + "_VersionNum": [ + 7, + 11, + 4, + 18993 + ] +} diff --git a/Axivion/architecture/config/axivion_config.json b/Axivion/architecture/config/axivion_config.json new file mode 100644 index 0000000000..db435d507f --- /dev/null +++ b/Axivion/architecture/config/axivion_config.json @@ -0,0 +1,8 @@ +{ + "#": "Note: Evaluation order is from bottom to top", + "_Layers": [ + "../rules/create_dependencies.py", + "ci_config.json", + "compiler_config.json" + ] +} diff --git a/Axivion/architecture/config/ci_config.json b/Axivion/architecture/config/ci_config.json new file mode 100644 index 0000000000..b6f081ad6f --- /dev/null +++ b/Axivion/architecture/config/ci_config.json @@ -0,0 +1,42 @@ +{ + "Project": { + "AxivionCompiler 1": { + "_active": true, + "_copy_from": "AxivionCompiler", + "ir": "$(AXIVION_PROJECT_NAME).ir", + "options": "-j -Isrc", + "source_files": [ + "src/**/*.c" + ] + }, + "BuildSystemIntegration": { + "child_order": [ + "AxivionCompiler 1" + ] + }, + "Project-GlobalOptions": { + "directory": "../../", + "ir": "$(AXIVION_PROJECT_NAME).ir", + "name": "$(AXIVION_PROJECT_NAME)" + }, + "Shadow": { + "_active": true, + "shadow_directory": "$(AXIVION_DATABASES_DIRECTORY)/$(AXIVION_PROJECT_NAME).shadow" + } + }, + "Results": { + "Dashboard": { + "ci_mode": { + "directory": "$(AXIVION_DATABASES_DIRECTORY)" + }, + "dashboard_url": "$(AXIVION_DASHBOARD_URL=)" + } + }, + "_Format": "1.0", + "_VersionNum": [ + 7, + 9, + 0, + 15691 + ] +} diff --git a/Axivion/architecture/config/compiler_config.json b/Axivion/architecture/config/compiler_config.json new file mode 100644 index 0000000000..d9a537bda4 --- /dev/null +++ b/Axivion/architecture/config/compiler_config.json @@ -0,0 +1,15 @@ +{ + "Project": { + "CustomToolchain": { + "_active": true + } + }, + "_Format": "1.0", + "_VersionNum": [ + 7, + 8, + 1, + 15116 + ] +} + \ No newline at end of file diff --git a/Axivion/architecture/dashboard/config/artifacts/README.txt b/Axivion/architecture/dashboard/config/artifacts/README.txt new file mode 100644 index 0000000000..66cd43a188 --- /dev/null +++ b/Axivion/architecture/dashboard/config/artifacts/README.txt @@ -0,0 +1,24 @@ +# Dashboard Artifacts Storage + +The files in this directory are the master-copies of the artifacts of the projects migrated via +/Results/Dashboard/upload=true in axivion_config. + +They are managed by the Dashboard Server and thus should not be manually dealt with. + +Notable exception is e.g. ``cidbman version remove`` for deleting analysis versions +to shrink database size. +Note, that you will need to consult the Dashboard Server ``Projects`` page in order to find out +the current project path as it will change after every analysis run. Also if an analysis +is currently running on an edited database, it won't be able to succeed any more. + +## Backing up the files in this folder +* When backing up files from this folder, be sure to also back up the file ``dashboard2.db`` as well +* It is safer to temporarily stop the Dashboard Server while creating the backup +* Should you need to restore from a backup, please consult ``axivion.support@qt.io`` + +## .trash files +Under certain circumstances, files no longer necessary cannot be deleted. At Dashboard Server +startup, such files are cleaned up. To prevent data loss, when a file is falsely recognized +as not needed anymore, the files are not deleted but renamed to +``old-name.date-when-detected-as-leftover.trash``. The Dashboard server will never delete +(or use) this ``.trash`` files but they can be deleted manually. diff --git a/Axivion/architecture/dashboard/config/dashboard2.config b/Axivion/architecture/dashboard/config/dashboard2.config new file mode 100644 index 0000000000..2a6d4e591c --- /dev/null +++ b/Axivion/architecture/dashboard/config/dashboard2.config @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Axivion/architecture/dashboard/start_dashboard.bat b/Axivion/architecture/dashboard/start_dashboard.bat new file mode 100644 index 0000000000..db4501b456 --- /dev/null +++ b/Axivion/architecture/dashboard/start_dashboard.bat @@ -0,0 +1,22 @@ +:: Starts the Axivion Dashboard. + +@setlocal + +@where /q dashserver || ( + @echo Axivion Suite not in PATH. Please run absvars.bat before calling %0 + @pause + @exit /b 1 +) + +if not exist %~dp0databases ( + mkdir "%~dp0databases" +) + +set "AXIVION_DASHBOARD_CONFIG=%~dp0config" +dashserver start +@if errorlevel 1 ( + @set _errorlevel=%ERRORLEVEL% + @echo %0: error %_errorlevel% + @pause + @exit /b %_errorlevel% +) diff --git a/Axivion/architecture/dashboard/stop_dashboard.bat b/Axivion/architecture/dashboard/stop_dashboard.bat new file mode 100644 index 0000000000..9bfcb19ea8 --- /dev/null +++ b/Axivion/architecture/dashboard/stop_dashboard.bat @@ -0,0 +1,12 @@ +:: Stops the Axivion Dashboard. + +@setlocal + +@where /q dashserver || ( + @echo Axivion Suite not in PATH. Please run absvars.bat before calling %0 + @exit /b 1 +) + +set "AXIVION_DASHBOARD_CONFIG=%~dp0config" +dashserver stop +@exit /b %ERRORLEVEL% diff --git a/Axivion/architecture/rules/architecture_common.py b/Axivion/architecture/rules/architecture_common.py new file mode 100644 index 0000000000..d286d033f2 --- /dev/null +++ b/Axivion/architecture/rules/architecture_common.py @@ -0,0 +1,54 @@ +""" + Helper functions for modules run as part of the scripted architecture and modules + ran later. + + IMPORTANT NOTE: This module is shared by the Python modules executed in the pipeline + of the configuration item Analysis/Architecture/Architecture-ScriptedArchitecture 1/architecture_files + (where it must be placed at the first position) and Python modules running at later + stages of the Axivion CI. +""" +from typing import List + +from bauhaus.rfg import * +from bauhaus.rfg.hierarchies import * + + +def name(node: Node) -> str: + """Returns the name of the node.""" + return node["Source.Name"] + + +# The character used to separate individual names for fully qualified names. +name_separator: str = "." + + +def basename(full_name: str) -> str: + """ + Extracts and returns the last individual name from a fully qualified + name where name_separator is used to separate individual names. + """ + if not full_name: + return "" + + # rsplit('.', 1) splits from the right, exactly once. + # [-1] grabs the last item in the resulting list. + return full_name.rsplit(name_separator, 1)[-1] + + +def linkname(node: Node) -> str: + """Returns the linkage name of the node.""" + return node["Linkage.Name"] + + +def fullname(view: View, node: Node) -> str: + """ + Returns a fully qualified name for the node. + This name consists of the complete list of ancestors + of the node in the node hierarchy given in view + where a period is used as a separator. + """ + parent_node = parent(view, node) + if parent_node is None: + return name(node) + else: + return fullname(view, parent_node) + name_separator + name(node) diff --git a/Axivion/architecture/rules/create_architecture.py b/Axivion/architecture/rules/create_architecture.py new file mode 100644 index 0000000000..59c04e8c4e --- /dev/null +++ b/Axivion/architecture/rules/create_architecture.py @@ -0,0 +1,154 @@ +""" + Creates the nodes of the architecture. There is one architecture + node for each namespace. The resulting architecture-node hierarchy + is isomorphic to the namespace nesting. +""" +from typing import TYPE_CHECKING + +# This is True in PyCharm, but False when you run the script +if TYPE_CHECKING: + from setup_initial import * + from architecture_common import * + + +def new_component(full_name: str, subcomponents: list[Component] = None) -> Component: + if subcomponents is None: + subcomponents = [] + component = Component(basename(full_name), *subcomponents) + component_map[full_name] = component + return component + + +def add_component(node: Node, subcomponents: list[Component] = None) -> Component: + """ + Creates and returns a Component with the given subcomponents + and adds it to the component_map (where its fullname is the key). + """ + if subcomponents is None: + subcomponents = [] + return new_component(fullname(code_facts, node), subcomponents) + + +def add_components(node: Node) -> Component: + """ + Creates Components for all descendants of node. Returns a Component for node. + The resulting Component is added to the component_map. + """ + subcomponents = [] + for sub_ns in sub_components(node): + subcomponents.append(add_components(sub_ns)) + return add_component(node, subcomponents) + + +# Create the architecture model: turn each Namespace into a Component. +# Traverses the node hierarchy bottom up because children must be known +# when their parent is to be created. +for namespace in INPUT_RFG.nodes(code_facts, only_namespaces): + if parent(code_facts, namespace) is None: + ARCH.register(add_components(namespace)) + +# Additional Lexer component for the classes generated by AntLR, which do not +# belong to a namespace. +ARCH.SEE.Scanner.Antlr.register(new_component("SEE.Scanner.Antlr.Lexer")) + +# We allow all SEE code to depend on System. +ARCH.SEE.depends_on(ARCH.System) + + +def add_dependencies(): + # FIXME + # Architecture rule: Each action must access a corresponding Net action. + + # Determined via dominance tree. + ARCH.SEE.UI.HelpSystem.depends_on(ARCH.UnityEngine.Video) + ARCH.SEE.Game.Drawable.depends_on(ARCH.UnityEngine.TextCore) + ARCH.SEE.Game.Evolution.depends_on(ARCH.SEE.Net.Actions.Animation) + ARCH.SEE.UI.RuntimeConfigMenu.depends_on(ARCH.SEE.Net.Actions.RuntimeConfig) + + # Dependencies of SEE on third-party components. + ARCH.SEE.Audio.depends_on(ARCH.SEE.Net.Actions) + ARCH.SEE.CameraPaths.depends_on(ARCH.TinySpline) + ARCH.SEE.Controls.depends_on(ARCH.UnityEngine.Windows.Speech) # Refinement? + ARCH.SEE.DataModel.DG.GraphSearch.depends_on(ARCH.FuzzySharp) + ARCH.SEE.DataModel.DG.GraphSearch.depends_on(ARCH.FuzzySharp.Extractor) + ARCH.SEE.DataModel.DG.GraphSearch.depends_on(ARCH.FuzzySharp.SimilarityRatio.Scorer) + ARCH.SEE.Dissonance.depends_on(ARCH.Dissonance.Networking) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Crosstales.Common.Util) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Crosstales.RTVoice) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Crosstales.RTVoice.Model) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Crosstales.RTVoice.Model.Enum) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Tasks.Components.Containers) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Tasks.Core) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Tasks.Vision.Core) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Tasks.Vision.GestureRecognizer) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Tasks.Vision.HandLandmarker) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Tasks.Vision.PoseLandmarker) + ARCH.SEE.Game.Avatars.depends_on(ARCH.Mediapipe.Unity.Experimental) + ARCH.SEE.Game.Avatars.depends_on(ARCH.RootMotion.FinalIK) + ARCH.SEE.Game.Avatars.depends_on(ARCH.ViveSR.anipal) + ARCH.SEE.Game.Avatars.depends_on(ARCH.ViveSR.anipal.Lip) + ARCH.SEE.GraphProviders.Evolution.depends_on(ARCH.LibGit2Sharp) + ARCH.SEE.GraphProviders.VCS.depends_on(ARCH.LibGit2Sharp) + ARCH.SEE.IDE.depends_on(ARCH.SEE.Utils.IdeRPC) + ARCH.SEE.Layout.depends_on(ARCH.TinySpline) + ARCH.SEE.Net.depends_on(ARCH.Unity.Netcode) + ARCH.SEE.Net.depends_on(ARCH.Unity.Netcode.Components) + ARCH.SEE.Scanner.Antlr.depends_on(ARCH.SEE.Scanner) + ARCH.SEE.Scanner.LSP.depends_on(ARCH.SEE.Scanner) + ARCH.SEE.Scanner.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Models) + ARCH.SEE.Scanner.depends_on(ARCH.SEE.Scanner.Antlr) + ARCH.SEE.Tools.LSP.depends_on(ARCH.Cysharp.Threading.Tasks.Linq) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.JsonRpc.Server) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Client.WorkDone) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Document) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.General) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Progress) + ARCH.SEE.Tools.LSP.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Window) + ARCH.SEE.Tools.LiveKit.depends_on(ARCH.Unity.Netcode) + ARCH.SEE.Tools.OpenTelemetry.depends_on(ARCH.OpenTelemetry) + ARCH.SEE.UI.DebugAdapterProtocol.DebugAdapter.depends_on(ARCH.Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages) + ARCH.SEE.UI.DebugAdapterProtocol.depends_on(ARCH.Michsky.UI.ModernUIPack) + ARCH.SEE.UI.DebugAdapterProtocol.depends_on(ARCH.Microsoft.VisualStudio.Shared.VSCodeDebugProtocol) + ARCH.SEE.UI.DebugAdapterProtocol.depends_on(ARCH.Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages) + ARCH.SEE.UI.DebugAdapterProtocol.depends_on(ARCH.SimpleFileBrowser) + ARCH.SEE.UI.Menu.depends_on(ARCH.Michsky.UI.ModernUIPack) + ARCH.SEE.UI.depends_on(ARCH.DG.Tweening) + ARCH.SEE.UI.depends_on(ARCH.DG.Tweening.Core) + ARCH.SEE.UI.depends_on(ARCH.DG.Tweening.Plugins.Options) + ARCH.SEE.UI.depends_on(ARCH.Michsky.UI.ModernUIPack) + ARCH.SEE.UI.depends_on(ARCH.TMPro) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.JetBrains.Annotations) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.Markdig) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.Markdig.Helpers) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.Markdig.Renderers) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.Markdig.Syntax) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.Markdig.Syntax.Inlines) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.MoreLinq.Extensions) + ARCH.SEE.Utils.Markdown.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Models) + ARCH.SEE.VCS.depends_on(ARCH.LibGit2Sharp) + ARCH.SEE.VCS.depends_on(ARCH.Microsoft.Extensions.FileSystemGlobbing) + ARCH.SEE.XR.depends_on(ARCH.UnityEngine.InputSystem) + ARCH.SEE.XR.depends_on(ARCH.UnityEngine.XR.Interaction.Toolkit) + ARCH.SEE.XR.depends_on(ARCH.UnityEngine.XR.Interaction.Toolkit.Interactables) + ARCH.SEE.XR.depends_on(ARCH.UnityEngine.XR.Interaction.Toolkit.Interactors) + ARCH.SEE.depends_on(ARCH.MoreLinq) + + # FIXME: Need refinement. + ARCH.SEE.UI.Menu.depends_on(ARCH.FuzzySharp) + ARCH.SEE.UI.Menu.depends_on(ARCH.FuzzySharp.Extractor) + ARCH.SEE.UI.Menu.depends_on(ARCH.FuzzySharp.SimilarityRatio.Scorer) + ARCH.SEE.Utils.depends_on(ARCH.Cysharp.Threading.Tasks) + ARCH.SEE.Utils.depends_on(ARCH.Cysharp.Threading.Tasks.Linq) + ARCH.SEE.Utils.depends_on(ARCH.DG.Tweening.Core) + ARCH.SEE.Utils.depends_on(ARCH.DG.Tweening.Plugins.Options) + ARCH.SEE.Utils.depends_on(ARCH.DiffMatchPatch) + ARCH.SEE.Utils.depends_on(ARCH.Joveler.Compression.XZ) + ARCH.SEE.Utils.depends_on(ARCH.Microsoft.Extensions.FileSystemGlobbing) + ARCH.SEE.Utils.depends_on(ARCH.Newtonsoft.Json) + ARCH.SEE.Utils.depends_on(ARCH.OmniSharp.Extensions.LanguageServer.Protocol.Models) + ARCH.SEE.Utils.depends_on(ARCH.Supercluster.KDTree) + ARCH.SEE.Utils.depends_on(ARCH.Supercluster.KDTree.Utilities) + ARCH.SEE.Utils.depends_on(ARCH.TinySpline) + ARCH.SEE.Utils.depends_on(ARCH.UnityEngine.XR.Interaction.Toolkit.Interactors) diff --git a/Axivion/architecture/rules/create_dependencies.py b/Axivion/architecture/rules/create_dependencies.py new file mode 100644 index 0000000000..a0ec7dbf53 --- /dev/null +++ b/Axivion/architecture/rules/create_dependencies.py @@ -0,0 +1,33 @@ +""" + A custom function to be used in the Axivion CI to export the result + of the architecture check. +""" +import axivion.config +from architecture_common import * + +the_analysis = axivion.config.get_analysis() + +# The view containing the result of the reflexion analysis. +reflexion_result = "Architecture Check" + + +def emit_dependencies(graph: Graph) -> Graph: + """ + Outputs all reflexion edges to two files, one of which + has the Python depends_on rules to allow them, the other one has the source, + target, and edge type in CSV format. + """ + with open("dependencies.py", "w") as py_out, open("dependencies.csv", "w") as csv_out: + convergence_type = graph.edge_type("Convergence") + divergence_type = graph.edge_type("Divergence") + reflexion_type = graph.edge_type("Architecture_Check_Result") + v = graph.view(reflexion_result) + for dep in v.xedges(lambda edge: edge.is_of_subtype(reflexion_type)): + if dep.is_of_subtype(convergence_type) or dep.is_of_subtype(divergence_type): + print(f"ARCH.{fullname(v, dep.source())}.depends_on(ARCH.{fullname(v, dep.target())})", file=py_out) + print(f"{fullname(v, dep.source())};{fullname(v, dep.target())};{dep.edge_type().name()}", file=csv_out) + return graph + + +the_analysis.activate('Architecture-CustomRFGFunction') +the_analysis['Architecture-CustomRFGFunction'].function = emit_dependencies diff --git a/Axivion/architecture/rules/create_mapping.py b/Axivion/architecture/rules/create_mapping.py new file mode 100644 index 0000000000..e2323c6b2b --- /dev/null +++ b/Axivion/architecture/rules/create_mapping.py @@ -0,0 +1,40 @@ +""" + Creates the individual mappings. +""" + +from typing import TYPE_CHECKING + +# This is True in PyCharm, but False when you run the script +if TYPE_CHECKING: + from setup_initial import * + from bauhaus.rfg.hierarchies import * + + +def map_onto(full_name: str, target: Component): + """ + Maps the node with the given full_name onto the target component. + """ + names = full_name.split(name_separator) + node = get_node_by_path(code_facts, names) + if node is None: + print(f"No such node name {full_name}") + return + MAPPING.add_concrete_mapping(node, target) + + +def create_mapping(node: Node): + """ + Creates a mapping of given implementation node onto its corresponding Component. + """ + full_name = fullname(code_facts, node) + map_onto(full_name, component_map[full_name]) + +# Map each namespace in code_facts onto the corresponding architecture component +# with the same name. +for namespace in INPUT_RFG.nodes(code_facts, only_namespaces): + create_mapping(namespace) + +map_onto("CSharpLexer", ARCH.SEE.Scanner.Antlr.Lexer) +map_onto("Java9Lexer", ARCH.SEE.Scanner.Antlr.Lexer) +map_onto("PlainTextLexer", ARCH.SEE.Scanner.Antlr.Lexer) +map_onto("PythonLexer", ARCH.SEE.Scanner.Antlr.Lexer) diff --git a/Axivion/architecture/rules/graph_analysis.py b/Axivion/architecture/rules/graph_analysis.py new file mode 100644 index 0000000000..68b5d2d32a --- /dev/null +++ b/Axivion/architecture/rules/graph_analysis.py @@ -0,0 +1,286 @@ +""" + Runs various graph analysis using networkx to learn more about the architecture + and the mapping. +""" +import csv +import os +import sys +import re +from pathlib import Path +from enum import Enum + +import networkx as nx +from bauhaus import rfg + +#from bauhaus.rfg import * + +# This is to be able to write special characters to the Windows console. +sys.stdout.reconfigure(encoding='utf-8') + + +def read_graph_from_csv(filename: str) -> nx.MultiDiGraph: + """ + Reads the CSV data from given filename and returns the corresponding + networkx.graph. The following assumptions about the CSV apply: + 1) there is no header + 2) the first column is the source of an edge + 3) the second column is the target of an edge + 4) the third column is the type of edge + """ + graph = nx.MultiDiGraph() + + # Safely open and read the file. + with open(filename, mode='r', encoding='utf-8') as file: + reader = csv.reader(file, delimiter=';') + + print(f"\n--- Reading data from {filename} ---") + + row_count = 0 + for row in reader: + # print(row) + source = row[0] + target = row[1] + edge_type = row[2] + graph.add_node(source) + graph.add_node(target) + graph.add_edge(source, target, type=edge_type) + row_count += 1 + + print(f"\nSuccessfully read {row_count} rows of data.") + + return graph + + +# The view to be processed. Must exist in the input RFG if there is any. +VIEW: str = "Lifted Code Facts" + + +def read_graph_from_rfg(filename: str) -> nx.MultiDiGraph: + """ + Reads an RFG from filename and yields the corresponding NetworkX graph. + """ + result = nx.MultiDiGraph() + graph = rfg.Graph(filename) + if not graph.is_view_name(VIEW): + print(f"Available views: {graph.view_names()}") + raise ValueError(f"No view named {VIEW}") + view = graph.view(VIEW) + no_nodes: int = 0 + for node in view.xnodes(): + #print(simple_name(node)) + result.add_node(simple_name(node)) + no_nodes = no_nodes + 1 + print(f"Read {no_nodes} nodes") + no_edges: int = 0 + for edge in view.xedges(): + result.add_edge(simple_name(edge.source()), simple_name(edge.target()), type=edge.edge_type()) + no_edges = no_edges + 1 + print(f"Read {no_edges} edges") + return result + + +def simple_name(node: rfg.Node) -> str: + return extract_middle(node["Linkage.Name"]) + + +def extract_middle(text: str) -> str: + """ + Extracts the string between a prefix ending in ':' and a suffix starting with '@'. + Example: 'A:my_target_data@domain.com' -> 'my_target_data' + """ + if not text or ':' not in text or '@' not in text: + return "" + + # split(':', 1)[1] grabs everything after the first colon + # split('@', 1)[0] grabs everything before the first '@' in the remaining string + return text.split(':', 1)[1].split('@', 1)[0] + + +def print_tree(tree, current_node=None, regex: str = "", level=0): + """ + Recursively prints a NetworkX DiGraph representing a tree through nesting. + """ + # Find the root if we're at the very beginning of the recursive loop + at_root: bool = False + if current_node is None: + # A tree's root is the only node with an in-degree of 0 + roots = [n for n, in_degree in tree.in_degree() if in_degree == 0] + if not roots: + print("Error: No root found. Are you sure this is a valid tree?") + return + current_node = roots[0] + at_root = True + + if not at_root and regex != "": + if not re.search(regex, current_node): + return + + # Format and print the current node + indent = " " * level + # Add a little visual marker for children to make it look nicer + marker = "└── " if level > 0 else "" + print(f"{indent}{marker}{current_node}") + + # Find all successors (children) and recurse + for child in tree.successors(current_node): + print_tree(tree, child, regex, level + 1) + + +def get_roots(graph: nx.MultiDiGraph) -> list: + """ + Finds all nodes in a directed graph that do not have any predecessor. + + Args: + graph: The directed graph to analyze. + + Returns: + list: A list of nodes with an in-degree of 0. + """ + # graph.in_degree() returns an InDegreeView, which yields (node, in_degree) tuples + return [node for node, degree in graph.in_degree if degree == 0] + + +def dominance_tree(graph: nx.MultiDiGraph) -> nx.DiGraph: + """ + Returns a dominance tree for given graph. + The edges of the resulting DiGraph have type 'dominates' + and form a tree. The root is the artificial node "ROOT". + """ + print("running dominance analysis") + # Dominance analysis requires a unique root node. + tree = nx.DiGraph() + roots = get_roots(graph) + if len(roots) == 1: + root = roots[0] + elif len(roots) > 1: + root = "ROOT" + graph.add_node(root) + for node in roots: + graph.add_edge(root, node, type="artificial_dep") + else: + print("Error: Graph is cyclic. No root found.") + return tree + dom_tree = nx.immediate_dominators(graph, root) + for dominatee, dominator in dom_tree.items(): + tree.add_edge(dominator, dominatee, type="dominates") + return tree + + +def find_subgraphs(graph: nx.MultiDiGraph): + weak_nodes = list(nx.weakly_connected_components(graph)) + weak_subgraphs = [graph.subgraph(c).copy() for c in weak_nodes] + print(f"Number of subgraph: {len(weak_subgraphs)}") + for g in weak_subgraphs: + print(f"Number of subgraph nodes: {g.number_of_nodes()}") + if g.number_of_nodes() < 11: + for n in g.nodes(): + print(n) + + +def find_cycles(graph: nx.MultiDiGraph): + """ + Prints all cycles in the given graph. + """ + print("finding cycles") + # each cycle is represented by a list of nodes along the cycle. + cycles = list(nx.strongly_connected_components(graph)) + if len(cycles) > 1: + for cycle in cycles: + if len(cycle) > 1: + print(cycle) + else: + print("No cycles") + + +def remove_self_loops(graph: nx.MultiDiGraph): + """ + Removes all self loops of the given graph. A self loop is an + edge from a node to itself. + """ + print("removing self loops") + self_loops = list(nx.selfloop_edges(graph)) + graph.remove_edges_from(self_loops) + + +class Direction(Enum): + FORWARD = 1 + BACKWARD = 2 + BOTH = 3 + + +def sub_context(graph: nx.MultiDiGraph, node: rfg.Node, direction: Direction = Direction.BOTH) -> nx.MultiDiGraph: + if direction == Direction.BOTH: + edges = list(graph.out_edges([node], keys=True)) + edges += list(graph.in_edges([node], keys=True)) + elif direction == Direction.FORWARD: + edges = graph.out_edges(node, keys=True) + elif direction == Direction.BACKWARD: + edges = graph.in_edges(node, keys=True) + result = nx.edge_subgraph(graph, edges) + return result + + +def full_context(graph: nx.MultiDiGraph, node: rfg.Node, direction: Direction = Direction.BOTH) -> nx.MultiDiGraph: + if direction == Direction.BOTH: + neighbors = list(nx.all_neighbors(graph, node)) + elif direction == Direction.FORWARD: + neighbors = list(graph.successors(node)) + elif direction == Direction.BACKWARD: + neighbors = list(graph.predecessors(node)) + neighbors.append(node) + return nx.induced_subgraph(graph, neighbors) + + +def context(graph: nx.MultiDiGraph, node: rfg.Node, direction: Direction = Direction.BOTH, edges_between_neighbors: bool = False) -> nx.MultiDiGraph: + if edges_between_neighbors: + return full_context(graph, node, direction) + else: + return sub_context(graph, node, direction) + + +def slice(graph: nx.MultiDiGraph, node: rfg.Node, direction: Direction, edges_between_neighbors: bool, filename: str) -> nx.MultiDiGraph: + g = context(graph, node, direction, edges_between_neighbors) + nx.drawing.nx_pydot.write_dot(g, filename) + + +if __name__ == "__main__": + # 1. Ensure the user provided exactly one argument (the filename) + # sys.argv[0] is the script name itself, so we need exactly 2 items. + if len(sys.argv) != 2: + print("Usage: python graph_analysis.py ") + sys.exit(1) # Exit the program with an error status + + # Grab the filename from the arguments + filename: str = sys.argv[1] + + # Verify the file actually exists to prevent crashes. + if not os.path.isfile(filename): + print(f"Error: The file '{filename}' could not be found.") + sys.exit(1) + + try: + if filename.endswith(".csv"): + g = read_graph_from_csv(filename) + elif filename.endswith(".rfg"): + g = read_graph_from_rfg(filename) + else: + raise ValueError(f"ERROR: unsupported file extension of {filename}") + + if g.number_of_nodes() == 0: + print("Warning: The graph has no nodes") + sys.exit(1) + + remove_self_loops(g) + find_subgraphs(g) + find_cycles(g) + t = dominance_tree(g) + print_tree(t, regex=r'^SEE.') + nx.drawing.nx_pydot.write_dot(g, Path(filename).stem + ".dot") + slice(g, "SEE.Tools.ReflexionAnalysis", Direction.BOTH, True, Path(filename).stem + "-slice.dot") + slice(g, "SEE.Tools.ReflexionAnalysis", Direction.FORWARD, True, Path(filename).stem + "-forward-slice.dot") + slice(g, "SEE.Tools.ReflexionAnalysis", Direction.BACKWARD, True, Path(filename).stem + "-backward-slice.dot") + + + except Exception as e: + print(f"ERROR: {e}") + sys.exit(1) diff --git a/Axivion/architecture/rules/lift.py b/Axivion/architecture/rules/lift.py new file mode 100644 index 0000000000..0a3471ddd3 --- /dev/null +++ b/Axivion/architecture/rules/lift.py @@ -0,0 +1,62 @@ +#!/usr/bin/env rfgscript + +from bauhaus.shared import bauhaustool +from bauhaus.rfg import Graph, View, Node, EdgeType, NodeSet, EdgeSet, misc, rfgtool +from bauhaus.rfg.hierarchies import * + +INPUTS = { + 'graph': {'doc': 'the input rfg', + 'type': 'rfg', + 'switches': ['--graph', '--rfg', '-r', '--input', '-i'], + }, +} +OUTPUT = 'rfg' + +# All node types that define the nodes to be kept. +CONTAINER_NODE_TYPES = ["Type"] + +# All view names to be reduced +VIEW_NAMES = ["Code Facts"] + + +def lift(graph: Graph) -> Graph: + """ + Returns the resulting modified graph. + """ + for view_name in VIEW_NAMES: + if graph.is_view_name(view_name): + v = graph.view(view_name) + lift_view(v) + else: + print("View %s not found in RFG" % view_name) + return graph + + +def lift_view(view: View): + result = view.lift_edges_totally(view, "Lifted " + view.name()) + for node in result.xnodes(lambda n: not is_container(n)): + result.remove(node) + + +def is_container(node: Node) -> bool: + """ + True if the type of node is any of CONTAINER_NODE_TYPES or their subtypes. + """ + for node_type in CONTAINER_NODE_TYPES: + if node.is_of_subtype(node_type): + return True + return False + + +@rfgtool.with_rfg_types +@bauhaustool.BauhausTool(INPUTS, OUTPUT) +def perform(**kwargs): + graph = kwargs['graph'] + lift(graph) + return graph + + +if __name__ == '__main__': + perform.execute_as_command_line_tool \ + (usage='%prog [options] ', + description='Removes lower-level nodes and lifts their edges.') diff --git a/Axivion/architecture/rules/setup_final.py b/Axivion/architecture/rules/setup_final.py new file mode 100644 index 0000000000..8df7c68149 --- /dev/null +++ b/Axivion/architecture/rules/setup_final.py @@ -0,0 +1,9 @@ +# At the end: create the actual views. + +from typing import TYPE_CHECKING +# This is True in PyCharm, but False when you run the script +if TYPE_CHECKING: + from setup_initial import * + +ARCH.create_view(INPUT_RFG, "Architecture") +MAPPING.create_mapping_view("Mapping") diff --git a/Axivion/architecture/rules/setup_initial.py b/Axivion/architecture/rules/setup_initial.py new file mode 100644 index 0000000000..3e31b05ee5 --- /dev/null +++ b/Axivion/architecture/rules/setup_initial.py @@ -0,0 +1,54 @@ +# import the basic library for creating architectures and mappings +from bauhaus.architecture.scripted_architecture import * +from bauhaus.rfg import * +from bauhaus.rfg.hierarchies import * + +from typing import TYPE_CHECKING +# This is True in PyCharm, but False when you run the script +if TYPE_CHECKING: + from architecture_common import * + +# the global variable INPUT_RFG is provided via scripted_architecture +# Create architecture and mapping abstractions +ARCH = Architecture("Architecture") + +# Mapping of architecture components onto implementation components. +# First parameter is the dependency graph for the implementation. +# Second parameter is the graph view representing the node hierarchy of +# the dependency graph. +MAPPING = Mapping(INPUT_RFG, 'Code Facts') + +# Code Facts view +code_facts = INPUT_RFG.view("Code Facts") + +# Node type of namespaces +namespace_type = INPUT_RFG.node_type("Namespace") +# Node type of types (classes, interfaces). +type_type = INPUT_RFG.node_type("Type") + +# Mapping of the fully qualified name of a Namespace (Linkage.Name) onto +# its corresponding Component. +component_map = {} + +# There is a root "global" and a root ".entry". We do not want them. +for root in roots(code_facts): + if name(root) not in [".entry", "global"]: + raise AssertionError(f"Unexpected root {linkname(root)} found") + print("removing root", name(root)) + code_facts.remove(root) + + +def only_namespaces(node: Node) -> bool: + """True if node has type Namespace.""" + return node.is_of_subtype(namespace_type) + + +def only_types_and_namespaces(node: Node) -> bool: + """True if node has type Namespace or Type (or a subtype thereof).""" + return node.is_of_subtype(namespace_type) or node.is_of_subtype(type_type) + + +def sub_components(node: Node) -> NodeSet: + """Yields all direct children of node to be treated as an architecture component""" + # return children(node, code_facts).filter(only_namespaces) + return children(node, code_facts).filter(only_types_and_namespaces) diff --git a/Axivion/architecture/start_analysis.bat b/Axivion/architecture/start_analysis.bat new file mode 100644 index 0000000000..458dc6f3d6 --- /dev/null +++ b/Axivion/architecture/start_analysis.bat @@ -0,0 +1,20 @@ +:: Runs the Axivion CI or its configuration (the latter if and only +:: if command-line parameter config was set). + +@setlocal + +@where /q cafeCC || ( + @echo Axivion Suite not in PATH. Please run absvars.bat before calling %0 + @exit /b 1 +) + +set "PYTHONPATH=%PYTHONPATH%;%~dp0rules" +set "AXIVION_PROJECT_NAME=SEE" +set "AXIVION_DASHBOARD_URL=http://localhost:9090/axivion" +set "AXIVION_DATABASES_DIRECTORY=%~dp0dashboard\databases" +set "BAUHAUS_CONFIG=%~dp0config\architecture_config.json;%~dp0config\axivion_config.json" +if "%1" == "config" ( + axivion_config || exit /b 1 +) else ( + axivion_ci %* || exit /b 1 +) diff --git a/Axivion/compile.bat b/Axivion/compile.bat index 61669a78a2..d4df40ac17 100644 --- a/Axivion/compile.bat +++ b/Axivion/compile.bat @@ -22,9 +22,9 @@ REM The path to the Unity editor to generate the solution and csproj files. SET "UNITY=C:\Program Files\Unity\Hub\Editor\6000.0.67f1\Editor\Unity.exe" REM The path to AspNetCore.App needed by csharp2rfg. -SET "ASPNETCORE=C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\9.0.13" +SET "ASPNETCORE=C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\9.0.15" -REM goto export +goto generateRFG REM ------------- REM Build Section @@ -37,11 +37,6 @@ REM Note: The Unity Editor cannot run at the same time. -batchmode -nographics -logFile - ^ -executeMethod CITools.SolutionGenerator.Sync -projectPath . -quit -REM Compile C# code into IR -REM build_csproj -msbuild:%MSBUILD% -p:langversion=latest -p:AdditionalOptions="/B%cd%" SEE.csproj -REM Extract RFG from IR -REM ir2rfg Temp\bin\Debug\SEE.dll.ir %RFG% - REM Generate RFG :generateRFG csharp2rfg --library --no_duplicate_edges ^ @@ -52,7 +47,7 @@ csharp2rfg --library --no_duplicate_edges ^ REM Reduce the graph to all components in SEE and only its immediate neighbors. :reduce -REM rfgscript Axivion\reduce.py --graph "%RFG%" "%RFG%" +rfgscript Axivion\reduce.py --graph "%RFG%" "%RFG%" :export REM Export to GXL. diff --git a/Axivion/reduce.py b/Axivion/reduce.py index f82b0233e2..5650d80110 100644 --- a/Axivion/reduce.py +++ b/Axivion/reduce.py @@ -14,7 +14,7 @@ OUTPUT = 'rfg' # All node types that define the nodes to be kept -NODE_TYPES = ["Namespace", "Class"] +NODE_TYPES = ["Namespace", "Class", "Interface"] # All node names (Source.Name) that define the nodes to be kept NODE_NAMES = ["SEE"] # All view names to be reduced diff --git a/Data/JLGExample/CodeFacts.csv b/Data/JLGExample/CodeFacts.csv deleted file mode 100644 index 831089426a..0000000000 --- a/Data/JLGExample/CodeFacts.csv +++ /dev/null @@ -1,2 +0,0 @@ -ID;Metric.Developers -"counter.CountToAThousand.countWithFibbonaci(I;)";3 diff --git a/Data/JLGExample/CodeFacts.gxl.xz b/Data/JLGExample/CodeFacts.gxl.xz deleted file mode 100644 index e923998d7b..0000000000 Binary files a/Data/JLGExample/CodeFacts.gxl.xz and /dev/null differ diff --git a/Data/JLGExample/jacoco.xml b/Data/JLGExample/jacoco.xml deleted file mode 100644 index 651a70a9e6..0000000000 --- a/Data/JLGExample/jacoco.xml +++ /dev/null @@ -1,970 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Data/jacoco/jacoco.csv b/Data/jacoco/jacoco.csv new file mode 100644 index 0000000000..dbf3a16817 --- /dev/null +++ b/Data/jacoco/jacoco.csv @@ -0,0 +1,3 @@ +ID;Metric.Developers +"org.jacoco.core.tools.ExecFileLoader.~ExecFileLoader()";10 +"org.jacoco.core.tools.ExecFileLoader.getExecutionDataStore()";3