Exemple #1
0
        public void JoinRoom(SignedResponse <JoinRoomData> signedJoinRoomData)
        {
            mt.SignedJoinRoomData = signedJoinRoomData;
            waitForRoomJoinEvent  = true;
            if (!mt.isConnected)
            {
                mt.connect(signedJoinRoomData.Data.host, signedJoinRoomData.Data.tcpPort, signedJoinRoomData.Data.httpsPort);
                return;
            }
            if (!mt.isLoggedIn)
            {
                mt.login();
                return;
            }
            string clientRoomName = mt.ClientRoomName;

            if (clientRoomName != null && clientRoomName == signedJoinRoomData.Data.room)
            {
                mt.triggerEvent(GameServerEvent.ROOM_JOIN, clientRoomName);
                return;
            }
            RoomJoinError roomJoinError = default(RoomJoinError);

            roomJoinError.roomName     = signedJoinRoomData.Data.room;
            roomJoinError.errorMessage = "Already logged in";
            mt.triggerEvent(GameServerEvent.ROOM_JOIN_ERROR, roomJoinError);
        }