From 434e40274cb9783c7c64a6f405f24f51c359a5ba Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 1 Sep 2022 20:57:47 -0400 Subject: [PATCH] prep auto-population of property menu --- Assets/Scenes/Editor.unity | 22 +++- .../LevelEditor/DialogHelpers/TabsContent.cs | 15 +++ .../DialogHelpers/TabsContent.cs.meta | 11 ++ .../EventSelector/PropertyPrefabs copy.meta | 8 ++ .../PropertyPrefabs.meta | 8 ++ .../BoolChartPropertyPrefab.cs | 37 +++++++ .../BoolChartPropertyPrefab.cs.meta | 11 ++ .../ColorChartPropertyPrefab.cs | 61 +++++++++++ .../ColorChartPropertyPrefab.cs.meta | 11 ++ .../EnumChartPropertyPrefab.cs | 49 +++++++++ .../EnumChartPropertyPrefab.cs.meta | 11 ++ .../NumberChartPropertyPrefab.cs | 101 ++++++++++++++++++ .../NumberChartPropertyPrefab.cs.meta | 11 ++ .../StringChartPropertyPrefab.cs | 44 ++++++++ .../StringChartPropertyPrefab.cs.meta | 11 ++ .../RemixPropertiesDialog.cs | 47 ++++++++ .../RemixPropertyPrefab.cs | 29 +++++ .../RemixPropertyPrefab.cs.meta | 11 ++ .../Tabs/ChartInfoProperties.cs | 39 ++++--- .../SettingsDialog/Tabs/ControllerSettings.cs | 10 +- .../Tabs/CreditsLegalSettings.cs | 10 +- .../SettingsDialog/Tabs/DispAudioSettings.cs | 10 +- .../SettingsDialog/Tabs/EditorSettings.cs | 10 +- 23 files changed, 552 insertions(+), 25 deletions(-) create mode 100644 Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs create mode 100644 Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs.meta create mode 100644 Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs copy.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs.meta create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs create mode 100644 Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs.meta diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index a7774f00..543b0fa8 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -28048,7 +28048,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 137.66667, y: -20} + m_AnchoredPosition: {x: 137.66669, y: -20} m_SizeDelta: {x: 70, y: 40} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1107362316 @@ -29701,7 +29701,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.89537} + m_AnchoredPosition: {x: 0, y: 189.92252} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -30145,7 +30145,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: propertyHolder: {fileID: 1496522766} - propertyNames: [] IntegerP: {fileID: 797336683} FloatP: {fileID: 797336683} BooleanP: {fileID: 2083473857} @@ -35214,6 +35213,21 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: dialog: {fileID: 1336470761} + infoTags: + - remixtitle + infoLabels: + - Remix Title + flavourTags: [] + flavourLabels: [] + infoContainer: {fileID: 1177777399} + chart: + bpm: 0 + musicVolume: 0 + entities: [] + tempoChanges: [] + volumeChanges: [] + beatmapSections: [] + firstBeatOffset: 0 --- !u!1 &1337141464 GameObject: m_ObjectHideFlags: 0 @@ -45262,7 +45276,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.990036} m_SizeDelta: {x: 320, y: -113.92} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 diff --git a/Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs b/Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs new file mode 100644 index 00000000..ae11c500 --- /dev/null +++ b/Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using HeavenStudio.Editor.Track; + +using TMPro; + +namespace HeavenStudio.Editor +{ + public abstract class TabsContent : MonoBehaviour + { + public abstract void OnOpenTab(); + public abstract void OnCloseTab(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs.meta b/Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs.meta new file mode 100644 index 00000000..bcfa1c3a --- /dev/null +++ b/Assets/Scripts/LevelEditor/DialogHelpers/TabsContent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c95e3e333c0372d498ab6cdad5a6ac1d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs copy.meta b/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs copy.meta new file mode 100644 index 00000000..bbab429e --- /dev/null +++ b/Assets/Scripts/LevelEditor/EventSelector/PropertyPrefabs copy.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 28745dfd251ff86468a98978665f553b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs.meta new file mode 100644 index 00000000..b4530c7d --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eccea73a04818a844bc25e6308bc1d05 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs new file mode 100644 index 00000000..ad034dae --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Linq; +using TMPro; +using Starpelly; + +using HeavenStudio.Util; +using HeavenStudio.Editor; + +namespace HeavenStudio.Editor +{ + public class BoolChartPropertyPrefab : RemixPropertyPrefab + { + [Header("Boolean")] + [Space(10)] + public Toggle toggle; + + new public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption) + { + InitProperties(diag, propertyName, caption); + + // ' (bool)type ' always results in false + toggle.isOn = Convert.ToBoolean(parameterManager.chart[propertyName]); + + toggle.onValueChanged.AddListener( + _ => parameterManager.chart[propertyName] = toggle.isOn + ); + } + + private void Update() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs.meta new file mode 100644 index 00000000..e077a855 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/BoolChartPropertyPrefab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5765785c18f751f4196e09d11dd30ff3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs new file mode 100644 index 00000000..c1c08257 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs @@ -0,0 +1,61 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Linq; +using TMPro; +using Starpelly; + +using HeavenStudio.Util; +using HeavenStudio.Editor; + +namespace HeavenStudio.Editor +{ + public class ColorChartPropertyPrefab : RemixPropertyPrefab + { + [Header("Color")] + [Space(10)] + public Button ColorBTN; + public RectTransform ColorTable; + public bool colorTableActive; + public ColorPreview colorPreview; + + new public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption) + { + InitProperties(diag, propertyName, caption); + + colorPreview.colorPicker.onColorChanged += _ => + parameterManager.chart[propertyName] = colorPreview.colorPicker.color; + + Color paramCol = parameterManager.chart[propertyName]; + + ColorBTN.onClick.AddListener( + () => + { + ColorTable.gameObject.SetActive(true); + colorTableActive = true; + colorPreview.ChangeColor(paramCol); + } + ); + + colorPreview.ChangeColor(paramCol); + ColorTable.gameObject.SetActive(false); + } + + private void Update() + { + if (colorTableActive) + { + if (!Editor.MouseInRectTransform(ColorTable)) + { + if (Input.GetMouseButtonDown(0)) + { + ColorTable.gameObject.SetActive(false); + colorTableActive = false; + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs.meta new file mode 100644 index 00000000..aa82341d --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/ColorChartPropertyPrefab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83f718678c662f9448813df185f1283f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs new file mode 100644 index 00000000..9a66e55c --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Linq; +using TMPro; +using Starpelly; + +using HeavenStudio.Util; +using HeavenStudio.Editor; + +namespace HeavenStudio.Editor +{ + public class EnumChartPropertyPrefab : RemixPropertyPrefab + { + [Header("Dropdown")] + [Space(10)] + public TMP_Dropdown dropdown; + + new public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption) + { + InitProperties(diag, propertyName, caption); + + var enumType = type.GetType(); + var enumVals = Enum.GetValues(enumType); + var enumNames = Enum.GetNames(enumType).ToList(); + + // Can we assume non-holey enum? + // If we can we can simplify to dropdown.value = (int) parameterManager.chart[propertyName] + var currentlySelected = (int) parameterManager.chart[propertyName]; + var selected = enumVals + .Cast() + .ToList() + .FindIndex(val => (int) val == currentlySelected); + + dropdown.AddOptions(enumNames); + dropdown.value = selected; + + dropdown.onValueChanged.AddListener(_ => + parameterManager.chart[propertyName] = (int) enumVals.GetValue(dropdown.value) + ); + } + + private void Update() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs.meta new file mode 100644 index 00000000..40e71924 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/EnumChartPropertyPrefab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bddf1f894c08d91429a4a36f21a3c10e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs new file mode 100644 index 00000000..54f164de --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs @@ -0,0 +1,101 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Linq; +using TMPro; +using Starpelly; + +using HeavenStudio.Util; +using HeavenStudio.Editor; + +namespace HeavenStudio.Editor +{ + public class NumberChartPropertyPrefab : RemixPropertyPrefab + { + [Header("Integer and Float")] + [Space(10)] + public Slider slider; + public TMP_InputField inputField; + + new public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption) + { + InitProperties(diag, propertyName, caption); + + switch (type) + { + case EntityTypes.Integer integer: + slider.minValue = integer.min; + slider.maxValue = integer.max; + + slider.wholeNumbers = true; + slider.value = Convert.ToSingle(parameterManager.chart[propertyName]); + inputField.text = slider.value.ToString(); + + slider.onValueChanged.AddListener( + _ => + { + inputField.text = slider.value.ToString(); + parameterManager.chart[propertyName] = (int) slider.value; + } + ); + + inputField.onSelect.AddListener( + _ => + Editor.instance.editingInputField = true + ); + + inputField.onEndEdit.AddListener( + _ => + { + slider.value = Convert.ToSingle(inputField.text); + parameterManager.chart[propertyName] = (int) slider.value; + Editor.instance.editingInputField = false; + } + ); + break; + + case EntityTypes.Float fl: + slider.minValue = fl.min; + slider.maxValue = fl.max; + + slider.value = Convert.ToSingle(parameterManager.chart[propertyName]); + inputField.text = slider.value.ToString("G"); + + slider.onValueChanged.AddListener( + _ => + { + var newValue = (float) Math.Round(slider.value, 4); + inputField.text = newValue.ToString("G"); + parameterManager.chart[propertyName] = newValue; + } + ); + + inputField.onSelect.AddListener( + _ => + Editor.instance.editingInputField = true + ); + + inputField.onEndEdit.AddListener( + _ => + { + slider.value = (float) Math.Round(Convert.ToSingle(inputField.text), 4); + parameterManager.chart[propertyName] = slider.value; + Editor.instance.editingInputField = false; + } + ); + break; + + default: + throw new ArgumentOutOfRangeException( + nameof(type), type, "I don't know how to make a property of this type!" + ); + } + } + + private void Update() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs.meta new file mode 100644 index 00000000..ac331387 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/NumberChartPropertyPrefab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3541b2824368eef4b94655619c05c3bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs new file mode 100644 index 00000000..8a142ab0 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs @@ -0,0 +1,44 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Linq; +using TMPro; +using Starpelly; + +using HeavenStudio.Util; +using HeavenStudio.Editor; + +namespace HeavenStudio.Editor +{ + public class StringChartPropertyPrefab : RemixPropertyPrefab + { + [Header("String")] //why wasn't this a thing before + [Space(10)] + public TMP_InputField inputFieldString; + + new public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption) + { + InitProperties(diag, propertyName, caption); + + inputFieldString.text = (string) parameterManager.chart[propertyName]; + + inputFieldString.onSelect.AddListener( + _ => + Editor.instance.editingInputField = true + ); + inputFieldString.onEndEdit.AddListener( + _ => + {; + parameterManager.chart[propertyName] = inputFieldString.text; + Editor.instance.editingInputField = false; + } + ); + } + + private void Update() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs.meta new file mode 100644 index 00000000..286c6585 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/PropertyPrefabs/StringChartPropertyPrefab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1d094b0b57b4a1945a8ca587d9478b75 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs index fb094fe1..ff6fc1bd 100644 --- a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs @@ -9,6 +9,18 @@ namespace HeavenStudio.Editor { public class RemixPropertiesDialog : Dialog { + [Header("Editable Properties")] + [SerializeField] string[] infoTags; + [SerializeField] string[] infoLabels; + [SerializeField] string[] flavourTags; + [SerializeField] string[] flavourLabels; + + [Header("Containers")] + [SerializeField] ChartInfoProperties infoContainer; + // [SerializeField] ChartFlavourProperties flavourContainer; + + public DynamicBeatmap chart; + private void Start() {} public void SwitchPropertiesDialog() @@ -17,11 +29,46 @@ namespace HeavenStudio.Editor Editor.instance.canSelect = true; Editor.instance.inAuthorativeMenu = false; dialog.SetActive(false); + + CleanDialog(); } else { ResetAllDialogs(); Editor.instance.canSelect = false; Editor.instance.inAuthorativeMenu = true; dialog.SetActive(true); + + SetupDialog(); + } + } + + private void SetupDialog() { + chart = GameManager.instance.Beatmap; + string[] tags = infoTags; + string[] labels = infoLabels; + int i = 0; + + foreach (string property in tags) { + if (chart.properties.ContainsKey(property)) { + infoContainer.AddParam(this, property, chart.properties[property], labels[i]); + } + else + { + if (property == "divider") + { + //TODO: prefab that's just a dividing line + } + else + { + Debug.LogWarning("Property Menu generation Warning: Property " + property + " not found"); + } + } + i++; + } + } + + private void CleanDialog() { + foreach (Transform child in dialog.transform) { + Destroy(child.gameObject); } } diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs new file mode 100644 index 00000000..e3a3d78a --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs @@ -0,0 +1,29 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using System; +using System.Linq; +using TMPro; +using Starpelly; + +using HeavenStudio.Util; + +namespace HeavenStudio.Editor +{ + public class RemixPropertyPrefab : MonoBehaviour + { + public TMP_Text caption; + public RemixPropertiesDialog parameterManager; + public string propertyName; + + public void SetProperties(RemixPropertiesDialog diag, string propertyName, object type, string caption) {} + + public void InitProperties(RemixPropertiesDialog diag, string propertyName, string caption) + { + this.parameterManager = diag; + this.propertyName = propertyName; + this.caption.text = caption; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs.meta b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs.meta new file mode 100644 index 00000000..8f855936 --- /dev/null +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertyPrefab.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2483aa618d773c143857f608a2d2d32a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs index a7e1df5a..9cba7704 100644 --- a/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs +++ b/Assets/Scripts/LevelEditor/RemixPropertiesDialog/Tabs/ChartInfoProperties.cs @@ -4,14 +4,11 @@ using TMPro; namespace HeavenStudio.Editor { - public class ChartInfoProperties : MonoBehaviour + public class ChartInfoProperties : TabsContent { [Header("General References")] [SerializeField] private GameObject propertyHolder; - [Header("Editable Properties")] - [SerializeField] private string[] propertyNames; - [Header("Property Prefabs")] [SerializeField] private GameObject IntegerP; [SerializeField] private GameObject FloatP; @@ -20,7 +17,7 @@ namespace HeavenStudio.Editor [SerializeField] private GameObject ColorP; [SerializeField] private GameObject StringP; - private void AddParam(string propertyName, object type, string caption, string tooltip = "") + public void AddParam(RemixPropertiesDialog diag, string propertyName, object type, string caption, string tooltip = "") { GameObject prefab = IntegerP; GameObject input; @@ -31,43 +28,43 @@ namespace HeavenStudio.Editor { prefab = IntegerP; input = InitPrefab(prefab, tooltip); - var property = input.GetComponent(); - property.SetProperties(propertyName, type, caption); + var property = input.GetComponent(); + property.SetProperties(diag, propertyName, type, caption); } else if (objType == typeof(EntityTypes.Float)) { prefab = FloatP; input = InitPrefab(prefab, tooltip); - var property = input.GetComponent(); - property.SetProperties(propertyName, type, caption); + var property = input.GetComponent(); + property.SetProperties(diag, propertyName, type, caption); } else if (type is bool) { prefab = BooleanP; input = InitPrefab(prefab, tooltip); - var property = input.GetComponent(); - property.SetProperties(propertyName, type, caption); + var property = input.GetComponent(); + property.SetProperties(diag, propertyName, type, caption); } else if (objType.IsEnum) { prefab = DropdownP; input = InitPrefab(prefab, tooltip); - var property = input.GetComponent(); - property.SetProperties(propertyName, type, caption); + var property = input.GetComponent(); + property.SetProperties(diag, propertyName, type, caption); } else if (objType == typeof(Color)) { prefab = ColorP; input = InitPrefab(prefab, tooltip); - var property = input.GetComponent(); - property.SetProperties(propertyName, type, caption); + var property = input.GetComponent(); + property.SetProperties(diag, propertyName, type, caption); } else if (objType == typeof(string)) { prefab = StringP; input = InitPrefab(prefab, tooltip); - var property = input.GetComponent(); - property.SetProperties(propertyName, type, caption); + var property = input.GetComponent(); + property.SetProperties(diag, propertyName, type, caption); } else { @@ -88,5 +85,13 @@ namespace HeavenStudio.Editor return input; } + + public override void OnOpenTab() + { + } + + public override void OnCloseTab() + { + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/ControllerSettings.cs b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/ControllerSettings.cs index 2fc2adfb..e883751b 100644 --- a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/ControllerSettings.cs +++ b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/ControllerSettings.cs @@ -12,7 +12,7 @@ using static JSL; namespace HeavenStudio.Editor { - public class ControllerSettings : MonoBehaviour + public class ControllerSettings : TabsContent { [SerializeField] private TMP_Text numConnectedLabel; [SerializeField] private TMP_Text currentControllerLabel; @@ -245,5 +245,13 @@ namespace HeavenStudio.Editor yield return new WaitForSeconds(0.25f); JslSetRumbleFrequency(controller.GetHandle(), 0f, 0f, 0f, 0f); } + + public override void OnOpenTab() + { + } + + public override void OnCloseTab() + { + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/CreditsLegalSettings.cs b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/CreditsLegalSettings.cs index 21b9a731..3c34ed4e 100644 --- a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/CreditsLegalSettings.cs +++ b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/CreditsLegalSettings.cs @@ -9,7 +9,7 @@ using TMPro; namespace HeavenStudio.Editor { - public class CreditsLegalSettings : MonoBehaviour + public class CreditsLegalSettings : TabsContent { private int SecretCounter = 0; private bool SecretActive = false; @@ -50,5 +50,13 @@ namespace HeavenStudio.Editor SecretActive = false; secretContent.CloseDanceWindow(); } + + public override void OnOpenTab() + { + } + + public override void OnCloseTab() + { + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs index 4de43ffa..af5460c6 100644 --- a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs +++ b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs @@ -6,7 +6,7 @@ using TMPro; namespace HeavenStudio.Editor { - public class DispAudioSettings : MonoBehaviour + public class DispAudioSettings : TabsContent { public TMP_Dropdown resolutionsDropdown; public GameObject customSetter; @@ -71,5 +71,13 @@ namespace HeavenStudio.Editor volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text) / 100f, 2); GlobalGameManager.ChangeMasterVolume(volSlider.value); } + + public override void OnOpenTab() + { + } + + public override void OnCloseTab() + { + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/EditorSettings.cs b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/EditorSettings.cs index 1d05e73e..26b084e7 100644 --- a/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/EditorSettings.cs +++ b/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/EditorSettings.cs @@ -4,7 +4,7 @@ using TMPro; namespace HeavenStudio.Editor { - public class EditorSettings : MonoBehaviour + public class EditorSettings : TabsContent { public Toggle cursorCheckbox; @@ -16,5 +16,13 @@ namespace HeavenStudio.Editor GameManager.instance.CursorCam.enabled = Editor.instance.isCursorEnabled; } } + + public override void OnOpenTab() + { + } + + public override void OnCloseTab() + { + } } } \ No newline at end of file