Exemplo n.º 1
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                _itemRecommendedArrowLength        = new ToolStripMenuItem("Use Recommended Arrow Size");
                _itemRecommendedArrowLength.Click += (sender, e) => _itemRecommendedArrowLength.Checked = !_itemRecommendedArrowLength.Checked;

                ToolStripMenuItem itemSetArrowHeadSideLength = new ToolStripMenuItem("Set Arrow Head Side Length");
                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)
                    {
                        _arrowHeadSideLength = arrowHeadSideLength.Value;
                    }
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(_itemRecommendedArrowLength);
                _contextMenuStrip.Items.Add(itemSetArrowHeadSideLength);
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 2
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemUseFixedSize = new ToolStripMenuItem("Use Fixed Size");
                itemUseFixedSize.Click += (sender, e) =>
                {
                    _useFixedSize            = !_useFixedSize;
                    itemUseFixedSize.Checked = _useFixedSize;
                };

                ToolStripMenuItem itemSetBackwardsSize = new ToolStripMenuItem("Set Backwards Size...");
                itemSetBackwardsSize.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter backwards size.");
                    double?backwardsSizeNullable = ParsingUtilities.ParseDoubleNullable(text);
                    if (!backwardsSizeNullable.HasValue)
                    {
                        return;
                    }
                    _backwardsSize = (float)backwardsSizeNullable.Value;
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemUseFixedSize);
                _contextMenuStrip.Items.Add(itemSetBackwardsSize);
            }

            return(_contextMenuStrip);
        }
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                List <BackgroundImage> backgroundImages       = Config.MapAssociations.GetAllBackgroundImages();
                List <object>          backgroundImageChoices = new List <object>()
                {
                    "Recommended"
                };
                backgroundImages.ForEach(backgroundImage => backgroundImageChoices.Add(backgroundImage));

                ToolStripMenuItem itemSelectMap = new ToolStripMenuItem("Select Background");
                itemSelectMap.Click += (sender, e) =>
                {
                    SelectionForm form = new SelectionForm();
                    form.Initialize(
                        "Select a Background",
                        "Set Background",
                        backgroundImageChoices,
                        backgroundChoice => _backgroundChoice = backgroundChoice);
                    form.Show();
                };
                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSelectMap);
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 4
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                List <MapLayout> mapLayouts       = Config.MapAssociations.GetAllMaps();
                List <object>    mapLayoutChoices = new List <object>()
                {
                    "Recommended"
                };
                mapLayouts.ForEach(mapLayout => mapLayoutChoices.Add(mapLayout));

                ToolStripMenuItem itemSelectMap = new ToolStripMenuItem("Select Map");
                itemSelectMap.Click += (sender, e) =>
                {
                    SelectionForm form = new SelectionForm();
                    form.Initialize(
                        "Select a Map",
                        "Set Map",
                        mapLayoutChoices,
                        mapLayoutChoice => _mapLayoutChoice = mapLayoutChoice);
                    form.Show();
                };
                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemSelectMap);
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 5
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                _itemUseRelativeAngles        = new ToolStripMenuItem("Use Relative Angles");
                _itemUseRelativeAngles.Click += (sender, e) => _itemUseRelativeAngles.Checked = !_itemUseRelativeAngles.Checked;

                ToolStripMenuItem itemSetAngleDiff = new ToolStripMenuItem("Set Angle Diff");
                itemSetAngleDiff.Click += (sender, e) =>
                {
                    string text      = DialogUtilities.GetStringFromDialog(labelText: "Enter angle diff.");
                    int?   angleDiff = ParsingUtilities.ParseIntNullable(text);
                    if (angleDiff.HasValue && angleDiff.Value > 0)
                    {
                        _angleDiff = angleDiff.Value;
                    }
                };

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

            return(_contextMenuStrip);
        }
