syntax = "proto3";
package dof;
option go_package = "./;pb";

// ClientMessage 客户端发送给服务端的消息类型
message ClientMessage {
  oneof actual {
    PlayerEnter player_enter = 1;
    LevelPrepared level_prepared = 2;
    PointFound point_found = 3;
    LevelEnd level_end = 4;
    AllLevelEnd all_level_end = 5;
    PlayerLeave player_leave = 6;
  }
}

// ServerMessage 服务端发送给客户端的消息类型
message ServerMessage {
  oneof actual {
    PlayerEntered player_entered = 1;
    GameStart game_start = 2;
    LevelStart level_start = 3;
    PointFound point_found = 4;
    GameFinish game_finish = 5;
  }
}

// PlayerEnter 客户端进入房间
message PlayerEnter {
  string room_id = 1;
  string uid = 2;
  string nick_name = 3;
  string country = 4;
}

message LevelResource {
  string level_id = 1;
  string android_generation = 2;
  string ios_generation = 3;
}

// PlayerEntered 服务端接收到 PlayerEnter 消息后发还给客户端的回执
message PlayerEntered {
  int64 cid = 1;
}

message GameStart {
  repeated LevelResource level_resource = 1;
}

message LevelPrepared {
  int64 cid = 1;
  string level = 2;
}

message LevelStart {
  string level = 1;
}

message PointFound {
  int64 cid = 1;
  string level = 2;
  int32 point_id = 3;
}

message LevelEnd {
  int64 cid = 1;
  string level = 2;
}

message AllLevelEnd {
  int64 cid = 1;
}

message GameScore {
  string uid = 1;
  int32 score = 2;
}

message GameFinish {
  repeated GameScore scores = 1;
}

message PlayerLeave {
  int64 cid = 1;
}
