using System.Collections; using System.Collections.Generic; using Ichni.RhythmGame; using TMPro; using UnityEngine; using UnityEngine.UI; namespace Ichni.Editor { public class ClipManagementWindow : MovableWindow { public TMP_InputField clipNameInputField; public Button applyClipButton; public void InitializeAsSaveClip() { GameElement currentElement = EditorManager.instance.operationManager.currentSelectedElement; if (currentElement == null) { LogWindow.Log("No Game Element selected.", Color.red); return; } if (!OpenWindow()) { return; } InitializeWindow("Save Clip: " + currentElement.elementName); clipNameInputField.text = currentElement.elementName; applyClipButton.onClick.RemoveAllListeners(); applyClipButton.onClick.AddListener(() => { EditorManager.instance.projectManager.beatmapClipManager.Save(clipNameInputField.text); gameObject.SetActive(false); }); } public void InitializeAsLoadClip() { if (!OpenWindow()) { return; } InitializeWindow("Load Clip"); clipNameInputField.text = ""; applyClipButton.onClick.RemoveAllListeners(); applyClipButton.onClick.AddListener(() => { EditorManager.instance.projectManager.beatmapClipManager.Load(clipNameInputField.text); gameObject.SetActive(false); }); } private bool OpenWindow() { if (EditorManager.instance.uiManager.mainPage.toolBar.clipManagementWindow.gameObject.activeSelf) { LogWindow.Log("Clip Management Window is already active."); return false; } gameObject.SetActive(true); return true; } } }