diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-23 21:17:45 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-23 21:17:45 +0100 |
commit | 225e873c8ac9c4c08720a69b8f2c817d22cf0071 (patch) | |
tree | 20c1539a7ea7d133fca143e922165fd7533c87fe /game/mainmenu/ButtonSubScene.cpp | |
parent | a3097a20daaf58e4e3852bfb36315dc5e14d3e52 (diff) |
made script reusable to switch scenes
Diffstat (limited to 'game/mainmenu/ButtonSubScene.cpp')
-rw-r--r-- | game/mainmenu/ButtonSubScene.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/game/mainmenu/ButtonSubScene.cpp b/game/mainmenu/ButtonSubScene.cpp index e61613b..b415f74 100644 --- a/game/mainmenu/ButtonSubScene.cpp +++ b/game/mainmenu/ButtonSubScene.cpp @@ -1,6 +1,7 @@ #include "ButtonSubScene.h" #include "ButtonScript.h" -#include "ButtonStartScript.h" +#include "ShowPreviewScript.h" +#include "ShowStartScript.h" #include "MainMenuConfig.h" #include <crepe/api/BehaviorScript.h> @@ -50,13 +51,10 @@ void ButtonSubScene::btn_text_middle(crepe::GameObject & button_object,const std void ButtonSubScene::set_script(crepe::GameObject & button_object,ScriptSelect script){ switch (script) { - case ScriptSelect::START: - button_object.add_component<BehaviorScript>().set_script<ButtonStartScript>(); - break; case ScriptSelect::PREVIEW: - case ScriptSelect::SHOP: - button_object.add_component<BehaviorScript>().set_script<ButtonScript>(); + button_object.add_component<BehaviorScript>().set_script<ShowPreviewScript>(); break; + case ScriptSelect::SHOP: case ScriptSelect::NONE: break; } |