コード例 #1
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void RB_CloseConnection_CheckedChanged(object sender, EventArgs e)
        {
            if (War.HWnd != IntPtr.Zero)
            {
                int[] keyIndexGroup = { 10, 11, 12, 13, 14, 15, 16, 17, 18 };

                if (RB_CloseDescConnection.Checked)
                {
                    ChangeKey.UninstallKey(this.Handle, keyIndexGroup);
                    TX_ClosOrderRemote.Enabled = true;
                    BT_CloseALLRemote.Enabled  = true;
                }
                else if (RB_KeyDownCloseConnection.Checked)
                {
                    ChangeKey.UninstallKey(this.Handle, keyIndexGroup);

                    ChangeKey.KeyModify(this.Handle, 10, "D1", 1);
                    ChangeKey.KeyModify(this.Handle, 11, "D2", 1);
                    ChangeKey.KeyModify(this.Handle, 12, "D3", 1);
                    ChangeKey.KeyModify(this.Handle, 13, "D4", 1);
                    ChangeKey.KeyModify(this.Handle, 14, "D5", 1);
                    ChangeKey.KeyModify(this.Handle, 15, "D6", 1);
                    ChangeKey.KeyModify(this.Handle, 16, "D7", 1);
                    ChangeKey.KeyModify(this.Handle, 17, "D8", 1);
                    ChangeKey.KeyModify(this.Handle, 18, "D9", 1);

                    TX_ClosOrderRemote.Enabled = false;
                    BT_CloseALLRemote.Enabled  = false;
                }
            }
        }
コード例 #2
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void TX_KeySpeak_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (!"Alt".Equals(e.Modifiers.ToString()))
            {
                string keyContent = ChangeKey.KeyFilter(e, "");

                if (keyContent != "")
                {
                    TX_KeySpeak.Text = keyContent;
                }
            }
        }
コード例 #3
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
 private void CB_EnlargeHorizon_CheckedChanged(object sender, EventArgs e)
 {
     if (War.HWnd != IntPtr.Zero)
     {
         if (CB_EnlargeHorizon.Checked)
         {
             ChangeKey.KeyModify(this.Handle, 24, "Left", 1);
         }
         else
         {
             ChangeKey.UnregisterHotKey(Handle, 24);
         }
     }
 }
コード例 #4
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void BT_VSROOM_Click(object sender, EventArgs e)
        {
            if (BT_VSROOM.Text.IndexOf("V S 擠 房") != -1)
            {
                BT_VSROOM.Text = "选择房间按下 Alt+空格 键";

                ChangeKey.KeyModify(this.Handle, 23, "Space", 1);
            }
            else
            {
                BT_VSROOM.Text     = "V S 擠 房";
                CrowdedRoom.iSquit = true;
                ChangeKey.UnregisterHotKey(Handle, 23);
                CrowdedRoom.OverCrowded();
            }
        }
コード例 #5
0
        //注册单热键或组合热键验证
        public static void KeyRegisterValidate(IntPtr hWnd, string keyValue, int sid)
        {
            if (keyValue != "" && keyValue.IndexOf('+') == -1)
            {
                ChangeKey.KeyModify(hWnd, sid, keyValue, 0);
            }
            else
            {
                switch (keyValue.Split('+')[0].ToLower())
                {
                case "alt": ChangeKey.KeyModify(hWnd, sid, keyValue.Split('+')[1], 1); break;

                case "control": ChangeKey.KeyModify(hWnd, sid, keyValue.Split('+')[1], 2); break;

                case "shift": ChangeKey.KeyModify(hWnd, sid, keyValue.Split('+')[1], 4); break;
                }
            }
        }
コード例 #6
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        //按键前事件验证
        private void TX_PreviewKey_Validate(object sender, PreviewKeyDownEventArgs e)
        {
            TextBox key = (TextBox)sender;

            if (!"Delete".Equals(e.KeyCode.ToString()) && !"Back".Equals(e.KeyCode.ToString()))
            {
                string keyContent = ChangeKey.KeyFilter(e, ((TextBox)sender).Name);

                if (keyContent != "")
                {
                    key.Text = e.KeyCode.ToString();
                }
            }
            else
            {
                key.Text = "";
            }
        }
コード例 #7
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        private void CK_VideoGama_CheckedChanged(object sender, EventArgs e)
        {
            if (War.HWnd != IntPtr.Zero)
            {
                if (CK_VideoGama.Checked)
                {
                    int ResultGammaValue = Video.SetGamma();

                    ChangeKey.UninstallKey(this.Handle, new int[] { 21, 22 });

                    ChangeKey.KeyModify(this.Handle, 20, "Up", 1);
                    ChangeKey.KeyModify(this.Handle, 21, "Down", 1);
                }
                else
                {
                    War.GamaValue   = 0.1;
                    Video.GamaValue = War.GamaValue;
                    Video.SetGamma();

                    ChangeKey.UninstallKey(this.Handle, new int[] { 21, 22 });
                }
            }
        }
