// -------------------------------------------------------------------------------
        // SwitchServerPlayer
        // @Server -> @Client
        // -------------------------------------------------------------------------------
        public void SwitchServerPlayer(NetworkConnection conn, string playername, string anchorName, string zoneName, int _token)
        {
            ServerMessageResponsePlayerSwitchServer message = new ServerMessageResponsePlayerSwitchServer
            {
                playername       = playername,
                anchorname       = anchorName,
                zonename         = zoneName,
                token            = _token,
                success          = true,
                text             = "",
                causesDisconnect = false
            };

            if (DatabaseManager.singleton.TryPlayerSwitchServer(playername, anchorName, zoneName, _token))
            {
                message.text = systemText.playerSwitchServerSuccess;
            }
            else
            {
                message.text    = systemText.playerSwitchServerFailure;
                message.success = false;
            }

            conn.Send(message);

            // -- Required: now log the user/player out server-side
            // -- it is never guaranteed that OnServerDisconnect is called correctly and in-time
            LogoutPlayerAndUser(conn);
        }
示例#2
0
        // -------------------------------------------------------------------------------
        // SwitchServerPlayer
        // @Server -> @Client
        // -------------------------------------------------------------------------------
        public void SwitchServerPlayer(NetworkConnection conn, string playername, string anchorName, string zoneName, int _token)
        {
            ServerMessageResponsePlayerSwitchServer message = new ServerMessageResponsePlayerSwitchServer
            {
                playername       = playername,
                anchorname       = anchorName,
                zonename         = zoneName,
                token            = _token,
                success          = true,
                text             = "",
                causesDisconnect = false
            };

            if (DatabaseManager.singleton.TryPlayerSwitchServer(playername, anchorName, zoneName, _token))
            {
                message.text = systemText.playerSwitchServerSuccess;
            }
            else
            {
                message.text    = systemText.playerSwitchServerFailure;
                message.success = false;
            }

            conn.Send(message);
        }
示例#3
0
        // -------------------------------------------------------------------------------
        // OnClientMessageRequestPlayerSwitchServer
        // @Client -> @Server
        // -------------------------------------------------------------------------------
        void OnClientMessageRequestPlayerSwitchServer(NetworkConnection conn, ClientMessageRequestPlayerSwitchServer msg)
        {
            ServerMessageResponsePlayerSwitchServer message = new ServerMessageResponsePlayerSwitchServer
            {
                success          = true,
                text             = "",
                causesDisconnect = false
            };

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

            conn.Send(message);
        }
示例#4
0
 // -------------------------------------------------------------------------------
 void OnServerMessageResponsePlayerSwitchServer(NetworkConnection conn, ServerMessageResponsePlayerSwitchServer msg)
 {
     //RequestPlayerSwitchServer(conn, userName);
     OnServerMessageResponse(conn, msg);
 }