예제 #1
0
        /// <summary>
        /// Gets triggered when a hotkey is pressed from the hook
        /// </summary>
        /// <param name="key"></param>
        public static void HotkeyPressed(Keys key)
        {
            //We're checking for hotkeys pressed here
            int index = Array.IndexOf(Data.hotkeys, key);

            //If it's a valid index
            if (index >= 0)
            {
                //Rush hotkey
                if (index >= 1 && index <= 7)
                {
                    if (!Data.hotkeyDelay.IsRunning || Data.hotkeyDelay.ElapsedMilliseconds > 1000)
                    {
                        Data.hotkeyDelay.Restart();
                        RushingUserControl control = Data.form.RushingTabControl.TabPages[index - 1].Controls[0] as RushingUserControl;
                        Console.WriteLine("Toggling Settings!");
                        FlipSettings(control.config);
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Triggers when the form is finished loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormLoaded(object sender, EventArgs e)
        {
            //Start the timer once the form is loaded
            InitTimer();

            MainTabControl.SelectedTab = RushingTab;

            TabPage firstRushing = CreateTab(RushingTabControl, new RushingUserControl(0), 0);
            Button  button       = FindControl <Button>("AddScript", firstRushing);

            button.Enabled   = false;
            button.BackColor = Color.Gray;

            int lastIndex = 1;

            //If there are more rushing tabs that should be created, create them
            for (int i = 1; i < Data.rushConfigs.Length; i++)
            {
                if (Data.rushConfigs[i] != null)
                {
                    TabPage tp = CreateTab(RushingTabControl, new RushingUserControl(i), i);
                    Button  b  = FindControl <Button>("AddScript", tp);
                    b.Enabled   = false;
                    b.BackColor = Color.Gray;
                    lastIndex++;
                }
            }

            button           = FindControl <Button>("AddScript", FindControl <TabPage>("Script" + lastIndex));
            button.Enabled   = true;
            button.BackColor = Color.White;

            //Create a new blank RUC in order to copy the controls over to the game info tab
            RushingUserControl ruc = new RushingUserControl(-1);

            GameInfoPanel.Controls.Add(ruc.SettingsPanel);

            foreach (CustomCheckBox box in FindControls <CustomCheckBox>("", GameInfoPanel))
            {
                box.AutoCheck = false;
                box.Cursor    = Cursors.Default;
                box.Loaded();
            }

            //Set the current tab as the first one
            RushingTabControl.SelectedTab = firstRushing;
            MainTabControl.SelectedTab    = MainTab;

            //Apply the link to the LinkLabels
            GitHubLink.Links.Add(0, 0, "https://github.com/StarOfDoom/RotMGScripts");
            GitHubLink.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);

            //Update the version label to include the current version number
            VersionNumberLabel.Text = Info.version;

            //Add event handlers for when you click hotkey buttons
            HotkeyButton0.Click += new EventHandler(HotkeyButtonClick);

            //Set the paint handler for adding images to the background
            DebuggingInfoPanel.Paint += new PaintEventHandler(InfoTabPaint);

            //Set the paint handler for adding images to the title bar
            TitleBarPanel.Paint += new PaintEventHandler(TitleBarPaint);

            //Call event when the text is changed in the process name field
            ProcessName.TextChanged += new EventHandler(ProcessTextChanged);

            //Call event when a key is pressed in the console input to check for an Enter or Arrow key
            ConsoleInput.KeyDown    += new KeyEventHandler(ConsoleInputKeyDown);
            ConsoleSendButton.Click += new EventHandler(ConsoleSendClick);

            //Update the two delays
            SearchDelayInput.ValueChanged += new EventHandler(DelayInputValueChanged);
            UpdateDelayInput.ValueChanged += new EventHandler(DelayInputValueChanged);

            //Add event handlers for checking the auto resize box
            foreach (CheckBox box in FindControls <CheckBox>("", AspectRatioGroup))
            {
                box.MouseClick += new MouseEventHandler(AspectBoxChanged);
            }

            //Lets you drag around the window without a windows title bar
            TitleBarPanel.MouseDown += new MouseEventHandler(TitleBar);
            TitleLabel.MouseDown    += new MouseEventHandler(TitleBar);

            ExitButton.InitializeButton();
            MinimizeButton.InitializeButton();

            KeyboardHook.StartHook();
        }