Table of Contents

Class Menus

Namespace
TinyLife.Uis
Assembly
Tiny Life.dll

A set of static methods to deal with MLEM.Ui and in-game menus

public static class Menus
Inheritance
Menus
Inherited Members

Methods

GamepadHint(Anchor, Func<Options, Buttons>, Vector2, Vector2?, Func<bool>)

Returns a new image that displays information about what gamepad Microsoft.Xna.Framework.Input.Buttons can be pressed to invoke an action. This image is automatically hidden if gamepad controls are not currently being used, or if shouldHide returns true.

public static Image GamepadHint(Anchor anchor, Func<Options, Buttons> button, Vector2 positionOffset = default, Vector2? size = null, Func<bool> shouldHide = null)

Parameters

anchor Anchor

The anchor for the image.

button Func<Options, Buttons>

A function that returns the button that should be displayed.

positionOffset Vector2

The position offset for the image.

size Vector2?

The size of the image, or null for the image to be 12 pixels big.

shouldHide Func<bool>

A function that determines whether the hint should currently be hidden, or null to only hide it when gamepad controls are not currently being used.

Returns

Image

The created gamepad hint image.

MenuBackground(int, int, int, int)

Returns a MLEM.Textures.NinePatch that contains a menu background texture region, based on the given data.

public static NinePatch MenuBackground(int x, int y, int width = 1, int height = 1)

Parameters

x int

The x coordinate of the menu background section to return, which is expected to be between 0 and 1.

y int

The y coordinate of the menu background section to return, which is expected to be between 0 and 1.

width int

The width of the menu background section to return, which is expected to be between 1 and 2.

height int

The height of the menu background section to return, which is expected to be between 1 and 2.

Returns

NinePatch

A MLEM.Textures.NinePatch that contains a menu background texture region.

Transition(Action, Action, TransitionType, TransitionType, float, float, float, Color?)

Displays a screen transition that includes a fade out, an inbetween action, followed by a fade back in and an after action.

public static void Transition(Action inbetween = null, Action after = null, Menus.TransitionType outType = TransitionType.Swipe, Menus.TransitionType inType = TransitionType.Swipe, float outSpeed = 0.05, float inSpeed = 0.05, float waitInbetween = 0.15, Color? color = null)

Parameters

inbetween Action

The action that is invoked while the screen is faded out, or null to invoke no action.

after Action

The action that is invoked after the full fade routine completes, or null to invoke no action.

outType Menus.TransitionType

The Menus.TransitionType used for fading out.

inType Menus.TransitionType

The Menus.TransitionType used for fading in.

outSpeed float

The speed with which outType is displayed per frame.

inSpeed float

The speed with which inType is displayed per frame.

waitInbetween float

The amount of time to wait while the screen is faded out.

color Color?

The color that the fade should have, or null to use black.

Exceptions

InvalidOperationException

Thrown when a fade is already happening when this method is called.