Exemplo n.º 1
0
 public static string GetName(NintendoSwitch.Key key)
 {
     if (_keyName.ContainsKey(key))
     {
         return(_keyName[key]);
     }
     return(string.Empty);
 }
Exemplo n.º 2
0
 public void Run(NintendoSwitch.Key key, int duration, int interval)
 {
     Msg(Colors.Highlight, "连发:" + key.Name);
     Light(Color.LightYellow);
     Light(Taskbar.Highlight);
     while (true)
     {
         Press(key, duration);
         Wait(interval);
     }
 }
Exemplo n.º 3
0
        public static int GetDirectionIndex(NintendoSwitch.Key key)
        {
            int x = key.StickX;
            int y = key.StickY;

            if (x == NintendoSwitch.STICK_CENTER && y == NintendoSwitch.STICK_CENTER)
            {
                return(-1);
            }
            x = (int)Math.Round(x / 32d);
            y = (int)Math.Round(y / 32d);
            return(x >= y ? x + y : 32 - x - y);
        }
Exemplo n.º 4
0
        public void OpenEntry(Entry entry)
        {
            Log($"Menu.OpenEntry({entry.GetName()})");
            var t0 = GetCursorPos();
            var t1 = LocateEntry(entry);
            int x0 = t0.Item1, y0 = t0.Item2;
            int x1 = t1.Item1, y1 = t1.Item2;

            while (x1 >= 0)
            {
                NintendoSwitch.Key key = null;
                if (x0 < x1)
                {
                    key = Keys.HAT.Right;
                    x0++;
                }
                else if (x0 > x1)
                {
                    key = Keys.HAT.Left;
                    x0--;
                }
                else if (y0 < y1)
                {
                    key = Keys.HAT.Down;
                    y0++;
                }
                else if (y0 > y1)
                {
                    key = Keys.HAT.Up;
                    y0--;
                }
                if (key == null)
                {
                    break;
                }
                Press(key);
                Wait(300);
            }
            Press(Keys.A);
        }
Exemplo n.º 5
0
 public StickUp(NintendoSwitch.Key key, string keyname)
     : base(key, keyname, null)
 {
 }
Exemplo n.º 6
0
 public StickAction(NintendoSwitch.Key key, string keyname, string direcion)
 {
     Key       = key;
     KeyName   = keyname?.ToUpper();
     Direction = direcion?.ToUpper();
 }
Exemplo n.º 7
0
 public StickDown(NintendoSwitch.Key key, string keyname, string direction)
     : base(key, keyname, direction)
 {
 }
Exemplo n.º 8
0
 public StickPress(NintendoSwitch.Key key, string keyname, string direction, ValBase duration)
     : base(key, keyname, direction)
 {
     Duration = duration;
 }
Exemplo n.º 9
0
 public KeyPress(NintendoSwitch.Key key, ValBase duration)
     : base(key)
 {
     Duration = duration;
 }
Exemplo n.º 10
0
 public KeyPress(NintendoSwitch.Key key)
     : base(key)
 {
     Duration = DefaultDuration;
     _omitted = true;
 }
Exemplo n.º 11
0
 public KeyAction(NintendoSwitch.Key key)
 {
     Key = key;
 }
Exemplo n.º 12
0
 public KeyUp(NintendoSwitch.Key key)
     : base(key)
 {
 }
Exemplo n.º 13
0
 public KeyDown(NintendoSwitch.Key key)
     : base(key)
 {
 }