Chances are that those of you who wanted to submit their games to FGL via their offer (www.fgl.com for details) have encountered a major show-stopper: the new FGL 1.2 API isn't easily implemented in C2 and therefore it is very difficult to get a game through their QA mechanism.
There have been some unofficial plugins developed for this purpose and an official one is supposed to be on the way but until now none of them allowed for implementing all of the required features. Especially problematic were the In-App Purchase and the Branding Logo. I've taken a plugin developed by @EncryptedCow (kudos) and modified it so that it should cover 100% of the required functionality.
The plugin contains all the required functions and they are pretty self-explanatory, so I won't go into too much detail here, but some additional steps are required for the Branding Logo to work.
First of all, download the plugin:
dl.dropboxusercontent.com/u/21172099/FGL%20Plugin.c2addon
------------------------------------------------------------------------------------------------------------
Word of advice: I strongly recommend removing all references, actions, conditions and files related to any other versions of a FGL plugin that you might have installed before. Installing the new version may cause conflicts or may even cause your project to refuse to open permanently.
------------------------------------------------------------------------------------------------------------
Drag the plugin into the C2 window. You should now have a FGL object available to add to your project. Then implement the features as required.
Now, as to the Branding Logo:
Add a sprite and call it e.g. BrandingLogo. This sprite will be the sponsor logo button. Make it 250x100 px. Make it visible only if the Branding Enabled condition is true.
Now, add the condition BrandingLogo->On created
Inside this condition, put the action: BrandingLogo->Load image from URL
As the argument to this action, set: fgl.brandingURL
Now add another condition Touch->On touched object->BrandingLogo
Add the action inside: FGL->Branding Logo Clicked
As below:
Now the branding logo should appear as expected. Finally, for the API to work you need to modify the index.html file exported by Construct 2.
This is why the plugin probably won't work if you use the Minify Script. If anyone knows a way around this, please let me know.
Open the index.html file, and find this:
<script>
// Size the canvas to fill the browser viewport.
jQuery(window).resize(function() {
cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());
});
// Start the Construct 2 project running on window load.
jQuery(document).ready(function ()
{
// Create new runtime using the c2canvas
cr_createRuntime("c2canvas");
});
// Pause and resume on page becoming visible/invisible
function onVisibilityChanged() {
if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)
cr_setSuspended(true);
else
cr_setSuspended(false);
};
document.addEventListener("visibilitychange", onVisibilityChanged, false);
document.addEventListener("mozvisibilitychange", onVisibilityChanged, false);
document.addEventListener("webkitvisibilitychange", onVisibilityChanged, false);
document.addEventListener("msvisibilitychange", onVisibilityChanged, false);
</script>
<script>
var element = document.getElementById('c2canvas');
fgl.create(element);
fgl.onReady(function(){
loadGame();
});
var loadGame = function() {
// Size the canvas to fill the browser viewport.
jQuery(window).resize(function() {
cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());
});
// Start the Construct 2 project running on window load.
jQuery(document).ready(function ()
{
// Create new runtime using the c2canvas
cr_createRuntime("c2canvas");
});
// Pause and resume on page becoming visible/invisible
function onVisibilityChanged() {
if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)
cr_setSuspended(true);
else
cr_setSuspended(false);
};
document.addEventListener("visibilitychange", onVisibilityChanged, false);
document.addEventListener("mozvisibilitychange", onVisibilityChanged, false);
document.addEventListener("webkitvisibilitychange", onVisibilityChanged, false);
document.addEventListener("msvisibilitychange", onVisibilityChanged, false);
};
</script>
Now everything should work.
Mind you, this plugin has yet to be tested 'in the field' so just write about any problems in the comments. Just treat it as an alfa/beta version. Good luck!