// -------------------------------------------------------------------------------
        void OnServerMessageResponsePlayerSwitchServer(NetworkConnection conn, ServerMessageResponsePlayerSwitchServer msg)
        {
            int token = 0;

            //RequestPlayerSwitchServer(conn, userName, token);
            OnServerMessageResponse(conn, msg);
        }
Esempio n. 2
0
        // -------------------------------------------------------------------------------
        // OnClientMessageRequestPlayerSwitchServer
        // @Client -> @Server
        // -------------------------------------------------------------------------------
        void OnClientMessageRequestPlayerSwitchServer(NetworkConnection conn, ClientMessageRequestPlayerSwitchServer msg)
        {
            ServerMessageResponsePlayerSwitchServer message = new ServerMessageResponsePlayerSwitchServer
            {
                success          = true,
                text             = "",
                causesDisconnect = false
            };

            if (DatabaseManager.singleton.TryPlayerSwitchServer(msg.username, msg.token))
            {
                message.text = systemText.playerSwitchServerSuccess;
            }
            else
            {
                message.text    = systemText.playerSwitchServerFailure;
                message.success = false;
            }

            conn.Send(message);
        }
Esempio n. 3
0
        // ====================== MESSAGE EVENT HANDLERS =================================

        // -------------------------------------------------------------------------------
        // OnServerMessageResponsePlayerSwitchServer
        // @Client
        // -------------------------------------------------------------------------------
        public void OnServerMessageResponsePlayerSwitchServer(NetworkConnection conn, ServerMessageResponsePlayerSwitchServer msg)
        {
            networkManager.StopClient();

            NetworkClient.Shutdown();
            OpenMMO.Network.NetworkManager.Shutdown();
            OpenMMO.Network.NetworkManager.singleton = networkManager;

            autoPlayerName = msg.playername;

            for (int i = 0; i < subZones.Count; i++)
            {
                if (msg.zonename == subZones[i].name)
                {
                    zoneIndex             = i;
                    networkTransport.port = GetZonePort;
                    autoConnectClient     = true;
                    Invoke(nameof(ReloadScene), 0.25f);

                    debug.LogFormat(this.name, nameof(OnServerMessageResponsePlayerSwitchServer), i.ToString());                     //DEBUG

                    return;
                }
            }

            debug.LogFormat(this.name, nameof(OnServerMessageResponsePlayerSwitchServer), "NOT FOUND");             //DEBUG
        }
Esempio n. 4
0
        // ====================== MESSAGE EVENT HANDLERS =================================

        // -------------------------------------------------------------------------------
        // OnServerMessageResponsePlayerSwitchServer
        // @Client
        // -------------------------------------------------------------------------------
        public void OnServerMessageResponsePlayerSwitchServer(NetworkConnection conn, ServerMessageResponsePlayerSwitchServer msg)
        {
            if (NetworkServer.active)
            {
                return;
            }

            networkManager.StopClient();

            NetworkClient.Shutdown();
            OpenMMO.Network.NetworkManager.Shutdown();
            OpenMMO.Network.NetworkManager.singleton = networkManager;

            autoPlayerName = msg.playername;

            for (int i = 0; i < subZones.Count; i++)
            {
                if (msg.zonename == subZones[i].name)
                {
                    zoneIndex             = i;
                    networkTransport.port = GetZonePort;
                    autoConnectClient     = true;
                    Invoke(nameof(ReloadScene), 0.25f);
                    return;
                }
            }
        }