Word Game Builder 2.0.1f2
Reference Manual
Classes | Public Types | Public Member Functions | Properties | List of all members
LetterTile Class Reference

A standard letter tile. Includes support for selection, wildcard tiles, multiple colors, input, and state querying. More...

+ Inheritance diagram for LetterTile:
+ Collaboration diagram for LetterTile:

Classes

class  ColorInfo
 Represents color information for a letter tile. More...
 
class  DisplayInfo
 Controls additional display settings for a letter tile. More...
 
class  SelectionInfo
 Represents selection information for a letter tile. More...
 
class  TileColor
 Represents a set of colors for a tile. Tiles have both a foreground and background color. More...
 
class  TileStateColorGroup
 Represents a group of colors for different tile states. More...
 
class  TweenInfo
 Controls tween settings for a letter tile. More...
 

Public Types

enum  DistanceSpace { Pixel, Local, World }
 Controls how a tile's distance is calculated for selection. More...
 
enum  LetterTileChange {
  NoChange, Enabled, Disabled, Selected,
  Deselected, Hovered, Unhovered, LetterAndScoreChanged,
  ScoreChanged, ColorTweenOnly
}
 The type of change that invoked a tile change event. More...
 
enum  SelectionMode { None, SelectOnPress, SelectOnClick }
 Controls how a tile is selected. More...
 

Public Member Functions

bool CanSelectTile (IList< ILetterTile > tiles, out bool shouldDeselect)
 Returns true if this tile can be selected based on a list of currently selected tiles. More...
 
bool CanSelectTile (IWordGamePlayer player, out bool shouldDeselect)
 Returns true if the specified player can select this tile. More...
 
void ChangeDefaultLetter (Letter letter)
 Changes the default letter on a tile. More...
 
void ChangeDefaultLetter (string letterString)
 Changes the letter on a tile, using the specified language. More...
 
void ChangeDefaultLetter (string letterString, WordGameLanguage language)
 Changes the letter on a tile, using the specified language. More...
 
bool DeselectTile (IList< ILetterTile > tiles)
 Deselects the tile from a list of currently selected tiles, obeying rules for tile selection. More...
 
bool DeselectTile (IWordGamePlayer player)
 Deselects the tile for a player, obeying rules for tile selection. More...
 
void DespawnTile ()
 This should control tile visibility, colliders, and triggers. More...
 
void ForceDeselectTile ()
 Deselects the tile, ignoring tile selection rules. More...
 
void ForceSelectTile ()
 Selects the tile, ignoring tile selection rules. More...
 
void ModifyTileSelection (IList< ILetterTile > tiles)
 Modifies a list of selected tiles to include/remove the current tile, based on tile selection rules. More...
 
void RemoveWildcard ()
 Remove the wildcard letter on a tile. More...
 
void ResetPointValue ()
 Resets the point value of the tile to the default. More...
 
bool SelectTile (IList< ILetterTile > tiles)
 Selects the tile from a list of currently selected tiles, obeying rules for tile selection. More...
 
bool SelectTile (IWordGamePlayer player)
 Selects the tile for a player, obeying rules for tile selection. More...
 
void SetPointMultiplier (float multiplier)
 Sets the point multiplier of a letter tile. More...
 
void SetWildcard (Letter letter)
 Sets the wildcard letter on a tile. More...
 
void SetWildcard (Letter letter, int score)
 Sets the wildcard letter on a tile, and changes its score to the specified score. More...
 
void SimulateClickInput ()
 Simulates a tile click action from user input. More...
 
void SimulateHoverInput (bool isOver)
 Simulates a tile hover action from user input. More...
 
void SimulateInput ()
 Simulates tile selection/deselection event from user input (either a press or a click). More...
 
void SimulatePressInput (bool isPressed)
 Simulates a tile press action from user input. More...
 
void SpawnTile ()
 This should control tile visibility, colliders, and triggers. More...
 
- Public Member Functions inherited from WGBBase
GetComponentFromInterface< T > ()
 Gets a component from its interface type. More...
 
GetComponentInChildrenFromInterface< T > ()
 Gets a component from its interface type, searching through this GameObject and all children. More...
 
