Esempio n. 1
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeIwerlipseLockPositions)
            {
                _lockPositions             = settings.NewIwerlipseLockPositions;
                _itemLockPositions.Checked = settings.NewIwerlipseLockPositions;
            }

            if (settings.ChangeShowQuarterSteps)
            {
                _showQuarterSteps             = settings.NewShowQuarterSteps;
                _itemShowQuarterSteps.Checked = settings.NewShowQuarterSteps;
            }
        }
Esempio n. 2
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.FloorChangeExcludeDeathBarriers)
            {
                _excludeDeathBarriers             = settings.FloorNewExcludeDeathBarriers;
                _itemExcludeDeathBarriers.Checked = settings.FloorNewExcludeDeathBarriers;
            }

            if (settings.FloorChangeEnableQuarterFrameLandings)
            {
                _enableQuarterFrameLandings             = settings.FloorNewEnableQuarterFrameLandings;
                _itemEnableQuarterFrameLandings.Checked = settings.FloorNewEnableQuarterFrameLandings;
            }
        }
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeAutoUpdate)
            {
                _autoUpdate             = settings.NewAutoUpdate;
                _itemAutoUpdate.Checked = settings.NewAutoUpdate;
            }

            if (settings.ChangeUseCurrentCellTris)
            {
                _useCurrentCellTris             = settings.NewUseCurrentCellTris;
                _itemUseCurrentCellTris.Checked = settings.NewUseCurrentCellTris;
            }
        }
Esempio n. 4
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeIconSize)
            {
                _imageSize = settings.NewIconSize;
                string suffix = string.Format(" ({0})", _imageSize);
                _itemSetIconSize.Text = SET_ICON_SIZE_TEXT + suffix;
            }

            if (settings.ChangeUseExtendedLevelBoundaries)
            {
                _useExtendedLevelBoundaries             = settings.NewUseExtendedLevelBoundaries;
                _itemUseExtendedLevelBoundaries.Checked = settings.NewUseExtendedLevelBoundaries;
            }
        }
Esempio n. 5
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeUseCrossSection)
            {
                _useCrossSection             = settings.NewUseCrossSection;
                _itemUseCrossSection.Checked = settings.NewUseCrossSection;
            }

            if (settings.ChangeIconSize)
            {
                _imageSize = settings.NewIconSize;
                string suffix = string.Format(" ({0})", _imageSize);
                _itemSetIconSize.Text = SET_ICON_SIZE_TEXT + suffix;
            }
        }
Esempio n. 6
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                _itemUseRelativeAngles        = new ToolStripMenuItem("Use Relative Angles");
                _itemUseRelativeAngles.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeAngleRangeUseRelativeAngles: true,
                        newAngleRangeUseRelativeAngles: !_useRelativeAngles);
                    GetParentMapTracker().ApplySettings(settings);
                };

                string suffix = string.Format(" ({0})", _angleDiff);
                _itemSetAngleDiff        = new ToolStripMenuItem(SET_ANGLE_DIFF_TEXT + suffix);
                _itemSetAngleDiff.Click += (sender, e) =>
                {
                    string text      = DialogUtilities.GetStringFromDialog(labelText: "Enter angle diff.");
                    int?   angleDiff = ParsingUtilities.ParseIntNullable(text);
                    if (!angleDiff.HasValue || angleDiff.Value <= 0)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeAngleRangeAngleDiff: true, newAngleRangeAngleDiff: angleDiff.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _itemUseInGameAngles        = new ToolStripMenuItem("Use In-Game Angles");
                _itemUseInGameAngles.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeAngleRangeUseInGameAngles: true,
                        newAngleRangeUseInGameAngles: !_useInGameAngles);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemUseRelativeAngles);
                _contextMenuStrip.Items.Add(_itemSetAngleDiff);
                _contextMenuStrip.Items.Add(_itemUseInGameAngles);
            }

            return(_contextMenuStrip);
        }
Esempio n. 7
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeWallRelativeHeight)
            {
                _relativeHeight = settings.NewWallRelativeHeight;
                string suffix = _relativeHeight.HasValue ? string.Format(" ({0})", _relativeHeight.Value) : "";
                _itemSetRelativeHeight.Text = SET_RELATIVE_HEIGHT_TEXT + suffix;
            }

            if (settings.ChangeWallAbsoluteHeight)
            {
                _absoluteHeight = settings.NewWallAbsoluteHeight;
                string suffix = _absoluteHeight.HasValue ? string.Format(" ({0})", _absoluteHeight.Value) : "";
                _itemSetAbsoluteHeight.Text = SET_ABSOLUTE_HEIGHT_TEXT + suffix;
            }
        }
