Skip to content

Commit

Permalink
Merge pull request #21 from SERENCH/dev
Browse files Browse the repository at this point in the history
style: proto修改
  • Loading branch information
yihan-wa committed Sep 22, 2024
2 parents 8daf86a + a9ce5f2 commit 64f969c
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 72 deletions.
30 changes: 21 additions & 9 deletions dependency/proto/Message2Clients.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,21 @@ message MessageOfTrap
int64 team_id = 4;
}

message MessageOfResource
message MessageOfEconomyResource
{
ResourceType resource_type = 1;
ResourceState resource_state = 2;
EconomyResourceType economy_resource_type = 1;
EconomyResourceState economy_resource_state = 2;

int32 x = 3;
int32 y = 4;

int32 process = 5; // 采集进度 等价于血量
}

message MessageOfAdditionResource
{
AdditionResourceType addition_resource_type = 1;
AdditionResourceState addition_resource_state = 2;

int32 x = 3;
int32 y = 4;
Expand Down Expand Up @@ -108,10 +119,11 @@ message MessageOfObj
MessageOfSpring spring_message = 3;
MessageOfFarm farm_message = 4;
MessageOfTrap trap_message = 5;
MessageOfResource resource_message = 6;
MessageOfMap map_message = 7;
MessageOfNews news_message = 8;
MessageOfTeam team_message = 9;
MessageOfEconomyResource economy_resource_message = 6;
MessageOfAdditonResource addition_resource_message = 7;
MessageOfMap map_message = 8;
MessageOfNews news_message = 9;
MessageOfTeam team_message = 10;
}
}

Expand All @@ -120,8 +132,8 @@ message MessageOfAll
int32 game_time = 1;
int32 buddhists_team_score=2;
int32 monsters_team_score=3;
int32 buddhists_team_energy=4;
int32 monsters_team_energy=5;
int32 buddhists_team_economy=4;
int32 monsters_team_economy=5;
int32 buddhists_hero_hp=6;
int32 monsters_hero_hp=7;
}
Expand Down
24 changes: 11 additions & 13 deletions dependency/proto/Message2Server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,27 @@ message SendMsg
int64 team_id = 5;
}

message AttackMsg // 相当于攻击
message AttackMsg // 普通攻击
{
int64 character_id = 1;
int64 team_id = 2;
int32 attack_range = 3; // 攻击范围
int64 attacked_character_id = 4;
int64 attacked_character_id = 4; // 攻击对象
}

message CastMsg
message CastMsg // 释放技能
{
int64 character_id = 0;
int64 skill_id = 1;
repeated int64 casted_character_id = 2;
repeated int64 casted_character_id = 2; // 技能作用的对象,可能有多个
int64 team_id = 3;
int32 x = 4;
int32 y = 5;

// 释放技能时角色的位置(击退可能有用)
optional int32 x = 4;
optional int32 y = 5;

// 释放技能的角度(激光束可能有用)
optional double angle = 6;
}

message ConstructMsg //修建建筑
Expand All @@ -78,13 +83,6 @@ message RecoverMsg
int64 team_id = 3;
}

message ShieldMsg
{
int64 character_id = 1;
int64 defensive_value = 2;
int64 team_id = 3;
}

