├── .github
└── ISSUE_TEMPLATE.md
├── .gitignore
├── .npmignore
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Gruntfile.js
├── LICENSE
├── README.md
├── build
├── phaser-ads.d.ts
├── phaser-ads.js
├── phaser-ads.js.map
└── phaser-ads.min.js
├── example
├── bodenstaendig_2000_in_rock_4bit.ogg
├── gamedistribution.html
└── ima3.html
├── package-lock.json
├── package.json
├── ts
├── AdManager.ts
├── Providers
│ ├── Cocoon.ts
│ ├── CordovaGameDistribution.ts
│ ├── CordovaHeyzap.ts
│ ├── GameDistributionAds.ts
│ ├── IProvider.ts
│ └── Ima3.ts
└── definitions.d.ts
├── tsconfig.json
├── tslint.json
└── vendor
├── cocoon.d.ts
├── cordova-gamedistribution.d.ts
├── cordova-heyzap.d.ts
├── game-distribution.d.ts
└── google-ima3-sdk.d.ts
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Before opening this issue _please_ check we haven't already fixed it! Check the [Closed issues](https://github.com/azerion/phaser-ads/issues?q=is%3Aissue+is%3Aclosed)
2 | This Issue is about (delete as applicable)
3 |
4 | * A bug in the API (always say which version you're using!)
5 | * An error in the documentation
6 | * An error in the example
7 | * A problem with my own code
8 |
9 | API errors must include example code showing what happens, and why you don't believe this is the expected behavior. Issues posted without code take _far_ longer to get resolved, _if ever_.
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .idea
3 | .tscache
4 | *.tmp.txt
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | Gruntfile.js
2 | example
3 | ts
4 | .idea
5 | node_modules
6 | .tscache
7 | deploy
8 | config
9 | .github
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 | All notable changes to this project will be documented in this file.
3 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5 |
6 | ## [2.4.1] 2019-11-15
7 | ### Added
8 | - GD banner alignment enum
9 | - Possibility to align GD Banner in a given HTMLElement
10 |
11 | ## [2.4.0] 2019-11-15
12 | ### Added
13 | - GD banner ad support
14 |
15 | ## [2.3.1] - 2019-10-18
16 | ### Fixed
17 | - [GameDistribution Ads] Content paused is now only fired when an ad is actually beeing displayed
18 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at fabrique@azerion.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.md).
2 |
3 | ## Reporting issues
4 |
5 | [GitHub Issues][0] is the place to report bugs you may have found. When submitting a bug please do the following:
6 |
7 | **1. Search for existing issues.** Your bug may have already been fixed, or cannot, or will not, be fixed. So be sure to search the issues first before putting in a duplicate issue.
8 |
9 | **2. Not sure if it's a bug?.** Please ask on the Phaser's slack or discord servers, @AleBles is usually there. If something is blatantly wrong then post it to GitHub. But if you feel it might just be because you're not sure of expected behavior, then it might save us time, and get you a response faster, if you post it to the Phaser forum instead.
10 |
11 | **3. Create an isolated and reproducible test case.** If you are reporting a bug, make sure you also have a minimal, runnable, code example that reproduces the problem you have.
12 |
13 | **4. Include a live example.** After narrowing your code down to only the problem areas please provide some basic code that show it, or a link to your live site so that we can view a live example of the problem.
14 |
15 | **5. Share as much information as possible.** Include browser version affected, your OS, version of the library, steps to reproduce, etc. "X isn't working!!!!!" will probably just be closed.
16 |
17 | ## Making Changes
18 |
19 | To take advantage of our grunt build script and tslint config it will be easiest for you if you have node.js and grunt installed locally.
20 |
21 | You can download node.js from [nodejs.org][3]. After it has been installed open a console and run `npm i -g grunt-cli` to install the global `grunt` executable.
22 |
23 | After that you can clone the repository and run `npm i` inside the cloned folder. This will install dependencies necessary for building the project. Once that is ready, make your changes and submit a Pull Request:
24 |
25 | - **Send Pull Requests to the `dev` branch.** This'll make it much easier for to keep a clear track between development and releases.
26 |
27 | - **Ensure changes are tslint validated.** Our TSlint configuration file is provided in the repository and you should check against it before submitting.
28 |
29 | - **Never commit new builds.** When making a code change you should always run `grunt dist` which will rebuild the project so you can test, *however* please do not commit these new builds or your PR will be closed. Builds by default are placed in the `build` folder.
30 |
31 | - **Only commit relevant changes.** Don't include changes that are not directly relevant to the fix you are making. The more focused a PR is, the faster it will get attention and be merged. Extra files changing only whitespace or trash files will likely get your PR closed.
32 |
33 |
34 | ## Coding style preferences are not contributions
35 |
36 | If your PR is doing little more than changing the source code into a format / coding style that you prefer then we will automatically close it. All PRs must adhere to the coding style already set-out across the code. Your personal preferences for how things should "look" or be structured do not apply here, sorry. PRs should fix bugs, fix documentation or add features. No changes for the sake of change.
37 |
38 |
39 | ## I don't really like git / node.js, but I can fix this bug
40 |
41 | That is fine too. While Pull Requests are the best thing in the world for us, they are not the only way to help. You're welcome to post fixes to our forum or even just email them to us. All we ask is that you still adhere to the guidelines presented here re: TSlint, etc.
42 |
43 |
44 | ## Code Style Guide
45 |
46 | - Use 4 spaces for tabs, never tab characters.
47 |
48 | - No trailing whitespace, blank lines should have no whitespace.
49 |
50 | - Always favor strict equals `===` unless you *need* to use type coercion.
51 |
52 | - Follow conventions already in the code, and listen to tslint. Our config is set-up for a reason.
53 |
54 | Thanks to Rich for creating the Phaser Contributing file which we adapted for this plugin.
55 |
56 | [0]: https://github.com/azerion/phaser-ads/issues
57 | [3]: http://nodejs.org
58 |
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | module.exports = function (grunt) {
2 | 'use strict';
3 |
4 | grunt.initConfig({
5 | //Get some details from the package.json
6 | pkg: grunt.file.readJSON('package.json'),
7 | banner: '/*!\n' +
8 | ' * <%= pkg.config.name %> - version <%= pkg.version %> \n' +
9 | ' * <%= pkg.description %>\n' +
10 | ' *\n' +
11 | ' * <%= pkg.author %>\n' +
12 | ' * Build at <%= grunt.template.today("dd-mm-yyyy") %>\n' +
13 | ' * Released under MIT License \n' +
14 | ' */\n',
15 | usebanner: {
16 | dist: {
17 | options: {
18 | position: 'top',
19 | banner: '<%= banner %>'
20 | },
21 | files: {
22 | src: [ 'build/*.js' ]
23 | }
24 | }
25 | },
26 | //Typescript settings per build
27 | ts: {
28 | dist: {
29 | tsconfig: './tsconfig.json',
30 | src: ['ts/**/*.ts'],
31 | dest: 'build/<%= pkg.config.name %>.js'
32 | }
33 | },
34 | watch: {
35 | files: ['ts/**/*.ts'],
36 | tasks: ['ts'],
37 | options: {
38 | livereload: true
39 | }
40 | },
41 | connect: {
42 | server: {
43 | options: {
44 | port: 8080
45 | }
46 | }
47 | },
48 | uglify: {
49 | options: {
50 | compress: {
51 | sequences: true,
52 | dead_code: true,
53 | conditionals: true,
54 | booleans: true,
55 | unused: true,
56 | if_return: true,
57 | join_vars: true,
58 | drop_console: true
59 | },
60 | mangle: true,
61 | beautify: false
62 | },
63 | dist: {
64 | files: {
65 | 'build/<%= pkg.config.name %>.min.js': [
66 | 'build/<%= pkg.config.name %>.js'
67 | ]
68 | }
69 | }
70 | },
71 | clean: {
72 | dist: ['build']
73 | },
74 | tslint: {
75 | options: {
76 | // can be a configuration object or a filepath to tslint.json
77 | configuration: "./tslint.json"
78 | },
79 | dist: {
80 | src: [
81 | 'ts/**/*.ts'
82 | ]
83 | }
84 | }
85 | });
86 |
87 | grunt.loadNpmTasks('grunt-contrib-clean');
88 | grunt.loadNpmTasks('grunt-contrib-uglify');
89 | grunt.loadNpmTasks('grunt-banner');
90 | grunt.loadNpmTasks('grunt-ts');
91 | grunt.loadNpmTasks('grunt-tslint');
92 | grunt.loadNpmTasks('grunt-contrib-connect');
93 | grunt.loadNpmTasks('grunt-contrib-watch');
94 |
95 | //dist Build
96 | grunt.registerTask('dist', [
97 | 'tslint',
98 | 'clean:dist', //Clean the dist folder
99 | 'ts:dist',//Run typescript on the preprocessed files, for dist (client)
100 | 'uglify:dist', //Minify everything
101 | 'usebanner:dist' //Minify everything
102 | ]);
103 |
104 | grunt.registerTask('dev', [
105 | 'ts:dist',
106 | 'connect',
107 | 'watch'
108 | ]);
109 |
110 | };
111 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Azerion
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### **_IMPORTANT NOTE_**
2 | **This repository is to be considered _DEPRECATED_ and all efforts are going towards developing the next version of the Ad Wrapper in [azerion/h5-ad-wrapper](https://github.com/azerion/h5-ad-wrapper).**
3 |
4 | [](https://badge.fury.io/js/%40azerion%2Fphaser-ads) [](https://www.jsdelivr.com/package/npm/@azerion/phaser-ads)
5 |
6 | Phaser Ads
7 | ==========
8 | This Phaser plugin that allows you to leverage different ad providers whilst providing the same simple API.
9 | Also allows you to easily integrate mobile ads (via [Cocoon](https://cocoon.io)).
10 |
11 | Key features:
12 | - Ads for your mobile web experience
13 | - Pluggable ad providers
14 | - Gamedistribution.com
15 | - IMA3 SDK
16 | - Cocoon.io (support for AdMob/HeyZap/MoPub/Chartboost)
17 | - HeyZap for Cordova
18 | - Integrates nicely into Phaser
19 | - Fullscreen ad support
20 |
21 | Getting Started
22 | ---------------
23 | First you want to get a fresh copy of the plugin. You can get it from [this repo](https://github.com/azerion/phaser-ads/releases) or from [npm](https://www.npmjs.com/package/@azerion/phaser-ads).
24 | ```
25 | npm install @azerion/phaser-ads
26 | ```
27 |
28 | Next up you'd want to add it to your list of js sources you load into your game:
29 | ```html
30 |
31 | ```
32 |
33 | You could also opt for using the (free) jsdelivr cdn:
34 | ```html
35 |
36 | ```
37 |
38 | After adding the script to the page you can activate it by enabling the plugin:
39 | ```javascript
40 | game.add.plugin(PhaserAds.AdManager);
41 | ```
42 |
43 | Usage
44 | -----
45 | First thing you need to do after loading the plugin is attaching a provider to the adManager. PhaserAds comes pre-compiled with 4 providers for you to choose from:
46 | - [Gamedistribution.com](https://gamedistribution.com)
47 | - [IMA SDK](https://developers.google.com/interactive-media-ads/docs/sdks/html5)
48 | - [Cocoon.io](https://cocoon.io)
49 | - Cordova HeyZap (wrapping your game with Cordova? Want HeyZap ads? Then this is your provider)
50 |
51 | ### Gamedistribution.com
52 | If you already have an account on Gamedistribution.com you can skip this introduction if not, head on over to [gamedistribution.com](https://gamedistribution.com) and sign up for a free account.
53 | Once you're signed up you can check out [this guide](https://gamedistribution.com/sdk) for settings up a game. This is important because this will supply you with a gameId, which you need to supply to the plugin.
54 |
55 | So when you have your gameId you can start by registering the provider to the plugin:
56 | ```javascript
57 | // Let's create a new provider, first argument should be the game, second should be the ad tag URL
58 | var provider = new PhaserAds.AdProvider.GameDistributionAds(
59 | game, // Your Phaser game instance
60 | '2d77cfd4b1e5487d998465c29de195b3' // Your gameId
61 | );
62 | game.ads.setAdProvider(provider);
63 | ```
64 |
65 | After this it's as easy as calling:
66 | ```javascript
67 | game.ads.showAd();
68 | ```
69 |
70 |
71 | ### IMA SDK
72 | 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 IMA Provider you can create one like this:
73 | ```javascript
74 | // Let's create a new provider, first argument should be the game, second should be the ad tag URL
75 | var provider = new PhaserAds.AdProvider.Ima3(
76 | game,
77 | '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'
78 | );
79 | game.ads.setAdProvider(provider);
80 | ```
81 |
82 | Now all you need to do is request an ad, and add an event listener that is called when the ad is completed/skipped/finished/done playing.
83 | ```javascript
84 | game.ads.onContentResumed.addOnce(function() {
85 | // This gets called when the ad is complete
86 | game.state.start('NextState');
87 | });
88 |
89 | // Here we request the ad
90 | game.ads.showAd();
91 | ```
92 | You can also send custom parameters by adding them as an object to the showAd function.
93 |
94 | F.A.Q.
95 | ------
96 | ### I Don't see any ads!
97 | This can happen, sometimes the provider does something wrong, but most of the time (and when you are testing locally) your ads get blocked from showing.
98 | That's right, ads don't show when testing locally. The easiest way to avoid this is by testing your game on a server (online).
99 |
100 | Another work around would be to adjust your [/etc/hosts](https://howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file).
101 |
102 |
103 | ### Why don't you support this ad provider!
104 | The setup allows for a multitude of ad providers to work, but sadly we don't have the time and resources to add all of them.
105 | That beeing said, this plugin is on GitHub, and you're welcome to shoot in a [PR](https://github.com/azerion/phaser-ads/compare) to add a new provider =)
106 |
107 | Disclaimer
108 | ----------
109 | We at Azerion just love playing and creating awesome games. We aren't affiliated with Phaser.io. We just needed some awesome ads in our awesome HTML5 games. Feel free to use it for enhancing your own awesome games!
110 |
111 | Phaser Ads is distributed under the MIT license. All 3rd party libraries and components are distributed under their
112 | respective license terms.
113 |
--------------------------------------------------------------------------------
/build/phaser-ads.d.ts:
--------------------------------------------------------------------------------
1 | declare module 'phaser-ads' {
2 | export = PhaserAds;
3 | }
4 | declare module PhaserAds {
5 | interface IAdGame extends Phaser.Game {
6 | ads: AdManager;
7 | }
8 | enum AdEvent {
9 | start = 0,
10 | firstQuartile = 1,
11 | midPoint = 2,
12 | thirdQuartile = 3,
13 | complete = 4
14 | }
15 | enum AdType {
16 | interstitial = 0,
17 | rewarded = 1,
18 | banner = 2,
19 | video = 3
20 | }
21 | class AdManager extends Phaser.Plugin {
22 | onContentPaused: Phaser.Signal;
23 | onContentResumed: Phaser.Signal;
24 | onAdProgression: Phaser.Signal;
25 | onAdsDisabled: Phaser.Signal;
26 | onAdClicked: Phaser.Signal;
27 | onAdRewardGranted: Phaser.Signal;
28 | onAdLoaded: Phaser.Signal;
29 | onBannerShown: Phaser.Signal;
30 | onBannerHidden: Phaser.Signal;
31 | bannerActive: boolean;
32 | private provider;
33 | private wasMuted;
34 | constructor(game: IAdGame, pluginManager: Phaser.PluginManager);
35 | /**
36 | * Here we set an adprovider, any can be given as long as it implements the IProvider interface
37 | *
38 | * @param provider
39 | */
40 | setAdProvider(provider: AdProvider.IProvider): void;
41 | /**
42 | * Here we request an ad, the arguments passed depend on the provider used!
43 | * @param args
44 | */
45 | showAd(...args: any[]): void;
46 | loadBanner(...args: any[]): any;
47 | isRewardedAvailable(): boolean;
48 | /**
49 | * Some providers might require you to preload an ad before showing it, that can be done here
50 | *
51 | * @param args
52 | */
53 | preloadAd(...args: any[]): void;
54 | /**
55 | * Some providers require you to destroy an add after it was shown, that can be done here.
56 | *
57 | * @param args
58 | */
59 | destroyAd(...args: any[]): void;
60 | /**
61 | * Some providers allow you to hide an ad, you might think of an banner ad that is shown in show cases
62 | *
63 | * @param args
64 | */
65 | hideAd(...args: any[]): void;
66 | /**
67 | * Checks if ads are enabled or blocked
68 | *
69 | * @param args
70 | */
71 | adsEnabled(): boolean;
72 | /**
73 | * Should be called after ad was(n't) shown, demutes the game so we can peacefully continue
74 | */
75 | unMuteAfterAd(): void;
76 | }
77 | }
78 | declare module PhaserAds {
79 | module AdProvider {
80 | enum CocoonProvider {
81 | AdMob = 0,
82 | MoPub = 1,
83 | Chartboost = 2,
84 | Heyzap = 3
85 | }
86 | class CocoonAds implements IProvider {
87 | adManager: AdManager;
88 | adsEnabled: boolean;
89 | private cocoonProvider;
90 | private banner;
91 | private bannerShowable;
92 | private interstitial;
93 | private interstitialShowable;
94 | private rewarded;
95 | hasRewarded: boolean;
96 | constructor(game: Phaser.Game, provider: CocoonProvider, config?: any);
97 | setManager(manager: AdManager): void;
98 | showAd(adType: AdType): void;
99 | preloadAd(adType: AdType, adId?: string, bannerPosition?: string): void;
100 | destroyAd(adType: AdType): void;
101 | hideAd(adType: AdType): void;
102 | }
103 | }
104 | }
105 | declare module PhaserAds {
106 | module AdProvider {
107 | class CordovaGameDistribution implements PhaserAds.AdProvider.IProvider {
108 | adManager: AdManager;
109 | adsEnabled: boolean;
110 | hasRewarded: boolean;
111 | constructor(game: Phaser.Game, gameId: string, userId: string, debug?: boolean);
112 | private setAdListeners;
113 | setManager(manager: PhaserAds.AdManager): void;
114 | showAd(adType?: AdType): void;
115 | preloadAd(): void;
116 | destroyAd(): void;
117 | hideAd(): void;
118 | }
119 | }
120 | }
121 | declare module PhaserAds {
122 | module AdProvider {
123 | enum HeyzapAdTypes {
124 | Interstitial = 0,
125 | Video = 1,
126 | Rewarded = 2,
127 | Banner = 3
128 | }
129 | class CordovaHeyzap implements IProvider {
130 | adManager: AdManager;
131 | adsEnabled: boolean;
132 | hasRewarded: boolean;
133 | constructor(game: Phaser.Game, publisherId: string);
134 | setManager(manager: AdManager): void;
135 | showAd(adType: HeyzapAdTypes, bannerAdPositions?: string): void;
136 | preloadAd(adType: HeyzapAdTypes): void;
137 | destroyAd(adType: HeyzapAdTypes): void;
138 | hideAd(adType: HeyzapAdTypes): void;
139 | }
140 | }
141 | }
142 | declare module PhaserAds {
143 | module AdProvider {
144 | enum GameDistributionAdType {
145 | interstitial = "interstitial",
146 | rewarded = "rewarded",
147 | display = "display"
148 | }
149 | enum GameDistributionBannerSize {
150 | LargeRectangle = 0,
151 | MediumRectangle = 1,
152 | Billboard = 2,
153 | Leaderboard = 3,
154 | Skyscraper = 4,
155 | WideSkyscraper = 5
156 | }
157 | enum GameDistributionAlignment {
158 | TopLeft = 0,
159 | TopCenter = 1,
160 | TopRight = 2,
161 | CenterLeft = 3,
162 | Center = 4,
163 | CenterRight = 5,
164 | BottomLeft = 6,
165 | BottomCenter = 7,
166 | BottomRight = 8
167 | }
168 | class GameDistributionBanner {
169 | element: HTMLElement;
170 | private resizeListener;
171 | private parent;
172 | private alignment;
173 | private width;
174 | private height;
175 | private offsetX;
176 | private offsetY;
177 | constructor();
178 | loadBanner(): void;
179 | destroy(): void;
180 | alignIn(element: HTMLElement, position: GameDistributionAlignment): void;
181 | setOffset(x?: number, y?: number): void;
182 | private resize;
183 | setSize(size: GameDistributionBannerSize): void;
184 | position(x: number, y: number): void;
185 | }
186 | class GameDistributionAds implements PhaserAds.AdProvider.IProvider {
187 | adManager: AdManager;
188 | adsEnabled: boolean;
189 | hasRewarded: boolean;
190 | constructor(game: Phaser.Game, gameId: string, userId?: string);
191 | setManager(manager: PhaserAds.AdManager): void;
192 | showAd(adType: AdType, containerId?: string): void;
193 | loadBanner(size: GameDistributionBannerSize): GameDistributionBanner;
194 | preloadAd(adType: PhaserAds.AdType): void;
195 | destroyAd(): void;
196 | hideAd(): void;
197 | /**
198 | * Checks if the ads are enabled (e.g; adblock is enabled or not)
199 | * @returns {boolean}
200 | */
201 | private areAdsEnabled;
202 | }
203 | }
204 | }
205 | declare module PhaserAds {
206 | module AdProvider {
207 | interface ICustomParams {
208 | [name: string]: string | number | any[];
209 | }
210 | class Ima3 implements IProvider {
211 | private gameContent;
212 | private adContent;
213 | private adDisplay;
214 | private adLoader;
215 | private adsManager;
216 | private googleEnabled;
217 | adsEnabled: boolean;
218 | private adTagUrl;
219 | private game;
220 | private adRequested;
221 | hasRewarded: boolean;
222 | adManager: AdManager;
223 | private resizeListener;
224 | constructor(game: Phaser.Game, adTagUrl: string);
225 | setManager(manager: AdManager): void;
226 | /**
227 | * Doing an ad request, if anything is wrong with the lib (missing ima3, failed request) we just dispatch the contentResumed event
228 | * Otherwise we display an ad
229 | */
230 | showAd(customParams?: ICustomParams): void;
231 | preloadAd(): void;
232 | destroyAd(): void;
233 | hideAd(): void;
234 | /**
235 | * Called when the ads manager was loaded.
236 | * We register all ad related events here, and initialize the manager with the game width/height
237 | *
238 | * @param adsManagerLoadedEvent
239 | */
240 | private onAdManagerLoader;
241 | /**
242 | * Generic ad events are handled here
243 | * @param adEvent
244 | */
245 | private onAdEvent;
246 | private onAdError;
247 | /**
248 | * When the ad starts playing, and the game should be paused
249 | */
250 | private onContentPauseRequested;
251 | /**
252 | * When the ad is finished and the game should be resumed
253 | */
254 | private onContentResumeRequested;
255 | private parseCustomParams;
256 | /**
257 | * Checks if the ads are enabled (e.g; adblock is enabled or not)
258 | * @returns {boolean}
259 | */
260 | private areAdsEnabled;
261 | }
262 | }
263 | }
264 | declare module PhaserAds {
265 | module AdProvider {
266 | interface IProvider {
267 | adManager: AdManager;
268 | adsEnabled: boolean;
269 | hasRewarded: boolean;
270 | setManager(manager: AdManager): void;
271 | preloadAd(...args: any[]): void;
272 | destroyAd(...args: any[]): void;
273 | hideAd(...args: any[]): void;
274 | showAd(...args: any[]): void;
275 | loadBanner?(...args: any[]): void;
276 | }
277 | }
278 | }
279 |
--------------------------------------------------------------------------------
/build/phaser-ads.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"phaser-ads.js","sourceRoot":"","sources":["../ts/AdManager.ts","../ts/Providers/Cocoon.ts","../ts/Providers/CordovaGameDistribution.ts","../ts/Providers/CordovaHeyzap.ts","../ts/Providers/GameDistributionAds.ts","../ts/Providers/Ima3.ts","../ts/Providers/IProvider.ts"],"names":[],"mappings":";;;;;;;;;;AAIA,I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AgB,IAAI,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC;yBACzC;qBACJ;oBACD,OAAO,eAAe,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;iBACjE;gBAED,OAAO,EAAE,CAAC;YACd,CAAC;YAED;;;eAGG;YACK,4BAAa,GAArB;gBAAA,iBAsBC;gBArBG,IAAI,IAAI,GAAgB,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;gBAC1B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;gBACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAEhC,2BAA2B;gBAC3B,IAAI,SAAS,GAAkB;oBAC3B,IAAI,OAAO,GAAY,IAAI,CAAC;oBAC5B,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE;wBACzB,OAAO,GAAG,KAAK,CAAC;qBACnB;oBACD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBAElC,OAAO,OAAO,CAAC;gBACnB,CAAC,CAAC;gBAEF,MAAM,CAAC,UAAU,CAAC;oBACd,KAAI,CAAC,UAAU,GAAG,SAAS,EAAE,CAAC;gBAClC,CAAC,EAAE,GAAG,CAAC,CAAC;YACZ,CAAC;YACL,WAAC;QAAD,CAAC,AAxVD,IAwVC;QAxVY,eAAI,OAwVhB,CAAA;IACL,CAAC,EA9Va,UAAU,GAAV,oBAAU,KAAV,oBAAU,QA8VvB;AACL,CAAC,EAhWM,SAAS,KAAT,SAAS,QAgWf"}
--------------------------------------------------------------------------------
/build/phaser-ads.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * phaser-ads - version 2.4.1
3 | * A Phaser plugin for providing nice ads integration in your phaser.io game
4 | *
5 | * Azerion
6 | * Build at 15-11-2019
7 | * Released under MIT License
8 | */
9 |
10 | var __extends=this&&this.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])};return function(b,c){function d(){this.constructor=b}a(b,c),b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}(),PhaserAds;!function(a){var b;!function(a){a[a.start=0]="start",a[a.firstQuartile=1]="firstQuartile",a[a.midPoint=2]="midPoint",a[a.thirdQuartile=3]="thirdQuartile",a[a.complete=4]="complete"}(b=a.AdEvent||(a.AdEvent={}));var c;!function(a){a[a.interstitial=0]="interstitial",a[a.rewarded=1]="rewarded",a[a.banner=2]="banner",a[a.video=3]="video"}(c=a.AdType||(a.AdType={}));var d=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.onContentPaused=new Phaser.Signal,d.onContentResumed=new Phaser.Signal,d.onAdProgression=new Phaser.Signal,d.onAdsDisabled=new Phaser.Signal,d.onAdClicked=new Phaser.Signal,d.onAdRewardGranted=new Phaser.Signal,d.onAdLoaded=new Phaser.Signal,d.onBannerShown=new Phaser.Signal,d.onBannerHidden=new Phaser.Signal,d.bannerActive=!1,d.provider=null,d.wasMuted=!1,Object.defineProperty(b,"ads",{value:d}),d}return __extends(b,a),b.prototype.setAdProvider=function(a){this.provider=a,this.provider.setManager(this)},b.prototype.showAd=function(){for(var a=[],b=0;b0&&(b+="&");var d=Array.isArray(a[c])?a[c].join(","):a[c];b+=c+"="+d}return"&cust_params="+encodeURIComponent(b)}return""},b.prototype.areAdsEnabled=function(){var a=this,b=document.createElement("div");b.innerHTML=" ",b.className="adsbox",b.style.position="absolute",b.style.fontSize="10px",document.body.appendChild(b);var c=function(){var a=!0;return 0===b.offsetHeight&&(a=!1),b.parentNode.removeChild(b),a};window.setTimeout(function(){a.adsEnabled=c()},100)},b}();b.Ima3=c}(b=a.AdProvider||(a.AdProvider={}))}(PhaserAds||(PhaserAds={}));
--------------------------------------------------------------------------------
/example/bodenstaendig_2000_in_rock_4bit.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azerion/phaser-ads/b49d7373c8e22af8ccde71059bb9f7cd7a5660e6/example/bodenstaendig_2000_in_rock_4bit.ogg
--------------------------------------------------------------------------------
/example/gamedistribution.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Phaser Advertisement example
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
22 |
23 |
24 |
160 |
161 |
162 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/example/ima3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Phaser Advertisement example
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
23 |
24 |
25 |
138 |
139 |
140 |
143 |
144 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@azerion/phaser-ads",
3 | "author": "Azerion",
4 | "version": "2.4.1",
5 | "description": "A Phaser plugin for providing nice ads integration in your phaser.io game",
6 | "contributors": [
7 | {
8 | "name": "Ale Bles",
9 | "email": "a.bles@azerion.com"
10 | }
11 | ],
12 | "repository": {
13 | "type": "git",
14 | "url": "git@github.com:azerion/phaser-ads.git"
15 | },
16 | "licenses": [
17 | {
18 | "type": "MIT",
19 | "url": "https://github.com/azerion/phaser-ads/raw/master/LICENSE"
20 | }
21 | ],
22 | "bugs": [
23 | {
24 | "url": "https://github.com/azerion/phaser-ads/issues"
25 | }
26 | ],
27 | "config": {
28 | "name": "phaser-ads"
29 | },
30 | "devDependencies": {
31 | "@types/es6-promise": "0.0.32",
32 | "grunt": "^1.0.4",
33 | "grunt-banner": "^0.6.0",
34 | "grunt-contrib-clean": "1.0.x",
35 | "grunt-contrib-connect": "^2.1.0",
36 | "grunt-contrib-uglify": "2.0.x",
37 | "grunt-contrib-watch": "^1.1.0",
38 | "grunt-ts": "^6.0.0-beta.22",
39 | "grunt-tslint": "^3.3.0",
40 | "phaser": "2.6.2",
41 | "tslint": "^3.15.1",
42 | "typescript": "^2.9.2"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/ts/AdManager.ts:
--------------------------------------------------------------------------------
1 | declare module 'phaser-ads' {
2 | export = PhaserAds;
3 | }
4 |
5 | module PhaserAds {
6 | export interface IAdGame extends Phaser.Game {
7 | ads: AdManager;
8 | }
9 |
10 | export enum AdEvent {
11 | start,
12 | firstQuartile,
13 | midPoint,
14 | thirdQuartile,
15 | complete
16 | }
17 |
18 | export enum AdType {
19 | interstitial,
20 | rewarded,
21 | banner,
22 | video
23 | }
24 |
25 | export class AdManager extends Phaser.Plugin {
26 | public onContentPaused: Phaser.Signal = new Phaser.Signal();
27 |
28 | public onContentResumed: Phaser.Signal = new Phaser.Signal();
29 |
30 | public onAdProgression: Phaser.Signal = new Phaser.Signal();
31 |
32 | public onAdsDisabled: Phaser.Signal = new Phaser.Signal();
33 |
34 | public onAdClicked: Phaser.Signal = new Phaser.Signal();
35 |
36 | public onAdRewardGranted: Phaser.Signal = new Phaser.Signal();
37 |
38 | public onAdLoaded: Phaser.Signal = new Phaser.Signal();
39 |
40 | public onBannerShown: Phaser.Signal = new Phaser.Signal();
41 |
42 | public onBannerHidden: Phaser.Signal = new Phaser.Signal();
43 |
44 | public bannerActive: boolean = false;
45 |
46 | private provider: AdProvider.IProvider = null;
47 |
48 | private wasMuted: boolean = false;
49 |
50 | constructor(game: IAdGame, pluginManager: Phaser.PluginManager) {
51 | super(game, pluginManager);
52 |
53 | Object.defineProperty(game, 'ads', {
54 | value: this
55 | });
56 | }
57 |
58 | /**
59 | * Here we set an adprovider, any can be given as long as it implements the IProvider interface
60 | *
61 | * @param provider
62 | */
63 | public setAdProvider(provider: AdProvider.IProvider): void {
64 | this.provider = provider;
65 | this.provider.setManager(this);
66 | }
67 |
68 | /**
69 | * Here we request an ad, the arguments passed depend on the provider used!
70 | * @param args
71 | */
72 | public showAd(...args: any[]): void {
73 | if (null === this.provider) {
74 | throw new Error('Can not request an ad without an provider, please attach an ad provider!');
75 | }
76 |
77 | //Let's not do this for banner's
78 | if (args[0] !== AdType.banner) {
79 | //first we check if the sound was already muted before we requested an add
80 | this.wasMuted = this.game.sound.mute;
81 | //Let's mute audio for the game, we can resume the audi playback once the add has played
82 | this.game.sound.mute = true;
83 | }
84 |
85 | this.provider.showAd.apply(this.provider, args);
86 | }
87 |
88 | public loadBanner(...args: any[]): any {
89 | return this.provider.loadBanner.apply(this.provider, args);
90 | }
91 |
92 | public isRewardedAvailable(): boolean {
93 | return this.provider.hasRewarded;
94 | }
95 |
96 | /**
97 | * Some providers might require you to preload an ad before showing it, that can be done here
98 | *
99 | * @param args
100 | */
101 | public preloadAd(...args: any[]): void {
102 | if (null === this.provider) {
103 | throw new Error('Can not preload an ad without an provider, please attach an ad provider!');
104 | }
105 |
106 | this.provider.preloadAd.apply(this.provider, args);
107 | }
108 |
109 | /**
110 | * Some providers require you to destroy an add after it was shown, that can be done here.
111 | *
112 | * @param args
113 | */
114 | public destroyAd(...args: any[]): void {
115 | if (null === this.provider) {
116 | throw new Error('Can not destroy an ad without an provider, please attach an ad provider!');
117 | }
118 |
119 | this.provider.destroyAd.apply(this.provider, args);
120 | }
121 |
122 | /**
123 | * Some providers allow you to hide an ad, you might think of an banner ad that is shown in show cases
124 | *
125 | * @param args
126 | */
127 | public hideAd(...args: any[]): void {
128 | if (null === this.provider) {
129 | throw new Error('Can not hide an ad without an provider, please attach an ad provider!');
130 | }
131 |
132 | this.unMuteAfterAd();
133 |
134 | this.provider.hideAd.apply(this.provider, args);
135 | }
136 |
137 | /**
138 | * Checks if ads are enabled or blocked
139 | *
140 | * @param args
141 | */
142 | public adsEnabled(): boolean {
143 | return this.provider.adsEnabled;
144 | }
145 |
146 | /**
147 | * Should be called after ad was(n't) shown, demutes the game so we can peacefully continue
148 | */
149 | public unMuteAfterAd(): void {
150 | if (!this.wasMuted) {
151 | //Here we unmute audio, but only if it wasn't muted before requesting an add
152 | this.game.sound.mute = false;
153 | }
154 |
155 | }
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/ts/Providers/Cocoon.ts:
--------------------------------------------------------------------------------
1 | module PhaserAds {
2 | export module AdProvider {
3 | export enum CocoonProvider {
4 | AdMob,
5 | MoPub,
6 | Chartboost,
7 | Heyzap
8 | }
9 |
10 | export class CocoonAds implements IProvider {
11 | public adManager: AdManager;
12 |
13 | public adsEnabled: boolean = false;
14 |
15 | private cocoonProvider: Cocoon.Ad.IAdProvider;
16 |
17 | private banner: Cocoon.Ad.IBanner = null;
18 |
19 | private bannerShowable: boolean = false;
20 |
21 | private interstitial: Cocoon.Ad.IBanner = null;
22 |
23 | private interstitialShowable: boolean = false;
24 |
25 | private rewarded: Cocoon.Ad.IBanner = null;
26 |
27 | public hasRewarded: boolean = false;
28 |
29 | constructor(game: Phaser.Game, provider: CocoonProvider, config?: any) {
30 | if ((game.device.cordova || game.device.crosswalk) && (Cocoon && Cocoon.Ad)) {
31 | this.adsEnabled = true;
32 | } else {
33 | return;
34 | }
35 |
36 | switch (provider) {
37 | default:
38 | case CocoonProvider.AdMob:
39 | this.cocoonProvider = Cocoon.Ad.AdMob;
40 | break;
41 | case CocoonProvider.Chartboost:
42 | this.cocoonProvider = Cocoon.Ad.Chartboost;
43 | break;
44 | case CocoonProvider.Heyzap:
45 | this.cocoonProvider = Cocoon.Ad.Heyzap;
46 | break;
47 | case CocoonProvider.MoPub:
48 | this.cocoonProvider = Cocoon.Ad.MoPub;
49 | break;
50 | }
51 |
52 | this.cocoonProvider.configure(config);
53 | }
54 |
55 | public setManager(manager: AdManager): void {
56 | this.adManager = manager;
57 | }
58 |
59 | public showAd(adType: AdType): void {
60 | if (!this.adsEnabled) {
61 | this.adManager.unMuteAfterAd();
62 | if (!(adType === AdType.banner)) {
63 | this.adManager.onContentResumed.dispatch();
64 | }
65 | return;
66 | }
67 |
68 | if (adType === AdType.banner) {
69 | if (!this.bannerShowable || null === this.banner) {
70 | this.adManager.unMuteAfterAd();
71 | //No banner ad available, skipping
72 | //this.adManager.onContentResumed.dispatch(CocoonAdType.banner);
73 | return;
74 | }
75 | this.adManager.onBannerShown.dispatch(this.banner.width, this.banner.height);
76 | this.adManager.bannerActive = true;
77 | this.banner.show();
78 | }
79 |
80 | if (adType === AdType.interstitial) {
81 | if (!this.interstitialShowable || null === this.interstitial) {
82 | this.adManager.unMuteAfterAd();
83 | //No banner ad available, skipping
84 | this.adManager.onContentResumed.dispatch(AdType.interstitial);
85 | return;
86 | }
87 |
88 | this.interstitial.show();
89 | }
90 |
91 | if (adType === AdType.rewarded) {
92 | if (!this.hasRewarded || null === this.rewarded) {
93 | this.adManager.unMuteAfterAd();
94 | //No banner ad available, skipping
95 | this.adManager.onContentResumed.dispatch(AdType.rewarded);
96 | return;
97 | }
98 |
99 | this.rewarded.show();
100 | }
101 | }
102 |
103 | public preloadAd(adType: AdType, adId?: string, bannerPosition?: string): void {
104 | if (!this.adsEnabled) {
105 | return;
106 | }
107 |
108 | //Some cleanup before preloading a new ad
109 | this.destroyAd(adType);
110 |
111 | if (adType === AdType.banner) {
112 | this.banner = this.cocoonProvider.createBanner(adId);
113 | if (bannerPosition) {
114 | this.banner.setLayout(bannerPosition);
115 | }
116 | this.banner.on('load', () => {
117 | this.bannerShowable = true;
118 | });
119 | this.banner.on('fail', () => {
120 | this.bannerShowable = false;
121 | this.banner = null;
122 | });
123 | this.banner.on('click', () => {
124 | this.adManager.onAdClicked.dispatch(AdType.banner);
125 | });
126 |
127 | //Banner don't pause or resume content
128 | this.banner.on('show', () => {
129 | /*this.adManager.onBannerShown.dispatch(this.banner.width, this.banner.height);
130 | this.adManager.bannerActive = true;*/
131 | // this.adManager.onContentPaused.dispatch(AdType.banner);
132 | });
133 |
134 | this.banner.on('dismiss', () => {
135 | /*this.adManager.bannerActive = false;
136 | this.adManager.onBannerHidden.dispatch(this.banner.width, this.banner.height);*/
137 | // this.adManager.onContentResumed.dispatch(AdType.banner);
138 | // this.bannerShowable = false;
139 | // this.banner = null;
140 | });
141 | this.banner.load();
142 | }
143 |
144 | if (adType === AdType.interstitial) {
145 | this.interstitial = this.cocoonProvider.createInterstitial(adId);
146 | this.interstitial.on('load', () => {
147 | this.interstitialShowable = true;
148 | });
149 | this.interstitial.on('fail', () => {
150 | this.interstitialShowable = false;
151 | this.interstitial = null;
152 | });
153 | this.interstitial.on('click', () => {
154 | this.adManager.onAdClicked.dispatch(AdType.interstitial);
155 | });
156 |
157 | this.interstitial.on('show', () => {
158 | this.adManager.onContentPaused.dispatch(AdType.interstitial);
159 | });
160 |
161 | this.interstitial.on('dismiss', () => {
162 | this.adManager.unMuteAfterAd();
163 | this.adManager.onContentResumed.dispatch(AdType.interstitial);
164 | this.interstitialShowable = false;
165 | this.interstitial = null;
166 | });
167 | this.interstitial.load();
168 | }
169 |
170 | if (adType === AdType.rewarded) {
171 | this.rewarded = this.cocoonProvider.createRewardedVideo(adId);
172 | this.rewarded.on('load', () => {
173 | this.hasRewarded = true;
174 | });
175 | this.rewarded.on('fail', () => {
176 | this.hasRewarded = false;
177 | this.rewarded = null;
178 | });
179 | this.rewarded.on('click', () => {
180 | this.adManager.onAdClicked.dispatch(AdType.rewarded);
181 | });
182 |
183 | this.rewarded.on('show', () => {
184 | this.adManager.onContentPaused.dispatch(AdType.rewarded);
185 | });
186 |
187 | this.rewarded.on('dismiss', () => {
188 | this.adManager.unMuteAfterAd();
189 | this.adManager.onContentResumed.dispatch(AdType.rewarded);
190 | this.hasRewarded = false;
191 | this.rewarded = null;
192 | });
193 |
194 | this.rewarded.on('reward', () => {
195 | this.adManager.unMuteAfterAd();
196 | this.adManager.onAdRewardGranted.dispatch(AdType.rewarded);
197 | this.hasRewarded = false;
198 | this.rewarded = null;
199 | });
200 | this.rewarded.load();
201 | }
202 | }
203 |
204 | public destroyAd(adType: AdType): void {
205 | if (!this.adsEnabled) {
206 | return;
207 | }
208 |
209 | if (adType === AdType.banner && null !== this.banner) {
210 | //Releasing banners will fail on cocoon due to:
211 | // https://github.com/ludei/atomic-plugins-ads/pull/12
212 | try {
213 | this.cocoonProvider.releaseBanner(this.banner);
214 | } catch (e) {
215 | //silently ignore
216 | }
217 | this.banner = null;
218 | this.bannerShowable = false;
219 | }
220 |
221 | if (adType === AdType.interstitial && null !== this.interstitial) {
222 | this.cocoonProvider.releaseInterstitial(this.interstitial);
223 | this.interstitial = null;
224 | this.interstitialShowable = false;
225 | }
226 | }
227 |
228 | public hideAd(adType: AdType): void {
229 | if (!this.adsEnabled) {
230 | return;
231 | }
232 |
233 | if (adType === AdType.interstitial && null !== this.interstitial) {
234 | this.interstitial.hide();
235 |
236 | // this.adManager.onContentResumed.dispatch(AdType.interstitial);
237 | }
238 |
239 | if (adType === AdType.banner && null !== this.banner) {
240 | if (this.adManager.bannerActive) {
241 | this.adManager.bannerActive = false;
242 | this.adManager.onBannerHidden.dispatch(this.banner.width, this.banner.height);
243 | }
244 | this.banner.hide();
245 |
246 | // this.adManager.onContentResumed.dispatch(AdType.banner);
247 | }
248 |
249 | if (adType === AdType.rewarded && null !== this.rewarded) {
250 | this.rewarded.hide();
251 |
252 | // this.adManager.onContentResumed.dispatch(AdType.rewarded);
253 | }
254 | }
255 |
256 | /*public setLayout(bannerPosition: string): void {
257 | this.banner.setLayout(bannerPosition);
258 | }
259 |
260 | public setPosition(x: number, y: number): void {
261 | this.banner.setPosition(x, y);
262 | }*/
263 | }
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/ts/Providers/CordovaGameDistribution.ts:
--------------------------------------------------------------------------------
1 | module PhaserAds {
2 | export module AdProvider {
3 | export class CordovaGameDistribution implements PhaserAds.AdProvider.IProvider {
4 | public adManager: AdManager;
5 |
6 | public adsEnabled: boolean = false;
7 |
8 | public hasRewarded: boolean = false;
9 |
10 | constructor(game: Phaser.Game, gameId: string, userId: string, debug: boolean = false) {
11 | if (cordova.plugins === undefined ||
12 | (cordova.plugins !== undefined && cordova.plugins.gdApi === undefined)
13 | ) {
14 | console.log('gdApi not available!');
15 | return;
16 | }
17 |
18 | if (debug) {
19 | cordova.plugins.gdApi.enableTestAds();
20 | }
21 |
22 | this.setAdListeners();
23 | (cordova.plugins.gdApi).init([
24 | gameId,
25 | userId
26 | ], (data: any) => {
27 | console.log('API init success!', data);
28 | }, (error: any) => {
29 | console.log('API init error!', error);
30 | });
31 | }
32 |
33 | private setAdListeners(): void {
34 | (cordova.plugins.gdApi).setAdListener((data: any) => {
35 | console.log('banner reply, data.event', data.event, data);
36 | switch (data.event) {
37 | case 'BANNER_STARTED':
38 | this.adManager.onContentPaused.dispatch();
39 | break;
40 | case 'API_IS_READY':
41 | //Send post init
42 | this.adsEnabled = true;
43 | break;
44 | case 'API_ALREADY_INITIALIZED':
45 | break;
46 | case 'BANNER_CLOSED':
47 | case 'API_NOT_READY':
48 | case 'BANNER_FAILED':
49 | this.adManager.onContentResumed.dispatch();
50 | break;
51 | }
52 | }, (error: any) => {
53 | console.log('Set listener error:', error);
54 | this.adsEnabled = false;
55 | });
56 | }
57 |
58 | public setManager(manager: PhaserAds.AdManager): void {
59 | this.adManager = manager;
60 | }
61 |
62 | public showAd(adType?: AdType): void {
63 | if (this.adsEnabled) {
64 | console.log('show banner called');
65 | (cordova.plugins.gdApi).showBanner((data: any) => {
66 | console.log('Show banner worked', data);
67 | }, (data: any) => {
68 | console.log('Could not show banner:', data);
69 | this.adManager.onContentResumed.dispatch();
70 | });
71 | } else {
72 | console.log('Ads not enabled, resuming');
73 | this.adManager.onContentResumed.dispatch();
74 | }
75 | }
76 |
77 | //Does nothing, but needed for Provider interface
78 | public preloadAd(): void {
79 | return;
80 | }
81 |
82 | //Does nothing, but needed for Provider interface
83 | public destroyAd(): void {
84 | return;
85 | }
86 |
87 | //Does nothing, but needed for Provider interface
88 | public hideAd(): void {
89 | return;
90 | }
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/ts/Providers/CordovaHeyzap.ts:
--------------------------------------------------------------------------------
1 | module PhaserAds {
2 | export module AdProvider {
3 | export enum HeyzapAdTypes {
4 | Interstitial,
5 | Video,
6 | Rewarded,
7 | Banner
8 | }
9 |
10 | export class CordovaHeyzap implements IProvider {
11 | public adManager: AdManager;
12 |
13 | public adsEnabled: boolean = false;
14 |
15 | public hasRewarded: boolean = false;
16 |
17 | constructor(game: Phaser.Game, publisherId: string) {
18 | if (game.device.cordova || game.device.crosswalk) {
19 | this.adsEnabled = true;
20 | } else {
21 | return;
22 | }
23 |
24 | HeyzapAds.start(publisherId).then(() => {
25 | // Native call successful.
26 | }, (error: any) => {
27 | //Failed to start heyzap, disabling ads
28 | this.adsEnabled = false;
29 | });
30 | }
31 |
32 | public setManager(manager: AdManager): void {
33 | this.adManager = manager;
34 | }
35 |
36 | public showAd(adType: HeyzapAdTypes, bannerAdPositions?: string): void {
37 | if (!this.adsEnabled) {
38 | this.adManager.unMuteAfterAd();
39 | this.adManager.onContentResumed.dispatch();
40 | }
41 |
42 | switch (adType) {
43 | case HeyzapAdTypes.Interstitial:
44 | //Register event listeners
45 | HeyzapAds.InterstitialAd.addEventListener(HeyzapAds.InterstitialAd.Events.HIDE, () => {
46 | this.adManager.unMuteAfterAd();
47 | this.adManager.onContentResumed.dispatch(HeyzapAds.InterstitialAd.Events.HIDE);
48 | });
49 | HeyzapAds.InterstitialAd.addEventListener(HeyzapAds.InterstitialAd.Events.SHOW_FAILED, () => {
50 | this.adManager.unMuteAfterAd();
51 | this.adManager.onContentResumed.dispatch(HeyzapAds.InterstitialAd.Events.SHOW_FAILED);
52 | });
53 | HeyzapAds.InterstitialAd.addEventListener(HeyzapAds.InterstitialAd.Events.CLICKED, () => {
54 | this.adManager.onAdClicked.dispatch(HeyzapAds.InterstitialAd.Events.CLICKED);
55 | });
56 |
57 | HeyzapAds.InterstitialAd.show().then(() => {
58 | // Native call successful.
59 | this.adManager.onContentPaused.dispatch();
60 | }, (error: any) => {
61 | this.adManager.unMuteAfterAd();
62 | //Failed to show insentive ad, continue operations
63 | this.adManager.onContentResumed.dispatch();
64 | });
65 | break;
66 | case HeyzapAdTypes.Video:
67 | HeyzapAds.VideoAd.addEventListener(HeyzapAds.VideoAd.Events.HIDE, () => {
68 | this.adManager.unMuteAfterAd();
69 | this.adManager.onContentResumed.dispatch(HeyzapAds.VideoAd.Events.HIDE);
70 | });
71 | HeyzapAds.VideoAd.addEventListener(HeyzapAds.VideoAd.Events.SHOW_FAILED, () => {
72 | this.adManager.unMuteAfterAd();
73 | this.adManager.onContentResumed.dispatch(HeyzapAds.VideoAd.Events.SHOW_FAILED);
74 | });
75 | HeyzapAds.VideoAd.addEventListener(HeyzapAds.VideoAd.Events.CLICKED, () => {
76 | this.adManager.onAdClicked.dispatch(HeyzapAds.VideoAd.Events.CLICKED);
77 | });
78 |
79 | HeyzapAds.VideoAd.show().then(() => {
80 | // Native call successful.
81 | this.adManager.onContentPaused.dispatch();
82 | }, (error: any) => {
83 | this.adManager.unMuteAfterAd();
84 | //Failed to show insentive ad, continue operations
85 | this.adManager.onContentResumed.dispatch();
86 | });
87 | break;
88 | case HeyzapAdTypes.Rewarded:
89 | HeyzapAds.IncentivizedAd.addEventListener(HeyzapAds.IncentivizedAd.Events.HIDE, () => {
90 | this.adManager.unMuteAfterAd();
91 | this.adManager.onContentResumed.dispatch(HeyzapAds.IncentivizedAd.Events.HIDE);
92 | });
93 | HeyzapAds.IncentivizedAd.addEventListener(HeyzapAds.IncentivizedAd.Events.SHOW_FAILED, () => {
94 | this.adManager.unMuteAfterAd();
95 | this.adManager.onContentResumed.dispatch(HeyzapAds.IncentivizedAd.Events.SHOW_FAILED);
96 | });
97 | HeyzapAds.IncentivizedAd.addEventListener(HeyzapAds.IncentivizedAd.Events.CLICKED, () => {
98 | this.adManager.onAdClicked.dispatch(HeyzapAds.IncentivizedAd.Events.CLICKED);
99 | });
100 |
101 | HeyzapAds.IncentivizedAd.show().then(() => {
102 | // Native call successful.
103 | this.adManager.onContentPaused.dispatch();
104 | }, (error: any) => {
105 | this.adManager.unMuteAfterAd();
106 | //Failed to show insentive ad, continue operations
107 | this.adManager.onContentResumed.dispatch();
108 | });
109 | break;
110 | case HeyzapAdTypes.Banner:
111 | HeyzapAds.BannerAd.show(bannerAdPositions).then(() => {
112 | // Native call successful.
113 | }, (error: any) => {
114 | // Handle Error
115 | });
116 | break;
117 | }
118 | }
119 |
120 | public preloadAd(adType: HeyzapAdTypes): void {
121 | if (!this.adsEnabled) {
122 | return;
123 | }
124 |
125 | if (adType === HeyzapAdTypes.Rewarded) {
126 | HeyzapAds.IncentivizedAd.fetch().then(() => {
127 | // Native call successful.
128 | }, (error: any) => {
129 | // Handle Error
130 | });
131 | }
132 |
133 | return;
134 | }
135 |
136 | public destroyAd(adType: HeyzapAdTypes): void {
137 | if (!this.adsEnabled) {
138 | return;
139 | }
140 |
141 | if (adType === HeyzapAdTypes.Banner) {
142 | HeyzapAds.BannerAd.destroy().then(() => {
143 | // Native call successful.
144 | }, (error: any) => {
145 | // Handle Error
146 | });
147 | }
148 |
149 | return;
150 | }
151 |
152 | public hideAd(adType: HeyzapAdTypes): void {
153 | if (!this.adsEnabled) {
154 | return;
155 | }
156 |
157 | if (adType === HeyzapAdTypes.Banner) {
158 | HeyzapAds.BannerAd.hide().then(() => {
159 | // Native call successful.
160 | }, (error: any) => {
161 | // Handle Error
162 | });
163 | }
164 |
165 | return;
166 | }
167 | }
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/ts/Providers/GameDistributionAds.ts:
--------------------------------------------------------------------------------
1 | module PhaserAds {
2 | export module AdProvider {
3 | export enum GameDistributionAdType {
4 | interstitial = 'interstitial',
5 | rewarded = 'rewarded',
6 | display = 'display'
7 | }
8 |
9 | export enum GameDistributionBannerSize {
10 | LargeRectangle, // 336x280
11 | MediumRectangle, // 300x250
12 | Billboard, // 970x250
13 | Leaderboard, // 728x90
14 | Skyscraper, // 120x600
15 | WideSkyscraper // 160x600
16 | }
17 |
18 | export enum GameDistributionAlignment {
19 | TopLeft,
20 | TopCenter,
21 | TopRight,
22 | CenterLeft,
23 | Center,
24 | CenterRight,
25 | BottomLeft,
26 | BottomCenter,
27 | BottomRight
28 | }
29 |
30 | export class GameDistributionBanner {
31 |
32 | public element: HTMLElement;
33 |
34 | private resizeListener: () => void;
35 |
36 | private parent: HTMLElement;
37 |
38 | private alignment: GameDistributionAlignment;
39 |
40 | private width: number;
41 |
42 | private height: number;
43 |
44 | private offsetX: number = 0;
45 |
46 | private offsetY: number = 0;
47 |
48 | constructor() {
49 | this.element = document.createElement('div');
50 | this.element.style.position = 'absolute';
51 | this.element.style.top = `0px`;
52 | this.element.style.left = `0px`;
53 | this.element.id = `banner-${Date.now()}${Math.random() * 10000000 | 0}`;
54 | document.body.appendChild(this.element);
55 | };
56 |
57 | public loadBanner(): void {
58 | return gdsdk.showAd(GameDistributionAdType.display, {
59 | containerId: this.element.id
60 | });
61 | }
62 |
63 | public destroy(): void {
64 | document.body.removeChild(this.element);
65 | this.element = null;
66 | this.parent = null;
67 | this.alignment = null;
68 |
69 | if (this.resizeListener) {
70 | window.removeEventListener('resize', this.resizeListener);
71 | }
72 | }
73 |
74 | public alignIn(element: HTMLElement, position: GameDistributionAlignment): void {
75 | this.parent = element;
76 | this.alignment = position;
77 |
78 | this.resizeListener = () => this.resize();
79 |
80 | window.addEventListener('resize', this.resizeListener);
81 |
82 | this.resize();
83 | }
84 |
85 | public setOffset(x: number = 0, y: number = 0): void {
86 | this.offsetX = x;
87 | this.offsetY = y;
88 |
89 | this.resize();
90 | }
91 |
92 | private resize(): void {
93 | const parentBoundingRect: ClientRect = this.parent.getBoundingClientRect();
94 |
95 | switch (this.alignment) {
96 | case GameDistributionAlignment.TopLeft:
97 | this.position(
98 | parentBoundingRect.left,
99 | parentBoundingRect.top
100 | );
101 | break;
102 | case GameDistributionAlignment.TopCenter:
103 | this.position(
104 | parentBoundingRect.left + parentBoundingRect.width / 2 - this.width / 2,
105 | parentBoundingRect.top
106 | );
107 | break;
108 | case GameDistributionAlignment.TopRight:
109 | this.position(
110 | parentBoundingRect.left + parentBoundingRect.width - this.width,
111 | parentBoundingRect.top
112 | );
113 | break;
114 | case GameDistributionAlignment.CenterLeft:
115 | this.position(
116 | parentBoundingRect.left,
117 | parentBoundingRect.top + parentBoundingRect.height / 2 - this.height / 2
118 | );
119 | break;
120 | case GameDistributionAlignment.Center:
121 | this.position(
122 | parentBoundingRect.left + parentBoundingRect.width / 2 - this.width / 2,
123 | parentBoundingRect.top + parentBoundingRect.height / 2 - this.height / 2
124 | );
125 | break;
126 | case GameDistributionAlignment.CenterRight:
127 | this.position(
128 | parentBoundingRect.left + parentBoundingRect.width - this.width,
129 | parentBoundingRect.top + parentBoundingRect.height / 2 - this.height / 2
130 | );
131 | break;
132 | case GameDistributionAlignment.BottomLeft:
133 | this.position(
134 | parentBoundingRect.left,
135 | parentBoundingRect.top + parentBoundingRect.height - this.height
136 | );
137 | break;
138 | case GameDistributionAlignment.BottomCenter:
139 | this.position(
140 | parentBoundingRect.left + parentBoundingRect.width / 2 - this.width / 2,
141 | parentBoundingRect.top + parentBoundingRect.height - this.height
142 | );
143 | break;
144 | case GameDistributionAlignment.BottomRight:
145 | this.position(
146 | parentBoundingRect.left + parentBoundingRect.width - this.width,
147 | parentBoundingRect.top + parentBoundingRect.height - this.height
148 | );
149 | break;
150 | }
151 | }
152 |
153 | public setSize(size: GameDistributionBannerSize): void {
154 | let width: number, height: number;
155 | switch (size) {
156 | default:
157 | case GameDistributionBannerSize.LargeRectangle:
158 | width = 336;
159 | height = 280;
160 | break;
161 | case GameDistributionBannerSize.MediumRectangle:
162 | width = 300;
163 | height = 250;
164 | break;
165 | case GameDistributionBannerSize.Billboard:
166 | width = 970;
167 | height = 250;
168 | break;
169 | case GameDistributionBannerSize.Leaderboard:
170 | width = 728;
171 | height = 90;
172 | break;
173 | case GameDistributionBannerSize.Skyscraper:
174 | width = 120;
175 | height = 600;
176 | break;
177 | case GameDistributionBannerSize.WideSkyscraper:
178 | width = 160;
179 | height = 600;
180 | break;
181 | }
182 |
183 | this.width = width;
184 | this.height = height;
185 |
186 | this.element.style.width = `${width}px`;
187 | this.element.style.height = `${height}px`;
188 | }
189 |
190 | public position(x: number, y: number): void {
191 | this.element.style.left = `${x + this.offsetX}px`;
192 | this.element.style.top = `${y + this.offsetY}px`;
193 | }
194 | }
195 |
196 | export class GameDistributionAds implements PhaserAds.AdProvider.IProvider {
197 | public adManager: AdManager;
198 |
199 | public adsEnabled: boolean = true;
200 |
201 | public hasRewarded: boolean = false;
202 |
203 | constructor(game: Phaser.Game, gameId: string, userId: string = '') {
204 | this.areAdsEnabled();
205 |
206 | GD_OPTIONS = {
207 | gameId: gameId,
208 | advertisementSettings: {
209 | autoplay: false
210 | },
211 | onEvent: (event: any): void => {
212 | switch (event.name as string) {
213 | case 'SDK_GAME_PAUSE':
214 | // pause game logic / mute audio
215 | this.adManager.onContentPaused.dispatch();
216 | break;
217 | default:
218 | break;
219 | }
220 | }
221 | };
222 |
223 | //Include script. even when adblock is enabled, this script also allows us to track our users;
224 | (function (d: Document, s: string, id: string): void {
225 | let js: HTMLScriptElement;
226 | let fjs: HTMLScriptElement = d.getElementsByTagName(s)[0];
227 | if (d.getElementById(id)) {
228 | return;
229 | }
230 | js = d.createElement(s);
231 | js.id = id;
232 | js.src = '//html5.api.gamedistribution.com/main.min.js';
233 | fjs.parentNode.insertBefore(js, fjs);
234 | }(document, 'script', 'gamedistribution-jssdk'));
235 | }
236 |
237 | public setManager(manager: PhaserAds.AdManager): void {
238 | this.adManager = manager;
239 | }
240 |
241 | public showAd(adType: AdType, containerId?: string): void {
242 | if (!this.adsEnabled) {
243 | this.adManager.unMuteAfterAd();
244 | this.adManager.onContentResumed.dispatch();
245 | return;
246 | }
247 |
248 | if (typeof gdsdk === 'undefined' || (gdsdk && typeof gdsdk.showAd === 'undefined')) {
249 | //So gdApi isn't available OR
250 | //gdApi is available, but showBanner is not there (weird but can happen)
251 | this.adsEnabled = false;
252 | this.adManager.unMuteAfterAd();
253 | this.adManager.onContentResumed.dispatch();
254 | return;
255 | }
256 |
257 | if (adType === PhaserAds.AdType.rewarded && this.hasRewarded === false) {
258 | this.adManager.unMuteAfterAd();
259 | this.adManager.onContentResumed.dispatch();
260 | return;
261 | }
262 |
263 | gdsdk.showAd((adType === PhaserAds.AdType.rewarded) ? GameDistributionAdType.rewarded : GameDistributionAdType.interstitial).then(() => {
264 | if (adType === PhaserAds.AdType.rewarded && this.hasRewarded === true) {
265 | this.adManager.onAdRewardGranted.dispatch();
266 | this.hasRewarded = false;
267 | }
268 |
269 | this.adManager.unMuteAfterAd();
270 | this.adManager.onContentResumed.dispatch();
271 | }).catch(() => {
272 | if (adType === PhaserAds.AdType.rewarded && this.hasRewarded === true) {
273 | this.hasRewarded = false;
274 | }
275 |
276 | this.adManager.unMuteAfterAd();
277 | this.adManager.onContentResumed.dispatch();
278 | });
279 | }
280 |
281 | public loadBanner(size: GameDistributionBannerSize): GameDistributionBanner {
282 | const banner: GameDistributionBanner = new GameDistributionBanner();
283 | banner.setSize(size);
284 | banner.loadBanner();
285 | return banner;
286 | }
287 |
288 | //Does nothing, but needed for Provider interface
289 | public preloadAd(adType: PhaserAds.AdType): void {
290 | if (this.hasRewarded) {
291 | return;
292 | }
293 |
294 | gdsdk.preloadAd(GameDistributionAdType.rewarded).then(() => {
295 | this.hasRewarded = true;
296 | this.adManager.onAdLoaded.dispatch(adType);
297 | });
298 | }
299 |
300 | //Does nothing, but needed for Provider interface
301 | public destroyAd(): void {
302 | return;
303 | }
304 |
305 | //Does nothing, but needed for Provider interface
306 | public hideAd(): void {
307 | return;
308 | }
309 |
310 | /**
311 | * Checks if the ads are enabled (e.g; adblock is enabled or not)
312 | * @returns {boolean}
313 | */
314 | private areAdsEnabled(): void {
315 | let test: HTMLElement = document.createElement('div');
316 | test.innerHTML = ' ';
317 | test.className = 'adsbox';
318 | test.style.position = 'absolute';
319 | test.style.fontSize = '10px';
320 | document.body.appendChild(test);
321 |
322 | // let adsEnabled: boolean;
323 | let isEnabled: () => boolean = () => {
324 | let enabled: boolean = true;
325 | if (test.offsetHeight === 0) {
326 | enabled = false;
327 | }
328 | test.parentNode.removeChild(test);
329 |
330 | return enabled;
331 | };
332 |
333 | window.setTimeout(() => {
334 | this.adsEnabled = isEnabled();
335 | }, 100);
336 | }
337 | }
338 | }
339 | }
340 |
--------------------------------------------------------------------------------
/ts/Providers/IProvider.ts:
--------------------------------------------------------------------------------
1 | module PhaserAds {
2 | export module AdProvider {
3 | export interface IProvider {
4 | adManager: AdManager;
5 | adsEnabled: boolean;
6 | hasRewarded: boolean;
7 |
8 | setManager(manager: AdManager): void;
9 | preloadAd(...args: any[]): void;
10 | destroyAd(...args: any[]): void;
11 | hideAd(...args: any[]): void;
12 | showAd(...args: any[]): void;
13 | loadBanner?(...args: any[]): void;
14 | /*setLayout(...args: any[]): void;
15 | setPosition(...args: any[]): void;*/
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ts/Providers/Ima3.ts:
--------------------------------------------------------------------------------
1 | module PhaserAds {
2 | export module AdProvider {
3 | export interface ICustomParams {
4 | [name: string]: string | number| any[];
5 | }
6 |
7 | export class Ima3 implements IProvider {
8 | private gameContent: any;
9 |
10 | private adContent: HTMLElement;
11 |
12 | private adDisplay: GoogleAds.ima.AdDisplayContainer;
13 |
14 | private adLoader: GoogleAds.ima.AdsLoader;
15 |
16 | private adsManager: GoogleAds.ima.AdsManager = null;
17 |
18 | private googleEnabled: boolean = false;
19 |
20 | public adsEnabled: boolean = true;
21 |
22 | private adTagUrl: string = '';
23 |
24 | private game: Phaser.Game;
25 |
26 | private adRequested: boolean = false;
27 |
28 | public hasRewarded: boolean = false;
29 |
30 | public adManager: AdManager = null;
31 |
32 | private resizeListener: () => void = null;
33 |
34 | constructor(game: Phaser.Game, adTagUrl: string) {
35 | this.areAdsEnabled();
36 |
37 | if (typeof google === 'undefined') {
38 | return;
39 | }
40 |
41 | this.googleEnabled = true;
42 |
43 | this.gameContent = (typeof game.parent === 'string') ? document.getElementById((game).parent) : game.parent;
44 | // this.gameContent.currentTime = 100;
45 | this.gameContent.style.position = 'absolute';
46 | this.gameContent.style.width = '100%';
47 |
48 | this.adContent = this.gameContent.parentNode.appendChild(document.createElement('div'));
49 | this.adContent.id = 'phaser-ad-container';
50 | this.adContent.style.position = 'absolute';
51 | this.adContent.style.zIndex = '9999';
52 | this.adContent.style.display = 'none';
53 | this.adContent.style.top = '0';
54 | this.adContent.style.left = '0';
55 | this.adContent.style.width = '100%';
56 | this.adContent.style.height = '100%';
57 | this.adContent.style.overflow = 'hidden';
58 |
59 | this.adTagUrl = adTagUrl;
60 | this.game = game;
61 |
62 | // Create the ad display container.
63 | this.adDisplay = new google.ima.AdDisplayContainer(this.adContent);
64 |
65 | //Set vpaid enabled, and update locale
66 | (google.ima.settings).setVpaidMode((google.ima).ImaSdkSettings.VpaidMode.ENABLED);
67 | (google.ima.settings).setLocale('nl');
68 |
69 | // Create ads loader, and register events
70 | this.adLoader = new google.ima.AdsLoader(this.adDisplay);
71 | this.adLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, this.onAdManagerLoader, false, this);
72 | this.adLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, this.onAdError, false, this);
73 | }
74 |
75 | public setManager(manager: AdManager): void {
76 | this.adManager = manager;
77 | }
78 |
79 | /**
80 | * Doing an ad request, if anything is wrong with the lib (missing ima3, failed request) we just dispatch the contentResumed event
81 | * Otherwise we display an ad
82 | */
83 | public showAd(customParams?: ICustomParams): void {
84 | console.log('Ad Requested');
85 | if (this.adRequested) {
86 | return;
87 | }
88 |
89 | if (!this.adsEnabled) {
90 | this.adManager.onAdsDisabled.dispatch(true);
91 | }
92 |
93 | if (!this.googleEnabled) {
94 | this.onContentResumeRequested();
95 | return;
96 | }
97 |
98 | //For mobile this ad request needs to be handled post user click
99 | this.adDisplay.initialize();
100 |
101 | // Request video ads.
102 | let adsRequest: GoogleAds.ima.AdsRequest = new google.ima.AdsRequest();
103 | adsRequest.adTagUrl = this.adTagUrl + this.parseCustomParams(customParams);
104 |
105 | let width: number = window.innerWidth; //parseInt((!this.game.canvas.style.width ? this.game.canvas.width : this.game.canvas.style.width), 10);
106 | let height: number = window.innerHeight; //parseInt((!this.game.canvas.style.height ? this.game.canvas.height : this.game.canvas.style.height), 10);
107 |
108 | //Here we check if phaser is fullscreen or not, if we are fullscreen, we subtract some of the width and height, to counter for the resize (
109 | //Fullscreen should be disabled for the ad, (onContentPaused) and requested for again when the game resumes
110 | if (this.game.scale.isFullScreen && document.body.clientHeight < window.innerHeight) {
111 | height = document.body.clientHeight;
112 | width = document.body.clientWidth;
113 | }
114 |
115 | // Specify the linear and nonlinear slot sizes. This helps the SDK to
116 | // select the correct creative if multiple are returned.
117 | adsRequest.linearAdSlotWidth = width;
118 | adsRequest.linearAdSlotHeight = height;
119 | adsRequest.nonLinearAdSlotWidth = width;
120 | adsRequest.nonLinearAdSlotHeight = height;
121 |
122 | //Required for games, see:
123 | //http://googleadsdeveloper.blogspot.nl/2015/10/important-changes-for-gaming-publishers.html
124 | adsRequest.forceNonLinearFullSlot = true;
125 |
126 | try {
127 | this.adRequested = true;
128 | this.adLoader.requestAds(adsRequest);
129 | } catch (e) {
130 | console.log(e);
131 | this.onContentResumeRequested();
132 | }
133 | }
134 |
135 | //Does nothing, but needed for Provider interface
136 | public preloadAd(): void {
137 | return;
138 | }
139 |
140 | //Does nothing, but needed for Provider interface
141 | public destroyAd(): void {
142 | return;
143 | }
144 |
145 | //Does nothing, but needed for Provider interface
146 | public hideAd(): void {
147 | return;
148 | }
149 |
150 | /**
151 | * Called when the ads manager was loaded.
152 | * We register all ad related events here, and initialize the manager with the game width/height
153 | *
154 | * @param adsManagerLoadedEvent
155 | */
156 | private onAdManagerLoader(adsManagerLoadedEvent: GoogleAds.ima.AdsManagerLoadedEvent): void {
157 | console.log('AdsManager loaded');
158 | // Get the ads manager.
159 | let adsRenderingSettings: GoogleAds.ima.AdsRenderingSettings = new google.ima.AdsRenderingSettings();
160 | adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true;
161 |
162 | // videoContent should be set to the content video element.
163 | let adsManager: GoogleAds.ima.AdsManager = adsManagerLoadedEvent.getAdsManager(this.gameContent, adsRenderingSettings);
164 | this.adsManager = adsManager;
165 | console.log(adsManager.isCustomClickTrackingUsed());
166 |
167 | // Add listeners to the required events.
168 | adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, this.onContentPauseRequested, false, this);
169 | adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, this.onContentResumeRequested, false, this);
170 | adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, this.onAdError, false, this);
171 |
172 | [
173 | google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
174 | google.ima.AdEvent.Type.CLICK,
175 | google.ima.AdEvent.Type.COMPLETE,
176 | google.ima.AdEvent.Type.FIRST_QUARTILE,
177 | google.ima.AdEvent.Type.LOADED,
178 | google.ima.AdEvent.Type.MIDPOINT,
179 | google.ima.AdEvent.Type.PAUSED,
180 | google.ima.AdEvent.Type.STARTED,
181 | google.ima.AdEvent.Type.THIRD_QUARTILE
182 | ].forEach((event: string) => {
183 | adsManager.addEventListener(
184 | event,
185 | this.onAdEvent,
186 | false,
187 | this);
188 | });
189 |
190 | try {
191 | //Show the ad elements, we only need to show the faux videoelement on iOS, because the ad is displayed in there.
192 | this.adContent.style.display = 'block';
193 |
194 | // Initialize the ads manager. Ad rules playlist will start at this time.
195 | let width: number = window.innerWidth; //parseInt((!this.game.canvas.style.width ? this.game.canvas.width : this.game.canvas.style.width), 10);
196 | let height: number = window.innerHeight; //parseInt((!this.game.canvas.style.height ? this.game.canvas.height : this.game.canvas.style.height), 10);
197 | this.adsManager.init(width, height, google.ima.ViewMode.NORMAL);
198 |
199 | // Call play to start showing the ad. Single video and overlay ads will
200 | // start at this time; the call will be ignored for ad rules.
201 | this.adsManager.start();
202 |
203 | this.resizeListener = () => {
204 | if (this.adsManager === null) {
205 | return;
206 | }
207 |
208 | //Window was resized, so expect something similar
209 | console.log('Resizing ad size');
210 | this.adsManager.resize(window.innerWidth, window.innerHeight, google.ima.ViewMode.NORMAL);
211 | };
212 |
213 | window.addEventListener('resize', this.resizeListener);
214 | } catch (adError) {
215 | console.log('Adsmanager error:', adError);
216 | this.onAdError(adError);
217 | }
218 | }
219 |
220 | /**
221 | * Generic ad events are handled here
222 | * @param adEvent
223 | */
224 | private onAdEvent(adEvent: any): void {
225 | console.log('onAdEvent', adEvent);
226 |
227 | switch (adEvent.type) {
228 | case google.ima.AdEvent.Type.CLICK:
229 | this.adManager.onAdClicked.dispatch();
230 | break;
231 | case google.ima.AdEvent.Type.LOADED:
232 | this.adRequested = false;
233 | let ad: any = adEvent.getAd();
234 | console.log('is ad linear?', ad.isLinear());
235 | if (!ad.isLinear()) {
236 | this.onContentResumeRequested();
237 | }
238 | break;
239 | case google.ima.AdEvent.Type.STARTED:
240 | this.adManager.onAdProgression.dispatch(AdEvent.start);
241 | break;
242 | case google.ima.AdEvent.Type.FIRST_QUARTILE:
243 | this.adManager.onAdProgression.dispatch(AdEvent.firstQuartile);
244 | break;
245 | case google.ima.AdEvent.Type.MIDPOINT:
246 | this.adManager.onAdProgression.dispatch(AdEvent.midPoint);
247 | break;
248 | case google.ima.AdEvent.Type.THIRD_QUARTILE:
249 | this.adManager.onAdProgression.dispatch(AdEvent.thirdQuartile);
250 | break;
251 | case google.ima.AdEvent.Type.COMPLETE:
252 | this.adManager.onAdProgression.dispatch(AdEvent.complete);
253 | break;
254 | case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
255 | this.onContentResumeRequested();
256 | break;
257 | }
258 | }
259 |
260 | private onAdError(error: any): void {
261 | console.log('gneric ad error', error);
262 | if (null !== this.adsManager) {
263 | this.adsManager.destroy();
264 | this.adsManager = null;
265 |
266 | if (null !== this.resizeListener) {
267 | window.removeEventListener('resize', this.resizeListener);
268 | this.resizeListener = null;
269 | }
270 | }
271 |
272 | if (this.adRequested) {
273 | this.adRequested = false;
274 | }
275 |
276 | //We silently ignore adLoader errors, it just means there is no ad available
277 | this.onContentResumeRequested();
278 | }
279 |
280 | /**
281 | * When the ad starts playing, and the game should be paused
282 | */
283 | private onContentPauseRequested(): void {
284 | console.log('onContentPauseRequested', arguments);
285 | this.adManager.onContentPaused.dispatch();
286 | }
287 |
288 | /**
289 | * When the ad is finished and the game should be resumed
290 | */
291 | private onContentResumeRequested(): void {
292 | console.log('onContentResumeRequested', arguments);
293 |
294 | if (typeof google === 'undefined') {
295 | this.adManager.unMuteAfterAd();
296 | this.adManager.onContentResumed.dispatch();
297 | return;
298 | }
299 |
300 | this.adContent.style.display = 'none';
301 | this.adManager.unMuteAfterAd();
302 | this.adManager.onContentResumed.dispatch();
303 | }
304 |
305 | private parseCustomParams(customParams: ICustomParams): string {
306 | if (undefined !== customParams) {
307 | let customDataString: string = '';
308 | for (let key in customParams) {
309 | if (customParams.hasOwnProperty(key)) {
310 | if (customDataString.length > 0) {
311 | customDataString += '' +
312 | '&';
313 | }
314 | let param: any = (Array.isArray(customParams[key])) ? (customParams[key]).join(',') : customParams[key];
315 | customDataString += key + '=' + param;
316 | }
317 | }
318 | return '&cust_params=' + encodeURIComponent(customDataString);
319 | }
320 |
321 | return '';
322 | }
323 |
324 | /**
325 | * Checks if the ads are enabled (e.g; adblock is enabled or not)
326 | * @returns {boolean}
327 | */
328 | private areAdsEnabled(): void {
329 | let test: HTMLElement = document.createElement('div');
330 | test.innerHTML = ' ';
331 | test.className = 'adsbox';
332 | test.style.position = 'absolute';
333 | test.style.fontSize = '10px';
334 | document.body.appendChild(test);
335 |
336 | // let adsEnabled: boolean;
337 | let isEnabled: () => boolean = () => {
338 | let enabled: boolean = true;
339 | if (test.offsetHeight === 0) {
340 | enabled = false;
341 | }
342 | test.parentNode.removeChild(test);
343 |
344 | return enabled;
345 | };
346 |
347 | window.setTimeout(() => {
348 | this.adsEnabled = isEnabled();
349 | }, 100);
350 | }
351 | }
352 | }
353 | }
354 |
--------------------------------------------------------------------------------
/ts/definitions.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 | ///
5 | ///
6 | ///
7 | ///
8 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "amd",
4 | "target": "es5",
5 | "sourceMap": true,
6 | "noImplicitAny": true,
7 | "removeComments": false,
8 | "declaration": true,
9 | "preserveConstEnums": true
10 | },
11 | "include": [
12 | "./ts/**/*.ts"
13 | ]
14 | }
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "align": [
4 | true,
5 | "parameters",
6 | "statements"
7 | ],
8 | "ban": false,
9 | "class-name": true,
10 | "curly": true,
11 | "eofline": true,
12 | "forin": true,
13 | "indent": [
14 | true,
15 | "spaces"
16 | ],
17 | "interface-name": true,
18 | "jsdoc-format": true,
19 | "label-position": true,
20 | "label-undefined": true,
21 | "max-line-length": [
22 | true,
23 | 200
24 | ],
25 | "member-access": true,
26 | "no-any": false,
27 | "no-arg": true,
28 | "no-conditional-assignment": true,
29 | "no-consecutive-blank-lines": true,
30 | "no-console": [
31 | true,
32 | "debug",
33 | "info",
34 | "time",
35 | "timeEnd",
36 | "trace"
37 | ],
38 | "no-construct": true,
39 | "no-constructor-vars": true,
40 | "no-debugger": true,
41 | "no-duplicate-key": true,
42 | "no-duplicate-variable": true,
43 | "no-empty": true,
44 | "no-eval": true,
45 | "no-inferrable-types": false,
46 | "no-internal-module": false,
47 | "no-null-keyword": false,
48 | "no-require-imports": false,
49 | "no-shadowed-variable": true,
50 | "no-string-literal": false,
51 | "no-switch-case-fall-through": false,
52 | "no-trailing-whitespace": true,
53 | "no-unreachable": true,
54 | "no-unused-expression": true,
55 | "no-unused-variable": true,
56 | "no-use-before-declare": true,
57 | "no-var-keyword": true,
58 | "no-var-requires": true,
59 | "object-literal-sort-keys": false,
60 | "one-line": [
61 | true,
62 | "check-open-brace",
63 | "check-catch",
64 | "check-else",
65 | "check-finally",
66 | "check-whitespace"
67 | ],
68 | "quotemark": [
69 | true,
70 | "single",
71 | "avoid-escape"
72 | ],
73 | "radix": true,
74 | "semicolon": [
75 | true,
76 | "always"
77 | ],
78 | "switch-default": false,
79 | "trailing-comma": [
80 | true,
81 | {
82 | "multiline": "never",
83 | "singleline": "never"
84 | }
85 | ],
86 | "triple-equals": [
87 | true,
88 | "allow-null-check"
89 | ],
90 | "typedef": [
91 | true,
92 | "call-signature",
93 | "parameter",
94 | "arrow-parameter",
95 | "property-declaration",
96 | "variable-declaration",
97 | "member-variable-declaration"
98 | ],
99 | "typedef-whitespace": [
100 | true,
101 | {
102 | "call-signature": "nospace",
103 | "index-signature": "nospace",
104 | "parameter": "nospace",
105 | "property-declaration": "nospace",
106 | "variable-declaration": "nospace"
107 | },
108 | {
109 | "call-signature": "onespace",
110 | "index-signature": "onespace",
111 | "parameter": "onespace",
112 | "property-declaration": "onespace",
113 | "variable-declaration": "onespace"
114 | }
115 | ],
116 | "use-strict": false,
117 | "variable-name": [
118 | true,
119 | "allow-leading-underscore",
120 | "ban-keywords"
121 | ],
122 | "whitespace": [
123 | true,
124 | "check-branch",
125 | "check-decl",
126 | "check-operator",
127 | "check-separator",
128 | "check-type"
129 | ]
130 | }
131 | }
--------------------------------------------------------------------------------
/vendor/cocoon.d.ts:
--------------------------------------------------------------------------------
1 | declare module Cocoon {
2 | export module Ad {
3 | export interface IBanner {
4 | width: number;
5 | height: number;
6 | show(): void;
7 | hide(): void;
8 | load(): void;
9 | on(eventName: "load" | "fail" | "show" | "dismiss" | "click" | "reward", listener?: () => void): void;
10 | setLayout(layout: string): void;
11 | // setPosition(x: number, y:number): void;
12 | }
13 | export interface IAdProvider {
14 | configure(config: any): void;
15 | createBanner(adId?: any): IBanner;
16 | createInterstitial(adId?: any): IBanner;
17 | createRewardedVideo(adId?: any): IBanner;
18 | showDebug(): void;
19 | releaseBanner(banner: IBanner): void;
20 | releaseInterstitial(interstitial: IBanner): void;
21 |
22 | }
23 |
24 | export var BannerLayout: {
25 | TOP_CENTER: string,
26 | BOTTOM_CENTER: string,
27 | CUSTOM: string
28 | };
29 |
30 | export var AdMob: IAdProvider;
31 | export var MoPub: IAdProvider;
32 | export var Heyzap: IAdProvider;
33 | export var Chartboost: IAdProvider;
34 | }
35 |
36 | }
--------------------------------------------------------------------------------
/vendor/cordova-gamedistribution.d.ts:
--------------------------------------------------------------------------------
1 | declare class CordovaPluginGdApi {
2 | init: (settings: any, succes: (data: any) => void, error: (error: any) => void) => void;
3 | setAdListener: (success: (data: any) => void, error: (data: any) => void) => void;
4 | showBanner: (succes: (data: any) => void, error: (error: any) => void) => void;
5 | enableTestAds: () => void;
6 | }
7 |
8 | declare var cordova: any;
9 |
--------------------------------------------------------------------------------
/vendor/cordova-heyzap.d.ts:
--------------------------------------------------------------------------------
1 | declare module HeyzapAds {
2 | export function start(published_id: string): Thenable;
3 |
4 | export module InterstitialAd {
5 | export var Events: {
6 | SHOW_FAILED: string;
7 | SHOW: string;
8 | CLICKED: string;
9 | HIDE: string;
10 | };
11 | export function show(): Thenable;
12 | export function addEventListener(target: string, call: () => void): void;
13 | }
14 | export module VideoAd {
15 | export var Events: {
16 | SHOW_FAILED: string;
17 | SHOW: string;
18 | CLICKED: string;
19 | HIDE: string;
20 | };
21 | export function show(): Thenable;
22 | export function fetch(): Thenable;
23 | export function addEventListener(target: string, call: () => void): void;
24 | }
25 | export module IncentivizedAd {
26 | export var Events: {
27 | SHOW_FAILED: string;
28 | SHOW: string;
29 | CLICKED: string;
30 | HIDE: string;
31 | };
32 | export function show(): Thenable;
33 | export function fetch(): Thenable;
34 | export function addEventListener(target: string, call: () => void): void;
35 | }
36 | export module BannerAd {
37 | export var POSITION_TOP: string;
38 | export var POSITION_BOTTOM: string;
39 | export var Events: {
40 | SHOW_FAILED: string;
41 | SHOW: string;
42 | CLICKED: string;
43 | };
44 | export function show(position: string): Thenable;
45 | export function hide(): Thenable;
46 | export function destroy(): Thenable;
47 | export function addEventListener(target: string, call: () => void): void;
48 | }
49 | }
--------------------------------------------------------------------------------
/vendor/game-distribution.d.ts:
--------------------------------------------------------------------------------
1 | interface IGameDistributionSettings {
2 | gameId: string;
3 | userId?: string;
4 | onEvent?: (event: any) => void;
5 | }
6 |
7 | declare var gdsdk: any;
8 | declare var GD_OPTIONS: IGameDistributionSettings;
9 |
--------------------------------------------------------------------------------
/vendor/google-ima3-sdk.d.ts:
--------------------------------------------------------------------------------
1 | declare module GoogleAds.ima {
2 | class ViewMode {
3 | public static NORMAL: string;
4 | public static FULLSCREEN: string;
5 | }
6 |
7 | class AdErrorEvent {
8 | public static Type: {
9 | AD_ERROR: string;
10 | };
11 |
12 | public getError(): string;
13 | }
14 |
15 | class AdEvent {
16 | public static Type: {
17 | CONTENT_PAUSE_REQUESTED: string;
18 | CONTENT_RESUME_REQUESTED: string;
19 | ALL_ADS_COMPLETED: string;
20 | LOADED: string;
21 | STARTED: string;
22 | COMPLETE: string;
23 | CLICK: string;
24 | PAUSED: string;
25 | FIRST_QUARTILE: string;
26 | MIDPOINT: string;
27 | THIRD_QUARTILE: string;
28 | };
29 | }
30 |
31 | class AdsManagerLoadedEvent {
32 | public static Type: {
33 | ADS_MANAGER_LOADED: string;
34 | };
35 |
36 | public getAdsManager(content: HTMLElement, adRenderSettings: AdsRenderingSettings): AdsManager;
37 | }
38 |
39 | class AdsRequest {
40 | constructor();
41 | public adTagUrl: string;
42 | public linearAdSlotWidth: number;
43 | public linearAdSlotHeight: number;
44 | public nonLinearAdSlotWidth: number;
45 | public nonLinearAdSlotHeight: number;
46 | public forceNonLinearFullSlot: boolean;
47 | }
48 |
49 | class AdsRenderingSettings {
50 | public restoreCustomPlaybackStateOnAdBreakComplete: boolean;
51 | }
52 |
53 | class AdContainer {
54 | public initialize: () => void;
55 | }
56 |
57 | class AdsLoader {
58 | constructor(displayontainer: AdDisplayContainer);
59 | public addEventListener(type: string, callback: (thingy: any) => void, something: boolean, context?: any): void;
60 | public requestAds(request: AdsRequest): void;
61 | }
62 |
63 | class AdsManager {
64 | public isCustomClickTrackingUsed(): boolean;
65 | public addEventListener(type: string, callback: (thingy: any) => void, something?: boolean, context?: any): void;
66 | public init(width: number, height: number, viewMode: string): void;
67 | public start(): void;
68 | public destroy(): void;
69 | public resize(width: number, height: number, viewMode: string): void;
70 | }
71 |
72 | class AdDisplayContainer {
73 | constructor(content: HTMLElement, ad?: HTMLElement, customClickTrack?: HTMLElement);
74 | public initialize(): void;
75 | }
76 | }
77 |
78 | declare var google: any;
--------------------------------------------------------------------------------