TSI_Config/config_mgr.h
2025-04-01 15:03:59 +08:00

34 lines
746 B
C++

#ifndef CONFIG_MGR_H
#define CONFIG_MGR_H
#include <memory>
#include <vector>
#include "cardbase.h"
class ConfigMgr {
private:
static ConfigMgr *instance;
ConfigMgr() {
for (int i = 0; i < SLOT_NUM; ++i) {
card_type_[i] = kCardNone;
}
}
public:
static ConfigMgr *Instance() {
if (instance == nullptr) {
instance = new ConfigMgr();
}
return instance;
}
~ConfigMgr();
void Save();
void Load(QString filename);
std::shared_ptr<CardBase> GetSlotPtr(int slot);
void AddCard(std::shared_ptr<CardBase> ptr);
private:
QString filename_;
int card_type_[15];
std::vector<std::shared_ptr<CardBase>> cards_;
};
#endif // CONFIG_MGR_H