diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 82d18a9..319c9b0 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -54,8 +54,10 @@ void Human::FillMFObjectPart(cs::MFObjectPart* part_data) part_data->set_object_type(ET_Player); cs::MFPlayerPart* p = part_data->mutable_union_obj_1(); p->set_obj_uniid(entity_uniid); + #if 0 TypeConvert::ToPb(pos, p->mutable_pos()); TypeConvert::ToPb(attack_dir, p->mutable_dir()); + #endif } void Human::FillMFObjectFull(cs::MFObjectFull* full_data) @@ -63,8 +65,10 @@ void Human::FillMFObjectFull(cs::MFObjectFull* full_data) full_data->set_object_type(ET_Player); cs::MFPlayerFull* p = full_data->mutable_union_obj_1(); p->set_obj_uniid(entity_uniid); + #if 0 TypeConvert::ToPb(pos, p->mutable_pos()); TypeConvert::ToPb(attack_dir, p->mutable_dir()); + #endif p->set_dead(dead); p->set_disconnected(disconnected); diff --git a/server/gameserver/typeconvert.cc b/server/gameserver/typeconvert.cc index eefa804..e101ae5 100644 --- a/server/gameserver/typeconvert.cc +++ b/server/gameserver/typeconvert.cc @@ -4,13 +4,13 @@ namespace TypeConvert { - void ToPb(const a8::Vec2& v, cs::MFVector2D* pb_obj) + void ToPb(const a8::Vec2& v, cs::MFVec2* pb_obj) { pb_obj->set_x(v.x); pb_obj->set_y(v.y); } - void FromPb(a8::Vec2& v, const cs::MFVector2D* pb_obj) + void FromPb(a8::Vec2& v, const cs::MFVec2* pb_obj) { v.x = pb_obj->x(); v.y = pb_obj->y(); diff --git a/server/gameserver/typeconvert.h b/server/gameserver/typeconvert.h index ab84f02..71c50da 100644 --- a/server/gameserver/typeconvert.h +++ b/server/gameserver/typeconvert.h @@ -2,11 +2,11 @@ namespace cs { - class MFVector2D; + class MFVec2; } namespace TypeConvert { - void ToPb(const a8::Vec2& v, cs::MFVector2D* pb_obj); - void FromPb(a8::Vec2& v, const cs::MFVector2D* pb_obj); + void ToPb(const a8::Vec2& v, cs::MFVec2* pb_obj); + void FromPb(a8::Vec2& v, const cs::MFVec2* pb_obj); } diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 6a015f3..76ea4b6 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -88,7 +88,7 @@ message MFPair64 } //向量 -message MFVector2D +message MFVec2 { optional float x = 1; //x轴 optional float y = 2; //y轴 @@ -119,7 +119,7 @@ message MFPropertyChg message MFMapObject { optional int32 object_id = 1; //物件id(mapThing表id) - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 } //玩家信息 @@ -130,6 +130,29 @@ message MFPlayerInfo optional string name = 3; } +//蛇头 +message MFSnakeHead +{ + optional MFVec2 pos = 1; //位置 + optional MFVec2 dir = 2; //朝向 + optional float radius = 3; //半径 + optional float speed = 4; //速度 +} + +//蛇身 +message MFSnakeBody +{ + optional MFVec2 pos = 1; //蛇身位置 +} + +//蛇 +message MFSnake +{ + optional MFSnakeHead snake_head = 1; //蛇头 + repeated MFSnakeBody snake_body = 2; //蛇身 + optional int32 total_mass = 3; //总重量 +} + //皮肤 message MFSkin { @@ -141,16 +164,14 @@ message MFSkin message MFPlayerPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //朝向 + optional MFSnake snake = 2; //蛇 } //玩家信息-全量 message MFPlayerFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //朝向 + optional MFSnake snake = 2; //蛇 optional bool dead = 7; //是否已死亡 optional bool disconnected = 9; //是否断网 @@ -167,7 +188,7 @@ message MFPlayerFull message MFObstaclePart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float scale = 3; //缩放比 } @@ -175,7 +196,7 @@ message MFObstaclePart message MFObstacleFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float scale = 3; //缩放比 optional int32 obstacle_id = 6; //阻挡物id @@ -187,14 +208,14 @@ message MFObstacleFull message MFLootPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 } //loot-全量 message MFLootFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 item_id = 6; optional int32 count = 7; @@ -248,8 +269,8 @@ message MFGasData message MFTeamData { optional int32 player_id = 1; //玩家id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //方向 + optional MFVec2 pos = 2; //位置 + optional MFVec2 dir = 3; //方向 optional bool disconnected = 5 [default = false]; //是否短线 optional bool dead = 6 [default = false]; //是否死亡 optional string name = 8; //名字 @@ -332,8 +353,8 @@ message CMMove { optional int32 seq = 1; //序号 - optional MFVector2D move_dir = 24; //移动-方向 - optional MFVector2D attack_dir = 20; //攻击方向(朝向) + optional MFVec2 move_dir = 24; //移动-方向 + optional MFVec2 attack_dir = 20; //攻击方向(朝向) optional bool spectate = 30; //自杀 optional int32 emote = 31; //表情id } @@ -348,7 +369,7 @@ message CMDropItem message CMEmote { optional int32 type = 1; - optional MFVector2D pos = 2; + optional MFVec2 pos = 2; optional bool team_only = 4; } @@ -393,15 +414,17 @@ message SMWatchWar //加入成功 message SMJoinedNotify { - optional int32 team_mode = 1; //队伍模式 0:单人 1:多人 - optional int32 player_id = 2; //玩家id(自己) - optional bool started = 3; //游戏是否已开始 - optional string room_uuid = 4; //房间唯一id + optional int32 error_code = 1; //错误 1:服务器维护中 2:服务器繁忙请稍后再进入 + optional int32 team_mode = 2; //队伍模式 0:单人 1:多人 + optional int32 player_id = 3; //玩家id(自己) + optional bool started = 4; //游戏是否已开始 + optional string room_uuid = 5; //房间唯一id - optional int32 map_type = 5; //目前没用到 - optional bool elo_start = 6; //目前没用到 - - optional int32 error_code = 7; //错误 1:服务器维护中 2:服务器繁忙请稍后再进入 + optional int32 left_time = 6; //剩余时间(秒) + optional int32 scene_width = 7; //地图宽度 + optional int32 grid_widht = 8; //小格子宽度 + optional int32 server_time = 9; //当前服务器时间(本局开始后的相对时间) + optional int32 update_hz = 10; //模拟频率 } //地图信息