GithubHelp home page GithubHelp logo

cocos-creator-poki-sdk's Introduction

Poki Extension for Cocos Creator 3.x

Note: This extension works for CocosCreator3.4.0 and above only

This extension is designed to help the integration of the PokiSDK into your Cocos Creator(3.x) game. You can create a custom build and preview templates to do the integration by yourself, but the extension provides them ready to use.

The extension provides:

  • A preview template
  • A web-mobile build template
  • PokiSDK abstraction
  • A demo scene showcasing usage

Once you install and enable the extension, you will be able to test the PokiSDK integration in preview mode (in browser) and be able to make builds (web-mobile) that can be uploaded to poki platform.

Please note that Poki is a curated platform, you will need to submit your game through pokifordevelopers.com first, and only work on the sdk integration after the game is approved .

1.Installation

There are two ways to download and install the extension

Cocos Store

You can search and install the extension directly from the Cocos store. This is the easiest way to get started. //screenshots of the store and install process.

From Source/Release

Download the extension archive poki-sdk-v1.2.2.zip.

Or download the source code as a zip file.

git clone https://github.com/vkbsb/cocos-creator-poki-sdk
  1. Once this is done, you can launch the extension manager in Cocos creator editor extension-manager-open
  2. Switch to the project tab and click on add extension button extension-add
  3. Browse to the poki-sdk-v1.2.2.zip file you have downloaded and click open. pick-extension-archive

2.Enable extension

Once you have done the installation, go to the extension manager and ensure that the poki-build extension is enabled.

  1. Open the extension manager

extension-manager-open

  1. Under project tab, ensure that poki-sdk is enabled. If it's not enabled, enable it.

extension-enable

The extension creates the following files in your project directory.

  • preview-template/index.ejs
  • build-templates/common/application.ejs
  • build-templates/web-mobile/index.ejs
  • assets/poki-api/PokiPlatform.ts
  • assets/demo/demo.scene
  • assets/demo/DemoScript.ts

folders-created

3.Usage

In your component scripts, you will be able to import CCPokiSDK and use it to interact with the PokiSDK. The following are the functions that are available for you to use from your game scripts. Checkout the DemoScript.ts for example usage.

CCPokiSDK.isAdBlocked() //-- in JS it's PokiSDK.isAdBlocked()
CCPokiSDK.gameplayStart() //-- in JS it's PokiSDK.gameplayStart()
CCPokiSDK.gameplayStop() //-- in JS it's PokiSDK.gameplayStop()
CCPokiSDK.commercialBreak() //-- in JS it's PokiSDK.commercialBreak()
CCPokiSDK.rewardBreak() //-- in JS it's PokiSDK.rewardedBreak()
CCPokiSDK.shareableURL(params, callback) //-- in JS it's PokiSDK.shareableURL({}).then(url => {})
local value = CCPokiSDK.getURLParam(key) //-- in JS it's PokiSDK.getURLParam('id')

You will notice that you do not see an equivalent to PokiSDK.setDebug(value) this is because the extension sets this automatically based on the build you make.

________________________________________________________
| Build Type                  | PokiSDK Debug           |
|_____________________________|_________________________|
| Preview Build               | PokiSDK.setDebug(true) |
| web-mobile:Debug(checked)   | PokiSDK.setDebug(true) |
| web-mobile:Debug(un-checked)| PokiSDK.setDebug(false)|
---------------------------------------------------------

Rewarded Break

This ad type is used for optional rewarded actions, for example watching an ad video in exchange for in-game currency, a revive, a level skip... Here are the following steps you need to follow to implement it using this extension.

  • Register for a call back on cc.game for EVENT_REWARD_BREAK_DONE
  • if arguments[0] == true we can give player reward, else don't reward.

Check out DemoScript.ts for reference.

SiteLock

Poki provides a sitelock code to the developers which helps ensure that the game is playable only on Poki's website. Please collect it from your dev contact. Once you get it, paste the code in the SiteLock field of the poki-sdk section of the web-mobile build.

SiteLock Code

Please note that the sitelock code is embedded in the build only when you make a build with debug box un-checked.

Web-mobile-release

Submit your game on Poki

On developers.poki.com you can submit your game with Poki. If we think your game is a good fit for our playground, we will reach out to you!

cocos-creator-poki-sdk's People

Contributors

vkbsb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.