message CreatCharacterMsg
{
CharacterType character_type = 1;
Expand Down
104 changes: 61 additions & 43 deletions dependency/proto/MessageType.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,137 +2,155 @@
syntax = "proto3";
package protobuf;

enum GameState
enum GameState //
{
NULL_GAME_STATE = 0;
GAME_START = 1;
GAME_RUNNING = 2;
GAME_END = 3;
}

enum PlaceType
enum PlaceType //
{
NULL_PLACE_TYPE = 0;
HOME = 1;
SPACE = 2;
BARRIER = 3;
BUSH = 4;
RESOURCE = 5;
CONSTRUCTION = 6;
TRAP = 7;
HOME = 1; // 出生点(地图左下与右上)
SPACE = 2; // 空地
BARRIER = 3; // 障碍
BUSH = 4; // 草丛
ECONOMY_RESOURCE = 5; // 经济资源
ADDITION_RESOURCE = 6; // 加成资源
CONSTRUCTION = 7; // 建筑
TRAP = 8; // 陷阱
}

enum ShapeType
enum ShapeType //
{
NULL_SHAPE_TYPE = 0;
CIRCLE = 1;
SQUARE = 2;
}


enum PlayerType
{
NULL_PLAYER_TYPE = 0;
CHARACTER = 1;
TEAM = 2;
}

enum CharacterType
enum CharacterType //
{
NULL_CHARACTER_TYPE = 0;

// 取经团队阵营角色
CAMP1_CHARACTER1 = 1;
CAMP1_CHARACTER2 = 2;
CAMP1_CHARACTER3 = 3;
CAMP1_CHARACTER4 = 4;
CAMP1_CHARACTER5 = 5;

// 妖怪团队阵营角色
CAMP2_CHARACTER1 = 6;
CAMP2_CHARACTER2 = 7;
CAMP2_CHARACTER3 = 8;
CAMP2_CHARACTER4 = 9;
CAMP2_CHARACTER5 = 10;
}

enum CharacterState
enum CharacterState // 角色状态
{
NULL_CHARACTER_STATE = 0;

// 主动状态
IDLE = 1;
HARVESTING = 2;
ATTACKING = 3;
SKILL_CASTING = 4;
CONSTRUCTING = 5;
MOVING = 6;

// 被动状态
BLIND = 7;
KNOCKED_BACK = 8;
STUNNED = 9;
INVISIBLE = 10;
HEALING = 11;
BERSERK = 12;
BURNED = 13;
}

enum ResourceType
enum EconomyResourceType // 经济资源
{
NULL_RESOURCE_TYPE = 0;
NULL_ECONOMY_RESOURCE_TYPE = 0;
ECONOMY_RESOURCE = 1;
SMALL_ADDITION_RESOURCE1 = 2;
MEDIUM_ADDITION_RESOURCE1 = 3;
LARGE_ADDITION_RESOURCE1 = 4;
SMALL_ADDITION_RESOURCE2 = 5;
MEDIUM_ADDITION_RESOURCE2 = 6;
LARGE_ADDITION_RESOURCE2 = 7;
SMALL_ADDITION_RESOURCE3 = 8;
MEDIUM_ADDITION_RESOURCE3 = 9;
LARGE_ADDITION_RESOURCE3 = 10;
SMALL_ADDITION_RESOURCE4 = 11;
MEDIUM_ADDITION_RESOURCE4 = 12;
LARGE_ADDITION_RESOURCE4 = 13;
}

enum ResourceState
enum AdditionResourceType // 加成资源
{
NULL_ADDITION_RESOURCE_TYPE = 0;

SMALL_ADDITION_RESOURCE1 = 1;
MEDIUM_ADDITION_RESOURCE1 = 2;
LARGE_ADDITION_RESOURCE1 = 3;

SMALL_ADDITION_RESOURCE2 = 4;
MEDIUM_ADDITION_RESOURCE2 = 5;
LARGE_ADDITION_RESOURCE2 = 6;

ADDITION_RESOURCE3 = 7;

ADDITION_RESOURCE4 = 8;
}

enum EconomyResourceState //
{
NULL_RESOURCE_STSTE = 0;
NULL_ECONOMY_RESOURCE_STSTE = 0;
HARVESTABLE = 1;
BEING_HARVESTED = 2;
HARVESTED = 3;
}

enum EquipmentType
enum AdditionResourceState //
{
NULL_ADDITION_RESOURCE_STATE = 0;
BEATABLE = 1;
BEING_BEATEN = 2;
BEATEN = 3;
}

enum EquipmentType // 装备
{
NULL_EQUIPMENT_TYPE = 0;

SMALL_HEALTH_POTION = 1;
MEDIUM_HEALTH_POTION = 2;
LARGE_HEALTH_POTION = 3;

SMALL_SHIELD = 4;
MEDIUM_SHIELD = 5;
LARGE_SHIELD = 6;

SPEEDBOOTS = 7;
PURIFICATION_POTION = 8;
INVISIBILITY_POTION = 9;
BERSERK_POTION = 10;
}

enum ConstructionType
enum ConstructionType // 建筑
{
NULL_CONSTRUCTION_TYPE = 0;
BARRACKS = 1;
SPRING = 2;
FARM = 3;
}

enum TrapType
enum TrapType // 陷阱
{
NULL_TRAP_TYPE = 0;
HOLE = 1;
CAGE = 2;
HOLE = 1; // 坑洞陷阱
CAGE = 2; // 牢笼陷阱
}

enum NewsType
enum NewsType //
{
NULL_NEWS_TYPE = 0;
TEXT = 1;
BINARY = 2;
}

enum PlayerTeam
enum PlayerTeam //
{
NULL_TEAM = 0;
BUDDHISTS_TEAM=1;
Expand Down
17 changes: 10 additions & 7 deletions dependency/proto/Services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@ import "Message2Server.proto";
service AvailableService
{
rpc TryConnection(IDMsg) returns (BoolRes);

// 游戏开局调用一次的服务
rpc AddPlayer(PlayerMsg) returns (stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息
rpc AddCharacter(CharacterMsg) returns (stream MessageToClient); // 连接上后等待游戏开始,server会定时通过该服务向所有client发送消息
rpc GetMap(NullRequest) returns (MessageOfMap);
// 游戏过程中玩家执行操作的服务
//

// 游戏过程中普通角色执行操作的服务
rpc Move(MoveMsg) returns (MoveRes); // 移动
rpc Recover(RecoverMsg) returns (BoolRes); // 回复
rpc Harvest(IDMsg) returns (BoolRes); // 开采
rpc Harvest(IDMsg) returns (BoolRes); // 开采经济资源
rpc Rebuild(ConstructMsg) returns (BoolRes); // 给建筑回血
rpc Construct(ConstructMsg) returns (BoolRes); // 修建建筑
rpc Equip(EquipMsg) returns (BoolRes); // 买装备
rpc Attack(AttackMsg) returns (BoolRes); // 攻击
rpc Attack(AttackMsg) returns (BoolRes); // 普通攻击
rpc Cast(CastMsg) returns (BoolRes); // 释放技能
rpc Send(SendMsg) returns (BoolRes); // 传递信息
rpc CreatCharacter(CreatCharacterMsg) returns (BoolRes);
rpc CreatCharacterRID(CreatCharacterMsg) returns (CreatCharacterRes);

// 游戏过程中核心角色可以另外执行操作的服务
rpc CreatCharacter(CreatCharacterMsg) returns (BoolRes); // 创建角色
rpc CreatCharacterRID(CreatCharacterMsg) returns (CreatCharacterRes); // 获取角色编号
rpc EndAllAction(IDMsg) returns (BoolRes); // 结束所有动作
}

0 comments on commit 64f969c

Please sign in to comment.