Simplify playfab

This commit is contained in:
Andrei Andreev 2023-02-13 23:53:45 +01:00
parent 3299be8b44
commit d7bdc18a7d
19 changed files with 1338 additions and 3508 deletions

View File

@ -1,3 +1,4 @@
public/**/*.js public/**/*.js
src/components/SliderComponent.vue src/components/SliderComponent.vue
javascripts/supported-browsers.js javascripts/supported-browsers.js
src/steam/PlayFabClientApi.js

1
.gitignore vendored
View File

@ -6,4 +6,3 @@ dist
node_modules node_modules
.eslintrc.js .eslintrc.js
.DS_Store .DS_Store
playfab.js

View File

@ -1,13 +1,13 @@
import LZString from "lz-string"; import { PlayFab } from "@/steam/PlayFabClientApi";
export function playFabLogin() { export function playFabLogin() {
try { try {
Steam.getAuthSessionTicket(function(ticket){ Steam.getAuthSessionTicket(ticket => {
var SteamTicket = ticket.ticket.toString('hex') const SteamTicket = ticket.ticket.toString("hex");
PlayFab.settings.titleId = "59813"; PlayFab.settings.titleId = "59813";
var requestData = { const requestData = {
TitleId: PlayFab.settings.titleId, TitleId: PlayFab.settings.titleId,
SteamTicket: SteamTicket, SteamTicket,
CreateAccount: true CreateAccount: true
}; };
try { try {
@ -15,242 +15,28 @@ export function playFabLogin() {
} catch (e) { } catch (e) {
console.log("Unable to send login request to PlayFab."); console.log("Unable to send login request to PlayFab.");
} }
}) });
/*
// Dev playfab login
titleId = "144";
var requestData = {
TitleId: titleId,
CustomId: "GettingStartedGuide",
CreateAccount: true
}
try {
PlayFab.ClientApi.LoginWithCustomID(requestData, playFabLoginCallback);
} catch (e) { } catch (e) {
console.log("Unable to send login request to PlayFab."); console.log(e);
}
*/
} catch (e) {
console.log(e)
} }
} }
var titleId = "59813";
PlayFab.settings.titleId = "59813"; PlayFab.settings.titleId = "59813";
var playFabId = -1 let playFabId = -1;
function playFabLoginCallback(data, error) { function playFabLoginCallback(data, error) {
if (error) { if (error) {
console.log(error.errorMessage); console.log(error.errorMessage);
GameUI.notify.error("Couldn't log in to PlayFab Cloud."); GameUI.notify.error("Couldn't log in to PlayFab Cloud.");
//document.getElementById("cloudOptions").style.display = "none"
//document.getElementById("cloud").style.display = "none"
return; return;
} }
if (data) { if (data) {
playFabId = data.data.PlayFabId; playFabId = data.data.PlayFabId;
PlayFab.PlayFabID = playFabId PlayFab.PlayFabID = playFabId;
GameUI.notify.info("Logged in to PlayFab Cloud"); GameUI.notify.info("Logged in to PlayFab Cloud");
PlayFab.ClientApi.UpdateUserTitleDisplayName({"DisplayName": Steam.getSteamId().screenName}) PlayFab.ClientApi.UpdateUserTitleDisplayName({ "DisplayName": Steam.getSteamId().screenName });
if (player.options.cloud) playFabLoadCheck() console.log("Logged in to playFab");
console.log("Logged in to playFab") SteamFunctions.autoLogin();
SteamFunctions.autoLogin()
} }
} }
function saveToPlayFab(root) {
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined') return false;
// Cut compressed root object into strings of 10,000 bytes for PlayFab
var chunks = LZString.compressToEncodedURIComponent(JSON.stringify(root)).match(/.{1,10000}/g);
if (chunks.length > 10) {
GameUI.notify.error("Error saving to cloud: size limit exceeded");
}
PlayFab.settings.titleId = "59813";
var requestData = {
TitleId: PlayFab.settings.titleId,
PlayFabId: playFabId,
Data: chunks.mapToObject((_, index) => index, value => value)
}
try {
PlayFab.ClientApi.UpdateUserData(requestData, saveToPlayFabCallback);
} catch (e) {
console.log(e);
}
}
function saveToPlayFabCallback(data, error) {
if (error) {
console.log(error);
return false;
}
if (data) {
console.log("Game Saved!");
GameUI.notify.info("Game saved to cloud");
GameStorage.save();
return true;
}
}
function loadFromPlayFab(callback) {
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined') {
console.log(playFabId, PlayFab);
return false;
}
var requestData = {
Keys: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "save"],
PlayFabId: playFabId
}
try {
console.log('attempting to send load request');
PlayFab.ClientApi.GetUserData(requestData, loadFromPlayFabCallback.bind(this, callback));
console.log('sent load request');
} catch (e) {
console.log(e);
}
}
function loadFromPlayFabCallback(callback, data, error) {
console.log('loading callback fired');
console.log(data, error);
if (error) {
console.log(error);
return;
}
if (data) {
// Start: Migration
if (data.data.Data.save) {
var oldSave = JSON.parse(LZString.decompressFromEncodedURIComponent(data.data.Data.save.Value));
PlayFab.settings.titleId = "59813";
var requestData = {
TitleId: PlayFab.settings.titleId,
PlayFabId: playFabId,
// convert array into object with numbers as keys
Data: {
save: null,
infinitied: null,
eternities: null
}
}
try {
PlayFab.ClientApi.UpdateUserData(requestData, function(_, error) {
if (error) Modal.message.show("Error migrating cloud saves, please report this.");
var newRoot = {
current: 0,
saves: {
0: oldSave,
1: null,
2: null
}
};
saveToPlayFab(newRoot);
callback(newRoot);
});
} catch (e) {
console.log(e);
}
} else {
var root = getRootFromChunks(data.data.Data);
callback(root || {saves: []});
}
// End: Migration
}
}
function getRootFromChunks(chunks) {
// merge chunks back together
return JSON.parse(LZString.decompressFromEncodedURIComponent(
Object.values(chunks)
.map(function(val) {
return val.Value;
})
.join("")
));
}
// If both of them are the same, undefined will be returned
function newestSave(first, second) {
function getSaveInfo(save) {
if (!save) return { infinitied: DC.D0, eternities: DC.D0 };
const deepCopy = { ...save };
return {
infinitied: typeof deepCopy.infinitied === "object" ? deepCopy.infinitied : new Decimal(deepCopy.infinitied),
eternities: typeof deepCopy.eternities === "object" ? deepCopy.eternities : new Decimal(deepCopy.eternities)
};
}
const firstInfo = getSaveInfo(first);
const secondInfo = getSaveInfo(second);
if (firstInfo.eternities.eq(secondInfo.eternities) && firstInfo.infinitied.eq(secondInfo.infinitied)) {
return undefined;
}
if (firstInfo.eternities.gt(secondInfo.eternities)) {
return first;
}
if (firstInfo.infinitied.gt(secondInfo.infinitied)) {
return first;
}
return second;
}
function playFabLoadCheck() {
loadFromPlayFab(cloudRoot => {
GameUI.notify.info("Loaded from cloud");
for (let i = 0; i < 3; i++) {
const saveId = i;
const cloudSave = cloudRoot.saves[saveId];
const localSave = GameStorage.saves[saveId];
const newestSaveCheck = newestSave(cloudSave, localSave);
const overwriteLocalSave = () => {
GameStorage.overwriteSlot(saveId, cloudSave);
};
if (newestSaveCheck === localSave) {
Modal.addCloudConflict(saveId, cloudSave, localSave, overwriteLocalSave);
Modal.cloudLoadConflict.show();
} else {
overwriteLocalSave();
}
}
});
}
function playFabSaveCheck() {
loadFromPlayFab(cloudRoot => {
for (let i = 0; i < 3; i++) {
const saveId = i;
const cloudSave = cloudRoot.saves[saveId];
const localSave = GameStorage.saves[saveId];
const newestSaveCheck = newestSave(cloudSave, localSave);
let isConflicted = false;
const overwriteCloudSave = () => {
cloudRoot.saves[saveId] = GameStorage.saves[saveId];
};
const sendCloudSave = () => {
saveToPlayFab(cloudRoot);
};
if (newestSaveCheck === cloudSave) {
isConflicted = true;
Modal.addCloudConflict(saveId, cloudSave, localSave, overwriteCloudSave, sendCloudSave);
Modal.cloudSaveConflict.show();
} else {
overwriteCloudSave();
}
if (!isConflicted) {
sendCloudSave();
}
}
});
}

