ServerSelection.h 1.9 KB

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