All of the UIs should be cleared out, and that just leaves the tests.
This commit is contained in:
parent
d5ff57e025
commit
564f9842a2
23 changed files with 126 additions and 145 deletions
|
@ -6,15 +6,14 @@
|
|||
#include "rand.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "events.hpp"
|
||||
#include "game_level.hpp"
|
||||
|
||||
namespace gui {
|
||||
namespace ritual {
|
||||
using namespace guecs;
|
||||
using std::any, std::any_cast, std::string, std::make_any;
|
||||
|
||||
UI::UI(GameLevel level) :
|
||||
$level(level)
|
||||
{
|
||||
UI::UI() {
|
||||
$gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT);
|
||||
$gui.layout(
|
||||
"[_]"
|
||||
|
@ -186,11 +185,14 @@ namespace gui {
|
|||
}
|
||||
|
||||
void UI::complete_combine() {
|
||||
auto world = Game::current_world();
|
||||
auto player = Game::the_player();
|
||||
|
||||
if($craft_state.is_combined()) {
|
||||
auto ritual = $ritual_engine.finalize($craft_state);
|
||||
auto& belt = $level.world->get_the<::ritual::Belt>();
|
||||
auto& belt = world->get_the<::ritual::Belt>();
|
||||
belt.equip(belt.next(), ritual);
|
||||
$level.world->send<Events::GUI>(Events::GUI::NEW_RITUAL, $level.player, {});
|
||||
world->send<Events::GUI>(Events::GUI::NEW_RITUAL, player, {});
|
||||
blanket().consume_crafting();
|
||||
clear_craft_result();
|
||||
|
||||
|
@ -240,14 +242,15 @@ namespace gui {
|
|||
}
|
||||
}
|
||||
|
||||
void UI::update_level(GameLevel& level) {
|
||||
$level = level;
|
||||
}
|
||||
|
||||
void UI::clear_craft_result() {
|
||||
blanket().reset();
|
||||
$gui.close<Text>("result_text");
|
||||
$gui.close<Sprite>("result_image");
|
||||
}
|
||||
|
||||
::ritual::Blanket& UI::blanket() {
|
||||
auto world = Game::current_world();
|
||||
return world->get_the<::ritual::Blanket>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue