31 return _states[
slot].Menus.back().get();
40 return _states[
slot].Menus.front().get();
57 if (!_states[
slot].Menus.empty())
77 _states[
slot].Menus.push_back(std::move(
menu));
92 state.Menus.pop_back();
93 if (
state.Menus.empty())
122 _states[
slot].Menus.resize(1);
126void MenuStack::Rebuild(
int slot)
132 state.Breadcrumb.clear();
133 for (std::size_t
i = 0;
i + 1 <
state.Menus.size(); ++
i)
135 if (!
state.Breadcrumb.empty())
159 *
row.State ? _translations.
GetOr(
"menu.on",
slot,
"ON") : _translations.
GetOr(
"menu.off",
slot,
"OFF");
163 if (
state.Rows.size() !=
menu->Items.size())
165 state.Rows.assign(
menu->Items.size(), RowMemory{});
169 RowMemory&
memory =
state.Rows[
static_cast<std::size_t
>(index)];
230 const std::shared_ptr<Menu>
held = _states[
slot].Menus.back();
253void MenuStack::ApplyPending(
int slot)
255 _pending.Apply(slot);
258bool MenuStack::IsPending(
int slot,
int index)
const
260 return _pending.IsPending(slot, index);
bool IsPending(int slot, int index) const
void Hold(int slot, int index, std::function< void()> commit)
std::function< Subscription(int64_t delayMs, std::function< void()> callback)> Timer
One-shot delays and repeating timers, run on the game thread.
"The occupant of this slot changed" - raised by PlayerManager, consumed below it.
static int64_t MonotonicMs()
Localization system. Loads one JSON file per language; nested objects flatten into dotted keys (categ...
std::string GetOr(std::string_view key, int slot, std::string_view fallback) const
@ Toggle
Carries an on/off value.
static constexpr std::string_view kBreadcrumbSeparator
static std::string ReadFile(const std::filesystem::path &path)
constexpr bool IsValidSlot(int slot)
bool IsRowActionable(const MenuItem &item, int slot)
static PendingCommit::Timer TimerOn(Scheduler &scheduler)