Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 121 additions & 1 deletion extensions/reviewed/PokiGamesSDKHtml.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "PokiGamesSDKHtml",
"previewIconUrl": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NzguODggMjczLjE2Ij4KCTxwYXRoIGZpbGw9ImJsYWNrIiBkPSJNNTQxIDg1LjhjMjEgMCAzOC0xNy40IDM4LTM4LjcgMC0yMC40LTE3LjQtMzcuNy0zOC0zNy43UzUwMy41IDI2LjYgNTAzLjUgNDdjMCAyMS40IDE3IDM4LjggMzcuNyAzOC44eiI+Cgk8L3BhdGg+Cgk8cGF0aCBmaWxsPSJibGFjayIgZD0iTTUwNCA5OS4zdjExMC41TDQ3MCAxMzZjMTUuNC0xOS4zIDIxLjctNDYuNCAyMi40LTY2VjU0aC02MC4ydjE1LjVjLTEgMTkuNi03LjMgMjguOC0yNC44IDM0LjVWMEgzNDZ2NDQuNEMzMjQgMjEuNiAyOTMgOS42IDI1Ni43IDkuNmMtNDAgMC03MyAxMy44LTk1LjYgNDBhMTE4IDExOCAwIDAgMC0xNyAyNi4yQzEyOSA2MC42IDEwOC40IDU0IDg0IDU0SDB2MjE5LjJoNTZWMjIxaDI4YzI0LjQgMCA0NS04LjMgNjAtMjMuN2ExMTYuMyAxMTYuMyAwIDAgMCAxNy42IDI3YzIyLjcgMjUuOCA1NS41IDM5LjMgOTUgMzkuMyAzOC42IDAgNzEtMTMuNSA5My42LTM5bDQuNS01LjZoNTIuN3YtNTQuM2w4LTIgMjYgNTYuNGgxMzYuOFY5OS40aC03NHptLTQxOCA2NEg1NnYtNTNoMjkuMmM3LjYgMCAyMC4zIDUuMiAyMC4zIDI1LjUgMCAxMy01LjQgMjcuMy0xOS40IDI3LjN6bTE3MCA2MGMtNDcuMyAwLTg1LjctMzkuNC04NS43LTg3LjhDMTcwLjMgODkgMjA5LjUgNTAgMjU2IDUwczg1LjYgMzkgODUuNiA4NS41YzAgNDguNC0zOC40IDg3LjgtODUuNiA4Ny44eiI+Cgk8L3BhdGg+Cgk8cGF0aCBmaWxsPSJibGFjayIgZD0iTTI1NiAxNDJjLTM4IDAtNTcgNi41LTY1IDguNiA2LjcgMzAuNSAzMy4yIDUzLjMgNjUgNTMuM3M1OC4zLTIzIDY1LTUzLjRjLTgtMi0yNy4yLTguNy02NS04Ljd6Ij4KCTwvcGF0aD4KPC9zdmc+Cg==",
"shortDescription": "Poki Games SDK: display ads and manage game lifecycle for Poki hosting.",
"version": "0.1.1",
"version": "0.1.2",
"description": "Please refer to [Poki's guide](https://sdk.poki.com/sdk-documentation.html) to know when to call the different actions.",
"origin": {
"identifier": "PokiGamesSDKHtml",
Expand Down Expand Up @@ -429,6 +429,126 @@
],
"objectGroups": []
},
{
"async": true,
"description": "Prompt the player to log in with Poki.",
"fullName": "Login",
"functionType": "Action",
"name": "Login",
"sentence": "Log the player in with Poki",
"events": [
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"if (typeof PokiSDK === \"undefined\") {",
" eventsFunctionContext.task.resolve();",
" return;",
"}",
"const logger = new gdjs.Logger(\"Poki games SDK HTML\");",
"PokiSDK.login().catch((error) => {",
" logger.log(`Login failed: ${error}`);",
"}).finally(() => {",
" eventsFunctionContext.task.resolve();",
"});",
""
],
"parameterObjects": "",
"useStrict": true,
"eventsSheetExpanded": false
}
],
"parameters": [],
"objectGroups": []
},
{
"async": true,
"description": "Get the current Poki user and store it in a structure variable.",
"fullName": "Get user",
"functionType": "Action",
"name": "GetUser",
"sentence": "Get Poki user and store it in _PARAM0_",
"events": [
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"if (typeof PokiSDK === \"undefined\") {",
" eventsFunctionContext.task.resolve();",
" return;",
"}",
"const logger = new gdjs.Logger(\"Poki games SDK HTML\");",
"/** @type {gdjs.Variable} */",
"const result = eventsFunctionContext.getArgument(\"Result\");",
"result.fromJSObject({ username: \"\", avatarUrl: \"\" });",
"PokiSDK.getUser().then((user) => {",
" const safeUser = user && typeof user === \"object\" ? user : {};",
" result.fromJSObject({",
" username: typeof safeUser.username === \"string\" ? safeUser.username : \"\",",
" avatarUrl: typeof safeUser.avatarUrl === \"string\" ? safeUser.avatarUrl : \"\",",
" });",
"}).catch((error) => {",
" logger.log(`Failed to get user: ${error}`);",
"}).finally(() => {",
" eventsFunctionContext.task.resolve();",
"});",
""
],
"parameterObjects": "",
"useStrict": true,
"eventsSheetExpanded": false
}
],
"parameters": [
{
"description": "Structure variable where the user will be stored",
"longDescription": "The result structure contains `username` and `avatarUrl`.",
"name": "Result",
"type": "variable"
}
],
"objectGroups": []
},
{
"async": true,
"description": "Get the current Poki token and store it in a variable.",
"fullName": "Get token",
"functionType": "Action",
"name": "GetToken",
"sentence": "Get Poki token and store it in _PARAM0_",
"events": [
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"if (typeof PokiSDK === \"undefined\") {",
" eventsFunctionContext.task.resolve();",
" return;",
"}",
"const logger = new gdjs.Logger(\"Poki games SDK HTML\");",
"/** @type {gdjs.Variable} */",
"const result = eventsFunctionContext.getArgument(\"Result\");",
"result.setString(\"\");",
"PokiSDK.getToken().then((token) => {",
" result.setString(typeof token === \"string\" ? token : \"\");",
"}).catch((error) => {",
" logger.log(`Failed to get token: ${error}`);",
"}).finally(() => {",
" eventsFunctionContext.task.resolve();",
"});",
""
],
"parameterObjects": "",
"useStrict": true,
"eventsSheetExpanded": false
}
],
"parameters": [
{
"description": "Variable where the token will be stored",
"name": "Result",
"type": "variable"
}
],
"objectGroups": []
},
{
"description": "Measure an event for analytics.",
"fullName": "Measure event",
Expand Down