[add] Added ResultScene.
This commit is contained in:
parent
3dbd498b8f
commit
98be1dbc74
@ -1,9 +1,9 @@
|
||||
actor [0..100] {
|
||||
actor [0..1] {
|
||||
color_a := 1;
|
||||
|
||||
clip_left := 0.1;
|
||||
}
|
||||
background [0..100] {
|
||||
background [0..1] {
|
||||
inner_r = 0.8;
|
||||
inner_g = 0.8;
|
||||
inner_b = 0.8;
|
||||
@ -14,7 +14,7 @@ background [0..100] {
|
||||
outer_b = 0;
|
||||
outer_a = 1;
|
||||
}
|
||||
posteffect [0..100] {
|
||||
posteffect [0..1] {
|
||||
clip_left := 0.1;
|
||||
clip_right := 0.1;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import sj.AbstractGame,
|
||||
sj.Music,
|
||||
sj.PlayScene,
|
||||
sj.ProgramSet,
|
||||
sj.ResultScene,
|
||||
sj.SelectScene,
|
||||
sj.TitleScene;
|
||||
|
||||
@ -38,12 +39,14 @@ class Game : AbstractGame {
|
||||
title_ = new TitleScene(lobby_, programs_);
|
||||
select_ = new SelectScene(lobby_, programs_, fonts_, music_list_);
|
||||
load_ = new LoadingScene(args, lobby_, programs_, fonts_);
|
||||
play_ = new PlayScene();
|
||||
play_ = new PlayScene;
|
||||
result_ = new ResultScene(lobby_, programs_, fonts_);
|
||||
|
||||
title_ .SetupSceneDependency(select_);
|
||||
select_.SetupSceneDependency(title_, load_);
|
||||
load_ .SetupSceneDependency(play_);
|
||||
play_ .SetupSceneDependency(); // TODO: pass result scene
|
||||
play_ .SetupSceneDependency(result_);
|
||||
result_.SetupSceneDependency();
|
||||
|
||||
title_.Initialize();
|
||||
super(title_);
|
||||
@ -54,6 +57,7 @@ class Game : AbstractGame {
|
||||
select_.destroy();
|
||||
load_.destroy();
|
||||
play_.destroy();
|
||||
result_.destroy();
|
||||
|
||||
lobby_.destroy();
|
||||
|
||||
@ -75,4 +79,5 @@ class Game : AbstractGame {
|
||||
SelectScene select_;
|
||||
LoadingScene load_;
|
||||
PlayScene play_;
|
||||
ResultScene result_;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ static import sjplayer;
|
||||
|
||||
import sj.KeyInput,
|
||||
sj.Music,
|
||||
sj.ResultScene,
|
||||
sj.SceneInterface;
|
||||
|
||||
///
|
||||
@ -20,7 +21,8 @@ class PlayScene : SceneInterface {
|
||||
}
|
||||
|
||||
///
|
||||
void SetupSceneDependency() { // TODO: add result scene
|
||||
void SetupSceneDependency(ResultScene result) {
|
||||
result_scene_ = result;
|
||||
}
|
||||
|
||||
///
|
||||
@ -31,7 +33,15 @@ class PlayScene : SceneInterface {
|
||||
music_.PlayForGame();
|
||||
}
|
||||
override SceneInterface Update(KeyInput input) {
|
||||
context_.OperateScheduledControllers(music_.beat);
|
||||
const beat = music_.beat;
|
||||
|
||||
if (beat >= context_.length) {
|
||||
music_.StopPlaying();
|
||||
result_scene_.Initialize(music_, 0); // TODO: pass a proper score
|
||||
return result_scene_;
|
||||
}
|
||||
|
||||
context_.OperateScheduledControllers(beat);
|
||||
|
||||
// TODO: actor accelaration
|
||||
|
||||
@ -52,6 +62,8 @@ class PlayScene : SceneInterface {
|
||||
}
|
||||
|
||||
private:
|
||||
ResultScene result_scene_;
|
||||
|
||||
Music music_;
|
||||
sjplayer.Context context_;
|
||||
}
|
||||
|
48
src/sj/ResultScene.d
Normal file
48
src/sj/ResultScene.d
Normal file
@ -0,0 +1,48 @@
|
||||
/// License: MIT
|
||||
module sj.ResultScene;
|
||||
|
||||
import gl4d;
|
||||
|
||||
import sj.FontSet,
|
||||
sj.KeyInput,
|
||||
sj.LobbyWorld,
|
||||
sj.Music,
|
||||
sj.ProgramSet,
|
||||
sj.SceneInterface;
|
||||
|
||||
///
|
||||
class ResultScene : SceneInterface {
|
||||
public:
|
||||
///
|
||||
this(LobbyWorld lobby, ProgramSet programs, FontSet fonts) {
|
||||
lobby_ = lobby;
|
||||
programs_ = programs;
|
||||
fonts_ = fonts;
|
||||
}
|
||||
~this() {
|
||||
}
|
||||
|
||||
///
|
||||
void SetupSceneDependency() {
|
||||
}
|
||||
|
||||
///
|
||||
void Initialize(Music music, int score) {
|
||||
music_ = music;
|
||||
}
|
||||
override SceneInterface Update(KeyInput input) {
|
||||
return this;
|
||||
}
|
||||
override void Draw() {
|
||||
lobby_.Draw();
|
||||
}
|
||||
|
||||
private:
|
||||
LobbyWorld lobby_;
|
||||
|
||||
ProgramSet programs_;
|
||||
|
||||
FontSet fonts_;
|
||||
|
||||
Music music_;
|
||||
}
|
Reference in New Issue
Block a user