From 80bcbfbd98f554a19955d18b67b40c7c686d759a Mon Sep 17 00:00:00 2001 From: minenice55 Date: Fri, 5 Jan 2024 22:14:47 -0500 Subject: [PATCH] certain editor shortcuts now exit fullscreen fix color hex input not locking editor shortcuts --- Assets/Scenes/Editor.unity | 9 ++-- Assets/Scripts/LevelEditor/Editor.cs | 52 ++++++------------- .../PropertyPrefabs/ColorPropertyPrefab.cs | 13 +++++ 3 files changed, 33 insertions(+), 41 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index af3a0cdc8..899afd7b1 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -26851,7 +26851,7 @@ MonoBehaviour: m_HandleRect: {fileID: 1589389271} m_Direction: 2 m_Value: 1 - m_Size: 0.9989085 + m_Size: 0.9999814 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -32707,7 +32707,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: 173.14249} + m_AnchoredPosition: {x: 0, y: 171.91833} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &1154875945 @@ -39097,8 +39097,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 459.58514, y: -25} - m_SizeDelta: {x: 879.1703, y: 30} + m_AnchoredPosition: {x: 391.79788, y: -25} + m_SizeDelta: {x: 743.59576, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1443721748 MonoBehaviour: @@ -39119,6 +39119,7 @@ MonoBehaviour: ColorTable: {fileID: 723094753} colorTableActive: 0 colorPreview: {fileID: 1535224921} + hex: {fileID: 426555699} --- !u!1 &1443971064 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index 5a954f7c9..661250671 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -131,6 +131,7 @@ namespace HeavenStudio.Editor public void ShowQuitPopUp(bool show) { + if (fullscreen) Fullscreen(); _confirmQuitMain.SetActive(show); SetAuthoritiveMenu(show); } @@ -167,12 +168,12 @@ namespace HeavenStudio.Editor Fullscreen(); } - if (Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace)) + if ((Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace)) && !fullscreen) { CommandManager.Instance.AddCommand(new Commands.Delete(Selections.instance.eventsSelected.Select(c => c.entity.guid).ToList())); } - if (Input.GetKey(KeyCode.LeftControl)) + if (Input.GetKey(KeyCode.LeftControl) && !fullscreen) { if (Input.GetKeyDown(KeyCode.Z)) { @@ -193,20 +194,13 @@ namespace HeavenStudio.Editor { Timeline.instance.Paste(); } - - if (Input.GetKey(KeyCode.LeftShift)) - { - if (Input.GetKeyDown(KeyCode.D)) - { - ToggleDebugCam(); - } - } } if (Input.GetKey(KeyCode.LeftControl)) { if (Input.GetKeyDown(KeyCode.N)) { + if (fullscreen) Fullscreen(); NewBTN.onClick.Invoke(); } else if (Input.GetKeyDown(KeyCode.O)) @@ -224,6 +218,14 @@ namespace HeavenStudio.Editor { SaveRemix(false); } + + if (Input.GetKey(KeyCode.LeftShift)) + { + if (Input.GetKeyDown(KeyCode.D)) + { + ToggleDebugCam(); + } + } } } #endregion @@ -247,33 +249,6 @@ namespace HeavenStudio.Editor PasteBTN.transform.GetChild(0).GetComponent().color = Color.white; else PasteBTN.transform.GetChild(0).GetComponent().color = Color.gray; - - - if (Timeline.instance.timelineState.selected && Editor.instance.canSelect) - { - /* - if (Input.GetMouseButtonUp(0)) - { - List selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true && c.eligibleToMove == true); - - if (selectedEvents.Count > 0) - { - List result = new List(); - - for (int i = 0; i < selectedEvents.Count; i++) - { - //TODO: this is in LateUpdate, so this will never run! change this to something that works properly - if (!(selectedEvents[i].isCreating || selectedEvents[i].wasDuplicated)) - { - result.Add(selectedEvents[i]); - } - selectedEvents[i].OnUp(); - } - CommandManager.instance.Execute(new Commands.Move(result)); - } - } - */ - } } public static Sprite GameIcon(string name) @@ -360,6 +335,7 @@ namespace HeavenStudio.Editor { if (dialog.GetType() == typeof(RemixPropertiesDialog)) { + if (fullscreen) Fullscreen(); GlobalGameManager.ShowErrorMessage("Set Remix Properties", "Set remix properties before saving."); (dialog as RemixPropertiesDialog).SwitchPropertiesDialog(); (dialog as RemixPropertiesDialog).SetSaveOnClose(true, saveAs); @@ -431,6 +407,7 @@ namespace HeavenStudio.Editor public void LoadRemix(bool create = false) { + if (fullscreen) Fullscreen(); if (create) { GameManager.instance.NewRemix(); @@ -446,6 +423,7 @@ namespace HeavenStudio.Editor public void OpenRemix() { + if (fullscreen) Fullscreen(); var extensions = new[] { new ExtensionFilter("Heaven Studio Remix File ", new string[] { "riq" }), diff --git a/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs/ColorPropertyPrefab.cs b/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs/ColorPropertyPrefab.cs index 4e69b914d..69b5a16e8 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs/ColorPropertyPrefab.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs/ColorPropertyPrefab.cs @@ -20,6 +20,7 @@ namespace HeavenStudio.Editor public RectTransform ColorTable; public bool colorTableActive; public ColorPreview colorPreview; + public TMP_InputField hex; private Color _defaultColor; @@ -27,6 +28,17 @@ namespace HeavenStudio.Editor { InitProperties(propertyName, caption); + hex.onSelect.AddListener( + _ => + Editor.instance.editingInputField = true + ); + hex.onEndEdit.AddListener( + _ => + {; + Editor.instance.editingInputField = false; + } + ); + colorPreview.colorPicker.onColorChanged += _ => { parameterManager.entity[propertyName] = colorPreview.colorPicker.color; @@ -78,6 +90,7 @@ namespace HeavenStudio.Editor { ColorTable.gameObject.SetActive(false); colorTableActive = false; + Editor.instance.editingInputField = false; } } }