![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
phaser-plugin
Advanced tools
Hi! 👋 This is the official Poki Phaser Plugin for [Phaser 3](https://phaser.io/phaser3). This plugin will automate most of implementing the [Poki SDK](https://sdk.poki.com/) when making a game with Phaser.
Hi! 👋 This is the official Poki Phaser Plugin for Phaser 3. This plugin will automate most of implementing the Poki SDK when making a game with Phaser.
scene.plugins.get('poki')
so you can:
This is a quick step by step tutorial on how to use our plugin. You can also always check the example in the /example directory.
First, you have to make sure to add the poki-phaser-3
plugin as a dependency
to your project:
$ npm install --save-dev poki-phaser-3
# or
$ yarn add --dev poki-phaser-3
(note: at the time of writing, not yet published to npm)
Step two is to add the plugin to the plugins section of your Phaser configuration, for example:
import { PokiPlugin } from 'poki-phaser-3'
// ...
const config = {
// ...
plugins: {
global: [
{
plugin: PokiPlugin,
key: 'poki',
start: true, // must be true, in order to load
data: {
// This must be the key/name of your loading scene
loadingSceneKey: 'LoadingScene',
// This must be the key/name of your game (gameplay) scene
gameplaySceneKey: 'PlayScene',
// This will always request a commercialBreak when gameplay starts,
// set to false to disable this behaviour (recommended to have true,
// see Poki SDK docs for more details).
autoCommercialBreak: true
}
}
]
}
}
// ...
var game = new Phaser.Game(config)
(more info on Phaser's configuration here)
The Poki Phaser plugin will automatically call PokiSDK.gameLoadingStart()
and
PokiSDK.gameLoadingStop();
if the loadingSceneKey is configured. The same is
true for the set gameplaySceneKey.
If your game doesn't use multiple scenes for gameplay you can manually call the events like so:
const poki = scene.plugins.get('poki') // get the plugin from the Phaser PluginManager
poki.gameplayStart()
// ... start gameplay ...
scene.on('player_died', () => {
poki.gameplayStop()
})
To run code only when the PokiSDK is initialized you can use the following interface:
const poki = scene.plugins.get('poki') // get the plugin from the Phaser PluginManager
poki.runWhenInitialized((poki) => {
// This is called after the PokiSDK is fully initialized, or immediately if
// the PokiSDK has already been initialized.
if (poki.hasAdblock) {
console.log('😢')
}
})
This repository contains an example on how to use the Poki Phaser 3 plugin in the /example directory. The main configuration/setup is done in the example/game.js file.
The example game consist of a Loading-, Menu-, and Playscene to show the way the plugin works with the Poki 'gameplayStart' event etc.
Checkout the MenuScene for an extensive example of using this library where we wait for the Poki SDK to be completely initialized, check if an adblock is detected and allows players to watch a rewarded adbreak. You can find this code here.
To run the example use the following command:
$ yarn watch
Server running at http://localhost:1234
And point your browser to http://localhost:1234
This project is currently in an early development phase. These steps are still left before we can publish it for general use:
Background music credits: https://github.com/photonstorm/phaser-examples/blob/master/examples/assets/audio/bodenstaendig_2000_in_rock_4bit.mp3
FAQs
Hi! 👋 This is the official Poki Phaser Plugin for [Phaser 3](https://phaser.io/phaser3). This plugin will automate most of implementing the [Poki SDK](https://sdk.poki.com/) when making a game with Phaser.
The npm package phaser-plugin receives a total of 0 weekly downloads. As such, phaser-plugin popularity was classified as not popular.
We found that phaser-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.