Changed so that the next paper is set correctly.

This commit is contained in:
fu-majime 2024-03-11 13:54:35 +09:00
parent 2ccc7f5396
commit 6e40bbbc18
2 changed files with 15 additions and 22 deletions

View file

@ -82,11 +82,6 @@ namespace HeavenStudio.Games.Loaders
function = delegate {PowerCalligraphy.instance.TheEnd();},
defaultLength = 0.5f,
},
new GameAction("prepare", "Force Prepare")
{
function = delegate {var e = eventCaller.currentEntity; PowerCalligraphy.instance.ForcePrepare(e.beat);},
defaultLength = 0.5f,
},
},
new List<string>() { "agb", "normal" }, "agbCalligraphy", "en", new List<string>() { }
);
@ -108,7 +103,7 @@ namespace HeavenStudio.Games
public Animator fudePosAnim;
public Animator fudeAnim;
public static Nullable<QueuedPaper> queuedPaper = null;
public static int queuedType;
[Header("Variables")]
public Vector3 scrollSpeed = new Vector3();
@ -125,11 +120,6 @@ namespace HeavenStudio.Games
face_kr,
NONE,
}
public struct QueuedPaper
{
public double beat;
public int type;
}
double gameStartBeat;
public static PowerCalligraphy instance = null;
@ -142,6 +132,7 @@ namespace HeavenStudio.Games
public override void OnGameSwitch(double beat)
{
gameStartBeat = beat;
NextPrepare(beat);
}
public override void OnPlay(double beat)
{
@ -155,14 +146,14 @@ namespace HeavenStudio.Games
var cond = Conductor.instance;
if (!cond.isPlaying || cond.isPaused)
{
if (!cond.isPaused) queuedPaper = null;
if (!cond.isPaused) queuedType = (int)CharacterType.NONE;
return;
}
if (queuedPaper is not null)
if (queuedType != (int)CharacterType.NONE)
{
Prepare(queuedPaper.Value.type);
queuedPaper = null;
Prepare(queuedType);
queuedType = (int)CharacterType.NONE;
}
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
@ -198,17 +189,17 @@ namespace HeavenStudio.Games
nowPaper.startBeat = beat;
nowPaper.Play();
isPrepare=false;
double nextBeat = beat + nowPaper.nextBeat;
BeatAction.New(instance, new List<BeatAction.Action>(){
new BeatAction.Action(nextBeat, delegate{ NextPrepare(nextBeat);})
});
}
public void QueuePaper(double beat, int type)
{
if (GameManager.instance.currentGame != "powerCalligraphy")
{
queuedPaper = new QueuedPaper()
{
beat = 0,
type = type,
};
queuedType = type;
}
else if(Conductor.instance.songPositionInBeats < beat)
{
@ -225,7 +216,7 @@ namespace HeavenStudio.Games
isPrepare = true;
}
}
public void ForcePrepare(double beat)
public void NextPrepare(double beat) // Prepare next paper
{
double endBeat = double.MaxValue;
var entities = gameManager.Beatmap.Entities;

View file

@ -47,6 +47,7 @@ namespace HeavenStudio.Games.Scripts_PowerCalligraphy
}
public double startBeat;
public double nextBeat;
[SerializeField] PatternItem[] AnimPattern;
private Animator paperAnim;
@ -68,6 +69,7 @@ namespace HeavenStudio.Games.Scripts_PowerCalligraphy
game = PowerCalligraphy.instance;
paperAnim = GetComponent<Animator>();
paperSort = GetComponent<SortingGroup>();
nextBeat = AnimPattern[^1].beat;
}
public void Play()
@ -145,7 +147,7 @@ namespace HeavenStudio.Games.Scripts_PowerCalligraphy
break;
}
}
actions.Add(new BeatAction.Action(startBeat + AnimPattern[^1].beat, delegate { Finish();}));
actions.Add(new BeatAction.Action(startBeat + nextBeat, delegate { Finish();}));
if (sounds.Count > 0) MultiSound.Play(sounds.ToArray());
if (actions.Count > 0) BeatAction.New(game, actions);