Beispiel #1
0
 public ForEachScript(WorldModel worldModel, string variable, IFunctionGeneric list, IScript loopScript)
 {
     m_worldModel = worldModel;
     m_variable = variable;
     m_list = list;
     m_loopScript = loopScript;
 }
Beispiel #2
0
 public ForEachScript(ScriptContext scriptContext, string variable, IFunctionGeneric list, IScript loopScript)
 {
     m_scriptContext = scriptContext;
     m_variable      = variable;
     m_list          = list;
     m_loopScript    = loopScript;
 }
 public DictionaryRemoveScript(ScriptContext scriptContext, IFunctionGeneric dictionary, IFunction <string> key)
 {
     m_scriptContext = scriptContext;
     m_dictionary    = dictionary;
     m_key           = key;
     m_worldModel    = scriptContext.WorldModel;
 }
Beispiel #4
0
 public ListAddScript(ScriptContext scriptContext, IFunctionGeneric list, IFunction<object> value)
 {
     m_scriptContext = scriptContext;
     m_list = list;
     m_value = value;
     m_worldModel = scriptContext.WorldModel;
 }
Beispiel #5
0
 public ForEachScript(ScriptContext scriptContext, string variable, IFunctionGeneric list, IScript loopScript)
 {
     m_scriptContext = scriptContext;
     m_variable = variable;
     m_list = list;
     m_loopScript = loopScript;
 }
Beispiel #6
0
 public DictionaryAddScript(WorldModel worldModel, IFunctionGeneric dictionary, IFunction<string> key, IFunction<object> value)
 {
     m_dictionary = dictionary;
     m_key = key;
     m_value = value;
     m_worldModel = worldModel;
 }
Beispiel #7
0
 public ListAddScript(ScriptContext scriptContext, IFunctionGeneric list, IFunction <object> value)
 {
     m_scriptContext = scriptContext;
     m_list          = list;
     m_value         = value;
     m_worldModel    = scriptContext.WorldModel;
 }
Beispiel #8
0
 private SwitchScript(ScriptContext scriptContext, IFunctionGeneric expression, IScript defaultScript)
 {
     m_scriptContext = scriptContext;
     m_worldModel    = scriptContext.WorldModel;
     m_expr          = expression;
     m_default       = defaultScript ?? new MultiScript(m_worldModel);
 }
Beispiel #9
0
 public DictionaryAddScript(ScriptContext scriptContext, IFunctionGeneric dictionary, IFunction<string> key, IFunction<object> value)
 {
     m_scriptContext = scriptContext;
     m_dictionary = dictionary;
     m_key = key;
     m_value = value;
     m_worldModel = scriptContext.WorldModel;
 }
 public DictionaryAddScript(ScriptContext scriptContext, IFunctionGeneric dictionary, IFunction <string> key, IFunction <object> value)
 {
     m_scriptContext = scriptContext;
     m_dictionary    = dictionary;
     m_key           = key;
     m_value         = value;
     m_worldModel    = scriptContext.WorldModel;
 }
Beispiel #11
0
 public ShowMenuScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction <string> caption, IFunctionGeneric options, IFunction <bool> allowCancel, IScript callbackScript)
 {
     m_scriptContext  = scriptContext;
     m_worldModel     = scriptContext.WorldModel;
     m_scriptFactory  = scriptFactory;
     m_caption        = caption;
     m_options        = options;
     m_allowCancel    = allowCancel;
     m_callbackScript = callbackScript;
 }
Beispiel #12
0
 public ShowMenuScript(ScriptContext scriptContext, IScriptFactory scriptFactory, IFunction<string> caption, IFunctionGeneric options, IFunction<bool> allowCancel, IScript callbackScript)
 {
     m_scriptContext = scriptContext;
     m_worldModel = scriptContext.WorldModel;
     m_scriptFactory = scriptFactory;
     m_caption = caption;
     m_options = options;
     m_allowCancel = allowCancel;
     m_callbackScript = callbackScript;
 }
