syntax = "proto3";

option go_package = "./msg";

enum roleType {
    ROLE_TYPE_UNKNOWN = 0;
    RED        = 1;  // 无操作
    BLUE   = 4;
    YELLOW   = 3;
    GREEN   = 2;
}

enum OptType {
    OPT_TYPE_UNKNOWN = 0;
    ZHI_SHAI_ZI     = 1;  
    SELECT_ROLE   = 2;
}

enum roomType {
  ROOM_TYPE_UNKNOWN = 0;
  SHUANG_REN = 1;
  SIREN_REN = 2;
}

enum roomMode {
  ROOM_MODE_UNKNOWN = 0;
  REN_JI = 1;
  WAN_JIA = 2;
}

enum roadType {
  ROAD_TYPE_UNKNOWN = 0;
  HOME =1;
}

enum playerStatus {
  PLAYER_STATUS_UNKNOWN = 0;
  SZ_ANIMATION =1;
  COLOR_FINISH = 2;
  COLOR_KICK = 3;
  COLOR_TIME_OUT = 4;
}

enum roomStatus {
  AWAIT = 0;
  START = 1;
  END = 2;
}

message round {
  roleType m_color = 1; 
  string m_road = 2;
  OptType opt = 3;
  int32 szNumber = 4;
}

message RoomInfo {
  repeated RoleData roles = 1;
  repeated ColorData colors = 2;
  roomType room_type = 3;
  roomMode room_mode = 4;
  roleType cur_round_color = 5; //当前那个阵营的回合
  repeated round rounds = 6;
  repeated ColorData finish_colors = 7;
  repeated ColorData kict_colors = 8;
  int32 id = 9;
  int32 room_level = 10; //房间的每个等级都对应着不同的奖励和消耗
  roomStatus room_status = 11;
  NotifyPlayerOpt cur_color_opt_data = 12; //当前阵营操作的类型
  int32 opt_time = 13; //玩家当前剩余操作时间
}

message RoleData {
  roleType m_color = 1;
  int32 m_seat = 2;
  string m_id = 3;
  roadType m_cur_road = 4;
  int32 step = 5;
  int32 old_setp = 6;
}

message ColorData {
  string m_id = 1;
  roleType m_color = 2;
  bool is_kick = 3;
  bool is_finish = 4;
  int32 time_out_num = 5;
  string m_name = 6;
  string m_head = 7;
  int32 rank_num = 8;
  int32 m_coin = 9;
  int32 m_reward_coin = 10;
}

message MoveStepData {
  string m_id = 1;
  int32 step = 2;
  int32 old_setp = 3;
}

message SendColorSz {
  roleType color = 1;  // 
}

message SendRoleMove {
  roleType color = 1;  // 
  string roleId = 2;
}

message SendQuitRoom {
  roleType color = 1;  // 
}

message NotifyPlayerSzNumber {
  roleType color = 1;  // 
  int32 szNumber = 2;   // 
  MsgError err_msg = 3;
}

message NotifyPlayerMove {
  roleType color = 1;  // 
  MoveStepData step = 2;   // 
  repeated RoleData kick = 3;
}

message NotifyPlayerOpt {
  roleType color = 1;  // 
  OptType opt = 2;   // 
  repeated RoleData canMoveRoles = 3;
  int32 opt_time = 4;
}

message NotifyPlayerStatus {
  roleType color = 1;  // 
  playerStatus status = 2;
  repeated ColorData colors = 3;
  ColorData time_out_color = 4;
}


message NotifySettlement {
  roleType color = 1;  // 
  repeated ColorData finish_colors = 2;
}


message NotifyUpdateRoomInfo {
  RoomInfo room_info = 1;  // 
}
//----------------------------------


//用户信息
message UserInfo {
  string UserId = 1;
  string m_head = 2;
  int32 m_coin = 3;
  string name = 4;
  int32 room_id = 5; //如果用户在某一个房间玩，他的id就一直存在，
  
}
//登录 请求
message ReqLogin {
  string account = 1;
  string password = 2;
}

//登录 响应
message ResLogin {
  string userId = 1;
  string nikeName = 2;
  UserInfo userInfo = 3;
  MsgError err_msg = 4;
}
//注册 请求
message ReqRegister {
  string nikeName = 1;
  string account = 2;
  string password = 3;
  string m_head = 4;
}
//注册 响应
message ResRegister {
  bool success = 1;
  MsgError err_msg = 2;
}



//进入大厅
message EnterHall {
  string userId = 1;
}
//进入大厅响应
message ResEnterHall {
  bool success = 1;
  MsgError err_msg = 2;
  RoomInfo reconnect_room_info = 3;
}

//离开大厅
message LeaveHall {
  string userId = 1;
}

//匹配ludo
message MatchLudo {
  roomType select_room_type = 1;
  int32 room_level = 2;
  roleType select_color = 3;
}
//匹配ludo 响应
message ResMatchLudo {
  bool success = 1;
  MsgError err_msg = 2;
  RoomInfo room = 3;
}

//error
message MsgError {
  int32 error_code = 1;
  string error_msg = 2;
}


// 更新用户信息
message UpdateUserInfo {
  UserInfo info = 1;
}
message ResHeartBeat {
  string msg = 1;
}

message ReqHeartBeat {
  string msg = 1;
}

message ShopItem{
  string name = 1;
  string id = 2;
  int32 price = 3;
  int32 num = 4;
}

//被踢登陆
message BeKickLogin {
  MsgError err_msg = 1;
}

// 请求商城
message ReqShop {
  int32 shopType = 1;
}

// 响应商城
message ResShop {
  bool success = 1;
  MsgError err_msg = 2;
  repeated ShopItem list = 3;
}

message BuyShopItem{
  string id = 1;
}