推
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user