using System; using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; using Ichni.RhythmGame.Beatmap; using Lean.Pool; using Unity.VisualScripting; using UnityEngine; namespace Ichni.RhythmGame { public partial class Flick : NoteBase { public static readonly NoteJudgeIntervals judgeIntervals = new NoteJudgeIntervals( new TimeInterval(-0.25f, -0.25f), new TimeInterval(-0.25f, -0.25f), new TimeInterval(-0.25f, -0.25f), new TimeInterval(-0.25f, 0.15f), new TimeInterval(0.15f, 0.25f), new TimeInterval(0.25f, 0.25f), 0.25f); public List availableFlickDirections; public float flickBufferAngle = 60f; public static Flick GenerateElement(string elementName, Guid id, List tags, bool isFirstGenerated, GameElement parentElement, float exactJudgeTime, List directions) { Flick flick = Instantiate(GameManager.instance.basePrefabs.flickNote, parentElement.transform).GetComponent(); flick.Initialize(elementName, id, tags, isFirstGenerated, parentElement); flick.exactJudgeTime = exactJudgeTime; flick.availableFlickDirections = directions; if (parentElement.TryGetComponent(out Track track)) { if (track.trackTimeSubmodule != null) { flick.track = track; flick.trackPositioner = flick.AddComponent(); flick.trackPositioner.spline = track.trackPathSubmodule.path; flick.isOnTrack = true; flick.UpdateNoteInTrack(); } else { throw new System.Exception("如果Note要生成在Track上,Track必须有TrackTimeSubmodule组件。"); } } else { flick.track = null; flick.isOnTrack = false; } return flick; } public void SetFirstJudge(Vector3 deltaPosition) { } } public partial class Flick { public override void SetDefaultSubmodules() { base.SetDefaultSubmodules(); noteAudioSubmodule = new NoteAudioSubmodule(this, "DefaultStay"); } public override void SaveBM() { matchedBM = new Flick_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, exactJudgeTime, availableFlickDirections); } } namespace Beatmap { public class Flick_BM : NoteBase_BM { public List availableFlickDirections; public Flick_BM() { } public Flick_BM(string elementName, Guid elementGuid, List tags, GameElement_BM attachedElement, float exactJudgeTime, List directions) : base(elementName, elementGuid, tags, attachedElement, exactJudgeTime) { availableFlickDirections = directions; } public override void ExecuteBM() { matchedElement = Flick.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid), exactJudgeTime, availableFlickDirections); } public override GameElement DuplicateBM(GameElement parent) { return Flick.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent, exactJudgeTime, availableFlickDirections); } } } }