Esempio n. 8
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeCustomCylinderRelativeMinY)
            {
                _relativeMinY = settings.NewCustomCylinderRelativeMinY;
                string suffix = string.Format(" ({0})", _relativeMinY);
                _itemSetRelativeMinY.Text = SET_RELATIVE_MIN_Y_TEXT + suffix;
            }

            if (settings.ChangeCustomCylinderRelativeMaxY)
            {
                _relativeMaxY = settings.NewCustomCylinderRelativeMaxY;
                string suffix = string.Format(" ({0})", _relativeMaxY);
                _itemSetRelativeMaxY.Text = SET_RELATIVE_MAX_Y_TEXT + suffix;
            }
        }
Esempio n. 9
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                string suffixMin = string.Format(" ({0})", _relativeMinY);
                _itemSetRelativeMinY        = new ToolStripMenuItem(SET_RELATIVE_MIN_Y_TEXT + suffixMin);
                _itemSetRelativeMinY.Click += (sender, e) =>
                {
                    string text         = DialogUtilities.GetStringFromDialog(labelText: "Enter the relative min y.");
                    float? relativeMinY = ParsingUtilities.ParseFloatNullable(text);
                    if (!relativeMinY.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeCustomCylinderRelativeMinY: true, newCustomCylinderRelativeMinY: relativeMinY.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                string suffixMax = string.Format(" ({0})", _relativeMaxY);
                _itemSetRelativeMaxY        = new ToolStripMenuItem(SET_RELATIVE_MAX_Y_TEXT + suffixMax);
                _itemSetRelativeMaxY.Click += (sender, e) =>
                {
                    string text         = DialogUtilities.GetStringFromDialog(labelText: "Enter the relative max y.");
                    float? relativeMaxY = ParsingUtilities.ParseFloatNullable(text);
                    if (!relativeMaxY.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeCustomCylinderRelativeMaxY: true, newCustomCylinderRelativeMaxY: relativeMaxY.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemSetRelativeMinY);
                _contextMenuStrip.Items.Add(_itemSetRelativeMaxY);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetCircleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Esempio n. 10
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                _useInteractionStatusAsColorItem        = new ToolStripMenuItem("Use Interaction Status as Color");
                _useInteractionStatusAsColorItem.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeUseInteractionStatusAsColor: true, newUseInteractionStatusAsColor: !_useInteractionStatusAsColor);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_useInteractionStatusAsColorItem);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetCircleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Esempio n. 11
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.AngleRangeChangeUseRelativeAngles)
            {
                _useRelativeAngles             = settings.AngleRangeNewUseRelativeAngles;
                _itemUseRelativeAngles.Checked = settings.AngleRangeNewUseRelativeAngles;
            }

            if (settings.AngleRangeChangeAngleDiff)
            {
                _angleDiff = settings.AngleRangeNewAngleDiff;
            }

            if (settings.AngleRangeChangeUseInGameAngles)
            {
                _useInGameAngles             = settings.AngleRangeNewUseInGameAngles;
                _itemUseInGameAngles.Checked = settings.AngleRangeNewUseInGameAngles;
            }
        }
Esempio n. 12
0
        public void ApplySettings(MapObjectSettings settings)
        {
            FieldInfo[] fieldInfos = typeof(MapObjectSettings).GetFields();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (FieldInfo fieldInfo in fieldInfos)
            {
                dictionary[fieldInfo.Name] = fieldInfo.GetValue(settings);
            }
            foreach (string key1 in dictionary.Keys)
            {
                object value1 = dictionary[key1];
                if (key1.StartsWith("Change") && value1.Equals(true))
                {
                    string key2   = "New" + key1.Substring(6);
                    object value2 = dictionary[key2];
                    _dictionary[key1] = value1;
                    _dictionary[key2] = value2;
                }
            }
        }
