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-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 Tap : NoteBase
|
2025-01-27 22:11:24 -05:00
|
|
|
|
{
|
2025-02-02 08:34:54 -05:00
|
|
|
|
public static Tap GenerateElement(string elementName, Guid id, List<string> tags,
|
|
|
|
|
|
float exactJudgeTime, BaseElement attach)
|
2025-01-28 11:58:39 -05:00
|
|
|
|
{
|
2025-01-30 22:45:33 -05:00
|
|
|
|
Tap tap = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent<Tap>();
|
2025-02-02 08:34:54 -05:00
|
|
|
|
tap.Initialize(elementName, id, tags);
|
2025-01-30 22:45:33 -05:00
|
|
|
|
tap.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
tap.transformSubmodule = new TransformSubmodule(tap);
|
|
|
|
|
|
tap.timeDurationSubmodule = new TimeDurationSubmodule(tap);
|
2025-01-28 11:58:39 -05:00
|
|
|
|
tap.SetParent(attach);
|
|
|
|
|
|
|
|
|
|
|
|
if (attach.TryGetComponent(out Track track))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (track.trackTimeSubmodule != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
tap.track = track;
|
2025-01-30 22:45:33 -05:00
|
|
|
|
tap.trackPositioner = tap.AddComponent<SplinePositioner>();
|
2025-01-28 11:58:39 -05:00
|
|
|
|
tap.trackPositioner.spline = track.trackPathSubmodule.path;
|
|
|
|
|
|
tap.isOnTrack = true;
|
|
|
|
|
|
tap.UpdateNoteInTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new System.Exception("如果Note要生成在Track上,Track必须有TrackTimeSubmodule组件。");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-01-30 22:45:33 -05:00
|
|
|
|
tap.track = null;
|
|
|
|
|
|
tap.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 tap;
|
|
|
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
|
}
|
2025-02-02 08:34:54 -05:00
|
|
|
|
|
|
|
|
|
|
public partial class Tap
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void SaveBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
matchedBM = new Beatmap.Tap_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Beatmap
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Tap_BM : BaseElement_BM
|
|
|
|
|
|
{
|
|
|
|
|
|
public float exactJudgeTime;
|
|
|
|
|
|
|
|
|
|
|
|
public Tap_BM()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Tap_BM(string elementName, Guid elementGuid, List<string> tags, BaseElement_BM attachedElement, float exactJudgeTime)
|
|
|
|
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExecuteBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
matchedElement = Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override BaseElement DuplicateBM(BaseElement parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-01-28 11:58:39 -05:00
|
|
|
|
}
|