클라우드 저장/로드 완료

This commit is contained in:
Ino 2025-09-07 10:22:33 +09:00
parent fdbac82f26
commit 97c5381fea
243 changed files with 18100 additions and 577 deletions

View File

@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: ab759628f97301541855b12ebefe30d5
m_currentHash:
serializedVersion: 2
Hash: 92948e6e64f76e2ab7c9ad8968522f5b
Hash: 2e7ac85690eeca579afc57a4b462de21
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 1
m_CatalogRequestsTimeout: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a5ec3b4a710c3ac4cb70edeba9fbf856
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f6275d42c28128a49a450f7708543546
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 315965287bbf43d4b88ec90948807dc8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0127f844fb84e164db70282ab9a1f360
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2f4e61d01d027ae4098130e206f91e7a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 61dedbaac98a7024fae4a814dd3996b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb86a74bfb1c63941982552d7cabb4a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df3f7c6574125a0448c8b54d59640ab0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 165366dd47118514188d2f8ff79b1b48
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
fileFormatVersion: 2
guid: d34ff6261005cf44aa1fd70929cd17e0
labels:
- gpsr
PluginImporter:
externalObjects: {}
serializedVersion: 3
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
Any:
enabled: 0
settings: {}
Editor:
enabled: 1
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.games</groupId>
<artifactId>gpgs-plugin-support</artifactId>
<version>2.1.0</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-games-v2</artifactId>
<version>21.0.0</version>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-nearby</artifactId>
<version>18.5.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9f2e9b9a7ff43104f84fd8bc87c57d58
labels:
- gpsr
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3d56492ea0fa21446adb3064d83c2c8e
guid: 7ab68dd3fa82e4b4eb8e4795d6fbb273
labels:
- gvh
- gvh_version-9.5.0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1f9e743e218055f47ac2ffe7c04dc1d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 24d9eb3a0c4fc49e9b5e5b3600becdef
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 11083f74e79584f50ad394be94e2caec
folderAsset: yes
timeCreated: 1435699548
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,460 @@
// <copyright file="GPGSAndroidSetupUI.cs" company="Google Inc.">
// Copyright (C) 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.
// </copyright>
namespace GooglePlayGames.Editor
{
using System;
using System.Collections;
using System.IO;
using System.Xml;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Google Play Game Services Setup dialog for Android.
/// </summary>
public class GPGSAndroidSetupUI : EditorWindow
{
/// <summary>
/// The configuration data from the play games console "resource data"
/// </summary>
private string mConfigData = string.Empty;
/// <summary>
/// The name of the class to generate containing the resource constants.
/// </summary>
private string mClassName = "GPGSIds";
/// <summary>
/// The scroll position
/// </summary>
private Vector2 scroll;
/// <summary>
/// The directory for the constants class.
/// </summary>
private string mConstantDirectory = "Assets";
/// <summary>
/// The web client identifier.
/// </summary>
private string mWebClientId = string.Empty;
/// <summary>
/// Menus the item for GPGS android setup.
/// </summary>
[MenuItem("Window/Google Play Games/Setup/Android setup...", false, 1)]
public static void MenuItemFileGPGSAndroidSetup()
{
EditorWindow window = EditorWindow.GetWindow(
typeof(GPGSAndroidSetupUI), true, GPGSStrings.AndroidSetup.Title);
window.minSize = new Vector2(500, 400);
}
[MenuItem("Window/Google Play Games/Setup/Android setup...", true)]
public static bool EnableAndroidMenuItem()
{
#if UNITY_ANDROID
return true;
#else
return false;
#endif
}
/// <summary>
/// Performs setup using the Android resources downloaded XML file
/// from the play console.
/// </summary>
/// <returns><c>true</c>, if setup was performed, <c>false</c> otherwise.</returns>
/// <param name="clientId">The web client id.</param>
/// <param name="classDirectory">the directory to write the constants file to.</param>
/// <param name="className">Fully qualified class name for the resource Ids.</param>
/// <param name="resourceXmlData">Resource xml data.</param>
/// <param name="nearbySvcId">Nearby svc identifier.</param>
/// <param name="requiresGooglePlus">Indicates this app requires G+</param>
public static bool PerformSetup(
string clientId,
string classDirectory,
string className,
string resourceXmlData,
string nearbySvcId)
{
if (string.IsNullOrEmpty(resourceXmlData) &&
!string.IsNullOrEmpty(nearbySvcId))
{
return PerformSetup(
clientId,
GPGSProjectSettings.Instance.Get(GPGSUtil.APPIDKEY),
nearbySvcId);
}
if (ParseResources(classDirectory, className, resourceXmlData))
{
GPGSProjectSettings.Instance.Set(GPGSUtil.CLASSDIRECTORYKEY, classDirectory);
GPGSProjectSettings.Instance.Set(GPGSUtil.CLASSNAMEKEY, className);
GPGSProjectSettings.Instance.Set(GPGSUtil.ANDROIDRESOURCEKEY, resourceXmlData);
// check the bundle id and set it if needed.
CheckBundleId();
GPGSUtil.CheckAndFixDependencies();
GPGSUtil.CheckAndFixVersionedAssestsPaths();
AssetDatabase.Refresh();
Google.VersionHandler.VerboseLoggingEnabled = true;
Google.VersionHandler.UpdateVersionedAssets(forceUpdate: true);
Google.VersionHandler.Enabled = true;
AssetDatabase.Refresh();
Google.VersionHandler.InvokeStaticMethod(
Google.VersionHandler.FindClass(
"Google.JarResolver",
"GooglePlayServices.PlayServicesResolver"),
"MenuResolve", null);
return PerformSetup(
clientId,
GPGSProjectSettings.Instance.Get(GPGSUtil.APPIDKEY),
nearbySvcId);
}
return false;
}
/// <summary>
/// Provide static access to setup for facilitating automated builds.
/// </summary>
/// <param name="webClientId">The oauth2 client id for the game. This is only
/// needed if the ID Token or access token are needed.</param>
/// <param name="appId">App identifier.</param>
/// <param name="nearbySvcId">Optional nearby connection serviceId</param>
/// <param name="requiresGooglePlus">Indicates that GooglePlus should be enabled</param>
/// <returns>true if successful</returns>
public static bool PerformSetup(string webClientId, string appId, string nearbySvcId)
{
if (!string.IsNullOrEmpty(webClientId))
{
if (!GPGSUtil.LooksLikeValidClientId(webClientId))
{
GPGSUtil.Alert(GPGSStrings.Setup.ClientIdError);
return false;
}
string serverAppId = webClientId.Split('-')[0];
if (!serverAppId.Equals(appId))
{
GPGSUtil.Alert(GPGSStrings.Setup.AppIdMismatch);
return false;
}
}
// check for valid app id
if (!GPGSUtil.LooksLikeValidAppId(appId) && string.IsNullOrEmpty(nearbySvcId))
{
GPGSUtil.Alert(GPGSStrings.Setup.AppIdError);
return false;
}
if (nearbySvcId != null)
{
#if UNITY_ANDROID
if (!NearbyConnectionUI.PerformSetup(nearbySvcId, true))
{
return false;
}
#endif
}
GPGSProjectSettings.Instance.Set(GPGSUtil.APPIDKEY, appId);
GPGSProjectSettings.Instance.Set(GPGSUtil.WEBCLIENTIDKEY, webClientId);
GPGSProjectSettings.Instance.Save();
GPGSUtil.UpdateGameInfo();
// check that Android SDK is there
if (!GPGSUtil.HasAndroidSdk())
{
Debug.LogError("Android SDK not found.");
EditorUtility.DisplayDialog(
GPGSStrings.AndroidSetup.SdkNotFound,
GPGSStrings.AndroidSetup.SdkNotFoundBlurb,
GPGSStrings.Ok);
return false;
}
// Generate AndroidManifest.xml
GPGSUtil.GenerateAndroidManifest();
// refresh assets, and we're done
AssetDatabase.Refresh();
GPGSProjectSettings.Instance.Set(GPGSUtil.ANDROIDSETUPDONEKEY, true);
GPGSProjectSettings.Instance.Save();
return true;
}
/// <summary>
/// Called when this object is enabled by Unity editor.
/// </summary>
public void OnEnable()
{
GPGSProjectSettings settings = GPGSProjectSettings.Instance;
mConstantDirectory = settings.Get(GPGSUtil.CLASSDIRECTORYKEY, mConstantDirectory);
mClassName = settings.Get(GPGSUtil.CLASSNAMEKEY, mClassName);
mConfigData = settings.Get(GPGSUtil.ANDROIDRESOURCEKEY);
mWebClientId = settings.Get(GPGSUtil.WEBCLIENTIDKEY);
}
/// <summary>
/// Called when the GUI should be rendered.
/// </summary>
public void OnGUI()
{
GUI.skin.label.wordWrap = true;
GUILayout.BeginVertical();
GUIStyle link = new GUIStyle(GUI.skin.label);
link.normal.textColor = new Color(0f, 0f, 1f);
GUILayout.Space(10);
GUILayout.Label(GPGSStrings.AndroidSetup.Blurb);
if (GUILayout.Button("Open Play Games Console", link, GUILayout.ExpandWidth(false)))
{
Application.OpenURL("https://play.google.com/apps/publish");
}
Rect last = GUILayoutUtility.GetLastRect();
last.y += last.height - 2;
last.x += 3;
last.width -= 6;
last.height = 2;
GUI.Box(last, string.Empty);
GUILayout.Space(15);
GUILayout.Label("Constants class name", EditorStyles.boldLabel);
GUILayout.Label("Enter the fully qualified name of the class to create containing the constants");
GUILayout.Space(10);
mConstantDirectory = EditorGUILayout.TextField(
"Directory to save constants",
mConstantDirectory,
GUILayout.MinWidth(480));
mClassName = EditorGUILayout.TextField(
"Constants class name",
mClassName,
GUILayout.MinWidth(480));
GUILayout.Label("Resources Definition", EditorStyles.boldLabel);
GUILayout.Label("Paste in the Android Resources from the Play Console");
GUILayout.Space(10);
scroll = GUILayout.BeginScrollView(scroll);
mConfigData = EditorGUILayout.TextArea(
mConfigData,
GUILayout.MinWidth(475),
GUILayout.Height(Screen.height));
GUILayout.EndScrollView();
GUILayout.Space(10);
// Client ID field
GUILayout.Label(GPGSStrings.Setup.WebClientIdTitle, EditorStyles.boldLabel);
GUILayout.Label(GPGSStrings.AndroidSetup.WebClientIdBlurb);
mWebClientId = EditorGUILayout.TextField(
GPGSStrings.Setup.ClientId,
mWebClientId,
GUILayout.MinWidth(450));
GUILayout.Space(10);
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button(GPGSStrings.Setup.SetupButton, GUILayout.Width(100)))
{
// check that the classname entered is valid
try
{
if (GPGSUtil.LooksLikeValidPackageName(mClassName))
{
DoSetup();
return;
}
}
catch (Exception e)
{
GPGSUtil.Alert(
GPGSStrings.Error,
"Invalid classname: " + e.Message);
}
}
if (GUILayout.Button("Cancel", GUILayout.Width(100)))
{
Close();
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(20);
GUILayout.EndVertical();
}
/// <summary>
/// Starts the setup process.
/// </summary>
public void DoSetup()
{
if (PerformSetup(mWebClientId, mConstantDirectory, mClassName, mConfigData, null))
{
CheckBundleId();
EditorUtility.DisplayDialog(
GPGSStrings.Success,
GPGSStrings.AndroidSetup.SetupComplete,
GPGSStrings.Ok);
GPGSProjectSettings.Instance.Set(GPGSUtil.ANDROIDSETUPDONEKEY, true);
Close();
}
else
{
GPGSUtil.Alert(
GPGSStrings.Error,
"Invalid or missing XML resource data. Make sure the data is" +
" valid and contains the app_id element");
}
}
/// <summary>
/// Checks the bundle identifier.
/// </summary>
/// <remarks>
/// Check the package id. If one is set the gpgs properties,
/// and the player settings are the default or empty, set it.
/// if the player settings is not the default, then prompt before
/// overwriting.
/// </remarks>
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);
#else
currentId = PlayerSettings.bundleIdentifier;
#endif
if (!string.IsNullOrEmpty(packageName))
{
if (string.IsNullOrEmpty(currentId) ||
currentId == "com.Company.ProductName")
{
#if UNITY_5_6_OR_NEWER
PlayerSettings.SetApplicationIdentifier(
BuildTargetGroup.Android, packageName);
#else
PlayerSettings.bundleIdentifier = packageName;
#endif
}
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 UNITY_5_6_OR_NEWER
PlayerSettings.SetApplicationIdentifier(
BuildTargetGroup.Android, packageName);
#else
PlayerSettings.bundleIdentifier = packageName;
#endif
}
}
}
else
{
Debug.Log("NULL package!!");
}
}
/// <summary>
/// Parses the resources xml and set the properties. Also generates the
/// constants file.
/// </summary>
/// <returns><c>true</c>, if resources was parsed, <c>false</c> otherwise.</returns>
/// <param name="classDirectory">Class directory.</param>
/// <param name="className">Class name.</param>
/// <param name="res">Res. the data to parse.</param>
private static bool ParseResources(string classDirectory, string className, string res)
{
XmlTextReader reader = new XmlTextReader(new StringReader(res));
bool inResource = false;
string lastProp = null;
Hashtable resourceKeys = new Hashtable();
string appId = null;
while (reader.Read())
{
if (reader.Name == "resources")
{
inResource = true;
}
if (inResource && reader.Name == "string")
{
lastProp = reader.GetAttribute("name");
}
else if (inResource && !string.IsNullOrEmpty(lastProp))
{
if (reader.HasValue)
{
if (lastProp == "app_id")
{
appId = reader.Value;
GPGSProjectSettings.Instance.Set(GPGSUtil.APPIDKEY, appId);
}
else if (lastProp == "package_name")
{
GPGSProjectSettings.Instance.Set(GPGSUtil.ANDROIDBUNDLEIDKEY, reader.Value);
}
else
{
resourceKeys[lastProp] = reader.Value;
}
lastProp = null;
}
}
}
reader.Close();
if (resourceKeys.Count > 0)
{
GPGSUtil.WriteResourceIds(classDirectory, className, resourceKeys);
}
return appId != null;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 41fe658b93aa24c709c540575965fdff
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
// <copyright file="GPGSDocsUI.cs" company="Google Inc.">
// 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.
// </copyright>
namespace GooglePlayGames.Editor
{
using UnityEngine;
using UnityEditor;
public class GPGSDocsUI
{
[MenuItem("Window/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)]
public static void MenuItemPlayGamesServicesAPI()
{
Application.OpenURL(GPGSStrings.ExternalLinks.PlayGamesServicesApiURL);
}
[MenuItem("Window/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);
}
[MenuItem("Window/Google Play Games/About/License...", false, 301)]
public static void MenuItemLicense()
{
EditorUtility.DisplayDialog(GPGSStrings.LicenseTitle, GPGSStrings.LicenseText,
GPGSStrings.Ok);
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 73cbcab28a27446ff9e06e06a040814f
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
// <copyright file="GPGSPostBuild.cs" company="Google Inc.">
// Copyright (C) 2014 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.Editor
{
using System.Collections.Generic;
using System.IO;
using UnityEditor.Callbacks;
using UnityEditor;
using UnityEngine;
public static class GPGSPostBuild
{
[PostProcessBuild(99999)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
if (!GPGSProjectSettings.Instance.GetBool(GPGSUtil.ANDROIDSETUPDONEKEY, false))
{
EditorUtility.DisplayDialog("Google Play Games not configured!",
"Warning!! Google Play Games was not configured, Game Services will not work correctly.",
"OK");
}
return;
}
}
}
#endif //UNITY_ANDROID

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 1a7b050a8e8214613893df7d81dcc13c
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,197 @@
// <copyright file="GPGSProjectSettings.cs" company="Google Inc.">
// 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.
// </copyright>
// Keep this file even on unsupported configurations.
namespace GooglePlayGames.Editor
{
using System.Collections.Generic;
using System.IO;
#if UNITY_2017_3_OR_NEWER
using UnityEngine.Networking;
#else
using UnityEngine;
#endif
public class GPGSProjectSettings
{
private static GPGSProjectSettings sInstance = null;
public static GPGSProjectSettings Instance
{
get
{
if (sInstance == null)
{
sInstance = new GPGSProjectSettings();
}
return sInstance;
}
}
private bool mDirty = false;
private readonly string mFile;
private Dictionary<string, string> mDict = new Dictionary<string, string>();
private GPGSProjectSettings()
{
mFile = GPGSUtil.SlashesToPlatformSeparator("ProjectSettings/GooglePlayGameSettings.txt");
StreamReader rd = null;
// read the settings file, this list is all the locations it can be in order of precedence.
string[] fileLocations =
{
mFile,
GPGSUtil.SlashesToPlatformSeparator(Path.Combine(GPGSUtil.RootPath, "Editor/projsettings.txt")),
GPGSUtil.SlashesToPlatformSeparator("Assets/Editor/projsettings.txt")
};
foreach (string f in fileLocations)
{
if (File.Exists(f))
{
// assign the reader and break out of the loop
rd = new StreamReader(f);
break;
}
}
if (rd != null)
{
while (!rd.EndOfStream)
{
string line = rd.ReadLine();
if (line == null || line.Trim().Length == 0)
{
break;
}
line = line.Trim();
string[] p = line.Split(new char[] {'='}, 2);
if (p.Length >= 2)
{
mDict[p[0].Trim()] = p[1].Trim();
}
}
rd.Close();
}
}
public string Get(string key, Dictionary<string, string> overrides)
{
if (overrides.ContainsKey(key))
{
return overrides[key];
}
else if (mDict.ContainsKey(key))
{
#if UNITY_2017_3_OR_NEWER
return UnityWebRequest.UnEscapeURL(mDict[key]);
#else
return WWW.UnEscapeURL(mDict[key]);
#endif
}
else
{
return string.Empty;
}
}
public string Get(string key, string defaultValue)
{
if (mDict.ContainsKey(key))
{
#if UNITY_2017_3_OR_NEWER
return UnityWebRequest.UnEscapeURL(mDict[key]);
#else
return WWW.UnEscapeURL(mDict[key]);
#endif
}
else
{
return defaultValue;
}
}
public string Get(string key)
{
return Get(key, string.Empty);
}
public bool GetBool(string key, bool defaultValue)
{
return Get(key, defaultValue ? "true" : "false").Equals("true");
}
public bool GetBool(string key)
{
return Get(key, "false").Equals("true");
}
public void Set(string key, string val)
{
#if UNITY_2017_3_OR_NEWER
string escaped = UnityWebRequest.EscapeURL(val);
#else
string escaped = WWW.EscapeURL(val);
#endif
mDict[key] = escaped;
mDirty = true;
}
public void Set(string key, bool val)
{
Set(key, val ? "true" : "false");
}
public void Save()
{
// See if we are building the plugin, and don't write the settings file
string[] args = System.Environment.GetCommandLineArgs();
foreach (string a in args)
{
if (a == "-g.building")
{
mDirty = false;
break;
}
}
if (!mDirty)
{
return;
}
StreamWriter wr = new StreamWriter(mFile, false);
foreach (string key in mDict.Keys)
{
wr.WriteLine(key + "=" + mDict[key]);
}
wr.Close();
mDirty = false;
}
public static void Reload()
{
sInstance = new GPGSProjectSettings();
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: cf234a050ba25433f9386e20578ccf19
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,174 @@
// <copyright file="GPGSStrings.cs" company="Google Inc.">
// 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.
// </copyright>
// Keep the strings all the time even if on an unsupported configuration.
namespace GooglePlayGames.Editor
{
public class GPGSStrings
{
public const string Error = "Error";
public const string Ok = "OK";
public const string Cancel = "Cancel";
public const string Yes = "Yes";
public const string No = "No";
public const string Success = "Success";
public const string Warning = "Warning";
public class PostInstall
{
public const string Title = "Google Play Games Plugin for Unity";
public const string Text = "The Google Play Games Plugin for Unity version $VERSION " +
"is now ready to use. If this is a new installation or if you have " +
"just upgraded from a previous version, please click the 'Google Play Games' " +
"menu and select 'Android Setup' to set up your project.";
}
public class Setup
{
public const string AppIdTitle = "Google Play Games Application ID";
public const string AppId = "Application ID";
public const string AppIdBlurb = "Enter your application ID below. This is the numeric\n" +
"identifier provided by the Developer Console (for example, 123456789012).";
public const string AppIdError = "The App Id does not appear to be valid. " +
"It must consist solely of digits, usually 10 or more.";
public const string WebClientIdTitle = "Web App Client ID (Optional)";
public const string ClientId = "Client ID";
public const string ClientIdError = "The Client ID does not appear to be valid. " +
"It should end in .apps.googleusercontent.com.";
public const string AppIdMismatch = "Web app client ID not associated with this game!";
public const string NearbyServiceId = "Nearby Connection Service ID";
public const string NearbyServiceBlurb = "Enter the service id that identifies the " +
"nearby connections service scope";
public const string SetupButton = "Setup";
}
public class NearbyConnections
{
public const string Title = "Google Play Games - Nearby Connections Setup";
public const string Blurb = "To configure Nearby Connections in this project,\n" +
"please enter the information below and click on the Setup button.";
public const string SetupComplete = "Nearby connections configured successfully.";
}
public class AndroidSetup
{
public const string Title = "Google Play Games - Android Configuration";
public const string Blurb = "To configure Google Play Games in this project,\n" +
"go to the Play Game console, then enter the information below and click on the Setup button.";
public const string WebClientIdBlurb =
"The web app client ID is needed to access the user's ID token and " +
"call other APIs onbehalf of the user." +
" It is not required for Game Services. Enter your oauth2 client ID below.\nTo obtain this " +
"ID, generate a web linked app in Developer Console. Example:\n" +
"123456789012-abcdefghijklm.apps.googleusercontent.com";
public const string PkgName = "Package name";
public const string PkgNameBlurb = "Enter your application's package name below.\n" +
"(for example, com.example.lorem.ipsum).";
public const string PackageNameError = "The package name does not appear to be valid. " +
"Enter a valid Android package name (for example, com.example.lorem.ipsum).";
public const string SdkNotFound = "Android SDK Not found";
public const string SdkNotFoundBlurb = "The Android SDK path was not found. " +
"Please configure it in the Unity preferences window (under External Tools).";
public const string LibProjNotFound = "Google Play Services Library Project Not Found";
public const string LibProjNotFoundBlurb = "Google Play Services library project " +
"could not be found your SDK installation. Make sure it is installed (open " +
"the SDK manager and go to Extras, and select Google Play Services).";
public const string SupportJarNotFound = "Android Support Library v4 Not Found";
public const string SupportJarNotFoundBlurb = "Android Support Library v4 " +
"could not be found your SDK installation. Make sure it is installed (open " +
"the SDK manager and go to Extras, and select 'Android Support Library').";
public const string LibProjVerNotFound = "The version of your copy of the Google Play " +
"Services Library Project could not be determined. Please make sure it is " +
"at least version {0}. Continue?";
public const string LibProjVerTooOld = "Your copy of the Google Play " +
"Services Library Project is out of date. Please launch the Android SDK manager " +
"and upgrade your Google Play Services bundle to the latest version (your version: " +
"{0}; required version: {1}). Proceeding may cause problems. Proceed anyway?";
public const string SetupComplete = "Google Play Games configured successfully.";
}
public class ExternalLinks
{
public const string GettingStartedGuideURL =
"https://github.com/playgameservices/play-games-plugin-for-unity";
public const string PlayGamesServicesApiURL =
"https://developers.google.com/games/services";
public const string GooglePlayGamesAndroidSdkTitle = "Google Play Games Android SDK Download";
public const string GooglePlayGamesAndroidSdkBlurb = "The Google Play Games SDK for " +
"Android must be downloaded via the Android SDK Manager. Do you wish to " +
"start the SDK manager now?";
public const string GooglePlayGamesAndroidSdkInstructions = "The Android SDK manager " +
"will be launched. Install or upgrade the 'Google Play Services' package, " +
"which can be found under the 'Extras' " +
"category.";
public const string GooglePlayGamesAndroidSdkManagerFailed = "Failed to find the " +
"Android SDK manager executable. Make sure the Android SDK is properly installed " +
"and that its path is correctly configured in the Unity preferences window " +
"(under External Tools).";
}
public const string AboutTitle = "Google Play Games Plugin for Unity";
public const string AboutText = "Copyright (C) 2014 Google Inc.\n\nThis is an open-source " +
"plugin that allows cross-platform integration with Google Play games services. " +
"For more information, visit the official site on Github:\n\n" +
"https://github.com/playgameservices/play-games-plugin-for-unity\n\nPlugin version: ";
public const string LicenseTitle = "Google Play Games Plugin for Unity";
public const string LicenseText = "Copyright (C) 2014 Google Inc. All Rights Reserved.\n\n" +
"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\n\n" +
" http://www.apache.org/licenses/LICENSE-2.0\n\n" +
"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.";
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 992ecb564cf02408d9c5a1b44d958334
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,61 @@
// <copyright file="GPGSUpgrader.cs" company="Google Inc.">
// 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.Editor
{
using System.IO;
using UnityEditor;
using UnityEngine;
/// <summary>
/// GPGS upgrader handles performing and upgrade tasks.
/// </summary>
[InitializeOnLoad]
public class GPGSUpgrader
{
/// <summary>
/// Initializes static members of the <see cref="GooglePlayGames.GPGSUpgrader"/> class.
/// </summary>
static GPGSUpgrader()
{
if (EditorApplication.isPlayingOrWillChangePlaymode)
return;
Debug.Log("GPGSUpgrader start");
GPGSProjectSettings.Instance.Set(GPGSUtil.LASTUPGRADEKEY, PluginVersion.VersionKey);
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();
}
if (isChanged)
{
AssetDatabase.Refresh();
}
Debug.Log("GPGSUpgrader done");
}
}
}
#endif

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 357a64420a0c44b61a0ed7ca22c7f10f
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,798 @@
// <copyright file="GPGSUtil.cs" company="Google Inc.">
// Copyright (C) 2014 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.
// </copyright>
// Keep this even on unsupported configurations.
namespace GooglePlayGames.Editor
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Utility class to perform various tasks in the editor.
/// </summary>
public static class GPGSUtil
{
/// <summary>Property key for project settings.</summary>
public const string SERVICEIDKEY = "App.NearbdServiceId";
/// <summary>Property key for project settings.</summary>
public const string APPIDKEY = "proj.AppId";
/// <summary>Property key for project settings.</summary>
public const string CLASSDIRECTORYKEY = "proj.classDir";
/// <summary>Property key for project settings.</summary>
public const string CLASSNAMEKEY = "proj.ConstantsClassName";
/// <summary>Property key for project settings.</summary>
public const string WEBCLIENTIDKEY = "and.ClientId";
/// <summary>Property key for project settings.</summary>
public const string ANDROIDRESOURCEKEY = "and.ResourceData";
/// <summary>Property key for project settings.</summary>
public const string ANDROIDSETUPDONEKEY = "android.SetupDone";
/// <summary>Property key for project settings.</summary>
public const string ANDROIDBUNDLEIDKEY = "and.BundleId";
/// <summary>Property key for plugin version.</summary>
public const string PLUGINVERSIONKEY = "proj.pluginVersion";
/// <summary>Property key for nearby settings done.</summary>
public const string NEARBYSETUPDONEKEY = "android.NearbySetupDone";
/// <summary>Property key for project settings.</summary>
public const string LASTUPGRADEKEY = "lastUpgrade";
/// <summary>Constant for token replacement</summary>
private const string SERVICEIDPLACEHOLDER = "__NEARBY_SERVICE_ID__";
private const string SERVICEID_ELEMENT_PLACEHOLDER = "__NEARBY_SERVICE_ELEMENT__";
private const string NEARBY_PERMISSIONS_PLACEHOLDER = "__NEARBY_PERMISSIONS__";
/// <summary>Constant for token replacement</summary>
private const string APPIDPLACEHOLDER = "__APP_ID__";
/// <summary>Constant for token replacement</summary>
private const string CLASSNAMEPLACEHOLDER = "__Class__";
/// <summary>Constant for token replacement</summary>
private const string WEBCLIENTIDPLACEHOLDER = "__WEB_CLIENTID__";
/// <summary>Constant for token replacement</summary>
private const string PLUGINVERSIONPLACEHOLDER = "__PLUGIN_VERSION__";
/// <summary>Constant for require google plus token replacement</summary>
private const string REQUIREGOOGLEPLUSPLACEHOLDER = "__REQUIRE_GOOGLE_PLUS__";
/// <summary>Property key for project settings.</summary>
private const string TOKENPERMISSIONKEY = "proj.tokenPermissions";
/// <summary>Constant for token replacement</summary>
private const string NAMESPACESTARTPLACEHOLDER = "__NameSpaceStart__";
/// <summary>Constant for token replacement</summary>
private const string NAMESPACEENDPLACEHOLDER = "__NameSpaceEnd__";
/// <summary>Constant for token replacement</summary>
private const string CONSTANTSPLACEHOLDER = "__Constant_Properties__";
/// <summary>
/// The game info file path, relative to the plugin root directory. This is a generated file.
/// </summary>
private const string GameInfoRelativePath = "Runtime/Scripts/GameInfo.cs";
/// <summary>
/// The manifest path, relative to the plugin root directory.
/// </summary>
/// <remarks>The Games SDK requires additional metadata in the AndroidManifest.xml
/// file. </remarks>
private const string ManifestRelativePath =
"../../Plugins/Android/GooglePlayGamesManifest.androidlib/AndroidManifest.xml";
private const string RootFolderName = "com.google.play.games";
/// <summary>
/// The root path of the Google Play Games plugin
/// </summary>
public static string RootPath
{
get
{
if (string.IsNullOrEmpty(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<string>(ref dirs, dirsLength + dir1.Length);
Array.Copy(dir1, 0, dirs, dirsLength, dir1.Length);
#else
string[] dirs = Directory.GetDirectories("Assets", RootFolderName, SearchOption.AllDirectories);
#endif
switch (dirs.Length)
{
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;
}
}
// 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;
}
}
/// <summary>
/// The game info file path. This is a generated file.
/// </summary>
private static string GameInfoPath
{
get { return SlashesToPlatformSeparator(Path.Combine(RootPath, GameInfoRelativePath)); }
}
/// <summary>
/// The manifest path.
/// </summary>
/// <remarks>The Games SDK requires additional metadata in the AndroidManifest.xml
/// file. </remarks>
private static string ManifestPath
{
get { return SlashesToPlatformSeparator(Path.Combine(RootPath, ManifestRelativePath)); }
}
/// <summary>
/// The root path of the Google Play Games plugin
/// </summary>
private static string mRootPath = "";
/// <summary>
/// The map of replacements for filling in code templates. The
/// key is the string that appears in the template as a placeholder,
/// the value is the key into the GPGSProjectSettings.
/// </summary>
private static Dictionary<string, string> replacements =
new Dictionary<string, string>()
{
// Put this element placeholder first, since it has embedded placeholder
{SERVICEID_ELEMENT_PLACEHOLDER, SERVICEID_ELEMENT_PLACEHOLDER},
{SERVICEIDPLACEHOLDER, SERVICEIDKEY},
{APPIDPLACEHOLDER, APPIDKEY},
{CLASSNAMEPLACEHOLDER, CLASSNAMEKEY},
{WEBCLIENTIDPLACEHOLDER, WEBCLIENTIDKEY},
{PLUGINVERSIONPLACEHOLDER, PLUGINVERSIONKEY},
// Causes the placeholder to be replaced with overridden value at runtime.
{NEARBY_PERMISSIONS_PLACEHOLDER, NEARBY_PERMISSIONS_PLACEHOLDER}
};
/// <summary>
/// Replaces / in file path to be the os specific separator.
/// </summary>
/// <returns>The path.</returns>
/// <param name="path">Path with correct separators.</param>
public static string SlashesToPlatformSeparator(string path)
{
return path.Replace("/", System.IO.Path.DirectorySeparatorChar.ToString());
}
/// <summary>
/// Reads the file.
/// </summary>
/// <returns>The file contents. The slashes are corrected.</returns>
/// <param name="filePath">File path.</param>
public static string ReadFile(string filePath)
{
filePath = SlashesToPlatformSeparator(filePath);
if (!File.Exists(filePath))
{
Alert("Plugin error: file not found: " + filePath);
return null;
}
StreamReader sr = new StreamReader(filePath);
string body = sr.ReadToEnd();
sr.Close();
return body;
}
/// <summary>
/// Reads the editor template.
/// </summary>
/// <returns>The editor template contents.</returns>
/// <param name="name">Name of the template in the editor directory.</param>
public static string ReadEditorTemplate(string name)
{
return ReadFile(
Path.Combine(RootPath, string.Format("Editor{0}{1}.txt", Path.DirectorySeparatorChar, name)));
}
/// <summary>
/// Writes the file.
/// </summary>
/// <param name="file">File path - the slashes will be corrected.</param>
/// <param name="body">Body of the file to write.</param>
public static void WriteFile(string file, string body)
{
file = SlashesToPlatformSeparator(file);
DirectoryInfo dir = Directory.GetParent(file);
dir.Create();
using (var wr = new StreamWriter(file, false))
{
wr.Write(body);
}
}
/// <summary>
/// Validates the string to be a valid nearby service id.
/// </summary>
/// <returns><c>true</c>, if like valid service identifier was looksed, <c>false</c> otherwise.</returns>
/// <param name="s">string to test.</param>
public static bool LooksLikeValidServiceId(string s)
{
if (s.Length < 3)
{
return false;
}
foreach (char c in s)
{
if (!char.IsLetterOrDigit(c) && c != '.')
{
return false;
}
}
return true;
}
/// <summary>
/// Looks the like valid app identifier.
/// </summary>
/// <returns><c>true</c>, if valid app identifier, <c>false</c> otherwise.</returns>
/// <param name="s">the string to test.</param>
public static bool LooksLikeValidAppId(string s)
{
if (s.Length < 5)
{
return false;
}
foreach (char c in s)
{
if (c < '0' || c > '9')
{
return false;
}
}
return true;
}
/// <summary>
/// Looks the like valid client identifier.
/// </summary>
/// <returns><c>true</c>, if valid client identifier, <c>false</c> otherwise.</returns>
/// <param name="s">the string to test.</param>
public static bool LooksLikeValidClientId(string s)
{
return s.EndsWith(".googleusercontent.com");
}
/// <summary>
/// Looks the like a valid bundle identifier.
/// </summary>
/// <returns><c>true</c>, if valid bundle identifier, <c>false</c> otherwise.</returns>
/// <param name="s">the string to test.</param>
public static bool LooksLikeValidBundleId(string s)
{
return s.Length > 3;
}
/// <summary>
/// Looks like a valid package.
/// </summary>
/// <returns><c>true</c>, if valid package name, <c>false</c> otherwise.</returns>
/// <param name="s">the string to test.</param>
public static bool LooksLikeValidPackageName(string s)
{
if (string.IsNullOrEmpty(s))
{
throw new Exception("cannot be empty");
}
string[] parts = s.Split(new char[] {'.'});
foreach (string p in parts)
{
char[] bytes = p.ToCharArray();
for (int i = 0; i < bytes.Length; i++)
{
if (i == 0 && !char.IsLetter(bytes[i]))
{
throw new Exception("each part must start with a letter");
}
else if (char.IsWhiteSpace(bytes[i]))
{
throw new Exception("cannot contain spaces");
}
else if (!char.IsLetterOrDigit(bytes[i]) && bytes[i] != '_')
{
throw new Exception("must be alphanumeric or _");
}
}
}
return parts.Length >= 1;
}
/// <summary>
/// Determines if is setup done.
/// </summary>
/// <returns><c>true</c> if is setup done; otherwise, <c>false</c>.</returns>
public static bool IsSetupDone()
{
bool doneSetup = true;
#if UNITY_ANDROID
doneSetup = GPGSProjectSettings.Instance.GetBool(ANDROIDSETUPDONEKEY, false);
// check gameinfo
if (File.Exists(GameInfoPath))
{
string contents = ReadFile(GameInfoPath);
if (contents.Contains(APPIDPLACEHOLDER))
{
Debug.Log("GameInfo not initialized with AppId. " +
"Run Window > Google Play Games > Setup > Android Setup...");
return false;
}
}
else
{
Debug.Log("GameInfo.cs does not exist. Run Window > Google Play Games > Setup > Android Setup...");
return false;
}
#endif
return doneSetup;
}
/// <summary>
/// Makes legal identifier from string.
/// Returns a legal C# identifier from the given string. The transformations are:
/// - spaces => underscore _
/// - punctuation => empty string
/// - leading numbers are prefixed with underscore.
/// </summary>
/// <returns>the id</returns>
/// <param name="key">Key to convert to an identifier.</param>
public static string MakeIdentifier(string key)
{
string s;
string retval = string.Empty;
if (string.IsNullOrEmpty(key))
{
return "_";
}
s = key.Trim().Replace(' ', '_');
foreach (char c in s)
{
if (char.IsLetterOrDigit(c) || c == '_')
{
retval += c;
}
}
return retval;
}
/// <summary>
/// Displays an error dialog.
/// </summary>
/// <param name="s">the message</param>
public static void Alert(string s)
{
Alert(GPGSStrings.Error, s);
}
/// <summary>
/// Displays a dialog with the given title and message.
/// </summary>
/// <param name="title">the title.</param>
/// <param name="message">the message.</param>
public static void Alert(string title, string message)
{
EditorUtility.DisplayDialog(title, message, GPGSStrings.Ok);
}
/// <summary>
/// Gets the android sdk path.
/// </summary>
/// <returns>The android sdk path.</returns>
public static string GetAndroidSdkPath()
{
string sdkPath = EditorPrefs.GetString("AndroidSdkRoot");
#if UNITY_2019_1_OR_NEWER
// Unity 2019.x added installation of the Android SDK in the AndroidPlayer directory
// so fallback to searching for it there.
if (string.IsNullOrEmpty(sdkPath) || EditorPrefs.GetBool("SdkUseEmbedded"))
{
string androidPlayerDir = BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None);
if (!string.IsNullOrEmpty(androidPlayerDir))
{
string androidPlayerSdkDir = Path.Combine(androidPlayerDir, "SDK");
if (Directory.Exists(androidPlayerSdkDir))
{
sdkPath = androidPlayerSdkDir;
}
}
}
#endif
if (sdkPath != null && (sdkPath.EndsWith("/") || sdkPath.EndsWith("\\")))
{
sdkPath = sdkPath.Substring(0, sdkPath.Length - 1);
}
return sdkPath;
}
/// <summary>
/// Determines if the android sdk exists.
/// </summary>
/// <returns><c>true</c> if android sdk exists; otherwise, <c>false</c>.</returns>
public static bool HasAndroidSdk()
{
string sdkPath = GetAndroidSdkPath();
return sdkPath != null && sdkPath.Trim() != string.Empty && System.IO.Directory.Exists(sdkPath);
}
/// <summary>
/// Gets the unity major version.
/// </summary>
/// <returns>The unity major version.</returns>
public static int GetUnityMajorVersion()
{
#if UNITY_5
string majorVersion = Application.unityVersion.Split('.')[0];
int ver;
if (!int.TryParse(majorVersion, out ver))
{
ver = 0;
}
return ver;
#elif UNITY_4_6
return 4;
#else
return 0;
#endif
}
/// <summary>
/// Checks for the android manifest file exsistance.
/// </summary>
/// <returns><c>true</c>, if the file exists <c>false</c> otherwise.</returns>
public static bool AndroidManifestExists()
{
string destFilename = ManifestPath;
return File.Exists(destFilename);
}
/// <summary>
/// Generates the android manifest.
/// </summary>
public static void GenerateAndroidManifest()
{
string destFilename = ManifestPath;
// Generate AndroidManifest.xml
string manifestBody = GPGSUtil.ReadEditorTemplate("template-AndroidManifest");
Dictionary<string, string> overrideValues =
new Dictionary<string, string>();
if (!string.IsNullOrEmpty(GPGSProjectSettings.Instance.Get(SERVICEIDKEY)))
{
overrideValues[NEARBY_PERMISSIONS_PLACEHOLDER] =
" <!-- Required for Nearby Connections -->\n" +
" <uses-permission android:name=\"android.permission.BLUETOOTH\" />\n" +
" <uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />\n" +
" <uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />\n" +
" <uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" />\n" +
" <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />\n";
overrideValues[SERVICEID_ELEMENT_PLACEHOLDER] =
" <!-- Required for Nearby Connections API -->\n" +
" <meta-data android:name=\"com.google.android.gms.nearby.connection.SERVICE_ID\"\n" +
" android:value=\"__NEARBY_SERVICE_ID__\" />\n";
}
else
{
overrideValues[NEARBY_PERMISSIONS_PLACEHOLDER] = "";
overrideValues[SERVICEID_ELEMENT_PLACEHOLDER] = "";
}
foreach (KeyValuePair<string, string> ent in replacements)
{
string value =
GPGSProjectSettings.Instance.Get(ent.Value, overrideValues);
manifestBody = manifestBody.Replace(ent.Key, value);
}
GPGSUtil.WriteFile(destFilename, manifestBody);
GPGSUtil.UpdateGameInfo();
}
/// <summary>
/// Writes the resource identifiers file. This file contains the
/// resource ids copied (downloaded?) from the play game app console.
/// </summary>
/// <param name="classDirectory">Class directory.</param>
/// <param name="className">Class name.</param>
/// <param name="resourceKeys">Resource keys.</param>
public static void WriteResourceIds(string classDirectory, string className, Hashtable resourceKeys)
{
string constantsValues = string.Empty;
string[] parts = className.Split('.');
string dirName = classDirectory;
if (string.IsNullOrEmpty(dirName))
{
dirName = "Assets";
}
string nameSpace = string.Empty;
for (int i = 0; i < parts.Length - 1; i++)
{
dirName += "/" + parts[i];
if (nameSpace != string.Empty)
{
nameSpace += ".";
}
nameSpace += parts[i];
}
EnsureDirExists(dirName);
foreach (DictionaryEntry ent in resourceKeys)
{
string key = MakeIdentifier((string) ent.Key);
constantsValues += " public const string " +
key + " = \"" + ent.Value + "\"; // <GPGSID>\n";
}
string fileBody = GPGSUtil.ReadEditorTemplate("template-Constants");
if (nameSpace != string.Empty)
{
fileBody = fileBody.Replace(
NAMESPACESTARTPLACEHOLDER,
"namespace " + nameSpace + "\n{");
}
else
{
fileBody = fileBody.Replace(NAMESPACESTARTPLACEHOLDER, string.Empty);
}
fileBody = fileBody.Replace(CLASSNAMEPLACEHOLDER, parts[parts.Length - 1]);
fileBody = fileBody.Replace(CONSTANTSPLACEHOLDER, constantsValues);
if (nameSpace != string.Empty)
{
fileBody = fileBody.Replace(
NAMESPACEENDPLACEHOLDER,
"}");
}
else
{
fileBody = fileBody.Replace(NAMESPACEENDPLACEHOLDER, string.Empty);
}
WriteFile(Path.Combine(dirName, parts[parts.Length - 1] + ".cs"), fileBody);
}
/// <summary>
/// Updates the game info file. This is a generated file containing the
/// app and client ids.
/// </summary>
public static void UpdateGameInfo()
{
string fileBody = GPGSUtil.ReadEditorTemplate("template-GameInfo");
foreach (KeyValuePair<string, string> ent in replacements)
{
string value =
GPGSProjectSettings.Instance.Get(ent.Value);
fileBody = fileBody.Replace(ent.Key, value);
}
GPGSUtil.WriteFile(GameInfoPath, fileBody);
}
/// <summary>
/// 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.
/// </summary>
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);
}
/// <summary>
/// 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.
/// </summary>
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);
}
}
}
/// <summary>
/// Ensures the dir exists.
/// </summary>
/// <param name="dir">Directory to check.</param>
public static void EnsureDirExists(string dir)
{
dir = SlashesToPlatformSeparator(dir);
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
}
/// <summary>
/// Deletes the dir if exists.
/// </summary>
/// <param name="dir">Directory to delete.</param>
public static void DeleteDirIfExists(string dir)
{
dir = SlashesToPlatformSeparator(dir);
if (Directory.Exists(dir))
{
Directory.Delete(dir, true);
}
}
/// <summary>
/// Gets the Google Play Services library version. This is only
/// needed for Unity versions less than 5.
/// </summary>
/// <returns>The GPS version.</returns>
/// <param name="libProjPath">Lib proj path.</param>
private static int GetGPSVersion(string libProjPath)
{
string versionFile = libProjPath + "/res/values/version.xml";
XmlTextReader reader = new XmlTextReader(new StreamReader(versionFile));
bool inResource = false;
int version = -1;
while (reader.Read())
{
if (reader.Name == "resources")
{
inResource = true;
}
if (inResource && reader.Name == "integer")
{
if ("google_play_services_version".Equals(
reader.GetAttribute("name")))
{
reader.Read();
Debug.Log("Read version string: " + reader.Value);
version = Convert.ToInt32(reader.Value);
}
}
}
reader.Close();
return version;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: fd01714f9ee99447996b878b1ac67540
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
{
"name": "Google.Play.Games.Editor",
"references": [
"Google.Play.Games"
],
"includePlatforms": [
"Editor"
]
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9172e27a923a34eb8b02dc3ab88d3dcd
labels:
- gvh
- gvh_version-2.1.0
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<dependencies>
<!-- Internal library dependency generated at build time.
It also defines the transitive dependencies on play-services
-->
<androidPackages>
<androidPackage spec="com.google.games:gpgs-plugin-support:2.1.0">
<repositories>
<repository>Assets/GooglePlayGames/com.google.play.games/Editor/m2repository</repository>
</repositories>
</androidPackage>
</androidPackages>
</dependencies>

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 23be7d2a8d0784f2195988f3ee220ea2
labels:
- gvh
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,100 @@
Assets/PlayServicesResolver/Editor/play-services-resolver_v1.2.137.0.txt
Assets/Plugins/Android/GooglePlayGamesManifest.androidlib/project.properties
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb
Assets/ExternalDependencyManager/Editor/LICENSE
Assets/ExternalDependencyManager/Editor/CHANGELOG.md
Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll
Assets/ExternalDependencyManager/Editor/README.md
Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.182_manifest.txt
Assets/ExternalDependencyManager/Editor/1.2.182/Google.PackageManagerResolver.pdb
Assets/ExternalDependencyManager/Editor/1.2.182/Google.VersionHandlerImpl.pdb
Assets/ExternalDependencyManager/Editor/1.2.182/Google.VersionHandlerImpl.dll
Assets/ExternalDependencyManager/Editor/1.2.182/Google.PackageManagerResolver.dll
Assets/ExternalDependencyManager/Editor/1.2.182/Google.JarResolver.pdb
Assets/ExternalDependencyManager/Editor/1.2.182/Google.IOSResolver.pdb
Assets/ExternalDependencyManager/Editor/1.2.182/Google.JarResolver.dll
Assets/ExternalDependencyManager/Editor/1.2.182/Google.IOSResolver.dll
Assets/GooglePlayGames/AssemblyInfo.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Google.Play.Games.asmdef
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/NearbyConnectionClientFactory.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidSavedGameClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidSnapshotMetadata.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidJavaConverter.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidEventsClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidNearbyConnectionClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidHelperFragment.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/Android/AndroidTaskUtils.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/Platforms/PlayGamesClientFactory.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/PluginVersion.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/PlayGamesHelperObject.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/PlatformUtils.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/Logger.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/Misc.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/OurUtils/NearbyHelperObject.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesPlatform.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesScore.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesLeaderboard.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesUserProfile.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesLocalUser.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/ISocialPlatform/PlayGamesAchievement.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Achievement.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/AuthScope.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/ScorePageToken.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/DummyClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/AuthResponse.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/RecallAccess.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/SavedGame/ISavedGameClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/SavedGame/ISavedGameMetadata.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/SavedGame/SavedGameMetadataUpdate.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/CommonStatusCodes.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/DummyNearbyConnectionClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/AdvertisingResult.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/EndpointDetails.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/ConnectionRequest.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/INearbyConnectionClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/ConnectionResponse.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Nearby/NearbyConnectionConfiguration.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/PlayerProfile.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/IPlayGamesClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/LeaderboardScoreData.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/SignInInteractivity.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Events/Event.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Events/IEvent.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Events/IEventsClient.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/Player.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/SignInStatus.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/CommonTypes.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/BasicApi/PlayerStats.cs
Assets/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs
Assets/GooglePlayGames/com.google.play.games/current-build/GooglePlayGamesPlugin-2.0.0.unitypackage
Assets/GooglePlayGames/com.google.play.games/package.json
Assets/GooglePlayGames/com.google.play.games/Proguard/games.txt
Assets/GooglePlayGames/com.google.play.games/Editor/template-AndroidManifest.txt
Assets/GooglePlayGames/com.google.play.games/Editor/NearbyConnectionUI.cs
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSAndroidSetupUI.cs
Assets/GooglePlayGames/com.google.play.games/Editor/template-Constants.txt
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSPostBuild.cs
Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSUtil.cs
Assets/GooglePlayGames/com.google.play.games/Editor/template-GameInfo.txt
Assets/GooglePlayGames/com.google.play.games/Editor/Google.Play.Games.Editor.asmdef
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSUpgrader.cs
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/maven-metadata.xml.sha256
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/maven-metadata.xml
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/maven-metadata.xml.sha512
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.srcaar.sha1
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.srcaar.md5
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.pom.md5
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.pom.sha512
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.srcaar.sha512
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.pom
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.srcaar
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.pom.sha256
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.pom.sha1
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/2.1.0/gpgs-plugin-support-2.1.0.srcaar.sha256
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/maven-metadata.xml.md5
Assets/GooglePlayGames/com.google.play.games/Editor/m2repository/com/google/games/gpgs-plugin-support/maven-metadata.xml.sha1
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSStrings.cs
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSDocsUI.cs
Assets/GooglePlayGames/com.google.play.games/Editor/GPGSProjectSettings.cs

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2cab45bef89b247bcb7a494b006fdf9b
labels:
- gvh
- gvh_manifest
- gvh_version-2.1.0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,153 @@
// <copyright file="NearbyConnectionUI.cs" company="Google Inc.">
// Copyright (C) 2014 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.Editor
{
using UnityEngine;
using UnityEditor;
public class NearbyConnectionUI : EditorWindow
{
private string mNearbyServiceId = string.Empty;
[MenuItem("Window/Google Play Games/Setup/Nearby Connections setup...", false, 3)]
public static void MenuItemNearbySetup()
{
EditorWindow window = EditorWindow.GetWindow(
typeof(NearbyConnectionUI), true, GPGSStrings.NearbyConnections.Title);
window.minSize = new Vector2(400, 200);
}
[MenuItem("Window/Google Play Games/Setup/Nearby Connections setup...", true)]
public static bool EnableNearbyMenuItem()
{
#if UNITY_ANDROID
return true;
#else
return false;
#endif
}
public void OnEnable()
{
mNearbyServiceId = GPGSProjectSettings.Instance.Get(GPGSUtil.SERVICEIDKEY);
}
public void OnGUI()
{
GUI.skin.label.wordWrap = true;
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.Label(GPGSStrings.NearbyConnections.Blurb);
GUILayout.Space(10);
GUILayout.Label(GPGSStrings.Setup.NearbyServiceId, EditorStyles.boldLabel);
GUILayout.Space(10);
GUILayout.Label(GPGSStrings.Setup.NearbyServiceBlurb);
mNearbyServiceId = EditorGUILayout.TextField(GPGSStrings.Setup.NearbyServiceId,
mNearbyServiceId, GUILayout.Width(350));
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button(GPGSStrings.Setup.SetupButton,
GUILayout.Width(100)))
{
DoSetup();
}
if (GUILayout.Button("Cancel", GUILayout.Width(100)))
{
this.Close();
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(20);
GUILayout.EndVertical();
}
private void DoSetup()
{
if (PerformSetup(mNearbyServiceId, true))
{
EditorUtility.DisplayDialog(GPGSStrings.Success,
GPGSStrings.NearbyConnections.SetupComplete, GPGSStrings.Ok);
this.Close();
}
}
/// Provide static access to setup for facilitating automated builds.
/// <param name="nearbyServiceId">The nearby connections service Id</param>
/// <param name="androidBuild">true if building android</param>
public static bool PerformSetup(string nearbyServiceId, bool androidBuild)
{
// check for valid app id
if (!GPGSUtil.LooksLikeValidServiceId(nearbyServiceId))
{
if (EditorUtility.DisplayDialog(
"Remove Nearby connection permissions? ",
"The service Id is invalid. It must follow package naming rules. " +
"Do you want to remove the AndroidManifest entries for Nearby connections?",
"Yes",
"No"))
{
GPGSProjectSettings.Instance.Set(GPGSUtil.SERVICEIDKEY, null);
GPGSProjectSettings.Instance.Save();
}
else
{
return false;
}
}
else
{
GPGSProjectSettings.Instance.Set(GPGSUtil.SERVICEIDKEY, nearbyServiceId);
GPGSProjectSettings.Instance.Save();
}
if (androidBuild)
{
// create needed directories
GPGSUtil.EnsureDirExists("Assets/Plugins");
GPGSUtil.EnsureDirExists("Assets/Plugins/Android");
// Generate AndroidManifest.xml
GPGSUtil.GenerateAndroidManifest();
GPGSProjectSettings.Instance.Set(GPGSUtil.NEARBYSETUPDONEKEY, true);
GPGSProjectSettings.Instance.Save();
// Resolve the dependencies
Google.VersionHandler.VerboseLoggingEnabled = true;
Google.VersionHandler.UpdateVersionedAssets(forceUpdate: true);
Google.VersionHandler.Enabled = true;
AssetDatabase.Refresh();
Google.VersionHandler.InvokeStaticMethod(
Google.VersionHandler.FindClass(
"Google.JarResolver",
"GooglePlayServices.PlayServicesResolver"),
"MenuResolve", null);
}
return true;
}
}
}
#endif

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: b64332a502e18436da5652adbf7e24a3
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a1aac54589c4640cd89900056af3a094
folderAsset: yes
timeCreated: 1515000812
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 76a0a965afaf3450c92e9b41b493bbeb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6cb1e99a036f54817b99eeef873b6466
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e98998ec335bb4358bc79e29457320ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 227f33919ca3d4d60a6040a03cbaa5e9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 097e60ab202a04d96b15903958e8d21f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.games</groupId>
<artifactId>gpgs-plugin-support</artifactId>
<version>2.1.0</version>
<packaging>srcaar</packaging>
<dependencies>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-games-v2</artifactId>
<version>21.0.0</version>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-nearby</artifactId>
<version>18.5.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6c7298e4e719d4b4385fdbd461a80e16
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 77c5e5feaf1bb418eb5dee0b81092649
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8341b2c3a48474fa1844e4abb5680cb3
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
a470877748a60d4edc3ec1773906e069a06dd1481fde054f700e4ab0ae698728

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e6b6a3e652c5a492ab2801cd91083291
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
499a85fbba0d49e29f1bcbd369b691b0fc8f12b74c68e9d85ffc0e2264ae49081b4decac323579ebbde56523df194ddac932adcfd7169d59044e39f53a179833

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b240939517fec40b4865e09113e40a67
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: be12aa927c7cf4436b9e41baec85bc56
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b05cec21e440d40d292505bdd9f0872a
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7fad262fe84ae4755bb1e5992d0bb0fe
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
52ba335460015c31f4f2aec66a28f2ae1e6338741ed03f75a792fbc248d279bb

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b355faca70a7f4859836cfd5bb5107db
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
fba25ef5bc17ef310ad5b6b95c3e821e1e710b23167b9f3452cdd2ebe6b9dddbdc743fd23a9fa5a6565fee9a30562aa0e305579ca251966a8786dac50d6525a2

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7c8d8706ef3f5409d86d34690d62e5a7
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.google.games</groupId>
<artifactId>gpgs-plugin-support</artifactId>
<versioning>
<latest>2.1.0</latest>
<release>2.1.0</release>
<versions>
<version>2.1.0</version>
</versions>
<lastUpdated>20250708083250</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: df1b97918a3cb4607a87f7d357adfee7
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5e7cbb11d2cd04f6380a65c16715e9a4
labels:
- gvh
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a43cf6ce24a034a94bed8334f57647a7
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
8efe76e7d3745bc3722234db7e6922a89c5b2aa6620a5cfb532a8ddb87649bf9

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 42a80f9d5c82741178cc211096f64370
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
add19f532d7d142f9f0a247a9c7e37dc4772b866c8672a05e881a7d6eba5bcff90c2119478e9a5965e4fd5b18bced11c27056eb78e06abb47e558f9c14b38997

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 22b2c04f6a22f4165aab5a886ce75b1e
labels:
- gvh
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj"
android:versionCode="1"
android:versionName="1.0" >
__NEARBY_PERMISSIONS__
<application>
__NEARBY_SERVICE_ELEMENT__
<!-- The space in these forces it to be interpreted as a string vs. int -->
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="\u003__APP_ID__" />
<!-- Keep track of which plugin is being used -->
<meta-data android:name="com.google.android.gms.games.unityVersion"
android:value="\u003__PLUGIN_VERSION__" />
<activity android:name="com.google.games.bridge.NativeBridgeActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0e1f3c150256848b1ba98702cfb71220
labels:
- gvh
- gvh_version-2.1.0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
// <copyright file="GPGSIds.cs" company="Google Inc.">
// 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.
// </copyright>
///
/// This file is automatically generated DO NOT EDIT!
///
/// These are the constants defined in the Play Games Console for Game Services
/// Resources.
///
__NameSpaceStart__
public static class __Class__
{
__Constant_Properties__
}
__NameSpaceEnd__

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7f2719cb8be514661b7b6aa9986bfe5f
labels:
- gvh
- gvh_version-2.1.0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,71 @@
// <copyright file="GameInfo.cs" company="Google Inc.">
// 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.
// </copyright>
#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.
///
/// <summary>
/// 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 "__".
/// </summary>
public static class GameInfo {
private const string UnescapedApplicationId = "APP_ID";
private const string UnescapedIosClientId = "IOS_CLIENTID";
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 IosClientId = "__IOS_CLIENTID__"; // 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 IosClientIdInitialized() {
return !string.IsNullOrEmpty(IosClientId) && !IosClientId.Equals(ToEscapedToken(UnescapedIosClientId));
}
public static bool WebClientIdInitialized() {
return !string.IsNullOrEmpty(WebClientId) && !WebClientId.Equals(ToEscapedToken(UnescapedWebClientId));
}
public static bool NearbyConnectionsInitialized() {
return !string.IsNullOrEmpty(NearbyConnectionServiceId) &&
!NearbyConnectionServiceId.Equals(ToEscapedToken(UnescapedNearbyServiceId));
}
/// <summary>
/// Returns an escaped token (i.e. one flanked with "__") for the passed token
/// </summary>
/// <returns>The escaped token.</returns>
/// <param name="token">The Token</param>
private static string ToEscapedToken(string token) {
return string.Format("__{0}__", token);
}
}
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c6fa1c0456d174d298bf8dd66f584e9e
labels:
- gvh
- gvh_version-2.1.0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34de77d5a35fb46aeae90de4ad11647b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
-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.* { *; }
-keep class com.google.android.gms.common.api.ResultCallback { *; }
-keep class com.google.android.gms.signin.** { *; }
-keep class com.google.android.gms.dynamic.** { *; }
-keep class com.google.android.gms.dynamite.** { *; }
-keep class com.google.android.gms.tasks.** { *; }
-keep class com.google.android.gms.security.** { *; }
-keep class com.google.android.gms.base.** { *; }
-keep class com.google.android.gms.actions.** { *; }
-keep class com.google.games.bridge.** { *; }
-keep class com.google.android.gms.common.ConnectionResult { *; }
-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.nearby.** { *; }

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3617310a589994e39a2cc011f0758cbf
labels:
- gvh
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cdb02382f873f45598f111dc70b3b47e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
{
"name": "Google.Play.Games",
"includePlatforms": [
"Android",
"Editor"
]
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1ed07ff861e5f468287b0baef844706d
labels:
- gvh
- gvh_version-2.1.0
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee74fb8a25a6e4adea15f4675bac5756
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 0a565e85253b345878939982a360e0b6
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,201 @@
// <copyright file="Achievement.cs" company="Google Inc.">
// 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.BasicApi
{
using System;
/// <summary>Data interface for retrieving achievement information.</summary>
/// <remarks>
/// There are 3 states an achievement can be in:
/// <para>
/// Hidden - indicating the name and description of the achievement is
/// not visible to the player.
/// </para><para>
/// Revealed - indicating the name and description of the achievement is
/// visible to the player.
/// Unlocked - indicating the player has unlocked, or achieved, the achievment.
/// </para><para>
/// Achievements has two types, standard which is unlocked in one step,
/// and incremental, which require multiple steps to unlock.
/// </para>
/// </remarks>
public class Achievement
{
static readonly DateTime UnixEpoch =
new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
private string mId = string.Empty;
private bool mIsIncremental = false;
private bool mIsRevealed = false;
private bool mIsUnlocked = false;
private int mCurrentSteps = 0;
private int mTotalSteps = 0;
private string mDescription = string.Empty;
private string mName = string.Empty;
private long mLastModifiedTime = 0;
private ulong mPoints;
private string mRevealedImageUrl;
private string mUnlockedImageUrl;
/// <summary>
/// Returns a <see cref="System.String"/> that represents the current <see cref="GooglePlayGames.BasicApi.Achievement"/>.
/// </summary>
/// <returns>A <see cref="System.String"/> that represents the current <see cref="GooglePlayGames.BasicApi.Achievement"/>.</returns>
public override string ToString()
{
return string.Format(
"[Achievement] id={0}, name={1}, desc={2}, type={3}, revealed={4}, unlocked={5}, steps={6}/{7}",
mId, mName, mDescription, mIsIncremental ? "INCREMENTAL" : "STANDARD",
mIsRevealed, mIsUnlocked, mCurrentSteps, mTotalSteps);
}
public Achievement()
{
}
/// <summary>
/// Indicates whether this achievement is incremental.
/// </summary>
public bool IsIncremental
{
get { return mIsIncremental; }
set { mIsIncremental = value; }
}
/// <summary>
/// The number of steps the user has gone towards unlocking this achievement.
/// </summary>
public int CurrentSteps
{
get { return mCurrentSteps; }
set { mCurrentSteps = value; }
}
/// <summary>
/// The total number of steps needed to unlock this achievement.
/// </summary>
public int TotalSteps
{
get { return mTotalSteps; }
set { mTotalSteps = value; }
}
/// <summary>
/// Indicates whether the achievement is unlocked or not.
/// </summary>
public bool IsUnlocked
{
get { return mIsUnlocked; }
set { mIsUnlocked = value; }
}
/// <summary>
/// Indicates whether the achievement is revealed or not (hidden).
/// </summary>
public bool IsRevealed
{
get { return mIsRevealed; }
set { mIsRevealed = value; }
}
/// <summary>
/// The ID string of this achievement.
/// </summary>
public string Id
{
get { return mId; }
set { mId = value; }
}
/// <summary>
/// The description of this achievement.
/// </summary>
public string Description
{
get { return this.mDescription; }
set { mDescription = value; }
}
/// <summary>
/// The name of this achievement.
/// </summary>
public string Name
{
get { return this.mName; }
set { mName = value; }
}
/// <summary>
/// The date and time the state of the achievement was modified.
/// </summary>
/// <remarks>
/// The value is invalid (-1 long) if the achievement state has
/// never been updated.
/// </remarks>
public DateTime LastModifiedTime
{
get { return UnixEpoch.AddMilliseconds(mLastModifiedTime); }
set
{
TimeSpan ts = value - UnixEpoch;
mLastModifiedTime = (long) ts.TotalMilliseconds;
}
}
/// <summary>
/// The number of experience points earned for unlocking this Achievement.
/// </summary>
public ulong Points
{
get { return mPoints; }
set { mPoints = value; }
}
/// <summary>
/// The URL to the image to display when the achievement is revealed.
/// </summary>
public string RevealedImageUrl
{
get { return mRevealedImageUrl; }
set { mRevealedImageUrl = value; }
}
/// <summary>
/// The URL to the image to display when the achievement is unlocked.
/// </summary>
public string UnlockedImageUrl
{
get { return mUnlockedImageUrl; }
set { mUnlockedImageUrl = value; }
}
}
}
#endif

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: b20fc2fda369044ba962d1d9115c4c63
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,104 @@
// <copyright file="AuthResponse.cs" company="Google Inc.">
// Copyright (C) 2025 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.BasicApi
{
using System;
using System.Collections.Generic;
/// <summary>
/// Represents the response received from Play Games Services when requesting a server-side OAuth 2.0
/// authorization code for the signed-in player.
/// </summary>
public class AuthResponse
{
private readonly string _authCode;
private readonly List<AuthScope> _grantedScopes;
/// <summary>
/// Constructs an <c>AuthResponse</c> with the provided granted scopes and authentication code.
/// </summary>
/// <param name="authCode">The authentication code.</param>
/// <param name="grantedScopes">A list of <c>AuthScope</c> objects representing the granted scopes.</param>
/// <exception cref="ArgumentNullException">If <c>grantedScopes</c> is null.</exception>
public AuthResponse(string authCode, List<AuthScope> grantedScopes)
{
if (grantedScopes == null)
{
throw new ArgumentNullException(nameof(grantedScopes), "Granted scopes list cannot be null");
}
_authCode = authCode;
_grantedScopes = grantedScopes;
}
/// <summary>
/// Gets the list of <c>AuthScope</c> permissions that the user has granted.
/// </summary>
/// <remarks>
/// A list of the <c>AuthScope</c> permissions the user explicitly granted consent for (or
/// previously approved). The list will be empty if the user declines consent and none of the
/// requested <c>AuthScope</c> were previously granted.
/// </remarks>
/// <returns>A <c>List</c> of <c>AuthScope</c> objects, representing the granted permissions.</returns>
public List<AuthScope> GetGrantedScopes()
{
return _grantedScopes;
}
/// <summary>
/// Gets the OAuth 2.0 authorization code.
/// </summary>
/// <remarks>
/// This code is a short-lived credential that should be sent securely to your server to be
/// exchanged for an access token and conditionally a refresh token.
/// </remarks>
/// <returns>A string containing the OAuth 2.0 authorization code.</returns>
public string GetAuthCode()
{
return _authCode;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj == null || GetType() != obj.GetType())
{
return false;
}
var other = (AuthResponse)obj;
return _grantedScopes.Equals(other._grantedScopes) && _authCode == other._authCode;
}
public override int GetHashCode()
{
return HashCode.Combine(_grantedScopes, _authCode);
}
public override string ToString()
{
string grantedScopesText = _grantedScopes.Count > 0 ? string.Join(", ", _grantedScopes.ToArray()) : "[]";
return $"AuthResponse {{ grantedScopes = {grantedScopesText}, authCode = {_authCode} }}";
}
}
}
#endif

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: d31e1b3df27554441b81c35d645a008a
labels:
- gvh
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,102 @@
// <copyright file="AuthScope.cs" company="Google Inc.">
// Copyright (C) 2025 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.BasicApi
{
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Represents type-safe constants for the specific OAuth 2.0 authorization scopes used when
/// requesting server-side access to Play Games Services web APIs.
/// </summary>
public enum AuthScope
{
/// <summary>
/// See your primary Google Account email address.
/// </summary>
EMAIL,
/// <summary>
/// See your personal info, including any personal info you've made publicly available.
/// </summary>
PROFILE,
/// <summary>
/// Associate you with your personal info on Google.
/// </summary>
OPEN_ID
}
/// <summary>
/// Extensions for the AuthScope enum.
/// <remarks>
/// These extensions are used to converting between the AuthScope enum and its string
/// representation.
/// </remarks>
/// </summary>
public static class AuthScopeExtensions
{
/// <summary>
/// A map of AuthScope string values to their enum representations.
/// </summary>
private static readonly Dictionary<string, AuthScope> _stringToEnumMap =
new Dictionary<string, AuthScope>
{
{ "EMAIL", AuthScope.EMAIL },
{ "PROFILE", AuthScope.PROFILE },
{ "OPEN_ID", AuthScope.OPEN_ID }
};
/// <summary>
/// A map of AuthScope enum values to their string representations.
/// </summary>
private static readonly Dictionary<AuthScope, string> _enumToStringMap =
_stringToEnumMap.ToDictionary(pair => pair.Value, pair => pair.Key);
/// <summary>
/// Returns the standard string representation of this OAuth 2.0 scope.
/// </summary>
/// <param name="authScope">The AuthScope enum value.</param>
/// <returns>The string value used to represent this scope.</returns>
/// <exception cref="ArgumentException">If the provided AuthScope is not valid.</exception>
public static string GetValue(this AuthScope authScope)
{
if (!_enumToStringMap.ContainsKey(authScope))
{
throw new ArgumentException($"Invalid AuthScope: {authScope}");
}
return _enumToStringMap[authScope];
}
/// <summary>
/// Returns the AuthScope enum value corresponding to the provided string.
/// </summary>
/// <param name="value">The string value used to represent the scope.</param>
/// <returns>The AuthScope enum value corresponding to the provided string.</returns>
/// <exception cref="ArgumentException">If the provided string is not a valid AuthScope.</exception>
public static AuthScope FromValue(string value)
{
if (!_stringToEnumMap.ContainsKey(value))
{
throw new ArgumentException($"Invalid AuthScope: {value}");
}
return _stringToEnumMap[value];
}
}
}
#endif

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 46024b30df48146d9a58760a6b9e188e
labels:
- gvh
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,100 @@
// <copyright file="CommonStatusCodes.cs" company="Google Inc.">
// 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.
// </copyright>
#if UNITY_ANDROID
namespace GooglePlayGames.BasicApi
{
/// <summary>
/// Common status codes.
/// See https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes
/// </summary>
public enum CommonStatusCodes
{
/// <summary>The operation was successful, but the device's cache was used.</summary>
SuccessCached = -1,
/// <summary>The operation was successful.</summary>
Success = 0,
/// <summary>Google Play services is missing on this device.</summary>
ServiceMissing = 1,
/// <summary>The installed version of Google Play services is out of date.</summary>
ServiceVersionUpdateRequired = 2,
/// <summary>The installed version of Google Play services has been disabled on this device.</summary>
ServiceDisabled = 3,
/// <summary>The client attempted to connect to the service but the user is not signed in.</summary>
SignInRequired = 4,
/// <summary>The client attempted to connect to the service with an invalid account name specified.</summary>
InvalidAccount = 5,
/// <summary>Completing the operation requires some form of resolution.</summary>
ResolutionRequired = 6,
/// <summary>A network error occurred.</summary>
NetworkError = 7,
/// <summary>An internal error occurred.</summary>
InternalError = 8,
/// <summary>The version of the Google Play services installed on this device is not authentic.</summary>
ServiceInvalid = 9,
/// <summary>The application is misconfigured.</summary>
DeveloperError = 10,
/// <summary>The application is not licensed to the user.</summary>
LicenseCheckFailed = 11,
/// <summary>The operation failed with no more detailed information.</summary>
Error = 13,
/// <summary>A blocking call was interrupted while waiting and did not run to completion.</summary>
Interrupted = 14,
/// <summary>Timed out while awaiting the result.</summary>
Timeout = 15,
/// <summary>The result was canceled either due to client disconnect or cancel().</summary>
Canceled = 16,
/// <summary>The client attempted to call a method from an API that failed to connect.</summary>
ApiNotConnected = 17,
/// <summary>Invalid credentials were provided.</summary>
AuthApiInvalidCredentials = 3000,
/// <summary>Access is forbidden.</summary>
AuthApiAccessForbidden = 3001,
/// <summary>Error related to the client.</summary>
AuthApiClientError = 3002,
/// <summary>Error related to the server.</summary>
AuthApiServerError = 3003,
/// <summary>Error related to token.</summary>
AuthTokenError = 3004,
/// <summary>Error related to auth URL resolution.</summary>
AuthUrlResolution = 3005
}
}
#endif

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: cd54f7a2763f74ce191bdd3efa0a44d5
labels:
- gvh
- gvh_version-2.1.0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,214 @@
// <copyright file="CommonTypes.cs" company="Google Inc.">
// 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.
// </copyright>
namespace GooglePlayGames.BasicApi
{
/// <summary>
/// A enum describing where game data can be fetched from.
/// </summary>
public enum DataSource
{
/// <summary>
/// Allow a read from either a local cache, or the network.
/// </summary>
/// <remarks> Values from the cache may be
/// stale (potentially producing more write conflicts), but reading from cache may still
/// allow reads to succeed if the device does not have internet access and may complete more
/// quickly (as the reads can occur locally rather requiring network roundtrips).
/// </remarks>
ReadCacheOrNetwork,
/// <summary>
/// Only allow reads from network.
/// </summary>
/// <remarks> This guarantees any returned values were current at the time
/// the read succeeded, but prevents reads from succeeding if the network is unavailable for
/// any reason.
/// </remarks>
ReadNetworkOnly
}
/// <summary> Native response status codes</summary>
/// <remarks> These values are returned by the native SDK API.
/// NOTE: These values are different than the CommonStatusCodes.
/// </remarks>
public enum ResponseStatus
{
/// <summary>The operation was successful.</summary>
Success = 1,
/// <summary>The operation was successful, but the device's cache was used.</summary>
SuccessWithStale = 2,
/// <summary>The application is not licensed to the user.</summary>
LicenseCheckFailed = -1,
/// <summary>An internal error occurred.</summary>
InternalError = -2,
/// <summary>The player is not authorized to perform the operation.</summary>
NotAuthorized = -3,
/// <summary>The installed version of Google Play services is out of date.</summary>
VersionUpdateRequired = -4,
/// <summary>Timed out while awaiting the result.</summary>
Timeout = -5,
///< summary>
/// Constant indicating that the developer does not have access to the friends list, but can
/// call the AskForLoadFriendsResolution API to show a consent dialog.
///</summary>
ResolutionRequired = -6,
}
/// <summary> Native response status codes for UI operations.</summary>
/// <remarks> These values are returned by the native SDK API.
/// </remarks>
public enum UIStatus
{
/// <summary>The result is valid.</summary>
Valid = 1,
/// <summary>An internal error occurred.</summary>
InternalError = -2,
/// <summary>The player is not authorized to perform the operation.</summary>
NotAuthorized = -3,
/// <summary>The installed version of Google Play services is out of date.</summary>
VersionUpdateRequired = -4,
/// <summary>Timed out while awaiting the result.</summary>
Timeout = -5,
/// <summary>UI closed by user.</summary>
UserClosedUI = -6,
UiBusy = -12,
/// <summary>An network error occurred.</summary>
NetworkError = -20,
}
/// <summary>Values specifying the start location for fetching scores.</summary>
public enum LeaderboardStart
{
/// <summary>Start fetching scores from the top of the list.</summary>
TopScores = 1,
/// <summary>Start fetching relative to the player's score.</summary>
PlayerCentered = 2,
}
/// <summary>Values specifying which leaderboard timespan to use.</summary>
public enum LeaderboardTimeSpan
{
/// <summary>Daily scores. The day resets at 11:59 PM PST.</summary>
Daily = 1,
/// <summary>Weekly scores. The week resets at 11:59 PM PST on Sunday.</summary>
Weekly = 2,
/// <summary>All time scores.</summary>
AllTime = 3,
}
/// <summary>Values specifying which leaderboard collection to use.</summary>
public enum LeaderboardCollection
{
/// <summary>Public leaderboards contain the scores of players who are sharing their gameplay publicly.</summary>
Public = 1,
/// <summary>Social leaderboards contain the scores of players in the viewing player's circles.</summary>
Social = 2,
}
/// <summary>Values specifying the visibility status of the friends list.</summary>
public enum FriendsListVisibilityStatus
{
///< summary>
/// Constant indicating that currently it's unknown if the friends list is visible to the
/// game, game can ask for permission from user.
///</summary>
Unknown = 0,
/// Constant indicating that the friends list is currently visible to the game.
Visible = 1,
///< summary>
/// Constant indicating that the developer does not have access to the friends list, but can
/// call the AskForLoadFriendsResolution API to show a consent dialog.
///</summary>
ResolutionRequired = 2,
///< summary>
/// Constant indicating that the friends list is currently unavailable for this user, and it
/// is not possible to request access at this time, either because the user has permanently
/// declined or the friends feature is not available to them. In this state, any attempts to
/// request
/// access to the friends list will be unsuccessful.
///</summary>
Unavailable = 3,
/// <summary>An network error occurred.</summary>
NetworkError = -4,
/// <summary>The player is not authorized to perform the operation.</summary>
NotAuthorized = -5,
}
/// <summary>Values specifying the status of the friends list.</summary>
public enum LoadFriendsStatus
{
/// <summary>An unknown value to return when loadFriends is not available.</summary>
Unknown = 0,
/// <summary>All the friends have been loaded.</summary>
Completed = 1,
/// <summary>There are more friends to load.</summary>
LoadMore = 2,
/// <summary>
/// The game doesn't have permission to access the player's friends list. No friends loaded.
/// </summary>
ResolutionRequired = -3,
/// <summary>An internal error occurred.</summary>
InternalError = -4,
/// <summary>The player is not authorized to perform the operation.</summary>
NotAuthorized = -5,
/// <summary>An network error occurred.</summary>
NetworkError = -6,
}
/// <summary>
/// Utility class for common types.
/// This class checks if a response status is a success or not.
/// </summary>
public class CommonTypesUtil
{
/// <summary>
/// Checks if a response status is a success or not.
/// </summary>
public static bool StatusIsSuccess(ResponseStatus status)
{
return ((int) status) > 0;
}
}
}

Some files were not shown because too many files have changed in this diff Show More