コード例 #8
0
ファイル: Video.cs プロジェクト: wuethan/wjewar
        //发送鼠标点击
        public static void SendMouseDown(IntPtr hWnd, int skillsIndex, int number)
        {
            Point ptPast = new Point();

            GetCursorPos(ref ptPast);

            Point ptIng = new Point();

            ClientToScreen(hWnd, ref ptIng);

            RECT rc;

            GetWindowRect(hWnd, out rc);

            int    width  = rc.right - (int)ptIng.X;
            double wIndex = 0.78;
            double hIndex = 0.95;

            switch (skillsIndex)
            {
            case 0: wIndex = 0.85; hIndex = 0.88; break;

            case 1: wIndex = 0.90; hIndex = 0.88; break;

            case 2: wIndex = 0.80; hIndex = 0.95; break;

            case 3: wIndex = 0.85; hIndex = 0.95; break;

            case 4: wIndex = 0.90; hIndex = 0.95; break;

            case 5: wIndex = 0.95; hIndex = 0.95; break;

            case 6: wIndex = 0.66; hIndex = 0.82; break;

            case 7: wIndex = 0.71; hIndex = 0.82; break;

            case 8: wIndex = 0.66; hIndex = 0.89; break;

            case 9: wIndex = 0.71; hIndex = 0.89; break;

            case 10: wIndex = 0.66; hIndex = 0.95; break;

            case 11: wIndex = 0.71; hIndex = 0.95; break;
            }

            width = (int)(width - (width * wIndex));
            width = rc.right - width;

            int height = rc.bottom - (int)ptIng.Y;

            height = (int)(height - (height * hIndex));
            height = rc.bottom - height;

            SetCursorPos(width, height);

            const int MOUSEEVENTF_LEFTDOWN = 0x0002;
            const int MOUSEEVENTF_LEFTUP   = 0x0004;

            const uint KEYEVENTF_EXTENDEDKEY = 0x1;
            const uint KEYEVENTF_KEYUP       = 0x2;

            const uint VK_Control = 0x11;

            ChangeKey.keybd_event((byte)VK_Control, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);

            for (int i = 0; i <= number; i++)
            {
                ChangeKey.mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                System.Threading.Thread.Sleep(5);
            }
            ChangeKey.keybd_event((byte)VK_Control, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);


            SetCursorPos(ptPast.X, ptPast.Y);
        }
コード例 #9
0
 /// <summary>卸载包裹改键
 ///
 /// </summary>
 public static void KeyModifyOFF(IntPtr hWnd)
 {
     int[] keGroup = { 7, 8, 4, 5, 1, 2, 22, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 };
     ChangeKey.UninstallKey(hWnd, keGroup);
 }
コード例 #10
0
ファイル: FM_DemonWar.cs プロジェクト: wuethan/wjewar
        //按下设定的键时调用该函数
        private void ProcessHotkey(Message m)
        {
            IntPtr id  = m.WParam;
            string sid = id.ToString();

            switch (sid)
            {
            case "7":
                int[] Num7 = { 103 };
                ChangeKey.KeyBoardDo(Num7, War.HWnd);
                break;

            case "8":
                int[] Num8 = { 104 };
                ChangeKey.KeyBoardDo(Num8, War.HWnd);
                break;

            case "4":
                int[] Num4 = { 100 };
                ChangeKey.KeyBoardDo(Num4, War.HWnd);
                break;

            case "5":
                int[] Num5 = { 101 };
                ChangeKey.KeyBoardDo(Num5, War.HWnd);
                break;

            case "1":
                int[] Num1 = { 97 };
                ChangeKey.KeyBoardDo(Num1, War.HWnd);
                break;

            case "2":
                int[] Num2 = { 98 };
                ChangeKey.KeyBoardDo(Num2, War.HWnd);
                break;

            case "10":
                ClosRemoteByIndex(1);
                break;

            case "11":
                ClosRemoteByIndex(2);
                break;

            case "12":
                ClosRemoteByIndex(3);
                break;

            case "13":
                ClosRemoteByIndex(4);
                break;

            case "14":
                ClosRemoteByIndex(5);
                break;

            case "15":
                ClosRemoteByIndex(6);
                break;

            case "16":
                ClosRemoteByIndex(7);
                break;

            case "17":
                ClosRemoteByIndex(8);
                break;

            case "18":
                ClosRemoteByIndex(9);
                break;

            case "20":
                if (War.GamaValue > 0.05)
                {
                    Video.GamaValue = War.GamaValue -= 0.01;
                }
                if (CK_VideoGama.Checked)
                {
                    Video.SetGamma();
                }
                break;

            case "21":
                if (War.GamaValue < 0.1)
                {
                    Video.GamaValue = War.GamaValue += 0.01;
                }
                if (CK_VideoGama.Checked)
                {
                    Video.SetGamma();
                }
                break;

            case "22":
                if (War.HWnd == GetForegroundWindow())
                {
                    if (War.IsCanSpeak)
                    {
                        string str = TX_SpeakContent.Text;
                        if (str != "")
                        {
                            War.IsCanSpeak = false;
                            Clipboard.SetText(ConvertEncode(str));
                            ChangeKey.WarSpeak(War.HWnd);
                            War.IsCanSpeak = true;
                        }
                    }
                }
                break;

            case "23":
                CrowdedRoom.VsRoom();
                break;

            case "24":
                War.LensValue = War.LensValue + 300; break;

            case "25":
                Video.SendMouseDown(War.HWnd, 0, 30); break;

            case "26":
                Video.SendMouseDown(War.HWnd, 1, 30); break;

            case "27":
                Video.SendMouseDown(War.HWnd, 2, 30); break;

            case "28":
                Video.SendMouseDown(War.HWnd, 3, 30); break;

            case "29":
                Video.SendMouseDown(War.HWnd, 4, 30); break;

            case "30":
                Video.SendMouseDown(War.HWnd, 5, 30); break;

            case "31":
                Video.SendMouseDown(War.HWnd, 6, 30); break;

            case "32":
                Video.SendMouseDown(War.HWnd, 7, 30); break;

            case "33":
                Video.SendMouseDown(War.HWnd, 8, 30); break;

            case "34":
                Video.SendMouseDown(War.HWnd, 9, 30); break;

            case "35":
                Video.SendMouseDown(War.HWnd, 10, 30); break;

            case "36":
                Video.SendMouseDown(War.HWnd, 11, 30); break;
            }
        }