Skip to content

Commit

Permalink
Merge pull request #9 from orange-games/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AleBles authored Dec 20, 2016
2 parents 3bc3cc4 + ed57ef8 commit 61b3812
Show file tree
Hide file tree
Showing 12 changed files with 372 additions and 360 deletions.
9 changes: 5 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function (grunt) {
//Get some details from the package.json
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
' * <%= pkg.name %> - version <%= pkg.version %> \n' +
' * <%= pkg.config.name %> - version <%= pkg.version %> \n' +
' * <%= pkg.description %>\n' +
' *\n' +
' * <%= pkg.author %>\n' +
Expand All @@ -28,7 +28,7 @@ module.exports = function (grunt) {
dist: {
tsconfig: './config/tsconfig.json',
src: ['ts/**/*.ts'],
dest: 'build/<%= pkg.name %>.js'
dest: 'build/<%= pkg.config.name %>.js'
}
},
watch: {
Expand Down Expand Up @@ -62,8 +62,9 @@ module.exports = function (grunt) {
},
dist: {
files: {
'build/<%= pkg.name %>.min.js': [
'build/<%= pkg.name %>.js'
'build/<%= pkg.config.name %>.min.js': [
'vendor/Spine.js',
'build/<%= pkg.config.name %>.js'
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Next up you'd want to add it to your list of js sources you load into your game:

After adding the script to the page you can activate it by enabling the plugin:
```javascript
game.add.plugin(Fabrique.Plugins.AdManager);
game.add.plugin(PhaserAds.AdManager);
```

Usage
Expand All @@ -40,7 +40,7 @@ We'll continue this part of the readme asuming you're going to implement IMA3.
A provider can use any number of arguments configured in order to make it work, it all depends on the implementation that was made by the developer. For our IMA3 Provider you can create one like this:
```javascript
//let's create a new provider, first argument should be the game, second should be the ad tag URL
var provider = new Fabrique.AdProvider.Ima3(
var provider = new PhaserAds.AdProvider.Ima3(
game,
'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&correlator'
);
Expand Down
150 changes: 75 additions & 75 deletions build/phaser-ads.d.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
declare module Fabrique {
module Plugins {
interface IAdGame extends Phaser.Game {
ads: Fabrique.Plugins.AdManager;
}
enum AdEvent {
start = 0,
firstQuartile = 1,
midPoint = 2,
thirdQuartile = 3,
complete = 4,
}
class AdManager extends Phaser.Plugin {
onContentPaused: Phaser.Signal;
onContentResumed: Phaser.Signal;
onAdProgression: Phaser.Signal;
onAdsDisabled: Phaser.Signal;
onAdClicked: Phaser.Signal;
onAdRewardGranted: Phaser.Signal;
private provider;
private wasMuted;
constructor(game: IAdGame, pluginManager: Phaser.PluginManager);
/**
* Here we set an adprovider, any can be given as long as it implements the IProvider interface
*
* @param provider
*/
setAdProvider(provider: AdProvider.IProvider): void;
/**
* Here we request an ad, the arguments passed depend on the provider used!
* @param args
*/
showAd(...args: any[]): void;
/**
* Some providers might require you to preload an ad before showing it, that can be done here
*
* @param args
*/
preloadAd(...args: any[]): void;
/**
* Some providers require you to destroy an add after it was shown, that can be done here.
*
* @param args
*/
destroyAd(...args: any[]): void;
/**
* Some providers allow you to hide an ad, you might think of an banner ad that is shown in show cases
*
* @param args
*/
hideAd(...args: any[]): void;
/**
* Checks if ads are enabled or blocked
*
* @param args
*/
adsEnabled(): boolean;
}
declare module 'phaser-ads' {
export = PhaserAds;
}
declare module PhaserAds {
interface IAdGame extends Phaser.Game {
ads: AdManager;
}
enum AdEvent {
start = 0,
firstQuartile = 1,
midPoint = 2,
thirdQuartile = 3,
complete = 4,
}
class AdManager extends Phaser.Plugin {
onContentPaused: Phaser.Signal;
onContentResumed: Phaser.Signal;
onAdProgression: Phaser.Signal;
onAdsDisabled: Phaser.Signal;
onAdClicked: Phaser.Signal;
onAdRewardGranted: Phaser.Signal;
private provider;
private wasMuted;
constructor(game: IAdGame, pluginManager: Phaser.PluginManager);
/**
* Here we set an adprovider, any can be given as long as it implements the IProvider interface
*
* @param provider
*/
setAdProvider(provider: AdProvider.IProvider): void;
/**
* Here we request an ad, the arguments passed depend on the provider used!
* @param args
*/
showAd(...args: any[]): void;
/**
* Some providers might require you to preload an ad before showing it, that can be done here
*
* @param args
*/
preloadAd(...args: any[]): void;
/**
* Some providers require you to destroy an add after it was shown, that can be done here.
*
* @param args
*/
destroyAd(...args: any[]): void;
/**
* Some providers allow you to hide an ad, you might think of an banner ad that is shown in show cases
*
* @param args
*/
hideAd(...args: any[]): void;
/**
* Checks if ads are enabled or blocked
*
* @param args
*/
adsEnabled(): boolean;
}
}
declare module Fabrique {
declare module PhaserAds {
module AdProvider {
enum CocoonProvider {
AdMob = 0,
Expand Down Expand Up @@ -90,7 +91,7 @@ declare module Fabrique {
}
}
}
declare module Fabrique {
declare module PhaserAds {
module AdProvider {
enum HeyzapAdTypes {
Interstitial = 0,
Expand All @@ -110,21 +111,7 @@ declare module Fabrique {
}
}
}
import AdManager = Fabrique.Plugins.AdManager;
declare module Fabrique {
module AdProvider {
interface IProvider {
adManager: AdManager;
adsEnabled: boolean;
setManager(manager: AdManager): void;
preloadAd(...args: any[]): void;
destroyAd(...args: any[]): void;
hideAd(...args: any[]): void;
showAd(...args: any[]): void;
}
}
}
declare module Fabrique {
declare module PhaserAds {
module AdProvider {
interface ICustomParams {
[name: string]: string | number | any[];
Expand Down Expand Up @@ -182,3 +169,16 @@ declare module Fabrique {
}
}
}
declare module PhaserAds {
module AdProvider {
interface IProvider {
adManager: AdManager;
adsEnabled: boolean;
setManager(manager: AdManager): void;
preloadAd(...args: any[]): void;
destroyAd(...args: any[]): void;
hideAd(...args: any[]): void;
showAd(...args: any[]): void;
}
}
}
Loading

0 comments on commit 61b3812

Please sign in to comment.