Mania++
 All Classes Functions Variables Pages
UIManager.h
1 #ifndef UIMANAGER_H_
2 #define UIMANAGER_H_
3 
4 #include <cmath>
5 
6 #include "../Events/EventManager.h"
7 #include "../Methods/Methods.h"
8 #include "../Utils/Text.h"
9 
10 #include "UIFrame.h"
11 #include "UIList.h"
12 
13 //* UIManager
17 class UIManager
18 {
19 public:
27  UIManager(Methods* serverPtr, EventManager* eventsPtr, std::map<std::string, Player>* playersPtr);
28 
36  void OnPlayerManialinkPageAnswer(Player player, std::string answer, std::vector<EntryVal> entries);
37 
43  bool Display(UIFrame frame);
44 
51  bool Display(UIFrame frame, Player player);
52 
60  bool DisplayList(UIList list, Player player, int currentPage = 1);
61 
67  void CloseList(Player player);
68 
72  void OnEndMatch();
73 
80  bool RegisterEvent(std::string answer, std::function<void(Player, std::string, std::vector<EntryVal>)> function);
81 
82 private:
85  std::map<std::string, Player>* players;
86  std::map<std::string, std::function<void(Player, std::string, std::vector<EntryVal>)>> answers;
88  std::map<std::string, UIList> currentLists;
95  std::string formatPage(UIFrame frame);
96 };
97 
98 #endif // UIMANAGER_H_
ManiaLink for UI list.
Definition: UIList.h:11
void OnEndMatch()
Event listener for EndMatch, closes center lists.
Definition: UIManager.cpp:207
void CloseList(Player player)
Close list for player and removes from memory.
Definition: UIManager.cpp:195
UIManager(Methods *serverPtr, EventManager *eventsPtr, std::map< std::string, Player > *playersPtr)
Constructor takes needed controller pointers.
Definition: UIManager.cpp:3
Manages the user interface on the server (ManiaLinks).
Definition: UIManager.h:17
Methods * server
Pointer to the server methods.
Definition: UIManager.h:83
bool DisplayList(UIList list, Player player, int currentPage=1)
Display list to player.
Definition: UIManager.cpp:72
Contains all information about a player in easy-to-use format.
Definition: Player.h:11
bool Display(UIFrame frame)
Display frame.
Definition: UIManager.cpp:62
ManiaLink for UI.
Definition: UIFrame.h:12
std::string formatPage(UIFrame frame)
Formats the page, including custom UI.
Definition: UIManager.cpp:230
Contains all server methods and returns usable data types.
Definition: Methods.h:15
bool RegisterEvent(std::string answer, std::function< void(Player, std::string, std::vector< EntryVal >)> function)
Register event to be handled on page answer.
Definition: UIManager.cpp:215
std::map< std::string, Player > * players
Pointer to the player list.
Definition: UIManager.h:85
void OnPlayerManialinkPageAnswer(Player player, std::string answer, std::vector< EntryVal > entries)
Callback handler voor ManiaLink page answers.
Definition: UIManager.cpp:26
std::map< std::string, std::function< void(Player, std::string, std::vector< EntryVal >)> > answers
List with ManiaLink answers to handle.
Definition: UIManager.h:86
EventManager * events
Pointer to the event manager.
Definition: UIManager.h:84
std::map< std::string, UIList > currentLists
Current lists displayed to players.
Definition: UIManager.h:88
Handles events (callbacks) from server to plugins.
Definition: EventManager.h:15