Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://download.playfab.com/PlayFabClientApi.js"></script>
- <script>
- // PlayFab einrichten
- PlayFab.settings.titleId = ":)";
- window.onload = function() {
- var playFabId = getCookie('PlayFabId');
- function getCookie(name) {
- var nameEQ = name + "=";
- var ca = document.cookie.split(';');
- for(var i=0;i < ca.length;i++) {
- var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1,c.length);
- if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
- }
- return null;
- }
- console.log('PlayFabId aus Cookies:', playFabId); // Log der PlayFabId
- if (playFabId) {
- // Rufen Sie die Kontoinformationen ab und aktualisieren Sie die Seite
- var getAccountInfoRequest = {
- PlayFabId: playFabId,
- };
- console.log('PlayFabId, die an GetAccountInfo übergeben wird: ', playFabId);
- try {
- PlayFabClientSDK.GetAccountInfo(getAccountInfoRequest, function (accountInfoResult, accountInfoError) {
- if (accountInfoResult) {
- var username = accountInfoResult.data.AccountInfo.Username;
- var email = accountInfoResult.data.AccountInfo.PrivateInfo.Email;
- // Zeigen Sie die Benutzerinformationen an
- document.getElementById('displayName').textContent = username;
- document.getElementById('email').textContent = email;
- console.log('Username:' + username);
- console.log('Email:' + email);
- } else if (accountInfoError) {
- console.log('Fehler beim Abrufen der Benutzerdaten: ' + accountInfoError.errorMessage);
- }
- });
- } catch (error) {
- console.error('Ein Fehler ist aufgetreten:', error);
- }
- } else {
- console.log('PlayFabId konnte nicht aus den Cookies abgerufen werden.');
- }
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement