Allows for easy access to the Kongregate API
Todo: Add in the functions for Chat Integration - you can still use them via the FlxKongregate.api object.
@link http://www.photonstorm.com
Static variables
staticapi:Dynamic
The Kongregate API object. You can make calls directly to this once the API has connected.
Static methods
staticaddEventListener(ContentType:String, Callback:() ‑> Void):Void
Register an event listener with the API. Useful for capturing guest to user login requests for example. See: http://www.kongregate.com/developer_center/docs/handling-guests
Parameters:
ContentType | The event to listen for (i.e. "login") |
---|---|
Callback | Funcation to call when this event is received |
staticaddLoadListener(ContentType:String, Callback:() ‑> Void):Void
Use the addLoadListener function to register an event listener which will be triggered when content of the specified type is loaded by the user. These MUST be set-up before you call FlxKongregate.connect() See: http://www.kongregate.com/developer_center/docs/shared-content-api
Parameters:
ContentType | Type of content to listen for |
---|---|
Callback | Function to call when content load request has been made |
staticbrowseSharedContent(ContentType:String, ?SortOrder:String, ?Label:String):Void
The browse function causes a list of shared content to appear in the user's browser. This will allow them to view, rate, or load shared content for your game. See: http://www.kongregate.com/developer_center/docs/shared-content-api
Parameters:
ContentType | Type of content to browse |
---|---|
SortOrder | Optional constant specifying how to sort content (see API docs) |
Label | Optional, only browse content saved with the specified label |
staticconnect():Void
Connect to the Kongregate API. This should be called only after the init callback reports a succesful load of the API
staticdisconnect():Void
Remove the API from memory (when possible) and removes it from the display list also
staticgetGameAuthToken():String
If you are using the Authentication API you can use the getGameAuthToken function to get the player's game authentication token.
staticgetUserId():Float
You can use the getUserId() function to retrieve the unique user id of the current player. It will return 0 if the user is not signed in.
staticgetUserName():String
You can use the getUsername() function to retrieve the username of the current player. It will begin with Guest if the user is not signed in.
staticinit(Callback:Dynamic):Void
Loads the Kongregate API and if successful connects to the service. Note that your game must have access to Stage by this point.
Parameters:
Callback | This function is called if the API loads successfully. Do not call any API function until this has happened. |
---|
staticisGuest():Bool
The isGuest function can be called to determine if the player is currently signed into Kongregate or not
staticpurchaseItem(Items:Array<Dynamic>, Callback:() ‑> Void):Void
Bring up the "purchase items" dialog box by using the purchaseItems method on the microtransaction services object. Your game must be in the Kongregate Microtransactions beta to use this function. See: http://www.kongregate.com/developer_center/docs/microtransaction-client-api
Parameters:
Items | The array of item identifier strings or item/metadata objects. |
---|---|
Callback | The callback function |
staticrequestUserItemList(Username:String, Callback:() ‑> Void):Void
Request the inventory of any user. Your game must be in the Kongregate Microtransactions beta to use this function. See: http://www.kongregate.com/developer_center/docs/microtransaction-client-api
Parameters:
Username | The username to request inventory for, or null for the current player |
---|---|
Callback | The callback function |
staticresizeGame(Width:Int, Height:Int):Void
If you need to resize your game's enclosing container, you may do so with resizeGame call. The enclosing iframe will resize around your game. Games may not be resized smaller than their initial dimensions. This call requires special permission from Kongregate to use.
Parameters:
Width | New width (in pixels) of the container |
---|---|
Height | New height (in pixels) of the container |
staticsaveSharedContent(ContentType:String, Content:String, Callback:() ‑> Void, ?Thumb:DisplayObject, ?Label:String):Void
Use the save function to submit shared content on the Kongregate back-end. See: http://www.kongregate.com/developer_center/docs/shared-content-api
Parameters:
ContentType | Type of content the user wishes to save, 12 characters max. |
---|---|
Content | Value of content to be saved. We strongly recommend keeping these values under 100K. |
Callback | Function to call when save has finished. |
Thumb | Optional but highly recommended! Send us a DisplayObject that we will snapshotted and used as a thumbnail for the content. |
Label | Optional, label for sub-classing the shared content. |
staticshowKredPurchaseDialog(PurchaseMethod:String):Void
Display the Kred purchasing Dialog. Your game must be in the Kongregate Microtransactions beta to use this function. See: http://www.kongregate.com/developer_center/docs/microtransaction-client-api
Parameters:
PurchaseMethod | The purchase method to display. Should be "offers" or "mobile" |
---|
staticshowRegistrationBox():Void
This call works the same way as showSigninBox, but it focuses the registration form rather than the sign-in form.
staticshowShoutBox(Message:String = ""):Void
If a player is logged-in and you want to allow them to post a shout on their profile page, you may bring up the shout box, optionally populated with some initial content.
Parameters:
Message | The optional initial content |
---|
staticshowSignInBox():Void
If the player is a guest, and you want to display the sign-in/registration UI to them you can use the showSignInBox function.
staticsubmitAvatar(Avatar:DisplayObject, Callback:() ‑> Void):Void
Export a DisplayObject to be converted to a user avatar. It is highly recommended that avatars be at least 40 x 40px. See: http://www.kongregate.com/developer_center/docs/avatar-api
Parameters:
Avatar | Can be null, but highly recommended that you send yourself. If null, we will snapshot the stage. |
---|---|
Callback | Function to call when content load request has been made |
staticsubmitScore(Score:Float, Mode:String):Void
Submit a score to the Kongregate server. Make sure you have defined the stat before calling this. See the Kongregate API documentation for details.
Parameters:
Score | The value of the score |
---|---|
Mode | What game mode this score is for, like "Hard" or "Normal" |
staticsubmitStats(Name:String, Value:Float):Void
Submit a statistic to the Kongregate server. Make sure you have defined the stat before calling this. See the Kongregate API documentation for details.
Parameters:
Name | The name of the statistic |
---|---|
Value | The value to submit (will be converted to an integer server-side) |