using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using PlayFab;
using PlayFab.ClientModels;
using UnityEngine.SceneManagement;
using TMPro;
//using System;

public class SignIn : MonoBehaviour
{
    //サインイン処理
    public void SilentSignInPlayfab()
    {
        //ユーザーネーム登録
        var request = new UpdateUserTitleDisplayNameRequest
        {
            //DisplayName = Environment.UserName
            DisplayName = PlayerPrefs.GetString("customID")
        };

        PlayFabClientAPI.UpdateUserTitleDisplayName(request, OnSuccess, OnError);
    }

    //サインイン処理成功時
    void OnSuccess(UpdateUserTitleDisplayNameResult result)
    {
        //ゲームシーンに移動
        SceneManager.LoadScene("Game");
    }

    //サインイン処理失敗時
    void OnError(PlayFabError error)
    {
        //タイトルシーンに移動
        SceneManager.LoadScene("Title");
    }
}