Example #1
0
        /// <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;
        }
Example #2
0
        /// <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;
        }
Example #3
0
 public static Command CreateLocalAndServerCommand(ClientCommand clientCommand, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions)
 {
     return(CreateLocalAndServerCommand(null, clientCommand, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz));
 }
Example #4
0
 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));
 }
Example #5
0
 public static Command CreateServerCommand(ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency)
 {
     return(CreateServerCommand(null, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, frequency));
 }
Example #6
0
 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));
 }
Example #7
0
 public static Command CreateLocalAndServerCommand(ClientCommand clientCommand, ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions)
 {
     return CreateLocalAndServerCommand(null, clientCommand, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, ExecutionFrequency.FullUpdate60Hz);
 }
Example #8
0
 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);
 }
Example #9
0
 public static Command CreateServerCommand(ServerCommand serverCommand, ApplyServerCommand applyServerResult, Type typeOfDataExchanged, DataTransferOptions dataTransferOptions, ExecutionFrequency frequency)
 {
     return CreateServerCommand(null, serverCommand, applyServerResult, typeOfDataExchanged, dataTransferOptions, frequency);
 }
Example #10
0
 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);
 }