5#include "../Util/AssetsDef.h"
8#include <Util/SafeLog.h>
13ResMgr::ResMgr() =
default;
23void ResMgr::InitResource() {
25 if(m_assetManager ==
nullptr)
29 m_assetManager->LoadAssets(Settings::IsAssetsPacked());
32void ResMgr::Exterminate() {
33 SAFE_DELETE(m_assetManager);
38 CORE->GetCore(
MemoryMgr)->ReleaseObject(m_object,
true);
41int ResMgr::GetStringHash(
const std::string& str) {
42 auto result = std::find(m_stringIds.begin(), m_stringIds.end(), str);
43 if (result != m_stringIds.end())
44 return result - m_stringIds.begin();
46 m_stringIds.push_back(str);
47 return m_stringIds.size() - 1;
51 return m_assetManager->GetAsset(name);
54SResource* ResMgr::GetSResource(std::string name)
const {
55 if(m_objects.count(name) > 0)
return Get(name);
57 for (
const auto& pair : m_objects) {
58 const auto& res = pair.second;
59 if (make_lower_copy(res->GetName()) == name)
61 if (make_lower_copy(res->GetAbsoluteID()) == name)
67std::list<AssetMgr::AssetReference*> ResMgr::GetAssetReferences(AssetMgr::TYPE type)
const {
68 return m_assetManager->GetAssets(type);
73void ResMgr::SetAssetManager(AAssetManager* obj) {
74 SafeLog::Log(
"SetAssetManager");
76 if(m_assetManager ==
nullptr)
78 m_assetManager->SetAssetManager(obj);
82AAssetManager* ResMgr::GetAssetManager() {
83 return m_assetManager->GetAssetManager();
86void ResMgr::SetEnv(JNIEnv *obj) {
87 m_assetManager->SetEnv(obj);
90JNIEnv *ResMgr::GetEnv() {
91 return m_assetManager->GetEnv();