Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-23 11:40:29 +08:00
parent 2dae60d368
commit 6d010467ae
60 changed files with 196637 additions and 17425 deletions

View File

@@ -454,5 +454,52 @@ namespace Ichni.Editor
}
}
}
// 导出Track下所有Note为正则格式文本
public static void ExportNotesFromTrack()
{
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
{
LogWindow.Log("Please select a Track first!");
return;
}
Track track = (Track)inspector.connectedGameElement;
var notes = track.childElementList.OfType<NoteBase>().OrderBy(n => n.exactJudgeTime).ToList();
List<string> lines = new List<string>();
foreach (var note in notes)
{
string type = note switch
{
Tap => "Tap",
Stay => "Stay",
Hold => "Hold",
Flick => "Flick",
_ => "Unknown"
};
string id = track.elementName;
float time = note.exactJudgeTime;
float x = 0f;
// 获取X值
if (note.noteVisual.submoduleList.FirstOrDefault(i => i is TransformSubmodule) is TransformSubmodule ts)
{
x = ts.originalPosition.x;
}
if (note is Hold hold)
{
float duration = hold.holdEndTime - hold.exactJudgeTime;
lines.Add($"({type}, {id}, {time:0.###}, {x:0.###}, {duration:0.###})");
}
else
{
lines.Add($"({type}, {id}, {time:0.###}, {x:0.###})");
}
}
string result = string.Join("\n", lines);
Debug.Log(result);
//LogWindow.Log(result, Color.green);
// 复制到剪贴板
GUIUtility.systemCopyBuffer = result;
LogWindow.Log("Colped Done!", Color.green);
}
}
}

View File

@@ -56,7 +56,7 @@ namespace Ichni.RhythmGame
SetParent(parentElement);
EditorManager.instance.uiManager.hierarchy.GenerateTab(this, parentElement);
gameObject.name = elementName;
//GameManager.beatMapContainer.beatMapElementList.Add(this);
//serialNumber = totalSerialNumber++;
//SetTransformObserver();
@@ -109,6 +109,7 @@ namespace Ichni.RhythmGame
public virtual void Refresh()
{
if (connectedTab != null) connectedTab.tabButtonText.text = this.elementName;
gameObject.name = elementName;
}
/// <summary>

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using Lean.Pool;
@@ -115,21 +116,21 @@ namespace Ichni.RhythmGame
var trackRendererAutoOrientButton =
inspector.GenerateButton(this, trackRendererSubcontainer, "Track Renderer Auto Orient", () =>
{
trackRendererSubmodule =
trackRendererSubmodule =
new TrackRendererSubmoduleAutoOrient(this, false, 0, true, Vector2.one, Vector2.zero);
inspectorMain.SetInspector(this);
});
var trackRendererPathGeneratorButton =
inspector.GenerateButton(this, trackRendererSubcontainer, "Track Renderer Path Generator", () =>
{
trackRendererSubmodule =
trackRendererSubmodule =
new TrackRendererSubmodulePathGenerator(this, false, 0, true, Vector2.one, Vector2.zero);
inspectorMain.SetInspector(this);
});
var trackRenderTubeGeneratorButton =
inspector.GenerateButton(this, trackRendererSubcontainer, "Track Renderer Tube Generator", () =>
{
trackRendererSubmodule =
trackRendererSubmodule =
new TrackRendererSubmoduleTubeGenerator(this, false, 0, true, 4, Vector2.one, Vector2.zero);
inspectorMain.SetInspector(this);
});
@@ -166,13 +167,16 @@ namespace Ichni.RhythmGame
var flickButton = inspector.GenerateButton(this, noteSubcontainer, "Flick",
() => { Flick.GenerateElement("New Flick", Guid.NewGuid(), new List<string>(), true, this, 0f, new List<Vector2>()); }); //Note Flick
var particleSubcontainer = generateContainer.GenerateSubcontainer(3);
var particleTrackerButton = inspector.GenerateButton(this, particleSubcontainer, "Particle Tracker",
() => { ParticleTracker.GenerateElement("New Particle Tracker", Guid.NewGuid(), new List<string>(), true, this,
string.Empty, string.Empty, false, 0, 1, false, 10, Vector3.right, 10, 5, true, Vector3.zero); }); //Particle Tracker
() =>
{
ParticleTracker.GenerateElement("New Particle Tracker", Guid.NewGuid(), new List<string>(), true, this,
string.Empty, string.Empty, false, 0, 1, false, 10, Vector3.right, 10, 5, true, Vector3.zero);
}); //Particle Tracker
StandardInspectionElement.GenerateForTransform(this, generateContainer); //关于有Transform的元素
// var animationSubcontainer = generateContainer.GenerateSubcontainer(3);
// var displacementButton = inspector.GenerateButton(this, animationSubcontainer, "Displacement", () =>
@@ -335,6 +339,34 @@ namespace Ichni.RhythmGame
return notes;
}
[Button("Check Notes")]
public void checkNotes()
{
foreach (NoteBase note in childElementList.OfType<NoteBase>())
{
if (note.noteJudgeSubmodule == null)
{
Debug.LogWarning($"Note {note.elementName} does not have a NoteJudgeSubmodule!");
}
if (note.noteVisual == null)
{
Debug.LogWarning($"Note {note.elementName} does not have a NoteVisual!");
}
if (note.noteAudioSubmodule == null)
{
Debug.LogWarning($"Note {note.elementName} does not have a NoteAudio!");
}
foreach (NoteBase note2 in childElementList.OfType<NoteBase>())
{
if (note2 != note && note2.exactJudgeTime == note.exactJudgeTime && note2.noteVisual?.transformSubmodule.currentPosition == note.noteVisual?.transformSubmodule.currentPosition)
{
Debug.LogWarning($"Note {note.elementName} and Note {note2.elementName} have the same position! Plz Check!");
}
}
}
}
}
public partial class Track

