Drag[en]gine Script Module DragonScript
1.23
|
Set of quick use slots holding elements to quickly use if activated. More...
Public Member Functions | |
void | forEachNonEmptySlot (Block ablock) |
Visit non-empty slots with block. More... | |
void | forEachSlot (Block ablock) |
Visit slots with block. More... | |
Element | getItem (int index) |
Item from indexed slot. More... | |
int | getSlotCount () |
Count of slots. More... | |
int | indexOfNextFreeSlot () |
Index of next free slot or -1 if all are full. More... | |
int | indexOfSlotWith (Element item) |
Index of slot item is located in or -1 if absent. More... | |
QuickUseManager | new (int slotCount) |
Create quick use manager. More... | |
void | readFromFile (PersistencyEnvironment env, FileReader reader, ElementResolver elementResolver) |
Read slots from file. More... | |
void | removeItemIfPresent (Element item) |
Remove item if present in any slots. More... | |
void | setItem (int index, Element item) |
Set item in slot. More... | |
void | setSlotCount (int count) |
Set count of slots. More... | |
void | writeToFile (PersistencyEnvironment env, FileWriter writer) |
Write slots to file. More... | |
Set of quick use slots holding elements to quickly use if activated.
void Dragengine.Utils.QuickUseManager.forEachNonEmptySlot | ( | Block | ablock | ) |
Visit non-empty slots with block.
Block is called for each slot with arguments "int slot" and "Element element".
void Dragengine.Utils.QuickUseManager.forEachSlot | ( | Block | ablock | ) |
Visit slots with block.
Block is called for each slot with arguments "int slot" and "Element element". Element can be null if slot is empty.
Element Dragengine.Utils.QuickUseManager.getItem | ( | int | index | ) |
Item from indexed slot.
int Dragengine.Utils.QuickUseManager.getSlotCount | ( | ) |
Count of slots.
int Dragengine.Utils.QuickUseManager.indexOfNextFreeSlot | ( | ) |
Index of next free slot or -1 if all are full.
int Dragengine.Utils.QuickUseManager.indexOfSlotWith | ( | Element | item | ) |
Index of slot item is located in or -1 if absent.
QuickUseManager Dragengine.Utils.QuickUseManager.new | ( | int | slotCount | ) |
Create quick use manager.
void Dragengine.Utils.QuickUseManager.readFromFile | ( | PersistencyEnvironment | env, |
FileReader | reader, | ||
ElementResolver | elementResolver | ||
) |
Read slots from file.
The number of slots is not saved. If you need variable slot count you have to restore the correct slot number before calling readFromFile() yourself.
void Dragengine.Utils.QuickUseManager.removeItemIfPresent | ( | Element | item | ) |
Remove item if present in any slots.
void Dragengine.Utils.QuickUseManager.setItem | ( | int | index, |
Element | item | ||
) |
Set item in slot.
Can be null to clear the slot. If item is not null and it is already in another slot it is moved.
void Dragengine.Utils.QuickUseManager.setSlotCount | ( | int | count | ) |
Set count of slots.
void Dragengine.Utils.QuickUseManager.writeToFile | ( | PersistencyEnvironment | env, |
FileWriter | writer | ||
) |
Write slots to file.
The number of slots is not saved. If you need variable slot count you have to restore the correct slot number before calling readFromFile() yourself.