From 2b4b7f0a735989115cc435a930525a0055736669 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Fri, 26 Aug 2022 23:43:01 -0400 Subject: [PATCH] make all dialogs inherit one base class - opening a new dialog closes the previous one --- Assets/Scenes/Editor.unity | 275 +++++++++++++++++- .../LevelEditor/DialogHelpers/Dialog.cs | 28 ++ .../LevelEditor/DialogHelpers/Dialog.cs.meta | 11 + Assets/Scripts/LevelEditor/Editor.cs | 12 +- .../NewRemixDialog/NewRemixDialog.cs | 15 +- .../RemixPropertiesDialog.cs | 17 +- .../SettingsDialog/SettingsDialog.cs | 16 +- .../LevelEditor/SnapDialog/SnapDialog.cs | 10 +- .../LevelEditor/TempoFinder/TempoFinder.cs | 10 +- .../Scripts/LevelEditor/Timeline/Timeline.cs | 2 +- 10 files changed, 345 insertions(+), 51 deletions(-) create mode 100644 Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs create mode 100644 Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs.meta diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index fdc614b1..88602962 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -289,7 +289,7 @@ RectTransform: m_Children: - {fileID: 1090919178} m_Father: {fileID: 202724642} - m_RootOrder: 10 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -4058,7 +4058,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -289.15002, y: 2} + m_AnchoredPosition: {x: -289.15, y: 2} m_SizeDelta: {x: -578.29, y: 49.92} m_Pivot: {x: 0.5, y: 0} --- !u!114 &156962255 @@ -5372,6 +5372,7 @@ RectTransform: - {fileID: 1271528577} - {fileID: 1478799965} - {fileID: 1201441976} + - {fileID: 285739499} - {fileID: 1055877578} - {fileID: 3236231} - {fileID: 528192060} @@ -7078,6 +7079,139 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_IsOn: 1 +--- !u!1 &285739498 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 285739499} + - component: {fileID: 285739502} + - component: {fileID: 285739501} + - component: {fileID: 285739500} + m_Layer: 5 + m_Name: ChartParameters + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &285739499 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 285739498} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0000798, y: 1.0000798, z: 1.0000798} + m_Children: + - {fileID: 646945866} + m_Father: {fileID: 202724642} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 295.7, y: 0} + m_SizeDelta: {x: 35, y: 35} + m_Pivot: {x: 0, y: 0.5} +--- !u!114 &285739500 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 285739498} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.7490196, g: 1, b: 1, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 285739501} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1336470763} + m_TargetAssemblyTypeName: HeavenStudio.Editor.RemixPropertiesDialog, Assembly-CSharp + m_MethodName: SwitchPropertiesDialog + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &285739501 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 285739498} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 10 +--- !u!222 &285739502 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 285739498} + m_CullTransparentMesh: 1 --- !u!1 &285804966 GameObject: m_ObjectHideFlags: 0 @@ -11700,7 +11834,7 @@ RectTransform: m_Children: - {fileID: 551314712} m_Father: {fileID: 202724642} - m_RootOrder: 11 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -15587,6 +15721,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 643814082} m_CullTransparentMesh: 1 +--- !u!1 &646945865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 646945866} + - component: {fileID: 646945868} + - component: {fileID: 646945867} + m_Layer: 5 + m_Name: Graphic + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &646945866 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646945865} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 285739499} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 30, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &646945867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646945865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 05e0181d5d7f7144f9263d1ccca41112, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &646945868 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 646945865} + m_CullTransparentMesh: 1 --- !u!1 &657727711 GameObject: m_ObjectHideFlags: 0 @@ -16645,7 +16854,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f32d53b1d58c64e41b71bd7520435169, type: 3} m_Name: m_EditorClassIdentifier: - snapSetter: {fileID: 683816221} + dialog: {fileID: 683816221} snapText: {fileID: 344865319} --- !u!1 &683953387 GameObject: @@ -20908,8 +21117,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1589389272} m_HandleRect: {fileID: 1589389271} m_Direction: 2 - m_Value: 1 - m_Size: 0.99982846 + m_Value: 0 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -22543,7 +22752,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 971914992} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 1336470763} + m_TargetAssemblyTypeName: HeavenStudio.Editor.RemixPropertiesDialog, Assembly-CSharp + m_MethodName: SwitchPropertiesDialog + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!114 &971914992 MonoBehaviour: m_ObjectHideFlags: 0 @@ -24491,11 +24712,11 @@ RectTransform: - {fileID: 837036037} - {fileID: 215482486} m_Father: {fileID: 202724642} - m_RootOrder: 9 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 295.7, y: 0} + m_AnchoredPosition: {x: 335.7, y: 0} m_SizeDelta: {x: 35, y: 35} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1055877579 @@ -24872,6 +25093,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1063174879} + - component: {fileID: 1063174880} m_Layer: 5 m_Name: DialogTemplate m_TagString: Untagged @@ -24901,6 +25123,19 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1063174880 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1063174878} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e317d304732b562489c993ae93ce2265, type: 3} + m_Name: + m_EditorClassIdentifier: + dialog: {fileID: 1063174878} --- !u!1 &1063895373 GameObject: m_ObjectHideFlags: 0 @@ -25697,7 +25932,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -408.98004, y: -17} + m_AnchoredPosition: {x: -408.97998, y: -17} m_SizeDelta: {x: -817.96, y: -46.29} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1118147045 @@ -26866,7 +27101,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 129.91096} + m_AnchoredPosition: {x: 0, y: 129.89534} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -29343,7 +29578,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1b489f3aef16a65499f9596abda39c35, type: 3} m_Name: m_EditorClassIdentifier: - tempoFinder: {fileID: 1265865540} + dialog: {fileID: 1265865540} bpmText: {fileID: 565525426} --- !u!1 &1267250656 GameObject: @@ -32184,7 +32419,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: eedc1c2d03f4b22478ebb914e36371d8, type: 3} m_Name: m_EditorClassIdentifier: - propertiesMenu: {fileID: 1336470761} + dialog: {fileID: 1336470761} --- !u!1 &1337141464 GameObject: m_ObjectHideFlags: 0 @@ -33164,13 +33399,21 @@ MonoBehaviour: FullScreenBTN: {fileID: 151246938} TempoFinderBTN: {fileID: 1478799966} SnapDiagBTN: {fileID: 1201441977} + ChartParamBTN: {fileID: 285739500} EditorThemeBTN: {fileID: 528192061} EditorSettingsBTN: {fileID: 3236232} + Dialogs: + - {fileID: 1962376965} + - {fileID: 683816223} + - {fileID: 1265865542} + - {fileID: 1336470763} + - {fileID: 1946344932} tooltipText: {fileID: 1196204504} fullscreen: 0 discordDuringTesting: 0 canSelect: 1 editingInputField: 0 + inAuthorativeMenu: 0 isCursorEnabled: 1 --- !u!114 &1423699438 MonoBehaviour: @@ -41448,7 +41691,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -84.99005} + m_AnchoredPosition: {x: 0, y: -84.99002} m_SizeDelta: {x: 320, y: -113.92} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 @@ -43288,7 +43531,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d82cc04699de2e54483ca0e0468d9ed2, type: 3} m_Name: m_EditorClassIdentifier: - settingsMenu: {fileID: 1946344930} + dialog: {fileID: 1946344930} --- !u!1 &1946352456 GameObject: m_ObjectHideFlags: 0 @@ -43853,7 +44096,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5e1b2b36751952147bb6126f9ffd6086, type: 3} m_Name: m_EditorClassIdentifier: - diag: {fileID: 1962376963} + dialog: {fileID: 1962376963} --- !u!1 &1964271230 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs b/Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs new file mode 100644 index 00000000..ad446629 --- /dev/null +++ b/Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using HeavenStudio.Editor.Track; + +using TMPro; + +namespace HeavenStudio.Editor +{ + public class Dialog : MonoBehaviour + { + [SerializeField] protected GameObject dialog; + public void ForceState(bool onoff = false) + { + Editor.instance.canSelect = onoff; + Editor.instance.inAuthorativeMenu = !onoff; + dialog.SetActive(onoff); + } + + public static void ResetAllDialogs() + { + foreach(var dialog in FindObjectsOfType()) + { + dialog.ForceState(false); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs.meta b/Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs.meta new file mode 100644 index 00000000..5d6f17e5 --- /dev/null +++ b/Assets/Scripts/LevelEditor/DialogHelpers/Dialog.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e317d304732b562489c993ae93ce2265 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index d2fc6e23..9cbd1bfd 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -52,10 +52,14 @@ namespace HeavenStudio.Editor [SerializeField] private Button FullScreenBTN; [SerializeField] private Button TempoFinderBTN; [SerializeField] private Button SnapDiagBTN; + [SerializeField] private Button ChartParamBTN; [SerializeField] private Button EditorThemeBTN; [SerializeField] private Button EditorSettingsBTN; + [Header("Dialogs")] + [SerializeField] private Dialog[] Dialogs; + [Header("Tooltip")] public TMP_Text tooltipText; @@ -68,8 +72,11 @@ namespace HeavenStudio.Editor public bool discordDuringTesting = false; public bool canSelect = true; public bool editingInputField = false; + public bool inAuthorativeMenu = false; public bool isCursorEnabled = true; + public bool isShortcutsEnabled { get { return (!inAuthorativeMenu) && (!editingInputField); } } + private byte[] MusicBytes; public static Editor instance { get; private set; } @@ -111,6 +118,7 @@ namespace HeavenStudio.Editor Tooltip.AddTooltip(FullScreenBTN.gameObject, "Preview [Tab]"); Tooltip.AddTooltip(TempoFinderBTN.gameObject, "Tempo Finder"); Tooltip.AddTooltip(SnapDiagBTN.gameObject, "Snap Settings"); + Tooltip.AddTooltip(ChartParamBTN.gameObject, "Remix Properties"); Tooltip.AddTooltip(EditorSettingsBTN.gameObject, "Editor Settings [Ctrl+Shift+O]"); UpdateEditorStatus(true); @@ -119,7 +127,7 @@ namespace HeavenStudio.Editor public void LateUpdate() { #region Keyboard Shortcuts - if (!editingInputField) + if (isShortcutsEnabled) { if (Input.GetKeyDown(KeyCode.Tab)) { @@ -160,7 +168,7 @@ namespace HeavenStudio.Editor { if (Input.GetKeyDown(KeyCode.N)) { - NewRemix(); + NewBTN.onClick.Invoke(); } else if (Input.GetKeyDown(KeyCode.O)) { diff --git a/Assets/Scripts/LevelEditor/NewRemixDialog/NewRemixDialog.cs b/Assets/Scripts/LevelEditor/NewRemixDialog/NewRemixDialog.cs index 6090c4cc..d3cf895e 100644 --- a/Assets/Scripts/LevelEditor/NewRemixDialog/NewRemixDialog.cs +++ b/Assets/Scripts/LevelEditor/NewRemixDialog/NewRemixDialog.cs @@ -4,24 +4,23 @@ using UnityEngine; using HeavenStudio.Editor; -public class NewRemixDialog : MonoBehaviour +public class NewRemixDialog : Dialog { - [SerializeField] private GameObject diag; - public void SwitchNewDialog() { - if(diag.activeSelf) { - diag.SetActive(false); + if(dialog.activeSelf) { + dialog.SetActive(false); } else { - diag.SetActive(true); + ResetAllDialogs(); + dialog.SetActive(true); } } public void Confirm() { Editor.instance.NewRemix(); - if(diag.activeSelf) { - diag.SetActive(false); + if(dialog.activeSelf) { + dialog.SetActive(false); } } } diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs index 0c0c7edb..fb094fe1 100644 --- a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs @@ -7,18 +7,21 @@ using TMPro; namespace HeavenStudio.Editor { - public class RemixPropertiesDialog : MonoBehaviour + public class RemixPropertiesDialog : Dialog { - [SerializeField] private GameObject propertiesMenu; - private void Start() {} - public void SwitchSettingsDialog() + public void SwitchPropertiesDialog() { - if(propertiesMenu.activeSelf) { - propertiesMenu.SetActive(false); + if(dialog.activeSelf) { + Editor.instance.canSelect = true; + Editor.instance.inAuthorativeMenu = false; + dialog.SetActive(false); } else { - propertiesMenu.SetActive(true); + ResetAllDialogs(); + Editor.instance.canSelect = false; + Editor.instance.inAuthorativeMenu = true; + dialog.SetActive(true); } } diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs b/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs index 236a1433..a9c5e2f0 100644 --- a/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs +++ b/Assets/Scripts/LevelEditor/SettingsDialog/SettingsDialog.cs @@ -7,19 +7,21 @@ using TMPro; namespace HeavenStudio.Editor { - public class SettingsDialog : MonoBehaviour + public class SettingsDialog : Dialog { - [SerializeField] private GameObject settingsMenu; - //this may all be moved to a different script in the future - private void Start() {} public void SwitchSettingsDialog() { - if(settingsMenu.activeSelf) { - settingsMenu.SetActive(false); + if(dialog.activeSelf) { + Editor.instance.canSelect = true; + Editor.instance.inAuthorativeMenu = false; + dialog.SetActive(false); } else { - settingsMenu.SetActive(true); + ResetAllDialogs(); + Editor.instance.canSelect = false; + Editor.instance.inAuthorativeMenu = true; + dialog.SetActive(true); } } diff --git a/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs b/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs index a51b852a..98001e1a 100644 --- a/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs +++ b/Assets/Scripts/LevelEditor/SnapDialog/SnapDialog.cs @@ -7,9 +7,8 @@ using TMPro; namespace HeavenStudio.Editor { - public class SnapDialog : MonoBehaviour + public class SnapDialog : Dialog { - [SerializeField] private GameObject snapSetter; [SerializeField] private TMP_Text snapText; private Timeline timeline; @@ -22,10 +21,11 @@ namespace HeavenStudio.Editor public void SwitchSnapDialog() { - if(snapSetter.activeSelf) { - snapSetter.SetActive(false); + if(dialog.activeSelf) { + dialog.SetActive(false); } else { - snapSetter.SetActive(true); + ResetAllDialogs(); + dialog.SetActive(true); } } diff --git a/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs b/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs index 459c6c5c..efefdbfe 100644 --- a/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs +++ b/Assets/Scripts/LevelEditor/TempoFinder/TempoFinder.cs @@ -4,9 +4,8 @@ using UnityEngine; namespace HeavenStudio.Editor { - public class TempoFinder : MonoBehaviour + public class TempoFinder : Dialog { - [SerializeField] private GameObject tempoFinder; private bool pressed; private float timePressed; [SerializeField] private BPMText bpmText; @@ -17,12 +16,13 @@ namespace HeavenStudio.Editor } public void SwitchTempoDialog() { - if(tempoFinder.activeSelf) { - tempoFinder.SetActive(false); + if(dialog.activeSelf) { + dialog.SetActive(false); timePressed = 0; bpmText.ResetText(); } else { - tempoFinder.SetActive(true); + ResetAllDialogs(); + dialog.SetActive(true); } } public void TapBPM() diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index fd04b965..de7dc326 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -273,7 +273,7 @@ namespace HeavenStudio.Editor.Track SliderControl(); #region Keyboard Shortcuts - if (!userIsEditingInputField) + if ((!userIsEditingInputField) && Editor.instance.isShortcutsEnabled) { if (Input.GetKeyDown(KeyCode.Space))