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

@@ -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);
}
}