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

116 lines
3.6 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 Jukebox;
using Jukebox.Legacy;
2022-08-23 14:56:39 +00:00
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("Containers")]
[SerializeField] ChartInfoProperties[] containers;
2022-09-02 00:57:47 +00:00
[Header("Tabs")]
[SerializeField] private TabsManager.TabsEntry[] tabs;
[Header("Property Prefabs")]
[SerializeField] public GameObject IntegerP;
[SerializeField] public GameObject FloatP;
[SerializeField] public GameObject BooleanP;
[SerializeField] public GameObject DropdownP;
[SerializeField] public GameObject ColorP;
[SerializeField] public GameObject StringP;
[Header("Layout Prefabs")]
[SerializeField] public GameObject DividerP;
[SerializeField] public GameObject HeaderP;
[SerializeField] public GameObject SubHeaderP;
[NonSerialized] public RiqBeatmap chart;
List<GameObject> tabContents;
2022-09-02 00:57:47 +00:00
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)
{
Editor.instance.canSelect = true;
Editor.instance.inAuthorativeMenu = false;
dialog.SetActive(false);
tabsManager.CleanTabs();
tabContents = null;
2022-09-03 23:10:27 +00:00
}
else
{
ResetAllDialogs();
Editor.instance.canSelect = false;
Editor.instance.inAuthorativeMenu = true;
dialog.SetActive(true);
chart = GameManager.instance.Beatmap;
chart["propertiesmodified"] = true;
tabContents = tabsManager.GenerateTabs(tabs);
foreach (var tab in tabContents)
{
tab.GetComponent<ChartInfoProperties>().Init(this);
}
2022-09-02 00:57:47 +00:00
}
}
public void SetupDialog(PropertyTag[] tags, ChartInfoProperties container)
2022-09-03 23:10:27 +00:00
{
2022-09-02 00:57:47 +00:00
chart = GameManager.instance.Beatmap;
chart["propertiesmodified"] = true;
2022-09-02 00:57:47 +00:00
2022-09-03 23:10:27 +00:00
foreach (PropertyTag property in tags)
{
if (chart.data.properties.ContainsKey(property.tag))
2022-09-03 23:10:27 +00:00
{
container.AddParam(this, property.tag, chart.data.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
{
container.AddDivider(this);
2022-09-02 00:57:47 +00:00
}
2022-09-04 02:29:50 +00:00
else if (property.tag == "header")
{
container.AddHeader(this, property.label);
}
2022-09-04 02:29:50 +00:00
else if (property.tag == "subheader")
{
container.AddSubHeader(this, property.label);
}
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
}
}
}
}
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
}
}