The class MacaoPage is not a class itself, but it is used to document the global properties and methods of the package core/storageManager.js.
Field Summary | |
---|---|
String | basePath This field keeps the path from the current page to the Macao base directory. It is strongly recommended to set this field before loading the Java Script libraries. |
Method Summary | |
---|---|
void | addInventoryItem(String inventoryName, String itemName, String itemTitle, String imageUrl, String itemSubtitle, float quantity)
Call this method to add an inventory item to the Storage Manager. |
void | clearInventory(String inventoryName)
Call this method to remove all items of an inventory from the Storage Manager. |
void | defResource(String resourceName, String language1Text, optional String language2Text)
Use this method to define the texts of a text resource in one or more languages. |
String | getBasePath()
Use this method to get the base path. |
Array | getInventoryItems(String inventoryName)
Call this method to get the definitions of all items of an inventory from the Storage Manager. |
String | getLanguageSM()
Call this method to get the actual language of the application. |
String | getPageName()
This method calculates the name of the page from the page's filename, by removing the extension. |
String | getParameterSM(String parameterName)
Call this method to get the value of a parameter, which is provided with the URL, which was used to open the page. |
Array | getParametersSM()
Call this method to get the parameters, which are provided with the URL. |
String | getResource(String resourceName, optional String defaultLanguageText, optional boolean nullIfUndefined)
Use this method to get the content of a text resource for the actual language. |
boolean | isDesignModeSM()
Call this method to check, if the design mode is active. |
void | openResourceExportWindow()
This method opens a dialog window to export the text resources. |
void | setBasePath(String path)
You may use this method to set the base path. |
void | setDesignModeSM(boolean active)
Call this method to set the design mode active or inactive. |
void | setLanguageSM(String language)
Call this method to set the actual language of the application. |
void | setResourceDefaultLanguage(String language)
This method sets the language, which is used by the parameter defaultLanguageText of the method getResource(). |
void | setResourceDefinitionLanguages(Array languagesArray)
This method sets the languages, which are used by the method defResource() to define resource texts. |
boolean | storageGetGameEvent(String eventName)
Call this method to get a game event from the storage manager. |
variant | storageGetValue(String valueName)
Call this method to get a stored value from the storage manager. |
void | storageSetGameEvent(String eventName, boolean setEvent)
Call this method to store a game event in the storage manager. |
void | storageSetValue(String valueName, variant value)
Call this method to store a value in the storage manager. |
Field Details |
---|
This field keeps the path from the current page to the Macao base directory. It is strongly recommended to set this field before loading the Java Script libraries.
The Macao base directory is defined as the directory, which contains the subdirectory named core. For example, if you have your HTML page file in the in the subdirectory "myapp", set this field to "../". If you have your page in the subdirectory "myapp/chapter1", set this field to "../../" and so on.
Method Details |
---|
Call this method to add an inventory item to the Storage Manager.
This method is used by the inventory controller to store its items to the Storage Manager. If you want to add an inventory item during the game, you should instead send an event calling to invoke the method MacaoInventory.addInventoryItem(). Call this method, if you want to initialize the inventory during the start of a new game.
If you call this method from a page, you should call the method MacaoPage.isStorageBlocked() to check, if the write access to the Storage Manager is allowed.
Call this method to remove all items of an inventory from the Storage Manager.
Call this method before adding items using the method addInventoryItem().
Use this method to define the texts of a text resource in one or more languages.
You may provide texts for as much languages as you like by providing more parameters. The text in the parameters has to fit the languages, which are defined using the method setResourceDefinitionLanguages(). You have to call that method first.
See defResource() and getResource() for descriptions and examples.
Use this method to get the base path.
The base path is the relative path between the location of the current page and the Macao base directory. Use this path, if you calculate an image source location. See also setBasePath() and basePath. See getBasePath() for an example.
Call this method to get the definitions of all items of an inventory from the Storage Manager.
Call this method to get the actual language of the application.
The language can be set with the URL, which is used to open the page containing the storage manager. Provide the language as the parameter "language". The default language is en (= English). The following URL defines the language de (= German) as the actual language.
http://www.mydomain.com/macao/myapp.html?language=de
This method calculates the name of the page from the page's filename, by removing the extension.
If the page has the filename "page1.html", then the method returns "page1".
Call this method to get the value of a parameter, which is provided with the URL, which was used to open the page.
Call this method to get the parameters, which are provided with the URL.
Use this method to get the content of a text resource for the actual language.
The actual language can be set using the method setLanguageSM() or the URL parameter language. See getResource() for a description.
Call this method to check, if the design mode is active.
This method opens a dialog window to export the text resources.
Use this dialog to create the source code for additional languages and the translations of additional resources. You can copy the source code to your page and fill in the translations. See also getResource() and defResource().
You may use this method to set the base path.
But it's recommended to set the base path before loading the first JavaScript package into the page. So you better set the variable basePath directly before loading this package. See basePath and getBasePath(). See getBasePath() for an example.
Call this method to set the design mode active or inactive.
By default the design mode is active.
When the design mode is active, the user can drag objects with the mouse while holding the Shift and Control key down. If the keys are hold down and the mouse is moved, the position of the mouse is displayed in the status bar. The user can also open the Road Editor hitting the key E, when the design mode is active.
Call this method to set the actual language of the application.
The default language is "en" for English.
This method sets the language, which is used by the parameter defaultLanguageText of the method getResource().
See getResource(). See getResource() for a description.
This method sets the languages, which are used by the method defResource() to define resource texts.
See also defResource(). See defResource() for a description.
Call this method to get a game event from the storage manager.
Call this method to get a stored value from the storage manager.
Call this method to store a game event in the storage manager.
Call this method to store a value in the storage manager.