16
package-lock.json generated
View File

@ -1,5 +1,5 @@
{ {
"name": "BaseFiles", "name": "YouGuysAreWastingPreciousDevelopmentTime",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
@ -15,7 +15,6 @@
"firebase": "^9.6.6", "firebase": "^9.6.6",
"gamma": "^1.0.0", "gamma": "^1.0.0",
"js-sha512": "^0.8.0", "js-sha512": "^0.8.0",
"lz-string": "^1.4.4",
"mousetrap": "^1.6.5", "mousetrap": "^1.6.5",
"pako": "^2.0.4", "pako": "^2.0.4",
"svg-pan-zoom": "^3.6.1", "svg-pan-zoom": "^3.6.1",
@ -11334,14 +11333,6 @@
"yallist": "^2.1.2" "yallist": "^2.1.2"
} }
}, },
"node_modules/lz-string": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz",
"integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=",
"bin": {
"lz-string": "bin/bin.js"
}
},
"node_modules/make-dir": { "node_modules/make-dir": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -25084,11 +25075,6 @@
"yallist": "^2.1.2" "yallist": "^2.1.2"
} }
}, },
"lz-string": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz",
"integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY="
},
"make-dir": { "make-dir": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",

View File

@ -18,7 +18,6 @@
"firebase": "^9.6.6", "firebase": "^9.6.6",
"gamma": "^1.0.0", "gamma": "^1.0.0",
"js-sha512": "^0.8.0", "js-sha512": "^0.8.0",
"lz-string": "^1.4.4",
"mousetrap": "^1.6.5", "mousetrap": "^1.6.5",
"pako": "^2.0.4", "pako": "^2.0.4",
"svg-pan-zoom": "^3.6.1", "svg-pan-zoom": "^3.6.1",

View File

@ -1,3 +0,0 @@
{
"phabricator.uri" : "https://phabricator.playfab.com/"
}

View File

@ -1,8 +0,0 @@
bin/
obj/
.vs/
*.map
*.user
testTitleData.json

View File

@ -1,145 +0,0 @@
JavaScript Getting Started Guide
----
This guide will help you make your first API call in JavaScript.
JavaScript Project Setup
----
* OS: This guide should work in any OS capable of running a web-browser
* Installation
* You are probably already reading this page on your favorite browser
* New Project Setup
* Create a new folder, with two empty text files:
* PlayFabGettingStarted.html
* PlayFabGettingStarted.js
* PlayFab installation complete
Set up your first API call
----
This guide will provide the minimum steps to make your first PlayFab API call. Confirmation will be visible on the webpage.
In your favorite text-editor, update the contents of PlayFabGettingStarted.html as follows:
```HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PlayFab JavaScript Unit Tests</title>
<script type="text/javascript" src="https://download.playfab.com/PlayFabClientApi.js"></script>
<script type="text/javascript" src="PlayFabGettingStarted.js"></script>
</head>
<body>
PlayFab Getting Started Guide<br />
TitleID: <input type="text" id="titleId" value="144"><br />
CustomID: <input type="text" id="customId" value="GettingStartedGuide"><br />
<input type="button" value="Call LoginWithCustomID" onclick="DoExampleLoginWithCustomID()"><br />
Result:<br />
<textarea id="resultOutput" cols="60" rows="5"></textarea><br />
</body>
</html>
```
In your favorite text-editor, update the contents of PlayFabGettingStarted.js as follows:
```JavaScript
function DoExampleLoginWithCustomID(){
PlayFab.settings.titleId = document.getElementById("titleId").value;
var loginRequest = {
// Currently, you need to look up the correct format for this object in the API-docs:
// https://api.playfab.com/Documentation/Client/method/LoginWithCustomID
TitleId: PlayFab.settings.titleId,
CustomId: document.getElementById("customId").value,
CreateAccount: true
};
PlayFabClientSDK.LoginWithCustomID(loginRequest, LoginCallback);
}
var LoginCallback = function (result, error) {
if (result !== null) {
document.getElementById("resultOutput").innerHTML = "Congratulations, you made your first successful API call!";
} else if (error !== null) {
document.getElementById("resultOutput").innerHTML =
"Something went wrong with your first API call.\n" +
"Here's some debug information:\n" +
CompileErrorReport(error);
}
}
// This is a utility function we haven't put into the core SDK yet. Feel free to use it.
function CompileErrorReport(error) {
if (error === null)
return "";
var fullErrors = error.errorMessage;
for (var paramName in error.errorDetails)
for (var msgIdx in error.errorDetails[paramName])
fullErrors += "\n" + paramName + ": " + error.errorDetails[paramName][msgIdx];
return fullErrors;
}
```
Finish and Execute
----
* Open PlayFabGettingStarted.html in your favorite browser
* Click the "Call LoginWithCustomID" button
* You should see the following text in the Result section:
```text
Congratulations, you made your first successful API call!
```
* At this point, you can start making other api calls, and building your game
* For a list of all available client API calls, see our documentation:
* https://api.playfab.com/
* Happy coding!
Deconstruct the code
----
This optional last section describes each part of this example in detail.
The HTML file has a few important lines:
```HTML
<script type="text/javascript" src="https://download.playfab.com/PlayFabClientApi.js"></script>
```
This line loads the Client-SDK directly from the PlayFab CDN. Our CDN always hosts the latest version of PlayFabSDK. It may be safer for you to download the files, and use a fixed version: [PlayFab JavaScriptSDK](https://api.playfab.com/sdks/download/javascript)
The other important HTML lines:
```HTML
<script type="text/javascript" src="PlayFabGettingStarted.js"></script>
...
<input type="button" value="Call LoginWithCustomID" onclick="DoExampleLoginWithCustomID()"><br />
```
As you can see above, PlayFabGettingStarted.js contains the DoExampleLoginWithCustomID function. These lines bind our js file to our webpage, and invoke the DoExampleLoginWithCustomID function in that script. Everything else is just GUI.
* Line by line breakdown for PlayFabGettingStarted.js
* PlayFab.settings.titleId = document.getElementById("titleId").value;
* This reads the titleId from the html-input, and sets it to the PlayFab sdk.
* Every PlayFab developer creates a title in Game Manager. When you publish your game, you must code that titleId into your game. This lets the client know how to access the correct data within PlayFab. For most users, just consider it a mandatory step that makes PlayFab work.
* var loginRequest = { TitleId: PlayFab.settings.titleId, CustomId: "GettingStartedGuide", CreateAccount: true };
* Most PlayFab API methods require input parameters, and those input parameters are packed into a request object
* Every API method requires a unique request object, with a mix of optional and mandatory parameters
* For LoginWithCustomIDRequest, there is a mandatory parameter of CustomId, which uniquely identifies a player and CreateAccount, which allows the creation of a new account with this call. TitleId is another mandatory parameter in JavaScript, and it must match PlayFab.settings.titleId
* PlayFabClientSDK.LoginWithCustomID(loginRequest, LoginCallback);
* This begins the async request to "LoginWithCustomID", which will call LoginCallback when the API call is complete
* For login, most developers will want to use a more appropriate login method
* See the [PlayFab Login Documentation](https://api.playfab.com/Documentation/Client#Authentication) for a list of all login methods, and input parameters. Common choices are:
* [LoginWithAndroidDeviceID](https://api.playfab.com/Documentation/Client/method/LoginWithAndroidDeviceID)
* [LoginWithIOSDeviceID](https://api.playfab.com/Documentation/Client/method/LoginWithIOSDeviceID)
* [LoginWithEmailAddress](https://api.playfab.com/Documentation/Client/method/LoginWithEmailAddress)
* LoginCallback contains two parameters: result, error
* When successful, error will be null, and the result object will contain the requested information, according to the API called
* This result contains some basic information about the player, but for most users, login is simply a mandatory step before calling other APIs.
* If error is not null, your API has failed
* API calls can fail for many reasons, and you should always attempt to handle failure
* Why API calls fail (In order of likelihood)
* PlayFabSettings.TitleId is not set. If you forget to set titleId to your title, then nothing will work.
* Request parameters. If you have not provided the correct or required information for a particular API call, then it will fail. See error.errorMessage, error.errorDetails, or error.GenerateErrorReport() for more info.
* Device connectivity issue. Cell-phones lose/regain connectivity constantly, and so any API call at any time can fail randomly, and then work immediately after. Going into a tunnel can disconnect you completely.
* PlayFab server issue. As with all software, there can be issues. See our [release notes](https://api.playfab.com/releaseNotes/) for updates.
* The internet is not 100% reliable. Sometimes the message is corrupted or fails to reach the PlayFab server.
* If you are having difficulty debugging an issue, and the information within the error information is not sufficient, please visit us on our [forums](https://community.playfab.com/index.html)

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 PlayFab Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,711 +0,0 @@
/// <reference path="../typings/PlayFab/PlayFabAdminApi.d.ts" />
var PlayFab = typeof PlayFab != "undefined" ? PlayFab : {};
if(!PlayFab.settings) {
PlayFab.settings = {
titleId: null, // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website)
developerSecretKey: null, // For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website)
advertisingIdType: null,
advertisingIdValue: null,
// disableAdvertising is provided for completeness, but changing it is not suggested
// Disabling this may prevent your advertising-related PlayFab marketplace partners from working correctly
disableAdvertising: false,
AD_TYPE_IDFA: "Idfa",
AD_TYPE_ANDROID_ID: "Adid"
}
}
if(!PlayFab._internalSettings) {
PlayFab._internalSettings = {
sessionTicket: null,
productionServerUrl: ".playfabapi.com",
errorTitleId: "Must be have PlayFab.settings.titleId set to call this method",
errorLoggedIn: "Must be logged in to call this method",
errorSecretKey: "Must have PlayFab.settings.developerSecretKey set to call this method",
GetServerUrl: function () {
return "https://" + PlayFab.settings.titleId + PlayFab._internalSettings.productionServerUrl;
},
ExecuteRequest: function (completeUrl, data, authkey, authValue, callback) {
if (callback != null && typeof (callback) != "function")
throw "Callback must be null of a function";
if (data == null)
data = {};
var startTime = new Date();
var requestBody = JSON.stringify(data);
var xhr = new XMLHttpRequest();
// window.console.log("URL: " + completeUrl);
xhr.open("POST", completeUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json');
if (authkey != null)
xhr.setRequestHeader(authkey, authValue);
xhr.setRequestHeader('X-PlayFabSDK', "JavaScriptSDK-" + PlayFab._internalSettings.sdkVersion);
xhr.onloadend = function () {
if (callback == null)
return;
var result;
try {
// window.console.log("parsing json result: " + xhr.responseText);
result = JSON.parse(xhr.responseText);
} catch (e) {
result = {
code: 503, // Service Unavailable
status: "Service Unavailable",
error: "Connection error",
errorCode: 2, // PlayFabErrorCode.ConnectionError
errorMessage: xhr.responseText
};
}
result.CallBackTimeMS = new Date() - startTime;
if (result.code === 200)
callback(result, null);
else
callback(null, result);
}
xhr.onerror = function () {
if (callback == null)
return;
var result;
try {
result = JSON.parse(xhr.responseText);
} catch (e) {
result = {
code: 503, // Service Unavailable
status: "Service Unavailable",
error: "Connection error",
errorCode: 2, // PlayFabErrorCode.ConnectionError
errorMessage: xhr.responseText
};
}
result.CallBackTimeMS = new Date() - startTime;
callback(null, result);
}
xhr.send(requestBody);
}
}
}
PlayFab.buildIdentifier = "jbuild_javascriptsdk_1";
PlayFab.sdkVersion = "1.11.170828";
PlayFab.AdminApi = {
CreatePlayerSharedSecret: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/CreatePlayerSharedSecret", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeletePlayerSharedSecret: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeletePlayerSharedSecret", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerSharedSecrets: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerSharedSecrets", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPolicy: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPolicy", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetPlayerSecret: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetPlayerSecret", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdatePlayerSharedSecret: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdatePlayerSharedSecret", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdatePolicy: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdatePolicy", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
BanUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/BanUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeletePlayer: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeletePlayer", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserAccountInfo: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserAccountInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserBans: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
/**
* @deprecated Please use DeletePlayer instead.
*/
ResetUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ResetUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RevokeAllBansForUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RevokeAllBansForUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RevokeBans: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RevokeBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SendAccountRecoveryEmail: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SendAccountRecoveryEmail", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateBans: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserTitleDisplayName: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserTitleDisplayName", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
CreatePlayerStatisticDefinition: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/CreatePlayerStatisticDefinition", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
/**
* @deprecated Please use DeleteUser instead.
*/
DeleteUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeleteUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetDataReport: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetDataReport", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerStatisticDefinitions: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerStatisticDefinitions", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerStatisticVersions: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerStatisticVersions", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserPublisherInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserPublisherInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserPublisherReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserPublisherReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
IncrementPlayerStatisticVersion: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/IncrementPlayerStatisticVersion", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RefundPurchase: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RefundPurchase", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ResetUserStatistics: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ResetUserStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ResolvePurchaseDispute: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ResolvePurchaseDispute", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdatePlayerStatisticDefinition: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdatePlayerStatisticDefinition", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserPublisherInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserPublisherInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserPublisherReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserPublisherReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddNews: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AddNews", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddVirtualCurrencyTypes: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AddVirtualCurrencyTypes", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeleteStore: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeleteStore", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCatalogItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetCatalogItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetRandomResultTables: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetRandomResultTables", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetStoreItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetStoreItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTitleData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetTitleData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTitleInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetTitleInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ListVirtualCurrencyTypes: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ListVirtualCurrencyTypes", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RemoveVirtualCurrencyTypes: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RemoveVirtualCurrencyTypes", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetCatalogItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetCatalogItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetStoreItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetStoreItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetTitleData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetTitleData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetTitleInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetTitleInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetupPushNotification: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetupPushNotification", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateCatalogItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateCatalogItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateRandomResultTables: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateRandomResultTables", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateStoreItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateStoreItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddUserVirtualCurrency: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AddUserVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserInventory: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserInventory", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GrantItemsToUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GrantItemsToUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RevokeInventoryItem: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RevokeInventoryItem", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SubtractUserVirtualCurrency: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SubtractUserVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetMatchmakerGameInfo: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetMatchmakerGameInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetMatchmakerGameModes: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetMatchmakerGameModes", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ModifyMatchmakerGameModes: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ModifyMatchmakerGameModes", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddServerBuild: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AddServerBuild", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetServerBuildInfo: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetServerBuildInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetServerBuildUploadUrl: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetServerBuildUploadUrl", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ListServerBuilds: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ListServerBuilds", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ModifyServerBuild: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ModifyServerBuild", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RemoveServerBuild: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RemoveServerBuild", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCloudScriptRevision: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetCloudScriptRevision", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCloudScriptVersions: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetCloudScriptVersions", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetPublishedRevision: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SetPublishedRevision", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateCloudScript: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateCloudScript", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeleteContent: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeleteContent", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetContentList: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetContentList", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetContentUploadUrl: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetContentUploadUrl", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ResetCharacterStatistics: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ResetCharacterStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddPlayerTag: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AddPlayerTag", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
/**
* @deprecated Please use GetTasks instead.
*/
GetAllActionGroups: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetAllActionGroups", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetAllSegments: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetAllSegments", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerSegments: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerSegments", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayersInSegment: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayersInSegment", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerTags: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerTags", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RemovePlayerTag: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RemovePlayerTag", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AbortTaskInstance: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AbortTaskInstance", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
CreateActionsOnPlayersInSegmentTask: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/CreateActionsOnPlayersInSegmentTask", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
CreateCloudScriptTask: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/CreateCloudScriptTask", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeleteTask: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeleteTask", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
/**
* @deprecated Please use GetTasks instead.
*/
GetActionsOnPlayersInSegmentTaskInstance: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetActionsOnPlayersInSegmentTaskInstance", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCloudScriptTaskInstance: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetCloudScriptTaskInstance", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTaskInstances: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetTaskInstances", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTasks: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetTasks", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RunTask: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RunTask", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateTask: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateTask", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
};
var PlayFabAdminSDK = PlayFab.AdminApi;

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +0,0 @@
/// <reference path="../typings/PlayFab/PlayFabMatchmakerApi.d.ts" />
var PlayFab = typeof PlayFab != "undefined" ? PlayFab : {};
if(!PlayFab.settings) {
PlayFab.settings = {
titleId: null, // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website)
developerSecretKey: null, // For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website)
advertisingIdType: null,
advertisingIdValue: null,
// disableAdvertising is provided for completeness, but changing it is not suggested
// Disabling this may prevent your advertising-related PlayFab marketplace partners from working correctly
disableAdvertising: false,
AD_TYPE_IDFA: "Idfa",
AD_TYPE_ANDROID_ID: "Adid"
}
}
if(!PlayFab._internalSettings) {
PlayFab._internalSettings = {
sessionTicket: null,
productionServerUrl: ".playfabapi.com",
errorTitleId: "Must be have PlayFab.settings.titleId set to call this method",
errorLoggedIn: "Must be logged in to call this method",
errorSecretKey: "Must have PlayFab.settings.developerSecretKey set to call this method",
GetServerUrl: function () {
return "https://" + PlayFab.settings.titleId + PlayFab._internalSettings.productionServerUrl;
},
ExecuteRequest: function (completeUrl, data, authkey, authValue, callback) {
if (callback != null && typeof (callback) != "function")
throw "Callback must be null of a function";
if (data == null)
data = {};
var startTime = new Date();
var requestBody = JSON.stringify(data);
var xhr = new XMLHttpRequest();
// window.console.log("URL: " + completeUrl);
xhr.open("POST", completeUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json');
if (authkey != null)
xhr.setRequestHeader(authkey, authValue);
xhr.setRequestHeader('X-PlayFabSDK', "JavaScriptSDK-" + PlayFab._internalSettings.sdkVersion);
xhr.onloadend = function () {
if (callback == null)
return;
var result;
try {
// window.console.log("parsing json result: " + xhr.responseText);
result = JSON.parse(xhr.responseText);
} catch (e) {
result = {
code: 503, // Service Unavailable
status: "Service Unavailable",
error: "Connection error",
errorCode: 2, // PlayFabErrorCode.ConnectionError
errorMessage: xhr.responseText
};
}
result.CallBackTimeMS = new Date() - startTime;
if (result.code === 200)
callback(result, null);
else
callback(null, result);
}
xhr.onerror = function () {
if (callback == null)
return;
var result;
try {
result = JSON.parse(xhr.responseText);
} catch (e) {
result = {
code: 503, // Service Unavailable
status: "Service Unavailable",
error: "Connection error",
errorCode: 2, // PlayFabErrorCode.ConnectionError
errorMessage: xhr.responseText
};
}
result.CallBackTimeMS = new Date() - startTime;
callback(null, result);
}
xhr.send(requestBody);
}
}
}
PlayFab.buildIdentifier = "jbuild_javascriptsdk_1";
PlayFab.sdkVersion = "1.11.170828";
PlayFab.MatchmakerApi = {
AuthUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Matchmaker/AuthUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
PlayerJoined: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Matchmaker/PlayerJoined", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
PlayerLeft: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Matchmaker/PlayerLeft", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
StartGame: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Matchmaker/StartGame", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UserInfo: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Matchmaker/UserInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
};
var PlayFabMatchmakerSDK = PlayFab.MatchmakerApi;

View File

@ -1,768 +0,0 @@
/// <reference path="../typings/PlayFab/PlayFabServerApi.d.ts" />
var PlayFab = typeof PlayFab != "undefined" ? PlayFab : {};
if(!PlayFab.settings) {
PlayFab.settings = {
titleId: null, // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website)
developerSecretKey: null, // For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website)
advertisingIdType: null,
advertisingIdValue: null,
// disableAdvertising is provided for completeness, but changing it is not suggested
// Disabling this may prevent your advertising-related PlayFab marketplace partners from working correctly
disableAdvertising: false,
AD_TYPE_IDFA: "Idfa",
AD_TYPE_ANDROID_ID: "Adid"
}
}
if(!PlayFab._internalSettings) {
PlayFab._internalSettings = {
sessionTicket: null,
productionServerUrl: ".playfabapi.com",
errorTitleId: "Must be have PlayFab.settings.titleId set to call this method",
errorLoggedIn: "Must be logged in to call this method",
errorSecretKey: "Must have PlayFab.settings.developerSecretKey set to call this method",
GetServerUrl: function () {
return "https://" + PlayFab.settings.titleId + PlayFab._internalSettings.productionServerUrl;
},
ExecuteRequest: function (completeUrl, data, authkey, authValue, callback) {
if (callback != null && typeof (callback) != "function")
throw "Callback must be null of a function";
if (data == null)
data = {};
var startTime = new Date();
var requestBody = JSON.stringify(data);
var xhr = new XMLHttpRequest();
// window.console.log("URL: " + completeUrl);
xhr.open("POST", completeUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json');
if (authkey != null)
xhr.setRequestHeader(authkey, authValue);
xhr.setRequestHeader('X-PlayFabSDK', "JavaScriptSDK-" + PlayFab._internalSettings.sdkVersion);
xhr.onloadend = function () {
if (callback == null)
return;
var result;
try {
// window.console.log("parsing json result: " + xhr.responseText);
result = JSON.parse(xhr.responseText);
} catch (e) {
result = {
code: 503, // Service Unavailable
status: "Service Unavailable",
error: "Connection error",
errorCode: 2, // PlayFabErrorCode.ConnectionError
errorMessage: xhr.responseText
};
}
result.CallBackTimeMS = new Date() - startTime;
if (result.code === 200)
callback(result, null);
else
callback(null, result);
}
xhr.onerror = function () {
if (callback == null)
return;
var result;
try {
result = JSON.parse(xhr.responseText);
} catch (e) {
result = {
code: 503, // Service Unavailable
status: "Service Unavailable",
error: "Connection error",
errorCode: 2, // PlayFabErrorCode.ConnectionError
errorMessage: xhr.responseText
};
}
result.CallBackTimeMS = new Date() - startTime;
callback(null, result);
}
xhr.send(requestBody);
}
}
}
PlayFab.buildIdentifier = "jbuild_javascriptsdk_1";
PlayFab.sdkVersion = "1.11.170828";
PlayFab.ServerApi = {
AuthenticateSessionTicket: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AuthenticateSessionTicket", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetPlayerSecret: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetPlayerSecret", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
BanUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/BanUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerProfile: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayerProfile", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayFabIDsFromFacebookIDs: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayFabIDsFromFacebookIDs", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayFabIDsFromSteamIDs: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayFabIDsFromSteamIDs", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserAccountInfo: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserAccountInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserBans: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RevokeAllBansForUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RevokeAllBansForUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RevokeBans: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RevokeBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SendPushNotification: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SendPushNotification", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateAvatarUrl: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateAvatarUrl", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateBans: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeleteUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/DeleteUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetFriendLeaderboard: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetFriendLeaderboard", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetLeaderboard: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetLeaderboard", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetLeaderboardAroundUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetLeaderboardAroundUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerCombinedInfo: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayerCombinedInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerStatistics: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayerStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerStatisticVersions: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayerStatisticVersions", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserPublisherInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserPublisherInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserPublisherReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserPublisherReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdatePlayerStatistics: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdatePlayerStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserPublisherInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserPublisherInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserPublisherReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserPublisherReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCatalogItems: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCatalogItems", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTime: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetTime", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTitleData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetTitleData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTitleInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetTitleInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetTitleNews: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetTitleNews", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetPublisherData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetPublisherData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetTitleData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetTitleData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetTitleInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetTitleInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddCharacterVirtualCurrency: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AddCharacterVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddUserVirtualCurrency: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AddUserVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ConsumeItem: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/ConsumeItem", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
EvaluateRandomResultTable: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/EvaluateRandomResultTable", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCharacterInventory: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterInventory", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetRandomResultTables: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetRandomResultTables", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetUserInventory: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserInventory", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GrantItemsToCharacter: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GrantItemsToCharacter", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GrantItemsToUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GrantItemsToUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GrantItemsToUsers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GrantItemsToUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ModifyItemUses: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/ModifyItemUses", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
MoveItemToCharacterFromCharacter: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/MoveItemToCharacterFromCharacter", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
MoveItemToCharacterFromUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/MoveItemToCharacterFromUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
MoveItemToUserFromCharacter: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/MoveItemToUserFromCharacter", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RedeemCoupon: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RedeemCoupon", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ReportPlayer: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/ReportPlayer", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RevokeInventoryItem: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RevokeInventoryItem", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SubtractCharacterVirtualCurrency: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SubtractCharacterVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SubtractUserVirtualCurrency: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SubtractUserVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UnlockContainerInstance: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UnlockContainerInstance", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UnlockContainerItem: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UnlockContainerItem", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateUserInventoryItemCustomData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateUserInventoryItemCustomData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddFriend: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AddFriend", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetFriendsList: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetFriendsList", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RemoveFriend: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RemoveFriend", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetFriendTags: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetFriendTags", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeregisterGame: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/DeregisterGame", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
NotifyMatchmakerPlayerLeft: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/NotifyMatchmakerPlayerLeft", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RedeemMatchmakerTicket: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RedeemMatchmakerTicket", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RefreshGameServerInstanceHeartbeat: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RefreshGameServerInstanceHeartbeat", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RegisterGame: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RegisterGame", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetGameServerInstanceData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetGameServerInstanceData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetGameServerInstanceState: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetGameServerInstanceState", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
SetGameServerInstanceTags: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SetGameServerInstanceTags", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
WriteCharacterEvent: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/WriteCharacterEvent", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
WritePlayerEvent: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/WritePlayerEvent", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
WriteTitleEvent: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/WriteTitleEvent", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddSharedGroupMembers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AddSharedGroupMembers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
CreateSharedGroup: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/CreateSharedGroup", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeleteSharedGroup: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/DeleteSharedGroup", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetSharedGroupData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetSharedGroupData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RemoveSharedGroupMembers: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RemoveSharedGroupMembers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateSharedGroupData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateSharedGroupData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
ExecuteCloudScript: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/ExecuteCloudScript", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetContentDownloadUrl: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetContentDownloadUrl", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
DeleteCharacterFromUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/DeleteCharacterFromUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetAllUsersCharacters: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetAllUsersCharacters", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCharacterLeaderboard: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterLeaderboard", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCharacterStatistics: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetLeaderboardAroundCharacter: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetLeaderboardAroundCharacter", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetLeaderboardForUserCharacters: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetLeaderboardForUserCharacters", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GrantCharacterToUser: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GrantCharacterToUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateCharacterStatistics: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateCharacterStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCharacterData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCharacterInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetCharacterReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateCharacterData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateCharacterData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateCharacterInternalData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateCharacterInternalData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
UpdateCharacterReadOnlyData: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateCharacterReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AddPlayerTag: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AddPlayerTag", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
/**
* @deprecated Please use GetAllSegments instead.
*/
GetAllActionGroups: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetAllActionGroups", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetAllSegments: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetAllSegments", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerSegments: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayerSegments", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayersInSegment: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayersInSegment", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
GetPlayerTags: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetPlayerTags", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
RemovePlayerTag: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RemovePlayerTag", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
AwardSteamAchievement: function (request, callback) {
if (!PlayFab.settings.developerSecretKey) throw PlayFab._internalSettings.errorSecretKey;
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AwardSteamAchievement", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
},
};
var PlayFabServerSDK = PlayFab.ServerApi;

View File

@ -1,57 +0,0 @@
# JavaScriptSDK README
## 1. Overview:
JavaScriptSDK for the Client API of PlayFab
This SDK can alternatively be used via our CDN. Additional details can be found [here](https://blog.playfab.com/blog/playfab-now-serving-javascript-sdk-via-cdn).
If you want to start coding right away, check out our [JavaScript Getting Started Guide](JavaScriptGettingStarted.md)
## 2. Prerequisites:
* Users should be very familiar with the topics covered in our [getting started guide](https://api.playfab.com/docs/general-getting-started).
To connect to the PlayFab service, your machine must be running TLS v1.2 or better.
* For Windows, this means Windows 7 and above
* [Official Microsoft Documentation](https://msdn.microsoft.com/en-us/library/windows/desktop/aa380516%28v=vs.85%29.aspx)
* [Support for SSL/TLS protocols on Windows](http://blogs.msdn.com/b/kaushal/archive/2011/10/02/support-for-ssl-tls-protocols-on-windows.aspx)
## 3. Example Project (UNDER CONSTRUCTION)
The Example project is being revised for the upcoming 1.0 release
This sdk includes an optional example project that is used by PlayFab to verify sdk features are fully functional.
Please read about the testTitleData.json format, and purpose here:
* [testTitleData.md](https://github.com/PlayFab/SDKGenerator/blob/master/JenkinsConsoleUtility/testTitleData.md) must be created and placed in the root of the example (beside index.html & PlayFabApiTest.ts), and must be named "testTitleData.json"
## 4. Troubleshooting:
For a complete list of available APIs, check out the [online documentation](http://api.playfab.com/Documentation/).
#### Contact Us
We love to hear from our developer community!
Do you have ideas on how we can make our products and services better?
Our Developer Success Team can assist with answering any questions as well as process any feedback you have about PlayFab services.
[Forums, Support and Knowledge Base](https://community.playfab.com/index.html)
## 5. Acknowledgements
[dylanh724](https://www.github.com/dylanh724) - The previous tutorial before the current [Getting Started Guide](JavaScriptGettingStarted.md)
## 6. Copyright and Licensing Information:
Apache License --
Version 2.0, January 2004
http://www.apache.org/licenses/
Full details available within the LICENSE file.

View File

@ -1,160 +0,0 @@
JavaScript with TypeScript Getting Started Guide
----
This guide will help you make your first API call using a Web TypeScript environment.
TypeScript Project Setup
----
* OS: This guide is written for Windows 10 and Visual Studio
* The "Project Setup" section of this guide will not be very useful for other operating systems and environments (sorry!)
* TypeScript works on a wide variety of Operating Systems, Environments, and tools
* Installation
* Download and install Visual Studio 2015
* Update TypeScript within VS to the [latest version](https://www.microsoft.com/en-us/download/details.aspx?id=48593) (2.1.5 when this document was written)
* [OPTIONAL] Install the [Node.js tools](https://www.visualstudio.com/vs/node-js/) into Visual Studio
* Download and extract the [PlayFab JavaScriptSDK](https://github.com/PlayFab/JavaScriptSDK/archive/master.zip) to a local folder of your choosing {playFabSdkLocation}
* New Project Setup
* Open Visual Studio and create a new "Blank Node.js Web Application"
* ![TS image](/public/images/TypeScript/NewProj.png)
* This creates a project with several setup files
* [OPTIONAL] delete app.cs (We won't be using it)
* In Windows Explorer, navigate to {playFabSdkLocation}/PlayFabSdk and find the "src" folder
* In another Windows Explorer window, navigate to your new Visual Studio project
* Copy the "src" folder from {playFabSdkLocation}/PlayFabSdk, into your project folder
* Close the explorer windows, and return to Visual Studio
* Toggle the "Show All Files" button a few times, until you can see the PlayFab source files
* RClick "src" and "Include in Project"
* ![TS image](/public/images/TypeScript/IncludeSdk.png)
* At this point, running the project will open a browser, and display the default Microsoft example
* Project setup complete!
Set up your first API call
----
This guide will provide the minimum steps to make your first PlayFab API call. Confirmation will be visible on the webpage.
In your favorite text-editor, update the contents of index.html as follows:
```HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PlayFab JavaScript Unit Tests</title>
<script type="text/javascript" src="src/PlayFab/PlayFabClientApi.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body>
PlayFab Getting Started Guide<br/>
TitleID: <input type="text" id="titleId" value="144"><br/>
CustomID: <input type="text" id="customId" value="GettingStartedGuide"><br/>
<input type="button" value="Call LoginWithCustomID" onclick="DoExampleLoginWithCustomID()"><br/>
Result:<br/>
<textarea id="resultOutput" cols="60" rows="5"></textarea><br/>
</body>
</html>
```
In your favorite text-editor, update the contents of app.ts as follows:
```TypeScript
function DoExampleLoginWithCustomID(): void {
PlayFab.settings.titleId = (<HTMLInputElement>document.getElementById("titleId")).value;
var loginRequest: PlayFabClientModels.LoginWithCustomIDRequest = {
CustomId: (<HTMLInputElement>document.getElementById("customId")).value,
CreateAccount: true
};
PlayFabClientSDK.LoginWithCustomID(loginRequest, LoginCallback);
}
var LoginCallback = function (result: PlayFabModule.SuccessContainer<PlayFabClientModels.LoginResult>, error: PlayFabModule.IPlayFabError): void {
if (result !== null) {
document.getElementById("resultOutput").innerHTML = "Congratulations, you made your first successful API call!";
} else if (error !== null) {
document.getElementById("resultOutput").innerHTML =
"Something went wrong with your first API call.\n" +
"Here's some debug information:\n" +
CompileErrorReport(error);
}
}
// This is a utility function we haven't put into the core SDK yet. Feel free to use it.
function CompileErrorReport(error: PlayFabModule.IPlayFabError): string {
if (error === null)
return "";
var fullErrors: string = error.errorMessage;
for (var paramName in error.errorDetails)
for (var msgIdx in error.errorDetails[paramName])
fullErrors += "\n" + paramName + ": " + error.errorDetails[paramName][msgIdx];
return fullErrors;
}
```
Finish and Execute
----
* Run the program: Drop Down -> Debug -> Start Debugging
* In the new browser window, click the "Call LoginWithCustomID" button
* You should see the following text in the Result section:
```text
Congratulations, you made your first successful API call!
```
* At this point, you can start making other api calls, and building your game
* For a list of all available client API calls, see our documentation:
* https://api.playfab.com/
* Happy coding!
Deconstruct the code
----
This optional last section describes each part of this example in detail.
The HTML file has a few important lines:
```HTML
<script type="text/javascript" src="src/PlayFab/PlayFabClientApi.js"></script>
```
This line loads the Client-SDK from the local PlayFabSDK file. The latest version of this file is also available from [our CDN](https://download.playfab.com/PlayFabClientApi.js). For more information read our [CDN blog post](https://blog.playfab.com/blog/playfab-now-serving-javascript-sdk-via-cdn/).
The other important HTML lines:
```HTML
<script type="text/javascript" src="app.js"></script>
...
<input type="button" value="Call LoginWithCustomID" onclick="DoExampleLoginWithCustomID()"><br />
```
As you can see above, app.js contains the DoExampleLoginWithCustomID function. These lines bind our js file to our webpage, and invoke the DoExampleLoginWithCustomID function in that script. Everything else is just GUI. The name "app.js" is based on the typescript file in our default project "app.ts". If you rename "app.ts", it will generate a ".js" file with the same name. You should not try to add ".ts" scripts directly to a webpage. For more information about TypeScript, read the [TypeScript tutorial](https://www.typescriptlang.org/docs/tutorial.html).
* Line by line breakdown for app.js
* PlayFab.settings.titleId = (&lt;HTMLInputElement>document.getElementById("titleId")).value;
* This reads the titleId from the html-input, and sets it to the PlayFab sdk. TypeScript defines that getElementById returns type HTMLElement. We must cast that to the sub-type HTMLInputElement to get the input-specific field "value".
* Every PlayFab developer creates a title in Game Manager. When you publish your game, you must code that titleId into your game. This lets the client know how to access the correct data within PlayFab. For most users, just consider it a mandatory step that makes PlayFab work.
* var loginRequest: PlayFabClientModels.LoginWithCustomIDRequest = { TitleId: PlayFab.settings.titleId, CustomId: "GettingStartedGuide", CreateAccount: true };
* Most PlayFab API methods require input parameters, and those input parameters are packed into a request object
* Every API method requires a unique request object, with a mix of optional and mandatory parameters
* We also cast this request to LoginWithCustomIDRequest, which is the required type for PlayFabClientSDK.LoginWithCustomID
* For LoginWithCustomIDRequest, there is a mandatory parameter of CustomId, which uniquely identifies a player and CreateAccount, which allows the creation of a new account with this call.
* PlayFabClientSDK.LoginWithCustomID(loginRequest, LoginCallback);
* This begins the async request to "LoginWithCustomID", which will call LoginCallback when the API call is complete
* For login, most developers will want to use a more appropriate login method
* See the [PlayFab Login Documentation](https://api.playfab.com/Documentation/Client#Authentication) for a list of all login methods, and input parameters. Common choices are:
* [LoginWithAndroidDeviceID](https://api.playfab.com/Documentation/Client/method/LoginWithAndroidDeviceID)
* [LoginWithIOSDeviceID](https://api.playfab.com/Documentation/Client/method/LoginWithIOSDeviceID)
* [LoginWithEmailAddress](https://api.playfab.com/Documentation/Client/method/LoginWithEmailAddress)
* LoginCallback contains two parameters: result, error
* When successful, error will be null, and the result object will contain the requested information, according to the API called
* This result contains some basic information about the player, but for most users, login is simply a mandatory step before calling other APIs.
* If error is not null, your API has failed
* API calls can fail for many reasons, and you should always attempt to handle failure
* Why API calls fail (In order of likelihood)
* PlayFabSettings.TitleId is not set. If you forget to set titleId to your title, then nothing will work.
* Request parameters. If you have not provided the correct or required information for a particular API call, then it will fail. See error.errorMessage, error.errorDetails, or error.GenerateErrorReport() for more info.
* Device connectivity issue. Cell-phones lose/regain connectivity constantly, and so any API call at any time can fail randomly, and then work immediately after. Going into a tunnel can disconnect you completely.
* PlayFab server issue. As with all software, there can be issues. See our [release notes](https://api.playfab.com/releaseNotes/) for updates.
* The internet is not 100% reliable. Sometimes the message is corrupted or fails to reach the PlayFab server.
* If you are having difficulty debugging an issue, and the information within the error information is not sufficient, please visit us on our [forums](https://community.playfab.com/index.html)

View File

@ -1,9 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 The jQuery Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,35 +0,0 @@
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/qunit
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
All files located in the node_modules directory are externally maintained
libraries used by this software which have their own licenses; we
recommend you read them, as their terms may differ from the terms above.

View File

@ -45,7 +45,6 @@
</div> </div>
<div id="performance-stats" class="c-performance-stats" style="display: none;"></div> <div id="performance-stats" class="c-performance-stats" style="display: none;"></div>
<script type="text/javascript" src="PlayFab/PlayFabClientApi.js"></script>
<script type="text/javascript" src="Steam/steam.js"></script> <script type="text/javascript" src="Steam/steam.js"></script>
<canvas id="forceRefreshCanvas" style="position: fixed; right: 0px; bottom: 0px; width: 100vw; height: 100%; opacity: 0.01; pointer-events: none; z-index: -20;"></canvas> <canvas id="forceRefreshCanvas" style="position: fixed; right: 0px; bottom: 0px; width: 100vw; height: 100%; opacity: 0.01; pointer-events: none; z-index: -20;"></canvas>
<script> <script>

File diff suppressed because it is too large Load Diff