T[] GetComponentsFromInterface< T > ()
 Gets all components from its interface type. More...
 
T[] GetComponentsInChildrenFromInterface< T > ()
 Gets all components from its interface type, searching through this GameObject and all children. More...
 
- Public Member Functions inherited from IMonoBehaviour
void CancelInvoke ()
 Cancels all Invoke calls on this MonoBehaviour. More...
 
void CancelInvoke (string methodName)
 Cancels all Invoke calls with name methodName on this behaviour. More...
 
int GetInstanceID ()
 Returns the instance id of the object. More...
 
void Invoke (string methodName, float time)
 Invokes the method methodName in time seconds. More...
 
void InvokeRepeating (string methodName, float time, float repeatRate)
 Invokes the method methodName in time seconds. More...
 
bool IsInvoking ()
 Is any invoke pending on this MonoBehaviour? More...
 
bool IsInvoking (string methodName)
 Is any invoke on methodName pending? More...
 
Coroutine StartCoroutine (IEnumerator routine)
 Starts a coroutine. More...
 
Coroutine StartCoroutine (string methodName)
 Starts a coroutine named methodName. More...
 
Coroutine StartCoroutine (string methodName, object value)
 Starts a coroutine named methodName. More...
 
void StopAllCoroutines ()
 Stops all coroutines running on this behaviour. More...
 
void StopCoroutine (string methodName)
 Stops all coroutines named methodName running on this behaviour. More...
 
string ToString ()
 Returns the name of the game object. More...
 

Properties

ColorInfo colorInfo [get, set]
 Gets or sets the color information. More...
 
Color currentBackgroundColor [get]
 The current background color for the tile. More...
 
Color currentBackgroundColorRaw [get]
 The current background color for the tile, in raw form (without tweening). More...
 
LetterTileChange currentChange [get, set]
 Gets the current change state. This is only set during onTileChange. More...
 
Letter currentLetter [get]
 The current letter represented by the tile. More...
 
string currentLetterLabel [get]
 The current letter label for the tile. More...
 
int currentPointValue [get]
 The current point value of the tile. More...
 
string currentScoreLabel [get]
 The current score label for the tile. More...
 
Color currentTextColor [get]
 The current text color for the tile. More...
 
Color currentTextColorRaw [get]
 The current text color for the tile, in raw form (without tweening). More...
 
Letter defaultLetter [get]
 The letter represented by the tile. More...
 
int defaultPointValue [get]
 The default point value of the tile. More...
 
DisplayInfo displayInfo [get, set]
 Gets or sets additional display information. More...
 
bool isActive [get]
 Is the tile currently active (spawned)? More...
 
bool isBlank [get]
 Is the current tile blank !(letter.hasValue || wildcardLetter.hasValue)? More...
 
bool isBonus [get]
 Is the current tile in a bonus state (currentPointValue > defaultPointValue)? More...
 
bool isOver [get]
 Is the current tile being hovered over? More...
 
bool isPenalty [get]
 Is the current tile in a penalty state (currentPointValue < defaultPointValue)? More...
 
bool isSelected [get]
 Is the current tile selected? More...
 
bool isWildcard [get]
 Is the current tile a wildcard (wildcardLetter.hasValue)? More...
 
WGBEvent onTileChange [get, set]
 This event fires when a tile has changed. More...
 
WGBEvent onTileSelect [get, set]
 This event fires when a tile has been selected or deselected, and can be used to override selection. More...
 
WGBEvent onTileSpawn [get, set]
 This event fires when a tile is spawned or despawned. More...
 
SelectionInfo selectionInfo [get, set]
 Gets or sets the selection information. More...
 
TweenInfo tweenInfo [get, set]
 Gets or sets tweening information. More...
 
ColorInfo wildcardColorInfo [get, set]
 Gets or sets the wildcard color information. More...
 
Letter wildcardLetter [get]
 The wildcard letter represented by the tile. More...
 
- Properties inherited from WGBBase
object userData [get, set]
 Additional user data associated with this object. This is unused by default. More...
 
- Properties inherited from ISelectableLetterTile
bool isSelected [get]
 Is this tile currently selected? More...
 
