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";
}
}
'Program > Unity' 카테고리의 다른 글
Facebook - 로그인 - 친구리스트 불러오기 (0) | 2017.02.23 |
---|---|
[Unity3D] Application.LoadLevel(string) is obsolete 마이그레이션 (0) | 2017.02.20 |