Difference between revisions of "Cloud Global"
From Virtual World Web Wiki
(Documentation for the Cloud Global class) |
(Documentation for the Cloud Global class) |
||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
The Cloud JavaScript global object is available from server world scripts and is the main entry point for the GameCloud functionality. | The Cloud JavaScript global object is available from server world scripts and is the main entry point for the GameCloud functionality. | ||
− | * This is a JavaScript | + | * This is a JavaScript global object named '''Cloud''' |
===Remarks <nowiki>[</nowiki>[{{fullurl:Cloud Global Remarks|action=edit}} edit]<nowiki>]</nowiki>=== | ===Remarks <nowiki>[</nowiki>[{{fullurl:Cloud Global Remarks|action=edit}} edit]<nowiki>]</nowiki>=== | ||
− | {{:Cloud Global Remarks}} | + | {{#ifexist:Cloud Global Remarks|{{:Cloud Global Remarks}}|}} |
===Methods=== | ===Methods=== | ||
+ | :{{CSharp|EngagementExtended CreateEngagement()}} | ||
+ | :: | ||
+ | ::Creates a new engagement which wraps a state machine and can be used to help coordinate complex player interactions | ||
+ | |||
:{{CSharp|bool DataExists(string key)}} | :{{CSharp|bool DataExists(string key)}} | ||
:: | :: | ||
Line 14: | Line 18: | ||
::Deletes the specified application scoped data item. | ::Deletes the specified application scoped data item. | ||
− | :{{CSharp|CloudCurrencyExtended GetCurrency(string identifier | + | :{{CSharp|CloudCurrencyExtended GetCurrency(string identifier)}} |
:: | :: | ||
::Gets or creates a currency for use in your javascript applications. The returned object can be used to transact in this currency, and get balance of accounts. | ::Gets or creates a currency for use in your javascript applications. The returned object can be used to transact in this currency, and get balance of accounts. | ||
Line 22: | Line 26: | ||
::Gets the value of an application scoped data item. | ::Gets the value of an application scoped data item. | ||
− | :{{CSharp| | + | :{{CSharp|ReturnType GetMetadata(string key)}} |
+ | :: | ||
+ | ::Gets the value of an application metadata item | ||
+ | |||
+ | :{{CSharp|DOMObjectExtended Instantiate(DOMObjectExtended parent, Guid objectTypeID)}} | ||
+ | :: | ||
+ | ::Instantiates a new reference to the specified object type and adds it as a child of the provided DOM object | ||
+ | |||
+ | :{{CSharp|Guid Map(string identifier)}} | ||
+ | :: | ||
+ | ::Maps a declared dependancy from its identifier to its Guid ID. This is helpful to avoid using hard-coded ObjectTypeIDs and ResourceIDs in your scripts. Simply declare a dependancy in the admin as part of your GameCloud application, and then refer to it from script using this method. | ||
+ | |||
+ | :{{CSharp|InteractionMappingExtended RegisterInteraction(string selector, string abilityIdentifier, string groupIdentifier {{=}} NULL, string personaSelector {{=}} NULL)}} | ||
:: | :: | ||
::Wraps up the ViewInfo’s AddInteractionMapping and AddAbility methods into a single call. The abilityIdentifier is the name of a GameCloud registered ability (created in the admin). The groupIdentifier is the optional name of a GameCloud registered entity group used to filter who gets the interaction, and the selector is a CSS-Style selector which identifies nodes which are eligible targets of the interaction. | ::Wraps up the ViewInfo’s AddInteractionMapping and AddAbility methods into a single call. The abilityIdentifier is the name of a GameCloud registered ability (created in the admin). The groupIdentifier is the optional name of a GameCloud registered entity group used to filter who gets the interaction, and the selector is a CSS-Style selector which identifies nodes which are eligible targets of the interaction. | ||
Line 30: | Line 46: | ||
::Checkpoints your app data. Just in case. | ::Checkpoints your app data. Just in case. | ||
− | :{{CSharp|void SetApplication(string | + | :{{CSharp|void SetApplication(string identifier)}} |
:: | :: | ||
::Associates this script with an application (scope of data storage). A single call to this function is required before most other GameCloud functions will work. Simply pass a Guid as a string. | ::Associates this script with an application (scope of data storage). A single call to this function is required before most other GameCloud functions will work. Simply pass a Guid as a string. | ||
Line 37: | Line 53: | ||
:: | :: | ||
::Sets the value of an application-scoped data item. This is basic global application string data storage. | ::Sets the value of an application-scoped data item. This is basic global application string data storage. | ||
+ | |||
+ | :{{CSharp|void SetOrCreateApplication(string identifier, Guid applicationID)}} | ||
+ | :: | ||
+ | ::Similar to SetApplication, but will also create the application with the known GUID application ID. This is useful for scripts that auto-create their application if it doesn't exist, and ensures the application always has the same ID so it can be transferred reliably between systems. | ||
__NOTOC____NOEDITSECTION__ | __NOTOC____NOEDITSECTION__ |
Latest revision as of 16:24, 14 June 2018
The Cloud JavaScript global object is available from server world scripts and is the main entry point for the GameCloud functionality.
- This is a JavaScript global object named Cloud
Remarks [edit]
Methods
- EngagementExtended CreateEngagement()
- Creates a new engagement which wraps a state machine and can be used to help coordinate complex player interactions
- bool DataExists(string key)
- Checks if an application scoped data item exists (is set).
- void DeleteData(string key)
- Deletes the specified application scoped data item.
- CloudCurrencyExtended GetCurrency(string identifier)
- Gets or creates a currency for use in your javascript applications. The returned object can be used to transact in this currency, and get balance of accounts.
- string GetData(string key)
- Gets the value of an application scoped data item.
- ReturnType GetMetadata(string key)
- Gets the value of an application metadata item
- DOMObjectExtended Instantiate(DOMObjectExtended parent, Guid objectTypeID)
- Instantiates a new reference to the specified object type and adds it as a child of the provided DOM object
- Guid Map(string identifier)
- Maps a declared dependancy from its identifier to its Guid ID. This is helpful to avoid using hard-coded ObjectTypeIDs and ResourceIDs in your scripts. Simply declare a dependancy in the admin as part of your GameCloud application, and then refer to it from script using this method.
- InteractionMappingExtended RegisterInteraction(string selector, string abilityIdentifier, string groupIdentifier = NULL, string personaSelector = NULL)
- Wraps up the ViewInfo’s AddInteractionMapping and AddAbility methods into a single call. The abilityIdentifier is the name of a GameCloud registered ability (created in the admin). The groupIdentifier is the optional name of a GameCloud registered entity group used to filter who gets the interaction, and the selector is a CSS-Style selector which identifies nodes which are eligible targets of the interaction.
- void SaveData()
- Checkpoints your app data. Just in case.
- void SetApplication(string identifier)
- Associates this script with an application (scope of data storage). A single call to this function is required before most other GameCloud functions will work. Simply pass a Guid as a string.
- void SetData(string key, string value)
- Sets the value of an application-scoped data item. This is basic global application string data storage.
- void SetOrCreateApplication(string identifier, Guid applicationID)
- Similar to SetApplication, but will also create the application with the known GUID application ID. This is useful for scripts that auto-create their application if it doesn't exist, and ensures the application always has the same ID so it can be transferred reliably between systems.