This commit is contained in:
2026-02-08 16:20:50 +08:00
parent 0ae47e5d6a
commit 8b88904ef7
72 changed files with 5963 additions and 2038 deletions

View File

@@ -72,9 +72,12 @@ void Global_Game::InitGame()
EquipmentPathMap = GlobalEquipmentScript::InitEquipmentLst();
// 读取怪物配置文件
MonsterPathMap = GlobalMonsterScript::InitMonsterLst();
// 读取城镇配置文件
TownPathMap = GlobalTownScript::InitTownLst();
// 初始化松鼠脚本管理器
SquirrelManager::GetInstance().Init();
SquirrelManager::GetInstance()
.Init();
// 读取存档
SavaManager::GetInstance().Init();
@@ -105,6 +108,30 @@ GlobalMonsterScript::MonsterConfig Global_Game::GetMonsterInfo(int id)
return MonsterConfig;
}
const std::map<int, std::string> &Global_Game::GetTownMap() const
{
return TownPathMap;
}
GlobalTownScript::TownConfig *Global_Game::GetTownInfo(int id)
{
if (TownInfoMap.count(id))
return TownInfoMap[id];
if (!TownPathMap.count(id))
{
SDL_LogError(0, "城镇ID不存在");
return nullptr;
}
std::string path = TownPathMap[id];
GlobalTownScript::TownConfig *TownConfig = GlobalTownScript::GetTownConfig(path);
if (TownConfig)
{
TownInfoMap[id] = TownConfig;
return TownConfig;
}
return nullptr;
}
RefPtr<GameCamera> Global_Game::GetCamera()
{
return _GameCamera;