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 
59  bool DisplayList(UIList list, Player player, int currentPage = 1);
60 
66  void CloseList(Player player);
67 
71  void OnEndMatch();
72 
79  bool RegisterEvent(std::string answer, std::function<void(Player, std::string, std::vector<EntryVal>)> function);
80 
81 private:
84  std::map<std::string, Player>* players;
85  std::map<std::string, std::function<void(Player, std::string, std::vector<EntryVal>)>> answers;
87  std::map<std::string, UIList> currentLists;
94  std::string formatPage(UIFrame frame);
95 };
96 
97 #endif // UIMANAGER_H_
ManiaLink for UI list.
Definition: UIList.h:11
void OnEndMatch()
Event listener for EndMatch, closes center lists.
Definition: UIManager.cpp:192
void CloseList(Player player)
Close list for player and removes from memory.
Definition: UIManager.cpp:180
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:82
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:10
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:215
Contains all server methods and returns usable data types.
Definition: Methods.h:14
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:200
std::map< std::string, Player > * players
Pointer to the player list.
Definition: UIManager.h:84
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:85
EventManager * events
Pointer to the event manager.
Definition: UIManager.h:83
std::map< std::string, UIList > currentLists
Current lists displayed to players.
Definition: UIManager.h:87
Handles events (callbacks) from server to plugins.
Definition: EventManager.h:15