Beispiel #1
0
 public void SetMouseCommand(CommandListElement element)
 {
     MouseCommand = element;
     element.Next = Head;
     if (Head != null)
     {
         Head.Prev = element;
     }
     Head = element;
 }
Beispiel #2
0
        public void ClearAllCommands()
        {
            if (Head != null)
            {
                CommandListElement headPrevNext = null;

                while (true)
                {
                    var head = Head;
                    headPrevNext = Head.Prev.Next;
                    if (headPrevNext != null)
                    {
                        break;
                    }

                    var headNext     = head.Next;
                    var headNextNull = head.Next == null;
                    Head = head.Next;

                    if (!headNextNull)
                    {
                        headNext.Prev = null;

                        // label_6
                        if (head.Next != null)
                        {
                            head.Next.Prev = head.Prev;
                        }
                    }

                    head.Next = null;
                    head.Prev = null;

                    if (Head == null)
                    {
                        MouseCommand = null;
                        return;
                    }
                }
                headPrevNext = Head.Next;
                // goto label_6
            }
            MouseCommand = null;
        }
Beispiel #3
0
        public void AddCommand(MotionCommand command, float speed, bool mouse, bool holdRun)
        {
            var element = new CommandListElement(command, speed, holdRun);

            CommandListElement mouse_cmd = null;

            if (mouse)
            {
                mouse_cmd = MouseCommand;

                if (mouse_cmd == null)
                {
                    SetMouseCommand(element);
                    return;
                }

                var prevNext = mouse_cmd.Prev.Next;
                if (prevNext != null)
                {
                    prevNext = mouse_cmd.Next;
                }
                else
                {
                    var next     = mouse_cmd.Next;
                    var nextNull = next == null;
                    Head = mouse_cmd.Next;
                    if (nextNull)
                    {
                        // label_12
                        mouse_cmd.Next = null;
                        mouse_cmd.Prev = null;

                        SetMouseCommand(element);
                        return;
                    }
                    next.Prev = null;
                }
                if (mouse_cmd.Next != null)
                {
                    mouse_cmd.Next.Prev = mouse_cmd.Prev;
                }
                // goto label_12
            }
        }