FurnitureTool - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Tools

FurnitureTool Class

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 : TinyLife.Tools.Tool

Inheritance System.Object 🡒 Tool 🡒 FurnitureTool

Constructors

FurnitureTool.FurnitureTool() Constructor

Initializes a new instance of the System.Object class.

public FurnitureTool();

Methods

FurnitureTool.Closed() Method

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

public override void Closed();

FurnitureTool.Draw(GameTime, SpriteBatch) Method

This method is called every draw frame for the CurrentTool.
Note that this method is only called if the mouse is not hovering over any ui elements.

public override void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch);

Parameters

time Microsoft.Xna.Framework.GameTime
The game's time

batch Microsoft.Xna.Framework.Graphics.SpriteBatch
The sprite batch used for drawing

FurnitureTool.GetMouseCursor() Method

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

public override TinyLife.Uis.CursorType GetMouseCursor();

Returns

CursorType
The cursor type

FurnitureTool.InitBuildModeUi(Panel, Panel) Method

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

protected override void InitBuildModeUi(MLEM.Ui.Elements.Panel content, MLEM.Ui.Elements.Panel zoom);

Parameters

content MLEM.Ui.Elements.Panel
The main content panel. Add custom BuildModeButton(string, GenericCallback, DrawCallback, float, TextureRegion, LnCategory, IEnumerable<string>) instances here.

zoom MLEM.Ui.Elements.Panel
The zoom panel that contains ColorSelection(ColorScheme, Action<int>) and object previews

FurnitureTool.ShouldHighlightSelectedObject() Method

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

public override bool ShouldHighlightSelectedObject();

Returns

System.Boolean
Whether or not the selected object should be highlighted

FurnitureTool.Update(GameTime) Method

This method is called every update frame for the CurrentTool.

public override void Update(Microsoft.Xna.Framework.GameTime time);

Parameters

time Microsoft.Xna.Framework.GameTime
The game's time