2023-06-20 04:33:09 +00:00
|
|
|
#ifndef STAR_TEAMBAR_HPP
|
|
|
|
#define STAR_TEAMBAR_HPP
|
|
|
|
|
|
|
|
#include "StarPane.hpp"
|
|
|
|
#include "StarUuid.hpp"
|
|
|
|
#include "StarMainInterfaceTypes.hpp"
|
|
|
|
#include "StarProgressWidget.hpp"
|
2023-06-27 15:07:55 +00:00
|
|
|
#include "StarLabelWidget.hpp"
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2023-07-20 14:58:49 +00:00
|
|
|
virtual void update(float dt) override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
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:
|
2023-07-20 14:58:49 +00:00
|
|
|
virtual void update(float dt) override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void updatePlayerResources();
|
|
|
|
|
|
|
|
void inviteButton();
|
|
|
|
|
|
|
|
void buildTeamBar();
|
|
|
|
|
|
|
|
void showMemberMenu(Uuid memberUuid, Vec2I position);
|
|
|
|
|
|
|
|
MainInterface* m_mainInterface;
|
|
|
|
UniverseClientPtr m_client;
|
|
|
|
|
|
|
|
GuiContext* m_guiContext;
|
|
|
|
|
2024-04-21 20:07:59 +00:00
|
|
|
TextStyle m_nameStyle;
|
2023-06-20 04:33:09 +00:00
|
|
|
Vec2F m_nameOffset;
|
|
|
|
|
|
|
|
TeamInvitePtr m_teamInvite;
|
|
|
|
TeamInvitationPtr m_teamInvitation;
|
|
|
|
TeamMemberMenuPtr m_teamMemberMenu;
|
|
|
|
|
|
|
|
ProgressWidgetPtr m_healthBar;
|
|
|
|
ProgressWidgetPtr m_energyBar;
|
|
|
|
ProgressWidgetPtr m_foodBar;
|
|
|
|
|
2023-06-27 15:07:55 +00:00
|
|
|
LabelWidgetPtr m_nameLabel;
|
|
|
|
|
2023-06-20 04:33:09 +00:00
|
|
|
Color m_energyBarColor;
|
|
|
|
Color m_energyBarRegenMixColor;
|
|
|
|
Color m_energyBarUnusableColor;
|
|
|
|
|
|
|
|
friend class TeamMemberMenu;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|