ScreenObject - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Objects

ScreenObject Class

A furniture is an instance of a FurnitureType which is placed in the world, or in a Person's hand.
To register a custom furniture, use Register(TypeSettings).

public class ScreenObject : TinyLife.Objects.BreakableFurniture

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 MapObject 🡒 Furniture 🡒 BreakableFurniture 🡒 ScreenObject

Constructors

ScreenObject.ScreenObject(Guid, FurnitureType, int[], Map, Vector2) Constructor

Creates a new furniture instance.
By default, this is done using Construct(int[], Map, Vector2, Nullable<Guid>).

public ScreenObject(System.Guid id, TinyLife.Objects.FurnitureType type, int[] colors, TinyLife.World.Map map, Microsoft.Xna.Framework.Vector2 pos);

Parameters

id System.Guid
The id to apply to the created furniture instance

type FurnitureType
The type to create an instance of

colors System.Int32[]
The colors to apply to the furniture

map Map
The map to create the furniture on

pos Microsoft.Xna.Framework.Vector2
The position that the furniture should have

Properties

ScreenObject.IsOn Property

A property that determines whether this screen object is currently on.
A screen object is on if it has a current ScreenContent.

public bool IsOn { get; }

Property Value

System.Boolean

ScreenObject.ScreenContent Property

The current content of this screen object's screen.
The screen content set here determines the texture to display on this screen object's screen.
To set this value, use TurnOn(string) and TurnOff().

public string ScreenContent { get; set; }

Property Value

System.String

Methods

ScreenObject.Draw(GameTime, SpriteBatch, Vector2, Vector2, Nullable<Color>, Direction2, int[], float, bool, Furniture, AbstractSpot, float, bool) Method

Draws this furniture in the world with the given settings.
This is a more generalized version of Draw(GameTime, SpriteBatch, Vector2, Nullable<Color>)

public override void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Microsoft.Xna.Framework.Vector2 pos, Microsoft.Xna.Framework.Vector2 drawPos, System.Nullable<Microsoft.Xna.Framework.Color> overrideColor, MLEM.Misc.Direction2 rotation, int[] colors, float drawScale, bool pivot, TinyLife.Objects.Furniture parent, TinyLife.Objects.AbstractSpot parentSpot, float depthOffset, bool held);

Parameters

time Microsoft.Xna.Framework.GameTime
The game time

batch Microsoft.Xna.Framework.Graphics.SpriteBatch
The sprite batch to draw with

pos Microsoft.Xna.Framework.Vector2
The position, in world space, that the furniture is at

drawPos Microsoft.Xna.Framework.Vector2
The position, in draw space, to draw the furniture at

overrideColor System.Nullable<Microsoft.Xna.Framework.Color>
An optional color to override the default colors of the furniture

rotation MLEM.Misc.Direction2
The rotation of the furniture

colors System.Int32[]
The colors to draw the furniture with

drawScale System.Single
The scale to draw the furniture with

pivot System.Boolean
Whether or not to move the furniture by its texture's pivot point

parent Furniture
The object that this furniture is latched on to, or null if there is none

parentSpot AbstractSpot
The object spot that this furntiture is in, or null if there is none

depthOffset System.Single
A value that is added onto the calculated depth of the object

held System.Boolean
Whether or not this item is currently being held by a Person

ScreenObject.TurnOff() Method

Turns this screen object off

public void TurnOff();

ScreenObject.TurnOn(string) Method

Turns this screen object on, setting its ScreenContent to the given content.
The screen content set here determines the texture to display on this screen object's screen.

public void TurnOn(string screenContent);

Parameters

screenContent System.String