반응형

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using GooglePlayGames;

using UnityEngine.UI;


public class GoogleManager : MonoBehaviour {


public Text tx_id;

public Text tx_userName;

//public Text tx_Email;

public FacebookManager fb;


void Start()

{

PlayGamesPlatform.DebugLogEnabled = true;

PlayGamesPlatform.Activate ();

LogIn ();

}


public void LogIn()

{

Social.localUser.Authenticate ((bool success) => {

if (success) {

Debug.Log("You've successfully logged in");

tx_id.text = Social.localUser.id;

tx_userName.text = Social.localUser.userName;

//tx_Email.text = ((PlayGamesLocalUser)Social.localUser).Email + "-" + PlayGamesPlatform.Instance.GetUserEmail();

//fb.LogIn();

} else {

Debug.Log("Login failed for some reason : " + Social.Active);

Debug.Log("UserName : " + Social.localUser.userName);

Debug.Log("Id : " + Social.localUser.id);

}

/*

GooglePlayGames.OurUtils.PlayGamesHelperObject.RunOnGameThread(

() => {

Debug.Log("Local user's email is " + ((PlayGamesLocalUser)Social.localUser).Email);

});

*/

});

}


public void LogOut()

{

((PlayGamesPlatform)Social.Active).SignOut ();

tx_id.text = "No ID";

tx_userName.text = "No UserName";

//tx_Email.text = "No Email";

}

}



반응형

+ Recent posts