Skip to content

Commit

Permalink
Merge pull request #2749 from ozdemir08/master
Browse files Browse the repository at this point in the history
Merge into master
  • Loading branch information
olehkuznetsov authored Oct 17, 2019
2 parents 8642bf7 + f1e1d40 commit bc01724
Show file tree
Hide file tree
Showing 345 changed files with 7,315 additions and 20,471 deletions.
34 changes: 27 additions & 7 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
Version 0.10.04
Bug fixes:
* Updated the way of handling requests to prevent them being processed twice.
* Fixed the callback not being triggered in CommitUpdate issue.
* RealTimeMultiplayerListener runs on the game thread.

Version 0.10.03
Bug fixes:
* Fixed the exception caused by ui callbacks.
Version 0.10.02
Bug Fixes:
* Fixed LoadMoreScores.
* Fixed sign out issues when signed out from ui.
* GetAnotherServerAuthCode uses the same scopes used in sign in.
* Local user id is returned instead of "me" in LoadScores.
* Removed AndroidX dependency.
Version 0.10.01
Other:
* Reimplementation of the plugin without using C++ SDK
New Features:
* Updated play-services-games version to 18.0.1
* Migrated java code to AndroidX
Version 0.9.64
New Features:
New Features:
* Updated gradle version to 5.4.1 and tools to 3.4.0
Bug Fixes:
* #2553 NullReferenceException with new v0.9.63 Achievements system
* #2545 Soft crash when opening achievements
* #2549 PlayerStats.AvgSessonLength is a typo

Version 0.9.63
New Features:
New Features:
* Updated gradle version to 3.3.2
* Updated play-services-games version to 17.0
* [TBMP] Added GetMatch method
Expand All @@ -17,14 +38,13 @@ Version 0.9.63
Bug Fixes:
* Improved sign-in time.
* Refactored achievements implementation. Now it uses less server calls and massive achievement increement will not block Achievement UI.
* Log DateTime guard
* Log DateTime guard
* Fix DirectoryNotFoundException in GPGSUtil.GenerateAndroidManifest
* Fixed readme
* #2482 Warning in AndroidTokenClient when building for device
* #2482 Warning in AndroidTokenClient when building for device
* #2486 CanRematch in TBM always false
Other:
* Removed GetAchievement method. Use LoadAchievements instead.

Version 0.9.62
Bug Fixes:
* #2475 ANRs 0.9.61 TokenFragment
Expand All @@ -48,7 +68,7 @@ Version 0.9.59
Version 0.9.58
Bug Fixes:
* #2409 GetAnotherServerAuthCode always requests email permission
* #2406 IL2CPP managed stripping level
* #2406 IL2CPP managed stripping level
* #2401 Fix for missing TokenFragment class
* #2400 Many crash in Unity 2018.3.0f2
* #2395 Not working with Unity 2018.3.0f2
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ _Unity® is a trademark of Unity Technologies._

_iOS is a trademark of Apple, Inc._

## New Plugin Is Available
A new Google Play Games plugin is now publicly available. Please go to [the announcement post](https://github.com/playgameservices/play-games-plugin-for-unity/issues/2687) to learn more about it.


## Overview

The Google Play Games plugin for Unity allows you to access the Google Play Games
Expand Down
Binary file not shown.
Binary file modified samples/CubicPilot/CubicPilot.unitypackage
Binary file not shown.
Binary file modified samples/Minimal/Minimal.unitypackage
Binary file not shown.
Binary file modified samples/NearbyDroids/NearbyDroids.unitypackage
Binary file not shown.
Binary file modified samples/QuizRacer/QuizRacer.unitypackage
Binary file not shown.
Binary file modified samples/SmokeTest/SmokeTest.unitypackage
Binary file not shown.
42 changes: 40 additions & 2 deletions samples/SmokeTest/Source/Assets/SmokeTest/LeaderboardGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class LeaderboardGUI : MonoBehaviour
{
private MainGui mOwner;
private string mStatus;
private LeaderboardScoreData mScoreData;

// Constructed by the main gui
internal LeaderboardGUI(MainGui owner)
Expand Down Expand Up @@ -71,6 +72,14 @@ internal void OnGUI()
DoSocialLoadScores();
}

if (GUILayout.Button("Load More Scores", GUILayout.Height(height), GUILayout.ExpandWidth(true)))
{
DoLoadMoreScores();
}

GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(GUILayout.Height(height));

if (GUILayout.Button("Back", GUILayout.Height(height), GUILayout.ExpandWidth(true)))
{
mOwner.SetUI(MainGui.Ui.Main);
Expand Down Expand Up @@ -113,13 +122,14 @@ internal void DoSocialLoadScores()
PlayGamesPlatform.Instance.LoadScores(
GPGSIds.leaderboard_leaders_in_smoketesting,
LeaderboardStart.PlayerCentered,
100,
/* rowCount= */ 25,
LeaderboardCollection.Social,
LeaderboardTimeSpan.AllTime,
(data) =>
{
mStatus = "Leaderboard data valid: " + data.Valid;
mStatus += "\n approx:" + data.ApproximateCount + " have " + data.Scores.Length;
mScoreData = data;
});
}

Expand All @@ -128,17 +138,45 @@ internal void DoPublicLoadScores()
PlayGamesPlatform.Instance.LoadScores(
GPGSIds.leaderboard_leaders_in_smoketesting,
LeaderboardStart.PlayerCentered,
100,
/* rowCount= */ 25,
LeaderboardCollection.Public,
LeaderboardTimeSpan.AllTime,
(data) =>
{
mStatus = "LB data Status: " + data.Status;
mStatus += " valid: " + data.Valid;
mStatus += "\n approx:" + data.ApproximateCount + " have " + data.Scores.Length;
mScoreData = data;
});
}

