Exemplo n.º 1
0
        protected override ScriptBase CloneScript()
        {
            SwitchScript clone = new SwitchScript(m_scriptContext, m_expr.Clone(), (IScript)m_default.Clone());

            clone.m_cases = m_cases.Clone(clone);
            return(clone);
        }
Exemplo n.º 2
0
 private SwitchCases(SwitchScript parent)
 {
     m_parent = parent;
     if (parent.m_worldModel.EditMode)
     {
         m_cases.UndoLog = parent.m_worldModel.UndoLogger;
     }
 }
Exemplo n.º 3
0
            internal SwitchCases Clone(SwitchScript newParent)
            {
                SwitchCases clone = new SwitchCases(newParent);

                clone.m_cases = (QuestDictionary <IScript>)m_cases.Clone();
                clone.m_compiledExpressions = new Dictionary <string, IFunctionGeneric>();
                foreach (var compiledExpression in m_compiledExpressions)
                {
                    clone.m_compiledExpressions.Add(compiledExpression.Key, compiledExpression.Value);
                }
                return(clone);
            }
Exemplo n.º 4
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);
                }
            }
Exemplo n.º 5
0
 public SwitchCases(SwitchScript parent, List <Tuple <List <IFunction>, IScript> > cases)
 {
     m_cases = cases;
 }
Exemplo n.º 6
0
 public SwitchCases(SwitchScript parent, List<Tuple<List<IFunction>, IScript>> cases)
 {
     m_cases = cases;
 }
Exemplo n.º 7
0
 internal SwitchCases Clone(SwitchScript newParent)
 {
     SwitchCases clone = new SwitchCases(newParent);
     clone.m_cases = (QuestDictionary<IScript>)m_cases.Clone();
     clone.m_compiledExpressions = new Dictionary<string, IFunctionGeneric>();
     foreach (var compiledExpression in m_compiledExpressions)
     {
         clone.m_compiledExpressions.Add(compiledExpression.Key, compiledExpression.Value);
     }
     return clone;
 }
Exemplo n.º 8
0
 private SwitchCases(SwitchScript parent)
 {
     m_parent = parent;
     if (parent.m_worldModel.EditMode)
     {
         m_cases.UndoLog = parent.m_worldModel.UndoLogger;
     }
 }
Exemplo n.º 9
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);
                }
            }
Exemplo n.º 10
0
 protected override ScriptBase CloneScript()
 {
     SwitchScript clone = new SwitchScript(m_scriptContext, m_expr.Clone(), (IScript)m_default.Clone());
     clone.m_cases = m_cases.Clone(clone);
     return clone;
 }