Esempio n. 13
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeFloorExcludeDeathBarriers)
            {
                _excludeDeathBarriers             = settings.NewFloorExcludeDeathBarriers;
                _itemExcludeDeathBarriers.Checked = settings.NewFloorExcludeDeathBarriers;
            }

            if (settings.ChangeFloorDistinguishSlidingClasses)
            {
                _distinguishSlidingClasses             = settings.NewFloorDistinguishSlidingClasses;
                _itemDistinguishSlidingClasses.Checked = settings.NewFloorDistinguishSlidingClasses;
            }

            if (settings.ChangeFloorEnableQuarterFrameLandings)
            {
                _enableQuarterFrameLandings             = settings.NewFloorEnableQuarterFrameLandings;
                _itemEnableQuarterFrameLandings.Checked = settings.NewFloorEnableQuarterFrameLandings;
            }
        }
Esempio n. 14
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemSetRelativeMinY = new ToolStripMenuItem("Set Relative Min Y...");
                itemSetRelativeMinY.Click += (sender, e) =>
                {
                    string text         = DialogUtilities.GetStringFromDialog(labelText: "Enter a number.");
                    float? relativeMinY = ParsingUtilities.ParseFloatNullable(text);
                    if (!relativeMinY.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        customCylinderChangeRelativeMinY: true, customCylinderNewRelativeMinY: relativeMinY.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                ToolStripMenuItem itemSetRelativeMaxY = new ToolStripMenuItem("Set Relative Max Y...");
                itemSetRelativeMaxY.Click += (sender, e) =>
                {
                    string text         = DialogUtilities.GetStringFromDialog(labelText: "Enter a number.");
                    float? relativeMaxY = ParsingUtilities.ParseFloatNullable(text);
                    if (!relativeMaxY.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        customCylinderChangeRelativeMaxY: true, customCylinderNewRelativeMaxY: relativeMaxY.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSetRelativeMinY);
                _contextMenuStrip.Items.Add(itemSetRelativeMaxY);
            }

            return(_contextMenuStrip);
        }
Esempio n. 15
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeAngleRangeUseRelativeAngles)
            {
                _useRelativeAngles             = settings.NewAngleRangeUseRelativeAngles;
                _itemUseRelativeAngles.Checked = settings.NewAngleRangeUseRelativeAngles;
            }

            if (settings.ChangeAngleRangeAngleDiff)
            {
                _angleDiff = settings.NewAngleRangeAngleDiff;
                string suffix = string.Format(" ({0})", _angleDiff);
                _itemSetAngleDiff.Text = SET_ANGLE_DIFF_TEXT + suffix;
            }

            if (settings.ChangeAngleRangeUseInGameAngles)
            {
                _useInGameAngles             = settings.NewAngleRangeUseInGameAngles;
                _itemUseInGameAngles.Checked = settings.NewAngleRangeUseInGameAngles;
            }
        }
Esempio n. 16
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                List <string> itemNames = new List <string>()
                {
                    "Setting 1", "Setting 2", "Setting 3"
                };
                List <PuGridlineSetting>   itemValues   = EnumUtilities.GetEnumValues <PuGridlineSetting>(typeof(PuGridlineSetting));
                Action <PuGridlineSetting> setterAction = (PuGridlineSetting setting) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changePuGridlinesSetting: true, newPuGridlinesSetting: setting.ToString());
                    GetParentMapTracker().ApplySettings(settings);
                };
                PuGridlineSetting startingValue = _setting;
                (List <ToolStripMenuItem> itemList, Action <PuGridlineSetting> valueAction) =
                    ControlUtilities.CreateCheckableItems(
                        itemNames, itemValues, setterAction, startingValue);

                _itemUseMarioAsOrigin        = new ToolStripMenuItem("Use Mario as Origin");
                _itemUseMarioAsOrigin.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeUseMarioAsOrigin: true, newUseMarioAsOrigin: !_useMarioAsOrigin);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                itemList.ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(_itemUseMarioAsOrigin);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetGridlinesToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Esempio n. 17
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemSetAngleRadius = new ToolStripMenuItem("Set Angle Radius");
                itemSetAngleRadius.Click += (sender, e) =>
                {
                    string text        = DialogUtilities.GetStringFromDialog(labelText: "Enter the angle radius for sector:");
                    float? angleRadius = ParsingUtilities.ParseFloatNullable(text);
                    if (!angleRadius.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        sectorChangeAngleRadius: true, sectorNewAngleRadius: angleRadius.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSetAngleRadius);
            }

            return(_contextMenuStrip);
        }