internal void DoLoadMoreScores()
{
if (mScoreData == null)
{
mStatus = "mScoreData is null.";
return;
}

PlayGamesPlatform.Instance.LoadMoreScores(mScoreData.NextPageToken, 10,
(data) =>
{
if (data.Status == ResponseStatus.InternalError)
{
mStatus = "Internal error";
mScoreData = null;
}
else
{
mStatus = "LB data Status: " + data.Status;
mStatus += " valid: " + data.Valid;
mStatus += "\n approx:" + data.ApproximateCount + " have " + data.Scores.Length;
mScoreData = data;
}
}
);
}

internal void DoLoadLeaderboard()
{
ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard();
Expand Down
133 changes: 115 additions & 18 deletions samples/SmokeTest/Source/Assets/SmokeTest/MainGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ public class MainGui : MonoBehaviour, RealTimeMultiplayerListener
private const int GridCols = 2;
private const int GridRows = 10;

private static readonly PlayGamesClientConfiguration ClientConfiguration =
new PlayGamesClientConfiguration.Builder()
.EnableSavedGames()
.RequestEmail()
.RequestServerAuthCode(false)
.RequestIdToken()
.Build();
private static PlayGamesClientConfiguration ClientConfiguration;

private Ui mUi = Ui.Main;

Expand All @@ -69,7 +63,6 @@ public class MainGui : MonoBehaviour, RealTimeMultiplayerListener
private string idToken = "";
private string authCode = "";
private bool loadedFriends = false;
private bool loadingFriends = false;

private volatile TurnBasedMatch mMatch = null;

Expand Down Expand Up @@ -98,7 +91,8 @@ public enum Ui
Achievements,
Leaderboards,
Video,
UserInfo
UserInfo,
PopupGravity
}

public void Start()
Expand Down Expand Up @@ -272,12 +266,44 @@ internal void ShowNotAuthUi()
{
this.DrawTitle(null);
this.DrawStatus();
if (GUI.Button(this.CalcGrid(0, 1), "Authenticate"))
if (GUI.Button(this.CalcGrid(0, 1), "Authenticate - Simple"))
{
this.DoAuthenticate();
this.DoAuthenticate(new PlayGamesClientConfiguration.Builder().Build());
}

if (GUI.Button(this.CalcGrid(1, 1), "Nearby Connections"))
else if (GUI.Button(this.CalcGrid(1, 1), "Authenticate - ID Token"))
{
this.DoAuthenticate(new PlayGamesClientConfiguration.Builder()
.RequestIdToken()
.Build());
}
else if (GUI.Button(this.CalcGrid(0, 2), "Authenticate - Server Auth Code"))
{
this.DoAuthenticate(new PlayGamesClientConfiguration.Builder()
.RequestServerAuthCode(false)
.Build());
}
else if (GUI.Button(this.CalcGrid(1, 2), "Authenticate - Enable Saved Games"))
{
this.DoAuthenticate(new PlayGamesClientConfiguration.Builder()
.EnableSavedGames()
.Build());
}
else if (GUI.Button(this.CalcGrid(0, 3), "Authenticate - Hide Popups"))
{
this.DoAuthenticate(new PlayGamesClientConfiguration.Builder()
.EnableHidePopups()
.Build());
}
else if (GUI.Button(this.CalcGrid(1, 3), "Authenticate - Full"))
{
this.DoAuthenticate(new PlayGamesClientConfiguration.Builder()
.RequestIdToken()
.RequestEmail()
.RequestServerAuthCode(false)
.EnableSavedGames()
.Build());
}
else if (GUI.Button(this.CalcGrid(0, 4), "Nearby Connections"))
{
SetUI(Ui.NearbyConnections);
}
Expand Down Expand Up @@ -321,7 +347,11 @@ internal void ShowRegularUi()
{
SetUI(Ui.NearbyConnections);
}
else if (GUI.Button(this.CalcGrid(0, 5), "Sign Out"))
else if (GUI.Button(this.CalcGrid(0, 5), "Popup Gravity"))
{
SetUI(Ui.PopupGravity);
}
else if (GUI.Button(this.CalcGrid(1, 5), "Sign Out"))
{
this.DoSignOut();
}
Expand Down Expand Up @@ -707,7 +737,15 @@ internal void ShowRtmpUi()
{
DoLeaveRoom();
}
else if (GUI.Button(CalcGrid(1, 6), "Back"))
else if (GUI.Button(CalcGrid(1, 6), "Is Room Connected"))
{
DoIsRoomConnected();
}
else if (GUI.Button(CalcGrid(0, 7), "Get Invitation"))
{
DoGetInvitation();
}
else if (GUI.Button(CalcGrid(1, 7), "Back"))
{
SetUI(Ui.Multiplayer);
ShowEffect(true);
Expand Down Expand Up @@ -862,6 +900,42 @@ internal void ShowEventsUi()
}
}

