/// <summary> /// Adds a Command to this behavior that will be executed on the client and on the server /// </summary> /// <param name="clientExecution">The delegate to the code that will be executed by the client</param> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> protected void AddLocalAndServerCommand(Command.ClientCommand clientExecution, Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions) { AddCommand(Command.CreateLocalAndServerCommand(clientExecution, serverExecution, applyServerResult, dataType, dataTransferOptions)); }
/// <summary> /// Adds a Command to this behavior that will be executed on the client and on the server /// </summary> /// <param name="condition"></param> /// <param name="clientExecution">The delegate to the code that will be executed by the client</param> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> /// <param name="frequency"></param> protected void AddLocalAndServerCommand(Condition condition, Command.ClientCommand clientExecution, Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { AddCommand(Command.CreateLocalAndServerCommand(condition, clientExecution, serverExecution, applyServerResult, dataType, dataTransferOptions, frequency)); }
/// <summary> /// Creates a new Command instance /// </summary> /// <param name="condition"></param> /// <param name="clientExecution">The method that will be executed</param> /// <param name="serverExecution"></param> /// <param name="applyServerResult"></param> /// <param name="comandType">The CommandType of this Command</param> /// <param name="networkValueType">The type of the value that is returned by the Execution delegate, if the command doesn't returns a value, you can set this to null to limit network data transfer</param> /// <param name="dataTransferOptions">Defines options for network packet transmission</param> /// <param name="frequency">Defines the frequency at which the current command will be processed</param> public Command(Condition condition, ClientCommand clientExecution, ServerCommand serverExecution, ApplyServerCommand applyServerResult, CommandType comandType, Type networkValueType, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { if (networkValueType != null && !networkValueType.IsValueType && networkValueType != typeof(string) && networkValueType != typeof(byte[])) throw new CoreException("DataType must be a ValueType."); LocalId = _count++; Condition = condition; ClientExecution = clientExecution; ServerExecution = serverExecution; ApplyServerResult = applyServerResult; Type = comandType; NetworkValueType = networkValueType; TransferOptions = dataTransferOptions; Frequency = frequency; }
/// <summary> /// Creates a new Command instance /// </summary> /// <param name="condition"></param> /// <param name="clientExecution">The method that will be executed</param> /// <param name="serverExecution"></param> /// <param name="applyServerResult"></param> /// <param name="comandType">The CommandType of this Command</param> /// <param name="networkValueType">The type of the value that is returned by the Execution delegate, if the command doesn't returns a value, you can set this to null to limit network data transfer</param> /// <param name="dataTransferOptions">Defines options for network packet transmission</param> /// <param name="frequency">Defines the frequency at which the current command will be processed</param> public Command(Condition condition, ClientCommand clientExecution, ServerCommand serverExecution, ApplyServerCommand applyServerResult, CommandType comandType, Type networkValueType, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { if (networkValueType != null && !networkValueType.IsValueType && networkValueType != typeof(string) && networkValueType != typeof(byte[])) { throw new CoreException("DataType must be a ValueType."); } LocalId = _count++; Condition = condition; ClientExecution = clientExecution; ServerExecution = serverExecution; ApplyServerResult = applyServerResult; Type = comandType; NetworkValueType = networkValueType; TransferOptions = dataTransferOptions; Frequency = frequency; }
/// <summary> /// Converts DataTransferOptions to Xbox Live SendDataOptions /// </summary> /// <param name="dataTransferOptions"></param> /// <returns></returns> private static SendDataOptions ConvertToSendDataOptions(DataTransferOptions dataTransferOptions) { switch (dataTransferOptions) { case DataTransferOptions.None: return(SendDataOptions.None); case DataTransferOptions.Reliable: return(SendDataOptions.Reliable); case DataTransferOptions.InOrder: return(SendDataOptions.InOrder); case DataTransferOptions.Chat: return(SendDataOptions.Chat); default: case DataTransferOptions.ReliableInOrder: return(SendDataOptions.ReliableInOrder); } }
/// <summary> /// Converts DataTransferOptions to NetDeliveryOptions /// </summary> /// <param name="dataTransferOptions"></param> /// <returns></returns> private static NetDeliveryMethod ConvertToNetDeliveryMethod(DataTransferOptions dataTransferOptions) { switch (dataTransferOptions) { case DataTransferOptions.None: return(NetDeliveryMethod.Unknown); case DataTransferOptions.Reliable: return(NetDeliveryMethod.ReliableUnordered); case DataTransferOptions.InOrder: return(NetDeliveryMethod.ReliableSequenced); case DataTransferOptions.Chat: return(NetDeliveryMethod.Unreliable); default: case DataTransferOptions.ReliableInOrder: return(NetDeliveryMethod.ReliableOrdered); } }
public static Command CreateServerCommand(Condition condition, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return(new Command(condition, null, serverCommand, applyServerResult, CommandType.Server, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz)); }
/// <summary> /// Converts DataTransferOptions to Xbox Live SendDataOptions /// </summary> /// <param name="dataTransferOptions"></param> /// <returns></returns> private static SendDataOptions ConvertToSendDataOptions(DataTransferOptions dataTransferOptions) { switch (dataTransferOptions) { case DataTransferOptions.None: return SendDataOptions.None; case DataTransferOptions.Reliable: return SendDataOptions.Reliable; case DataTransferOptions.InOrder: return SendDataOptions.InOrder; case DataTransferOptions.Chat: return SendDataOptions.Chat; default: case DataTransferOptions.ReliableInOrder: return SendDataOptions.ReliableInOrder; } }
/// <summary> /// Adds a Command to this behavior that will be executed solely on the server and returned to all clients in the session /// </summary> /// <param name="condition"></param> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> /// <param name="frequency"></param> protected void AddServerCommand(Condition condition, Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { AddCommand(Command.CreateServerCommand(condition, serverExecution, applyServerResult, dataType, dataTransferOptions, frequency)); }
/// <summary> /// Adds a Command to this behavior that will be executed solely on the server and returned to all clients in the session /// </summary> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> protected void AddServerCommand(Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions) { AddCommand(Command.CreateServerCommand(serverExecution, applyServerResult, dataType, dataTransferOptions)); }
/// <summary> /// Adds a Command to this behavior that will be executed on the client and on the server /// </summary> /// <param name="condition"></param> /// <param name="clientExecution">The delegate to the code that will be executed by the client</param> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> protected void AddLocalAndServerCommand(Condition condition, Command.ClientCommand clientExecution, Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions) { AddCommand(Command.CreateLocalAndServerCommand(condition, clientExecution, serverExecution, applyServerResult, dataType, dataTransferOptions)); }
public static Command CreateServerCommand(ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { return CreateServerCommand(null, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, frequency); }
public static Command CreateLocalAndServerCommand(ClientCommand clientCommand, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return(CreateLocalAndServerCommand(null, clientCommand, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz)); }
public static Command CreateLocalAndServerCommand(ClientCommand clientCommand, ServerCommand serverCommand, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return(CreateLocalAndServerCommand(clientCommand, serverCommand, typeOfDataExchanged, dataTransferOptions)); }
public static Command CreateServerCommand(ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { return(CreateServerCommand(null, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, frequency)); }
public static Command CreateLocalAndServerCommand(Condition condition, ClientCommand clientCommand, ServerCommand serverCommand, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return new Command(condition, clientCommand, serverCommand, null, CommandType.LocalAndServer, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz); }
public static Command CreateLocalAndServerCommand(ClientCommand clientCommand, ServerCommand serverCommand, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return CreateLocalAndServerCommand(clientCommand, serverCommand, typeOfDataExchanged, dataTransferOptions); }
public static Command CreateLocalAndServerCommand(ClientCommand clientCommand, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return CreateLocalAndServerCommand(null, clientCommand, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz); }
public static Command CreateLocalAndServerCommand(Condition condition, ClientCommand clientCommand, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { return new Command(condition, clientCommand, serverCommand, applyServerResult, CommandType.LocalAndServer, typeOfDataExchanged, dataTransferOptions, frequency); }
public static Command CreateLocalAndServerCommand(Condition condition, ClientCommand clientCommand, ServerCommand serverCommand, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return(new Command(condition, clientCommand, serverCommand, null, CommandType.LocalAndServer, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz)); }
/// <summary> /// Adds a Command to this behavior that will be executed solely on the server and returned to all clients in the session /// </summary> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> protected void AddServerCommand(Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { AddCommand(Command.CreateServerCommand(serverExecution, applyServerResult, dataType, dataTransferOptions, frequency)); }
public static Command CreateLocalAndServerCommand(Condition condition, ClientCommand clientCommand, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency) { return(new Command(condition, clientCommand, serverCommand, applyServerResult, CommandType.LocalAndServer, typeOfDataExchanged, dataTransferOptions, frequency)); }
/// <summary> /// Adds a Command to this behavior that will be executed solely on the server and returned to all clients in the session /// </summary> /// <param name="condition"></param> /// <param name="serverExecution">The delegate to the code that will be executed by the server</param> /// <param name="applyServerResult">The delegate to the code that will be executed by all clients in the session when server returns</param> /// <param name="dataType">The Type of the data exchanged between the clients and server</param> /// <param name="dataTransferOptions">Tells how the command orders are transfered throught the network</param> protected void AddServerCommand(Condition condition, Command.ServerCommand serverExecution, Command.ApplyServerCommand applyServerResult, Type dataType, DataTransferOptions dataTransferOptions) { AddCommand(Command.CreateServerCommand(condition, serverExecution, applyServerResult, dataType, dataTransferOptions)); }
/// <summary> /// Converts DataTransferOptions to NetDeliveryOptions /// </summary> /// <param name="dataTransferOptions"></param> /// <returns></returns> private static NetDeliveryMethod ConvertToNetDeliveryMethod(DataTransferOptions dataTransferOptions) { switch (dataTransferOptions) { case DataTransferOptions.None: return NetDeliveryMethod.Unknown; case DataTransferOptions.Reliable: return NetDeliveryMethod.ReliableUnordered; case DataTransferOptions.InOrder: return NetDeliveryMethod.ReliableSequenced; case DataTransferOptions.Chat: return NetDeliveryMethod.Unreliable; default: case DataTransferOptions.ReliableInOrder: return NetDeliveryMethod.ReliableOrdered; } }
public static Command CreateServerCommand(Condition condition, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions) { return new Command(condition, null, serverCommand, applyServerResult, CommandType.Server, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz); }