From 12d61da7e4d864f722fa4833b7bc578fcef1909d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 2 Mar 2020 12:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E6=A4=8D=E8=B6=85=E6=97=B6=E5=9D=A6?= =?UTF-8?q?=E5=85=8B=E6=8A=80=E8=83=BD=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/typeconvert.cc | 4 +- server/gameserver/typeconvert.h | 6 +- server/tools/protobuild/cs_proto.proto | 104 +++++++++++++++---------- 3 files changed, 67 insertions(+), 47 deletions(-) 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 7ed1183..eb648d0 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; //位置 } //玩家信息 @@ -163,16 +163,16 @@ message MFSkin message MFPlayerPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //朝向 + optional MFVec2 pos = 2; //位置 + optional MFVec2 dir = 3; //朝向 } //玩家信息-全量 message MFPlayerFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //朝向 + optional MFVec2 pos = 2; //位置 + optional MFVec2 dir = 3; //朝向 optional float max_health = 5; //血量 optional float health = 6; //血量 @@ -208,7 +208,7 @@ message MFPlayerFull message MFObstaclePart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float scale = 3; //缩放比 } @@ -216,7 +216,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 @@ -242,14 +242,14 @@ message MFObstacleFull message MFBuildingPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 } //建筑物-全量 message MFBuildingFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 building_id = 3; //建筑物id optional bool ceiling_dead = 6; @@ -259,7 +259,7 @@ message MFBuildingFull message MFLootSpawnerPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 loot_id = 3; //id } @@ -267,7 +267,7 @@ message MFLootSpawnerPart message MFLootSpawnerFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 loot_id = 3; //id } @@ -275,14 +275,14 @@ message MFLootSpawnerFull 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; @@ -293,14 +293,14 @@ message MFLootFull message MFDeadBodyPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 } //尸体-全量 message MFDeadBodyFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 player_id = 3; //玩家id optional int32 inkjet = 6; @@ -310,7 +310,7 @@ message MFDeadBodyFull message MFDecalPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 decal_id = 3; //id } @@ -318,7 +318,7 @@ message MFDecalPart message MFDecalFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 decal_id = 3; //id } @@ -326,7 +326,7 @@ message MFDecalFull message MFProjectilePart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float pos_z = 3; //没用到 } @@ -334,7 +334,7 @@ message MFProjectilePart message MFProjectileFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float pos_z = 3; //没用到 } @@ -342,8 +342,8 @@ message MFProjectileFull message MFHeroPart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //朝向 + optional MFVec2 pos = 2; //位置 + optional MFVec2 dir = 3; //朝向 } @@ -351,8 +351,8 @@ message MFHeroPart message MFHeroFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 - optional MFVector2D dir = 3; //朝向 + optional MFVec2 pos = 2; //位置 + optional MFVec2 dir = 3; //朝向 optional int32 masert_uniid = 4; //主人id optional MFSkin skin = 13; //皮肤id @@ -367,7 +367,7 @@ message MFHeroFull message MFSmokePart { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float rad = 3; //半径 } @@ -375,7 +375,7 @@ message MFSmokePart message MFSmokeFull { optional int32 obj_uniid = 1; //唯一id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional float rad = 3; //半径 } @@ -478,8 +478,8 @@ message MFGasData */ optional int32 mode = 1; //0:inactive 1:waiting 2:moving 3:jump optional float duration = 2; //持续时间(秒) - optional MFVector2D pos_old = 3; //前一个圆心 - optional MFVector2D pos_new = 4; //新圆心 + optional MFVec2 pos_old = 3; //前一个圆心 + optional MFVec2 pos_new = 4; //新圆心 optional float rad_old = 5; //前一个圆半径 optional float rad_new = 6; //新圆半径 } @@ -488,8 +488,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 float health = 4; //血量 optional bool disconnected = 5 [default = false]; //是否短线 optional bool dead = 6 [default = false]; //是否死亡 @@ -503,8 +503,8 @@ message MFBullet { optional int32 player_id = 1; //玩家id optional int32 bullet_id = 2; //子弹id - optional MFVector2D pos = 3; //位置 - optional MFVector2D dir = 4; //方向 + optional MFVec2 pos = 3; //位置 + optional MFVec2 dir = 4; //方向 optional int32 gun_lv = 5; //枪等级 optional int32 bulletskin = 6; //子弹皮肤 optional bool crit = 7; @@ -527,7 +527,7 @@ message MFShot message MFExplosion { optional int32 item_id = 1; //配置表id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 player_id = 3; //玩家id optional int32 effect = 4 [default = 0]; //爆照效果 0:普通爆照 1:核爆炸 } @@ -536,7 +536,7 @@ message MFExplosion message MFSmoke { optional int32 item_id = 1; //配置表id - optional MFVector2D pos = 2; //位置 + optional MFVec2 pos = 2; //位置 optional int32 player_id = 4; //玩家id } @@ -587,7 +587,23 @@ message MFAirDrop { optional int32 appear_time = 1; //箱子出现时间(毫秒) optional int32 box_id = 2; //箱子id - optional MFVector2D pos = 3; //位置 + optional MFVec2 pos = 3; //位置 +} + +//buff +message MFBuff +{ + optional int32 buff_id = 1; //buff id + optional float left_time = 2; //剩余时间(单位毫秒) + optional float lasting_time = 3; //持续时间(总时间毫秒) +} + +//buff变更 +message MFBuffChg +{ + optional int32 obj_id = 1; //对象id + optional int32 chg = 2; //0:新增/更新 1:删除 + optional MFBuff buff = 3; //buff } //对象状态(只同步一次客户端自己到及时,有变化时服务器会再次下发) @@ -615,15 +631,15 @@ message MFBodyState //飞机 message MFPlane { - optional MFVector2D start_point = 1; //飞机起点 - optional MFVector2D end_point = 2; //飞机终点 + optional MFVec2 start_point = 1; //飞机起点 + optional MFVec2 end_point = 2; //飞机终点 } //载具 message MFCar { optional int32 car_id = 1; //载具id(读equip表) - optional MFVector2D pos = 2; //载具坐标 + optional MFVec2 pos = 2; //载具坐标 } //end mfmsg @@ -645,6 +661,7 @@ message CMJoin optional int32 energy_shield = 12; //能量护盾 repeated int32 baseskin = 13; //皮肤id optional int32 basemelee = 14; //xx + repeated int32 buff_list = 15; //周边系统带进来的战斗数据(护盾,立刻复活等) repeated MFWeapon weapons = 17; //武器列表 repeated MFSkin skins = 18; //皮肤列表 key: 皮肤id value:皮肤等级 repeated int32 prepare_items = 19; //战斗前准备道具 战前准备护盾存到energy_shield @@ -664,8 +681,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 shot_start = 6; //射击-单发 optional bool shot_hold = 7; //射击-连发 @@ -684,6 +701,9 @@ message CMMove optional bool aiming = 2; //是否瞄准中 optional bool use_skill = 29; //使用技能 + optional int32 skill_target_id = 21; //技能目标(单体攻击) + optional MFVec2 skill_dir = 34; //技能方向 + optional float skill_param1 = 35; //辅助参数 optional bool spectate = 30; //自杀 @@ -704,7 +724,7 @@ message CMDropItem message CMEmote { optional int32 type = 1; - optional MFVector2D pos = 2; + optional MFVec2 pos = 2; optional bool team_only = 4; } @@ -792,7 +812,7 @@ message SMUpdate optional MFActivePlayerData active_player_data = 6; //活跃玩家数据(如果玩家死亡后是观战对象的数据) optional int32 alive_count = 15; //存活数量 optional int32 gas_progress = 16; //毒圈进度,表示缩进的像素数(只有当gas_data.mode == moving时才会发进度) - optional MFVector2D gas_pos_old = 30; //毒圈当前圆心坐标 + optional MFVec2 gas_pos_old = 30; //毒圈当前圆心坐标 optional MFGasData gas_data = 17; //毒圈数据 repeated MFTeamData team_data = 18; //队伍数据 repeated MFBullet bullets = 20; //子弹