Пример #1
0
 public abstract object Execute(DeveloperConsole parent);
Пример #2
0
 public override object Execute(DeveloperConsole parent)
 {
     ConsoleVariable cvarCallOn = parent.ItemManager.FindCVar(CallOn);
     return parent.ItemManager.GetPropertyValue(cvarCallOn.Value, Property);
 }
Пример #3
0
            public override object Execute(DeveloperConsole parent)
            {
                ConsoleVariable cvarCallOn = parent.ItemManager.FindCVar(CallOn);
                parent.ItemManager.SetPropertyValue(cvarCallOn.Value, Property, Children[0].Execute(parent));

                return null;
            }
Пример #4
0
            public override object Execute(DeveloperConsole parent)
            {
                object endVal = null;
                switch (Type)
                {
                    case TokenType.Assign:
                        {
                            // Evaluate RHS children, assign to identifier
                            Identifier lhs = (Identifier)Children[0];
                            object rhsValue = Children[1].Execute(parent);
                            // Try to do a PropertySet if current scope is not null.
                            if (parent.CurrentScope != null)
                            {
                                parent.ItemManager.SetPropertyValue(parent.CurrentScope, lhs.Id, rhsValue);
                            }
                            else
                            {
                                ConsoleVariable var = parent.ItemManager.GetCVar(lhs.Id);
                                var.Value = rhsValue;
                            }
                            endVal = rhsValue;
                        }
                        break;
                    case TokenType.Add:
                        {
                            float lhsValue = Convert.ToSingle(Children[0].Execute(parent));
                            float rhsValue = Convert.ToSingle(Children[1].Execute(parent));
                            float value = lhsValue + rhsValue;
                            endVal = value;
                        }
                        break;
                    case TokenType.Subtract:
                        {
                            float lhsValue = Convert.ToSingle(Children[0].Execute(parent));
                            float rhsValue = Convert.ToSingle(Children[1].Execute(parent));
                            float value = lhsValue - rhsValue;
                            endVal = value;
                        }
                        break;
                    case TokenType.Multiply:
                        {
                            float lhsValue = Convert.ToSingle(Children[0].Execute(parent));
                            float rhsValue = Convert.ToSingle(Children[1].Execute(parent));
                            float value = lhsValue * rhsValue;
                            endVal = value;
                        }
                        break;
                    case TokenType.Divide:
                        {
                            float lhsValue = Convert.ToSingle(Children[0].Execute(parent));
                            float rhsValue = Convert.ToSingle(Children[1].Execute(parent));
                            float value = lhsValue / rhsValue;
                            endVal = value;
                        }
                        break;
                    case TokenType.BeginParen:
                        endVal = Children[0].Execute(parent);
                        break;
                }

                return endVal;
            }
Пример #5
0
 public override object Execute(DeveloperConsole parent)
 {
     return Value;
 }
Пример #6
0
 public override object Execute(DeveloperConsole parent)
 {
     ConsoleVariable var = parent.ItemManager.FindCVar(Id);
     if (var == null)
         throw new Exception("Unknown identifier " + Id);
     return var.Value;
 }
Пример #7
0
            public override object Execute(DeveloperConsole parent)
            {
                List<object> parameters = new List<object>();
                for (int i = 0; i < Children.Count; ++i)
                {
                    parameters.Add(Children[i].Execute(parent));
                }

                object[] paramArray = parameters.ToArray();

                object currentThis = null;
                ConsoleCommand cvarCommand;

                if (CallOn != null)
                {
                    ConsoleVariable cvarCallOn = parent.ItemManager.FindCVar(CallOn);

                    if (cvarCallOn != null)
                    {
                        currentThis = cvarCallOn.Value;
                        cvarCommand = parent.ItemManager.FindCommand(cvarCallOn.Value, Function, false);
                    }
                    else
                        cvarCommand = parent.ItemManager.FindCommand(CallOn, Function, false);
                }
                else
                {
                    currentThis = parent.CurrentScope;
                    cvarCommand = parent.ItemManager.FindCommand(currentThis, Function, true);
                }

                return cvarCommand.Execute(currentThis, paramArray);
            }
Пример #8
0
 public ConsoleParser(DeveloperConsole aParent)
 {
     _parent = aParent;
 }