示例#1
0
        private static void ProcessTokens(int lineNumber)
        {
            try
            {
                Debug.Assert(_tokens.Count > 0);

                string actionType = GetActionType();

                switch (actionType)
                {
                case "#import":
                    LoadImportScript(_tokens[1]);
                    return;

                case "const":
                case "var":
                    VariableParser.Parse(lineNumber, _LoadedFiles.Peek(), _script, _tokens);
                    return;
                }

                ActionBase act = CreateActionObject(actionType);

                switch (actionType)
                {
                case "function":
                {
                    string name = FunctionParser.Parse((Actionfunction)act, _tokens);

                    if (!_script.AddFunction(name))
                    {
                        string msg = "Function [" + name + "] already exists." + Environment.NewLine + "Unable to load script.";
                        throw new Exception(msg);
                    }
                }
                break;

                case "call":
                    CallParser.Parse((Actioncall)act, _tokens);
                    break;

                case "for":
                    ParseForLoop((Actionfor)act, _tokens);
                    break;

                default:
                    act.AddParams(_tokens);
                    break;
                }
                act.LineNumber  = lineNumber;
                act.Path2Script = _LoadedFiles.Peek();
                _script.AddAction(act);
            }
            catch
            {
                _vm.ParseError(_LoadedFiles.Pop(), lineNumber);
                throw;
            }
        }
示例#2
0
        public override void Start()
        {
            //Directly using EventKey so you don't have to declare EventReciever:
            Script.AddOnEventAction(SenderScript.EventOne, (Action <Vector2>) this.HandleOne);
            //Using an EventReciever:
            Script.AddOnEventAction(EventTwoReciever, (Action <Vector2>) this.HandleTwo);

            Script.AddAction(DelayedAction, TimeSpan.FromSeconds(2));

            Script.AddAction(DelayRepeatAction, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2));
        }
示例#3
0
 private static void BlankAction()
 {
     ScriptedActions.Action newAction = new ScriptedActions.Action
     {
         Delay      = 10000,
         PlaceValue = (uint)(Script.GetAllActions().Count + 1),
         Event      = null,
         Mods       = null,
         Repeat     = 3,
         type       = Script.ActionType.WAIT
     };
     Script.AddAction(newAction);
 }
        public override void Start()
        {
            //Keep a list of tasks to stop on cancel
            _tasks = new List <MicroThread>
            {
                //Directly using EventKey so you don't have to declare EventReciever:
                Script.AddOnEventAction(SenderScript.EventOne, HandleOne),
                //Using an EventReciever:
                Script.AddOnEventAction(_eventTwoReciever, HandleTwo),

                Script.AddAction(DelayedAction, TimeSpan.FromSeconds(2)),

                Script.AddAction(DelayRepeatAction, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2))
            };
        }
示例#5
0
        private void AddBTN_Click(object sender, EventArgs e)
        {
            object Event = null;

            object[]          Mods   = new object[] { };
            Script.ActionType action = new Script.ActionType();
            if (WaitBTN.Checked)
            {
                action = Script.ActionType.WAIT;
            }
            else if (MouseBTN.Checked)
            {
                action = Script.ActionType.MOUSE;
            }
            else if (KeyboardBTN.Checked)
            {
                action = Script.ActionType.KEYBOARD;
            }
            Script.AddAction(Event, Mods, 1, 1, action);
        }