Cleaned up the ritual UI some more and solved a few more bugs, then brought in a quick 'dubious combination' image.
This commit is contained in:
parent
bac552c3d7
commit
edf10c976a
8 changed files with 36 additions and 32 deletions
|
@ -309,6 +309,16 @@
|
||||||
{"path": "assets/rituals/stone_doll_cursed-128.png",
|
{"path": "assets/rituals/stone_doll_cursed-128.png",
|
||||||
"frame_width": 128,
|
"frame_width": 128,
|
||||||
"frame_height": 128
|
"frame_height": 128
|
||||||
|
},
|
||||||
|
"dubious_combination-64":
|
||||||
|
{"path": "assets/rituals/dubious_combination-64.png",
|
||||||
|
"frame_width": 64,
|
||||||
|
"frame_height": 64
|
||||||
|
},
|
||||||
|
"dubious_combination-128":
|
||||||
|
{"path": "assets/rituals/dubious_combination-128.png",
|
||||||
|
"frame_width": 128,
|
||||||
|
"frame_height": 128
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"worldgen": {
|
"worldgen": {
|
||||||
|
|
|
@ -197,6 +197,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"starting_junk": [
|
"starting_junk": [
|
||||||
"dirty_kerchief", "pocket_watch", "chess_pawn", "mushroom", "severed_finger", "rusty_nails"
|
"pocket_watch", "mushroom", "rusty_nails"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
BIN
assets/rituals/dubious_combination-128.png
Normal file
BIN
assets/rituals/dubious_combination-128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
assets/rituals/dubious_combination-64.png
Normal file
BIN
assets/rituals/dubious_combination-64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
@ -54,12 +54,6 @@ namespace gui {
|
||||||
[&](auto, auto){ event(Event::TOGGLE); }
|
[&](auto, auto){ event(Event::TOGGLE); }
|
||||||
});
|
});
|
||||||
|
|
||||||
auto combine = $gui.entity("combine");
|
|
||||||
$gui.set<Rectangle>(combine, {});
|
|
||||||
$gui.set<Label>(combine, {L"combine"});
|
|
||||||
$gui.set<Clickable>(combine, {
|
|
||||||
[&](auto, auto){ event(Event::COMBINE); }
|
|
||||||
});
|
|
||||||
|
|
||||||
$craft_state = $ritual_engine.start();
|
$craft_state = $ritual_engine.start();
|
||||||
$gui.init();
|
$gui.init();
|
||||||
|
@ -166,12 +160,7 @@ namespace gui {
|
||||||
state(State::OPENED);
|
state(State::OPENED);
|
||||||
} else {
|
} else {
|
||||||
run_crafting_engine();
|
run_crafting_engine();
|
||||||
|
show_craft_result();
|
||||||
if(!$craft_state.is_combined()) {
|
|
||||||
show_craft_failure();
|
|
||||||
} else {
|
|
||||||
show_craft_result();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,19 +215,31 @@ namespace gui {
|
||||||
void UI::show_craft_result() {
|
void UI::show_craft_result() {
|
||||||
using enum ::ritual::Element;
|
using enum ::ritual::Element;
|
||||||
auto ritual = $ritual_engine.finalize($craft_state);
|
auto ritual = $ritual_engine.finalize($craft_state);
|
||||||
|
auto combine = $gui.entity("result_image");
|
||||||
|
|
||||||
switch(ritual.element) {
|
if($craft_state.is_combined()) {
|
||||||
case FIRE:
|
$gui.show_label("result_text", L"This might work...");
|
||||||
$gui.show_sprite("result_image", "broken_yoyo-64");
|
|
||||||
break;
|
switch(ritual.element) {
|
||||||
case LIGHTNING:
|
case FIRE:
|
||||||
$gui.show_sprite("result_image", "pocket_watch-64");
|
$gui.show_sprite("result_image", "broken_yoyo-64");
|
||||||
break;
|
break;
|
||||||
default:
|
case LIGHTNING:
|
||||||
$gui.show_sprite("result_image", "severed_finger-64");
|
$gui.show_sprite("result_image", "pocket_watch-64");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$gui.show_sprite("result_image", "severed_finger-64");
|
||||||
|
}
|
||||||
|
|
||||||
|
$gui.set<Clickable>(combine, {
|
||||||
|
[&](auto, auto){ event(Event::COMBINE); }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$gui.show_label("result_text", L"That won't work.");
|
||||||
|
$gui.show_sprite("result_image", "dubious_combination-128");
|
||||||
|
$gui.remove<Clickable>(combine);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$gui.show_label("result_text", L"CRAFTING");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::clear_craft_result() {
|
void UI::clear_craft_result() {
|
||||||
|
@ -246,10 +247,5 @@ namespace gui {
|
||||||
$gui.close<Label>("result_text");
|
$gui.close<Label>("result_text");
|
||||||
$gui.close<Sprite>("result_image");
|
$gui.close<Sprite>("result_image");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::show_craft_failure() {
|
|
||||||
$gui.close<Sprite>("result_image");
|
|
||||||
$gui.show_label("result_text", L"FAILED!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ namespace gui {
|
||||||
void select_item(SelectedItem pair);
|
void select_item(SelectedItem pair);
|
||||||
void show_craft_result();
|
void show_craft_result();
|
||||||
void clear_craft_result();
|
void clear_craft_result();
|
||||||
void show_craft_failure();
|
|
||||||
void run_crafting_engine();
|
void run_crafting_engine();
|
||||||
void complete_combine();
|
void complete_combine();
|
||||||
void update_selection_state();
|
void update_selection_state();
|
||||||
|
|
|
@ -232,8 +232,7 @@ void System::combat(GameLevel &level, int attack_id) {
|
||||||
auto player = world.get_the<Player>();
|
auto player = world.get_the<Player>();
|
||||||
auto& the_belt = world.get_the<ritual::Belt>();
|
auto& the_belt = world.get_the<ritual::Belt>();
|
||||||
|
|
||||||
dbc::check(the_belt.has(attack_id),
|
if(!the_belt.has(attack_id)) return;
|
||||||
fmt::format("the_belt does not have an attack with id={}", attack_id));
|
|
||||||
|
|
||||||
auto& ritual = the_belt.get(attack_id);
|
auto& ritual = the_belt.get(attack_id);
|
||||||
const auto& player_position = world.get<Position>(player.entity);
|
const auto& player_position = world.get<Position>(player.entity);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue