private void AddStringContextMenuStripItems(string specialType)
        {
            ToolStripMenuItem itemSelectValue = new ToolStripMenuItem("Select Value...");
            bool addedClickAction             = false;

            switch (specialType)
            {
            case "ActionDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "PrevActionDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowPreviousActionDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "AnimationDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "TriangleTypeDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowTriangleTypeDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "DemoCounterDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowDemoCounterDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "TtcSpeedSettingDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowTtcSpeedSettingDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "AreaTerrainDescription":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowAreaTerrainDescriptionSelectionForm();
                addedClickAction       = true;
                break;

            case "Map3DMode":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowMap3DModeSelectionForm();
                addedClickAction       = true;
                break;

            case "CompassPosition":
                itemSelectValue.Click += (sender, e) => SelectionForm.ShowCompassPositionSelectionForm();
                addedClickAction       = true;
                break;
            }

            if (addedClickAction)
            {
                _contextMenuStrip.AddToBeginningList(new ToolStripSeparator());
                _contextMenuStrip.AddToBeginningList(itemSelectValue);
            }
        }
Example #2
0
        public ActionsManager(string varFilePath, WatchVariableFlowLayoutPanel variableTable, Control actionsControl)
            : base(varFilePath, variableTable)
        {
            textBoxActionDescription    = actionsControl.Controls["textBoxActionDescription"] as BetterTextbox;
            textBoxAnimationDescription = actionsControl.Controls["textBoxAnimationDescription"] as BetterTextbox;

            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionDescriptionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxAnimationDescription,
                new List <string>()
            {
                "Select Animation", "Replace Animation"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowAnimationDescriptionSelectionForm(),
                () =>
                {
                    int?animationToBeReplaced = SelectionForm.GetAnimation("Choose Animation to Be Replaced", "Select Animation");
                    int?animationToReplaceIt  = SelectionForm.GetAnimation("Choose Animation to Replace It", "Select Animation");
                    if (animationToBeReplaced == null || animationToReplaceIt == null)
                    {
                        return;
                    }
                    AnimationUtilities.ReplaceAnimation(animationToBeReplaced.Value, animationToReplaceIt.Value);
                },
            });
        }
Example #3
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionDescriptionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxAnimationDescription,
                new List <string>()
            {
                "Select Animation", "Replace Animation"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowAnimationDescriptionSelectionForm(),
                () =>
                {
                    int?animationToBeReplaced = SelectionForm.GetAnimation("Choose Animation to Be Replaced", "Select Animation");
                    int?animationToReplaceIt  = SelectionForm.GetAnimation("Choose Animation to Replace It", "Select Animation");
                    if (animationToBeReplaced == null || animationToReplaceIt == null)
                    {
                        return;
                    }
                    AnimationUtilities.ReplaceAnimation(animationToBeReplaced.Value, animationToReplaceIt.Value);
                },
            });
        }