Ejemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // RequestPlayerSwitchServer
        // @Client
        // -------------------------------------------------------------------------------
        protected override bool RequestPlayerSwitchServer(NetworkConnection conn, string playerName, string anchorName, string zoneName)
        {
            if (!base.RequestPlayerSwitchServer(conn, playerName, anchorName, zoneName))
            {
                return(false);
            }

            ClientMessageRequestPlayerSwitchServer message = new ClientMessageRequestPlayerSwitchServer
            {
                playername = playerName,
                zonename   = zoneName
            };

            conn.Send(message);

            return(true);
        }
Ejemplo 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.playername))
            {
                message.text = systemText.playerSwitchServerSuccess;
            }
            else
            {
                message.text    = systemText.playerSwitchServerFailure;
                message.success = false;
            }

            conn.Send(message);
        }