public static string GetName(NintendoSwitch.Key key) { if (_keyName.ContainsKey(key)) { return(_keyName[key]); } return(string.Empty); }
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); } }
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); }
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); }
public StickUp(NintendoSwitch.Key key, string keyname) : base(key, keyname, null) { }
public StickAction(NintendoSwitch.Key key, string keyname, string direcion) { Key = key; KeyName = keyname?.ToUpper(); Direction = direcion?.ToUpper(); }
public StickDown(NintendoSwitch.Key key, string keyname, string direction) : base(key, keyname, direction) { }
public StickPress(NintendoSwitch.Key key, string keyname, string direction, ValBase duration) : base(key, keyname, direction) { Duration = duration; }
public KeyPress(NintendoSwitch.Key key, ValBase duration) : base(key) { Duration = duration; }
public KeyPress(NintendoSwitch.Key key) : base(key) { Duration = DefaultDuration; _omitted = true; }
public KeyAction(NintendoSwitch.Key key) { Key = key; }
public KeyUp(NintendoSwitch.Key key) : base(key) { }
public KeyDown(NintendoSwitch.Key key) : base(key) { }