greencoder Posted April 16, 2018 Share Posted April 16, 2018 Hello everyone, Has anyone worked on integrating playfab to Panda2? Interested in starting this off too early in my project. Regards GC Quote Link to comment Share on other sites More sharing options...
greencoder Posted April 22, 2018 Author Share Posted April 22, 2018 Hello @enpu, Need some pointers here, I really need to get playfab integrated but I am not really sure on creating a plugin or directly writing the integration into the game. Please help this noob. Quote Link to comment Share on other sites More sharing options...
enpu Posted April 24, 2018 Share Posted April 24, 2018 @greencoder I just added support for loading external JavaScript files with addAsset function. Now you can easily load all the PlayFab libraries that you need. Take a look at the PlayFab JavaScript guide: https://api.playfab.com/docs/getting-started/javascript-getting-started Example: game.module( 'game.main' ) .body(function() { game.addAsset('https://download.playfab.com/PlayFabClientApi.js'); game.createScene('Main', { init: function() { var loginRequest = { TitleId: 'myTitleId', CustomId: 'myCustomId', CreateAccount: true }; // Now you can access PlayFabClientSDK object PlayFabClientSDK.LoginWithCustomID(loginRequest, function(result, error) { if (!error) { console.log('Congratulations, you made your first successful API call!'); } else { console.log(error); } }); } }); }); Remember to update your game engine to latest 2.6.0 version. Let me know if you have any issues. Quote Link to comment Share on other sites More sharing options...
greencoder Posted April 29, 2018 Author Share Posted April 29, 2018 Thanks a lot for this @enpu , shall try it out and let you know how it goes. Quote Link to comment Share on other sites More sharing options...
greencoder Posted April 29, 2018 Author Share Posted April 29, 2018 Tried it, in the editor, everything seems to work smoothly but when tried the same build on device and browser for instant games, the loading gets stuck at 95% and doesn't load beyond that. Any idea what could be causing it @enpu ? EDIT: And saw this on the debug console Quote Link to comment Share on other sites More sharing options...
enpu Posted April 30, 2018 Share Posted April 30, 2018 @greencoder Seems that Facebook only allows to load external scripts from certain domains. You can try to download the JavaScript file and add it to your media folder, then load it there. game.addAsset('PlayFabClientApi.js'); Quote Link to comment Share on other sites More sharing options...
greencoder Posted October 26, 2019 Author Share Posted October 26, 2019 Tried this after a long time, not working, the following error is shown on the preview screen : Quote Link to comment Share on other sites More sharing options...
greencoder Posted November 25, 2019 Author Share Posted November 25, 2019 An update about this thread, to sum it up, thanks @enpu, it works. For some reason, my PC's Panda IDE was an old version and it might have caused the issue. So here are the steps : Download latest panda IDE Update the engine to the latest in your project Download PlayFabClientApi.js from https://download.playfab.com/PlayFabClientApi.js into the media folder Add game.addAsset('PlayFabClientApi.js') to your game.main Add the following snippet to test whether it works (I used it in init of game.main), ideally when you run this in the IDE or the browser, a player will be created on PlayFab : var loginRequest = { TitleId: '<your game ID>', CustomId: <custom ID>, CreateAccount: true }; PlayFabClientSDK.LoginWithCustomID(loginRequest, function(result, error) { if (!error) { console.log('PF ID: ' + result.data.PlayFabId); } else { console.log(error);} }); As a next step, I prefer to make PlayFabClientApi.js into a plugin, like the instantgames plugin and load the script dynamically and not bundle it with the package. I shall keep this thread updated if the plugin is a success, or maybe drop if off in the plugins sub forum. Once again, thanks @enpu! @Stephan, there you go, done! Time to start with the game, yay! Wolfsbane 1 Quote Link to comment Share on other sites More sharing options...
Stephan Posted November 26, 2019 Share Posted November 26, 2019 Well done! ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.