2025-02-02 08:34:54 -05:00
|
|
|
|
using System;
|
2025-01-27 22:11:24 -05:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-01-30 22:45:33 -05:00
|
|
|
|
using Dreamteck.Splines;
|
2025-02-08 02:31:39 -05:00
|
|
|
|
using Ichni.RhythmGame.Beatmap;
|
2025-01-28 11:58:39 -05:00
|
|
|
|
using Lean.Pool;
|
2025-01-30 22:45:33 -05:00
|
|
|
|
using Unity.VisualScripting;
|
2025-01-27 22:11:24 -05:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
2025-01-28 11:58:39 -05:00
|
|
|
|
namespace Ichni.RhythmGame
|
2025-01-27 22:11:24 -05:00
|
|
|
|
{
|
2025-02-02 08:34:54 -05:00
|
|
|
|
public partial class Stay : NoteBase
|
2025-01-27 22:11:24 -05:00
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
public static Stay GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
|
|
|
|
|
GameElement parentElement, float exactJudgeTime)
|
2025-01-28 11:58:39 -05:00
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
Stay stay = Instantiate(EditorManager.instance.basePrefabs.tapNote, parentElement.transform).GetComponent<Stay>();
|
2025-02-09 23:47:42 -05:00
|
|
|
|
stay.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
|
2025-01-30 22:45:33 -05:00
|
|
|
|
stay.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
stay.transformSubmodule = new TransformSubmodule(stay);
|
|
|
|
|
|
stay.timeDurationSubmodule = new TimeDurationSubmodule(stay);
|
2025-02-09 23:47:42 -05:00
|
|
|
|
|
2025-02-08 02:31:39 -05:00
|
|
|
|
if (parentElement.TryGetComponent(out Track track))
|
2025-01-28 11:58:39 -05:00
|
|
|
|
{
|
|
|
|
|
|
if (track.trackTimeSubmodule != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
stay.track = track;
|
2025-01-30 22:45:33 -05:00
|
|
|
|
stay.trackPositioner = stay.AddComponent<SplinePositioner>();
|
2025-01-28 11:58:39 -05:00
|
|
|
|
stay.trackPositioner.spline = track.trackPathSubmodule.path;
|
|
|
|
|
|
stay.isOnTrack = true;
|
|
|
|
|
|
stay.UpdateNoteInTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new System.Exception("如果Note要生成在Track上,Track必须有TrackTimeSubmodule组件。");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-01-30 22:45:33 -05:00
|
|
|
|
stay.track = null;
|
|
|
|
|
|
stay.isOnTrack = false;
|
2025-01-28 11:58:39 -05:00
|
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
|
|
2025-01-28 11:58:39 -05:00
|
|
|
|
return stay;
|
|
|
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
|
}
|
2025-02-02 08:34:54 -05:00
|
|
|
|
|
|
|
|
|
|
public partial class Stay
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void SaveBM()
|
|
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
matchedBM = new Stay_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, exactJudgeTime);
|
2025-02-02 08:34:54 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Beatmap
|
|
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
public class Stay_BM : NoteBase_BM
|
2025-02-02 08:34:54 -05:00
|
|
|
|
{
|
|
|
|
|
|
public Stay_BM()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-08 02:31:39 -05:00
|
|
|
|
public Stay_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement, float exactJudgeTime)
|
|
|
|
|
|
: base(elementName, elementGuid, tags, attachedElement, exactJudgeTime)
|
2025-02-02 08:34:54 -05:00
|
|
|
|
{
|
|
|
|
|
|
this.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExecuteBM()
|
|
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
matchedElement = Stay.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid), exactJudgeTime);
|
2025-02-02 08:34:54 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-08 02:31:39 -05:00
|
|
|
|
public override GameElement DuplicateBM(GameElement parent)
|
2025-02-02 08:34:54 -05:00
|
|
|
|
{
|
2025-02-08 02:31:39 -05:00
|
|
|
|
return Stay.GenerateElement(elementName, elementGuid, tags, false, parent, exactJudgeTime);
|
2025-02-02 08:34:54 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-01-28 11:58:39 -05:00
|
|
|
|
}
|