72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using Convention;
|
|
using UnityEngine;
|
|
|
|
namespace Demo.Game
|
|
{
|
|
public class FullScreenInteraction : IInteraction
|
|
{
|
|
public static FullScreenInteraction Make()
|
|
{
|
|
return new GameObject().AddComponent<FullScreenInteraction>();
|
|
}
|
|
|
|
[Content] public bool IsNeedTap = true;
|
|
[Content, SerializeField] private bool IsJudgement = false;
|
|
[Content, SerializeField] private bool IsReleaseJudgementEffect = false;
|
|
|
|
/// <summary>
|
|
/// 设置为Hold模式, 即不需要点按即可判定的模式
|
|
/// </summary>
|
|
[Convention.RScript.Variable.Attr.Method]
|
|
public void EnableHoldMode()
|
|
{
|
|
IsNeedTap = false;
|
|
}
|
|
|
|
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
|
{
|
|
base.UpdateTicks(currentTime, deltaTime, tickType);
|
|
if (tickType == TickType.Pause || tickType == TickType.Reset)
|
|
{
|
|
IsJudgement = false;
|
|
IsReleaseJudgementEffect = false;
|
|
}
|
|
}
|
|
|
|
public override JudgementLevel JudgementBehaviour(float timePoint)
|
|
{
|
|
var stats = timePoint > GetBestJudgementTimePoint();
|
|
if (IsJudgement)
|
|
{
|
|
if (IsNeedTap)
|
|
return JudgementLevel.None;
|
|
else if (stats && IsReleaseJudgementEffect == false)
|
|
{
|
|
IsReleaseJudgementEffect = true;
|
|
return JudgementLevel.BestLevel;
|
|
}
|
|
else
|
|
return JudgementLevel.None;
|
|
}
|
|
if (GetRoot().RootGameController.IsAutoPlay)
|
|
return stats ? JudgementLevel.BestLevel: JudgementLevel.None;
|
|
var inputs = GetRoot().InputCatch;
|
|
var index = inputs.FindIndex(x => IsInInteractiveDuration(x.TimePoint));
|
|
if (index != -1)
|
|
{
|
|
if (IsNeedTap)
|
|
{
|
|
inputs.RemoveAt(index);
|
|
return JudgementLevel.Default;
|
|
}
|
|
else
|
|
{
|
|
IsJudgement = true;
|
|
return JudgementLevel.None;
|
|
}
|
|
}
|
|
return JudgementLevel.None;
|
|
}
|
|
}
|
|
}
|