Table of Contents

Class PlayModeTool

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 PlayModeTool : Tool
Inheritance
PlayModeTool
Inherited Members
Extension Methods

Constructors

PlayModeTool()

public PlayModeTool()

Fields

AvailableStats

public static readonly Dictionary<(Type, AgeGroup), PlayModeTool.StatType[]> AvailableStats

Field Value

Dictionary<(Type, AgeGroup), PlayModeTool.StatType[]>

SelectablePersonTypes

public static readonly List<Type> SelectablePersonTypes

Field Value

List<Type>

Properties

SelectedPerson

Stores the PersonLike that is currently selected

public PersonLike SelectedPerson { get; }

Property Value

PersonLike

SelectedStat

The PlayModeTool.StatType that is currently se

public PlayModeTool.StatType SelectedStat { get; }

Property Value

PlayModeTool.StatType

Methods

CanUndoRedo()

Returns whether or not the UndoRedoStack can currently operate and thus, whether the Undo() or Redo() actions can be called.

public override bool CanUndoRedo()

Returns

bool

Whether the undo or redo commands can be used right now.

Closed()

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

public override void Closed()

Opened()

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

public override void Opened()

PlayEventSting(SoundEffect)

Plays an event sting sound effect with the EventStingVolume, additionally ducking the music for the duration of the sting.

public static bool PlayEventSting(SoundEffect sting)

Parameters

sting SoundEffect

The sting to play.

Returns

bool

Whether the sting was successfully played. If this is false, the EventStingVolume was not high enough to play a sting.

Reload()

Reloads the play mode tool's ui

public static void Reload()

SetSelectedPerson(PersonLike)

Sets the currently selected person to the given person and updates the UI accordingly.

public bool SetSelectedPerson(PersonLike person)

Parameters

person PersonLike

The person.

Returns

bool

Whether the person could be set. This is false if the selected person is already the given person, or if SelectablePersonTypes does not contain the person's type.

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

OnUpdateStatsView

An event that is invoked when the play mode tool's stats MLEM.Ui.Elements.Panel is updated. This occurs when a PlayModeTool.StatType tab is opened, or when a corresponding stat's information changes in a way that forces the panel to be refreshed. During this even't Pre phase, the previous content has not been removed from the MLEM.Ui.Elements.Panel yet.

public static event Action<(PersonLike Person, PlayModeTool.StatType Stat, Panel Panel, EventPhase Phase)> OnUpdateStatsView

Event Type

Action<(PersonLike Person, PlayModeTool.StatType Stat, Panel Panel, EventPhase Phase)>