ServerSelection.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include <TextFeld.h>
  3. #include <Liste.h>
  4. #include <HashMap.h>
  5. #include "Menu.h"
  6. class ServerStatus : public ZeichnungHintergrund
  7. {
  8. private:
  9. Framework::Text name;
  10. Framework::Text ip;
  11. unsigned short sslPort;
  12. unsigned short port;
  13. Framework::Text playerName;
  14. int ping;
  15. Framework::Text status;
  16. int statusId;
  17. int requestId;
  18. Framework::HashMap<Framework::Text, Framework::Text> *secrets;
  19. Framework::AlphaFeld *closeAF;
  20. Framework::Knopf* join;
  21. public:
  22. ServerStatus(Framework::Text name, Framework::Text ip, unsigned short sslPort, unsigned short port, Framework::HashMap<Framework::Text, Framework::Text> *secrets);
  23. ~ServerStatus();
  24. virtual void updatePlayerName(Framework::Text playerName);
  25. virtual void doMausEreignis(Framework::MausEreignis& me, bool userRet) override;
  26. virtual bool tick(double time) override;
  27. virtual void render(Framework::Bild& rObj) override;
  28. Framework::Text getName() const;
  29. Framework::Text getIp() const;
  30. unsigned short getSSLPort() const;
  31. unsigned short getPort() const;
  32. Framework::HashMap<Framework::Text, Framework::Text>* zSecrets() const;
  33. bool canConnect() const;
  34. };
  35. class ServerSelectionMenu : public Menu
  36. {
  37. private:
  38. Framework::TextFeld* playerName;
  39. Framework::TextFeld* playerNameLabel;
  40. Framework::TextFeld* serverLabel;
  41. Framework::ZListe* serverList;
  42. Framework::Knopf* add;
  43. Framework::Knopf* refresh;
  44. public:
  45. ServerSelectionMenu(Framework::Bildschirm* zScreen);
  46. void addServer(Framework::Text name, Framework::Text ip, unsigned short sslPort, unsigned short port);
  47. bool hasServer(Framework::Text name) const;
  48. void removeServer(Framework::Text name) const;
  49. void saveServers() const;
  50. };