Example #1
0
        public void RunTick()
        {
            if (EditorTools.tileTool is TileTool == false)
            {
                return;
            }
            this.MouseOver = this.GetMouseOverState();

            if (this.MouseOver == UIMouseOverState.On)
            {
                UIComponent.ComponentWithFocus = this;
                UIHandler.RunToolTip("scroll", "Tile Scroller", "Use the Mouse Scroll to change between tile variants.", UIPrimaryDirection.Left);
            }

            // Mouse Scroll (if TileTool is selected as active tool)
            if (EditorTools.tileTool is TileTool == true)
            {
                sbyte scrollVal = Cursor.MouseScrollDelta;
                if (scrollVal == 0)
                {
                    return;
                }
                EditorTools.tileTool.CycleSubIndex(scrollVal);                 // Cycles the SubIndex by -1 or +1
                EditorTools.UpdateHelperText();
            }
        }
Example #2
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 #3
0
        public static void SetTempTool(FuncTool tool)
        {
            EditorTools.tempTool = tool;
            EditorTools.autoTool.ClearAutoTiles();

            // Update Helper Text (if applicable)
            EditorTools.UpdateHelperText();
        }
Example #4
0
        public static void SetTileTool(TileTool tool, byte index = 0)
        {
            EditorTools.tileTool = tool;
            EditorTools.funcTool = null;
            EditorTools.tempTool = null;
            EditorTools.autoTool.ClearAutoTiles();

            EditorUI.currentSlotGroup = EditorTools.tileTool.slotGroup;

            // Assign Index and SubIndex to TileTool (if applicable)
            EditorTools.tileTool.SetIndex(index);

            // Update Helper Text (if applicable)
            EditorTools.UpdateHelperText();
        }
Example #5
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)
            }
        }