快捷功能

Note时间填充
Hierarchy排序
This commit is contained in:
SoulliesOfficial
2025-03-20 15:17:08 -04:00
parent 22c6ca80ca
commit ab86d6d985
8 changed files with 352 additions and 16 deletions

View File

@@ -106,8 +106,8 @@ namespace Ichni.Editor
StartCoroutine(ExpandAnim());
if (isExpanded)
{
connectedGameElement.childElementList.Sort();//TODO: 后续可以让玩家手动快速排序
for (var index = 0; index < connectedGameElement.childElementList.Count; index++)
{
var childElement = connectedGameElement.childElementList[index];

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Ichni.RhythmGame;
using Sirenix.OdinInspector;
using UnityEngine;
@@ -17,6 +19,7 @@ namespace Ichni.Editor
public Button exportButton;
public Button clipSaveButton;
public Button clipLoadButton;
public Button beatmapToolsButton;
[Title("Windows")]
public GeneralSecondaryWindow clipManagementWindow;
@@ -28,6 +31,7 @@ namespace Ichni.Editor
exportButton.onClick.AddListener(EditorManager.instance.projectManager.exportManager.Export);
clipSaveButton.onClick.AddListener(GenerateSaveClipWindow);
clipLoadButton.onClick.AddListener(GenerateLoadClipWindow);
beatmapToolsButton.onClick.AddListener(GenerateBeatmapToolsWindow);
}
}
@@ -95,4 +99,50 @@ namespace Ichni.Editor
});
}
}
public partial class ToolBar
{
private void GenerateBeatmapToolsWindow()
{
GeneralSecondaryWindow beatmapToolsWindow =
Instantiate(EditorManager.instance.basePrefabs.generalSecondaryWindow,
EditorManager.instance.uiManager.mainPage.mainCanvas.GetComponent<RectTransform>()).GetComponent<GeneralSecondaryWindow>();
beatmapToolsWindow.Initialize("Beatmap Tools", () => clipManagementWindow = null);
var container = beatmapToolsWindow.GenerateContainer("Note Tools");
var applyTimeOnNameButton = beatmapToolsWindow.GenerateButton(container, "Apply Time On Note Name", () =>
{
List<NoteBase> allNotes = EditorManager.instance.beatmapContainer.gameElementList.FindAll(x => x is NoteBase).ConvertAll(x => x as NoteBase);
List<Tap> allTaps = allNotes.FindAll(x => x is Tap).ConvertAll(x => x as Tap);
List<Stay> allStays = allNotes.FindAll(x => x is Stay).ConvertAll(x => x as Stay);
List<Hold> allHolds = allNotes.FindAll(x => x is Hold).ConvertAll(x => x as Hold);
List<Flick> allFlicks = allNotes.FindAll(x => x is Flick).ConvertAll(x => x as Flick);
foreach (var tap in allTaps.Where(tap => tap.elementName == "New Tap" || Regex.IsMatch(tap.elementName, @"Tap \(\d+\)")))
{
tap.elementName = "Tap (" + tap.exactJudgeTime + ")";
tap.Refresh();
}
foreach (var stay in allStays.Where(stay => stay.elementName == "New Stay" || Regex.IsMatch(stay.elementName, @"Stay \(\d+\)")))
{
stay.elementName = "Stay (" + stay.exactJudgeTime + ")";
stay.Refresh();
}
foreach (var hold in allHolds.Where(hold => hold.elementName == "New Hold" || Regex.IsMatch(hold.elementName, @"Hold \(\d+-\d+\)")))
{
hold.elementName = "Hold (" + hold.exactJudgeTime + "-" + hold.holdEndTime + ")";
hold.Refresh();
}
foreach (var flick in allFlicks.Where(flick => flick.elementName == "New Flick" || Regex.IsMatch(flick.elementName, @"Flick \(\d+\)")))
{
flick.elementName = "Flick (" + flick.exactJudgeTime + ")";
flick.Refresh();
}
});
}
}
}

View File

@@ -13,7 +13,7 @@ using Inspector = Ichni.Editor.Inspector;
namespace Ichni.RhythmGame
{
public abstract partial class GameElement : SerializedMonoBehaviour, IBaseElement
public abstract partial class GameElement : SerializedMonoBehaviour, IBaseElement, IComparable<GameElement>
{
//物体名
public string elementName;
@@ -38,6 +38,8 @@ namespace Ichni.RhythmGame
//存档类
public BaseElement_BM matchedBM { get; set; }
public virtual int HierarchyPriority => 0;
/// <summary>
/// 首次初始化
@@ -89,6 +91,11 @@ namespace Ichni.RhythmGame
transform.SetParent(parentElement.transform);
}
}
public int CompareTo(GameElement other)
{
return HierarchyPriority.CompareTo(other.HierarchyPriority);
}
}
public abstract partial class GameElement //存档,删除,复制,粘贴

View File

@@ -30,6 +30,7 @@ namespace Ichni.RhythmGame
[Title("In-Game Info")]
public Vector2 noteScreenPosition;
[FormerlySerializedAs("isJudged")] public bool isFirstJudged;
public override int HierarchyPriority => -10;
/// <summary>
/// 在MovableTrack上更新Note的位置注意HoldNote需要重写这个方法

View File

@@ -20,6 +20,7 @@ namespace Ichni.RhythmGame
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
public ColorSubmodule colorSubmodule { get; set; }
public bool haveEmission => false;
public override int HierarchyPriority => -100;
[Title("Editor独有参数")]
[SerializeField]