快捷功能

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

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