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;
|
2023-12-26 05:22:51 +00:00
|
|
|
using UnityEngine.UI;
|
2022-08-23 14:56:39 +00:00
|
|
|
using HeavenStudio.Editor.Track;
|
2023-06-10 19:13:29 +00:00
|
|
|
using Jukebox;
|
|
|
|
using Jukebox.Legacy;
|
2022-08-23 14:56:39 +00:00
|
|
|
|
|
|
|
using TMPro;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Editor
|
|
|
|
{
|
2022-08-27 03:43:01 +00:00
|
|
|
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;
|
2023-12-26 05:22:51 +00:00
|
|
|
[SerializeField] Sprite returnIcon;
|
|
|
|
[SerializeField] Color returnColor;
|
|
|
|
[SerializeField] Sprite saveIcon;
|
|
|
|
[SerializeField] Color saveColor;
|
|
|
|
[SerializeField] Image returnButtonImage;
|
|
|
|
[SerializeField] GameObject onSaveButton;
|
2022-09-03 23:46:54 +00:00
|
|
|
|
2022-09-02 00:57:47 +00:00
|
|
|
[Header("Containers")]
|
2022-09-04 03:17:17 +00:00
|
|
|
[SerializeField] ChartInfoProperties[] containers;
|
2022-09-02 00:57:47 +00:00
|
|
|
|
2023-01-24 19:31:49 +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;
|
2023-12-26 05:22:51 +00:00
|
|
|
[SerializeField] public GameObject ImageP;
|
2023-01-24 19:31:49 +00:00
|
|
|
|
|
|
|
[Header("Layout Prefabs")]
|
|
|
|
[SerializeField] public GameObject DividerP;
|
|
|
|
[SerializeField] public GameObject HeaderP;
|
|
|
|
[SerializeField] public GameObject SubHeaderP;
|
2023-12-26 05:22:51 +00:00
|
|
|
[SerializeField] public GameObject ResultDialogP;
|
2023-01-24 19:31:49 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
[NonSerialized] public RiqBeatmap chart;
|
2023-01-24 19:31:49 +00:00
|
|
|
List<GameObject> tabContents;
|
2023-12-26 05:22:51 +00:00
|
|
|
bool saveAfterClose = false, saveAs = false;
|
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
|
|
|
|
2022-08-27 03:43:01 +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-08-27 03:43:01 +00:00
|
|
|
Editor.instance.canSelect = true;
|
|
|
|
Editor.instance.inAuthorativeMenu = false;
|
2023-12-26 05:22:51 +00:00
|
|
|
Editor.instance.editingInputField = false;
|
2022-08-27 03:43:01 +00:00
|
|
|
dialog.SetActive(false);
|
2023-01-24 19:31:49 +00:00
|
|
|
|
|
|
|
tabsManager.CleanTabs();
|
|
|
|
tabContents = null;
|
2022-09-03 23:10:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-27 03:43:01 +00:00
|
|
|
ResetAllDialogs();
|
|
|
|
Editor.instance.canSelect = false;
|
|
|
|
Editor.instance.inAuthorativeMenu = true;
|
2023-12-26 05:22:51 +00:00
|
|
|
Editor.instance.editingInputField = true;
|
2022-08-27 03:43:01 +00:00
|
|
|
dialog.SetActive(true);
|
2022-09-04 03:17:17 +00:00
|
|
|
|
|
|
|
chart = GameManager.instance.Beatmap;
|
|
|
|
chart["propertiesmodified"] = true;
|
2023-12-26 05:22:51 +00:00
|
|
|
SetSaveOnClose(false);
|
2023-01-24 19:31:49 +00:00
|
|
|
|
|
|
|
tabContents = tabsManager.GenerateTabs(tabs);
|
|
|
|
foreach (var tab in tabContents)
|
|
|
|
{
|
|
|
|
tab.GetComponent<ChartInfoProperties>().Init(this);
|
|
|
|
}
|
2022-09-02 00:57:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-26 05:22:51 +00:00
|
|
|
public void CloseAndSave()
|
|
|
|
{
|
|
|
|
if (saveAfterClose)
|
|
|
|
{
|
|
|
|
Editor.instance.SaveRemix(saveAs);
|
|
|
|
}
|
|
|
|
SwitchPropertiesDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetSaveOnClose(bool saveAfterClose, bool saveAs = false)
|
|
|
|
{
|
|
|
|
this.saveAfterClose = saveAfterClose;
|
|
|
|
this.saveAs = saveAs;
|
|
|
|
|
|
|
|
onSaveButton.SetActive(saveAfterClose);
|
|
|
|
}
|
|
|
|
|
2022-09-04 03:17:17 +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;
|
2022-09-04 03:17:17 +00:00
|
|
|
chart["propertiesmodified"] = true;
|
2022-09-02 00:57:47 +00:00
|
|
|
|
2022-09-03 23:10:27 +00:00
|
|
|
foreach (PropertyTag property in tags)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
if (chart.data.properties.ContainsKey(property.tag))
|
2022-09-03 23:10:27 +00:00
|
|
|
{
|
2023-06-10 19:13:29 +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
|
|
|
{
|
2022-09-04 03:17:17 +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")
|
2022-09-04 01:51:37 +00:00
|
|
|
{
|
2022-09-04 03:17:17 +00:00
|
|
|
container.AddHeader(this, property.label);
|
2022-09-04 01:51:37 +00:00
|
|
|
}
|
2022-09-04 02:29:50 +00:00
|
|
|
else if (property.tag == "subheader")
|
2022-09-04 01:51:37 +00:00
|
|
|
{
|
2022-09-04 03:17:17 +00:00
|
|
|
container.AddSubHeader(this, property.label);
|
2022-09-04 01:51:37 +00:00
|
|
|
}
|
2023-12-26 05:22:51 +00:00
|
|
|
else if (property.tag == "resultmessagediag")
|
|
|
|
{
|
|
|
|
container.AddResultMessageEditor(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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|