Small question

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-10-19 14:42:05 +08:00
parent 02fd8d52f7
commit eab38e36fe
32 changed files with 40657 additions and 16787 deletions

View File

@@ -94,5 +94,8 @@ namespace Ichni.Editor
}
}
}
}

View File

@@ -30,14 +30,31 @@ namespace Ichni.Editor
private TimePointer MarkedPointer;
public TMP_InputField TimeField;
public TMP_InputField BeatField;
public Slider ProgressSlider;
public RectTransform GetinputArea;
private string BeatText;
private string TimeText;
protected override void Start()
{
TimeField.onSelect.AddListener(_ => EditorManager.instance.musicPlayer.PauseMusic());
BeatField.onSelect.AddListener(_ => EditorManager.instance.musicPlayer.PauseMusic());
ProgressSlider.onValueChanged.AddListener(_ =>
{
EditorManager.instance.musicPlayer.PauseMusic();
EditorManager.instance.songInformation.songTime = (ProgressSlider.value * EditorManager.instance.songInformation.songLength) - EditorManager.instance.songInformation.offset;
UpdateTime();
});
}
public void Update()
{
if (EditorManager.instance.musicPlayer.isPlaying) UpdateTime();
if (EditorManager.instance.musicPlayer.isPlaying)
{
UpdateTime();
}
if (RectTransformUtility.RectangleContainsScreenPoint(GetinputArea, Mouse.current.position.ReadValue()))
{
@@ -45,14 +62,6 @@ namespace Ichni.Editor
DetectSetRange();
DetectPointer();
}
if (BeatField.text != BeatText)
{
BeatField.text = BeatText;
}
if (TimeField.text != TimeText)
{
TimeField.text = TimeText;
}
}
@@ -165,6 +174,15 @@ namespace Ichni.Editor
{
TimeText = songTime.ToString("F2");
BeatText = songBeat.ToString("F2");
if (BeatField.text != BeatText)
{
BeatField.text = BeatText;
}
if (TimeField.text != TimeText)
{
TimeField.text = TimeText;
}
ProgressSlider.SetValueWithoutNotify((songTime - EditorManager.instance.songInformation.offset) / EditorManager.instance.songInformation.songLength);
}
private Tweener _activeTweener = null; // 保存当前动画的引用

View File

@@ -9,15 +9,22 @@ namespace Ichni.RhythmGame
public class FullScreenNearTimeJudgeUnit : NoteJudgeUnit
{
protected override GameObject GetHintImagePrefab() => EditorManager.instance.basePrefabs.fullscreenNearTimeHint;
public FullScreenNearTimeJudgeUnit(NoteBase note) : base(note)
{
}
public override void UpdateJudge()
{
if(note.isFirstJudged) return;
if (note is Hold hold)
{
if (hold.isFinalJudged) return;
}
else
{
if (note.isFirstJudged) return;
}
Vector2 noteScreenPosition = note.noteScreenPosition;
RectTransform canvasRect = EditorManager.instance.judgeHintCanvas.GetComponent<RectTransform>();
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, noteScreenPosition, null, out Vector2 uiPosition))
@@ -25,15 +32,15 @@ namespace Ichni.RhythmGame
judgeHintImage.anchoredPosition = uiPosition;
}
}
public override void SetUpInspector()
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Full Screen Near Time Judge Unit");
var judgeModuleSettings = container.GenerateSubcontainer(3);
var isShowingJudgeField =
var isShowingJudgeField =
inspector.GenerateToggle(this, judgeModuleSettings, "Is Showing Judge", nameof(isShowingJudge))
.AddListenerFunction(() => SetShowingJudge(isShowingJudge));
var removeButton = inspector.GenerateButton(this, judgeModuleSettings, "Remove", () =>
@@ -43,7 +50,7 @@ namespace Ichni.RhythmGame
inspectorMain.SetInspector(note);
});
}
public override NoteJudgeUnit_BM ConvertToBM()
{
return new FullScreenNearTimeJudgeUnit_BM();
@@ -56,9 +63,9 @@ namespace Ichni.RhythmGame
{
public FullScreenNearTimeJudgeUnit_BM()
{
}
public override NoteJudgeUnit ConvertToGameType(NoteBase attachedNote)
{
return new FullScreenNearTimeJudgeUnit(attachedNote);

View File

@@ -13,7 +13,7 @@ namespace Ichni.RhythmGame
protected override GameObject GetHintImagePrefab() => EditorManager.instance.basePrefabs.areaHint;
private float CurrentScreenRatio() => Screen.height / 1080f;
public TouchAreaJudgeUnit(NoteBase note, float areaRadius) : base(note)
{
this.areaRadius = areaRadius;
@@ -21,7 +21,15 @@ namespace Ichni.RhythmGame
public override void UpdateJudge()
{
if(note.isFirstJudged) return;
if (note is Hold hold)
{
if (hold.isFinalJudged) return;
}
else
{
if (note.isFirstJudged) return;
}
Vector2 noteScreenPosition = note.noteScreenPosition;
RectTransform canvasRect = EditorManager.instance.judgeHintCanvas.GetComponent<RectTransform>();
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, noteScreenPosition, null, out Vector2 uiPosition))
@@ -35,10 +43,10 @@ namespace Ichni.RhythmGame
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Touch Area Judge Unit");
var judgeModuleSettings = container.GenerateSubcontainer(3);
var isShowingJudgeField =
var isShowingJudgeField =
inspector.GenerateToggle(this, judgeModuleSettings, "Is Showing Judge", nameof(isShowingJudge))
.AddListenerFunction(() => SetShowingJudge(isShowingJudge));
var areaRadiusField = inspector.GenerateInputField(this, judgeModuleSettings, "Area Radius", nameof(areaRadius));
@@ -64,9 +72,9 @@ namespace Ichni.RhythmGame
public TouchAreaJudgeUnit_BM()
{
}
public TouchAreaJudgeUnit_BM(float areaRadius)
{
this.areaRadius = areaRadius;

View File

@@ -22,38 +22,31 @@ namespace Ichni.RhythmGame
pendingNotes.Sort((a, b) => a.activationTime.CompareTo(b.activationTime));
}
void LateUpdate()
void Update()
{
List<(NoteBase note, float activationTime, float finishTime)> toRemove = new List<(NoteBase, float, float)>();
foreach ((NoteBase note, float activationTime, float finishTime) in pendingNotes)
float currentTime = EditorManager.instance.songInformation.songTime;
// 一次性移除所有 null 项
pendingNotes.RemoveAll(item => item.note == null);
foreach (var item in pendingNotes)
{
if (note == null)
{
toRemove.Add((note, activationTime, finishTime));
continue;
}
if (EditorManager.instance.songInformation.songTime >= activationTime &&
EditorManager.instance.songInformation.songTime <= finishTime)
{
if (!note.gameObject.activeSelf)
{
var (note, activationTime, finishTime) = item;
bool shouldBeActive = currentTime >= activationTime && currentTime <= finishTime;
bool isActive = note.gameObject.activeSelf;
note.gameObject.SetActive(true);
}
}
else
if (shouldBeActive && !isActive)
{
note.gameObject.SetActive(true);
}
else if (!shouldBeActive && isActive)
{
if (note.gameObject.activeSelf)
{
note.gameObject.SetActive(false);
}
note.gameObject.SetActive(false);
}
}
for (int i = toRemove.Count - 1; i >= 0; i--)
{
pendingNotes.Remove(toRemove[i]);
}
}
}