Clip保存与读取
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98c54627a956d42e8af1eb21c396109a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -8,16 +9,24 @@ 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 ClipManagementWindow 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(clipManagementWindow.InitializeAsSaveClip);
|
||||
clipLoadButton.onClick.AddListener(clipManagementWindow.InitializeAsLoadClip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user