Table of Contents

Class Notifications

Namespace
TinyLife.Uis
Assembly
Tiny Life.dll

This class holds information about the current and past notifications that are displayed in the top center of the screen. To create custom notifications, use Add(MapObject, string, NotifType) or Add(string, string, NotifType).

public static class Notifications
Inheritance
Notifications
Inherited Members

Fields

MaxHistoryLength

The maximum amount of entries that can be in the notification history before the oldest entries start being deleted.

public const int MaxHistoryLength = 512

Field Value

int

Methods

Add(string, string, NotifType)

Adds a new notification related to nothing. The passed icon is displayed instead of an object.

public static void Add(string icon, string content, NotifType type = NotifType.Info)

Parameters

icon string

The icon that should be displayed in the notification

content string

The content of the notification. Should be localized using Localization

type NotifType

The type that this notification should have, which determines the color of its background

Add(MapObject, string, NotifType)

Adds a new notification related to the given map object. The passed object is also the one that will be displayed in the notification.

public static void Add(MapObject obj, string content, NotifType type = NotifType.Info)

Parameters

obj MapObject

The map object that this notification relates to

content string

The content of the notification. Should be localized using Localization

type NotifType

The type that this notification should have, which determines the color of its background

RegisterIcon(string, TextureRegion)

Registers an icon that can be used as a notification icon in Add(string, string, NotifType). Icons are registered so that notification instances remember them when the game is closed and loaded again.

public static void RegisterIcon(string name, TextureRegion texture)

Parameters

name string

The name of the icon to register.

texture TextureRegion

The texture that the icon should display.