WGBEvent onTileSelect [get, set]
 This event should fire when a tile is selected or deselected and can be used to override a selection. More...
 
- Properties inherited from ILetterTile
Letter currentLetter [get]
 The current letter represented by the tile. More...
 
int currentPointValue [get]
 The current point value of the tile. More...
 
Letter defaultLetter [get]
 The default letter represented by the tile. More...
 
int defaultPointValue [get]
 The default point value of the tile. More...
 
bool isActive [get]
 Is the tile currently active (spawned)? More...
 
WGBEvent onTileChange [get, set]
 This event should fire when a tile's display should change in any way. More...
 
WGBEvent onTileSpawn [get, set]
 This event should fire when a tile is spawned or despawned. More...
 
Letter wildcardLetter [get]
 The wildcard letter represented by the tile. More...
 
- Properties inherited from IMonoBehaviour
bool enabled [get, set]
 Enabled Behaviours are Updated, disabled Behaviours are not. More...
 
GameObject gameObject [get]
 The game object this component is attached to. A component is always attached to a game object. More...
 
HideFlags hideFlags [get, set]
 Should the object be hidden, saved with the scene or modifiable by the user? More...
 
string name [get, set]
 The name of the object. More...
 
string tag [get, set]
 The tag of this game object. More...
 
Transform transform [get]
 The Transform attached to this GameObject. A component is always attached to a transform. More...
 
object userData [get, set]
 Additional user data associated with this object. This is unused by default. More...
 
- Properties inherited from ILetterTileDisplay
Color currentBackgroundColor [get]
 The current background color for the tile. More...
 
string currentLetterLabel [get]
 The current letter label for the tile. More...
 
string currentScoreLabel [get]
 The current score label for the tile. More...
 
Color currentTextColor [get]
 The current text color for the tile. More...
 
bool shouldAnimate [get]
 Returns true if a tile should animate. This should only be set during change events. More...
 
bool shouldChangeColor [get]
 Returns true if a tile should change color. This should only be set during change events. More...
 
bool shouldChangeLabel [get]
 Returns true if a tile should change any label text. This should only be set during change events. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from WGBBase
static T FindObjectOfTypeFromInterface< T > ()
 Finds the first object of interface type T. More...
 
static T[] FindObjectsOfTypeFromInterface< T > ()
 Finds all objects of interface type T. More...
 
static T InstantiateFromInterface< T > (T original)
 Instantiate a GameObject from interface type T. More...
 
static T InstantiateFromInterface< T > (T original, Vector3 position, Quaternion rotation)
 Instantiate a GameObject from interface type T at the specified position and rotation. More...
 
static void Log (object message, string prefix, string type)
 Logs a prefixed message. More...
 
static void Log (object message, string prefix, string type, Object context)
 Logs a prefixed message, with context. More...
 
static void LogError (object message, string prefix, string type)
 Logs a prefixed erorr. More...
 
static void LogError (object message, string prefix, string type, Object context)
 Logs a prefixed exception, with context. More...
 
static void LogException (System.Exception ex)
 Logs an exception. More...
 
static void LogException (System.Exception ex, Object context)
 Logs an exception, with context. More...
 
static void LogWarning (object message, string prefix, string type)
 Logs a prefixed warning. More...
 
static void LogWarning (object message, string prefix, string type, Object context)
 Logs a prefixed warning, with context. More...
 

Detailed Description

A standard letter tile. Includes support for selection, wildcard tiles, multiple colors, input, and state querying.

Actual display of the letter tiles are handled by other scripts.

Member Enumeration Documentation

enum DistanceSpace
strong

Controls how a tile's distance is calculated for selection.

Distance can be calculated in either pixel, local, or world spcace.

Enumerator
Pixel 

Calculate tile distances in pixel space, relative to a reference camera.

Local 

Calculate tile distances in local space.

World 

Calculate tile distances in world space.

enum LetterTileChange
strong

The type of change that invoked a tile change event.

Enumerator
NoChange 

No change has happened. This will never be set during a tile change event.

Enabled 

The tile was enabled.

Disabled 

The tile was disabled.

Selected 

The tile was selected.

Deselected 

The tile was deselected.

Hovered 

