add game_over

This commit is contained in:
Jim 2025-09-01 22:05:18 -04:00
parent 1ecd054a31
commit e9379a6a94
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
5 changed files with 57 additions and 23 deletions

View file

@ -15,7 +15,7 @@ use building_placement::SelectBuildingPreview;
use combat::Range;
use input::{SelectEntity, Selected};
use resources::{AvailableWorkers, Cost, ResourceDeposit, Resources, WorkedResourceDeposit};
use state::{BasePhaseState, CoreState, Phase};
use state::{BasePhaseState, CoreState, GameState, Phase};
use ui_state::GameUIState;
use upgrade::{UnlockUpgrade, Upgradable, Upgrade};
@ -32,6 +32,7 @@ impl Plugin for UiIngamePlugin {
.run_if(in_state(GameUIState::Default).and(in_state(CoreState::Unplaced))),
side_panel
.run_if(in_state(GameUIState::Default).and(in_state(CoreState::Placed))),
game_over.run_if(in_state(GameState::GameOver)),
plan_ui.run_if(in_state(GameUIState::Default).and(in_state(Phase::Plan))),
execute_ui.run_if(in_state(GameUIState::Default).and(in_state(Phase::Execute))),
transition_ui.run_if(
@ -60,6 +61,7 @@ impl Plugin for UiIngamePlugin {
}
}
const MEGA_FONT_SIZE: f32 = 64.;
const VERY_LARGE_FONT_SIZE: f32 = 48.;
const LARGE_FONT_SIZE: f32 = 24.;
const FONT_SIZE: f32 = 16.;
@ -176,7 +178,7 @@ fn transition_ui(
},
curr_state.get().phase_count()
))
.size(64.),
.size(MEGA_FONT_SIZE),
);
});
}
@ -352,8 +354,24 @@ fn place_core(
.title_bar(false)
.anchor(Align2::CENTER_BOTTOM, [0., 0.])
.show(ctx, |ui| {
if ui.button(RichText::new("COLONIZE").size(64.)).clicked() {
if ui
.button(RichText::new("COLONIZE").size(MEGA_FONT_SIZE))
.clicked()
{
selected_preview_writer.write(SelectBuildingPreview(Some(*core_preview)));
}
});
}
fn game_over(mut contexts: EguiContexts) {
let ctx = contexts.ctx_mut().unwrap();
egui::Window::new("TRANSITION")
.collapsible(false)
.title_bar(false)
.anchor(Align2::CENTER_CENTER, [0., 0.])
.fixed_size([600., 200.])
.show(ctx, |ui| {
ui.label(RichText::new("TRANSMISSION END").size(MEGA_FONT_SIZE));
});
}