This commit is contained in:
aozhiwei 2023-05-30 19:15:02 +08:00
parent 1bf985fab0
commit 2f4e6e2f10
2 changed files with 18 additions and 2 deletions

View File

@ -14,6 +14,22 @@ namespace mt
if (!GetByType(type())) { if (!GetByType(type())) {
type_hash_[type()] = this; type_hash_[type()] = this;
} }
if (!boss().empty()) {
std::vector<std::string> strings;
a8::Split(boss(), strings, ':');
if (strings.size() != 5) {
abort();
}
_boss = std::make_shared<std::tuple<glm::vec3, float, int>>
(
glm::vec3((float)a8::XValue(strings[0]).GetDouble(),
(float)a8::XValue(strings[1]).GetDouble(),
(float)a8::XValue(strings[2]).GetDouble()
),
(float)a8::XValue(strings[3]).GetDouble(),
a8::XValue(strings[4]).GetInt()
);
}
} }
const SafeArea* SafeArea::GetByType(int type) const SafeArea* SafeArea::GetByType(int type)

View File

@ -12,14 +12,14 @@ namespace mt
public: public:
void Init1(); void Init1();
std::shared_ptr<std::tuple<float, float, float, int>> GetBoss() { return _boss; } std::shared_ptr<std::tuple<glm::vec3, float, int>> GetBoss() const { return _boss; }
static const SafeArea* GetByType(int type); static const SafeArea* GetByType(int type);
private: private:
static std::map<int, const SafeArea*> type_hash_; static std::map<int, const SafeArea*> type_hash_;
std::shared_ptr<std::tuple<float, float, float, int>> _boss; std::shared_ptr<std::tuple<glm::vec3, float, int>> _boss;
}; };
} }