HeavenStudioPlus/Assets/Scripts/LevelEditor/RemixPropertiesDialog/RemixPropertiesDialog.cs

98 lines
2.8 KiB
C#
Raw Normal View History

2022-09-03 23:10:27 +00:00
using System;
2022-08-23 14:56:39 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Editor.Track;
using TMPro;
namespace HeavenStudio.Editor
{
public class RemixPropertiesDialog : Dialog
2022-08-23 14:56:39 +00:00
{
2022-09-03 23:46:54 +00:00
[Header("General References")]
[SerializeField] TabsManager tabsManager;
2022-09-02 00:57:47 +00:00
[Header("Editable Properties")]
2022-09-03 23:10:27 +00:00
[SerializeField] PropertyTag[] infoTags;
[SerializeField] PropertyTag[] flavourTags;
2022-09-02 00:57:47 +00:00
[Header("Containers")]
[SerializeField] ChartInfoProperties infoContainer;
// [SerializeField] ChartFlavourProperties flavourContainer;
public DynamicBeatmap chart;
2022-09-03 23:10:27 +00:00
private void Start() { }
2022-08-23 14:56:39 +00:00
public void SwitchPropertiesDialog()
2022-08-23 14:56:39 +00:00
{
2022-09-03 23:10:27 +00:00
if (dialog.activeSelf)
{
2022-09-03 23:46:54 +00:00
tabsManager.CloseContent();
Editor.instance.canSelect = true;
Editor.instance.inAuthorativeMenu = false;
dialog.SetActive(false);
2022-09-03 23:10:27 +00:00
}
else
{
ResetAllDialogs();
2022-09-03 23:46:54 +00:00
infoContainer.Init(this);
//flavourContainer.Init(this);
tabsManager.OpenContent();
Editor.instance.canSelect = false;
Editor.instance.inAuthorativeMenu = true;
dialog.SetActive(true);
2022-09-02 00:57:47 +00:00
}
}
2022-09-03 23:46:54 +00:00
public void SetupDialog()
2022-09-03 23:10:27 +00:00
{
2022-09-02 00:57:47 +00:00
chart = GameManager.instance.Beatmap;
2022-09-03 23:10:27 +00:00
PropertyTag[] tags = infoTags;
2022-09-02 00:57:47 +00:00
int i = 0;
2022-09-03 23:10:27 +00:00
foreach (PropertyTag property in tags)
{
if (chart.properties.ContainsKey(property.tag))
{
infoContainer.AddParam(this, property.tag, chart.properties[property.tag], property.label, property.isReadOnly);
2022-09-02 00:57:47 +00:00
}
else
{
2022-09-03 23:10:27 +00:00
if (property.tag == "divider")
2022-09-02 00:57:47 +00:00
{
2022-09-03 23:46:54 +00:00
infoContainer.AddDivider(this);
2022-09-02 00:57:47 +00:00
}
else if (property.tag == "heading")
{
infoContainer.AddDivider(this);
}
else if (property.tag == "subheading")
{
infoContainer.AddDivider(this);
}
2022-09-02 00:57:47 +00:00
else
{
2022-09-03 23:10:27 +00:00
Debug.LogWarning("Property Menu generation Warning: Property " + property.tag + " not found, skipping...");
2022-09-02 00:57:47 +00:00
}
}
i++;
}
}
2022-09-03 23:10:27 +00:00
private void CleanDialog() {}
2022-08-23 14:56:39 +00:00
private void Update() {}
2022-09-03 23:10:27 +00:00
[Serializable]
public class PropertyTag
{
public string tag;
public string label;
public bool isReadOnly;
}
2022-08-23 14:56:39 +00:00
}
}