ScheduleMissableInput

This commit is contained in:
fu-majime 2024-03-13 23:10:12 +09:00
parent 8ce190c5d9
commit cd97bc0d13
3 changed files with 20 additions and 3 deletions

View file

@ -46,6 +46,8 @@ namespace HeavenStudio.Games
public bool countsForAccuracy = true; //Indicates if the input counts for the accuracy or not. If set to false, it'll not be counted in the accuracy calculation public bool countsForAccuracy = true; //Indicates if the input counts for the accuracy or not. If set to false, it'll not be counted in the accuracy calculation
public bool missable = false; //Indicates if the miss input counts for the accuracy or not. If set to true, it'll not be counted in the accuracy calculation
public void setHitCallback(ActionEventCallbackState OnHit) public void setHitCallback(ActionEventCallbackState OnHit)
{ {
this.OnHit = OnHit; this.OnHit = OnHit;
@ -332,7 +334,7 @@ namespace HeavenStudio.Games
OnMiss(this); OnMiss(this);
} }
if (countsForAccuracy && gm.canInput && !(noAutoplay || autoplayOnly)) if (countsForAccuracy && !missable && gm.canInput && !(noAutoplay || autoplayOnly))
{ {
gm.ScoreInputAccuracy(startBeat + timer, 0, true, 2.0, weight, false); gm.ScoreInputAccuracy(startBeat + timer, 0, true, 2.0, weight, false);
GoForAPerfect.instance.Miss(); GoForAPerfect.instance.Miss();

View file

@ -216,6 +216,7 @@ namespace HeavenStudio.Games
PlayerActionEvent.ActionEventHittableQuery HittableQuery = null) PlayerActionEvent.ActionEventHittableQuery HittableQuery = null)
{ {
PlayerActionEvent evt = ScheduleInput(startBeat, timer, inputAction, OnHit, OnMiss, OnBlank, HittableQuery); PlayerActionEvent evt = ScheduleInput(startBeat, timer, inputAction, OnHit, OnMiss, OnBlank, HittableQuery);
evt.missable = true;
return evt; return evt;
} }
@ -232,6 +233,20 @@ namespace HeavenStudio.Games
if (BeatIsInBopRegion(beat)) Bop(beat); if (BeatIsInBopRegion(beat)) Bop(beat);
} }
[NonSerialized] public double gameEndBeat = double.MaxValue;
public override void OnGameSwitch(double beat)
{
var entities = GameManager.instance.Beatmap.Entities;
// find out when the next game switch (or remix end) happens
RiqEntity firstEnd = entities.Find(c => (c.datamodel.StartsWith("gameManager/switchGame") || c.datamodel.Equals("gameManager/end")) && c.beat > beat);
gameEndBeat = firstEnd?.beat ?? double.MaxValue;
}
public override void OnPlay(double beat)
{
OnGameSwitch(beat);
}
void Update() void Update()
{ {
var cond = Conductor.instance; var cond = Conductor.instance;

View file

@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_SickBeats
public void Appear() public void Appear()
{ {
if (startBeat >= game.gameEndBeat) return;
MultiSound.Play(new MultiSound.Sound[] MultiSound.Play(new MultiSound.Sound[]
{ {
new MultiSound.Sound("sickBeats/appear"+UnityEngine.Random.Range(0, 2).ToString(), startBeat), new MultiSound.Sound("sickBeats/appear"+UnityEngine.Random.Range(0, 2).ToString(), startBeat),
@ -42,7 +42,7 @@ namespace HeavenStudio.Games.Scripts_SickBeats
})}); })});
isJust = false; isJust = false;
PlayerInput.InputAction InputAction; PlayerInput.InputAction InputAction;
if (PlayerInput.PlayerHasControl() && PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Touch) if (PlayerInput.PlayerHasControl() && PlayerInput.CurrentControlStyle is InputSystem.InputController.ControlStyles.Touch)
{ {