Statistics with a chart at the end of a game, 64 achievements kept locally and on the server
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
193b199875
commit
9931ca9b54
37 files changed
+1833
-4
No files matched your search
+16
-1
@@ -14,6 +14,7 @@ use crate::settings::{all_actions, key_name, Action, Settings};
|
||||
use crate::ui::{grid_center, grid_center_y, mouse, sh, sw, tool_info, wrap, side_color, CH, CW, DIM, FRAME, FRAME_HI, GOLD, S, SMALL, TITLE, TOOLS, TXT};
|
||||
use macroquad::prelude::*;
|
||||
|
||||
mod achievements;
|
||||
mod bestiary;
|
||||
pub mod flags;
|
||||
|
||||
@@ -33,6 +34,7 @@ pub enum Page {
|
||||
Account, // password, logout, users (admin)
|
||||
Match { from_title: bool }, // multiplayer lobby and match status
|
||||
Bestiary { tab: usize, sel: usize, level: u32, from_title: bool }, // units, buildings, ranks
|
||||
Achievements { from_title: bool },
|
||||
}
|
||||
|
||||
pub const TABS: [&str; 6] = ["set.tab.sound", "set.tab.camera", "set.tab.graphics", "set.tab.game", "set.tab.debug", "set.tab.keys"];
|
||||
@@ -294,6 +296,7 @@ enum Btn {
|
||||
MatchLeave,
|
||||
MatchChat,
|
||||
Bestiary,
|
||||
Achievements,
|
||||
BestTab(usize),
|
||||
BestSel(i32),
|
||||
BestPick(usize),
|
||||
@@ -441,6 +444,7 @@ pub struct Menu {
|
||||
confirm: Option<Btn>, // overwrite / delete waiting for a second click
|
||||
scroll: usize,
|
||||
rows_visible: usize,
|
||||
pub profile: crate::achievements::Profile, // shown on the achievements page
|
||||
buttons: Vec<(Rect, Btn)>,
|
||||
lang_open: Option<Rect>, // the language dropdown is open below/above this field
|
||||
lang_scroll: usize, // first language shown in the open dropdown
|
||||
@@ -505,6 +509,7 @@ impl Menu {
|
||||
lang_rows: 0,
|
||||
cur_lang: String::new(),
|
||||
rows_visible: 1,
|
||||
profile: Default::default(),
|
||||
buttons: Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -530,6 +535,7 @@ impl Menu {
|
||||
Some(Page::Match { from_title }) => Some(if from_title { Page::Title } else { Page::Pause }),
|
||||
Some(Page::Bestiary { from_title: true, .. }) => Some(Page::Title),
|
||||
Some(Page::Bestiary { from_title: false, .. }) => Some(Page::Pause),
|
||||
Some(Page::Achievements { from_title }) => Some(if from_title { Page::Title } else { Page::Pause }),
|
||||
Some(Page::Briefing { ingame: true, .. }) => Some(Page::Pause),
|
||||
Some(Page::Briefing { ingame: false, .. }) => Some(Page::Campaign),
|
||||
Some(Page::CustomBriefing) => None,
|
||||
@@ -916,6 +922,11 @@ impl Menu {
|
||||
}
|
||||
MenuAction::Consumed
|
||||
}
|
||||
Some(Btn::Achievements) => {
|
||||
self.page = Some(Page::Achievements { from_title });
|
||||
self.scroll = 0;
|
||||
MenuAction::Consumed
|
||||
}
|
||||
Some(Btn::Bestiary) => {
|
||||
self.open_bestiary(from_title);
|
||||
MenuAction::Consumed
|
||||
@@ -954,6 +965,7 @@ impl Menu {
|
||||
Page::Briefing { mission, ingame } => self.draw_briefing(gfx, mission, ingame),
|
||||
Page::CustomBriefing => self.draw_custom_briefing(gfx),
|
||||
Page::Bestiary { tab, sel, level, .. } => self.draw_bestiary(gfx, tab, sel, level),
|
||||
Page::Achievements { .. } => self.draw_achievements(gfx),
|
||||
Page::KeyCapture { action, .. } => {
|
||||
self.draw_settings(gfx, settings, 5);
|
||||
self.buttons.clear();
|
||||
@@ -1098,6 +1110,7 @@ impl Menu {
|
||||
}
|
||||
items.push((Btn::Standalone, tr("menu.standalone")));
|
||||
items.push((Btn::Bestiary, tr("menu.bestiary")));
|
||||
items.push((Btn::Achievements, tr("menu.achievements")));
|
||||
items.push((Btn::Help, tr("menu.help")));
|
||||
let w = 26.0 * CW();
|
||||
let y = ty + GH * big + CH() * 4.0;
|
||||
@@ -1215,6 +1228,7 @@ impl Menu {
|
||||
items.extend([
|
||||
(Btn::Settings, tr("menu.settings")),
|
||||
(Btn::Bestiary, tr("menu.bestiary")),
|
||||
(Btn::Achievements, tr("menu.achievements")),
|
||||
(Btn::Help, tr("menu.help")),
|
||||
(Btn::MainMenu, tr("net.leave")),
|
||||
]);
|
||||
@@ -1225,6 +1239,7 @@ impl Menu {
|
||||
(Btn::Match, tr("menu.multiplayer")),
|
||||
(Btn::Settings, tr("menu.settings")),
|
||||
(Btn::Bestiary, tr("menu.bestiary")),
|
||||
(Btn::Achievements, tr("menu.achievements")),
|
||||
(Btn::Help, tr("menu.help")),
|
||||
(Btn::MainMenu, tr("menu.main")),
|
||||
]);
|
||||
@@ -1780,7 +1795,7 @@ impl Menu {
|
||||
pub fn scrollable(&self) -> bool {
|
||||
matches!(
|
||||
self.page,
|
||||
Some(Page::Saves { .. }) | Some(Page::Campaign) | Some(Page::CampaignEditor) | Some(Page::Briefing { .. }) | Some(Page::CustomBriefing) | Some(Page::Settings { tab: 5, .. }) | Some(Page::Match { .. }) | Some(Page::Account)
|
||||
Some(Page::Saves { .. }) | Some(Page::Campaign) | Some(Page::CampaignEditor) | Some(Page::Briefing { .. }) | Some(Page::CustomBriefing) | Some(Page::Settings { tab: 5, .. }) | Some(Page::Match { .. }) | Some(Page::Account) | Some(Page::Achievements { .. })
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user