Esempio n. 18
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeLineSegmentUseFixedSize)
            {
                _useFixedSize             = settings.NewLineSegmentUseFixedSize;
                _itemUseFixedSize.Checked = settings.NewLineSegmentUseFixedSize;
            }

            if (settings.ChangeLineSegmentBackwardsSize)
            {
                _backwardsSize = settings.NewLineSegmentBackwardsSize;
                string suffix = string.Format(" ({0})", settings.NewLineSegmentBackwardsSize);
                _itemSetBackwardsSize.Text = SET_BACKWARDS_SIZE_TEXT + suffix;
            }

            if (settings.ChangeIconSize)
            {
                _iconSize = settings.NewIconSize;
                string suffix = string.Format(" ({0})", settings.NewIconSize);
                _itemSetIconSize.Text = SET_ICON_SIZE_TEXT + suffix;
            }
        }
Esempio n. 19
0
        protected List <ToolStripMenuItem> GetFloorToolStripMenuItems()
        {
            _itemExcludeDeathBarriers        = new ToolStripMenuItem("Exclude Death Barriers");
            _itemExcludeDeathBarriers.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    floorChangeExcludeDeathBarriers: true, floorNewExcludeDeathBarriers: !_excludeDeathBarriers);
                GetParentMapTracker().ApplySettings(settings);
            };

            _itemEnableQuarterFrameLandings        = new ToolStripMenuItem("Enable Quarter Frame Landings");
            _itemEnableQuarterFrameLandings.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    floorChangeEnableQuarterFrameLandings: true, floorNewEnableQuarterFrameLandings: !_enableQuarterFrameLandings);
                GetParentMapTracker().ApplySettings(settings);
            };

            return(new List <ToolStripMenuItem>()
            {
                _itemExcludeDeathBarriers,
                _itemEnableQuarterFrameLandings,
            });
        }
Esempio n. 20
0
        public override void ApplySettings(MapObjectSettings settings)
        {
            base.ApplySettings(settings);

            if (settings.ChangeArrowUseRecommendedLength)
            {
                _useRecommendedArrowLength             = settings.NewArrowUseRecommendedLength;
                _itemUseRecommendedArrowLength.Checked = _useRecommendedArrowLength;
            }

            if (settings.ChangeArrowUseTruncatedAngle)
            {
                _useTruncatedAngle             = settings.NewArrowUseTruncatedAngle;
                _itemUseTruncatedAngle.Checked = _useTruncatedAngle;
            }

            if (settings.ChangeArrowHeadSideLength)
            {
                _arrowHeadSideLength = settings.NewArrowHeadSideLength;
                string suffix = string.Format(" ({0})", _arrowHeadSideLength);
                _itemSetArrowHeadSideLength.Text = SET_ARROW_HEAD_SIDE_LENGTH_TEXT + suffix;
            }

            if (settings.ChangeArrowAngleOffset)
            {
                _angleOffset = settings.NewArrowAngleOffset;
                string suffix = string.Format(" ({0})", _angleOffset);
                _itemSetAngleOffset.Text = SET_ANGLE_OFFSET_TEXT + suffix;
            }

            if (settings.ChangeUsePitch)
            {
                _usePitch             = settings.NewUsePitch;
                _itemUsePitch.Checked = _usePitch;
            }
        }
