LibraryItem class i- stores and manages a collection of LibraryItem objects organized in sub-libraries - those are map objects like Floor tiles, Furniture and Characters that can be placed on maps
1.0
© TheoWorlds.com, 2007-2009.
| com. | LibraryItem class i- stores and manages a collection of LibraryItem objects organized in sub-libraries - those are map objects like Floor tiles, Furniture and Characters that can be placed on maps |
| Variables | |
| _libraries | a 2D array that stores different libaries and their items first parametter is the unique library ID and the second is the ID of the item in this library this array of libaries stores arrays of LibraryItem objects -- the links to them -- LibraryItem to get to the information about a LibraryItem object (info about a map object) we use lib_arr[libID--1][libSymbolId--1] |
| _librariesInfo | we need those parametters for the Map Editor so we can display all the info in the preview panel |
| __instance | just one Library object can exist (Singleton). |
| _externalListeners_arr | external listeners subscribed to the “onEndParsing” event -- called when the libraries are loaded and parced |
| Functions | |
| getInstance | Singleton class |
| Library | constructor |
| getSymbolURL | |
| getLibraryItem | |
| getLibrary | returns an array with all the items of one sub--library. |
| getLibraryInfo | array of objects [{id:Number, url:String}] The libraries are located in the_libraries array, in order of their ID. |
| addLibrary | //OPT to pass or not the ID? |
| addListener | subscribes event listeners |
| removeListener | unsubscribes event listeners |
| dispatchEvent | |
| parseLibrary | parces the library XML file |
| addItem | adds at item to the libraries array |
| addLibraryInfo | ads the info about the loaded library to the libInfo_arr |
private var _libraries: Array
a 2D array that stores different libaries and their items first parametter is the unique library ID and the second is the ID of the item in this library this array of libaries stores arrays of LibraryItem objects -- the links to them -- LibraryItem to get to the information about a LibraryItem object (info about a map object) we use lib_arr[libID--1][libSymbolId--1]
public static function getLibraryInfo():Array
array of objects [{id:Number, url:String}] The libraries are located in the_libraries array, in order of their ID. So if it’s needed to get to the right library, we may need to go through 1000 items This way we access it as a database
a 2D array that stores different libaries and their items first parametter is the unique library ID and the second is the ID of the item in this library this array of libaries stores arrays of LibraryItem objects -- the links to them -- LibraryItem to get to the information about a LibraryItem object (info about a map object) we use lib_arr[libID--1][libSymbolId--1]
private var _libraries: Array
we need those parametters for the Map Editor so we can display all the info in the preview panel
private var _librariesInfo: Array
just one Library object can exist (Singleton).
private static var __instance: Library
external listeners subscribed to the “onEndParsing” event -- called when the libraries are loaded and parced
private var _externalListeners_arr: Array
Singleton class
public static function getInstance():Library
constructor
private function Library()
public static function getSymbolURL( libID: Number, libItemlID: Number ):String
public static function getLibraryItem( libID: Number, libItemID: Number ):LibraryItem
returns an array with all the items of one sub--library.
public static function getLibrary( libID: Number ):Array
array of objects [{id:Number, url:String}] The libraries are located in the_libraries array, in order of their ID.
public static function getLibraryInfo():Array
//OPT to pass or not the ID?
public function addLibrary( source ):Void
subscribes event listeners
public function addListener( o: Object ):Void
unsubscribes event listeners
public function removeListener( o ):Void
private function dispatchEvent( event: String ):Void
parces the library XML file
private function parseLibrary( success: Boolean, lib: XML, url: String ):Void
adds at item to the libraries array
private function addItem( libID: Number, itemID: Number, li: LibraryItem ):Void
ads the info about the loaded library to the libInfo_arr
private function addLibraryInfo( o: Object ):Void