add live ship stats panel

This commit is contained in:
2026-06-07 21:07:19 +02:00
parent 37a70ea321
commit f097e9a25f
20 changed files with 723 additions and 45 deletions

View File

@@ -1,13 +1,17 @@
#pragma once
#include <optional>
#include <string>
#include <vector>
#include <QPoint>
#include <QWidget>
#include "entt/entity/entity.hpp"
#include "Building.h"
#include "BuildingId.h"
#include "EntitySelectedEvent.h"
#include "EventHandler.h"
#include "GameConfig.h"
#include "RecipesConfig.h"
@@ -18,6 +22,7 @@
class Simulation;
class ShipLayoutPreview;
class ShipStatsPanel;
class QLabel;
class QComboBox;
class QListWidget;
@@ -25,7 +30,7 @@ class QPushButton;
class QVBoxLayout;
class SelectedBuildingPanel : public QWidget,
public EventHandler<TickAdvancedEvent>
public CombinedEventHandler<TickAdvancedEvent, EntitySelectedEvent>
{
Q_OBJECT
@@ -42,6 +47,7 @@ public slots:
private:
void handleEvent(std::shared_ptr<const TickAdvancedEvent> event) override;
void handleEvent(std::shared_ptr<const EntitySelectedEvent> event) override;
private slots:
void onRecipeChanged(int comboIndex);
@@ -80,4 +86,14 @@ private:
BuildingId m_singleBuildingId;
QPoint m_splitterTile;
std::string m_currentRecipeId;
std::optional<entt::entity> m_selectedEntity;
ShipStatsPanel* m_entityStatsPanel;
QLabel* m_entityTitleLabel;
QLabel* m_stationStatsLabel;
void buildEntityShip(entt::entity entity);
void buildEntityStation(entt::entity entity);
void refreshEntityStats();
void clearEntityDisplay();
};