TinyLifeExampleMod/Api/TinyLife/Tools/Tool.md

4.7 KiB

Tool

Namespace: TinyLife > Tools

Assembly: Tiny Life.dll

Summary

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

Constructors

Name Summary
Tool ( TextureRegion, Boolean ) Creates a new tool with the given settings

Fields

Type Name Summary
Boolean DisplayAsTab Whether or not this tool should be displayed as a tab (like the TinyLife.Tools.Tool.RemoveTool) or a button in the build menu
TextureRegion Texture The texture region that should be used to display this tool in the build menu

Methods

Return Name Summary
Boolean CanSaveOrSwitchModes ( ) Whether or not the game TinyLife.GameImpl.CanSaveOrSwitchModes currently, while this tool is selected
void Closed ( ) Called when this build tool is closed. By default, this method removes its elements from the ui.
void Draw ( GameTime, SpriteBatch ) This method is called every draw frame for the TinyLife.GameImpl.CurrentTool. Note that this method is only called if the mouse is not hovering over any ui elements.
Nullable<WallDisplay> ForceWallsUp ( ) Returns whether the TinyLife.WallDisplay should be forcibly changed by this tool. If it shouldn't be changed, null should be returned. Otherwise, the required TinyLife.WallDisplay should be returned.
CursorType GetMouseCursor ( ) Returns the TinyLife.Uis.CursorType that this tool should currently display. By default, TinyLife.Uis.CursorType.Default is returned.
void Opened ( ) Called when this build tool is opened. By default, this method initializes several settings and calls TinyLife.Tools.Tool.InitBuildModeUi(MLEM.Ui.Elements.Panel,MLEM.Ui.Elements.Panel).
Boolean ShouldHighlightSelectedObject ( ) Whether or not the TinyLife.Tools.Tool.SelectedObject should currently have a white highlight around it. This method defaults to return true if TinyLife.GameImpl.IsMouseOnUi is false.
void Update ( GameTime ) This method is called every update frame for the TinyLife.GameImpl.CurrentTool.

Static Fields

Type Name Summary
List<Tool> BuildTools A set of TinyLife.Tools.Tool instances that can be activated using the build mode menu. All tools in this list are automatically added to the menu.
MoveTool MoveTool The TinyLife.Tools.Tool.MoveTool singleton
PlayModeTool PlayModeTool The TinyLife.Tools.Tool.PlayModeTool singleton, which is activated when build mode is inactive.
RemoveTool RemoveTool The TinyLife.Tools.Tool.RemoveTool singleton, which is activated using the Remove tab in the build menu or by holding the control key.

Static Methods

Return Name Summary
Button BuildModeButton ( String, GenericCallback, DrawCallback, Single, TextureRegion, LnCategory, IEnumerable<String> )
Group ColorSelection ( ColorScheme, Action<Int32> ) Creates a new MLEM.Ui.Elements.Group that resembles a set of color selection buttons. This is used by TinyLife.Uis.CharacterCreator, as well as tools like the TinyLife.Tools.FurnitureTool.
Boolean IsOnLot ( Point ) Returns whether or not the passed position is on the currently edited lot (TinyLife.GameImpl.CurrentLot)