Example #1
0
 public virtual void OnClick()
 {
     EditorUI.currentSlotGroup = this.GetContextOpt(Cursor.MouseX, Cursor.MouseY);
     EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup);
     EditorTools.UpdateHelperText();
     this.CloseMenu();
     DrawTracker.AttemptPlace((short)Cursor.TileGridX, (short)Cursor.TileGridY);
 }
Example #2
0
        private void AutoTiling()
        {
            if (EditorTools.tileTool is TileToolGround && (Systems.input.LocalKeyDown(Keys.LeftControl) || Systems.input.LocalKeyDown(Keys.RightControl)) && Cursor.LeftMouseState == Cursor.MouseDownState.Released)
            {
                this.IncrementTutorialStep();
                return;
            }

            if (EditorTools.tileTool is TileToolGround == false)
            {
                EditorTools.SetTileToolBySlotGroup((byte)SlotGroup.Ground);
            }
            this.SetTutorialNote(500, 170, "Auto-Tiling", "Hold the `control` key while pressing and holding the left mouse button to auto-tile. This can auto-tile large sections of ground at once.", DirRotate.Down);
        }
Example #3
0
 public void CheckTileToolKeyBinds(Keys keyPressed)
 {
     if (keyPressed == Keys.D1)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 0);
     }
     else if (keyPressed == Keys.D2)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 1);
     }
     else if (keyPressed == Keys.D3)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 2);
     }
     else if (keyPressed == Keys.D4)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 3);
     }
     else if (keyPressed == Keys.D5)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 4);
     }
     else if (keyPressed == Keys.D6)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 5);
     }
     else if (keyPressed == Keys.D7)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 6);
     }
     else if (keyPressed == Keys.D8)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 7);
     }
     else if (keyPressed == Keys.D9)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 8);
     }
     else if (keyPressed == Keys.D0)
     {
         EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, 9);
     }
 }
Example #4
0
        public void RunTick()
        {
            this.MouseOver = this.GetMouseOverState();
            if (this.MouseOver == UIMouseOverState.On)
            {
                UIComponent.ComponentWithFocus = this;
                FuncButton funcButton = null;

                // Identify which Bar Number is being highlighted:
                byte barIndex = this.GetBarIndex(Cursor.MouseX);

                // Check if a Function Button is highlighted:
                if (buttonMap.ContainsKey(barIndex))
                {
                    funcButton = buttonMap[barIndex];

                    // Draw the Tool Tip associated with the Function Button
                    UIHandler.RunToolTip(funcButton.title, funcButton.title, funcButton.description, UIPrimaryDirection.Top);
                }

                // Mouse was pressed
                if (Cursor.LeftMouseState == Cursor.MouseDownState.Clicked)
                {
                    // Clicked a Tile Tool
                    if (barIndex < 10)
                    {
                        EditorTools.SetTileToolBySlotGroup(EditorUI.currentSlotGroup, barIndex);
                    }

                    // Clicked a Function Button
                    if (funcButton != null)
                    {
                        funcButton.ActivateFuncButton();
                    }
                }
            }

            // If the Mouse just exited this component:
            else if (this.MouseOver == UIMouseOverState.Exited)
            {
                EditorTools.UpdateHelperText();                 // Update the Helper Text (since it may have changed from overlaps)
            }
        }