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

View file

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