Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EnumPropertyType

An enum that can be used for custom properties.

since

1.12

Hierarchy

Index

Constructors

constructor

Properties

defaultValue

defaultValue: PropertyValue

The default value for properties of this type.

isClass

isClass: boolean

Returns true if this is a ClassPropertyType.

isEnum

isEnum: boolean

Returns true if this is a EnumPropertyType.

name

name: string

Get or set the name of this type. Must be unique in the project.

storageType

storageType: StorageType

Get or set how this enum will be serialized in map and tileset files.

values

values: string[]

Get or set all possible display names for values in this enum.

Methods

addValue

  • addValue(value: string): void
  • Add a new value to this enum.

nameOf

  • Get the display name of an enum value by its index in values.

  • Get the display name of a property value that is of this enum type. For example, if you had a property called "biome" using a custom enum type on the current asset, you could get the name of the value with the following script:

    var biome = tiled.activeAsset.resolvedProperty('biome');
    var biomeType = tiled.project.findTypeByName(biome.typeName);
    var biomeName = biomeType.nameOf(biome);
    

Generated using TypeDoc