MoveTool - Ellpeck/TinyLifeExampleMod Wiki

Original URL: https://github.com/Ellpeck/TinyLifeExampleMod/wiki/MoveTool

Tiny Life

TinyLife.Tools

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

Inheritance System.Object 🡒 Tool 🡒 MoveTool

Constructors

MoveTool.MoveTool() Constructor

Initializes a new instance of the System.Object class.

public MoveTool();

Methods

MoveTool.CanSaveOrSwitchModes() Method

Whether or not the game CanSaveOrSwitchModes() currently, while this tool is selected

public override bool CanSaveOrSwitchModes();

Returns

System.Boolean
Whether the game can be saved or mode switched right now

MoveTool.Closed() Method

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

public override void Closed();

MoveTool.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

MoveTool.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

MoveTool.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

MoveTool.Opened() Method

Called when this build tool is opened.
By default, this method initializes several settings and calls InitBuildModeUi(Panel, Panel).

public override void Opened();

MoveTool.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

MoveTool.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