2025-06-03 02:42:28 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using Dreamteck.Splines;
|
|
|
|
|
|
using Ichni.RhythmGame.Beatmap;
|
|
|
|
|
|
using Lean.Pool;
|
|
|
|
|
|
using UniRx;
|
|
|
|
|
|
using Unity.VisualScripting;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class Tap : NoteBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public static Tap GenerateElement(string elementName, Guid id, List<string> tags, bool isFirstGenerated,
|
|
|
|
|
|
GameElement parentElement, float exactJudgeTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
Tap tap = Instantiate(GameManager.instance.basePrefabs.tapNote, parentElement.transform).GetComponent<Tap>();
|
|
|
|
|
|
|
|
|
|
|
|
tap.Initialize(elementName, id, tags, isFirstGenerated, parentElement);
|
|
|
|
|
|
tap.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
tap.judgeIntervals = new NoteJudgeIntervals(
|
2025-07-10 08:42:30 -04:00
|
|
|
|
new TimeInterval(-0.15f, -0.15f), new TimeInterval(-0.15f, -0.125f),
|
|
|
|
|
|
new TimeInterval(-0.125f, -0.1f), new TimeInterval(-0.1f, 0.1f),
|
|
|
|
|
|
new TimeInterval(0.1f, 0.125f), new TimeInterval(0.125f, 0.15f), 0.15f);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
|
|
|
|
|
|
if (parentElement.TryGetComponent(out Track track))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (track.trackTimeSubmodule != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
tap.track = track;
|
|
|
|
|
|
tap.trackPositioner = tap.AddComponent<SplinePositioner>();
|
|
|
|
|
|
tap.trackPositioner.spline = track.trackPathSubmodule.path;
|
|
|
|
|
|
tap.isOnTrack = true;
|
|
|
|
|
|
tap.UpdateNoteInTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new System.Exception("如果Note要生成在Track上,Track必须有TrackTimeSubmodule组件。");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
tap.track = null;
|
|
|
|
|
|
tap.isOnTrack = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
float songTime = GameManager.instance.songTime;
|
|
|
|
|
|
|
|
|
|
|
|
if (!isFirstJudged &&
|
|
|
|
|
|
songTime >= exactJudgeTime + judgeIntervals.beforeMiss.intervalStart &&
|
|
|
|
|
|
!GameManager.instance.inputManager.checkingTapList.Contains(this))
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.instance.inputManager.checkingTapList.Add(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
base.Update();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override NoteJudgeType GetStartJudgeType(float timeDifference)
|
|
|
|
|
|
{
|
|
|
|
|
|
return judgeIntervals.GetNoteJudgeType(timeDifference);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExecuteStartJudge()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.ExecuteStartJudge();
|
2025-07-08 14:28:40 -04:00
|
|
|
|
|
|
|
|
|
|
isFinalJudged = true;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
|
|
|
|
|
|
if (GameManager.instance.inputManager.checkingTapList.Contains(this))
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.instance.inputManager.checkingTapList.Remove(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class Tap
|
|
|
|
|
|
{
|
|
|
|
|
|
public override void SetDefaultSubmodules()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.SetDefaultSubmodules();
|
|
|
|
|
|
noteAudioSubmodule = new NoteAudioSubmodule(this, "DefaultTap");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void SaveBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
matchedBM = new Tap_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, exactJudgeTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class Tap
|
|
|
|
|
|
{
|
|
|
|
|
|
public bool CheckJudgeAvailability(InputUnitTap inputUnitTap)
|
|
|
|
|
|
{
|
|
|
|
|
|
return noteJudgeSubmodule.judgeUnitList.All(judgeUnit => judgeUnit.CheckJudgeAvailability(inputUnitTap));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Beatmap
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Tap_BM : NoteBase_BM
|
|
|
|
|
|
{
|
|
|
|
|
|
public Tap_BM()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Tap_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement, float exactJudgeTime)
|
|
|
|
|
|
: base(elementName, elementGuid, tags, attachedElement, exactJudgeTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExecuteBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
matchedElement = Tap.GenerateElement(elementName, elementGuid, tags, false,
|
|
|
|
|
|
GetElement(attachedElementGuid), exactJudgeTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override GameElement DuplicateBM(GameElement parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Tap.GenerateElement(elementName, Guid.NewGuid(), tags, false, parent, exactJudgeTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|