コード例 #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;
 }