From 47ede702f6a9beda2c48659404857bcc6321e887 Mon Sep 17 00:00:00 2001 From: falsycat Date: Mon, 14 Oct 2019 00:00:00 +0000 Subject: [PATCH] [fix] Fixed an issue that sjplayer.Context wasn't destroyed after end of the game. --- src/sj/PlayScene.d | 14 ++++++++++---- src/sj/TitleScene.d | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/sj/PlayScene.d b/src/sj/PlayScene.d index e24c7af..c2c5e06 100644 --- a/src/sj/PlayScene.d +++ b/src/sj/PlayScene.d @@ -42,15 +42,16 @@ class PlayScene : SceneInterface { music_.PlayForGame(); } override SceneInterface Update(KeyInput input) { - const beat = music_.beat; + beat_ = music_.beat; - if (beat >= context_.length) { + if (beat_ >= context_.length) { music_.StopPlaying(); + result_scene_.Initialize(music_, score_); return result_scene_; } - context_.OperateScheduledControllers(beat); + context_.OperateScheduledControllers(beat_); context_.actor.Accelarate(GetAccelarationFromKeyInput(input)); @@ -78,6 +79,10 @@ class PlayScene : SceneInterface { context_.DrawActor(); context_.EndDrawing(); + + if (beat_ >= context_.length) { + context_.destroy(); + } } private: @@ -95,5 +100,6 @@ class PlayScene : SceneInterface { Music music_; sjplayer.Context context_; - int score_; + float beat_; + int score_; } diff --git a/src/sj/TitleScene.d b/src/sj/TitleScene.d index 0cff0ff..2b40f70 100644 --- a/src/sj/TitleScene.d +++ b/src/sj/TitleScene.d @@ -65,7 +65,7 @@ class TitleScene : SceneInterface { lobby_.cube_interval = cube_interval_ease_.Calculate(ratio); - if (input.down) { + if (anime_.isFinished && input.down) { select_scene_.Initialize(); return select_scene_; }