Exemplo n.º 6
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                _contextMenuStrip = new ContextMenuStrip();
                GetHorizontalTriangleToolStripMenuItems(targetTracker).ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetTriangleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 7
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                itemAutoUpdate         = new ToolStripMenuItem("Auto Update");
                itemAutoUpdate.Click  += (sender, e) => itemAutoUpdate.Checked = !itemAutoUpdate.Checked;
                itemAutoUpdate.Checked = true;

                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(_tris);
                };

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

                _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(new ToolStripSeparator());
                GetFloorToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetHorizontalTriangleToolStripMenuItems(targetTracker).ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetTriangleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
        protected List <ToolStripMenuItem> GetHorizontalTriangleToolStripMenuItems(MapTracker targetTracker)
        {
            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)
                {
                    _minHeight = minHeightNullable.Value;
                }
            };

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

            itemClearMinHeight.Click += (sender, e) => _minHeight = null;

            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)
                {
                    _maxHeight = maxHeightNullable.Value;
                }
            };

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

            itemClearMaxHeight.Click += (sender, e) => _maxHeight = null;

            return(new List <ToolStripMenuItem>()
            {
                itemSetMinHeight,
                itemClearMinHeight,
                itemSetMaxHeight,
                itemClearMaxHeight,
            });
        }
Exemplo n.º 9
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                itemEnableDrawing = new ToolStripMenuItem("Enable Drawing");
                var capturedMapTab = currentMapTab;
                itemEnableDrawing.Click += (sender, e) => drawingEnabled = !drawingEnabled;

                ToolStripMenuItem itemClearDrawing = new ToolStripMenuItem("Clear Drawing");
                itemClearDrawing.Click += (sender, e) => ClearDrawing();

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemEnableDrawing);
                _contextMenuStrip.Items.Add(itemClearDrawing);
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 10
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            this.targetTracker = targetTracker;
            if (_contextMenuStrip == null)
            {
                itemEnableDragging = new ToolStripMenuItem("Enable dragging");
                var capturedMapTab = currentMapTab;
                itemEnableDragging.Click += (sender, e) =>
                {
                    itemEnableDragging.Checked = !itemEnableDragging.Checked;
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemEnableDragging);
                itemEnableDragging.PerformClick();
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 11
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            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) => _setting = setting;
                PuGridlineSetting          startingValue = _setting;
                (List <ToolStripMenuItem> itemList, Action <PuGridlineSetting> valueAction) =
                    ControlUtilities.CreateCheckableItems(
                        itemNames, itemValues, setterAction, startingValue);
                _contextMenuStrip = new ContextMenuStrip();
                itemList.ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 12
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemUseColoredMarios = new ToolStripMenuItem("Use Colored Marios");
                itemUseColoredMarios.Click += (sender, e) =>
                {
                    _useColoredMarios            = !_useColoredMarios;
                    itemUseColoredMarios.Checked = _useColoredMarios;
                };
                itemUseColoredMarios.Checked = _useColoredMarios;

                ToolStripMenuItem itemShowQuarterSteps = new ToolStripMenuItem("Show Quarter Steps");
                itemShowQuarterSteps.Click += (sender, e) =>
                {
                    _showQuarterSteps            = !_showQuarterSteps;
                    itemShowQuarterSteps.Checked = _showQuarterSteps;
                };
                itemShowQuarterSteps.Checked = _showQuarterSteps;

                ToolStripMenuItem itemSetNumFrames = new ToolStripMenuItem("Set Num Frames...");
                itemSetNumFrames.Click += (sender, e) =>
                {
                    string text = DialogUtilities.GetStringFromDialog(labelText: "Enter num frames to the nearest 1/4th.");
                    double?numFramesNullable = ParsingUtilities.ParseDoubleNullable(text);
                    if (!numFramesNullable.HasValue)
                    {
                        return;
                    }
                    double numFrames = numFramesNullable.Value;
                    _numFrames = numFrames;
                };

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemUseColoredMarios);
                _contextMenuStrip.Items.Add(itemShowQuarterSteps);
                _contextMenuStrip.Items.Add(itemSetNumFrames);
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 13
0
        public static void AddObjectSubTrackers(MapTracker tracker, string name, ContextMenuStrip targetStrip, PositionAngleProvider positionAngleProvider)
        {
            MapTab mapTab        = tracker.mapTab;
            var    cylindersItem = new ToolStripMenuItem("Cylinders");

            cylindersItem.DropDownItems.AddHandlerToItem("Add Tracker for Hitbox Cylinders",
                                                         tracker.MakeCreateTrackerHandler(mapTab, "HitboxCylinders", () => new MapObjectCylinderObject(
                                                                                              positionAngleProvider,
                                                                                              MapObjectCylinderObject.Dimensions.HitBox,
                                                                                              "Hitbox Cylinders")));

            cylindersItem.DropDownItems.AddHandlerToItem("Add Tracker for Effective Hitbox Cylinders",
                                                         tracker.MakeCreateTrackerHandler(mapTab, "EffectiveHitboxCylinders", () => new MapObjectCylinderObject(
                                                                                              positionAngleProvider,
                                                                                              MapObjectCylinderObject.Dimensions.EffectiveHitBox,
                                                                                              "Effective Hitbox Cylinders")));

            cylindersItem.DropDownItems.AddHandlerToItem("Add Tracker for Hurtbox Cylinders",
                                                         tracker.MakeCreateTrackerHandler(mapTab, "HurtboxCylinders", () => new MapObjectCylinderObject(
                                                                                              positionAngleProvider,
                                                                                              MapObjectCylinderObject.Dimensions.HurtBox,
                                                                                              "Hurtbox Cylinders")));

            cylindersItem.DropDownItems.AddHandlerToItem("Add Tracker for Effective Hurtbox Cylinders",
                                                         tracker.MakeCreateTrackerHandler(mapTab, "EffectiveHurtboxCylinders", () => new MapObjectCylinderObject(
                                                                                              positionAngleProvider,
                                                                                              MapObjectCylinderObject.Dimensions.EffectiveHitBox,
                                                                                              "Effective Hurtbox Cylinders")));

            cylindersItem.DropDownItems.AddHandlerToItem("Add Tracker for Custom Cylinders",
                                                         () =>
            {
                Func <MapObject> genObject = () =>
                {
                    var customCylinderObject = new MapObjectCylinderObject(
                        positionAngleProvider,
                        null,
                        "Custom Cylinders");
                    customCylinderObject.getDimensions = MapObjectCylinderObject.Dimensions.CustomSize(() => (customCylinderObject.Size, 0, 100));
                    return(customCylinderObject);
                };
Exemplo n.º 14
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            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)
                    {
                        _angleRadius = angleRadius.Value;
                    }
                };

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

            return(_contextMenuStrip);
        }
Exemplo n.º 15
0
        protected override ContextMenuStrip GetContextMenuStrip(MapTracker targetTracker)
        {
            if (_contextMenuStrip == null)
            {
                ToolStripMenuItem itemAutoUpdate = new ToolStripMenuItem("Auto Update");
                itemAutoUpdate.Click += (sender, e) =>
                {
                    _autoUpdate            = !_autoUpdate;
                    itemAutoUpdate.Checked = _autoUpdate;
                };
                itemAutoUpdate.Checked = _autoUpdate;

                _contextMenuStrip = new ContextMenuStrip();
                _contextMenuStrip.Items.Add(itemAutoUpdate);
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetWallToolStripMenuItems(targetTracker).ForEach(item => _contextMenuStrip.Items.Add(item));
                _contextMenuStrip.Items.Add(new ToolStripSeparator());
                GetTriangleToolStripMenuItems().ForEach(item => _contextMenuStrip.Items.Add(item));
            }

            return(_contextMenuStrip);
        }
Exemplo n.º 16
0
 public GameEngine()
 {
     MapTracker.populateMap();
 }