Class PlayModeTool
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
A dictionary that contains information about the PlayModeTool.StatType values that should be selectable for a given PersonLike type and AgeGroup combination.
public static readonly Dictionary<(Type, AgeGroup), PlayModeTool.StatType[]> AvailableStats
Field Value
- Dictionary<(Type, AgeGroup), PlayModeTool.StatType[]>
SelectablePersonTypes
A list that contains the PersonLike types that can be selected in the play mode tool. If a person type is not in this list, people of that type will still display as part of the household, but not be actively playable.
public static readonly List<Type> SelectablePersonTypes
Field Value
Properties
SelectedPerson
Stores the PersonLike that is currently selected
public PersonLike SelectedPerson { get; }
Property Value
SelectedStat
The PlayModeTool.StatType that is currently se
public PlayModeTool.StatType SelectedStat { get; }
Property Value
Methods
CanUndoRedo(bool)
Returns whether or not the UndoRedoStack can currently operate and thus, whether the Undo() or Redo() actions can be called.
public override bool CanUndoRedo(bool cursorOnUi)
Parameters
cursorOnUi
bool
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
SoundEffectThe 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
PersonLikeThe 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
GameTimeThe game's time
cursorOnUi
boolWhether 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)>