Table of Contents

Class CustomClassDefinition

Namespace
DotTiled
Assembly
DotTiled.dll

Represents a custom class definition in Tiled. Refer to the documentation of custom types to understand how they work.

public class CustomClassDefinition : HasPropertiesBase, IHasProperties, ICustomTypeDefinition
Inheritance
CustomClassDefinition
Implements
Inherited Members

Properties

Color

The color of the custom class inside the Tiled editor.

public Color Color { get; set; }

Property Value

Color

DrawFill

Whether the custom class should be drawn with a fill color.

public bool DrawFill { get; set; }

Property Value

bool

ID

The ID of the custom type.

public uint ID { get; set; }

Property Value

uint

Members

The members of the custom class, with their names, types and default values.

public List<IProperty> Members { get; set; }

Property Value

List<IProperty>

Name

The name of the custom type.

public required string Name { get; set; }

Property Value

string

UseAs

What the custom class can be used as, or rather, what types of objects can use it.

public CustomClassUseAs UseAs { get; set; }

Property Value

CustomClassUseAs

Methods

FromClass(Type)

Creates a new CustomClassDefinition from the specified class type.

public static CustomClassDefinition FromClass(Type type)

Parameters

type Type

The type of the class to create a custom class definition from.

Returns

CustomClassDefinition

A new CustomClassDefinition instance.

Exceptions

ArgumentException

Thrown when the specified type is not a class.

FromClass<T>()

Creates a new CustomClassDefinition from the specified constructible class type.

public static CustomClassDefinition FromClass<T>() where T : class, new()

Returns

CustomClassDefinition

A new CustomClassDefinition instance.

Type Parameters

T

The type of the class to create a custom class definition from.

FromClass<T>(Func<T>)

Creates a new CustomClassDefinition from the specified factory function of a class instance.

public static CustomClassDefinition FromClass<T>(Func<T> factory) where T : class

Parameters

factory Func<T>

The factory function that creates an instance of the class.

Returns

CustomClassDefinition

A new CustomClassDefinition instance.

Type Parameters

T

The type of the class to create a custom class definition from.

GetProperties()

The properties attached to the object.

public override IList<IProperty> GetProperties()

Returns

IList<IProperty>