@@ -14,7 +14,7 @@ namespace Ichni.Editor
|
||||
public Hierarchy hierarchy;
|
||||
public Inspector inspector;
|
||||
public Timeline timeline;
|
||||
|
||||
public Canvas WindowsCanvas;
|
||||
public List<StaticWindow> staticWindows;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -23,21 +23,21 @@ namespace Ichni.Editor
|
||||
{
|
||||
CompositeParameterWindow compositeParameterWindow =
|
||||
Object.Instantiate(EditorManager.instance.basePrefabs.compositeParameterWindow,
|
||||
EditorManager.instance.uiManager.inspector.inspectorCanvas.GetComponent<RectTransform>())
|
||||
EditorManager.instance.uiManager.WindowsCanvas.GetComponent<RectTransform>())
|
||||
.GetComponent<CompositeParameterWindow>();
|
||||
compositeParameterWindow.Initialize(baseElement, title, parameterName);
|
||||
return compositeParameterWindow;
|
||||
}
|
||||
public GraphicalFlexibleFloatWindow GenerateGraphicalFlexibleFloatWindow(IBaseElement baseElement, string title, FlexibleFloat[] FlexibleFloats, string[] subTitle)
|
||||
{
|
||||
GraphicalFlexibleFloatWindow graphicalFlexibleFloatWindow = Object.Instantiate(EditorManager.instance.basePrefabs.graphicalFlexibleFloatWindow, EditorManager.instance.uiManager.inspector.inspectorCanvas.GetComponent<RectTransform>())
|
||||
GraphicalFlexibleFloatWindow graphicalFlexibleFloatWindow = Object.Instantiate(EditorManager.instance.basePrefabs.graphicalFlexibleFloatWindow, EditorManager.instance.uiManager.WindowsCanvas.GetComponent<RectTransform>())
|
||||
.GetComponent<GraphicalFlexibleFloatWindow>();
|
||||
graphicalFlexibleFloatWindow.Initialize(baseElement, title, FlexibleFloats, subTitle);
|
||||
return graphicalFlexibleFloatWindow;
|
||||
}
|
||||
public SampleWindow GenerateSampler(GameElement baseElement, string title)
|
||||
{
|
||||
SampleWindow sampler = Object.Instantiate(EditorManager.instance.basePrefabs.sampler, EditorManager.instance.uiManager.inspector.inspectorCanvas.GetComponent<RectTransform>())
|
||||
SampleWindow sampler = Object.Instantiate(EditorManager.instance.basePrefabs.sampler, EditorManager.instance.uiManager.WindowsCanvas.GetComponent<RectTransform>())
|
||||
.GetComponent<SampleWindow>();
|
||||
sampler.Initialize(baseElement, title);
|
||||
return sampler;
|
||||
@@ -130,7 +130,7 @@ namespace Ichni.Editor
|
||||
subcontainer.dynamicUIElements.Add(vector3InputField);
|
||||
return vector3InputField;
|
||||
}
|
||||
|
||||
|
||||
public DynamicUIVector2InputField GenerateVector2InputField(IBaseElement baseElement,
|
||||
DynamicUISubcontainer subcontainer, string title, string parameterName, bool isAutoUpdate = false)
|
||||
{
|
||||
|
||||
@@ -3,23 +3,26 @@ using System.Collections.Generic;
|
||||
using Lean.Pool;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class LogText : MonoBehaviour
|
||||
{
|
||||
public TMP_Text logText;
|
||||
|
||||
|
||||
public void SetLogText(string text, Color color)
|
||||
{
|
||||
logText.text = text;
|
||||
logText.color = color;
|
||||
|
||||
|
||||
string logFilePath = EditorManager.instance.projectInformation.projectPath + "/Logs/EditorLog.txt";
|
||||
|
||||
|
||||
// if(!ES3.FileExists(logFilePath)) System.IO.File.Create(logFilePath).Dispose();
|
||||
//
|
||||
// System.IO.File.AppendAllText(logFilePath, text + "\n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
@@ -13,18 +14,17 @@ namespace Ichni.Editor
|
||||
public GameObject logTextPrefab;
|
||||
|
||||
List<string> savedTexts;
|
||||
|
||||
public RectTransform textRect;
|
||||
public Button copyAllTextsButton;
|
||||
public Button removeAllTextsButton;
|
||||
public Queue<LogText> logTexts;
|
||||
public List<LogText> logTexts; // 改为 List
|
||||
public int logTextCapacity = 4;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
savedTexts = new List<string>();
|
||||
logTexts = new Queue<LogText>();
|
||||
logTexts = new List<LogText>(); // 初始化为 List
|
||||
copyAllTextsButton.onClick.AddListener(CopyAllText);
|
||||
removeAllTextsButton.onClick.AddListener(RemoveAllText);
|
||||
}
|
||||
@@ -36,19 +36,37 @@ namespace Ichni.Editor
|
||||
|
||||
private void AddLog(string text, Color color = default)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
private void CheckLogTextCapacity()
|
||||
{
|
||||
if (logTexts.Count >= logTextCapacity)
|
||||
// 插入到头部
|
||||
logTexts.Insert(0, logText);
|
||||
|
||||
// 超出容量则移除最后一个
|
||||
if (logTexts.Count > logTextCapacity)
|
||||
{
|
||||
LeanPool.Despawn(logTexts.Dequeue().gameObject);
|
||||
LogText logText1 = logTexts[logTexts.Count - 1];
|
||||
RectTransform rt = logText1.GetComponent<RectTransform>();
|
||||
rt.DOComplete();
|
||||
rt.DOAnchorPos(new Vector2(0, -23 * (logTexts.Count - 1)), 0.2f).SetEase(Ease.OutCubic);
|
||||
logText1.logText.DOColor(new Color(0, 0, 0, 0), 0.2f).OnComplete(() =>
|
||||
{
|
||||
LeanPool.Despawn(logText1.gameObject);
|
||||
});
|
||||
|
||||
logTexts.RemoveAt(logTexts.Count - 1);
|
||||
|
||||
}
|
||||
logText.logText.color = new Color(0, 0, 0, 0);
|
||||
logText.logText.DOColor(color, 0.2f);
|
||||
// 更新所有 log 的位置
|
||||
for (int i = 0; i < logTexts.Count; i++)
|
||||
{
|
||||
RectTransform rt = logTexts[i].GetComponent<RectTransform>();
|
||||
rt.DOComplete();
|
||||
rt.DOAnchorPos(new Vector2(0, -23 * i), 0.2f).SetEase(Ease.OutCubic);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
@@ -24,7 +25,10 @@ namespace Ichni.Editor
|
||||
{
|
||||
onCloseWindow?.Invoke();
|
||||
onQuit?.Invoke();
|
||||
Destroy(gameObject);
|
||||
this.transform.DOScale(Vector3.zero, 0.15f).SetEase(Ease.InCirc).OnComplete(() =>
|
||||
{
|
||||
Destroy(gameObject);
|
||||
});
|
||||
});
|
||||
StartCoroutine(WindowAnim.ShowPanelOnScale(gameObject));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Sirenix.OdinInspector;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
@@ -26,6 +27,13 @@ namespace Ichni.Editor
|
||||
// anchoredPosition = this.GetComponent<RectTransform>().anchoredPosition;
|
||||
// anchoredPosition3D = this.GetComponent<RectTransform>().anchoredPosition3D;
|
||||
// }
|
||||
|
||||
public void PlayAnim()
|
||||
{
|
||||
intervalUnitText.transform.DOKill();
|
||||
intervalUnitText.transform.DOScale(Vector3.one * 1.5f, 0.1f).SetEase(Ease.OutCubic).OnComplete(() =>
|
||||
{
|
||||
intervalUnitText.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutCubic);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Ichni.RhythmGame;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -15,7 +16,9 @@ namespace Ichni.Editor
|
||||
|
||||
public GameObject timePointerPrefab;
|
||||
public List<TimePointer> timePointerList;
|
||||
public List<TimePointer> ActivePointer => timePointerList.FindAll(pointer => pointer.gameObject.activeSelf);
|
||||
private TimePointer NowPointer;
|
||||
|
||||
public RectTransform moveTabPoint;
|
||||
public RectTransform timePointerContainer;
|
||||
public RectTransform rightSide;
|
||||
@@ -38,7 +41,7 @@ namespace Ichni.Editor
|
||||
{
|
||||
TimePointer timePointer = Instantiate(timePointerPrefab, timePointerContainer).GetComponent<TimePointer>();
|
||||
timePointerList.Add(timePointer);
|
||||
|
||||
timePointer.time = i * timeline.timePerBeat;
|
||||
timePointer.intervalUnitText.text = (i * timeline.timePerBeat).ToString("F3");
|
||||
timePointer.GetComponent<RectTransform>().localPosition = new Vector3(i * timePointerInterval, 0f, 0f);
|
||||
timePointer.index = i;
|
||||
@@ -94,5 +97,6 @@ namespace Ichni.Editor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace Ichni.Editor
|
||||
public TimePointerModule timePointerModule;
|
||||
public MusicPlayModule musicPlayModule;
|
||||
|
||||
|
||||
private TimePointer MarkedPointer;
|
||||
public TMP_InputField TimeField;
|
||||
public TMP_InputField BeatField;
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Ichni.Editor
|
||||
{
|
||||
|
||||
DetectSetRange();
|
||||
DetectPointer();
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +87,71 @@ namespace Ichni.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
private void DetectPointer()
|
||||
{
|
||||
if (Mouse.current.leftButton.wasPressedThisFrame)
|
||||
{
|
||||
foreach (var pointer in timePointerModule.ActivePointer)
|
||||
{
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(pointer.intervalUnitText.GetComponent<RectTransform>(), Mouse.current.position.ReadValue()))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = pointer.intervalUnitText.text;
|
||||
LogWindow.Log("Copied Time: " + pointer.intervalUnitText.text + " Marked Pointer");
|
||||
if (MarkedPointer != null) MarkedPointer.intervalUnitText.color = Color.white;
|
||||
|
||||
pointer.intervalUnitText.color = Color.yellow;
|
||||
pointer.PlayAnim();
|
||||
MarkedPointer = pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Mouse.current.rightButton.wasPressedThisFrame)
|
||||
{
|
||||
foreach (var pointer in timePointerModule.ActivePointer)
|
||||
{
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(pointer.intervalUnitText.GetComponent<RectTransform>(), Mouse.current.position.ReadValue()))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = Mathf.Abs(pointer.time - MarkedPointer.time).ToString("F3");
|
||||
LogWindow.Log("Total Time: " + Mathf.Abs(pointer.time - MarkedPointer.time).ToString("F3"));
|
||||
|
||||
pointer.PlayAnim();
|
||||
pointer.intervalUnitText.color = Color.yellow;
|
||||
pointer.intervalUnitText.DOColor(Color.white, 0.5f);
|
||||
// 灰色矩形动画效果
|
||||
if (MarkedPointer != null && pointer != MarkedPointer)
|
||||
{
|
||||
var rt1 = pointer.intervalUnitText.GetComponent<RectTransform>();
|
||||
var rt2 = MarkedPointer.intervalUnitText.GetComponent<RectTransform>();
|
||||
var parentRect = timePointerModule.timePointerContainer;
|
||||
|
||||
// 世界坐标转父级本地坐标
|
||||
Vector3 localPos1 = parentRect.InverseTransformPoint(rt1.position);
|
||||
Vector3 localPos2 = parentRect.InverseTransformPoint(rt2.position);
|
||||
|
||||
float minX = Mathf.Min(localPos1.x, localPos2.x);
|
||||
float width = Mathf.Abs(localPos1.x - localPos2.x);
|
||||
float minY = Mathf.Min(localPos1.y, localPos2.y);
|
||||
float height = Mathf.Max(rt1.rect.height, rt2.rect.height);
|
||||
|
||||
GameObject rectObj = new GameObject("PointerRangeRect", typeof(RectTransform), typeof(Image));
|
||||
rectObj.transform.SetParent(parentRect, false);
|
||||
var rectTrans = rectObj.GetComponent<RectTransform>();
|
||||
var image = rectObj.GetComponent<Image>();
|
||||
image.color = new Color(1f, 1f, 1f, 0.5f);
|
||||
|
||||
rectTrans.anchorMin = new Vector2(0, 0);
|
||||
rectTrans.anchorMax = new Vector2(0, 0);
|
||||
rectTrans.pivot = new Vector2(0, 0);
|
||||
rectTrans.localPosition = new Vector3(minX, minY - (height / 2), 0);
|
||||
rectTrans.sizeDelta = new Vector2(width, height);
|
||||
|
||||
DOTween.ToAlpha(() => image.color, c => image.color = c, 0f, 1f)
|
||||
.OnComplete(() => Destroy(rectObj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void UpdateTime()
|
||||
{
|
||||
TimeField.text = songTime.ToString("F2");
|
||||
|
||||
Reference in New Issue
Block a user