I'm making a game with Cocos Creator. I'd like to use Azure Playfab. Do you have any plans to launch a PlayFab module in the Cocos Store?
I'm making a game with Cocos Creator. I'd like to use Azure Playfab. Do you have any plans to launch a PlayFab module in the Cocos Store?
Currently, PlayFab doesn’t have plan to launch a PlayFab modules into Cocos Store. But since CocosCreator supports both JavaScript and TypeScript programming languages, you may refer to NodeJS quickstart - PlayFab | Microsoft Learn to install and use “playfab-sdk” in your project.
I tried following nodejs quick start through npm install, but cocoscreator doesn't support it.
I posted it on the forum of Cocos Creator, but I received an answer to make it through the corresponding native SDKs for Android and iOS native Plugin.
https://discuss.cocos2d-x.org/t/cocoscreator3-8-0-playfab-undefined/59447
Since CocosCreator using TypeScript which is a statically typed language, and it may require type declaration files (.d.ts files) to understand the structure of JavaScript modules, you may add a .d.ts files to the root of your project including declare module 'playfab-web-sdk'
to declare the ‘playfab-sdk’ module. Then you can refer to my working code:
import { _decorator, Component, Node, log} from 'cc';
const { ccclass, property } = _decorator;
import pf from 'playfab-sdk';
const PlayFab= pf.PlayFab as PlayFabModule.IPlayFab;
const clientApis=pf.PlayFabClient as PlayFabClientModule.IPlayFabClient;
let titleData={
titleId:"xxxx"
};
@ccclass('Test')
export class Test extends Component {
start() {
PlayFab.settings.titleId=titleData.titleId;
const loginRequest={
CustomId: "test",
CreateAccount: true
};
const loginCallback=(error:PlayFabModule.IPlayFabError,result:PlayFabModule.IPlayFabSuccessContainer<PlayFabClientModels.LoginResult>): void =>{
if(error!=null){
log("login failure");
}else{
log(result.data.PlayFabId);
}
};
clientApis.LoginWithCustomID(loginRequest,loginCallback);
}
update(deltaTime: number) {
}
}
2 People are following this question.
Leaderboards v2 in javascript or postman
APINotEnabledForGameClientAcces Unity3D
Returning linked account info from cloud script
How can we exceed the statistics limit if using basic package with pay as you go?
How can i signin with google play and playfab,How can I sign in with the new google play plugin.