public void GetCurrentPlayer(AN_PlayersClient client, Action <AN_LinkedObjectResult <AN_Player> > callback) { SA_Coroutine.WaitForSeconds(1, () => { var result = new AN_LinkedObjectResult <AN_Player>(new AN_Player()); callback.Invoke(result); }); }
private void RetrivePlayer(Action <SA_Result> callback) { AN_Logger.Log("UM_AndroidSignInClient, cleint sigined-in, getting the player info"); //When Sign in is finished with successes var gamesClient = AN_Games.GetGamesClient(); gamesClient.SetViewForPopups(AN_MainActivity.Instance); //optionally gamesClient.SetGravityForPopups(AN_Gravity.TOP | AN_Gravity.CENTER_HORIZONTAL); AN_PlayersClient client = AN_Games.GetPlayersClient(); SA_Result apiResult; client.GetCurrentPlayer((result) => { if (result.IsSucceeded) { apiResult = new SA_Result(); AN_Logger.Log("UM_AndroidSignInClient, player info retrived, OnPlayerChnaged event will be sent"); UpdatePlayerInfo(result.Data); } else { apiResult = new SA_Result(result.Error); } AN_Logger.Log("UM_AndroidSignInClient, sending sing in result"); callback.Invoke(apiResult); }); }
private void PrintSignedPlayerInfo() { AN_PlayersClient client = AN_Games.GetPlayersClient(); client.GetCurrentPlayer((result) => { if (result.IsSucceeded) { AN_Player player = result.Data; //Printing player info: AN_Logger.Log("player.Id: " + player.PlayerId); AN_Logger.Log("player.DisplayName: " + player.DisplayName); AN_Logger.Log("player.HiResImageUri: " + player.HiResImageUri); AN_Logger.Log("player.IconImageUri: " + player.IconImageUri); AN_Logger.Log("player.HasIconImage: " + player.HasIconImage); AN_Logger.Log("player.HasHiResImage: " + player.HasHiResImage); if (!player.HasHiResImage) { var url = player.HiResImageUri; AN_ImageManager manager = new AN_ImageManager(); manager.LoadImage(url, (imaheLoadResult) => { }); } } else { AN_Logger.Log("Failed to load Current Player " + result.Error.FullMessage); } }); }
public void GetSignedInPlayerData(Action <AN_Player> resultCallback = null) { if (!IsGoogleApiAvailable || AN_GoogleSignIn.GetLastSignedInAccount() == null) { return; } if (_currentPlayerData != null) //early exit with existing player data { //Printing player info: Debug.Log("player.Id: " + _currentPlayerData.PlayerId); Debug.Log("player.Title: " + _currentPlayerData.Title); Debug.Log("player.DisplayName: " + _currentPlayerData.DisplayName); Debug.Log("player.HiResImageUri: " + _currentPlayerData.HiResImageUri); Debug.Log("player.IconImageUri: " + _currentPlayerData.IconImageUri); Debug.Log("player.HasIconImage: " + _currentPlayerData.HasIconImage); Debug.Log("player.HasHiResImage: " + _currentPlayerData.HasHiResImage); resultCallback.SafeInvoke(_currentPlayerData); return; } AN_PlayersClient client = AN_Games.GetPlayersClient(); client.GetCurrentPlayer(result => { if (result.IsSucceeded) { _currentPlayerData = result.Data; //Printing player info: Debug.Log("player.Id: " + _currentPlayerData.PlayerId); Debug.Log("player.Title: " + _currentPlayerData.Title); Debug.Log("player.DisplayName: " + _currentPlayerData.DisplayName); Debug.Log("player.HiResImageUri: " + _currentPlayerData.HiResImageUri); Debug.Log("player.IconImageUri: " + _currentPlayerData.IconImageUri); Debug.Log("player.HasIconImage: " + _currentPlayerData.HasIconImage); Debug.Log("player.HasHiResImage: " + _currentPlayerData.HasHiResImage); resultCallback.SafeInvoke(_currentPlayerData); } else { Debug.Log("Failed to load Current Player " + result.Error.FullMessage); resultCallback.SafeInvoke(null); } }); }
private void PrintSignedPlayerInfo() { AN_PlayersClient client = AN_Games.GetPlayersClient(); client.GetCurrentPlayer((result) => { if (result.IsSucceeded) { AN_Player player = result.Data; //Printing player info: AN_Logger.Log("player.Id: " + player.Id); AN_Logger.Log("player.DisplayName: " + player.DisplayName); AN_Logger.Log("player.HiResImageUri: " + player.HiResImageUri); AN_Logger.Log("player.IconImageUri: " + player.IconImageUri); AN_Logger.Log("player.HasIconImage: " + player.HasIconImage); AN_Logger.Log("player.HasHiResImage: " + player.HasHiResImage); if (!player.HasHiResImage) { var url = player.HiResImageUri; AN_ImageManager manager = new AN_ImageManager(); manager.LoadImage(url, (imaheLoadResult) => { if (imaheLoadResult.IsSucceeded) { m_userAvatar.texture = imaheLoadResult.Image; } else { //Or you may want to assing some default texture here m_userAvatar.texture = null; } }); } } else { AN_Logger.Log("Failed to load Current Player " + result.Error.FullMessage); } }); }
public override void Test() { AN_PlayersClient client = AN_Games.GetPlayersClient(); client.GetCurrentPlayer((result) => { if (result.IsSucceeded) { AN_Player player = result.Data; //Printing player info: AN_Logger.Log("player.Id: " + player.PlayerId); AN_Logger.Log("player.Title: " + player.Title); AN_Logger.Log("player.DisplayName: " + player.DisplayName); AN_Logger.Log("player.HiResImageUri: " + player.HiResImageUri); AN_Logger.Log("player.IconImageUri: " + player.IconImageUri); AN_Logger.Log("player.HasIconImage: " + player.HasIconImage); AN_Logger.Log("player.HasHiResImage: " + player.HasHiResImage); } SetAPIResult(result); }); }
public void GetCurrentPlayer(AN_PlayersClient client, Action <AN_LinkedObjectResult <AN_Player> > callback) { AN_Java.Bridge.CallStaticWithCallback(AN_PlayersClient, "GetCurrentPlayer", callback, client.HashCode); }