The tile was hovered over.

Unhovered 

The tile is no longer hovered over.

LetterAndScoreChanged 

Both the letter and score has changed.

ScoreChanged 

The score has changed.

ColorTweenOnly 

The tile is currently tweening a color and no other change has happened.

enum SelectionMode
strong

Controls how a tile is selected.

Enumerator
None 

The tile should never be selected, unless SelectTile is called directly.

SelectOnPress 

The tile should be selected on press events.

SelectOnClick 

The tile should be selected on click events.

Member Function Documentation

bool CanSelectTile ( IList< ILetterTile tiles,
out bool  shouldDeselect 
)
inline

Returns true if this tile can be selected based on a list of currently selected tiles.

Parameters
tilesA list representing currently selected tiles.
shouldDeselectIf true, this tile should be deselected.
Returns
true if the tile can be selected, otherwise false

Implements ISelectableLetterTile.

bool CanSelectTile ( IWordGamePlayer  player,
out bool  shouldDeselect 
)
inline

Returns true if the specified player can select this tile.

Parameters
playerThe player to check, to see if this tile can be selected.
shouldDeselectIf true, this tile should be deselected.
Returns
true if the tile can be selected, otherwise false

Implements ISelectableLetterTile.

void ChangeDefaultLetter ( Letter  letter)
inline

Changes the default letter on a tile.

Parameters
letterThe new default letter to assign to the tile.

Changing the default letter will also reset the default score.

Implements ILetterTile.

void ChangeDefaultLetter ( string  letterString)
inline

Changes the letter on a tile, using the specified language.

Parameters
letterStringThe display text of the letter to change to.
void ChangeDefaultLetter ( string  letterString,
WordGameLanguage  language 
)
inline

Changes the letter on a tile, using the specified language.

Parameters
letterStringThe display text of the letter to change to.
languageThe language to use.
bool DeselectTile ( IList< ILetterTile tiles)
inline

Deselects the tile from a list of currently selected tiles, obeying rules for tile selection.

Parameters
tilesA list of tiles to modify.
Returns
true if the operation was successful; otherwise false.

Implements ISelectableLetterTile.

bool DeselectTile ( IWordGamePlayer  player)
inline

Deselects the tile for a player, obeying rules for tile selection.

Parameters
playerThe player to check, to see if this tile can be deselected.
Returns
true if the operation was successful; otherwise false.

Implements ISelectableLetterTile.

void DespawnTile ( )
inline

This should control tile visibility, colliders, and triggers.

Implements ILetterTile.

void ForceDeselectTile ( )
inline

Deselects the tile, ignoring tile selection rules.

Implements ISelectableLetterTile.

void ForceSelectTile ( )
inline

Selects the tile, ignoring tile selection rules.

Implements ISelectableLetterTile.

void ModifyTileSelection ( IList< ILetterTile tiles)
inline

Modifies a list of selected tiles to include/remove the current tile, based on tile selection rules.

Parameters
tilesA list of tiles to modify.

Selecting a tile would add to the list, while deselecting a tile would remove the tile from the list. Other tiles may also be modified.

Implements ISelectableLetterTile.

void RemoveWildcard ( )
inline

Remove the wildcard letter on a tile.

Implements ILetterTile.

void ResetPointValue ( )
inline

Resets the point value of the tile to the default.

bool SelectTile ( IList< ILetterTile tiles)
inline

Selects the tile from a list of currently selected tiles, obeying rules for tile selection.

Parameters
tilesA list of tiles to modify.
Returns
true if the operation was successful; otherwise false.

Implements ISelectableLetterTile.

bool SelectTile ( IWordGamePlayer  player)
inline

Selects the tile for a player, obeying rules for tile selection.

Parameters
playerThe player to check, to see if this tile can be selected.
Returns
true if the operation was successful; otherwise false.

Implements ISelectableLetterTile.

void SetPointMultiplier ( float  multiplier)
inline

Sets the point multiplier of a letter tile.

Parameters
multiplierThe multiplier to apply.

Changes the currentPointValue.

void SetWildcard ( Letter  letter)
inline

Sets the wildcard letter on a tile.

Parameters
letterThe letter to set as the wildcard letter.

