From 68c1802e87314cedb0f86626de6d797f171c2432 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sat, 3 Sep 2022 19:46:54 -0400 Subject: [PATCH] use tab manager to control flow --- Assets/Scenes/Editor.unity | 44 ++++++++++++------- .../LevelEditor/DialogHelpers/TabsManager.cs | 8 ++++ .../RemixPropertiesDialog.cs | 17 ++++--- .../Tabs/ChartInfoProperties.cs | 16 +++++++ 4 files changed, 64 insertions(+), 21 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 439a9c5a..6fa4c5a1 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -11863,9 +11863,9 @@ RectTransform: m_Father: {fileID: 1523610371} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 198, y: -25} m_SizeDelta: {x: 132, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &483251987 @@ -16154,7 +16154,7 @@ MonoBehaviour: m_HandleRect: {fileID: 704039020} m_Direction: 0 m_Value: 0 - m_Size: 0.032871284 + m_Size: 0.03287128 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -27223,9 +27223,9 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: -17, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &1063895375 MonoBehaviour: @@ -28236,7 +28236,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.97998, y: -17} + m_AnchoredPosition: {x: -408.98004, y: -17} m_SizeDelta: {x: -817.96, y: -46.29} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1118147045 @@ -29713,7 +29713,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.93517} + m_AnchoredPosition: {x: 0, y: 129.9111} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -30163,6 +30163,7 @@ MonoBehaviour: DropdownP: {fileID: 728113665} ColorP: {fileID: 1651196874} StringP: {fileID: 937032842} + DividerP: {fileID: 1503364107} --- !u!114 &1177777400 MonoBehaviour: m_ObjectHideFlags: 0 @@ -32125,7 +32126,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} @@ -33972,9 +33973,9 @@ RectTransform: m_Father: {fileID: 1523610371} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 66, y: -25} m_SizeDelta: {x: 132, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1308249141 @@ -35189,7 +35190,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1336470762 RectTransform: m_ObjectHideFlags: 0 @@ -35225,6 +35226,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: dialog: {fileID: 1336470761} + tabsManager: {fileID: 1523610372} infoTags: - tag: remixtitle label: Remix Title @@ -35232,6 +35234,18 @@ MonoBehaviour: - tag: remixauthor label: Remix Author isReadOnly: 0 + - tag: divider + label: Divider Idol + isReadOnly: 0 + - tag: idolgenre + label: Song Genre + isReadOnly: 0 + - tag: idolsong + label: Song Name + isReadOnly: 0 + - tag: idolcredit + label: Song Artist + isReadOnly: 0 flavourTags: [] infoContainer: {fileID: 1177777399} chart: @@ -38121,7 +38135,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 15} m_Pivot: {x: 0, y: 1} --- !u!114 &1496522768 MonoBehaviour: @@ -45429,7 +45443,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.99002} + m_AnchoredPosition: {x: 0, y: -84.99005} m_SizeDelta: {x: 320, y: -113.92} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 diff --git a/Assets/Scripts/LevelEditor/DialogHelpers/TabsManager.cs b/Assets/Scripts/LevelEditor/DialogHelpers/TabsManager.cs index 17e6f334..8592cba5 100644 --- a/Assets/Scripts/LevelEditor/DialogHelpers/TabsManager.cs +++ b/Assets/Scripts/LevelEditor/DialogHelpers/TabsManager.cs @@ -23,6 +23,14 @@ namespace HeavenStudio.Editor activeContent.GetComponent().OnOpenTab(); } + public void OpenContent() + { + if (activeContent != null) + { + activeContent.GetComponent().OnOpenTab(); + } + } + public void CloseContent() { if (activeContent != null) diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs index 71ec2dd1..4e2047b3 100644 --- a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs @@ -10,6 +10,9 @@ namespace HeavenStudio.Editor { public class RemixPropertiesDialog : Dialog { + [Header("General References")] + [SerializeField] TabsManager tabsManager; + [Header("Editable Properties")] [SerializeField] PropertyTag[] infoTags; [SerializeField] PropertyTag[] flavourTags; @@ -26,24 +29,26 @@ namespace HeavenStudio.Editor { if (dialog.activeSelf) { + tabsManager.CloseContent(); Editor.instance.canSelect = true; Editor.instance.inAuthorativeMenu = false; dialog.SetActive(false); - - CleanDialog(); } else { ResetAllDialogs(); + + infoContainer.Init(this); + //flavourContainer.Init(this); + + tabsManager.OpenContent(); Editor.instance.canSelect = false; Editor.instance.inAuthorativeMenu = true; dialog.SetActive(true); - - SetupDialog(); } } - private void SetupDialog() + public void SetupDialog() { chart = GameManager.instance.Beatmap; PropertyTag[] tags = infoTags; @@ -60,7 +65,7 @@ namespace HeavenStudio.Editor { if (property.tag == "divider") { - //TODO: prefab that's just a dividing line + infoContainer.AddDivider(this); } else { diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs index 42cac261..11451865 100644 --- a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs @@ -8,6 +8,7 @@ namespace HeavenStudio.Editor { [Header("General References")] [SerializeField] private GameObject propertyHolder; + RemixPropertiesDialog dialog; [Header("Property Prefabs")] [SerializeField] private GameObject IntegerP; @@ -17,6 +18,14 @@ namespace HeavenStudio.Editor [SerializeField] private GameObject ColorP; [SerializeField] private GameObject StringP; + [Header("Layout Prefabs")] + [SerializeField] private GameObject DividerP; + + public void Init(RemixPropertiesDialog diag) + { + dialog = diag; + } + public void AddParam(RemixPropertiesDialog diag, string propertyName, object type, string caption, bool isReadOnly = false, string tooltip = "") { GameObject prefab = IntegerP; @@ -73,6 +82,12 @@ namespace HeavenStudio.Editor } } + public void AddDivider(RemixPropertiesDialog diag) + { + GameObject prefab = DividerP; + InitPrefab(prefab); + } + private GameObject InitPrefab(GameObject prefab, string tooltip = "") { GameObject input = Instantiate(prefab); @@ -88,6 +103,7 @@ namespace HeavenStudio.Editor public override void OnOpenTab() { + dialog.SetupDialog(); } public override void OnCloseTab()