Class ChameleonTile


  • public class ChameleonTile
    extends Tile
    A chameleon tile can be used in chameleon mode, for visual purposes.
    • Field Detail

      • type

        public Tile.TileType type
        Tile variant the chameleon tile is morphed into.
      • text

        public java.lang.String text
        Text displayed above this tile.
    • Constructor Detail

      • ChameleonTile

        public ChameleonTile()
        Creates a coordinate less chameleon tile.
      • ChameleonTile

        public ChameleonTile​(CubeCoordinate coord)
        Creates a chameleon tile with coordinates.
        Parameters:
        coord - coordinate of the chameleon tile
      • ChameleonTile

        public ChameleonTile​(ChameleonTile other)
        Create a copy/clone of a house.
        Parameters:
        other - tile to clone
      • ChameleonTile

        public ChameleonTile​(CubeCoordinate coord,
                             org.json.JSONObject data)
        Creates a chameleon tile with a coordinate and extra json meta data.
        Parameters:
        coord - coordinate of the tile
        data - extra data
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from class: Tile
        Name of Tile in Api interface.
        Specified by:
        getName in class Tile
        Returns:
        api name of the tile
      • serializeData

        public org.json.JSONObject serializeData()
        Description copied from class: Tile
        Serializes extra Data of an Tile, to be send.
        Overrides:
        serializeData in class Tile
        Returns:
        null or JSONObject with at least a valid "type" field.
      • clone

        public Tile clone()
        Description copied from class: Tile
        Creates a clone of the tile.
        Specified by:
        clone in class Tile
        Returns:
        the new tile
      • withText

        public ChameleonTile withText​(java.lang.String text)
        Set debug text displayed above.. Is only effective when this instance is send to the game. e.g. via a place action. To change a tile, use ConfigureChameleonTileAction instead.
        Parameters:
        text - displayed text
        Returns:
        reference to this
      • withType

        public ChameleonTile withType​(Tile.TileType type)
                               throws java.lang.IllegalArgumentException
        Set tile type. Is only effective when this instance is send to the game. e.g. via a place action. To change a tile, use ConfigureChameleonTileAction instead.
        Parameters:
        type - Tile variant the chameleon tile should morph into.
        Returns:
        reference to this
        Throws:
        java.lang.IllegalArgumentException - gets thrown if this is not a valid tile type.
      • dataToString

        public java.lang.String dataToString()
        Description copied from class: Tile
        Can be used by tile to add internal data to `toString`. Returned string should start with: ", "
        Overrides:
        dataToString in class Tile
        Returns:
        additional data stringified