示例#1
0
文件: Main.cs 项目: Gentle/WFinfo
        public void OnMouseAction(MouseButton key)
        {
            latestActive = DateTime.UtcNow.AddMinutes(minutesTillAfk);

            if (Settings.ActivationMouseButton != MouseButton.Left && key == Settings.ActivationMouseButton)
            {     //check if user pressed activation key
                if (Keyboard.IsKeyDown(Key.Delete))
                { //Close all overlays if hotkey + delete is held down
                    foreach (Window overlay in App.Current.Windows)
                    {
                        if (overlay.GetType().ToString() == "WFInfo.Overlay")
                        {
                            overlay.Hide();
                        }
                    }
                    return;
                }

                if (searchBox.IsInUse)
                {     //if key is pressed and searchbox is active then rederect keystokes to it.
                    if (Keyboard.IsKeyDown(Key.Escape))
                    { // close it if esc is used.
                        searchBox.Finish();
                        return;
                    }
                    searchBox.searchField.Focus();
                    return;
                }

                if (Settings.debug && Keyboard.IsKeyDown(Settings.DebugModifierKey) && Keyboard.IsKeyDown(Settings.SnapitModifierKey))
                { //snapit debug
                    AddLog("Loading screenshot from file for snapit");
                    StatusUpdate("Offline testing with screenshot for snapit", 0);
                    LoadScreenshotSnap();
                }
                else if (Settings.debug && Keyboard.IsKeyDown(Settings.DebugModifierKey))
                {//normal debug
                    AddLog("Loading screenshot from file");
                    StatusUpdate("Offline testing with screenshot", 0);
                    LoadScreenshot();
                }
                else if (Keyboard.IsKeyDown(Settings.SnapitModifierKey))
                {//snapit
                    AddLog("Starting snap it");
                    StatusUpdate("Starting snap it", 0);
                    OCR.SnapScreenshot();
                }
                else if (Keyboard.IsKeyDown(Settings.SearchItModifierKey))
                { //Searchit
                    AddLog("Starting search it");
                    StatusUpdate("Starting search it", 0);
                    searchBox.Start();
                }
                else if (Settings.debug || OCR.VerifyWarframe())
                {
                    Task.Factory.StartNew(() => OCR.ProcessRewardScreen());
                }
            }
            else if (key == MouseButton.Left && OCR.Warframe != null && !OCR.Warframe.HasExited && Overlay.rewardsDisplaying)
            {
                Task.Run((() =>
                {
                    lastClick = System.Windows.Forms.Cursor.Position;
                    var index = OCR.GetSelectedReward(lastClick);
                    Debug.WriteLine(index);
                    if (index < 0)
                    {
                        return;
                    }
                    listingHelper.SelectedRewardIndex = (short)index;
                }));
            }
        }