TSI_Config/config_mgr.h

35 lines
747 B
C
Raw Normal View History

2025-03-29 18:05:12 +08:00
#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:
int card_type_[15];
2025-03-29 18:05:12 +08:00
static ConfigMgr *Instance() {
if (instance == nullptr) {
instance = new ConfigMgr();
}
return instance;
}
~ConfigMgr();
void Save();
void Load(QString filename);
2025-04-01 15:03:59 +08:00
std::shared_ptr<CardBase> GetSlotPtr(int slot);
void AddCard(std::shared_ptr<CardBase> ptr);
2025-03-29 18:05:12 +08:00
private:
2025-04-01 15:03:59 +08:00
QString filename_;
2025-03-29 18:05:12 +08:00
std::vector<std::shared_ptr<CardBase>> cards_;
};
#endif // CONFIG_MGR_H