protected override void WndProc(ref Message m) { if (m.Msg == HotkeyManager.WM_HOTKEY_MSG_ID) { BridgeTCPUDP.OnHotkey(m.WParam.ToInt32()); } base.WndProc(ref m); }
private void OnKey(Keys key, bool isDown) { if (GetForegroundWindow() != CwRam.memory.process.MainWindowHandle) { return; } if (!keyboardState.ContainsKey(key)) { keyboardState.Add(key, !isDown); } if (keyboardState[key] == isDown) { return; } keyboardState[key] = isDown; if (!isDown) { return; //temp fix to prevent activation on release } switch (key) { case Keys.D4: BridgeTCPUDP.OnHotkey(Resources.HotkeyID.CtrlSpace); break; case Keys.D5: BridgeTCPUDP.OnHotkey(Resources.HotkeyID.SpecialMove2); break; case Keys.D0: BridgeTCPUDP.OnHotkey(Resources.HotkeyID.TeleportToTown); break; default: break; } }