Implements ILetterTile.

void SetWildcard ( Letter  letter,
int  score 
)
inline

Sets the wildcard letter on a tile, and changes its score to the specified score.

Parameters
letterThe letter to set as the wildcard letter.
scoreThe score to set for the wildcard tile.

Implements ILetterTile.

void SimulateClickInput ( )
inline

Simulates a tile click action from user input.

Implements ILetterTileInput.

void SimulateHoverInput ( bool  isOver)
inline

Simulates a tile hover action from user input.

Parameters
isOverIf true, the user has started hovering over the tile. If false, the tile is no longer being hovered over.

Implements ILetterTileInput.

void SimulateInput ( )
inline

Simulates tile selection/deselection event from user input (either a press or a click).

+ Here is the call graph for this function:

void SimulatePressInput ( bool  isPressed)
inline

Simulates a tile press action from user input.

Parameters
isPressedIf true, the tile has just been pressed down. If false, the tile has just been released.

Implements ILetterTileInput.

void SpawnTile ( )
inline

This should control tile visibility, colliders, and triggers.

Implements ILetterTile.

Property Documentation

ColorInfo colorInfo
getset

Gets or sets the color information.

Color currentBackgroundColor
get

The current background color for the tile.

Implements ILetterTileDisplay.

Color currentBackgroundColorRaw
get

The current background color for the tile, in raw form (without tweening).

LetterTileChange currentChange
getset

Gets the current change state. This is only set during onTileChange.

Letter currentLetter
get

The current letter represented by the tile.

Implements ILetterTile.

string currentLetterLabel
get

The current letter label for the tile.

Implements ILetterTileDisplay.

int currentPointValue
get

The current point value of the tile.

Implements ILetterTile.

string currentScoreLabel
get

The current score label for the tile.

Implements ILetterTileDisplay.

Color currentTextColor
get

The current text color for the tile.

Implements ILetterTileDisplay.

Color currentTextColorRaw
get

The current text color for the tile, in raw form (without tweening).

Letter defaultLetter
get

The letter represented by the tile.

Implements ILetterTile.

int defaultPointValue
get

The default point value of the tile.

Implements ILetterTile.

DisplayInfo displayInfo
getset

Gets or sets additional display information.

bool isActive
get

Is the tile currently active (spawned)?

Implements ILetterTile.

bool isBlank
get

Is the current tile blank !(letter.hasValue || wildcardLetter.hasValue)?

bool isBonus
get

Is the current tile in a bonus state (currentPointValue > defaultPointValue)?

bool isOver
get

Is the current tile being hovered over?

bool isPenalty
get

Is the current tile in a penalty state (currentPointValue < defaultPointValue)?

bool isSelected
get

Is the current tile selected?

Implements ISelectableLetterTile.

bool isWildcard
get

Is the current tile a wildcard (wildcardLetter.hasValue)?

WGBEvent onTileChange
getset

This event fires when a tile has changed.

This event will fire if any of the following changes:

  • Tile enabled/disabled
  • Tile selected/deselected
  • Tile hovered/unhovered
  • Tile letter or score changed
  • Tile wildcard letter or score changed
  • Each frame during any color tweening action

Variables set:

  • WGBEvent.currentLanguage
  • WGBEvent.currentLetterTile

Implements ILetterTile.

WGBEvent onTileSelect
getset

This event fires when a tile has been selected or deselected, and can be used to override selection.

This event is fired before onTileChange. Overriding a selection will cancel the change event.

Variables set:

  • WGBEvent.currentLanguage
  • WGBEvent.currentLetterTile

Implements ISelectableLetterTile.

WGBEvent onTileSpawn
getset

This event fires when a tile is spawned or despawned.

Variables set:

  • WGBEvent.currentLanguage
  • WGBEvent.currentLetterTile

Implements ILetterTile.

SelectionInfo selectionInfo
getset

Gets or sets the selection information.

TweenInfo tweenInfo
getset

Gets or sets tweening information.

ColorInfo wildcardColorInfo
getset

Gets or sets the wildcard color information.

Letter wildcardLetter
get

The wildcard letter represented by the tile.

Implements ILetterTile.