|
VoltMod
C++23 framework for CS2 server plugins
|
runtime.Menus: the surface menus start on, chosen once per session.
More...
#include <MenuRouter.hpp>
Inheritance diagram for VoltMod::MenuRouter:Public Member Functions | |
| MenuRouter (MenuSurface &fallback) | |
| Subscription | Prefer (MenuSurface &surface) |
| bool | OpenSession (int slot, std::shared_ptr< Menu > menu, MenuOptions options) override |
| void | Open (int slot, std::shared_ptr< Menu > menu) override |
| bool | IsOpen (int slot) const override |
| void | Close (int slot) override |
| void | CloseAll (int slot) override |
| void | CloseAll (int slot, std::string_view replyKey) override |
| void | Prompt (int slot, std::string prompt, std::function< bool(int slot, std::string_view text)> callback) override |
| std::string | Translate (int slot, std::string_view key, std::string_view fallback) const override |
Public Member Functions inherited from VoltMod::MenuSurface | |
| virtual | ~MenuSurface ()=default |
| MenuSurface (const MenuSurface &)=delete | |
| MenuSurface & | operator= (const MenuSurface &)=delete |
Additional Inherited Members | |
Protected Member Functions inherited from VoltMod::MenuSurface | |
| MenuSurface ()=default | |
runtime.Menus: the surface menus start on, chosen once per session.
A session starts on the preferred surface when it can draw for the player, and on the fallback otherwise. Every later call follows the surface holding that player's session, and a player has one session across both. Rows and flows are built against this, so they never pick a surface themselves. SDK-free.
Definition at line 21 of file MenuRouter.hpp.
|
explicit |
fallback takes every session no preferred surface does, and must outlive this.
Definition at line 7 of file MenuRouter.cpp.
Pops the top menu, returning to its parent when one exists.
Implements VoltMod::MenuSurface.
Definition at line 53 of file MenuRouter.cpp.
References VoltMod::MenuSurface::Close(), and VoltMod::ReadFile().
Clears the stack and removes the menu from the player's screen.
Implements VoltMod::MenuSurface.
Definition at line 58 of file MenuRouter.cpp.
References VoltMod::MenuSurface::CloseAll(), and VoltMod::ReadFile().
Translates and sends replyKey, then closes every menu.
Implements VoltMod::MenuSurface.
Definition at line 63 of file MenuRouter.cpp.
References VoltMod::MenuSurface::CloseAll(), and VoltMod::ReadFile().
Implements VoltMod::MenuSurface.
Definition at line 48 of file MenuRouter.cpp.
References VoltMod::MenuSurface::IsOpen(), and VoltMod::ReadFile().
Referenced by Open().
Pushes menu onto slot's session and shows it, starting one with default options when none is open. What a row calls.
Implements VoltMod::MenuSurface.
Definition at line 37 of file MenuRouter.cpp.
References IsOpen(), VoltMod::MenuSurface::Open(), OpenSession(), and VoltMod::ReadFile().
|
overridevirtual |
Opens a session for slot showing menu, closing any the player has open here. What a command calls. False when this surface cannot draw for slot; nothing is left open then.
Implements VoltMod::MenuSurface.
Definition at line 21 of file MenuRouter.cpp.
References VoltMod::MenuSurface::CloseAll(), VoltMod::MenuSurface::OpenSession(), and VoltMod::ReadFile().
Referenced by Open().
| Subscription VoltMod::MenuRouter::Prefer | ( | MenuSurface & | surface | ) |
Try surface first for new sessions while the returned Subscription is held; hold it no longer than surface lives. A later call replaces the preference.
Definition at line 9 of file MenuRouter.cpp.
References VoltMod::ReadFile().
Referenced by VoltMod::Runtime::UsePanorama().
|
overridevirtual |
Routes the next chat line to callback. Closing the menu cancels it.
Implements VoltMod::MenuSurface.
Definition at line 68 of file MenuRouter.cpp.
References VoltMod::MenuSurface::Prompt(), and VoltMod::ReadFile().
|
overridevirtual |
Translates key for slot, using fallback when missing.
Implements VoltMod::MenuSurface.
Definition at line 73 of file MenuRouter.cpp.
References VoltMod::ReadFile(), and VoltMod::MenuSurface::Translate().