Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-12-21 16:41:12 +08:00
parent 7f4e339032
commit be1ad1566b
12 changed files with 204488 additions and 4699 deletions

View File

@@ -433,6 +433,29 @@ namespace Ichni.Editor
SplitHoldToTrack(PathnodesCount);
}
}
public static void ScalePathNodesXY(float scale, Vector2 scalePoint)
{
if (inspector.connectedGameElement == null || (inspector.connectedGameElement.GetType() != typeof(Track) && inspector.connectedGameElement.GetType() != typeof(ElementFolder)))
{
LogWindow.Log("Please select a Folder or Track first!");
return;
}
foreach (var i in inspector.connectedGameElement.GetAllGameElementsFromThis().OfType<Track>())
{
Track track = (Track)i;
var pathnodes = track.trackPathSubmodule.pathNodeList;
foreach (var pathnode in pathnodes)
{
Vector2 dir = new Vector2(pathnode.transform.position.x, pathnode.transform.position.y) - scalePoint;
Vector3 newPos = new Vector3(dir.x * scale + scalePoint.x, dir.y * scale + scalePoint.y, pathnode.transform.position.z);
pathnode.transform.position = newPos;
pathnode.transformSubmodule.originalPosition = pathnode.transform.localPosition;
pathnode.transformSubmodule.Refresh();
pathnode.Refresh();
}
}
}
#endregion
#region Note Import/Export (/)

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Ichni.Editor;
@@ -53,7 +54,7 @@ namespace Ichni.RhythmGame
public void SaveBM()
{
matchedBM = new ProjectInformation_BM(projectName, creatorName, "0.1.0",
createTime, lastSaveTime, selectedThemeBundleList, tagManager);
createTime, DateTime.Now.ToString(CultureInfo.CurrentCulture), selectedThemeBundleList, tagManager);
}
public void SetUpInspector()

View File

@@ -40,7 +40,15 @@ namespace Ichni.RhythmGame
public override void AfterInitialize()
{
base.AfterInitialize();
AddinNoteManager();
}
public void AddinNoteManager(bool isNewOne = true)
{
float beyondTime = 0f;
foreach (EffectBase effectBase in noteVisual.effectSubmodule.effectCollection["Generate"])
@@ -55,7 +63,6 @@ namespace Ichni.RhythmGame
effectBase.Recover();
}
}
float finishTime = 0f;
List<EffectBase> finishEffects = new List<EffectBase>();
finishEffects.AddRange(noteVisual.effectSubmodule.effectCollection["GeneralJudge"]);
@@ -77,11 +84,10 @@ namespace Ichni.RhythmGame
// EditorManager.instance.noteManager.RegisterNote(hold, hold.exactJudgeTime - beyondTime - 0.1f, + finishTime + 0.5f);
// }
EditorManager.instance.noteManager.RegisterNote(this, exactJudgeTime - beyondTime - 0.1f, (this is Hold hold ? hold.holdEndTime : exactJudgeTime) + finishTime + 0.1f);
if (isNewOne) EditorManager.instance.noteManager.RegisterNote(this, exactJudgeTime - beyondTime - 0.1f, (this is Hold hold ? hold.holdEndTime : exactJudgeTime) + finishTime + 0.1f);
else NoteManager.instance.ChangeNoteInfo(this, exactJudgeTime - beyondTime - 0.1f, (this is Hold hold ? hold.holdEndTime : exactJudgeTime) + finishTime + 0.1f);
}
}
/// <summary>
/// 在MovableTrack上更新Note的位置注意HoldNote需要重写这个方法
/// </summary>
@@ -121,7 +127,7 @@ namespace Ichni.RhythmGame
{
noteVisual.Refresh();
}
AddinNoteManager(false);
foreach (SampleWindow i in SampleWindow.instances.Where(i => i.gameElement)) i.OnceSpawnNote();
}

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UniRx;
using UnityEngine;
@@ -7,6 +8,7 @@ namespace Ichni.RhythmGame
{
public class NoteManager : MonoBehaviour
{
public static NoteManager instance;
public List<(NoteBase note, float activationTime, float finishTime)> pendingNotes = new List<(NoteBase, float, float)>();
private List<(NoteBase note1, bool isActive, float activationTime)> ProcessingNotes = new List<(NoteBase, bool, float)>();
public void RegisterNote(NoteBase note, float activationTime, float finishTime)
@@ -15,7 +17,22 @@ namespace Ichni.RhythmGame
AllNotesRegistered();
print($"Registered note {note.elementName} with activation time {activationTime} and finish time {finishTime}");
}
public void Awake()
{
instance = this;
}
public void ChangeNoteInfo(NoteBase note, float activationTime, float finishTime)
{
int idx = pendingNotes.FindIndex(i => i.note == note);
if (idx != -1)
{
var one = pendingNotes[idx];
one.finishTime = finishTime;
one.activationTime = activationTime;
pendingNotes[idx] = one;
AllNotesRegistered();
}
}
// 在所有物体注册完毕后,对列表进行一次排序
public void AllNotesRegistered()
{