View File

@@ -26,6 +26,7 @@ public class EventPoint : MonoBehaviour
public FlexibleFloatTab FatherTab;
public TMP_Text ViewText;
public static bool Locked = false;
public int BeatDeviver => FatherTab.BeatDeviver;
public void Initialize(AnimatedFloat animatedFloat)
{
@@ -51,8 +52,13 @@ public class EventPoint : MonoBehaviour
}
public float value => FatherTab.scalevalue;
public void Refresh()
public void Refresh(bool changePos = false)
{
if (changePos)
{
Initialize(animatedFloat);
}
UpdateValue();
ReDraw(value);
}
@@ -138,6 +144,7 @@ public class EventPoint : MonoBehaviour
public void SelectButtonClick()//unity内当按钮按下时
{
if (Locked) return;
if (Keyboard.current.leftShiftKey.isPressed)
{
if (FatherTab.FatherWindow.ClipBoard[FatherTab.Title].Contains(animatedFloat))
@@ -190,7 +197,7 @@ public class EventPoint : MonoBehaviour
}
private void UpdateValue()
public void UpdateValue()
{
// 设置新的连接点并更新UI
FatherTab.FatherWindow.ConnectedPoint = this;
@@ -270,6 +277,7 @@ public class EventPoint : MonoBehaviour
}
}
// 添加静态方法:克隆 AnimatedFloat 并应用时间偏移
/// <summary>
/// 克隆一个 AnimatedFloat 对象,并根据偏移量调整其开始和结束时间。

View File

@@ -265,4 +265,48 @@ public class FlexibleFloatTab : MonoBehaviour
Destroy(eventPoint.gameObject);
}
}
public IEnumerator Draging()
{
EventPoint.Locked = true;
while (Keyboard.current.uKey.isPressed)
{
bool changed = false;
var point = FatherWindow.ConnectedPoint;
if (Mouse.current.leftButton.isPressed)
{
point.animatedFloat.startTime = GetBeat();
changed = true;
}
else if (Mouse.current.rightButton.isPressed)
{
point.animatedFloat.endTime = GetBeat();
changed = true;
}
if (changed)
{
// 保证时间顺序
if (point.animatedFloat.startTime >= point.animatedFloat.endTime)
{
if (Mouse.current.leftButton.isPressed)
point.animatedFloat.endTime = point.animatedFloat.startTime + 0.1f;
else
point.animatedFloat.startTime = point.animatedFloat.endTime - 0.1f;
}
// 保证不超过下一个事件点
if (point.NextEventPoint != null && point.animatedFloat.endTime > point.NextEventPoint.animatedFloat.startTime)
{
if (Mouse.current.leftButton.isPressed)
point.animatedFloat.endTime = point.NextEventPoint.animatedFloat.startTime;
else
point.animatedFloat.startTime = point.NextEventPoint.animatedFloat.startTime - 0.1f;
}
point.Initialize(point.animatedFloat);
point.UpdateValue();
}
yield return null;
}
FatherWindow.ConnectedPoint.Refresh(true);
EventPoint.Locked = false;
}
}

View File

@@ -229,13 +229,24 @@ public partial class GraphicalFlexibleFloatWindow
ConnectedPoint.animatedFloat.startValue *= -1;
ConnectedPoint.Refresh();
}
if (Keyboard.current.sKey.wasPressedThisFrame)
else if (Keyboard.current.sKey.wasPressedThisFrame)
{
float value = ConnectedPoint.animatedFloat.startValue;
ConnectedPoint.animatedFloat.startValue = ConnectedPoint.animatedFloat.endValue;
ConnectedPoint.animatedFloat.endValue = value;
ConnectedPoint.Refresh();
}
else if (Keyboard.current.uKey.wasPressedThisFrame)
{
try
{
ConnectedPoint.FatherTab.StartCoroutine(ConnectedPoint.FatherTab.Draging());
}
catch (System.Exception)
{
EventPoint.Locked = false;
}
}
}