98 lines
4.0 KiB
C#
98 lines
4.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.Editor
|
|
{
|
|
public partial class ToolBar : StaticWindow
|
|
{
|
|
[Title("Buttons")]
|
|
public Button projectInfoButton;
|
|
public Button songInfoButton;
|
|
public Button saveButton;
|
|
public Button exportButton;
|
|
public Button clipSaveButton;
|
|
public Button clipLoadButton;
|
|
|
|
[Title("Windows")]
|
|
public GeneralSecondaryWindow clipManagementWindow;
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
saveButton.onClick.AddListener(EditorManager.instance.projectManager.saveManager.Save);
|
|
exportButton.onClick.AddListener(EditorManager.instance.projectManager.exportManager.Export);
|
|
clipSaveButton.onClick.AddListener(GenerateSaveClipWindow);
|
|
clipLoadButton.onClick.AddListener(GenerateLoadClipWindow);
|
|
}
|
|
}
|
|
|
|
public partial class ToolBar
|
|
{
|
|
private void GenerateSaveClipWindow()
|
|
{
|
|
GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElement;
|
|
|
|
if (currentElement == null)
|
|
{
|
|
LogWindow.Log("No Game Element selected.", Color.red);
|
|
return;
|
|
}
|
|
|
|
if (clipManagementWindow != null)
|
|
{
|
|
LogWindow.Log("Clip Management Window already exists.", Color.red);
|
|
return;
|
|
}
|
|
|
|
GeneralSecondaryWindow saveClipWindow =
|
|
Instantiate(EditorManager.instance.basePrefabs.generalSecondaryWindow,
|
|
EditorManager.instance.uiManager.mainPage.mainCanvas.GetComponent<RectTransform>()).GetComponent<GeneralSecondaryWindow>();
|
|
clipManagementWindow = saveClipWindow;
|
|
saveClipWindow.Initialize("Save Clip: " + currentElement.elementName, () => clipManagementWindow = null);
|
|
|
|
var container = saveClipWindow.GenerateContainer();
|
|
var clipNameInputField = saveClipWindow.GenerateInputField(container, "Clip Name", currentElement.elementName);
|
|
var applyClipButton = saveClipWindow.GenerateButton(container, "Apply", () =>
|
|
{
|
|
EditorManager.instance.projectManager.beatmapClipManager.SaveClip(clipNameInputField.GetValue<string>());
|
|
});
|
|
}
|
|
|
|
private void GenerateLoadClipWindow()
|
|
{
|
|
GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElement;
|
|
|
|
if (currentElement == null)
|
|
{
|
|
LogWindow.Log("No Game Element selected.", Color.red);
|
|
return;
|
|
}
|
|
|
|
GameElement loadTarget = currentElement == EditorManager.instance ? null : currentElement.parentElement;
|
|
|
|
if (clipManagementWindow != null)
|
|
{
|
|
LogWindow.Log("Clip Management Window already exists.", Color.red);
|
|
return;
|
|
}
|
|
|
|
GeneralSecondaryWindow loadClipWindow =
|
|
Instantiate(EditorManager.instance.basePrefabs.generalSecondaryWindow,
|
|
EditorManager.instance.uiManager.mainPage.mainCanvas.GetComponent<RectTransform>()).GetComponent<GeneralSecondaryWindow>();
|
|
clipManagementWindow = loadClipWindow;
|
|
loadClipWindow.Initialize("Load Clip", () => clipManagementWindow = null);
|
|
|
|
var container = loadClipWindow.GenerateContainer();
|
|
var clipNameInputField = loadClipWindow.GenerateInputField(container, "Clip Name");
|
|
var applyClipButton = loadClipWindow.GenerateButton(container, "Apply", () =>
|
|
{
|
|
EditorManager.instance.projectManager.beatmapClipManager.LoadClip(clipNameInputField.GetValue<string>());
|
|
});
|
|
}
|
|
}
|
|
} |