修改OpenGl渲染底层之前
This commit is contained in:
46
source_game/Global/Script/MonsterConfig.cpp
Normal file
46
source_game/Global/Script/MonsterConfig.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "MonsterConfig.h"
|
||||
#include "Asset/AssetManager.h"
|
||||
#include "Tool/Tool_String.h"
|
||||
|
||||
namespace GlobalMonsterScript
|
||||
{
|
||||
|
||||
std::map<int, std::string> InitMonsterLst()
|
||||
{
|
||||
std::map<int, std::string> EquipList;
|
||||
ScriptData Data = AssetManager::GetInstance().GetScriptInfo("monster/monster.lst");
|
||||
while (!Data.IsEnd())
|
||||
{
|
||||
std::string Index = Data.Get();
|
||||
std::string MonsterPath = std::string("monster/") + Data.Get();
|
||||
EquipList[std::stoi(Index)] = MonsterPath;
|
||||
}
|
||||
return EquipList;
|
||||
}
|
||||
MonsterConfig ReadMonsterConfig(std::string path)
|
||||
{
|
||||
MonsterConfig Config;
|
||||
Config.folder = path.substr(0, path.find_last_of('/') + 1);
|
||||
ScriptData Data = AssetManager::GetInstance().GetScriptInfo(path);
|
||||
while (!Data.IsEnd())
|
||||
{
|
||||
std::string Segment = Data.Get();
|
||||
if (Segment == "name")
|
||||
{
|
||||
Config.name = Data.Get();
|
||||
}
|
||||
else if (Segment == "[动作动画]")
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
std::string Ret = Data.Get();
|
||||
if (Ret == "[/动作动画]")
|
||||
break;
|
||||
std::string path = Data.Get();
|
||||
Config.animationPath[Ret] = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Config;
|
||||
}
|
||||
}
|
||||
26
source_game/Global/Script/MonsterConfig.h
Normal file
26
source_game/Global/Script/MonsterConfig.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
namespace GlobalMonsterScript
|
||||
{
|
||||
// 怪物配置
|
||||
struct MonsterConfig
|
||||
{
|
||||
//编号
|
||||
int id = -1;
|
||||
//名称
|
||||
std::string name = "none";
|
||||
//动作动画
|
||||
std::map<std::string, std::string> animationPath;
|
||||
|
||||
|
||||
//所在文件夹
|
||||
std::string folder = "none";
|
||||
};
|
||||
|
||||
// 读取怪物列表
|
||||
std::map<int, std::string> InitMonsterLst();
|
||||
// 读取怪物数据
|
||||
MonsterConfig ReadMonsterConfig(std::string path);
|
||||
}
|
||||
Reference in New Issue
Block a user