diff --git a/Assets/Plugins/Android.meta b/Assets/Plugins/Android.meta deleted file mode 100644 index 6a11e50de..000000000 --- a/Assets/Plugins/Android.meta +++ /dev/null @@ -1,5 +0,0 @@ -fileFormatVersion: 2 -guid: b8f0d9a6a7f9240c981894807effddbc -folderAsset: yes -DefaultImporter: - userData: diff --git a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib.meta b/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib.meta deleted file mode 100644 index fa0745149..000000000 --- a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib.meta +++ /dev/null @@ -1,143 +0,0 @@ -fileFormatVersion: 2 -guid: 44f4150f398dc4f22b230f8c74866383 -folderAsset: yes -timeCreated: 1504033921 -licenseType: Pro -PluginImporter: - serializedVersion: 2 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - data: - first: - '': Any - second: - enabled: 0 - settings: - Exclude Android: 0 - Exclude Editor: 0 - Exclude Linux: 0 - Exclude Linux64: 0 - Exclude LinuxUniversal: 0 - Exclude OSXIntel: 0 - Exclude OSXIntel64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 0 - Exclude Win: 0 - Exclude Win64: 0 - Exclude iOS: 0 - data: - first: - '': Editor - second: - enabled: 0 - settings: - CPU: AnyCPU - OS: AnyOS - data: - first: - Android: Android - second: - enabled: 1 - settings: - CPU: ARMv7 - data: - first: - Any: - second: - enabled: 1 - settings: {} - data: - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - data: - first: - Facebook: Win - second: - enabled: 0 - settings: - CPU: AnyCPU - data: - first: - Facebook: Win64 - second: - enabled: 0 - settings: - CPU: AnyCPU - data: - first: - Standalone: Linux - second: - enabled: 1 - settings: - CPU: x86 - data: - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: x86_64 - data: - first: - Standalone: LinuxUniversal - second: - enabled: 1 - settings: {} - data: - first: - Standalone: OSXIntel - second: - enabled: 1 - settings: - CPU: AnyCPU - data: - first: - Standalone: OSXIntel64 - second: - enabled: 1 - settings: - CPU: AnyCPU - data: - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: {} - data: - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: AnyCPU - data: - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: AnyCPU - data: - first: - WebGL: WebGL - second: - enabled: 1 - settings: {} - data: - first: - iPhone: iOS - second: - enabled: 1 - settings: - CompileFlags: - FrameworkDependencies: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml.meta b/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml.meta deleted file mode 100644 index a060c97be..000000000 --- a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0a6132672415643e8b1f16585785afe9 -timeCreated: 1504034459 -licenseType: Pro -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties b/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties deleted file mode 100644 index f438126c4..000000000 --- a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties +++ /dev/null @@ -1,2 +0,0 @@ -target=android-16 -android.library=true diff --git a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties.meta b/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties.meta deleted file mode 100644 index f43a87ce3..000000000 --- a/Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties.meta +++ /dev/null @@ -1,4 +0,0 @@ -fileFormatVersion: 2 -guid: 6156f0fc2bafa4f0c86d61673c0068d0 -DefaultImporter: - userData: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/Dependencies.xml b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/Dependencies.xml new file mode 100644 index 000000000..2fc4e5eeb --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/Dependencies.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/Dependencies.xml.meta similarity index 54% rename from Assets/Public/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Editor/Dependencies.xml.meta index e777dbe6c..f54f057cd 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt.meta +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/Dependencies.xml.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: 0e1f3c150256848b1ba98702cfb71220 -timeCreated: 1435699670 -licenseType: Pro +guid: 934b981265cbf984fa7fc451550eadcc TextScriptImporter: + externalObjects: {} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSAndroidSetupUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSAndroidSetupUI.cs index 84138460d..2802f88f8 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSAndroidSetupUI.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSAndroidSetupUI.cs @@ -24,6 +24,10 @@ namespace GooglePlayGames.Editor using UnityEditor; using UnityEngine; +#if UNITY_2021_2_OR_NEWER + using UnityEditor.Build; +#endif + /// /// Google Play Game Services Setup dialog for Android. /// @@ -57,15 +61,14 @@ public class GPGSAndroidSetupUI : EditorWindow /// /// Menus the item for GPGS android setup. /// - [MenuItem("Window/Google Play Games/Setup/Android setup...", false, 1)] + [MenuItem("Google/Play Games/Setup/Android setup...", false, 1)] public static void MenuItemFileGPGSAndroidSetup() { - EditorWindow window = EditorWindow.GetWindow( - typeof(GPGSAndroidSetupUI), true, GPGSStrings.AndroidSetup.Title); + var window = EditorWindow.GetWindow(true, GPGSStrings.AndroidSetup.Title); window.minSize = new Vector2(500, 400); } - [MenuItem("Window/Google Play Games/Setup/Android setup...", true)] + [MenuItem("Google/Play Games/Setup/Android setup...", true)] public static bool EnableAndroidMenuItem() { #if UNITY_ANDROID @@ -111,8 +114,6 @@ public static bool PerformSetup( // check the bundle id and set it if needed. CheckBundleId(); - GPGSUtil.CheckAndFixDependencies(); - GPGSUtil.CheckAndFixVersionedAssestsPaths(); AssetDatabase.Refresh(); Google.VersionHandler.VerboseLoggingEnabled = true; @@ -196,7 +197,7 @@ public static bool PerformSetup(string webClientId, string appId, string nearbyS } // Generate AndroidManifest.xml - GPGSUtil.GenerateAndroidManifest(); + GPGSUtil.UpdateGameInfo(); // refresh assets, and we're done AssetDatabase.Refresh(); @@ -298,9 +299,8 @@ public void OnGUI() } catch (Exception e) { - GPGSUtil.Alert( - GPGSStrings.Error, - "Invalid classname: " + e.Message); + GPGSUtil.Alert(GPGSStrings.Error,"Invalid classname: " + e.Message); + Debug.LogException(e); } } @@ -355,48 +355,45 @@ public static void CheckBundleId() string packageName = GPGSProjectSettings.Instance.Get( GPGSUtil.ANDROIDBUNDLEIDKEY, string.Empty); string currentId; -#if UNITY_5_6_OR_NEWER - currentId = PlayerSettings.GetApplicationIdentifier( - BuildTargetGroup.Android); +#if UNITY_2021_2_OR_NEWER + currentId = PlayerSettings.GetApplicationIdentifier(NamedBuildTarget.Android); +#elif UNITY_5_6_OR_NEWER + currentId = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android); #else currentId = PlayerSettings.bundleIdentifier; #endif - if (!string.IsNullOrEmpty(packageName)) + if (string.IsNullOrEmpty(packageName)) { - if (string.IsNullOrEmpty(currentId) || - currentId == "com.Company.ProductName") - { -#if UNITY_5_6_OR_NEWER - PlayerSettings.SetApplicationIdentifier( - BuildTargetGroup.Android, packageName); + Debug.Log("NULL package!!"); + } + else if (string.IsNullOrEmpty(currentId) || currentId == "com.Company.ProductName") + { +#if UNITY_2021_2_OR_NEWER + PlayerSettings.SetApplicationIdentifier(NamedBuildTarget.Android, packageName); +#elif UNITY_5_6_OR_NEWER + PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, packageName); #else - PlayerSettings.bundleIdentifier = packageName; + PlayerSettings.bundleIdentifier = packageName; #endif - } - else if (currentId != packageName) + } + else if (currentId != packageName) + { + if (EditorUtility.DisplayDialog( + "Set Bundle Identifier?", + "The server configuration is using " + packageName + + ", but the player settings is set to " + currentId + + ".\nSet the Bundle Identifier to " + packageName + "?", + "OK", "Cancel")) { - if (EditorUtility.DisplayDialog( - "Set Bundle Identifier?", - "The server configuration is using " + - packageName + ", but the player settings is set to " + - currentId + ".\nSet the Bundle Identifier to " + - packageName + "?", - "OK", - "Cancel")) - { -#if UNITY_5_6_OR_NEWER - PlayerSettings.SetApplicationIdentifier( - BuildTargetGroup.Android, packageName); +#if UNITY_2021_2_OR_NEWER + PlayerSettings.SetApplicationIdentifier(NamedBuildTarget.Android, packageName); +#elif UNITY_5_6_OR_NEWER + PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, packageName); #else - PlayerSettings.bundleIdentifier = packageName; + PlayerSettings.bundleIdentifier = packageName; #endif - } } } - else - { - Debug.Log("NULL package!!"); - } } /// diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSDocsUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSDocsUI.cs index 4d7c39d20..8b294686a 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSDocsUI.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSDocsUI.cs @@ -21,29 +21,26 @@ namespace GooglePlayGames.Editor public class GPGSDocsUI { - [MenuItem("Window/Google Play Games/Documentation/Plugin Getting Started Guide...", false, 100)] + [MenuItem("Google/Play Games/Documentation/Plugin Getting Started Guide...", false, 100)] public static void MenuItemGettingStartedGuide() { Application.OpenURL(GPGSStrings.ExternalLinks.GettingStartedGuideURL); } - [MenuItem("Window/Google Play Games/Documentation/Google Play Games API...", false, 101)] + [MenuItem("Google/Play Games/Documentation/Google Play Games API...", false, 101)] public static void MenuItemPlayGamesServicesAPI() { Application.OpenURL(GPGSStrings.ExternalLinks.PlayGamesServicesApiURL); } - [MenuItem("Window/Google Play Games/About/About the Plugin...", false, 300)] + [MenuItem("Google/Play Games/About/About the Plugin...", false, 300)] public static void MenuItemAbout() { - string msg = GPGSStrings.AboutText + - PluginVersion.VersionString + " (" + - string.Format("0x{0:X8}", GooglePlayGames.PluginVersion.VersionInt) + ")"; - EditorUtility.DisplayDialog(GPGSStrings.AboutTitle, msg, - GPGSStrings.Ok); + string msg = GPGSStrings.AboutText + PluginVersion.VersionString + " (" + string.Format("0x{0:X8}", GooglePlayGames.PluginVersion.VersionInt) + ")"; + EditorUtility.DisplayDialog(GPGSStrings.AboutTitle, msg, GPGSStrings.Ok); } - [MenuItem("Window/Google Play Games/About/License...", false, 301)] + [MenuItem("Google/Play Games/About/License...", false, 301)] public static void MenuItemLicense() { EditorUtility.DisplayDialog(GPGSStrings.LicenseTitle, GPGSStrings.LicenseText, diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSPostBuild.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSPostBuild.cs index fb55c4395..2a77314a3 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSPostBuild.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSPostBuild.cs @@ -17,13 +17,16 @@ #if UNITY_ANDROID namespace GooglePlayGames.Editor { - using System.Collections.Generic; using System.IO; - using UnityEditor.Callbacks; + using System.Xml; + using System.Linq; + using System.Collections.Generic; + using UnityEditor; - using UnityEngine; + using UnityEditor.Android; + using UnityEditor.Callbacks; - public static class GPGSPostBuild + public class GPGSPostBuild : IPostGenerateGradleAndroidProject { [PostProcessBuild(99999)] public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) @@ -37,6 +40,96 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj return; } + + public int callbackOrder => 999; + + const string androidNamespaceURL = "http://schemas.android.com/apk/res/android"; + public void OnPostGenerateGradleAndroidProject(string path) + { + var manifestPath = Path.Combine(path,"src","main","AndroidManifest.xml"); + if(!File.Exists(manifestPath)) + { + EditorUtility.DisplayDialog("Google Play Games Error","Cannot find AndroidManifest.xml to modified","OK"); + return; + } + + var xmlDoc = new XmlDocument(); + xmlDoc.Load(manifestPath); + + var nsmgr = new XmlNamespaceManager(xmlDoc.NameTable); + nsmgr.AddNamespace("android",androidNamespaceURL); + + var appID = FindOrCreate(xmlDoc,nsmgr,androidNamespaceURL,"manifest/application/meta-data","android:name","com.google.android.gms.games.APP_ID"); + SetAttributeNS(xmlDoc,appID,androidNamespaceURL,"android:value","\\u003" + GPGSProjectSettings.Instance.Get(GPGSUtil.APPIDKEY)); + + var webClientID = FindOrCreate(xmlDoc,nsmgr,androidNamespaceURL,"manifest/application/meta-data","android:name","com.google.android.gms.games.WEB_CLIENT_ID"); + SetAttributeNS(xmlDoc,webClientID,androidNamespaceURL,"android:value",GPGSProjectSettings.Instance.Get(GPGSUtil.WEBCLIENTIDKEY)); + + var version = FindOrCreate(xmlDoc,nsmgr,androidNamespaceURL,"manifest/application/meta-data","android:name","com.google.android.gms.games.unityVersion"); + SetAttributeNS(xmlDoc,version,androidNamespaceURL,"android:value","\\u003" + PluginVersion.VersionString); + + string serviceID = GPGSProjectSettings.Instance.Get(GPGSUtil.SERVICEIDKEY); + if (!string.IsNullOrEmpty(serviceID)) + { + foreach(var permission in new[]{ "BLUETOOTH","BLUETOOTH_ADMIN","ACCESS_WIFI_STATE","CHANGE_WIFI_STATE","ACCESS_COARSE_LOCATION" }) + FindOrCreate(xmlDoc,nsmgr,androidNamespaceURL,"manifest/uses-permission","android:name","android.permission." + permission); + + var service = FindOrCreate(xmlDoc,nsmgr,androidNamespaceURL,"manifest/application/meta-data","android:name","com.google.android.gms.nearby.connection.SERVICE_ID"); + SetAttributeNS(xmlDoc,service,androidNamespaceURL,"android:value",serviceID); + } + + xmlDoc.Save(manifestPath); + } + + static void SetAttributeNS(XmlDocument xmlDoc,XmlElement element,string namespaceURL,string attributeName,string attributeValue) + { + var attr = xmlDoc.CreateAttribute(attributeName,namespaceURL); + attr.Value = attributeValue; + element.SetAttributeNode(attr); + } + + static XmlElement FindOrCreate(XmlDocument xmlDoc,XmlNamespaceManager nsmgr,string attributeNamespace,string path,string attributeName,string attributeValue) + { + var nodes = xmlDoc.SelectNodes($"{path}[@{attributeName}='{attributeValue}']",nsmgr); + if(nodes.Count > 0) + { + int i = 0; + while(i < nodes.Count) + { + if(nodes[i] is XmlElement element) + break; + + i++; + } + + foreach(var node in nodes.OfType().Where((node,n) => i != n)) + node.ParentNode.RemoveChild(node); + + return nodes[i] as XmlElement; + } + else + { + var element = xmlDoc.DocumentElement; + var stack = new Stack(); + while(path.LastIndexOf('/') is int i && i > 0) + { + stack.Push(path.Substring(i + 1)); + path = path.Remove(i); + element = xmlDoc.SelectNodes(path,nsmgr)?.OfType().FirstOrDefault(); + if(element != null) + break; + } + + while(stack.TryPop(out string name)) + { + element = element.AppendChild(xmlDoc.CreateElement(name)) as XmlElement; + } + + SetAttributeNS(xmlDoc,element,attributeNamespace,attributeName,attributeValue); + + return element; + } + } } } #endif //UNITY_ANDROID \ No newline at end of file diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUpgrader.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUpgrader.cs index ada7ed1f7..32267fb28 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUpgrader.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUpgrader.cs @@ -38,22 +38,13 @@ static GPGSUpgrader() Debug.Log("GPGSUpgrader start"); GPGSProjectSettings.Instance.Set(GPGSUtil.LASTUPGRADEKEY, PluginVersion.VersionKey); - GPGSProjectSettings.Instance.Set(GPGSUtil.PLUGINVERSIONKEY, - PluginVersion.VersionString); + GPGSProjectSettings.Instance.Set(GPGSUtil.PLUGINVERSIONKEY, PluginVersion.VersionString); GPGSProjectSettings.Instance.Save(); - bool isChanged = false; - // Check that there is a AndroidManifest.xml file - if (!GPGSUtil.AndroidManifestExists()) - { - isChanged = true; - GPGSUtil.GenerateAndroidManifest(); - } + GPGSUtil.UpdateGameInfo(); + + AssetDatabase.Refresh(); - if (isChanged) - { - AssetDatabase.Refresh(); - } Debug.Log("GPGSUpgrader done"); } } diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs index 4eadb15ac..bff31563b 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs @@ -22,6 +22,7 @@ namespace GooglePlayGames.Editor using System.Collections.Generic; using System.IO; using System.Xml; + using System.Linq; using UnityEditor; using UnityEngine; @@ -100,15 +101,7 @@ public static class GPGSUtil /// /// The game info file path, relative to the plugin root directory. This is a generated file. /// - private const string GameInfoRelativePath = "Runtime/Scripts/GameInfo.cs"; - - /// - /// The manifest path, relative to the plugin root directory. - /// - /// The Games SDK requires additional metadata in the AndroidManifest.xml - /// file. - private const string ManifestRelativePath = - "../../Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml"; + private const string GameInfoRelativePath = "GooglePlayGames/Runtime/Scripts/GameInfo.cs"; private const string RootFolderName = "com.google.play.games"; @@ -119,55 +112,42 @@ public static string RootPath { get { - if (string.IsNullOrEmpty(mRootPath)) + if (string.IsNullOrEmpty(mRootPath) || !Directory.Exists(mRootPath)) { #if UNITY_2018_4_OR_NEWER - // Search for root path in plugin locations for both Asset packages and UPM packages - string[] dirs = Directory.GetDirectories("Packages", RootFolderName, SearchOption.AllDirectories); - string[] dir1 = Directory.GetDirectories("Assets", RootFolderName, SearchOption.AllDirectories); - int dirsLength = dirs.Length; - Array.Resize(ref dirs, dirsLength + dir1.Length); - Array.Copy(dir1, 0, dirs, dirsLength, dir1.Length); -#else - string[] dirs = Directory.GetDirectories("Assets", RootFolderName, SearchOption.AllDirectories); + mRootPath = Path.GetFullPath(Path.Combine("Packages",RootFolderName)); + if(Directory.Exists(mRootPath)) + return mRootPath; +#endif + + string[] dirs = new[] { +#if UNITY_2018_4_OR_NEWER + // search for remote UPM installation + Path.Join("Library","PackageCache"), + "Packages", #endif - switch (dirs.Length) + "Assets" + }.Distinct().SelectMany((path) => { + return Directory.GetDirectories(path, RootFolderName + "*", SearchOption.AllDirectories); + }).Distinct().ToArray(); + + mRootPath = dirs.Select((dir) => SlashesToPlatformSeparator(dir)).FirstOrDefault((dir) => File.Exists(Path.Combine(dir,GameInfoRelativePath))); + + if (string.IsNullOrEmpty(mRootPath)) { - case 0: - Alert("Plugin error: com.google.play.games folder was renamed"); - throw new Exception("com.google.play.games folder was renamed"); - - case 1: - mRootPath = SlashesToPlatformSeparator(dirs[0]); - break; - - default: - for (int i = 0; i < dirs.Length; i++) - { - if (File.Exists(SlashesToPlatformSeparator(Path.Combine(dirs[i], GameInfoRelativePath))) - ) - { - mRootPath = SlashesToPlatformSeparator(dirs[i]); - break; - } - } - - if (string.IsNullOrEmpty(mRootPath)) - { - Alert("Plugin error: com.google.play.games folder was renamed"); - throw new Exception("com.google.play.games folder was renamed"); - } - - break; + Alert("Plugin error: com.google.play.games folder was renamed"); + throw new Exception("com.google.play.games folder was renamed"); + } + + // UPM package root path is 'Library/PackageCache/com.google.play.games@.*/ + // where the suffix can be a version number if installed with URS + // or a hash if from disk or tarball + if (mRootPath.Contains(RootFolderName + '@')) + { + mRootPath = mRootPath.Replace("Packages", "Library/PackageCache"); } } - // UPM package root path is 'Library/PackageCache/com.google.play.games@.*/ - // where the suffix can be a version number if installed with URS - // or a hash if from disk or tarball - if (mRootPath.Contains(RootFolderName + '@')) - { - mRootPath = mRootPath.Replace("Packages", "Library/PackageCache"); - } + return mRootPath; } } @@ -177,17 +157,7 @@ public static string RootPath /// private static string GameInfoPath { - get { return SlashesToPlatformSeparator(Path.Combine(RootPath, GameInfoRelativePath)); } - } - - /// - /// The manifest path. - /// - /// The Games SDK requires additional metadata in the AndroidManifest.xml - /// file. - private static string ManifestPath - { - get { return SlashesToPlatformSeparator(Path.Combine(RootPath, ManifestRelativePath)); } + get { return SlashesToPlatformSeparator(Path.Combine("Assets", GameInfoRelativePath)); } } /// @@ -221,7 +191,7 @@ private static string ManifestPath /// Path with correct separators. public static string SlashesToPlatformSeparator(string path) { - return path.Replace("/", System.IO.Path.DirectorySeparatorChar.ToString()); + return Path.DirectorySeparatorChar == '/' ? path : path.Replace('/', Path.DirectorySeparatorChar); } /// @@ -251,8 +221,7 @@ public static string ReadFile(string filePath) /// Name of the template in the editor directory. public static string ReadEditorTemplate(string name) { - return ReadFile( - Path.Combine(RootPath, string.Format("Editor{0}{1}.txt", Path.DirectorySeparatorChar, name))); + return ReadFile(Path.Combine(RootPath,"Editor",string.Format("{0}.txt", name))); } /// @@ -491,7 +460,7 @@ public static string GetAndroidSdkPath() public static bool HasAndroidSdk() { string sdkPath = GetAndroidSdkPath(); - return sdkPath != null && sdkPath.Trim() != string.Empty && System.IO.Directory.Exists(sdkPath); + return sdkPath != null && sdkPath.Trim() != string.Empty && Directory.Exists(sdkPath); } /// @@ -516,61 +485,6 @@ public static int GetUnityMajorVersion() #endif } - /// - /// Checks for the android manifest file exsistance. - /// - /// true, if the file exists false otherwise. - public static bool AndroidManifestExists() - { - string destFilename = ManifestPath; - - return File.Exists(destFilename); - } - - /// - /// Generates the android manifest. - /// - public static void GenerateAndroidManifest() - { - string destFilename = ManifestPath; - - // Generate AndroidManifest.xml - string manifestBody = GPGSUtil.ReadEditorTemplate("template-AndroidManifest"); - - Dictionary overrideValues = - new Dictionary(); - - if (!string.IsNullOrEmpty(GPGSProjectSettings.Instance.Get(SERVICEIDKEY))) - { - overrideValues[NEARBY_PERMISSIONS_PLACEHOLDER] = - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n"; - overrideValues[SERVICEID_ELEMENT_PLACEHOLDER] = - " \n" + - " \n"; - } - else - { - overrideValues[NEARBY_PERMISSIONS_PLACEHOLDER] = ""; - overrideValues[SERVICEID_ELEMENT_PLACEHOLDER] = ""; - } - - foreach (KeyValuePair ent in replacements) - { - string value = - GPGSProjectSettings.Instance.Get(ent.Value, overrideValues); - manifestBody = manifestBody.Replace(ent.Key, value); - } - - GPGSUtil.WriteFile(destFilename, manifestBody); - GPGSUtil.UpdateGameInfo(); - } - /// /// Writes the resource identifiers file. This file contains the /// resource ids copied (downloaded?) from the play game app console. @@ -654,84 +568,6 @@ public static void UpdateGameInfo() GPGSUtil.WriteFile(GameInfoPath, fileBody); } - /// - /// Checks the dependencies file and fixes repository paths - /// if they are incorrect (for example if the user moved plugin - /// into some subdirectory). This is a generated file containing - /// the list of dependencies that are needed for the plugin to work. - /// - public static void CheckAndFixDependencies() - { - string depPath = - SlashesToPlatformSeparator(Path.Combine(GPGSUtil.RootPath, - "Editor/GooglePlayGamesPluginDependencies.xml")); - - XmlDocument doc = new XmlDocument(); - doc.Load(depPath); - - XmlNodeList repos = doc.SelectNodes("//androidPackage[contains(@spec,'com.google.games')]//repository"); - foreach (XmlNode repo in repos) - { - if (!Directory.Exists(repo.InnerText)) - { - int pos = repo.InnerText.IndexOf(RootFolderName); - if (pos != -1) - { - repo.InnerText = - Path.Combine(RootPath, repo.InnerText.Substring(pos + RootFolderName.Length + 1)) - .Replace("\\", "/"); - } - } - } - - doc.Save(depPath); - } - - /// - /// Checks the file containing the list of versioned assets and fixes - /// paths to them if they are incorrect (for example if the user moved - /// plugin into some subdirectory). This is a generated file. - /// - public static void CheckAndFixVersionedAssestsPaths() - { - string[] foundPaths = - Directory.GetFiles(RootPath, "GooglePlayGamesPlugin_v*.txt", SearchOption.AllDirectories); - - if (foundPaths.Length == 1) - { - string tmpFilePath = Path.GetTempFileName(); - - StreamWriter writer = new StreamWriter(tmpFilePath); - using (StreamReader reader = new StreamReader(foundPaths[0])) - { - string assetPath; - while ((assetPath = reader.ReadLine()) != null) - { - int pos = assetPath.IndexOf(RootFolderName); - if (pos != -1) - { - assetPath = Path.Combine(RootPath, assetPath.Substring(pos + RootFolderName.Length + 1)) - .Replace("\\", "/"); - } - - writer.WriteLine(assetPath); - } - } - - writer.Flush(); - writer.Close(); - - try - { - File.Copy(tmpFilePath, foundPaths[0], true); - } - finally - { - File.Delete(tmpFilePath); - } - } - } - /// /// Ensures the dir exists. /// diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/NearbyConnectionUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/NearbyConnectionUI.cs index f4cc4875e..bf23a9a3f 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/NearbyConnectionUI.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/NearbyConnectionUI.cs @@ -25,7 +25,7 @@ public class NearbyConnectionUI : EditorWindow { private string mNearbyServiceId = string.Empty; - [MenuItem("Window/Google Play Games/Setup/Nearby Connections setup...", false, 3)] + [MenuItem("Google/Play Games/Setup/Nearby Connections setup...", false, 3)] public static void MenuItemNearbySetup() { EditorWindow window = EditorWindow.GetWindow( @@ -33,7 +33,7 @@ public static void MenuItemNearbySetup() window.minSize = new Vector2(400, 200); } - [MenuItem("Window/Google Play Games/Setup/Nearby Connections setup...", true)] + [MenuItem("Google/Play Games/Setup/Nearby Connections setup...", true)] public static bool EnableNearbyMenuItem() { #if UNITY_ANDROID @@ -128,7 +128,7 @@ public static bool PerformSetup(string nearbyServiceId, bool androidBuild) GPGSUtil.EnsureDirExists("Assets/Plugins/Android"); // Generate AndroidManifest.xml - GPGSUtil.GenerateAndroidManifest(); + GPGSUtil.UpdateGameInfo(); GPGSProjectSettings.Instance.Set(GPGSUtil.NEARBYSETUPDONEKEY, true); GPGSProjectSettings.Instance.Save(); diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt b/Assets/Public/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt deleted file mode 100644 index d32616fb6..000000000 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt +++ /dev/null @@ -1,27 +0,0 @@ - - - - - __NEARBY_PERMISSIONS__ - - - - __NEARBY_SERVICE_ELEMENT__ - - - - - - - - - - - diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/m2repository.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Proguard.meta similarity index 80% rename from Assets/Public/GooglePlayGames/com.google.play.games/Editor/m2repository.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Proguard.meta index b57f75888..4a7d303ba 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/m2repository.meta +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Proguard.meta @@ -1,8 +1,6 @@ fileFormatVersion: 2 guid: a1aac54589c4640cd89900056af3a094 folderAsset: yes -timeCreated: 1515000812 -licenseType: Free DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt b/Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt index 63c7b08cf..62b587d3a 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt @@ -1,8 +1,10 @@ +-keep class com.google.android.gms.games.PlayGames { *; } -keep class com.google.android.gms.games.leaderboard.** { *; } -keep class com.google.android.gms.games.snapshot.** { *; } -keep class com.google.android.gms.games.achievement.** { *; } -keep class com.google.android.gms.games.event.** { *; } -keep class com.google.android.gms.games.stats.** { *; } +-keep class com.google.android.gms.games.video.** { *; } -keep class com.google.android.gms.games.* { *; } -keep class com.google.android.gms.common.api.ResultCallback { *; } -keep class com.google.android.gms.signin.** { *; } @@ -17,4 +19,5 @@ -keep class com.google.android.gms.common.GooglePlayServicesUtil { *; } -keep class com.google.android.gms.common.api.** { *; } -keep class com.google.android.gms.common.data.DataBufferUtils { *; } +-keep class com.google.android.gms.games.quest.** { *; } -keep class com.google.android.gms.nearby.** { *; } diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPlugin.txt.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt.meta similarity index 84% rename from Assets/Public/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPlugin.txt.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt.meta index 5932b27aa..a511a9780 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPlugin.txt.meta +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Proguard/games.txt.meta @@ -5,6 +5,3 @@ TextScriptImporter: userData: assetBundleName: assetBundleVariant: -labels: -- gvh -- gvh_manifest diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime.meta new file mode 100644 index 000000000..1b4e5aa47 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd0ac925755a93f468f9512314445211 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts.meta new file mode 100644 index 000000000..05a73186a --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 59e19e4181908444696b31ddc5d39242 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Player.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Player.cs deleted file mode 100644 index 094645f35..000000000 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Player.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright (C) 2014 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#if UNITY_ANDROID -namespace GooglePlayGames.BasicApi -{ - /// - /// Represents a player. A player is different from a participant! The participant is - /// an entity that takes part in a particular match; a Player is a real-world person - /// (tied to a Games account). The player exists across matches, the Participant - /// only exists in the context of a particular match. - /// - public class Player : PlayGamesUserProfile - { - internal Player(string displayName, string playerId, string avatarUrl) - : base(displayName, playerId, avatarUrl) - { - } - } -} -#endif diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/PlayerProfile.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/PlayerProfile.cs.meta new file mode 100644 index 000000000..7762f341a --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/PlayerProfile.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8b3a4a6424388914289809c499a7f304 \ No newline at end of file diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/RecallAccess.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/RecallAccess.cs.meta new file mode 100644 index 000000000..c15d7fa18 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/RecallAccess.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3efc78f4078ecbb4a9946525fbe40a3d \ No newline at end of file diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs deleted file mode 100644 index d6a65d680..000000000 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if UNITY_ANDROID -namespace GooglePlayGames -{ - /// - /// This file is automatically generated DO NOT EDIT! - /// - /// These are the constants defined in the Play Games Console for Game Services - /// Resources. - /// - /// - /// File containing information about the game. This is automatically updated by running the - /// platform-appropriate setup commands in the Unity editor (which does a simple search / replace - /// on the IDs in the form "__ID__"). We can check whether any particular field has been updated - /// by checking whether it still retains its initial value - we prevent the constants from being - /// replaced in the aforementioned search/replace by stripping off the leading and trailing "__". - /// - public static class GameInfo - { - private const string UnescapedApplicationId = "APP_ID"; - private const string UnescapedWebClientId = "WEB_CLIENTID"; - private const string UnescapedNearbyServiceId = "NEARBY_SERVICE_ID"; - - public const string ApplicationId = "__APP_ID__"; // Filled in automatically - public const string WebClientId = "__WEB_CLIENTID__"; // Filled in automatically - public const string NearbyConnectionServiceId = "__NEARBY_SERVICE_ID__"; - - - public static bool ApplicationIdInitialized() - { - return !string.IsNullOrEmpty(ApplicationId) && - !ApplicationId.Equals(ToEscapedToken(UnescapedApplicationId)); - } - - public static bool WebClientIdInitialized() - { - return !string.IsNullOrEmpty(WebClientId) && !WebClientId.Equals(ToEscapedToken(UnescapedWebClientId)); - } - - public static bool NearbyConnectionsInitialized() - { - return !string.IsNullOrEmpty(NearbyConnectionServiceId) && - !NearbyConnectionServiceId.Equals(ToEscapedToken(UnescapedNearbyServiceId)); - } - - /// - /// Returns an escaped token (i.e. one flanked with "__") for the passed token - /// - /// The escaped token. - /// The Token - private static string ToEscapedToken(string token) - { - return string.Format("__{0}__", token); - } - } -} -#endif //UNITY_ANDROID \ No newline at end of file diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs.meta deleted file mode 100644 index fd031ffb8..000000000 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a722d413080904cc1bd07f4db21e1af1 -timeCreated: 1435699550 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesUserProfile.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesUserProfile.cs index 62820e448..0bfe18291 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesUserProfile.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesUserProfile.cs @@ -19,9 +19,11 @@ namespace GooglePlayGames { using System; - using System.Collections; - using GooglePlayGames.OurUtils; + using UnityEngine; + + using GooglePlayGames.OurUtils; + #if UNITY_2017_2_OR_NEWER using UnityEngine.Networking; #endif @@ -42,18 +44,11 @@ public class PlayGamesUserProfile : IUserProfile private volatile bool mImageLoading = false; private Texture2D mImage; - internal PlayGamesUserProfile(string displayName, string playerId, - string avatarUrl) + internal PlayGamesUserProfile(string displayName, string playerId,string avatarUrl) : this(displayName,playerId,avatarUrl,false) { - mDisplayName = displayName; - mPlayerId = playerId; - setAvatarUrl(avatarUrl); - mImageLoading = false; - mIsFriend = false; } - internal PlayGamesUserProfile(string displayName, string playerId, string avatarUrl, - bool isFriend) + internal PlayGamesUserProfile(string displayName, string playerId, string avatarUrl,bool isFriend) { mDisplayName = displayName; mPlayerId = playerId; @@ -62,8 +57,7 @@ internal PlayGamesUserProfile(string displayName, string playerId, string avatar mIsFriend = isFriend; } - protected void ResetIdentity(string displayName, string playerId, - string avatarUrl) + protected void ResetIdentity(string displayName, string playerId,string avatarUrl) { mDisplayName = displayName; mPlayerId = playerId; @@ -112,7 +106,42 @@ public Texture2D image { OurUtils.Logger.d("Starting to load image: " + AvatarURL); mImageLoading = true; - PlayGamesHelperObject.RunCoroutine(LoadImage()); + + mImage = new Texture2D(96,96); + + using(var currentActivity = Android.AndroidHelperFragment.GetActivity()) + { + currentActivity.Call("runOnUiThread", new AndroidJavaRunnable(() => { + using(var currentActivity = Android.AndroidHelperFragment.GetActivity()) + using(var ImageManager = new AndroidJavaClass("com.google.android.gms.common.images.ImageManager")) + using(var imageManager = ImageManager.CallStatic("create",currentActivity)) + using(var Uri = new AndroidJavaClass("android.net.Uri")) + using(var uri = Uri.CallStatic("parse",AvatarURL)) + { + imageManager.Call("loadImage",new OnLoadImageListener((result) => { + PlayGamesHelperObject.RunOnGameThread(() => { + var (uri,drawable,isRequestedDrawable) = result; + + using(var CompressFormat = new AndroidJavaClass("android.graphics.Bitmap$CompressFormat")) + using(var format = CompressFormat.GetStatic("PNG")) + using(var outputStream = new AndroidJavaObject("java.io.ByteArrayOutputStream")) + using(var bitmap = drawable.Call("getBitmap")) + { + mImage.Reinitialize(bitmap.Call("getWidth"),bitmap.Call("getHeight")); + + bitmap.Call("compress",format,100,outputStream); + var data = outputStream.Call("toByteArray"); + + mImage.LoadImage(System.Runtime.InteropServices.MemoryMarshal.Cast(data).ToArray()); + } + + drawable?.Dispose(); + uri?.Dispose(); + }); + }),uri); + } + })); + } } return mImage; @@ -126,50 +155,17 @@ public string AvatarURL get { return mAvatarUrl; } } - /// - /// Loads the local user's image from the url. Loading urls - /// is asynchronous so the return from this call is fast, - /// the image is returned once it is loaded. null is returned - /// up to that point. - /// - internal IEnumerator LoadImage() + class OnLoadImageListener : AndroidJavaProxy { - // the url can be null if the user does not have an - // avatar configured. - if (!string.IsNullOrEmpty(AvatarURL)) + private Action<(AndroidJavaObject uri, AndroidJavaObject drawable, bool isRequestedDrawable)> mAction; + public OnLoadImageListener(Action<(AndroidJavaObject uri, AndroidJavaObject drawable, bool isRequestedDrawable)> action) : base("com.google.android.gms.common.images.ImageManager$OnImageLoadedListener") { -#if UNITY_2017_2_OR_NEWER - UnityWebRequest www = UnityWebRequestTexture.GetTexture(AvatarURL); - www.SendWebRequest(); -#else - WWW www = new WWW(AvatarURL); -#endif - while (!www.isDone) - { - yield return null; - } - - if (www.error == null) - { -#if UNITY_2017_2_OR_NEWER - this.mImage = DownloadHandlerTexture.GetContent(www); -#else - this.mImage = www.texture; -#endif - } - else - { - mImage = Texture2D.blackTexture; - OurUtils.Logger.e("Error downloading image: " + www.error); - } - - mImageLoading = false; + mAction = action; } - else + + public void onImageLoaded(AndroidJavaObject uri, AndroidJavaObject drawable, bool isRequestedDrawable) { - OurUtils.Logger.e("No URL found."); - mImage = Texture2D.blackTexture; - mImageLoading = false; + mAction((uri,drawable,isRequestedDrawable)); } } diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/PlatformUtils.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/PlatformUtils.cs index 5fce45bad..d87623457 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/PlatformUtils.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/PlatformUtils.cs @@ -41,8 +41,7 @@ public static bool Supported //if the app is installed, no errors. Else, doesn't get past next line try { - launchIntent = - packageManager.Call("getLaunchIntentForPackage", "com.google.android.play.games"); + launchIntent = packageManager.Call("getLaunchIntentForPackage", "com.google.android.play.games"); } catch (Exception) { diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidClient.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidClient.cs index a0c3ad35b..2eb70ef8f 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidClient.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidClient.cs @@ -37,12 +37,11 @@ private enum AuthState private readonly object GameServicesLock = new object(); private readonly object AuthStateLock = new object(); - private readonly static String PlayGamesSdkClassName = - "com.google.android.gms.games.PlayGamesSdk"; + private const string PlayGamesSdkClassName = "com.google.android.gms.games.PlayGamesSdk"; private volatile ISavedGameClient mSavedGameClient; private volatile IEventsClient mEventsClient; - private volatile Player mUser = null; + private volatile PlayGamesUserProfile mUser = null; private volatile AuthState mAuthState = AuthState.Unauthenticated; private IUserProfile[] mFriends = new IUserProfile[0]; private LoadFriendsStatus mLastLoadFriendsStatus = LoadFriendsStatus.Unknown; @@ -85,7 +84,7 @@ private void Authenticate(bool isAutoSignIn, Action callback) { // If the user is already authenticated, just fire the callback, we don't need // any additional work. - if (mAuthState == AuthState.Authenticated) + if (isAutoSignIn && mAuthState == AuthState.Authenticated) { OurUtils.Logger.d("Already authenticated."); InvokeCallbackOnGameThread(callback, SignInStatus.Success); @@ -97,85 +96,70 @@ private void Authenticate(bool isAutoSignIn, Action callback) OurUtils.Logger.d("Starting Auth using the method " + methodName); using (var client = getGamesSignInClient()) - using ( - var task = client.Call(methodName)) + using (var task = client.Call(methodName)) { - AndroidTaskUtils.AddOnSuccessListener(task, authenticationResult => - { + task.AddOnSuccessListener(authenticationResult => { bool isAuthenticated = authenticationResult.Call("isAuthenticated"); - SignInOnResult(isAuthenticated, callback); - }); + if (!isAuthenticated) + { + lock (AuthStateLock) + { + OurUtils.Logger.e("Not authenticated"); + callback(SignInStatus.Canceled); + return; + } + } - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + using (var client = getPlayersClient()) + using (client.Call("getCurrentPlayer").AddOnSuccessListener((AndroidJavaObject resultObject) => { + mUser = AndroidJavaConverter.ToPlayer(resultObject); + + lock (GameServicesLock) + { + mSavedGameClient = new AndroidSavedGameClient(this); + mEventsClient = new AndroidEventsClient(); + } + + mAuthState = AuthState.Authenticated; + InvokeCallbackOnGameThread(callback, SignInStatus.Success); + OurUtils.Logger.d("Authentication succeeded"); + LoadAchievements(ignore => { }); + }).AddOnFailureListener((exception) => { + OurUtils.Logger.e("GetCurrentPlayer failed - " + exception.Call("toString")); + callback(SignInStatus.InternalError); + }).AddOnCanceledListener(() => { + callback(SignInStatus.Canceled); + })); + }).AddOnFailureListener(exception => { OurUtils.Logger.e("Authentication failed - " + exception.Call("toString")); callback(SignInStatus.InternalError); + }).AddOnCanceledListener(() => { + callback(SignInStatus.Canceled); }); } } - private void SignInOnResult(bool isAuthenticated, Action callback) + static string appID = null; + public static string AppId { - if (isAuthenticated) + get { - using (var signInTasks = new AndroidJavaObject("java.util.ArrayList")) - { - AndroidJavaObject taskGetPlayer = - getPlayersClient().Call("getCurrentPlayer"); - signInTasks.Call("add", taskGetPlayer); + if(appID == null) + appID = AndroidHelperFragment.CallPackageMetaData("GET_META_DATA","getString","com.google.android.gms.games.APP_ID") ?? ""; - using (var tasks = new AndroidJavaClass(TasksClassName)) - using (var allTask = tasks.CallStatic("whenAll", signInTasks)) - { - AndroidTaskUtils.AddOnCompleteListener( - allTask, - completeTask => - { - if (completeTask.Call("isSuccessful")) - { - using (var resultObject = taskGetPlayer.Call("getResult")) - { - mUser = AndroidJavaConverter.ToPlayer(resultObject); - } - - lock (GameServicesLock) - { - mSavedGameClient = new AndroidSavedGameClient(this); - mEventsClient = new AndroidEventsClient(); - } - - mAuthState = AuthState.Authenticated; - InvokeCallbackOnGameThread(callback, SignInStatus.Success); - OurUtils.Logger.d("Authentication succeeded"); - LoadAchievements(ignore => { }); - } - else - { - if (completeTask.Call("isCanceled")) - { - InvokeCallbackOnGameThread(callback, SignInStatus.Canceled); - return; - } - - using (var exception = completeTask.Call("getException")) - { - OurUtils.Logger.e( - "Authentication failed - " + exception.Call("toString")); - InvokeCallbackOnGameThread(callback, SignInStatus.InternalError); - } - } - } - ); - } - } + return appID; } - else + } + + static string webClientId = null; + public static string WebClientId + { + get { - lock (AuthStateLock) - { - OurUtils.Logger.e("Returning an error code."); - InvokeCallbackOnGameThread(callback, SignInStatus.Canceled); - } + if(webClientId == null) + webClientId = AndroidHelperFragment.CallPackageMetaData("GET_META_DATA","getString","com.google.android.gms.games.WEB_CLIENT_ID") ?? ""; + + return webClientId; } } @@ -183,25 +167,14 @@ public void RequestServerSideAccess(bool forceRefreshToken, Action callb { callback = AsOnGameThreadCallback(callback); - if (!GameInfo.WebClientIdInitialized()) - { - throw new InvalidOperationException("Requesting server side access requires web " + - "client id to be configured."); - } + if (string.IsNullOrEmpty(WebClientId) || !WebClientId.StartsWith(AppId) || !WebClientId.EndsWith(".googleusercontent.com")) + throw new InvalidOperationException("Requesting server side access requires web client id to be configured."); using (var client = getGamesSignInClient()) - using (var task = client.Call("requestServerSideAccess", - GameInfo.WebClientId, forceRefreshToken)) + using (var task = client.Call("requestServerSideAccess", WebClientId, forceRefreshToken)) { - AndroidTaskUtils.AddOnSuccessListener( - task, - authCode => callback(authCode) - ); - - AndroidTaskUtils.AddOnFailureListener(task, exception => - { - OurUtils.Logger.e("Requesting server side access task failed - " + - exception.Call("toString")); + task.AddOnSuccessListener(authCode => callback(authCode)).AddOnFailureListener((exception) => { + OurUtils.Logger.e("Requesting server side access task failed - " + exception.Call("toString")); callback(null); }); } @@ -261,8 +234,7 @@ private static void InvokeCallbackOnGameThread(Action callback, T data) } - private static Action AsOnGameThreadCallback( - Action toInvokeOnGameThread) + private static Action AsOnGameThreadCallback(Action toInvokeOnGameThread) { return (result1, result2) => { @@ -298,11 +270,9 @@ public void LoadFriends(Action callback) LoadAllFriends(mFriendsMaxResults, /* forceReload= */ false, /* loadMore= */ false, callback); } - private void LoadAllFriends(int pageSize, bool forceReload, bool loadMore, - Action callback) + private void LoadAllFriends(int pageSize, bool forceReload, bool loadMore, Action callback) { - LoadFriendsPaginated(pageSize, loadMore, forceReload, result => - { + LoadFriendsPaginated(pageSize, loadMore, forceReload, result => { mLastLoadFriendsStatus = result; switch (result) { @@ -326,8 +296,7 @@ private void LoadAllFriends(int pageSize, bool forceReload, bool loadMore, }); } - public void LoadFriends(int pageSize, bool forceReload, - Action callback) + public void LoadFriends(int pageSize, bool forceReload, Action callback) { LoadFriendsPaginated(pageSize, /* isLoadMore= */ false, /* forceReload= */ forceReload, callback); @@ -339,34 +308,28 @@ public void LoadMoreFriends(int pageSize, Action callback) callback); } - private void LoadFriendsPaginated(int pageSize, bool isLoadMore, bool forceReload, - Action callback) + private void LoadFriendsPaginated(int pageSize, bool isLoadMore, bool forceReload, Action callback) { mFriendsResolutionException = null; using (var playersClient = getPlayersClient()) using (var task = isLoadMore ? playersClient.Call("loadMoreFriends", pageSize) - : playersClient.Call("loadFriends", pageSize, - forceReload)) + : playersClient.Call("loadFriends", pageSize, forceReload)) { - AndroidTaskUtils.AddOnSuccessListener( - task, annotatedData => + task.AddOnSuccessListener(annotatedData => { + using (var playersBuffer = annotatedData.Call("get")) { - using (var playersBuffer = annotatedData.Call("get")) - { - AndroidJavaObject metadata = playersBuffer.Call("getMetadata"); - var areMoreFriendsToLoad = metadata != null && - metadata.Call("getString", - "next_page_token") != null; - mFriends = AndroidJavaConverter.playersBufferToArray(playersBuffer); - mLastLoadFriendsStatus = areMoreFriendsToLoad - ? LoadFriendsStatus.LoadMore - : LoadFriendsStatus.Completed; - InvokeCallbackOnGameThread(callback, mLastLoadFriendsStatus); - } - }); - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + AndroidJavaObject metadata = playersBuffer.Call("getMetadata"); + var areMoreFriendsToLoad = metadata != null && + metadata.Call("getString", + "next_page_token") != null; + mFriends = AndroidJavaConverter.playersBufferToArray(playersBuffer); + mLastLoadFriendsStatus = areMoreFriendsToLoad + ? LoadFriendsStatus.LoadMore + : LoadFriendsStatus.Completed; + InvokeCallbackOnGameThread(callback, mLastLoadFriendsStatus); + } + }).AddOnFailureListener(exception => { AndroidHelperFragment.IsResolutionRequired(exception, resolutionRequired => { if (resolutionRequired) @@ -393,8 +356,7 @@ private void LoadFriendsPaginated(int pageSize, bool isLoadMore, bool forceReloa } mLastLoadFriendsStatus = LoadFriendsStatus.InternalError; - OurUtils.Logger.e("LoadFriends failed: " + - exception.Call("toString")); + OurUtils.Logger.e("LoadFriends failed: " + exception.Call("toString")); InvokeCallbackOnGameThread(callback, LoadFriendsStatus.InternalError); } }); @@ -404,8 +366,7 @@ private void LoadFriendsPaginated(int pageSize, bool isLoadMore, bool forceReloa } private static bool IsApiException(AndroidJavaObject exception) { - var exceptionClassName = exception.Call("getClass") - .Call("getName"); + var exceptionClassName = exception.Call("getClass").Call("getName"); return exceptionClassName == "com.google.android.gms.common.api.ApiException"; } @@ -422,14 +383,11 @@ public void AskForLoadFriendsResolution(Action callback) "list but there is no intent to trigger the UI. This may be because the user " + "has granted access already or the game has not called loadFriends() before."); using (var playersClient = getPlayersClient()) - using ( - var task = playersClient.Call("loadFriends", /* pageSize= */ 1, - /* forceReload= */ false)) + using (var task = playersClient.Call("loadFriends", /* pageSize= */ 1, /* forceReload= */ false)) { - AndroidTaskUtils.AddOnSuccessListener( - task, annotatedData => { InvokeCallbackOnGameThread(callback, UIStatus.Valid); }); - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + task.AddOnSuccessListener(annotatedData => { + InvokeCallbackOnGameThread(callback, UIStatus.Valid); + }).AddOnFailureListener(exception => { AndroidHelperFragment.IsResolutionRequired(exception, resolutionRequired => { if (resolutionRequired) @@ -452,8 +410,7 @@ public void AskForLoadFriendsResolution(Action callback) } } - OurUtils.Logger.e("LoadFriends failed: " + - exception.Call("toString")); + OurUtils.Logger.e("LoadFriends failed: " + exception.Call("toString")); InvokeCallbackOnGameThread(callback, UIStatus.InternalError); }); }); @@ -461,8 +418,7 @@ public void AskForLoadFriendsResolution(Action callback) } else { - AndroidHelperFragment.AskForLoadFriendsResolution(mFriendsResolutionException, - AsOnGameThreadCallback(callback)); + AndroidHelperFragment.AskForLoadFriendsResolution(mFriendsResolutionException,AsOnGameThreadCallback(callback)); } } @@ -476,15 +432,12 @@ public void ShowCompareProfileWithAlternativeNameHintsUI(string playerId, AsOnGameThreadCallback(callback)); } - public void GetFriendsListVisibility(bool forceReload, - Action callback) + public void GetFriendsListVisibility(bool forceReload, Action callback) { using (var playersClient = getPlayersClient()) - using ( - var task = playersClient.Call("getCurrentPlayer", forceReload)) + using (var task = playersClient.Call("getCurrentPlayer", forceReload)) { - AndroidTaskUtils.AddOnSuccessListener(task, annotatedData => - { + task.AddOnSuccessListener(annotatedData => { AndroidJavaObject currentPlayerInfo = annotatedData.Call("get").Call( "getCurrentPlayerInfo"); @@ -492,11 +445,8 @@ public void GetFriendsListVisibility(bool forceReload, currentPlayerInfo.Call("getFriendsListVisibilityStatus"); InvokeCallbackOnGameThread(callback, AndroidJavaConverter.ToFriendsListVisibilityStatus(playerListVisibility)); - }); - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + }).AddOnFailureListener(exception => { InvokeCallbackOnGameThread(callback, FriendsListVisibilityStatus.NetworkError); - return; }); } } @@ -541,41 +491,35 @@ public void GetPlayerStats(Action callback) using (var playerStatsClient = getPlayerStatsClient()) using (var task = playerStatsClient.Call("loadPlayerStats", /* forceReload= */ false)) { - AndroidTaskUtils.AddOnSuccessListener( - task, - annotatedData => + task.AddOnSuccessListener(annotatedData => { + using (var playerStatsJava = annotatedData.Call("get")) { - using (var playerStatsJava = annotatedData.Call("get")) - { - int numberOfPurchases = playerStatsJava.Call("getNumberOfPurchases"); - float avgSessionLength = playerStatsJava.Call("getAverageSessionLength"); - int daysSinceLastPlayed = playerStatsJava.Call("getDaysSinceLastPlayed"); - int numberOfSessions = playerStatsJava.Call("getNumberOfSessions"); - float sessionPercentile = playerStatsJava.Call("getSessionPercentile"); - float spendPercentile = playerStatsJava.Call("getSpendPercentile"); - float spendProbability = playerStatsJava.Call("getSpendProbability"); - float churnProbability = playerStatsJava.Call("getChurnProbability"); - float highSpenderProbability = playerStatsJava.Call("getHighSpenderProbability"); - float totalSpendNext28Days = playerStatsJava.Call("getTotalSpendNext28Days"); - - PlayerStats result = new PlayerStats( - numberOfPurchases, - avgSessionLength, - daysSinceLastPlayed, - numberOfSessions, - sessionPercentile, - spendPercentile, - spendProbability, - churnProbability, - highSpenderProbability, - totalSpendNext28Days); - - InvokeCallbackOnGameThread(callback, CommonStatusCodes.Success, result); - } - }); - - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + int numberOfPurchases = playerStatsJava.Call("getNumberOfPurchases"); + float avgSessionLength = playerStatsJava.Call("getAverageSessionLength"); + int daysSinceLastPlayed = playerStatsJava.Call("getDaysSinceLastPlayed"); + int numberOfSessions = playerStatsJava.Call("getNumberOfSessions"); + float sessionPercentile = playerStatsJava.Call("getSessionPercentile"); + float spendPercentile = playerStatsJava.Call("getSpendPercentile"); + float spendProbability = playerStatsJava.Call("getSpendProbability"); + float churnProbability = playerStatsJava.Call("getChurnProbability"); + float highSpenderProbability = playerStatsJava.Call("getHighSpenderProbability"); + float totalSpendNext28Days = playerStatsJava.Call("getTotalSpendNext28Days"); + + PlayerStats result = new PlayerStats( + numberOfPurchases, + avgSessionLength, + daysSinceLastPlayed, + numberOfSessions, + sessionPercentile, + spendPercentile, + spendProbability, + churnProbability, + highSpenderProbability, + totalSpendNext28Days); + + InvokeCallbackOnGameThread(callback, CommonStatusCodes.Success, result); + } + }).AddOnFailureListener(exception => { OurUtils.Logger.e("GetPlayerStats failed: " + exception.Call("toString")); var statusCode = IsAuthenticated() ? CommonStatusCodes.InternalError @@ -603,35 +547,29 @@ public void LoadUsers(string[] userIds, Action callback) { using (var task = playersClient.Call("loadPlayer", userIds[i])) { - AndroidTaskUtils.AddOnSuccessListener( - task, - annotatedData => + task.AddOnSuccessListener(annotatedData => { + using (var player = annotatedData.Call("get")) { - using (var player = annotatedData.Call("get")) + string playerId = player.Call("getPlayerId"); + for (int j = 0; j < count; ++j) { - string playerId = player.Call("getPlayerId"); - for (int j = 0; j < count; ++j) + if (playerId == userIds[j]) { - if (playerId == userIds[j]) - { - users[j] = AndroidJavaConverter.ToPlayer(player); - break; - } + users[j] = AndroidJavaConverter.ToPlayer(player); + break; } + } - lock (countLock) + lock (countLock) + { + ++resultCount; + if (resultCount == count) { - ++resultCount; - if (resultCount == count) - { - InvokeCallbackOnGameThread(callback, users); - } + InvokeCallbackOnGameThread(callback, users); } } - }); - - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + } + }).AddOnFailureListener(exception => { OurUtils.Logger.e("LoadUsers failed for index " + i + " with: " + exception.Call("toString")); lock (countLock) @@ -653,52 +591,46 @@ public void LoadAchievements(Action callback) using (var achievementsClient = getAchievementsClient()) using (var task = achievementsClient.Call("load", /* forceReload= */ false)) { - AndroidTaskUtils.AddOnSuccessListener( - task, - annotatedData => + task.AddOnSuccessListener(annotatedData => { + using (var achievementBuffer = annotatedData.Call("get")) { - using (var achievementBuffer = annotatedData.Call("get")) + int count = achievementBuffer.Call("getCount"); + Achievement[] result = new Achievement[count]; + for (int i = 0; i < count; ++i) { - int count = achievementBuffer.Call("getCount"); - Achievement[] result = new Achievement[count]; - for (int i = 0; i < count; ++i) + Achievement achievement = new Achievement(); + using (var javaAchievement = achievementBuffer.Call("get", i)) { - Achievement achievement = new Achievement(); - using (var javaAchievement = achievementBuffer.Call("get", i)) + achievement.Id = javaAchievement.Call("getAchievementId"); + achievement.Description = javaAchievement.Call("getDescription"); + achievement.Name = javaAchievement.Call("getName"); + achievement.Points = javaAchievement.Call("getXpValue"); + + long timestamp = javaAchievement.Call("getLastUpdatedTimestamp"); + achievement.LastModifiedTime = AndroidJavaConverter.ToDateTime(timestamp); + + achievement.RevealedImageUrl = javaAchievement.Call("getRevealedImageUrl"); + achievement.UnlockedImageUrl = javaAchievement.Call("getUnlockedImageUrl"); + achievement.IsIncremental = + javaAchievement.Call("getType") == 1 /* TYPE_INCREMENTAL */; + if (achievement.IsIncremental) { - achievement.Id = javaAchievement.Call("getAchievementId"); - achievement.Description = javaAchievement.Call("getDescription"); - achievement.Name = javaAchievement.Call("getName"); - achievement.Points = javaAchievement.Call("getXpValue"); - - long timestamp = javaAchievement.Call("getLastUpdatedTimestamp"); - achievement.LastModifiedTime = AndroidJavaConverter.ToDateTime(timestamp); - - achievement.RevealedImageUrl = javaAchievement.Call("getRevealedImageUrl"); - achievement.UnlockedImageUrl = javaAchievement.Call("getUnlockedImageUrl"); - achievement.IsIncremental = - javaAchievement.Call("getType") == 1 /* TYPE_INCREMENTAL */; - if (achievement.IsIncremental) - { - achievement.CurrentSteps = javaAchievement.Call("getCurrentSteps"); - achievement.TotalSteps = javaAchievement.Call("getTotalSteps"); - } - - int state = javaAchievement.Call("getState"); - achievement.IsUnlocked = state == 0 /* STATE_UNLOCKED */; - achievement.IsRevealed = state == 1 /* STATE_REVEALED */; + achievement.CurrentSteps = javaAchievement.Call("getCurrentSteps"); + achievement.TotalSteps = javaAchievement.Call("getTotalSteps"); } - result[i] = achievement; + int state = javaAchievement.Call("getState"); + achievement.IsUnlocked = state == 0 /* STATE_UNLOCKED */; + achievement.IsRevealed = state == 1 /* STATE_REVEALED */; } - achievementBuffer.Call("release"); - InvokeCallbackOnGameThread(callback, result); + result[i] = achievement; } - }); - AndroidTaskUtils.AddOnFailureListener(task, exception => - { + achievementBuffer.Call("release"); + InvokeCallbackOnGameThread(callback, result); + } + }).AddOnFailureListener(exception => { OurUtils.Logger.e("LoadAchievements failed: " + exception.Call("toString")); InvokeCallbackOnGameThread(callback, new Achievement[0]); }); @@ -806,90 +738,67 @@ public void LoadScores(string leaderboardId, LeaderboardStart start, Action callback) { using (var client = getLeaderboardsClient()) - { - string loadScoresMethod = - start == LeaderboardStart.TopScores ? "loadTopScores" : "loadPlayerCenteredScores"; - using (var task = client.Call( - loadScoresMethod, - leaderboardId, - AndroidJavaConverter.ToLeaderboardVariantTimeSpan(timeSpan), - AndroidJavaConverter.ToLeaderboardVariantCollection(collection), - rowCount)) - { - AndroidTaskUtils.AddOnSuccessListener( - task, - annotatedData => - { - using (var leaderboardScores = annotatedData.Call("get")) - { - InvokeCallbackOnGameThread(callback, CreateLeaderboardScoreData( - leaderboardId, - collection, - timeSpan, - annotatedData.Call("isStale") - ? ResponseStatus.SuccessWithStale - : ResponseStatus.Success, - leaderboardScores)); - leaderboardScores.Call("release"); - } - }); - - AndroidTaskUtils.AddOnFailureListener(task, exception => + using (var task = client.Call( + start == LeaderboardStart.TopScores ? "loadTopScores" : "loadPlayerCenteredScores", + leaderboardId, + AndroidJavaConverter.ToLeaderboardVariantTimeSpan(timeSpan), + AndroidJavaConverter.ToLeaderboardVariantCollection(collection), + rowCount)) + { + task.AddOnSuccessListener(annotatedData => { + using (var leaderboardScores = annotatedData.Call("get")) { - AndroidHelperFragment.IsResolutionRequired( - exception, resolutionRequired => - { - if (resolutionRequired) - { - mFriendsResolutionException = exception.Call( - "getResolution"); - InvokeCallbackOnGameThread( - callback, new LeaderboardScoreData(leaderboardId, - ResponseStatus.ResolutionRequired)); - } - else - { - mFriendsResolutionException = null; - } - }); - OurUtils.Logger.e("LoadScores failed: " + exception.Call("toString")); - InvokeCallbackOnGameThread( - callback, new LeaderboardScoreData(leaderboardId, - ResponseStatus.InternalError)); + InvokeCallbackOnGameThread(callback, CreateLeaderboardScoreData( + leaderboardId, + collection, + timeSpan, + annotatedData.Call("isStale") + ? ResponseStatus.SuccessWithStale + : ResponseStatus.Success, + leaderboardScores)); + leaderboardScores.Call("release"); + } + }).AddOnFailureListener(exception => { + AndroidHelperFragment.IsResolutionRequired(exception, resolutionRequired => { + if (resolutionRequired) + { + mFriendsResolutionException = exception.Call("getResolution"); + InvokeCallbackOnGameThread( + callback, new LeaderboardScoreData(leaderboardId,ResponseStatus.ResolutionRequired)); + } + else + { + mFriendsResolutionException = null; + } }); - } + + OurUtils.Logger.e("LoadScores failed: " + exception.Call("toString")); + InvokeCallbackOnGameThread(callback, new LeaderboardScoreData(leaderboardId,ResponseStatus.InternalError)); + }); } } - public void LoadMoreScores(ScorePageToken token, int rowCount, - Action callback) + public void LoadMoreScores(ScorePageToken token, int rowCount, Action callback) { using (var client = getLeaderboardsClient()) using (var task = client.Call("loadMoreScores", token.InternalObject, rowCount, AndroidJavaConverter.ToPageDirection(token.Direction))) { - AndroidTaskUtils.AddOnSuccessListener( - task, - annotatedData => - { - using (var leaderboardScores = annotatedData.Call("get")) - { - InvokeCallbackOnGameThread(callback, CreateLeaderboardScoreData( - token.LeaderboardId, - token.Collection, - token.TimeSpan, - annotatedData.Call("isStale") - ? ResponseStatus.SuccessWithStale - : ResponseStatus.Success, - leaderboardScores)); - leaderboardScores.Call("release"); - } - }); - - AndroidTaskUtils.AddOnFailureListener(task, exception => - { - AndroidHelperFragment.IsResolutionRequired(exception, resolutionRequired => + task.AddOnSuccessListener(annotatedData => { + using (var leaderboardScores = annotatedData.Call("get")) { + InvokeCallbackOnGameThread(callback, CreateLeaderboardScoreData( + token.LeaderboardId, + token.Collection, + token.TimeSpan, + annotatedData.Call("isStale") + ? ResponseStatus.SuccessWithStale + : ResponseStatus.Success, + leaderboardScores)); + leaderboardScores.Call("release"); + } + }).AddOnFailureListener(exception => { + AndroidHelperFragment.IsResolutionRequired(exception, resolutionRequired => { if (resolutionRequired) { mFriendsResolutionException = @@ -983,8 +892,7 @@ public void SubmitScore(string leaderboardId, long score, Action callback) } } - public void SubmitScore(string leaderboardId, long score, string metadata, - Action callback) + public void SubmitScore(string leaderboardId, long score, string metadata, Action callback) { if (!IsAuthenticated()) { diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidHelperFragment.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidHelperFragment.cs index 4b770e14d..6cf561091 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidHelperFragment.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidHelperFragment.cs @@ -17,14 +17,14 @@ #if UNITY_ANDROID namespace GooglePlayGames.Android { + using System; + + using UnityEngine; + using GooglePlayGames.BasicApi; using GooglePlayGames.BasicApi.SavedGame; - using OurUtils; - using UnityEngine; - using System; - using System.Collections.Generic; - internal class AndroidHelperFragment + internal static class AndroidHelperFragment { private const string HelperFragmentClass = "com.google.games.bridge.HelperFragment"; @@ -36,6 +36,26 @@ public static AndroidJavaObject GetActivity() } } + public static int PackageManagerFlag(string flagName) + { + using(var PackageManager = new AndroidJavaClass("android.content.pm.PackageManager")) + return PackageManager.GetStatic(flagName); + } + + public static T CallPackageMetaData(string flagName,string methodName, params object[] args) + { + return CallPackageMetaData(PackageManagerFlag(flagName),methodName,args); + } + + public static T CallPackageMetaData(int applicationInfoFlags,string methodName, params object[] args) + { + using (var activity = GetActivity()) + using (var pm = activity.Call("getPackageManager")) + using (var appInfo = pm.Call("getApplicationInfo", activity.Call("getPackageName"), applicationInfoFlags)) + using (var bundle = appInfo.Get("metaData")) + return bundle.Call(methodName,args); + } + public static AndroidJavaObject GetDefaultPopupView() { using (var helperFragment = new AndroidJavaClass(HelperFragmentClass)) diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidJavaConverter.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidJavaConverter.cs index f4bd0674f..7f94157cb 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidJavaConverter.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidJavaConverter.cs @@ -75,7 +75,7 @@ internal static int ToPageDirection(ScorePageDirection direction) } } - internal static Player ToPlayer(AndroidJavaObject player) + internal static PlayGamesUserProfile ToPlayer(AndroidJavaObject player) { if (player == null) { @@ -84,8 +84,8 @@ internal static Player ToPlayer(AndroidJavaObject player) string displayName = player.Call("getDisplayName"); string playerId = player.Call("getPlayerId"); - string avatarUrl = player.Call("getIconImageUrl"); - return new Player(displayName, playerId, avatarUrl); + string avatarUrl = player.Call("getIconImageUri").Call("toString"); + return new PlayGamesUserProfile(displayName, playerId, avatarUrl); } internal static PlayerProfile ToPlayerProfile(AndroidJavaObject player) { @@ -93,12 +93,10 @@ internal static PlayerProfile ToPlayerProfile(AndroidJavaObject player) { return null; } - string displayName = player.Call("getDisplayName"); - string playerId = player.Call("getPlayerId"); - string avatarUrl = player.Call("getIconImageUrl"); - bool isFriend = - player.Call("getRelationshipInfo").Call("getFriendStatus") == - 4 /* PlayerFriendStatus.Friend*/; + string displayName = player.Call("getDisplayName"); + string playerId = player.Call("getPlayerId"); + string avatarUrl = player.Call("getIconImageUri").Call("toString"); + bool isFriend = player.Call("getRelationshipInfo").Call("getFriendStatus") == 4 /* PlayerFriendStatus.Friend*/; return new PlayerProfile(displayName, playerId, avatarUrl, isFriend); } diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidNearbyConnectionClient.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidNearbyConnectionClient.cs index 654488cbc..e757f9243 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidNearbyConnectionClient.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidNearbyConnectionClient.cs @@ -24,8 +24,7 @@ public AndroidNearbyConnectionClient() NearbyHelperObject.CreateObject(this); using (var nearbyClass = new AndroidJavaClass("com.google.android.gms.nearby.Nearby")) { - mClient = nearbyClass.CallStatic("getConnectionsClient", - AndroidHelperFragment.GetActivity()); + mClient = nearbyClass.CallStatic("getConnectionsClient",AndroidHelperFragment.GetActivity()); } } @@ -292,12 +291,10 @@ public void onDisconnected(string endpointId) private AndroidJavaObject CreateDiscoveryOptions() { - using (var strategy = - new AndroidJavaClass("com.google.android.gms.nearby.connection.Strategy").GetStatic( - "P2P_CLUSTER")) - using (var builder = - new AndroidJavaObject("com.google.android.gms.nearby.connection.DiscoveryOptions$Builder")) - using (builder.Call("setStrategy", strategy)) + using (var builder = new AndroidJavaObject("com.google.android.gms.nearby.connection.DiscoveryOptions$Builder")) + using (var strategy = new AndroidJavaClass("com.google.android.gms.nearby.connection.Strategy")) + using (var flag = strategy.GetStatic("P2P_CLUSTER")) + using (builder.Call("setStrategy", flag)) { return builder.Call("build"); } @@ -413,20 +410,9 @@ public string GetServiceId() private static string ReadServiceId() { - using (var activity = AndroidHelperFragment.GetActivity()) - { - string packageName = activity.Call("getPackageName"); - using (var pm = activity.Call("getPackageManager")) - using (var appInfo = - pm.Call("getApplicationInfo", packageName, ApplicationInfoFlags)) - using (var bundle = appInfo.Get("metaData")) - { - string sysId = bundle.Call("getString", - "com.google.android.gms.nearby.connection.SERVICE_ID"); - OurUtils.Logger.d("SystemId from Manifest: " + sysId); - return sysId; - } - } + var sysId = AndroidHelperFragment.CallPackageMetaData(ApplicationInfoFlags,"getString","com.google.android.gms.nearby.connection.SERVICE_ID"); + OurUtils.Logger.d("SystemId from Manifest: " + sysId); + return sysId; } private static Action ToOnGameThread(Action toConvert) diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidTaskUtils.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidTaskUtils.cs index 4740cae82..8313442fd 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidTaskUtils.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidTaskUtils.cs @@ -6,32 +6,37 @@ namespace GooglePlayGames.Android using UnityEngine; using System; - class AndroidTaskUtils + static class AndroidTaskUtils { - private AndroidTaskUtils() + /** self */ + public static AndroidJavaObject AddOnCanceledListener(this AndroidJavaObject task, Action callback) { + using (task.Call("addOnCanceledListener",new TaskOnCanceledProxy(callback))) ; + return task; } - public static void AddOnSuccessListener(AndroidJavaObject task, Action callback) - { - using (task.Call("addOnSuccessListener", - new TaskOnSuccessProxy(callback, /* disposeResult= */ true))) ; - } + /** self */ + public static AndroidJavaObject AddOnSuccessListener(this AndroidJavaObject task, Action callback) => task.AddOnSuccessListener(true,callback); - public static void AddOnSuccessListener(AndroidJavaObject task, bool disposeResult, Action callback) + /** self */ + public static AndroidJavaObject AddOnSuccessListener(this AndroidJavaObject task, bool disposeResult, Action callback) { - using (task.Call("addOnSuccessListener", - new TaskOnSuccessProxy(callback, disposeResult))) ; + using (task.Call("addOnSuccessListener",new TaskOnSuccessProxy(callback, disposeResult))) ; + return task; } - public static void AddOnFailureListener(AndroidJavaObject task, Action callback) + /** self */ + public static AndroidJavaObject AddOnFailureListener(this AndroidJavaObject task, Action callback) { using (task.Call("addOnFailureListener", new TaskOnFailedProxy(callback))) ; + return task; } - public static void AddOnCompleteListener(AndroidJavaObject task, Action callback) + /** self */ + public static AndroidJavaObject AddOnCompleteListener(this AndroidJavaObject task, Action callback) { using (task.Call("addOnCompleteListener", new TaskOnCompleteProxy(callback))) ; + return task; } private class TaskOnCompleteProxy : AndroidJavaProxy @@ -65,8 +70,7 @@ private class TaskOnSuccessProxy : AndroidJavaProxy private Action mCallback; private bool mDisposeResult; - public TaskOnSuccessProxy(Action callback, bool disposeResult) - : base("com/google/android/gms/tasks/OnSuccessListener") + public TaskOnSuccessProxy(Action callback, bool disposeResult) : base("com/google/android/gms/tasks/OnSuccessListener") { mCallback = callback; mDisposeResult = disposeResult; @@ -92,8 +96,7 @@ private class TaskOnFailedProxy : AndroidJavaProxy { private Action mCallback; - public TaskOnFailedProxy(Action callback) - : base("com/google/android/gms/tasks/OnFailureListener") + public TaskOnFailedProxy(Action callback) : base("com/google/android/gms/tasks/OnFailureListener") { mCallback = callback; } @@ -106,6 +109,21 @@ public void onFailure(AndroidJavaObject exception) } } } + + private class TaskOnCanceledProxy : AndroidJavaProxy + { + private Action mCallback; + + public TaskOnCanceledProxy(Action callback) : base("com/google/android/gms/tasks/OnCanceledListener") + { + mCallback = callback; + } + + public void onCanceled() + { + mCallback(); + } + } } } #endif diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/PluginVersion.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/PluginVersion.cs index eaf682090..eb8d263ce 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/PluginVersion.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/PluginVersion.cs @@ -20,7 +20,7 @@ public class PluginVersion { // Current Version. public const int VersionInt = 0x01101; - public const string VersionString = "0.11.01"; + public const string VersionString = "0.11.1"; public const string VersionKey = "01101" ; } } diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android.meta new file mode 100644 index 000000000..b9a154356 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6bfcb1d6916d78f4583bdabd39381fd8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport.meta new file mode 100644 index 000000000..ef82bfd68 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8147152d9e5fe61419dd1f53c0458f44 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com.meta new file mode 100644 index 000000000..517db5a41 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b95c8473e1ebc164d9cd15a329252e20 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google.meta new file mode 100644 index 000000000..2ca1583cb --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 85ca6e6e94af9dc42b7b37d6503c01ef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games.meta new file mode 100644 index 000000000..6a92e9f96 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 70869f98832921b4dafd66fbb553b3c9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge.meta new file mode 100644 index 000000000..43174dc60 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 432674a00b61dc24bb763d81e289af52 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/AchievementUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AchievementUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/AchievementUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AchievementUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AchievementUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AchievementUiRequest.java.meta new file mode 100644 index 000000000..6b6204dff --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AchievementUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 38b00d1abfee17342b65128e3e2f4b2b \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/AllLeaderboardsUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AllLeaderboardsUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/AllLeaderboardsUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AllLeaderboardsUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AllLeaderboardsUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AllLeaderboardsUiRequest.java.meta new file mode 100644 index 000000000..51db88c23 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/AllLeaderboardsUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 99094e102809adb469b0fc4926e8cea3 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CommonUIStatus.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CommonUIStatus.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CommonUIStatus.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CommonUIStatus.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CommonUIStatus.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CommonUIStatus.java.meta new file mode 100644 index 000000000..0ec7da48c --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CommonUIStatus.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 7b5ddbaf6cadf00488e4fa278947e79c \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CompareProfileUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CompareProfileUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/CompareProfileUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CompareProfileUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CompareProfileUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CompareProfileUiRequest.java.meta new file mode 100644 index 000000000..3d19c710e --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/CompareProfileUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 4c535fafd50bfdc4e983fa9b875d8ca1 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java.meta new file mode 100644 index 000000000..65c1140ee --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/ConnectionLifecycleCallbackProxy.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2c298016396142e44b342cca809971c9 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java.meta new file mode 100644 index 000000000..165a3156b --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/EndpointDiscoveryCallbackProxy.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8eb2e3dc383e1d646bc3ce5578d2391a \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/GenericResolutionActivity.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionActivity.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/GenericResolutionActivity.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionActivity.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionActivity.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionActivity.java.meta new file mode 100644 index 000000000..1b15ba610 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionActivity.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 731e40efbdc9a7148a76357b9f149c2b \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/GenericResolutionUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/GenericResolutionUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionUiRequest.java.meta new file mode 100644 index 000000000..fa6a994f4 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/GenericResolutionUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 56580c8edb194d4469e097a661b0bb74 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/HelperFragment.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/HelperFragment.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/HelperFragment.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/HelperFragment.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/HelperFragment.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/HelperFragment.java.meta new file mode 100644 index 000000000..2c7b36f55 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/HelperFragment.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9389a2c4400794a4fbc9577c272735cf \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/LeaderboardUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/LeaderboardUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/LeaderboardUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/LeaderboardUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/LeaderboardUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/LeaderboardUiRequest.java.meta new file mode 100644 index 000000000..4fc77cc6b --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/LeaderboardUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ccd37b133b1dfd44f81e6d5e3938ffab \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/NativeBridgeActivity.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/NativeBridgeActivity.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/NativeBridgeActivity.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/NativeBridgeActivity.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/NativeBridgeActivity.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/NativeBridgeActivity.java.meta new file mode 100644 index 000000000..639c6993b --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/NativeBridgeActivity.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e466d6408a655594796e1f9ad1453ad0 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/PayloadCallbackProxy.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/PayloadCallbackProxy.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/PayloadCallbackProxy.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/PayloadCallbackProxy.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/PayloadCallbackProxy.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/PayloadCallbackProxy.java.meta new file mode 100644 index 000000000..4a83a5f21 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/PayloadCallbackProxy.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 79a3ebea938b5314b9dd3a977f4f5aaf \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/SelectSnapshotUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SelectSnapshotUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/SelectSnapshotUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SelectSnapshotUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SelectSnapshotUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SelectSnapshotUiRequest.java.meta new file mode 100644 index 000000000..24a5c91ea --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SelectSnapshotUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 037d0990822597c43be7c4fa0d493484 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/SimpleUiRequest.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SimpleUiRequest.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/SimpleUiRequest.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SimpleUiRequest.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SimpleUiRequest.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SimpleUiRequest.java.meta new file mode 100644 index 000000000..cb01c79a4 --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/SimpleUiRequest.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 243a99c032e213a4fa9f8e2a818cec71 \ No newline at end of file diff --git a/SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/Utils.java b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/Utils.java similarity index 100% rename from SupportFiles/Public/PlayGamesPluginSupport/src/main/java/com/google/games/bridge/Utils.java rename to Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/Utils.java diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/Utils.java.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/Utils.java.meta new file mode 100644 index 000000000..678a83f1b --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Runtime/Scripts/Plugins/Android/PlayGamesPluginSupport/com/google/games/bridge/Utils.java.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3a959daa9a4301142b9d127e3cb49b7e \ No newline at end of file diff --git a/Samples/SmokeTest/Scenes/TestScene.unity b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scenes/TestScene.unity similarity index 100% rename from Samples/SmokeTest/Scenes/TestScene.unity rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scenes/TestScene.unity diff --git a/Samples/SmokeTest/Scenes/TestScene.unity.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scenes/TestScene.unity.meta similarity index 100% rename from Samples/SmokeTest/Scenes/TestScene.unity.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scenes/TestScene.unity.meta diff --git a/Samples/SmokeTest/Scripts/AchievementGUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AchievementGUI.cs similarity index 100% rename from Samples/SmokeTest/Scripts/AchievementGUI.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AchievementGUI.cs diff --git a/Samples/SmokeTest/Scripts/AchievementGUI.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AchievementGUI.cs.meta similarity index 100% rename from Samples/SmokeTest/Scripts/AchievementGUI.cs.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AchievementGUI.cs.meta diff --git a/Samples/SmokeTest/Scripts/AssemblyInfo.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AssemblyInfo.cs similarity index 100% rename from Samples/SmokeTest/Scripts/AssemblyInfo.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AssemblyInfo.cs diff --git a/Samples/SmokeTest/Scripts/AssemblyInfo.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AssemblyInfo.cs.meta similarity index 100% rename from Samples/SmokeTest/Scripts/AssemblyInfo.cs.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/AssemblyInfo.cs.meta diff --git a/Samples/SmokeTest/Scripts/FriendsGUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/FriendsGUI.cs similarity index 100% rename from Samples/SmokeTest/Scripts/FriendsGUI.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/FriendsGUI.cs diff --git a/Samples/SmokeTest/Scripts/GPGSIds.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/GPGSIds.cs similarity index 100% rename from Samples/SmokeTest/Scripts/GPGSIds.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/GPGSIds.cs diff --git a/Samples/SmokeTest/Scripts/GPGSIds.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/GPGSIds.cs.meta similarity index 100% rename from Samples/SmokeTest/Scripts/GPGSIds.cs.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/GPGSIds.cs.meta diff --git a/Samples/SmokeTest/Scripts/LeaderboardGUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/LeaderboardGUI.cs similarity index 100% rename from Samples/SmokeTest/Scripts/LeaderboardGUI.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/LeaderboardGUI.cs diff --git a/Samples/SmokeTest/Scripts/LeaderboardGUI.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/LeaderboardGUI.cs.meta similarity index 100% rename from Samples/SmokeTest/Scripts/LeaderboardGUI.cs.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/LeaderboardGUI.cs.meta diff --git a/Samples/SmokeTest/Scripts/MainGui.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MainGui.cs similarity index 100% rename from Samples/SmokeTest/Scripts/MainGui.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MainGui.cs diff --git a/Samples/SmokeTest/Scripts/MainGui.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MainGui.cs.meta similarity index 100% rename from Samples/SmokeTest/Scripts/MainGui.cs.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MainGui.cs.meta diff --git a/Samples/SmokeTest/Scripts/MyGUISkin.guiskin b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MyGUISkin.guiskin similarity index 100% rename from Samples/SmokeTest/Scripts/MyGUISkin.guiskin rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MyGUISkin.guiskin diff --git a/Samples/SmokeTest/Scripts/MyGUISkin.guiskin.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MyGUISkin.guiskin.meta similarity index 100% rename from Samples/SmokeTest/Scripts/MyGUISkin.guiskin.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/MyGUISkin.guiskin.meta diff --git a/Samples/SmokeTest/Scripts/NearbyGUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/NearbyGUI.cs similarity index 99% rename from Samples/SmokeTest/Scripts/NearbyGUI.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/NearbyGUI.cs index 8f9f6ca4f..f5abc80ee 100644 --- a/Samples/SmokeTest/Scripts/NearbyGUI.cs +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/NearbyGUI.cs @@ -21,7 +21,7 @@ namespace SmokeTest using GooglePlayGames; using GooglePlayGames.BasicApi.Nearby; using UnityEngine; -#if UNITY_ANDROID && UNITY_2019 +#if UNITY_ANDROID && UNITY_2018_3_OR_NEWER using UnityEngine.Android; #endif @@ -72,7 +72,7 @@ internal NearbyGUI(MainGui owner) mMessageLog = new List(); mKnownEndpoints = new HashSet(); -#if UNITY_ANDROID && UNITY_2019 +#if UNITY_ANDROID && UNITY_2018_3_OR_NEWER Permission.RequestUserPermission(Permission.FineLocation); Permission.RequestUserPermission(Permission.CoarseLocation); #endif diff --git a/Samples/SmokeTest/Scripts/NearbyGUI.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/NearbyGUI.cs.meta similarity index 100% rename from Samples/SmokeTest/Scripts/NearbyGUI.cs.meta rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/NearbyGUI.cs.meta diff --git a/Samples/SmokeTest/Scripts/RecallGUI.cs b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/RecallGUI.cs similarity index 100% rename from Samples/SmokeTest/Scripts/RecallGUI.cs rename to Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/RecallGUI.cs diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/RecallGUI.cs.meta b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/RecallGUI.cs.meta new file mode 100644 index 000000000..f1853798b --- /dev/null +++ b/Assets/Public/GooglePlayGames/com.google.play.games/Samples~/SmokeTest/Scripts/RecallGUI.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 30f57da54bd70f847bdec7c90f89ecb3 \ No newline at end of file diff --git a/Assets/Public/GooglePlayGames/com.google.play.games/package.json b/Assets/Public/GooglePlayGames/com.google.play.games/package.json index 5b29d7a2b..917b6cfb2 100644 --- a/Assets/Public/GooglePlayGames/com.google.play.games/package.json +++ b/Assets/Public/GooglePlayGames/com.google.play.games/package.json @@ -2,10 +2,19 @@ "name": "com.google.play.games", "displayName": "Google Play Games", "description": "The Google Play Games plugin for Unity allows you to access the Google Play Games API through Unity's social interface.", - "version": "0.11.01", + "version": "0.11.1", "unity": "2018.4", "author": { "name": "Google LLC" }, - "dependencies": {} + "dependencies": { + "com.google.external-dependency-manager": "1.2.170" + }, + "samples": [ + { + "displayName": "SmokeTest", + "description": "Google Play Games Service Samples", + "path": "Samples~/SmokeTest" + } + ] } diff --git a/README.md b/README.md index 55634ca50..30b6a7290 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ +## Fork for upgrade package and making UPM compatiable + +```json +{ + "dependencies": { + "com.google.external-dependency-manager": "https://github.com/googlesamples/unity-jar-resolver.git?path=upm", + "com.google.play.games": "https://github.com/Thaina/play-games-plugin-for-unity.git?path=/Assets/Public/GooglePlayGames/com.google.play.games", + ... + } +} +``` + +`external-dependency-manager` is required dependencies to imported with UPM. But can be tgz or OpenUPM + +This fork now use gradle post build event to patch androidmanifest + +Also fix the image loader from play service + +Tested and worked in Unity 6. Should be compatible with lower version but not fully tested yet + # Google Play Games plugin for Unity _Copyright (c) 2014 Google Inc. All rights reserved._