Пример #1
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            // Hud Image
            pictureBoxHud.Image      = Config.ObjectAssociations.HudImage.Value;
            panelHudBorder.BackColor = Config.ObjectAssociations.HudColor;
            pictureBoxHud.BackColor  = Config.ObjectAssociations.HudColor.Lighten(0.5);

            buttonFullHp.Click      += (sender, e) => ButtonUtilities.FullHp();
            buttonDie.Click         += (sender, e) => ButtonUtilities.Die();
            buttonGameOver.Click    += (sender, e) => ButtonUtilities.GameOver();
            button99Coins.Click     += (sender, e) => ButtonUtilities.Coins99();
            button100CoinStar.Click += (sender, e) => ButtonUtilities.CoinStar100();
            button100Lives.Click    += (sender, e) => ButtonUtilities.Lives100();
            buttonStandardHud.Click += (sender, e) => ButtonUtilities.StandardHud();

            buttonTurnOnOffHud.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(MarioConfig.StructAddress + HudConfig.VisibilityOffset) & HudConfig.VisibilityMask) == 0);

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTurnOnOffHud,
                new List <string>()
            {
                "Disable HUD by Changing Level Index",
                "Enable HUD by Changing Level Index",
                "Disable HUD by Removing Function",
                "Enable HUD by Removing Function",
            },
                new List <Action>()
            {
                () => ButtonUtilities.SetHudVisibility(false, true),
                () => ButtonUtilities.SetHudVisibility(true, true),
                () => ButtonUtilities.SetHudVisibility(false, false),
                () => ButtonUtilities.SetHudVisibility(true, false),
            });
        }
Пример #2
0
        public HudManager(string varFilePath, Control tabControl, WatchVariableFlowLayoutPanel watchVariablePanelHud)
            : base(varFilePath, watchVariablePanelHud)
        {
            _tabControl = tabControl;

            SplitContainer splitContainerHud = tabControl.Controls["splitContainerHud"] as SplitContainer;

            (splitContainerHud.Panel1.Controls["buttonFullHp"] as Button).Click      += (sender, e) => ButtonUtilities.FullHp();
            (splitContainerHud.Panel1.Controls["buttonDie"] as Button).Click         += (sender, e) => ButtonUtilities.Die();
            (splitContainerHud.Panel1.Controls["buttonGameOver"] as Button).Click    += (sender, e) => ButtonUtilities.GameOver();
            (splitContainerHud.Panel1.Controls["button99Coins"] as Button).Click     += (sender, e) => ButtonUtilities.Coins99();
            (splitContainerHud.Panel1.Controls["button100CoinStar"] as Button).Click += (sender, e) => ButtonUtilities.CoinStar100();
            (splitContainerHud.Panel1.Controls["button100Lives"] as Button).Click    += (sender, e) => ButtonUtilities.Lives100();
            (splitContainerHud.Panel1.Controls["buttonStandardHud"] as Button).Click += (sender, e) => ButtonUtilities.StandardHud();

            _turnOnOffHudButton = splitContainerHud.Panel1.Controls["buttonTurnOnOffHud"] as BinaryButton;
            _turnOnOffHudButton.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(MarioConfig.StructAddress + HudConfig.VisibilityOffset) & HudConfig.VisibilityMask) == 0);

            ControlUtilities.AddContextMenuStripFunctions(
                _turnOnOffHudButton,
                new List <string>()
            {
                "Disable HUD by Changing Level Index",
                "Enable HUD by Changing Level Index",
                "Disable HUD by Removing Function",
                "Enable HUD by Removing Function",
            },
                new List <Action>()
            {
                () => ButtonUtilities.SetHudVisibility(false, true),
                () => ButtonUtilities.SetHudVisibility(true, true),
                () => ButtonUtilities.SetHudVisibility(false, false),
                () => ButtonUtilities.SetHudVisibility(true, false),
            });

            _checkBoxFullHP = splitContainerHud.Panel1.Controls["checkBoxFullHP"] as CheckBox;
        }