| @@ -0,0 +1,113 @@ | |||
| // Message2Client | |||
| syntax = "proto3"; | |||
| package Protobuf; | |||
| import "MessageType.proto"; | |||
| import "Message2Server.proto"; | |||
| import "google/protobuf/empty.proto"; | |||
| message MessageOfHuman | |||
| { | |||
| int32 x = 1; | |||
| int32 y = 2; | |||
| int32 speed = 3; | |||
| int32 life = 4; // 本次未倒地前的血量,也即还可以受的伤害 | |||
| int32 hangedTime = 5; // 被挂上的次数 | |||
| double timeUntilSkillAvailable = 6; | |||
| PlaceType place = 7; | |||
| PropType prop = 8; | |||
| HumanType humanType = 9; | |||
| int64 guid = 10; | |||
| bool onChair = 11; // 是否被挂 | |||
| double chairTime = 12; // 被挂的时间 | |||
| bool onGround = 13; // 是否倒地 | |||
| double groundTime = 14; // 倒地时间 | |||
| int64 playerID = 15; | |||
| repeated HumanBuffType buff = 16; | |||
| } | |||
| message MessageOfButcher | |||
| { | |||
| int32 x = 1; | |||
| int32 y = 2; | |||
| int32 speed = 3; | |||
| int32 damage = 4; | |||
| double timeUntilSkillAvailable = 5; | |||
| PlaceType place = 6; | |||
| PropType prop = 7; | |||
| ButcherType butcherType = 8; | |||
| int64 guid = 9; | |||
| bool movable = 10; // 是否进入了攻击后摇 | |||
| int64 playerID = 11; | |||
| repeated ButcherBuffType buff = 12; | |||
| } | |||
| message MessageOfProp // 可拾取道具的信息 | |||
| { | |||
| PropType type = 1; | |||
| int32 x = 2; | |||
| int32 y = 3; | |||
| double facingDirection = 4; | |||
| int64 guid = 5; | |||
| PlaceType place = 6; | |||
| } | |||
| message MessageOfPickedProp //for Unity,直接继承自THUAI5 | |||
| { | |||
| PropType type = 1; | |||
| int32 x = 2; | |||
| int32 y = 3; | |||
| double facingDirection = 4; | |||
| int64 mappingID = 5; | |||
| } | |||
| message MessageOfMap | |||
| { | |||
| message Row | |||
| { | |||
| repeated PlaceType col = 1; | |||
| } | |||
| repeated Row row = 2; | |||
| } | |||
| message MessageToClient | |||
| { | |||
| repeated MessageOfHuman humanMessage = 1; | |||
| repeated MessageOfButcher butcherMessage = 2; | |||
| repeated MessageOfProp propMessage = 3; | |||
| MessageOfMap mapMassage = 4; | |||
| } | |||
| message MoveRes // 如果打算设计撞墙保留平行速度分量,且需要返回值则可用这个(大概没啥用) | |||
| { | |||
| int64 actualSpeed = 1; | |||
| double actualAngle = 2; | |||
| } | |||
| message BoolRes // 用于只需要判断执行操作是否成功的行为,如捡起道具、使用道具 | |||
| { | |||
| bool actSuccess = 1; | |||
| } | |||
| service AvailableService | |||
| { | |||
| // 游戏开局调用一次的接口 | |||
| rpc AddPlayer(PlayerMsg) returns(BoolRes); | |||
| // 游戏过程中玩家执行操作的接口 | |||
| rpc Move(MoveMsg) returns (MoveRes); | |||
| rpc PickProp(PickMsg) returns (BoolRes); | |||
| rpc UseProp(IDMsg) returns (BoolRes); | |||
| rpc UseSkill(IDMsg) returns (BoolRes); | |||
| rpc SendMessage(SendMsg) returns (BoolRes); | |||
| rpc FixMachine(stream IDMsg) returns (stream BoolRes); // 若正常修复且未被打断则返回修复成功,位置错误/被打断则返回修复失败,下同 | |||
| rpc SaveHuman(stream IDMsg) returns (stream BoolRes); | |||
| rpc Attack (AttackMsg) returns (BoolRes); | |||
| rpc CarryHuman (IDMsg) returns (BoolRes); | |||
| rpc ReleaseHuman (IDMsg) returns (BoolRes); | |||
| rpc HangHuman (IDMsg) returns (BoolRes); | |||
| // 游戏过程中玩家获取信息的接口 | |||
| rpc GetInfo(google.protobuf.Empty) returns (stream MessageToClient); // 可直接获取全部的信息 | |||
| } | |||
| @@ -0,0 +1,62 @@ | |||
| // Message2Server | |||
| syntax = "proto3"; | |||
| package Protobuf; | |||
| import "MessageType.proto"; | |||
| message PlayerMsg | |||
| { | |||
| int64 playerID = 1; | |||
| PlayerType playerType = 2; | |||
| oneof jobType | |||
| { | |||
| HumanType humanType = 3; | |||
| ButcherType butcherType = 4; | |||
| } | |||
| } | |||
| message MoveMsg | |||
| { | |||
| int64 playerID = 1; | |||
| double angle = 2; | |||
| int64 timeInMilliseconds = 3; | |||
| } | |||
| message PickMsg | |||
| { | |||
| int64 playerID = 1; | |||
| PropType propType = 2; | |||
| } | |||
| message SendMsg | |||
| { | |||
| int64 playerID = 1; | |||
| int64 toPlayerID = 2; | |||
| string message = 3; | |||
| } | |||
| message AttackMsg | |||
| { | |||
| int64 playerID = 1; | |||
| double angle = 2; | |||
| } | |||
| message IDMsg | |||
| { | |||
| int64 playerID = 1; | |||
| } | |||
| // 基本继承于THUAI5,为了使发送的信息尽可能不被浪费,暂定不发这类大包。 | |||
| // message MessageToServer | |||
| // { | |||
| // MessageType messageType = 1; | |||
| // int64 playerID = 2; // 消息发送者的playerID | |||
| // PlayerType playerType = 3; | |||
| // HumanType humanType= 4; | |||
| // ButcherType butcherType = 5; | |||
| // double angle = 6; // messageType为Move, Attack时的角度 | |||
| // PropType propType = 7; // messageType为PickProp时要捡起的道具类型,防止多个道具堆叠时出现问题 | |||
| // int64 timeInMilliseconds = 8;//时间参数 | |||
| // int64 ToPlayerID = 9; // messageType为Send时要发送的对象的ID | |||
| // string message = 10; // messageType为Send时发送的消息内容 | |||
| // } | |||
| @@ -0,0 +1,108 @@ | |||
| // MessageType | |||
| syntax = "proto3"; | |||
| package Protobuf; | |||
| enum PlaceType // 地图中的所有物件类型 | |||
| { | |||
| NullPlaceType = 0; | |||
| // 地图情况,其中Gate是总体的大门,HiddenGate是地窖 | |||
| Wall = 1; | |||
| Grass = 2; | |||
| Machine = 3; | |||
| Gate = 4; | |||
| HiddenGate = 5; | |||
| // 待补充有特殊效果的地形 | |||
| } | |||
| enum ShapeType // 形状类型 | |||
| { | |||
| NullShapeType = 0; | |||
| Circle = 1; // 人类、屠夫、可拾取道具等为圆形 | |||
| Square = 2; // 地形均为方形 | |||
| } | |||
| enum PropType // 地图中的可拾取道具类型 | |||
| { | |||
| NullPropType = 0; | |||
| PType1 = 1; | |||
| PType2 = 2; | |||
| PType3 = 3; | |||
| PType4 = 4; | |||
| } | |||
| enum HumanBuffType // 人类可用的增益效果类型 | |||
| { | |||
| NullHBuffType = 0; | |||
| HBuffType1 = 1; | |||
| HBuffType2 = 2; | |||
| HBuffType3 = 3; | |||
| HBuffType4 = 4; | |||
| } | |||
| enum ButcherBuffType // 屠夫可用的增益效果类型 | |||
| { | |||
| NullBBuffType = 0; | |||
| BBuffType1 = 1; | |||
| BBuffType2 = 2; | |||
| BBuffType3 = 3; | |||
| BBuffType4 = 4; | |||
| } | |||
| // 特别说明:由于Human阵营和Butcher阵营有显著的隔离,且暂定职业、主动技能和被动效果相互绑定,故不按照THUAI5的方式区分ActiveSkillType和PassiveSkillType,而是选择了按照阵营来给不同阵营赋予不同的职业(及技能)。 | |||
| enum PlayerType | |||
| { | |||
| HumanPlayer = 0; | |||
| ButcherPlayer = 1; | |||
| } | |||
| enum HumanType | |||
| { | |||
| NullHumanType = 0; | |||
| HumanType1 = 1; | |||
| HumanType2 = 2; | |||
| HumanType3 = 3; | |||
| HumanType4 = 4; | |||
| } | |||
| enum ButcherType | |||
| { | |||
| NullButcherType = 0; | |||
| ButcherType1 = 1; | |||
| ButcherType2 = 2; | |||
| ButcherType3 = 3; | |||
| ButcherType4 = 4; | |||
| } | |||
| // 取消了大包之后,MessageType的枚举是否有必要保留还有待商榷 | |||
| // enum MessageType | |||
| // { | |||
| // // 公共信息类型 | |||
| // Move = 0; | |||
| // PickProp = 1; | |||
| // UseProp = 2; | |||
| // UseSkill = 3; | |||
| // Map = 4; | |||
| // Send = 5; | |||
| // // 人类限定信息类型 | |||
| // FixMachine = 6; | |||
| // SaveHuman = 7; | |||
| // // 屠夫限定信息类型 | |||
| // Attack = 8; | |||
| // CarryHuman = 9; | |||
| // ReleaseHuman = 10; | |||
| // HangHuman = 11; | |||
| // // 游戏相关信息类型 | |||
| // AddPlayer = 12; | |||
| // InvalidPlayer = 13; | |||
| // ValidPlayer = 14; | |||
| // StartGame = 15; | |||
| // Gaming = 16; | |||
| // EndGame = 17; | |||
| // } | |||