Indiefreaks.Xna.Sessions.Lidgren.LidgrenSession.ExecuteServerCommandOnClients C# (CSharp) 메소드

ExecuteServerCommandOnClients() 공개 메소드

Asks the Session to send a remote command call on all session clients
public ExecuteServerCommandOnClients ( Command command ) : void
command Indiefreaks.Xna.Logic.Command The command that should be executed
리턴 void
        public override void ExecuteServerCommandOnClients(Command command)
        {
            if (!IsHost)
                throw new CoreException("Only the host can execute server commands on clients");

            _outgoingMessage = LidgrenSessionManager.Server.CreateMessage();

            if (command.NetworkValue != null)
            {
                _outgoingMessage.Write((byte)LidgrenMessages.ExecuteServerCommandOnClientsDataExchanged);
            }
            else
            {
                _outgoingMessage.Write((byte)LidgrenMessages.ExecuteServerCommandOnClientsNoDataExchanged);
            }

            _outgoingMessage.Write(command.Id);

            if (command.NetworkValue != null)
            {
                WriteNetworkValue(ref _outgoingMessage, command.NetworkValue);
            }

            LidgrenSessionManager.Server.SendToAll(_outgoingMessage, ConvertToNetDeliveryMethod(command.TransferOptions));
        }