Esempio n. 21
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemAutoUpdate = new ToolStripMenuItem("Auto Update");
                itemAutoUpdate.Click += (sender, e) =>
                {
                    _autoUpdate            = !_autoUpdate;
                    itemAutoUpdate.Checked = _autoUpdate;
                };
                itemAutoUpdate.Checked = _autoUpdate;

                ToolStripMenuItem itemReset = new ToolStripMenuItem("Reset");
                itemReset.Click += (sender, e) => ResetTriangles();

                ToolStripMenuItem itemRemoveCurrentTri = new ToolStripMenuItem("Remove Current Tri");
                itemRemoveCurrentTri.Click += (sender, e) =>
                {
                    _removeCurrentTri            = !_removeCurrentTri;
                    itemRemoveCurrentTri.Checked = _removeCurrentTri;
                };

                ToolStripMenuItem itemShowTriData = new ToolStripMenuItem("Show Tri Data");
                itemShowTriData.Click += (sender, e) =>
                {
                    TriangleUtilities.ShowTriangles(_triList);
                };

                ToolStripMenuItem itemOpenForm = new ToolStripMenuItem("Open Form");
                itemOpenForm.Click += (sender, e) =>
                {
                    if (_triangleListForm != null)
                    {
                        return;
                    }
                    _triangleListForm = new TriangleListForm(
                        this, TriangleClassification.Wall, _triList);
                    _triangleListForm.Show();
                };

                _itemUseCurrentCellTris        = new ToolStripMenuItem("Use Current Cell Tris");
                _itemUseCurrentCellTris.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeUseCurrentCellTris: true, newUseCurrentCellTris: !_useCurrentCellTris);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemAutoUpdate);
                _contextMenuStrip.Items.Add(itemReset);
                _contextMenuStrip.Items.Add(itemRemoveCurrentTri);
                _contextMenuStrip.Items.Add(itemShowTriData);
                _contextMenuStrip.Items.Add(itemOpenForm);
                _contextMenuStrip.Items.Add(_itemUseCurrentCellTris);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetWallToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetTriangleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemCopyBasePoints = new ToolStripMenuItem("Copy Base Points");
                itemCopyBasePoints.Click += (sender, e) =>
                {
                    List <string> pointStrings = new List <string>();
                    var           quadList     = GetQuadList(null);
                    foreach (var quad in quadList)
                    {
                        (int x, int z) = ((int, int))GetQuadMidpoint(quad);
                        pointStrings.Add(x + "\t" + z);
                    }
                    pointStrings = pointStrings.Distinct().ToList();
                    string combinedText = string.Join("\r\n", pointStrings);
                    Clipboard.SetText(combinedText);
                };

                ToolStripMenuItem itemCopyMidpoints = new ToolStripMenuItem("Copy Midpoints");
                itemCopyMidpoints.Click += (sender, e) =>
                {
                    List <string> pointStrings = new List <string>();
                    var           quadList     = GetQuadList(null);
                    foreach (var quad in quadList)
                    {
                        (float x, float z) = GetQuadMidpoint(quad);
                        pointStrings.Add(x + "\t" + z);
                    }
                    string combinedText = string.Join("\r\n", pointStrings);
                    Clipboard.SetText(combinedText);
                };

                _itemSetCustomHeight        = new ToolStripMenuItem(SET_CUSTOM_HEIGHT_TEXT);
                _itemSetCustomHeight.Click += (sender, e) =>
                {
                    string text           = DialogUtilities.GetStringFromDialog(labelText: "Enter a custom height:");
                    float? heightNullable = ParsingUtilities.ParseFloatNullable(text);
                    if (!heightNullable.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeCustomHeight: true, newCustomHeight: heightNullable.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                ToolStripMenuItem itemClearCustomHeight = new ToolStripMenuItem("Clear Custom Height");
                itemClearCustomHeight.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeCustomHeight: true, newCustomHeight: null);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemCopyBasePoints);
                _contextMenuStrip.Items.Add(itemCopyMidpoints);
                _contextMenuStrip.Items.Add(_itemSetCustomHeight);
                _contextMenuStrip.Items.Add(itemClearCustomHeight);
            }

            return(_contextMenuStrip);
        }
