syntax = "proto3";  //指定版本，必须要写（proto3、proto2）  
option go_package="./;gameproto";
package gameproto;

import "google/protobuf/any.proto";

enum NotifyTypeEnum {
    NotifyTypePing = 0;
    NotifyTypeJoinRoom = 1;
    NotifyTypeLeaveRoom = 2;
    NotifyTypeCreateRoom = 3;
    NotifyTypeConnect = 4;
    NotifyTypeDisconnect = 5;
    NotifyTypeReady = 6;
    NotifyTypeUnReady = 7;
    NotifyTypeStart = 8;
    NotifyTypeChooseMaster = 9;
    NotifyTypeChooseMasterFinish = 10;
    NotifyTypeChooseMul = 11;
    NotifyTypeChooseMulinish = 12;
    NotifyTypeGameInit = 13; 
    NotifyTypeOpen = 14;
    NotifyTypeOpenFinish = 15;
    NotifyTypeMsgResp = 16;  //简单的返回
}

enum DataType {
    DataTypeNormal = 0;     //0x00000000
    DataTypeGZip   = 2;     //0x00000010
    DataTypeEnc    = 4;     //0x00000100
}

enum RoomType {
    RoomTypeFree = 0;    
    RoomTypeNormal = 1;
}

enum RespStatus {
    RespStatusSucc = 0;    
    RespStatusFailed = 1;
}

//Ping
message Ping {
}

message MsgResp {
    string once = 1;
    RespStatus status = 2;
    string msg = 3;
    google.protobuf.Any data = 4;
}

message Room {
    uint32 ID  = 1;
    string Name = 2;
    bool needPwd = 10;
    RoomType RoomType = 3;
    double BaseAmount = 4;
    uint32 ChairUserID1 = 5;
    uint32 ChairUserID2 = 6;
    uint32 ChairUserID3 = 7;
    uint32 ChairUserID4 = 8;
    uint32 ChairUserID5 = 9;
}

message Connect {
    uint32 UserID = 1;
    int64 LogID = 2;
    string Name = 3;
    string Img = 4;
    double Balance = 5;
    repeated Room RoomList = 6;
}

message Disconnect {
    uint32 UserID = 1;
}

message JoinRoom {
    uint32 RoomID = 1;
    uint32 ChairID = 2;
    uint32 UserID = 3;
    uint32 GameStatus = 4;
}

message LeaveRoom {
    uint32 RoomID = 1;
    uint32 ChairID = 2;
    uint32 UserID = 3;
}

message CreateRoom {
    uint32 ID  = 1;
    string Name = 2;
    bool needPwd = 10;
    RoomType RoomType = 3;
    double BaseAmount = 4;
    uint32 ChairUserID1 = 5;
    uint32 ChairUserID2 = 6;
    uint32 ChairUserID3 = 7;
    uint32 ChairUserID4 = 8;
    uint32 ChairUserID5 = 9;
}

message Ready {
    uint32 RoomID = 1;
    uint32 UserID = 3;
}

message UnReady {
    uint32 RoomID = 1;
    uint32 UserID = 3;
}

//准备人数够，开始游戏
message Start {
    uint32 RoomID = 1;
    repeated uint32 ChooseMasterMulList = 2;    //抢庄倍数列表
    string issue = 3;
}

//选庄
message ChooseMaster {
    uint32 UserID = 1;
    uint32 Mul = 2;                 //0,1,2,3 - 0表示不抢
    uint32 RoomID = 3;
}

//选倍数
message ChooseMul {
    uint32 UserID = 1;
    uint32 Mul = 2;         //1,2,3 - 倍数
    uint32 RoomID = 3;
}

//选庄完成
message ChooseMasterFinish {
    uint32 MasterUserID = 1;     //庄家的ID
    repeated uint32 MulList = 2; //倍数列表
    uint32 RoomID = 3;
}

//选倍数完成
message ChooseMulFinish {
    uint32 RoomID = 3;
}

message PayoutInfo {
    uint32 UserID = 1;
    float winAmount = 2;
    bool isMaster = 3;
}

//选倍数完成
message OpenFinish {
    uint32 RoomID = 1;
    repeated PayoutInfo PayoutInfoList = 2;
}

//开牌
message Open {
    uint32 RoomID = 1;
    uint32 UserID = 2;
    repeated uint32 CardList = 3; //牌型列表
}

//游戏初始化
message GameInit {
    uint32 RoomID = 1;
}