private void ShowPopupGravityUi()
{
DrawStatus();
DrawTitle("PopupGravity Ui");
if (GUI.Button(CalcGrid(0, 1), "Top"))
{
PlayGamesPlatform.Instance.SetGravityForPopups(Gravity.TOP);
Status = "Popup will appear on top";
}
else if (GUI.Button(CalcGrid(1, 1), "Bottom"))
{
PlayGamesPlatform.Instance.SetGravityForPopups(Gravity.BOTTOM);
Status = "Popup will appear at bottom";
}
else if (GUI.Button(CalcGrid(0, 2), "Left"))
{
PlayGamesPlatform.Instance.SetGravityForPopups(Gravity.LEFT);
Status = "Popup will appear on left";
}
else if (GUI.Button(CalcGrid(1, 2), "Right"))
{
PlayGamesPlatform.Instance.SetGravityForPopups(Gravity.RIGHT);
Status = "Popup will appear on right";
}
else if (GUI.Button(CalcGrid(0, 3), "Center horizontal"))
{
PlayGamesPlatform.Instance.SetGravityForPopups(Gravity.CENTER_HORIZONTAL);
Status = "Popup will appear on center";
}
else if (GUI.Button(CalcGrid(1, 3), "Back"))
{
SetUI(Ui.Main);
ShowEffect(true);
}
}

internal void ShowUserInfoUi()
{
GUI.Label(
Expand Down Expand Up @@ -895,9 +969,8 @@ internal void ShowUserInfoUi()
friendString = "No Friends found!";
}
}
else if (!loadingFriends)
else
{
loadingFriends = true;
Social.localUser.LoadFriends((ok) =>
{
loadedFriends = ok;
Expand Down Expand Up @@ -1041,6 +1114,9 @@ internal void OnGUI()

ShowUserInfoUi();
break;
case Ui.PopupGravity:
ShowPopupGravityUi();
break;
default:
// check for a status of interest, and if there
// is one, then don't touch it. Otherwise
Expand Down Expand Up @@ -1073,10 +1149,11 @@ internal void EndStandBy()
mStandby = false;
}

internal void DoAuthenticate()
internal void DoAuthenticate(PlayGamesClientConfiguration configuration)
{
SetStandBy("Authenticating...");

ClientConfiguration = configuration;
PlayGamesPlatform.InitializeInstance(ClientConfiguration);
PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) =>
Expand Down Expand Up @@ -1214,6 +1291,26 @@ private void DoLeaveRoom()
PlayGamesPlatform.Instance.RealTime.LeaveRoom();
}

private void DoIsRoomConnected()
{
Status = "Room is " +
(PlayGamesPlatform.Instance.RealTime.IsRoomConnected() ? "" : "not ") +
"connected.";
}

private void DoGetInvitation()
{
var invitation = PlayGamesPlatform.Instance.RealTime.GetInvitation();
if (invitation == null)
{
Status = "Invitation is null";
return;
}

string inviterName = invitation.Inviter != null ? invitation.Inviter.DisplayName : "(null)";
Status = "Invitation " + " from " + inviterName + ", id " + invitation.InvitationId;
}

private void DoWaitingRoom()
{
PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
Expand Down
3 changes: 3 additions & 0 deletions samples/SmokeTest/Source/Assets/SmokeTest/NearbyGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace SmokeTest
using GooglePlayGames;
using GooglePlayGames.BasicApi.Nearby;
using UnityEngine;
using UnityEngine.Android;

public class NearbyGUI : MonoBehaviour, IDiscoveryListener, IMessageListener
{
Expand Down Expand Up @@ -68,6 +69,8 @@ internal NearbyGUI(MainGui owner)
mEndpointsViewVector = new Vector2();
mMessageLog = new List<string>();
mKnownEndpoints = new HashSet<string>();
Permission.RequestUserPermission(Permission.FineLocation);
Permission.RequestUserPermission(Permission.CoarseLocation);
}

internal enum EndpointState
Expand Down
Binary file modified samples/TicTacToe/TicTacToe.unitypackage
Binary file not shown.
Loading

0 comments on commit bc01724

Please sign in to comment.