TinyLifeExampleMod/Api/TinyLife/Utilities/Extensions.md

4 KiB

Extensions

Namespace: TinyLife > Utilities

Assembly: Tiny Life.dll

Summary

A set of extensions for dealing with various things required by Tiny Life.

Static Methods

Return Name Summary
Button AddHoverAnimation ( Button ) Adds a hover animation to the given MLEM.Ui.Elements.Button. The hover animation will automatically start playing when the mouse enters the button.
CompletionType BothCompleted ( CompletionType, Func<CompletionType> )
CanExecuteResult BothValid ( CanExecuteResult, Func<CanExecuteResult> )
Int32 GetDecorativeRating ( Quality ) Returns the decorative rating of an object with the given TinyLife.Skills.Quality. The returned values are as follows: TinyLife.Skills.Quality.Terrible: -2, TinyLife.Skills.Quality.Good: 1, TinyLife.Skills.Quality.Great: 1, TinyLife.Skills.Quality.Perfect: 2, TinyLife.Skills.Quality.Masterpiece: 3, Else: 0.
GenealogyType GetOpposite ( GenealogyType ) Returns the opposite of the given TinyLife.GenealogyType. The "opposite" is the relationship that the other partner of this TinyLife.GenealogyType will have. For example, the opposite of TinyLife.GenealogyType.Parent is TinyLife.GenealogyType.Child and vice versa.
Single GetPriceModifier ( Quality ) Returns a multiplier that an object's price should be multiplied with based on the given TinyLife.Skills.Quality.
Boolean IsVertical ( Direction2 ) Returns whether the passed direction is considered vertical. A vertical direction is MLEM.Misc.Direction2.Up and MLEM.Misc.Direction2.Down. All other directions return false.
T JsonCopy ( T ) Copies the given object using the TinyLife.SaveHandler.Serializer.
CompletionType OneCompleted ( CompletionType, Func<CompletionType> )
Direction2 RotateBy ( Direction2, Direction2, Direction2 ) Rotates the given direction by a given reference direction.
String ToLocalizedString ( Quality ) Returns a localized string for the given TinyLife.Skills.Quality.
Vector2 ToScreenPos ( Vector2, Boolean ) Converts the given world-space position into a draw-space position
String ToSellingPriceString ( Single ) Returns a string of the structure "$0.##" that displays the given value as a price in dollars.
Int32 ToWallSide ( Direction2 ) Returns an integer that represents the given MLEM.Misc.Direction2 as a side of a TinyLife.World.Wall. Specifically, MLEM.Misc.Direction2.Up and MLEM.Misc.Direction2.Left return 0, any other directions return 1.
Pose ToWorking ( Pose )
Vector2 ToWorldPos ( Vector2 ) Converts the given draw-space position into a world-space position