//指定版本
//注意proto3与proto2的写法有些不同
syntax = "proto3";

//包名，通过protoc生成时go文件时
package protocol;

// 坐标信息
message Position {
    sint32 x = 1;
    sint32 y = 2;
    sint32 z = 3;
    sint32 w = 4;
}

message A2C_LoginAuthResp {
    string accessKey = 1;
    string secretKey = 2;
    string gateAddr = 3;
}

// 客户端登录
message ClientPlayerLogin {
    string accessKey = 1;
    string secretKey = 2;
    sint32 mapId = 3;
    sint32 mapWidth = 4;
    sint32 mapLength = 5;
    Position pos = 6;
    string username = 7;
    string modelRes = 8;
}

// 客户端验证请求
message C2A_LoginAuthReq {
    string account = 1;
    string password = 2;
}

// 客户端登录应答
message GsPlayerLoginResp {
    // 0 表示登录失败
    sint32 mapId = 1;
    string entityId = 2;
    string clientId = 3;
}

message BroadcastMsg2Clients {
    repeated string clientIds = 1;
    sint32 msgType = 2;
    bytes msgBody = 3;
}

message BroadcastMsg2AllClients {
    sint32 msgType = 1;
    bytes msgBody = 2;
}

message C2Gs_SyncEntityPos {
    string entityId = 1;
    Position pos = 2;
}

message Gs2C_SyncEntityPos {
   string entityId = 1;
   Position pos = 2;
}

// 其他实例离开附近区域
message Gs2C_NearEntityLeave {
    string entityId = 1;
}

// 其他实例进入附近区域
message Gs2C_NearEntityEnter {
    string entityId = 1;
    sint32 entityType = 2;
    Position pos = 3;
    string name = 4;
    string modelRes = 5;
    string ownerClientId = 6;
}

// 其他实例进入附近区域
message Gs2C_NearEntitiesEnter {
    repeated Gs2C_NearEntityEnter entities = 1;
}

// 其他实例进入附近区域
message Gs2C_NearEntitiesLeave {
    repeated string entityIds = 1;
}

message C2Gs_CreateEntity {
    string name = 1;
    string modelRes = 2;
    Position pos = 3;
    uint32 clientEntityId = 4;
    sint32 entityType = 5;
}

message Gs2C_CreateEntityResp {
    string entityId = 1;
    uint32 clientEntityId = 2;
}

message C2Gs_DeleteEntity {
    string entityId = 1;
}

message C2Gs_Broadcast2NearPlayer {
    sint32 msgType = 1;
    bytes msgBody = 2;
}

message C2Gs_Send2SpecPlayer {
    string dstClientId = 1;
    sint32 msgType = 2;
    bytes msgBody = 3;
}

message Gs2C_ReceiveFromOtherPlayer {
    string srcClientId = 1;
    sint32 msgType = 2;
    bytes msgBody = 3;
}

message C2Gs_SyncEntityInputState {
    string entityId = 1;
    sint32 state = 2;
    bool enable = 3;
}

message Gs2C_SyncEntityInputState {
    string entityId = 1;
    sint32 state = 2;
    bool enable = 3;
}

message C2GS_SendChatMsg {
    sint32 chatType = 1;
    string chatContent = 2;
}

message GS2C_SendChatMsg {
    sint32 chatType = 1;
    string chatSender = 2;
    string chatContent = 3;
}
