Table of Contents

Class FurnitureTool

Namespace
TinyLife.Tools
Assembly
Tiny Life.dll

A tool is a type of game mode that is currently active. Tools are split up into the PlayModeTool and BuildTools, the latter of which holds all tools that can be found in the build menu.

public class FurnitureTool : Tool
Inheritance
FurnitureTool
Inherited Members
Extension Methods

Constructors

FurnitureTool()

public FurnitureTool()

Methods

CanPlaceForTooltip()

Returns whether or not the tool should currently be considered to be able to place objects for a tooltip displayed to the player.

public override CanPlaceResult CanPlaceForTooltip()

Returns

CanPlaceResult

A CanPlaceResult that represents whether the tool should be considered to be able to place objects.

Closed()

Called when this build tool is closed. By default, this method removes its elements from the ui.

public override void Closed()

Draw(GameTime, SpriteBatch, bool)

This method is called every draw frame for the CurrentTool. By default, this method invokes OnDraw.

public override void Draw(GameTime time, SpriteBatch batch, bool cursorOnUi)

Parameters

time GameTime

The game's time

batch SpriteBatch

The sprite batch used for drawing

cursorOnUi bool

Whether the cursor is currently covering the ui.

GetMouseCursor()

Returns the CursorType that this tool should currently display. By default, Default is returned.

public override CursorType GetMouseCursor()

Returns

CursorType

The cursor type

InitBuildModeUi(Panel, Panel)

Override this method to add custom content to the passed ui elements. By default, this method does nothing.

protected override void InitBuildModeUi(Panel content, Panel zoom)

Parameters

content Panel

The main content panel. Add custom BuildModeButton(string, GenericCallback, DrawCallback, float, TextureRegion, string, IEnumerable<string>, float?) instances here.

zoom Panel

The zoom panel that contains ColorSelection(ColorSettings, Action<int, int>, Func<int, int, bool>) and object previews

OpenTab(Tab)

Switch to the given tab in the furniture tool. Note that, if the furniture tool is not currently open, this method will still invoke Populate(Func<FurnitureType, bool>).

public void OpenTab(FurnitureTool.Tab tab)

Parameters

tab FurnitureTool.Tab

The tab to open.

Populate(Func<FurnitureType, bool>)

Populates this furniture tool's item list with all furniture types that match the given filter. Note that, if the furniture tool is not currently open, this method will populate the BuildContent panel regardless of what it currently contains.

public void Populate(Func<FurnitureType, bool> filter)

Parameters

filter Func<FurnitureType, bool>

The filter to match furniture items against.

ShouldHighlightSelectedObject(object)

Whether or not the SelectedObject should currently have a white highlight around it. This method defaults to return true if IsCursorOnUi() is false.

public override bool ShouldHighlightSelectedObject(object obj)

Parameters

obj object

The selected object, which can be a MapObject or a WallLike.

Returns

bool

Whether or not the selected object should be highlighted

Update(GameTime, bool)

This method is called every update frame for the CurrentTool. By default, this method updates the MousePos and invokes OnUpdate, and also manages the UndoRedoStack.

public override void Update(GameTime time, bool cursorOnUi)

Parameters

time GameTime

The game's time

cursorOnUi bool

Whether the cursor is currently covering the ui.

Events

OnBuildModeButton

An event that is invoked when this tool's build mode buttons are created using BuildModeButton(string, GenericCallback, DrawCallback, float, TextureRegion, string, IEnumerable<string>, float?). The button that is created is passed as the second argument, and can be modified based on the object type.

public static event Action<FurnitureType, Furniture, Button> OnBuildModeButton

Event Type

Action<FurnitureType, Furniture, Button>