Beispiel #13
0
 public override void SetParameterInternal(int index, object value)
 {
     switch (index)
     {
         case 0:
             m_list = new ExpressionGeneric((string)value, m_worldModel);
             break;
         case 1:
             m_value = new Expression<object>((string)value, m_worldModel);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Beispiel #14
0
            public bool Execute(Context c, string result)
            {
                foreach (var switchCase in m_cases)
                {
                    IFunctionGeneric expr = m_compiledExpressions[switchCase.Key];

                    if (result == expr.Execute(c).ToString())
                    {
                        switchCase.Value.Execute(c);
                        return(true);
                    }
                }
                return(false);
            }
Beispiel #15
0
        public override void SetParameterInternal(int index, object value)
        {
            switch (index)
            {
            case 0:
                m_list = new ExpressionGeneric((string)value, m_scriptContext);
                break;

            case 1:
                m_value = new Expression <object>((string)value, m_scriptContext);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #16
0
            public SwitchCases(SwitchScript parent, Dictionary <IFunctionGeneric, IScript> cases)
                : this(parent)
            {
                foreach (var switchCase in cases)
                {
                    IFunctionGeneric compiledExpression = switchCase.Key;
                    string           caseString         = compiledExpression.Save();
                    IScript          script             = switchCase.Value;

                    if (m_cases.ContainsKey(caseString))
                    {
                        throw new Exception(string.Format("'switch' block contains duplicate case '{0}'", caseString));
                    }
                    m_cases.Add(caseString, script);
                    m_compiledExpressions.Add(caseString, compiledExpression);
                }
            }
Beispiel #17
0
        public override void SetParameterInternal(int index, object value)
        {
            switch (index)
            {
            case 0:
                m_variable = (string)value;
                break;

            case 1:
                m_list = new ExpressionGeneric((string)value, m_scriptContext);
                break;

            case 2:
                throw new InvalidOperationException("Attempt to use SetParameter to change the script of a 'foreach' loop");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #18
0
        public override void SetParameterInternal(int index, object value)
        {
            switch (index)
            {
            case 0:
                m_expr = new ExpressionGeneric((string)value, m_scriptContext);
                break;

            case 1:
                // any updates to the cases should change the scriptdictionary itself - nothing should cause SetParameter to be triggered.
                throw new InvalidOperationException("Attempt to use SetParameter to change the cases of a 'switch'");

            case 2:
                // any updates to the script should change the script itself - nothing should cause SetParameter to be triggered.
                throw new InvalidOperationException("Attempt to use SetParameter to change the script of a 'switch'");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #19
0
        public override void SetParameterInternal(int index, object value)
        {
            switch (index)
            {
            case 0:
                m_caption = new Expression <string>((string)value, m_scriptContext);
                break;

            case 1:
                m_options = new ExpressionGeneric((string)value, m_scriptContext);
                break;

            case 2:
                m_allowCancel = new Expression <bool>((string)value, m_scriptContext);
                break;

            case 3:
                // any updates to the script should change the script itself - nothing should cause SetParameter to be triggered.
                throw new InvalidOperationException("Attempt to use SetParameter to change the script of a 'show menu' command");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #20
0
 public SwitchScript(ScriptContext scriptContext, IFunctionGeneric expression, Dictionary<IFunctionGeneric, IScript> cases, IScript defaultScript)
     : this(scriptContext, expression, defaultScript)
 {
     m_cases = new SwitchCases(this, cases);
 }
Beispiel #21
0
 public override void SetParameterInternal(int index, object value)
 {
     switch (index)
     {
         case 0:
             m_expr = new ExpressionGeneric((string)value, m_scriptContext);
             break;
         case 1:
             // any updates to the cases should change the scriptdictionary itself - nothing should cause SetParameter to be triggered.
             throw new InvalidOperationException("Attempt to use SetParameter to change the cases of a 'switch'");
         case 2:
             // any updates to the script should change the script itself - nothing should cause SetParameter to be triggered.
             throw new InvalidOperationException("Attempt to use SetParameter to change the script of a 'switch'");
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Beispiel #22
0
 public SwitchScript(ScriptContext scriptContext, IFunctionGeneric expression, Dictionary <IFunctionGeneric, IScript> cases, IScript defaultScript)
     : this(scriptContext, expression, defaultScript)
 {
     m_cases = new SwitchCases(this, cases);
 }
Beispiel #23
0
 public override void SetParameterInternal(int index, object value)
 {
     switch (index)
     {
         case 0:
             m_dictionary = new ExpressionGeneric((string)value, m_scriptContext);
             break;
         case 1:
             m_key = new Expression<string>((string)value, m_scriptContext);
             break;
         case 2:
             m_value = new Expression<object>((string)value, m_scriptContext);
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Beispiel #24
0
 public MsgScript(WorldModel worldModel, IFunctionGeneric function)
 {
     m_worldModel = worldModel;
     m_function = function;
 }
Beispiel #25
0
 public ErrorScript(ScriptContext scriptContext, IFunctionGeneric function)
 {
     m_scriptContext = scriptContext;
     m_function      = function;
     m_worldModel    = scriptContext.WorldModel;
 }
Beispiel #26
0
 public ReturnScript(WorldModel worldModel, IFunctionGeneric returnValue)
 {
     m_worldModel = worldModel;
     m_returnValue = returnValue;
 }
Beispiel #27
0
 public ListAddScript(WorldModel worldModel, IFunctionGeneric list, IFunction<object> value)
 {
     m_list = list;
     m_value = value;
     m_worldModel = worldModel;
 }
Beispiel #28
0
 public ReturnScript(ScriptContext scriptContext, IFunctionGeneric returnValue)
 {
     m_scriptContext = scriptContext;
     m_worldModel    = scriptContext.WorldModel;
     m_returnValue   = returnValue;
 }
Beispiel #29
0
 public SwitchScript(WorldModel worldModel, IFunctionGeneric expression, Dictionary<IFunctionGeneric, IScript> cases, IScript defaultScript)
     : this(worldModel, expression, defaultScript)
 {
     m_cases = new SwitchCases(this, cases);
 }
Beispiel #30
0
 public MsgScript(ScriptContext scriptContext, IFunctionGeneric function)
 {
     m_scriptContext = scriptContext;
     m_worldModel = scriptContext.WorldModel;
     m_function = function;
 }
Beispiel #31
0
 public override void SetParameterInternal(int index, object value)
 {
     switch (index)
     {
         case 0:
             m_variable = (string)value;
             break;
         case 1:
             m_list = new ExpressionGeneric((string)value, m_worldModel);
             break;
         case 2:
             throw new InvalidOperationException("Attempt to use SetParameter to change the script of a 'foreach' loop");
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Beispiel #32
0
 public ReturnScript(ScriptContext scriptContext, IFunctionGeneric returnValue)
 {
     m_scriptContext = scriptContext;
     m_worldModel = scriptContext.WorldModel;
     m_returnValue = returnValue;
 }
Beispiel #33
0
 public override void SetParameterInternal(int index, object value)
 {
     switch (index)
     {
         case 0:
             m_caption = new Expression<string>((string)value, m_scriptContext);
             break;
         case 1:
             m_options = new ExpressionGeneric((string)value, m_scriptContext);
             break;
         case 2:
             m_allowCancel = new Expression<bool>((string)value, m_scriptContext);
             break;
         case 3:
             // any updates to the script should change the script itself - nothing should cause SetParameter to be triggered.
             throw new InvalidOperationException("Attempt to use SetParameter to change the script of a 'show menu' command");
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Beispiel #34
0
 public override void SetParameterInternal(int index, object value)
 {
     m_returnValue = new ExpressionGeneric((string)value, m_scriptContext);
 }
Beispiel #35
0
 public DictionaryRemoveScript(WorldModel worldModel, IFunctionGeneric dictionary, IFunction<string> key)
 {
     m_dictionary = dictionary;
     m_key = key;
     m_worldModel = worldModel;
 }
Beispiel #36
0
 public ErrorScript(WorldModel worldModel, IFunctionGeneric function)
 {
     m_function = function;
     m_worldModel = worldModel;
 }
Beispiel #37
0
 public RequestSpeakScript(ScriptContext scriptContext, IFunctionGeneric function)
 {
     m_scriptContext = scriptContext;
     m_worldModel    = scriptContext.WorldModel;
     m_function      = function;
 }
Beispiel #38
0
 public override void SetParameterInternal(int index, object value)
 {
     m_function = new ExpressionGeneric((string)value, m_worldModel);
 }
Beispiel #39
0
 private SwitchScript(ScriptContext scriptContext, IFunctionGeneric expression, IScript defaultScript)
 {
     m_scriptContext = scriptContext;
     m_worldModel = scriptContext.WorldModel;
     m_expr = expression;
     m_default = defaultScript ?? new MultiScript(m_worldModel);
 }
Beispiel #40
0
 private SwitchScript(WorldModel worldModel, IFunctionGeneric expression, IScript defaultScript)
 {
     m_worldModel = worldModel;
     m_expr = expression;
     m_default = defaultScript ?? new MultiScript();
 }
Beispiel #41
0
 public override void SetParameterInternal(int index, object value)
 {
     m_returnValue = new ExpressionGeneric((string)value, m_scriptContext);
 }
Beispiel #42
0
 public DictionaryRemoveScript(ScriptContext scriptContext, IFunctionGeneric dictionary, IFunction<string> key)
 {
     m_scriptContext = scriptContext;
     m_dictionary = dictionary;
     m_key = key;
     m_worldModel = scriptContext.WorldModel;
 }