Beispiel #1
0
        public bool TranslateMapFocusPosition(float xOffset, float yOffset, float zOffset, bool useRelative)
        {
            MapUtilities.MaybeChangeMapCameraMode();
            List <PositionAngle> posAngles = new List <PositionAngle> {
                PositionAngle.MapFocus
            };

            return(ButtonUtilities.ChangeValues(posAngles, xOffset, yOffset, zOffset, ButtonUtilities.Change.ADD, useRelative));
        }
Beispiel #2
0
        public bool TranslateMapCameraSpherical(float radiusOffset, float thetaOffset, float phiOffset)
        {
            MapUtilities.MaybeChangeMapCameraMode();
            ButtonUtilities.HandleScaling(ref thetaOffset, ref phiOffset);

            (double newX, double newY, double newZ) =
                MoreMath.OffsetSphericallyAboutPivot(
                    SpecialConfig.Map3DCameraX, SpecialConfig.Map3DCameraY, SpecialConfig.Map3DCameraZ,
                    radiusOffset, thetaOffset, phiOffset,
                    SpecialConfig.Map3DFocusX, SpecialConfig.Map3DFocusY, SpecialConfig.Map3DFocusZ);

            SpecialConfig.Map3DCameraX = (float)newX;
            SpecialConfig.Map3DCameraY = (float)newY;
            SpecialConfig.Map3DCameraZ = (float)newZ;

            return(true);
        }
Beispiel #3
0
        public bool TranslateMapFocusSpherical(float radiusOffset, float thetaOffset, float phiOffset)
        {
            MapUtilities.MaybeChangeMapCameraMode();
            ButtonUtilities.HandleScaling(ref thetaOffset, ref phiOffset);

            if (SpecialConfig.Map3DMode == Map3DCameraMode.CameraPosAndAngle)
            {
                SpecialConfig.Map3DCameraYaw   += thetaOffset;
                SpecialConfig.Map3DCameraPitch += phiOffset;
                return(true);
            }

            (double newX, double newY, double newZ) =
                MoreMath.OffsetSphericallyAboutPivot(
                    SpecialConfig.Map3DFocusX, SpecialConfig.Map3DFocusY, SpecialConfig.Map3DFocusZ,
                    radiusOffset, thetaOffset, phiOffset,
                    SpecialConfig.Map3DCameraX, SpecialConfig.Map3DCameraY, SpecialConfig.Map3DCameraZ);

            SpecialConfig.Map3DFocusX = (float)newX;
            SpecialConfig.Map3DFocusY = (float)newY;
            SpecialConfig.Map3DFocusZ = (float)newZ;

            return(true);
        }
