업데이트 이전에 문제 없이 잘 플레이해온 사람들인데 업데이트 후 이상현상이 여럿 접수되었습니다.
지금 유력한 원인 후보로 타겟api레벨로 보고있는데 (현재 타겟apu레벨이 28), 게임 시작 버튼을 누르면 즉시 팅긴다고 합니다.
혹시모르니 사용한 코드도 올리겠습니다.
게임 시작 버튼을 누를 때 호출되는 함수는 아래에 ★로 강조하였습니다.
using BackEnd;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using System;
public class BackEndFederationAuth : MonoBehaviour
{
public GameObject WarnningWindow;
public GameObject WarnningWindow_Chardan;
public GameObject WarnningWindow_Bg;
public GameObject baned;
void Start()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration
.Builder()
.RequestServerAuthCode(false)
.RequestEmail() // 이메일 요청
.RequestIdToken() // 토큰 요청
.Build();
//커스텀된 정보로 GPGS 초기화
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = false;
//GPGS 시작.
PlayGamesPlatform.Activate();
GoogleAuth();
}
void Update()
{
if (Input.GetKey(KeyCode.Escape))
WarnningWindow_Chardan.gameObject.SetActive(true);
}
public void SetOff()
{
Application.Quit();
}
public string MyNameIsbla = "";
// 구글에 로그인하기
bool asds = false;
private void GoogleAuth()
{
if (PlayGamesPlatform.Instance.localUser.authenticated == false)
{
Social.localUser.Authenticate(success =>
{
if (success == false)
{
asds = true;
return;
}
// 로그인이 성공되었습니다.
asds = true;
MyNameIsbla = ((PlayGamesLocalUser)Social.localUser).Email;
// Invoke("OnClickGPGSLogin", 3);
});
}
}
// 구글 토큰 받아오기
private string GetTokens()
{
if (PlayGamesPlatform.Instance.localUser.authenticated)
{
// 유저 토큰 받기 첫번째 방법
string _IDtoken = PlayGamesPlatform.Instance.GetIdToken();
// 두번째 방법
// string _IDtoken = ((PlayGamesLocalUser)Social.localUser).GetIdToken();
return _IDtoken;
}
else
{
if (asds)
{
WarnningWindow.gameObject.SetActive(true);
WarnningWindow_Bg.gameObject.SetActive(true);
}
GoogleAuth();
return null;
}
}
public DateTime GetServerDataTime;
// 구글토큰으로 뒤끝서버 로그인하기 - 동기 방식
//★★★★
//★★★★
//게임 시작 버튼을 누르면 이 함수가 호출됨
//★★★★
//★★★★
public void OnClickGPGSLogin()
{
BackendReturnObject BRO = Backend.BMember.AuthorizeFederation(GetTokens(), FederationType.Google, "gpgs로 만든계정");
if (BRO.IsSuccess())
{
BackendReturnObject servertime = Backend.Utils.GetServerTime();
string GetNowTime = servertime.GetReturnValuetoJSON()["utcTime"].ToString();
GetServerDataTime = DateTime.Parse(GetNowTime);
SceneManager.LoadScene("SampleScene");
}
else
{
switch (BRO.GetStatusCode())
{
case "200":
break;
case "403":
{
baned.gameObject.SetActive(true);
}
break;
default:
{
Backend.Utils.GetGoogleHash();
}
break;
}
}
}
}