flatworld.UI Class
Main class for showing UI on the map, like unit selections, movements and such. Has nothing to do with showing off-map data, like datagrams of the resources player has or other players status etc. Good examples for what this shows are: selected units-list, selection highlight (like a circle on the selected unit), unit movement. How it works is that this is basically the interface that shows what the UI theme class can (or must) implement.
Item Index
Methods
- add
- extend static
- fade
- play
- remove
- showSelections static
- showUnitMovement static
- stop
Methods
add
-
name
-
urls
-
options
Add a sound to be used.
Parameters:
Returns:
Created instance of sound
extend
-
newMethod
Adds a new method to this class
Parameters:
-
newMethod
StringName of the new method
fade
-
name
-
from
-
to
-
duration
Fade the sound in or out
Parameters:
Returns:
Promise that resolves after fade is complete
remove
-
name
Remove the sound from usage and memory
Parameters:
-
name
StringName / identifier of the sound to be removed
showSelections
-
objects
-
getDatas
-
{}
Responsible for showing what objects have been selected for inspection or if the player selects only one object, we hightlihgt it. For example if there are several objects in one tile on the map and the player needs to be able to select one specific unit on the stack. This is always defined in the UI theme-module Selecting one unit, highlight it, which means, e.g. bringing the unit on top on the map and showing selection circle around it.
Parameters:
-
objects
Array | ObjectObjects that have been selected.
-
getDatas
ObjectThis is an object made of functions, that get wanted data from the object. For example if you have objects name in object.data.specialData.name, then you have an object getDatas.name(), which retrieves this. This should be standardized maybe in MapDataManipulator, so that we can change the template between different game setups easier. Lets say if one game modification has different attributes than another, then maybe it should still have standard interface.
-
name
ObjectRetrieves object name
-
-
{}
ObjectExtra options
-
filters
MapDataManipulatorFilters objects
-
options
ObjectExtra options that are passed to the UITheme class
-
Returns:
showUnitMovement
-
options
Shows arrow or movement or what ever to indicate the selected unit is moving to the given location
Parameters:
-
options
ObjectExtra options. Like dropping a shadow etc.