예제 #1
0
 private static void SecondaryPanelControl_MouseLeave(object sender, EventArgs e)
 {
     BattleEventRenderer.IsSecondaryPanelMouseDown = false;
     BattleEventRenderer.IsHoveringSecondaryPanel  = false;
     BattleEventRenderer.DrawSecondaryPanel();
     BattleEventRenderer.DrawField();
 }
예제 #2
0
 private static void SecondaryPanelControl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (BattleEventRenderer.IsSecondaryPanelMouseDown)
     {
         BattleEventRenderer.ShowPanelSelect(false);
     }
     BattleEventRenderer.IsSecondaryPanelMouseDown = false;
     BattleEventRenderer.DrawSecondaryPanel();
     BattleEventRenderer.DrawPanels();
 }
예제 #3
0
        private static void DrawPanels()
        {
            var cols         = 4;
            var startPoint   = new Point(10, 10);
            var margin       = 5;
            var optionsCount = 10;

            for (int panel = 0; panel < optionsCount; panel++)
            {
                var topLeft = new Point(startPoint.X + (panel % cols) * (40 + margin * 2), startPoint.Y + (panel / cols) * (32 + margin * 2));

                BattleEventRenderer.PanelSelectionRenderer.Draw(new Sprite
                {
                    Position = new Point(topLeft.X, topLeft.Y),
                    TexX     = 0,
                    TexY     = 32 * panel,
                    Width    = 40,
                    Height   = 32,
                    Texture  = $"battleobjects"
                }.WithTopLeftPosition(), 0);
            }

            {
                var selectedPanel = (int)(BattleEventRenderer.IsSettingPrimaryPanel ? BattleEventRenderer.CurrentEncounter.PrimaryPanel : BattleEventRenderer.CurrentEncounter.SecondaryPanel);
                var topLeft       = new Point(startPoint.X - margin + (selectedPanel % cols) * (40 + margin * 2), startPoint.Y - margin + (selectedPanel / cols) * (32 + margin * 2));
                var bottomRight   = new Point(topLeft.X + 40 + margin * 2, topLeft.Y + 32 + margin * 2);
                BattleEventRenderer.PanelSelectionRenderer.DrawQuad(new Quad
                {
                    A     = new Point(bottomRight.X, topLeft.Y),
                    B     = new Point(bottomRight.X, bottomRight.Y),
                    C     = new Point(topLeft.X, bottomRight.Y),
                    D     = new Point(topLeft.X, topLeft.Y),
                    Color = Color.FromArgb(125, Color.Wheat),
                    Type  = DrawType.Outline | DrawType.Fill
                }, 4);
            }

            var selectedPosition = BattleEventRenderer.PanelSelectionMouseClickConfirmPosition ?? BattleEventRenderer.PanelSelectionMouseClickPosition ?? BattleEventRenderer.PanelSelectionMousePosition;

            if (selectedPosition != null)
            {
                var highlightedPanel = (selectedPosition.Value.X / (40 + 2 * margin)) + cols * (selectedPosition.Value.Y / (32 + 2 * margin));
                if (highlightedPanel < optionsCount)
                {
                    var topLeft     = new Point(startPoint.X - margin + (highlightedPanel % cols) * (40 + margin * 2), startPoint.Y - margin + (highlightedPanel / cols) * (32 + margin * 2));
                    var bottomRight = new Point(topLeft.X + 40 + margin * 2, topLeft.Y + 32 + margin * 2);
                    var color       = BattleEventRenderer.PanelSelectionMouseClickPosition.HasValue ? Color.FromArgb(128, Color.DarkBlue) : Color.FromArgb(128, Color.AliceBlue);
                    BattleEventRenderer.PanelSelectionRenderer.DrawQuad(new Quad
                    {
                        A     = new Point(bottomRight.X, topLeft.Y),
                        B     = new Point(bottomRight.X, bottomRight.Y),
                        C     = new Point(topLeft.X, bottomRight.Y),
                        D     = new Point(topLeft.X, topLeft.Y),
                        Color = color,
                        Type  = DrawType.Outline | DrawType.Fill
                    }, 4);
                }
                if (BattleEventRenderer.PanelSelectionMouseClickConfirmPosition.HasValue && BattleEventRenderer.PanelSelectionMouseClickPosition.HasValue)
                {
                    var selectedPanel = (BattleEventRenderer.PanelSelectionMouseClickPosition.Value.X / (40 + 2 * margin)) + cols * (BattleEventRenderer.PanelSelectionMouseClickPosition.Value.Y / (32 + 2 * margin));
                    var confirmPanel  = (BattleEventRenderer.PanelSelectionMouseClickConfirmPosition.Value.X / (40 + 2 * margin)) + cols * (BattleEventRenderer.PanelSelectionMouseClickConfirmPosition.Value.Y / (32 + 2 * margin));
                    if (confirmPanel < optionsCount && confirmPanel == selectedPanel)
                    {
                        if (BattleEventRenderer.IsSettingPrimaryPanel)
                        {
                            BattleEventRenderer.CurrentEncounter.PrimaryPanel = (Panel.PANEL)highlightedPanel;
                        }
                        else
                        {
                            BattleEventRenderer.CurrentEncounter.SecondaryPanel = (Panel.PANEL)highlightedPanel;
                        }
                        BattleEventRenderer.DrawField();
                        BattleEventRenderer.DrawPrimaryPanel();
                        BattleEventRenderer.DrawSecondaryPanel();
                    }
                    BattleEventRenderer.PanelSelectionMouseClickPosition        = null;
                    BattleEventRenderer.PanelSelectionMouseClickConfirmPosition = null;
                }
            }
            BattleEventRenderer.PanelSelectionRenderer.Render();
        }
예제 #4
0
 private static void SecondaryPanelControl_MouseEnter(object sender, EventArgs e)
 {
     BattleEventRenderer.IsHoveringSecondaryPanel = true;
     BattleEventRenderer.DrawSecondaryPanel();
     BattleEventRenderer.DrawField();
 }
예제 #5
0
 private static void SecondaryPanelControl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     BattleEventRenderer.IsSecondaryPanelMouseDown  = true;
     ((System.Windows.Forms.Control)sender).Capture = false;
     BattleEventRenderer.DrawSecondaryPanel();
 }