Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarTeamBar.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-20 14:33:09 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-20 14:33:09 +1000
commit6352e8e3196f78388b6c771073f9e03eaa612673 (patch)
treee23772f79a7fbc41bc9108951e9e136857484bf4 /source/frontend/StarTeamBar.hpp
parent6741a057e5639280d85d0f88ba26f000baa58f61 (diff)
everything everywhere
all at once
Diffstat (limited to 'source/frontend/StarTeamBar.hpp')
-rw-r--r--source/frontend/StarTeamBar.hpp115
1 files changed, 115 insertions, 0 deletions
diff --git a/source/frontend/StarTeamBar.hpp b/source/frontend/StarTeamBar.hpp
new file mode 100644
index 0000000..d781547
--- /dev/null
+++ b/source/frontend/StarTeamBar.hpp
@@ -0,0 +1,115 @@
+#ifndef STAR_TEAMBAR_HPP
+#define STAR_TEAMBAR_HPP
+
+#include "StarPane.hpp"
+#include "StarUuid.hpp"
+#include "StarMainInterfaceTypes.hpp"
+#include "StarProgressWidget.hpp"
+
+namespace Star {
+
+STAR_CLASS(TeamBar);
+STAR_CLASS(MainInterface);
+STAR_CLASS(UniverseClient);
+STAR_CLASS(Player);
+
+STAR_CLASS(TeamInvite);
+STAR_CLASS(TeamInvitation);
+STAR_CLASS(TeamMemberMenu);
+STAR_CLASS(TeamBar);
+
+class TeamInvite : public Pane {
+public:
+ TeamInvite(TeamBar* owner);
+
+ virtual void show() override;
+
+private:
+ TeamBar* m_owner;
+
+ void ok();
+ void close();
+};
+
+class TeamInvitation : public Pane {
+public:
+ TeamInvitation(TeamBar* owner);
+
+ void open(Uuid const& inviterUuid, String const& inviterName);
+
+private:
+ TeamBar* m_owner;
+ Uuid m_inviterUuid;
+
+ void ok();
+ void close();
+};
+
+class TeamMemberMenu : public Pane {
+public:
+ TeamMemberMenu(TeamBar* owner);
+
+ void open(Uuid memberUuid, Vec2I position);
+
+ virtual void update() override;
+
+private:
+ void updateWidgets();
+
+ void close();
+ void beamToShip();
+ void makeLeader();
+ void removeFromTeam();
+
+ TeamBar* m_owner;
+ Uuid m_memberUuid;
+ bool m_canBeam;
+};
+
+class TeamBar : public Pane {
+public:
+ TeamBar(MainInterface* mainInterface, UniverseClientPtr client);
+
+ bool sendEvent(InputEvent const& event) override;
+
+ void invitePlayer(String const& playerName);
+ void acceptInvitation(Uuid const& inviterUuid);
+
+protected:
+ virtual void update() override;
+
+private:
+ void updatePlayerResources();
+
+ void inviteButton();
+
+ void buildTeamBar();
+
+ void showMemberMenu(Uuid memberUuid, Vec2I position);
+
+ MainInterface* m_mainInterface;
+ UniverseClientPtr m_client;
+
+ GuiContext* m_guiContext;
+
+ int m_nameFontSize;
+ Vec2F m_nameOffset;
+
+ TeamInvitePtr m_teamInvite;
+ TeamInvitationPtr m_teamInvitation;
+ TeamMemberMenuPtr m_teamMemberMenu;
+
+ ProgressWidgetPtr m_healthBar;
+ ProgressWidgetPtr m_energyBar;
+ ProgressWidgetPtr m_foodBar;
+
+ Color m_energyBarColor;
+ Color m_energyBarRegenMixColor;
+ Color m_energyBarUnusableColor;
+
+ friend class TeamMemberMenu;
+};
+
+}
+
+#endif