Mania++
 All Classes Functions Variables Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
UIManager Class Reference

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

Methodsserver
 Pointer to the server methods.
 
EventManagerevents
 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, UIListcurrentLists
 Current lists displayed to players.
 

Detailed Description

Manages the user interface on the server (ManiaLinks).

Constructor & Destructor Documentation

UIManager::UIManager ( Methods serverPtr,
EventManager eventsPtr,
std::map< std::string, Player > *  playersPtr 
)

Constructor takes needed controller pointers.

Parameters
serverPtrPointer to the server methods.
eventsPtrPointer to the event manager.
playersPtrPointer to the player list.

Member Function Documentation

void UIManager::CloseList ( Player  player)

Close list for player and removes from memory.

Parameters
playerPlayer which center list should be closed.
bool UIManager::Display ( UIFrame  frame)

Display frame.

Parameters
frameFrame to be displayed.
bool UIManager::Display ( UIFrame  frame,
Player  player 
)

Display frame to player.

Parameters
frameFrame to be displayed.
playerPlayer who should receive the frame.
bool UIManager::DisplayList ( UIList  list,
Player  player,
int  currentPage = 1 
)

Display list to player.

Parameters
listList to be displayed.
playerPlayer who should receive the list.
std::string UIManager::formatPage ( UIFrame  frame)
private

Formats the page, including custom UI.

Parameters
frameFrame to be formatted.
void UIManager::OnPlayerManialinkPageAnswer ( Player  player,
std::string  answer,
std::vector< EntryVal entries 
)

Callback handler voor ManiaLink page answers.

Parameters
playerPlayer who interacted with the page.
answerPage answer.
entriesEntries.
bool UIManager::RegisterEvent ( std::string  answer,
std::function< void(Player, std::string, std::vector< EntryVal >)>  function 
)

Register event to be handled on page answer.

Parameters
answerName of the answer.
functionFunction to be called on callback.

The documentation for this class was generated from the following files: