Manages the user interface on the server (ManiaLinks). More...
#include <UIManager.h>
Public Member Functions | |
UIManager (Methods *serverPtr, EventManager *eventsPtr, std::map< std::string, Player > *playersPtr) | |
Constructor takes needed controller pointers. More... | |
void | OnPlayerManialinkPageAnswer (Player player, std::string answer, std::vector< EntryVal > entries) |
Callback handler voor ManiaLink page answers. More... | |
bool | Display (UIFrame frame) |
Display frame. More... | |
bool | Display (UIFrame frame, Player player) |
Display frame to player. More... | |
bool | DisplayList (UIList list, Player player, int currentPage=1) |
Display list to player. More... | |
void | CloseList (Player player) |
Close list for player and removes from memory. More... | |
void | OnEndMatch () |
Event listener for EndMatch, closes center lists. | |
bool | RegisterEvent (std::string answer, std::function< void(Player, std::string, std::vector< EntryVal >)> function) |
Register event to be handled on page answer. More... | |
Private Member Functions | |
std::string | formatPage (UIFrame frame) |
Formats the page, including custom UI. More... | |
Private Attributes | |
Methods * | server |
Pointer to the server methods. | |
EventManager * | events |
Pointer to the event manager. | |
std::map< std::string, Player > * | players |
Pointer to the player list. | |
std::map< std::string, std::function< void(Player, std::string, std::vector < EntryVal >)> > | answers |
List with ManiaLink answers to handle. | |
std::map< std::string, UIList > | currentLists |
Current lists displayed to players. | |
Manages the user interface on the server (ManiaLinks).
UIManager::UIManager | ( | Methods * | serverPtr, |
EventManager * | eventsPtr, | ||
std::map< std::string, Player > * | playersPtr | ||
) |
Constructor takes needed controller pointers.
serverPtr | Pointer to the server methods. |
eventsPtr | Pointer to the event manager. |
playersPtr | Pointer to the player list. |
void UIManager::CloseList | ( | Player | player | ) |
Close list for player and removes from memory.
player | Player which center list should be closed. |
bool UIManager::Display | ( | UIFrame | frame | ) |
Display frame.
frame | Frame to be displayed. |
Display frame to player.
frame | Frame to be displayed. |
player | Player who should receive the frame. |
Display list to player.
list | List to be displayed. |
player | Player who should receive the list. |
|
private |
Formats the page, including custom UI.
frame | Frame to be formatted. |
void UIManager::OnPlayerManialinkPageAnswer | ( | Player | player, |
std::string | answer, | ||
std::vector< EntryVal > | entries | ||
) |
Callback handler voor ManiaLink page answers.
player | Player who interacted with the page. |
answer | Page answer. |
entries | Entries. |
bool UIManager::RegisterEvent | ( | std::string | answer, |
std::function< void(Player, std::string, std::vector< EntryVal >)> | function | ||
) |
Register event to be handled on page answer.
answer | Name of the answer. |
function | Function to be called on callback. |