Esempio n. 23
0
        public override ContextMenuStrip GetContextMenuStrip()
        {
            if (_contextMenuStrip == null)
            {
                _itemUseRecommendedArrowLength        = new ToolStripMenuItem("Use Recommended Arrow Size");
                _itemUseRecommendedArrowLength.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeArrowUseRecommendedLength: true,
                        newArrowUseRecommendedLength: !_useRecommendedArrowLength);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemUseRecommendedArrowLength.Checked = _useRecommendedArrowLength;

                _itemUseTruncatedAngle        = new ToolStripMenuItem("Use Truncated Angle");
                _itemUseTruncatedAngle.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeArrowUseTruncatedAngle: true,
                        newArrowUseTruncatedAngle: !_useTruncatedAngle);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemUseTruncatedAngle.Checked = _useTruncatedAngle;

                string suffix1 = string.Format(" ({0})", _arrowHeadSideLength);
                _itemSetArrowHeadSideLength        = new ToolStripMenuItem(SET_ARROW_HEAD_SIDE_LENGTH_TEXT + suffix1);
                _itemSetArrowHeadSideLength.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the side length of the arrow head:");
                    float? arrowHeadSideLength = ParsingUtilities.ParseFloatNullable(text);
                    if (!arrowHeadSideLength.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeArrowHeadSideLength: true, newArrowHeadSideLength: arrowHeadSideLength.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                string suffix2 = string.Format(" ({0})", _angleOffset);
                _itemSetAngleOffset        = new ToolStripMenuItem(SET_ANGLE_OFFSET_TEXT + suffix2);
                _itemSetAngleOffset.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the angle offset:");
                    float? angleOffsetNullable = ParsingUtilities.ParseFloatNullable(text);
                    if (!angleOffsetNullable.HasValue)
                    {
                        return;
                    }
                    MapObjectSettings settings = new MapObjectSettings(
                        changeArrowAngleOffset: true, newArrowAngleOffset: angleOffsetNullable.Value);
                    GetParentMapTracker().ApplySettings(settings);
                };

                _itemUsePitch        = new ToolStripMenuItem("Use Pitch");
                _itemUsePitch.Click += (sender, e) =>
                {
                    MapObjectSettings settings = new MapObjectSettings(
                        changeUsePitch: true, newUsePitch: !_usePitch);
                    GetParentMapTracker().ApplySettings(settings);
                };
                _itemUsePitch.Checked = _usePitch;

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemUseRecommendedArrowLength);
                _contextMenuStrip.Items.Add(_itemUseTruncatedAngle);
                _contextMenuStrip.Items.Add(_itemSetArrowHeadSideLength);
                _contextMenuStrip.Items.Add(_itemSetAngleOffset);
                _contextMenuStrip.Items.Add(_itemUsePitch);
            }

            return(_contextMenuStrip);
        }
        protected List <ToolStripMenuItem> GetHorizontalTriangleToolStripMenuItems()
        {
            ToolStripMenuItem itemSetMinHeight = new ToolStripMenuItem("Set Min Height");

            itemSetMinHeight.Click += (sender, e) =>
            {
                string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the min height.");
                float? minHeightNullable =
                    text == "" ?
                    Config.Stream.GetSingle(MarioConfig.StructAddress + MarioConfig.YOffset) :
                    ParsingUtilities.ParseFloatNullable(text);
                if (!minHeightNullable.HasValue)
                {
                    return;
                }
                MapObjectSettings settings = new MapObjectSettings(
                    horizontalTriangleChangeMinHeight: true, horizontalTriangleNewMinHeight: minHeightNullable.Value);
                GetParentMapTracker().ApplySettings(settings);
            };

            ToolStripMenuItem itemClearMinHeight = new ToolStripMenuItem("Clear Min Height");

            itemClearMinHeight.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    horizontalTriangleChangeMinHeight: true, horizontalTriangleNewMinHeight: null);
                GetParentMapTracker().ApplySettings(settings);
            };

            ToolStripMenuItem itemSetMaxHeight = new ToolStripMenuItem("Set Max Height");

            itemSetMaxHeight.Click += (sender, e) =>
            {
                string text = DialogUtilities.GetStringFromDialog(labelText: "Enter the max height.");
                float? maxHeightNullable =
                    text == "" ?
                    Config.Stream.GetSingle(MarioConfig.StructAddress + MarioConfig.YOffset) :
                    ParsingUtilities.ParseFloatNullable(text);
                if (!maxHeightNullable.HasValue)
                {
                    return;
                }
                MapObjectSettings settings = new MapObjectSettings(
                    horizontalTriangleChangeMaxHeight: true, horizontalTriangleNewMaxHeight: maxHeightNullable.Value);
                GetParentMapTracker().ApplySettings(settings);
            };

            ToolStripMenuItem itemClearMaxHeight = new ToolStripMenuItem("Clear Max Height");

            itemClearMaxHeight.Click += (sender, e) =>
            {
                MapObjectSettings settings = new MapObjectSettings(
                    horizontalTriangleChangeMaxHeight: true, horizontalTriangleNewMaxHeight: null);
                GetParentMapTracker().ApplySettings(settings);
            };

            return(new List <ToolStripMenuItem>()
            {
                itemSetMinHeight,
                itemClearMinHeight,
                itemSetMaxHeight,
                itemClearMaxHeight,
            });
        }