70 lines
1.6 KiB
C++
70 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <thread>
|
|
#include <vector>
|
|
|
|
#include <QPushButton>
|
|
#include <QScrollArea>
|
|
#include <QTimer>
|
|
#include <QWidget>
|
|
|
|
#include "ArenaWidget.h"
|
|
#include "ArenaSimulation.h"
|
|
#include "BalancingConfig.h"
|
|
#include "GameConfig.h"
|
|
#include "VisualsConfig.h"
|
|
|
|
class InspectWindow;
|
|
|
|
class BalancingWindow : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
BalancingWindow(const BalancingConfig& balancingConfig,
|
|
GameConfig gameConfig,
|
|
const std::string& configDir,
|
|
const std::string& balancingConfigPath,
|
|
QWidget* parent = nullptr);
|
|
~BalancingWindow() override;
|
|
|
|
private slots:
|
|
void pollStatuses();
|
|
void reloadConfig();
|
|
void startAll();
|
|
void startArena(int index);
|
|
void inspectArena(int index);
|
|
void closeInspectWindow();
|
|
|
|
private:
|
|
void populateArenas(const BalancingConfig& balancingConfig);
|
|
void stopAllArenas();
|
|
void updateButtons();
|
|
void setMainControlsEnabled(bool enabled);
|
|
|
|
struct ArenaEntry
|
|
{
|
|
ArenaConfig config;
|
|
std::unique_ptr<ArenaSimulation> simulation;
|
|
std::thread worker;
|
|
ArenaWidget* widget;
|
|
};
|
|
|
|
std::vector<ArenaEntry> m_arenas;
|
|
GameConfig m_gameConfig;
|
|
VisualsConfig m_visuals;
|
|
std::string m_configDir;
|
|
std::string m_balancingConfigPath;
|
|
unsigned int m_nextSeed;
|
|
QPushButton* m_reloadButton;
|
|
QPushButton* m_startAllButton;
|
|
QScrollArea* m_scrollArea;
|
|
QTimer* m_pollTimer;
|
|
|
|
InspectWindow* m_inspectWindow;
|
|
int m_inspectedArenaIndex;
|
|
std::unique_ptr<ArenaSimulation> m_inspectedSim;
|
|
};
|