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