修改OpenGl渲染底层之前
This commit is contained in:
@@ -27,6 +27,8 @@ void Global_Game::InitGame()
|
||||
CharacterConfigs = GlobalCharacterScript::InitCharacterLst();
|
||||
// 读取装备配置文件
|
||||
EquipmentPathMap = GlobalEquipmentScript::InitEquipmentLst();
|
||||
// 读取怪物配置文件
|
||||
MonsterPathMap = GlobalMonsterScript::InitMonsterLst();
|
||||
|
||||
// 初始化松鼠脚本管理器
|
||||
SquirrelManager::GetInstance().Init();
|
||||
@@ -36,3 +38,24 @@ void Global_Game::InitGame()
|
||||
// 游戏初始化完成标志
|
||||
InitFlag = true;
|
||||
}
|
||||
|
||||
GlobalMonsterScript::MonsterConfig Global_Game::GetMonsterInfo(int id)
|
||||
{
|
||||
if (!InitFlag)
|
||||
{
|
||||
SDL_LogError(0, "游戏未初始化");
|
||||
return GlobalMonsterScript::MonsterConfig();
|
||||
}
|
||||
if (MonsterInfoMap.count(id))
|
||||
return MonsterInfoMap[id];
|
||||
if (!MonsterPathMap.count(id))
|
||||
{
|
||||
SDL_LogError(0, "怪物ID不存在");
|
||||
return GlobalMonsterScript::MonsterConfig();
|
||||
}
|
||||
std::string path = MonsterPathMap[id];
|
||||
GlobalMonsterScript::MonsterConfig MonsterConfig = GlobalMonsterScript::ReadMonsterConfig(path);
|
||||
MonsterConfig.id = id;
|
||||
MonsterInfoMap[id] = MonsterConfig;
|
||||
return MonsterConfig;
|
||||
}
|
||||
Reference in New Issue
Block a user