添加玩家配置表读取
This commit is contained in:
parent
d357bfe47c
commit
971bc22b85
@ -22,6 +22,9 @@ class Human : public Entity
|
||||
int vip = 0;
|
||||
int sdmg = 0;
|
||||
|
||||
bool moving = false;
|
||||
Vector2D move_dir;
|
||||
|
||||
std::set<Human*> my_seen_players;
|
||||
std::set<Human*> seen_me_players;
|
||||
std::set<Human*> new_players;
|
||||
|
@ -30,4 +30,9 @@ namespace MetaData
|
||||
const metatable::Equip* i = nullptr;
|
||||
};
|
||||
|
||||
struct Player
|
||||
{
|
||||
const metatable::Player* i = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,12 +20,15 @@ public:
|
||||
std::list<MetaData::Item> item_list;
|
||||
std::list<metatable::Equip> equip_meta_list;
|
||||
std::list<MetaData::Equip> equip_list;
|
||||
std::list<metatable::Player> player_meta_list;
|
||||
std::list<MetaData::Player> player_list;
|
||||
|
||||
std::map<std::string, MetaData::Parameter*> parameter_hash;
|
||||
std::map<int, MetaData::Map*> gamemap_hash;
|
||||
std::map<int, MetaData::SafeArea*> safearea_hash;
|
||||
std::map<int, MetaData::Item*> item_hash;
|
||||
std::map<int, MetaData::Equip*> equip_hash;
|
||||
std::map<int, MetaData::Player*> player_hash;
|
||||
|
||||
void Load()
|
||||
{
|
||||
@ -41,6 +44,7 @@ public:
|
||||
f8::ReadCsvMetaFile(res_path + "safearea@safearea.csv", safearea_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "item@item.csv", item_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "equip@equip.csv", equip_meta_list);
|
||||
f8::ReadCsvMetaFile(res_path + "player@player.csv", player_meta_list);
|
||||
BindToMetaData();
|
||||
}
|
||||
|
||||
@ -79,6 +83,12 @@ private:
|
||||
equip_hash[item.i->id()] = &item;
|
||||
}
|
||||
|
||||
for (auto& meta : player_meta_list) {
|
||||
MetaData::Player& item = a8::FastAppend(player_list);
|
||||
item.i = &meta;
|
||||
player_hash[item.i->id()] = &item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@ -115,3 +125,9 @@ MetaData::Map* MetaMgr::GetMap(int map_id)
|
||||
auto itr = loader_->gamemap_hash.find(map_id);
|
||||
return itr != loader_->gamemap_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
MetaData::Player* MetaMgr::GetPlayer(int id)
|
||||
{
|
||||
auto itr = loader_->player_hash.find(id);
|
||||
return itr != loader_->player_hash.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
|
||||
std::string GetSysParam(const std::string& param_name);
|
||||
MetaData::Map* GetMap(int map_id);
|
||||
MetaData::Player* GetPlayer(int id);
|
||||
|
||||
private:
|
||||
MetaDataLoader* loader_ = nullptr;
|
||||
|
@ -144,7 +144,7 @@ message MFPlayerFull
|
||||
optional bool disconnected = 9; //是否断网
|
||||
optional int32 anim_type = 10; //
|
||||
optional int32 anim_seq = 11; //
|
||||
optional int32 action_type = 12; //
|
||||
optional int32 action_type = 12; //0: none 1:reload 2:useitem 3:relive
|
||||
optional int32 skin = 13; //皮肤id
|
||||
//backpack
|
||||
optional int32 helmet = 16; //头盔
|
||||
@ -508,7 +508,6 @@ message CMMove
|
||||
optional bool move_right = 3; //移动-右
|
||||
optional bool move_up = 4; //移动-上
|
||||
optional bool move_down = 5; //移动-下
|
||||
optional int32 move_len = 22; //移动-距离
|
||||
optional MFVector2D to_move_dir = 24; //移动-方向
|
||||
|
||||
optional bool shoot_start = 6; //射击-开始
|
||||
@ -527,7 +526,7 @@ message CMMove
|
||||
optional bool scroll_up = 18; //zz
|
||||
optional bool portrait = 19; //zz
|
||||
|
||||
optional MFVector2D to_mouse_dir = 20; //zz
|
||||
optional MFVector2D to_mouse_dir = 20; //攻击方向(朝向)
|
||||
optional float to_mouse_len = 21; //
|
||||
//use_item
|
||||
//use_scope
|
||||
|
@ -54,6 +54,14 @@ message Equip
|
||||
optional int32 volume = 19; //装备容量
|
||||
}
|
||||
|
||||
message Player
|
||||
{
|
||||
optional int32 id = 1; //唯一id
|
||||
optional float radius = 2; //半径
|
||||
optional int32 health = 3; //初始血量
|
||||
optional int32 move_speed = 4; //移动速度
|
||||
}
|
||||
|
||||
message Monster
|
||||
{
|
||||
optional int32 mon_id = 1; //怪物id
|
||||
|
Loading…
x
Reference in New Issue
Block a user