PlayFabSDK for GDScript
This is a PlayFabSDK for GDScript generated using the forked PlayFab/SDKGenerator. To generate them individually, you need API_Specs and SDKGenerator, which are forked.
Each has a branch called gdscript.
# 1)
mkdir PlayFab_GDScriptSdk
# 2)
git clone https://github.com/MizunagiKB/API_Specs
cd API_Specs
git checkout gdscript
cd ..
# 3)
git clone https://github.com/MizunagiKB/SDKGenerator
cd SDKGenerator
git checkout gdscript
node generate.js GDScriptSdk=../PlayFab_GDScriptSdk -apiSpecPath ../API_Specs
- Copy PlayFabSDK folder to GodotEngine project folder
- Added res://PlayFabSDK/PlayFab.gd to AutoLoad under the name PlayFab.
- Added res://PlayFabSDK/PlayFabSettings.gd to AutoLoad under the name PlayFabSettings
- Create testTitleData.json to GodotEngine project folder
{
"TitleId": "*****",
"developerSecretKey": "********",
"userEmail": "****@****.***"
}
or
PlayFabSettings.TitleId = "00000"
PlayFabSettings.DeveloperSecretKey = "XXXXXXXX"
The API is called by playFab + category + API name.
Parameters are given in the dictionary.
var dict_request = {
"TitleId": "00000",
"DisplayName": "****",
"Username": "****",
"Password": "****",
"RequireBothUsernameAndEmail": false
}
PlayFab.Client.RegisterPlayFabUser(dict_request)
Use funcref to get the results.
# callback function
func _request_completed(
h_request: int,
response_code: int,
headers,
json_parse_result: JSONParseResult
):
pass
# Describe here what you want to do.
# on function call
PlayFab.Client.RegisterPlayFabUser(
dict_request,
funcref(self, "_request_completed")
)
- PlayFab.is_valid()
- Check to see if you can call PlayFab from GDScript.
- PlayFab.reset()
- Resets the current state and returns it to its initial state.
(Any information or requests in communication will be discarded.)
- Resets the current state and returns it to its initial state.
- PlayFab.get_status()
- Returns the current communication status. HTTPClient.get_status information can be obtained from the data.
- PlayFab.status_ntoa()
- get_status the information into readable information.
- PlayFab.request_queue_size()
- Returns the number of waiting requests.
See below for specific uses of the API.
https://docs.microsoft.com/en-us/gaming/playfab/api-references/