Ejemplo n.º 1
0
        internal static void Select(UISlotTool slot)
        {
            ToolShape.Clear();
            if (UISlotImage.SelectedImage != null)
            {
                UISlotImage.SelectedImage.isSelect = false;
                UISlotImage.SelectedImage          = null;
            }

            if (slot == null)
            {
                if (SelectedSlot != null)
                {
                    SelectedSlot.isSelect = false;
                    SelectedSlot          = null;
                }
                SelectedTool = ToolType.None;
            }
            else if (SelectedSlot == slot)
            {
                SelectedSlot.isSelect = false;
                SelectedSlot          = null;
                SelectedTool          = ToolType.None;
            }
            else
            {
                if (SelectedSlot != null)
                {
                    SelectedSlot.isSelect = false;
                    SelectedSlot          = null;
                }
                SelectedTool          = slot.Tool;
                SelectedSlot          = slot;
                SelectedSlot.isSelect = true;
            }

            if (SelectedTool == ToolType.None)
            {
                if (backupMouseColor != null)
                {
                    Main.mouseColor        = (Color)backupMouseColor;
                    Main.MouseBorderColor  = (Color)backupMouseBorderColor;
                    backupMouseColor       = null;
                    backupMouseBorderColor = null;
                }
            }
            else
            {
                if (backupMouseColor == null && ModContent.GetInstance <TeraCADConfig>().isBorderCursorNone&& !SelectedTool.isSelect())
                {
                    backupMouseColor       = Main.mouseColor;
                    backupMouseBorderColor = Main.MouseBorderColor;
                    Main.MouseBorderColor  = Color.Transparent;
                }
                else if (SelectedTool.isSelect() && backupMouseColor != null)
                {
                    Main.mouseColor        = (Color)backupMouseColor;
                    Main.MouseBorderColor  = (Color)backupMouseBorderColor;
                    backupMouseColor       = null;
                    backupMouseBorderColor = null;
                }
            }

            if (SelectedTool == ToolType.ParallelCopy)
            {
                SettingUI.instance.Show = true;
            }
            else
            {
                SettingUI.instance.Show = false;
            }
        }