From d1cebcca2018ed4ef47ad125e45aafd018a2ab2e Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Fri, 10 Jan 2025 14:43:42 +0100 Subject: make format --- game/menus/shop/ButtonBuySelectBubbleScript.cpp | 18 +++--- game/menus/shop/ButtonBuySelectBulletScript.cpp | 18 +++--- game/menus/shop/ShopLoadScript.cpp | 73 ++++++++++++------------- game/menus/shop/ShopMenuScene.cpp | 21 ++++--- game/menus/shop/Shopconfig.h | 2 - 5 files changed, 63 insertions(+), 69 deletions(-) (limited to 'game/menus/shop') diff --git a/game/menus/shop/ButtonBuySelectBubbleScript.cpp b/game/menus/shop/ButtonBuySelectBubbleScript.cpp index 21dbe1a..741afde 100644 --- a/game/menus/shop/ButtonBuySelectBubbleScript.cpp +++ b/game/menus/shop/ButtonBuySelectBubbleScript.cpp @@ -17,19 +17,17 @@ void ButtonBuySelectBubbleScript::init() { bool ButtonBuySelectBubbleScript::on_button_press(const ButtonPressEvent & e) { SaveManager & save = this->get_save_manager(); - ValueBroker buy_bullet = save.get(BUY_BUBBLE_SAVE,0); - if(!buy_bullet.get()){ - ValueBroker coins = save.get(TOTAL_COINS_GAME,0); - if(coins.get() >= 1000) - { + ValueBroker buy_bullet = save.get(BUY_BUBBLE_SAVE, 0); + if (!buy_bullet.get()) { + ValueBroker coins = save.get(TOTAL_COINS_GAME, 0); + if (coins.get() >= 1000) { int coin = coins.get(); coin -= 1000; - save.set(TOTAL_COINS_GAME,coin); - save.set(BUY_BUBBLE_SAVE,1); + save.set(TOTAL_COINS_GAME, coin); + save.set(BUY_BUBBLE_SAVE, 1); } - } - else { - save.set(JETPACK_PARTICLES,1); + } else { + save.set(JETPACK_PARTICLES, 1); } this->trigger_event(); return false; diff --git a/game/menus/shop/ButtonBuySelectBulletScript.cpp b/game/menus/shop/ButtonBuySelectBulletScript.cpp index 71d8b76..d30849c 100644 --- a/game/menus/shop/ButtonBuySelectBulletScript.cpp +++ b/game/menus/shop/ButtonBuySelectBulletScript.cpp @@ -17,19 +17,17 @@ void ButtonBuySelectBulletScript::init() { bool ButtonBuySelectBulletScript::on_button_press(const ButtonPressEvent & e) { SaveManager & save = this->get_save_manager(); - ValueBroker buy_bullet = save.get(BUY_BULLET_SAVE,0); - if(!buy_bullet.get()){ - ValueBroker coins = save.get(TOTAL_COINS_GAME,0); - if(coins.get() >= 0) - { + ValueBroker buy_bullet = save.get(BUY_BULLET_SAVE, 0); + if (!buy_bullet.get()) { + ValueBroker coins = save.get(TOTAL_COINS_GAME, 0); + if (coins.get() >= 0) { int coin = coins.get(); coin -= 0; - save.set(TOTAL_COINS_GAME,coin); - save.set(BUY_BULLET_SAVE,1); + save.set(TOTAL_COINS_GAME, coin); + save.set(BUY_BULLET_SAVE, 1); } - } - else { - save.set(JETPACK_PARTICLES,0); + } else { + save.set(JETPACK_PARTICLES, 0); } this->trigger_event(); return false; diff --git a/game/menus/shop/ShopLoadScript.cpp b/game/menus/shop/ShopLoadScript.cpp index a9f9bfe..a545fe2 100644 --- a/game/menus/shop/ShopLoadScript.cpp +++ b/game/menus/shop/ShopLoadScript.cpp @@ -1,129 +1,124 @@ #include "ShopLoadScript.h" -#include +#include "Shopconfig.h" #include "api/Button.h" #include "api/Sprite.h" -#include "Shopconfig.h" #include "api/Text.h" #include "manager/SaveManager.h" +#include using namespace crepe; using namespace std; void ShopLoadScript::init() { this->update(); - this->subscribe([this](const ShopUpdate e) { - return this->update(); - }); + this->subscribe([this](const ShopUpdate e) { return this->update(); }); } -bool ShopLoadScript::update(){ +bool ShopLoadScript::update() { SaveManager & save = this->get_save_manager(); - ValueBroker buy_bullet = save.get(BUY_BULLET_SAVE,0); - ValueBroker buy_bubble = save.get(BUY_BUBBLE_SAVE,0); + ValueBroker buy_bullet = save.get(BUY_BULLET_SAVE, 0); + ValueBroker buy_bubble = save.get(BUY_BUBBLE_SAVE, 0); - - if(buy_bullet.get()){ + if (buy_bullet.get()) { auto sprites = this->get_components_by_tag(BUY_BULLET); - for(auto sprite : sprites){ + for (auto sprite : sprites) { sprite.get().active = false; } auto buttons = this->get_components_by_tag