示例#1
0
 public ForEachScript(WorldModel worldModel, string variable, IFunctionGeneric list, IScript loopScript)
 {
     m_worldModel = worldModel;
     m_variable = variable;
     m_list = list;
     m_loopScript = loopScript;
 }
示例#2
0
 public ForEachScript(ScriptContext scriptContext, string variable, IFunctionGeneric list, IScript loopScript)
 {
     m_scriptContext = scriptContext;
     m_variable      = variable;
     m_list          = list;
     m_loopScript    = loopScript;
 }
示例#3
0
 public DictionaryRemoveScript(ScriptContext scriptContext, IFunctionGeneric dictionary, IFunction <string> key)
 {
     m_scriptContext = scriptContext;
     m_dictionary    = dictionary;
     m_key           = key;
     m_worldModel    = scriptContext.WorldModel;
 }
示例#4
0
 public ListAddScript(ScriptContext scriptContext, IFunctionGeneric list, IFunction<object> value)
 {
     m_scriptContext = scriptContext;
     m_list = list;
     m_value = value;
     m_worldModel = scriptContext.WorldModel;
 }
示例#5
0
 public ForEachScript(ScriptContext scriptContext, string variable, IFunctionGeneric list, IScript loopScript)
 {
     m_scriptContext = scriptContext;
     m_variable = variable;
     m_list = list;
     m_loopScript = loopScript;
 }
示例#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;
 }
示例#7
0
 public ListAddScript(ScriptContext scriptContext, IFunctionGeneric list, IFunction <object> value)
 {
     m_scriptContext = scriptContext;
     m_list          = list;
     m_value         = value;
     m_worldModel    = scriptContext.WorldModel;
 }
示例#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);
 }
示例#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;
 }
示例#10
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;
 }
示例#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;
 }
示例#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;
 }
示例#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();
     }
 }
示例#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);
            }
示例#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();
            }
        }
示例#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);
                }
            }
示例#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();
            }
        }
示例#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();
            }
        }
示例#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();
            }
        }
示例#20
0
 public SwitchScript(ScriptContext scriptContext, IFunctionGeneric expression, Dictionary<IFunctionGeneric, IScript> cases, IScript defaultScript)
     : this(scriptContext, expression, defaultScript)
 {
     m_cases = new SwitchCases(this, cases);
 }
示例#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();
     }
 }
示例#22
0
 public SwitchScript(ScriptContext scriptContext, IFunctionGeneric expression, Dictionary <IFunctionGeneric, IScript> cases, IScript defaultScript)
     : this(scriptContext, expression, defaultScript)
 {
     m_cases = new SwitchCases(this, cases);
 }
示例#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();
     }
 }
示例#24
0
文件: MsgScript.cs 项目: Pertex/Quest
 public MsgScript(WorldModel worldModel, IFunctionGeneric function)
 {
     m_worldModel = worldModel;
     m_function = function;
 }
示例#25
0
 public ErrorScript(ScriptContext scriptContext, IFunctionGeneric function)
 {
     m_scriptContext = scriptContext;
     m_function      = function;
     m_worldModel    = scriptContext.WorldModel;
 }
示例#26
0
 public ReturnScript(WorldModel worldModel, IFunctionGeneric returnValue)
 {
     m_worldModel = worldModel;
     m_returnValue = returnValue;
 }
示例#27
0
 public ListAddScript(WorldModel worldModel, IFunctionGeneric list, IFunction<object> value)
 {
     m_list = list;
     m_value = value;
     m_worldModel = worldModel;
 }
示例#28
0
 public ReturnScript(ScriptContext scriptContext, IFunctionGeneric returnValue)
 {
     m_scriptContext = scriptContext;
     m_worldModel    = scriptContext.WorldModel;
     m_returnValue   = returnValue;
 }
示例#29
0
 public SwitchScript(WorldModel worldModel, IFunctionGeneric expression, Dictionary<IFunctionGeneric, IScript> cases, IScript defaultScript)
     : this(worldModel, expression, defaultScript)
 {
     m_cases = new SwitchCases(this, cases);
 }
示例#30
0
文件: MsgScript.cs 项目: JatinR/quest
 public MsgScript(ScriptContext scriptContext, IFunctionGeneric function)
 {
     m_scriptContext = scriptContext;
     m_worldModel = scriptContext.WorldModel;
     m_function = function;
 }
示例#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();
     }
 }
示例#32
0
 public ReturnScript(ScriptContext scriptContext, IFunctionGeneric returnValue)
 {
     m_scriptContext = scriptContext;
     m_worldModel = scriptContext.WorldModel;
     m_returnValue = returnValue;
 }
示例#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();
     }
 }
示例#34
0
 public override void SetParameterInternal(int index, object value)
 {
     m_returnValue = new ExpressionGeneric((string)value, m_scriptContext);
 }
示例#35
0
 public DictionaryRemoveScript(WorldModel worldModel, IFunctionGeneric dictionary, IFunction<string> key)
 {
     m_dictionary = dictionary;
     m_key = key;
     m_worldModel = worldModel;
 }
示例#36
0
 public ErrorScript(WorldModel worldModel, IFunctionGeneric function)
 {
     m_function = function;
     m_worldModel = worldModel;
 }
示例#37
0
 public RequestSpeakScript(ScriptContext scriptContext, IFunctionGeneric function)
 {
     m_scriptContext = scriptContext;
     m_worldModel    = scriptContext.WorldModel;
     m_function      = function;
 }
示例#38
0
 public override void SetParameterInternal(int index, object value)
 {
     m_function = new ExpressionGeneric((string)value, m_worldModel);
 }
示例#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);
 }
示例#40
0
 private SwitchScript(WorldModel worldModel, IFunctionGeneric expression, IScript defaultScript)
 {
     m_worldModel = worldModel;
     m_expr = expression;
     m_default = defaultScript ?? new MultiScript();
 }
示例#41
0
 public override void SetParameterInternal(int index, object value)
 {
     m_returnValue = new ExpressionGeneric((string)value, m_scriptContext);
 }
示例#42
0
 public DictionaryRemoveScript(ScriptContext scriptContext, IFunctionGeneric dictionary, IFunction<string> key)
 {
     m_scriptContext = scriptContext;
     m_dictionary = dictionary;
     m_key = key;
     m_worldModel = scriptContext.WorldModel;
 }