/// <summary> /// Set the colour of a key /// </summary> /// <param name="key">The key to be coloured</param> /// <param name="colour">The colour for the key</param> /// <param name="direct">Determines if this is set directly to the keyboard or if it is stored in the keyboard color array</param> /// <returns>This functions return true (1) if the colours are changed (optional: updated)</returns> public static bool SetKey(WootingKey.Keys key, KeyColour colour, bool direct = false) { if (WootingKey.KeyMap.TryGetValue(key, out (byte row, byte column)index)) { return(SetKey(index.row, index.column, colour.r, colour.g, colour.b, direct)); } return(false); }
private List <KeyColour> collectedKeys = new List <KeyColour>(); // list of character collected keys public bool Pickupkey(KeyColour colour) // used within KeyTrigger script { if (collectedKeys.Contains(colour) == false) // check if key colour has already been collected { collectedKeys.Add(colour); // add key (colour) to collectedKeys return(true); // return true key picked up } return(false); // return false key not picked up }
static void TestRGB() { Console.WriteLine("Wooting Rgb Control testing!"); Console.WriteLine($"wooting_rgb_kbd_connected: {RGBControl.IsConnected()}"); //RGBControl.wooting_rgb_direct_set_key(0, 0, 255, 0, 0); //Console.WriteLine("Turning on auto-update!"); //RGBControl.wooting_rgb_array_auto_update(true); Console.WriteLine("Set disconnected cb"); RGBControl.SetDisconnectedCallback((DisconnectedCallback)dc_cb); Console.WriteLine("Setting some keys directly!"); Console.WriteLine($"Setting ESC green: {RGBControl.SetKey(WootingKey.Keys.Esc, 0, 255, 0)}"); RGBControl.UpdateKeyboard(); Console.WriteLine("Setting Enter Red"); RGBControl.SetKey(WootingKey.Keys.Enter, 255, 0, 0, true); Console.WriteLine("Setting G blue"); RGBControl.SetKey(WootingKey.Keys.G, 0, 0, 255, true); Console.WriteLine("Setting Mode/Scroll Lock green"); RGBControl.SetKey(WootingKey.Keys.Mode_ScrollLock, 0, 255, 0, true); Thread.Sleep(5000); Console.WriteLine("Setting the keyboard blank!"); KeyColour[,] keys = new KeyColour[RGBControl.MaxRGBRows, RGBControl.MaxRGBCols]; for (byte i = 0; i < RGBControl.MaxRGBCols; i++) { for (byte j = 0; j < RGBControl.MaxRGBRows; j++) { keys[j, i] = new KeyColour(0, 0, 0); } } RGBControl.SetFull(keys); RGBControl.UpdateKeyboard(); Thread.Sleep(1000); //RGBControl.woo(true); for (byte i = 0; i < RGBControl.MaxRGBCols; i++) { for (byte j = 0; j < RGBControl.MaxRGBRows; j++) { Console.WriteLine($"Setting the key, ROW:{j}, COL:{i}"); keys[j, i] = new KeyColour(255, 255, 0); //RGBControl.SetKey(j, i, 255, 0, 0, true); //RGBControl.SetFull(keys); //RGBControl.UpdateKeyboard(); RGBControl.SetFull(keys); RGBControl.UpdateKeyboard(); Thread.Sleep(100); } //Thread.Sleep(1000); } //Console.WriteLine($"wooting_rgb_kbd_connected: {RGBControl.wooting_rgb_kbd_connected()}"); Console.ReadKey(); RGBControl.Reset(); Console.ReadKey(); }
public bool CheckKeys(KeyColour colour) // used within Interaction script { foreach (KeyColour c in collectedKeys) // go thru list of collectedKeys { if (c == colour) // is colour passed to method matches keys collected { return(true); // return true needed detected key found } } return(false); // return false needed detected key not found }
public KeyCard(KeyColour colourCode) { keycolour = colourCode; }
static void TestRGB() { Console.WriteLine("Wooting Rgb Control testing!"); RGBDeviceInfo device = RGBControl.GetDeviceInfo(); Console.WriteLine($"Initial Device Info has got: Connected: {device.Connected}, Model: {device.Model}, Type: {device.DeviceType}, Max Rows: {device.MaxRows}, Max Cols: {device.MaxColumns}, Max Keycode: {device.KeycodeLimit}"); bool connected = RGBControl.IsConnected(); Console.WriteLine($"wooting_rgb_kbd_connected: {connected}"); if (!connected) { return; } device = RGBControl.GetDeviceInfo(); Console.WriteLine($"Device Info has got: Connected: {device.Connected}, Model: {device.Model}, Type: {device.DeviceType}, Max Rows: {device.MaxRows}, Max Cols: {device.MaxColumns}, Max Keycode: {device.KeycodeLimit}"); //Console.WriteLine("Turning on auto-update!"); //RGBControl.wooting_rgb_array_auto_update(true); Console.WriteLine("Set disconnected cb"); RGBControl.SetDisconnectedCallback((DisconnectedCallback)dc_cb); Console.WriteLine("Setting some keys directly!"); Console.WriteLine($"Setting ESC green: {RGBControl.SetKey(WootingKey.Keys.Esc, 0, 255, 0, true)}"); // RGBControl.UpdateKeyboard(); Console.WriteLine("Setting Enter Red"); RGBControl.SetKey(WootingKey.Keys.Enter, 255, 0, 0, true); Console.WriteLine("Setting G blue"); RGBControl.SetKey(WootingKey.Keys.G, 0, 0, 255, true); Console.WriteLine("Setting Mode/Scroll Lock green"); RGBControl.SetKey(WootingKey.Keys.Mode_ScrollLock, 0, 255, 0, true); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); Console.WriteLine("Setting the keyboard blank!"); KeyColour[,] keys = new KeyColour[RGBControl.MaxRGBRows, RGBControl.MaxRGBCols]; for (byte i = 0; i < device.MaxColumns; i++) { for (byte j = 0; j < device.MaxRows; j++) { keys[j, i] = new KeyColour(0, 0, 0); } } RGBControl.SetFull(keys); RGBControl.UpdateKeyboard(); RGBControl.ResetRGB(); Thread.Sleep(1000); RGBControl.Close(); for (byte i = 0; i < device.MaxColumns; i++) { for (byte j = 0; j < device.MaxRows; j++) { Console.WriteLine($"Setting the key, ROW:{j}, COL:{i}"); keys[j, i] = new KeyColour(255, 255, 0); RGBControl.SetFull(keys); RGBControl.UpdateKeyboard(); Thread.Sleep(100); } } Console.WriteLine("Press any key to reset all colors to default..."); Console.ReadKey(); RGBControl.Close(); }