Note inspector调整,Static Window可开关,Log可复制清空

This commit is contained in:
SoulliesOfficial
2025-02-24 15:20:54 -05:00
parent 935cbbb029
commit 1b4637ae95
39 changed files with 2556 additions and 121 deletions

View File

@@ -21,12 +21,12 @@ namespace Ichni.Editor
dropdown.onValueChanged.AddListener((value) => ApplyParameters(dropdown.options[value].text) );
}
public void SetUpStringList(List<string> stringList)
public void SetUpStringList(List<string> originalList)
{
this.stringList = stringList;
this.stringList.AddRange(originalList);
this.stringList.Insert(0, "Please Select..."); // Add a default value "Please Select...
dropdown.ClearOptions();
dropdown.AddOptions(stringList);
dropdown.AddOptions(this.stringList);
}
private void ApplyParameters(string value)

View File

@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
public class EnableButtonGroup : MonoBehaviour
{
public Button enableButton;
public Button disableButton;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9e35201c989394f039d7a198ccd53d65
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,20 +3,30 @@ using System.Collections;
using System.Collections.Generic;
using Lean.Pool;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace Ichni.Editor
{
public class LogWindow : MonoBehaviour
public class LogWindow : StaticWindow
{
public GameObject logTextPrefab;
List<string> savedTexts;
public RectTransform textRect;
public Button copyAllTextsButton;
public Button removeAllTextsButton;
public Queue<LogText> logTexts;
public int logTextCapacity = 4;
private void Start()
protected override void Start()
{
base.Start();
savedTexts = new List<string>();
logTexts = new Queue<LogText>();
copyAllTextsButton.onClick.AddListener(CopyAllText);
removeAllTextsButton.onClick.AddListener(RemoveAllText);
}
public static void Log(string text, Color color = default)
@@ -29,6 +39,7 @@ namespace Ichni.Editor
CheckLogTextCapacity();
LogText logText = LeanPool.Spawn(logTextPrefab, textRect).GetComponent<LogText>();
if (color == default) color = Color.white;
savedTexts.Add(text);
logText.SetLogText(text, color);
logTexts.Enqueue(logText);
}
@@ -40,5 +51,26 @@ namespace Ichni.Editor
LeanPool.Despawn(logTexts.Dequeue().gameObject);
}
}
private void CopyAllText()
{
string allText = "";
foreach (string text in savedTexts)
{
allText += text + "\n";
}
GUIUtility.systemCopyBuffer = allText;
}
private void RemoveAllText()
{
foreach (LogText logText in logTexts)
{
LeanPool.Despawn(logText.gameObject);
}
logTexts.Clear();
savedTexts.Clear();
}
}
}

View File

@@ -6,18 +6,18 @@ using UnityEngine.UI;
namespace Ichni.Editor
{
public partial class ToolBar : MonoBehaviour
public partial class ToolBar : StaticWindow
{
public Button projectInfoButton;
public Button songInfoButton;
public Button saveButton;
public Button exportButton;
private void Start()
protected override void Start()
{
base.Start();
saveButton.onClick.AddListener(EditorManager.instance.projectManager.saveManager.Save);
exportButton.onClick.AddListener(EditorManager.instance.projectManager.exportManager.Export);
}
}

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -6,6 +7,29 @@ namespace Ichni.Editor
{
public abstract class StaticWindow : MonoBehaviour
{
public EnableButtonGroup enableButtonGroup;
protected virtual void Start()
{
if (enableButtonGroup != null)
{
enableButtonGroup.enableButton.onClick.AddListener(EnableWindow);
enableButtonGroup.disableButton.onClick.AddListener(DisableWindow);
}
}
public virtual void EnableWindow()
{
gameObject.SetActive(true);
enableButtonGroup.disableButton.gameObject.SetActive(true);
enableButtonGroup.enableButton.gameObject.SetActive(false);
}
public virtual void DisableWindow()
{
gameObject.SetActive(false);
enableButtonGroup.disableButton.gameObject.SetActive(false);
enableButtonGroup.enableButton.gameObject.SetActive(true);
}
}
}

View File

@@ -12,7 +12,7 @@ using UnityEngine.UI;
namespace Ichni.Editor
{
public partial class Timeline : MonoBehaviour
public partial class Timeline : StaticWindow
{
public float songTime => EditorManager.instance.songInformation.songTime;
public float songBeat => EditorManager.instance.songInformation.songBeat;