Beispiel #4
0
        public MapTracker(MapTab mapTab, string creationIdentifier, MapObject mapObject)
        {
            this.mapTab             = mapTab;
            this.creationIdentifier = creationIdentifier;

            using (new AccessScope <MapTab>(mapTab))
            {
                InitializeComponent();

                this.mapObject = mapObject;

                _images = new List <Image>();

                _isVisible    = true;
                _showTriUnits = false;

                pictureBoxPicture.ContextMenuStrip = new ContextMenuStrip();
                ToolStripMenuItem        itemUseTopDownImage    = new ToolStripMenuItem("Use Top Down Image");
                ToolStripMenuItem        itemUseObjectSlotImage = new ToolStripMenuItem("Use Object Slot Image");
                ToolStripMenuItem        itemUseCustomImage     = new ToolStripMenuItem("Use Custom Image");
                List <ToolStripMenuItem> pictureBoxItems        = new List <ToolStripMenuItem>()
                {
                    itemUseTopDownImage, itemUseObjectSlotImage, itemUseCustomImage
                };
                itemUseTopDownImage.Click += (sender, e) =>
                {
                    this.mapObject.SetIconType(MapTrackerIconType.TopDownImage);
                    pictureBoxItems.ForEach(item => item.Checked = item == itemUseTopDownImage);
                };
                itemUseObjectSlotImage.Click += (sender, e) =>
                {
                    this.mapObject.SetIconType(MapTrackerIconType.ObjectSlotImage);
                    pictureBoxItems.ForEach(item => item.Checked = item == itemUseObjectSlotImage);
                };
                itemUseCustomImage.Click += (sender, e) =>
                {
                    Image        image    = DialogUtilities.GetImage();
                    Lazy <Image> imageMap = new Lazy <Image>(() => image);
                    if (image == null)
                    {
                        return;
                    }
                    this.mapObject.SetIconType(MapTrackerIconType.CustomImage, imageMap);
                    pictureBoxItems.ForEach(item => item.Checked = item == itemUseCustomImage);
                };
                itemUseTopDownImage.Checked = true;
                pictureBoxPicture.ContextMenuStrip.Items.Add(itemUseTopDownImage);
                pictureBoxPicture.ContextMenuStrip.Items.Add(itemUseObjectSlotImage);
                pictureBoxPicture.ContextMenuStrip.Items.Add(itemUseCustomImage);

                _customName = null;
                textBoxName.AddEnterAction(() => _customName     = textBoxName.Text);
                textBoxName.AddLostFocusAction(() => _customName = textBoxName.Text);
                textBoxName.AddDoubleClickAction(() => textBoxName.SelectAll());
                textBoxName.ContextMenuStrip = new ContextMenuStrip();
                ToolStripMenuItem itemResetCustomName = new ToolStripMenuItem("Reset Custom Name");
                itemResetCustomName.Click += (sender, e) => _customName = null;
                textBoxName.ContextMenuStrip.Items.Add(itemResetCustomName);

                checkBoxRotates.Click           += (sender, e) => this.mapObject.CustomRotates = checkBoxRotates.Checked;
                checkBoxRotates.ContextMenuStrip = new ContextMenuStrip();
                ToolStripMenuItem itemResetCustomRotates = new ToolStripMenuItem("Reset Custom Rotates");
                itemResetCustomRotates.Click += (sender, e) => this.mapObject.CustomRotates = null;
                checkBoxRotates.ContextMenuStrip.Items.Add(itemResetCustomRotates);

                tableLayoutPanel.BorderWidth = 2;
                tableLayoutPanel.ShowBorder  = true;

                comboBoxVisibilityType.DataSource   = Enum.GetValues(typeof(MapTrackerVisibilityType));
                comboBoxVisibilityType.SelectedItem = MapTrackerVisibilityType.VisibleWhenLoaded;

                comboBoxOrderType.DataSource   = Enum.GetValues(typeof(MapTrackerOrderType));
                comboBoxOrderType.SelectedItem = MapTrackerOrderType.OrderByY;

                SetSize(null);
                SetOpacity(null);
                SetOutlineWidth(null);
                SetColor(null);
                SetOutlineColor(null);

                textBoxSize.AddEnterAction(() => textBoxSize_EnterAction());
                trackBarSize.AddManualChangeAction(() => trackBarSize_ValueChanged());
                textBoxOpacity.AddEnterAction(() => textBoxOpacity_EnterAction());
                trackBarOpacity.AddManualChangeAction(() => trackBarOpacity_ValueChanged());
                textBoxOutlineWidth.AddEnterAction(() => textBoxOutlineWidth_EnterAction());
                trackBarOutlineWidth.AddManualChangeAction(() => trackBarOutlineWidth_ValueChanged());
                colorSelector.AddColorChangeAction((Color color) => SetColor(color));
                colorSelectorOutline.AddColorChangeAction((Color color) => SetOutlineColor(color));

                pictureBoxCog.ContextMenuStrip = this.mapObject.BindToTracker(this);
                pictureBoxCog.Click           += (sender, e) => pictureBoxCog.ContextMenuStrip.Show(Cursor.Position);

                MapUtilities.CreateTrackBarContextMenuStrip(trackBarSize);
                MapUtilities.CreateTrackBarContextMenuStrip(trackBarOutlineWidth);
                InitializePlusContextMenuStrip();

                UpdateControl();
            }
        }