示例#1
0
        public void MergeFrom(Payload other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.PayloadCase)
            {
            case PayloadOneofCase.ChatPayload:
                if (ChatPayload == null)
                {
                    ChatPayload = new global::Prisel.Protobuf.ChatPayload();
                }
                ChatPayload.MergeFrom(other.ChatPayload);
                break;

            case PayloadOneofCase.BroadcastPayload:
                if (BroadcastPayload == null)
                {
                    BroadcastPayload = new global::Prisel.Protobuf.BroadcastPayload();
                }
                BroadcastPayload.MergeFrom(other.BroadcastPayload);
                break;

            case PayloadOneofCase.CreateRoomRequest:
                if (CreateRoomRequest == null)
                {
                    CreateRoomRequest = new global::Prisel.Protobuf.CreateRoomRequest();
                }
                CreateRoomRequest.MergeFrom(other.CreateRoomRequest);
                break;

            case PayloadOneofCase.CreateRoomResponse:
                if (CreateRoomResponse == null)
                {
                    CreateRoomResponse = new global::Prisel.Protobuf.CreateRoomResponse();
                }
                CreateRoomResponse.MergeFrom(other.CreateRoomResponse);
                break;

            case PayloadOneofCase.ErrorPayload:
                if (ErrorPayload == null)
                {
                    ErrorPayload = new global::Prisel.Protobuf.ErrorPayload();
                }
                ErrorPayload.MergeFrom(other.ErrorPayload);
                break;

            case PayloadOneofCase.GetLobbyStateResponse:
                if (GetLobbyStateResponse == null)
                {
                    GetLobbyStateResponse = new global::Prisel.Protobuf.GetLobbyStateResponse();
                }
                GetLobbyStateResponse.MergeFrom(other.GetLobbyStateResponse);
                break;

            case PayloadOneofCase.GetRoomStateResponse:
                if (GetRoomStateResponse == null)
                {
                    GetRoomStateResponse = new global::Prisel.Protobuf.GetRoomStateResponse();
                }
                GetRoomStateResponse.MergeFrom(other.GetRoomStateResponse);
                break;

            case PayloadOneofCase.JoinRequest:
                if (JoinRequest == null)
                {
                    JoinRequest = new global::Prisel.Protobuf.JoinRequest();
                }
                JoinRequest.MergeFrom(other.JoinRequest);
                break;

            case PayloadOneofCase.JoinResponse:
                if (JoinResponse == null)
                {
                    JoinResponse = new global::Prisel.Protobuf.JoinResponse();
                }
                JoinResponse.MergeFrom(other.JoinResponse);
                break;

            case PayloadOneofCase.LoginRequest:
                if (LoginRequest == null)
                {
                    LoginRequest = new global::Prisel.Protobuf.LoginRequest();
                }
                LoginRequest.MergeFrom(other.LoginRequest);
                break;

            case PayloadOneofCase.LoginResponse:
                if (LoginResponse == null)
                {
                    LoginResponse = new global::Prisel.Protobuf.LoginResponse();
                }
                LoginResponse.MergeFrom(other.LoginResponse);
                break;

            case PayloadOneofCase.RoomStateChangePayload:
                if (RoomStateChangePayload == null)
                {
                    RoomStateChangePayload = new global::Prisel.Protobuf.RoomStateChangePayload();
                }
                RoomStateChangePayload.MergeFrom(other.RoomStateChangePayload);
                break;

            case PayloadOneofCase.ActionPayload:
                if (ActionPayload == null)
                {
                    ActionPayload = new global::Google.Protobuf.WellKnownTypes.Any();
                }
                ActionPayload.MergeFrom(other.ActionPayload);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
示例#2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (payloadCase_ == PayloadOneofCase.ChatPayload)
            {
                hash ^= ChatPayload.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.BroadcastPayload)
            {
                hash ^= BroadcastPayload.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.CreateRoomRequest)
            {
                hash ^= CreateRoomRequest.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.CreateRoomResponse)
            {
                hash ^= CreateRoomResponse.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.ErrorPayload)
            {
                hash ^= ErrorPayload.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.GetLobbyStateResponse)
            {
                hash ^= GetLobbyStateResponse.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.GetRoomStateResponse)
            {
                hash ^= GetRoomStateResponse.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.JoinRequest)
            {
                hash ^= JoinRequest.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.JoinResponse)
            {
                hash ^= JoinResponse.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.LoginRequest)
            {
                hash ^= LoginRequest.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.LoginResponse)
            {
                hash ^= LoginResponse.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.RoomStateChangePayload)
            {
                hash ^= RoomStateChangePayload.GetHashCode();
            }
            if (payloadCase_ == PayloadOneofCase.ActionPayload)
            {
                hash ^= ActionPayload.GetHashCode();
            }
            hash ^= (int)payloadCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }