Beispiel #1
0
        /// 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))
            {
                GPGSUtil.Alert(GPGSStrings.Setup.ServiceIdError);
                return(false);
            }

            GPGSProjectSettings.Instance.Set(GPGSUtil.SERVICEIDKEY, nearbyServiceId);
            GPGSProjectSettings.Instance.Save();

            if (androidBuild)
            {
                // create needed directories
                GPGSUtil.EnsureDirExists("Assets/SGLib/Plugins");
                GPGSUtil.EnsureDirExists("Assets/SGLib/Plugins/Android");
                GPGSUtil.CopySupportLibs();

                // Generate AndroidManifest.xml
                GPGSUtil.GenerateAndroidManifest(false);

                // refresh assets, and we're done
                AssetDatabase.Refresh();
                GPGSProjectSettings.Instance.Set("android.NearbySetupDone", true);
                GPGSProjectSettings.Instance.Save();
            }
            return(true);
        }
Beispiel #2
0
        // Provide static access to setup for facilitating automated builds.
        public static void PerformSetup(string appId)
        {
            // check for valid app id
            if (!GPGSUtil.LooksLikeValidAppId(appId))
            {
                GPGSUtil.Alert(GPGSStrings.Setup.AppIdError);
                return;
            }

            GPGSProjectSettings.Instance.Set("proj.AppId", appId);
            GPGSProjectSettings.Instance.Save();

            // 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;
            }

            GPGSUtil.CopySupportLibs();

            // Generate AndroidManifest.xml
            GPGSUtil.GenerateAndroidManifest();

            // refresh assets, and we're done
            AssetDatabase.Refresh();
            GPGSProjectSettings.Instance.Set("android.SetupDone", true);
            GPGSProjectSettings.Instance.Save();
            EditorUtility.DisplayDialog(GPGSStrings.Success,
                                        GPGSStrings.AndroidSetup.SetupComplete, GPGSStrings.Ok);
        }
Beispiel #3
0
        /// Provide static access to setup for facilitating automated builds.
        public static void PerformSetup(string nearbyServiceId)
        {
            // check for valid app id
            if (!GPGSUtil.LooksLikeValidServiceId(nearbyServiceId))
            {
                GPGSUtil.Alert(GPGSStrings.Setup.ServiceIdError);
                return;
            }

            GPGSProjectSettings.Instance.Set(GPGSUtil.SERVICEIDKEY, nearbyServiceId);
            GPGSProjectSettings.Instance.Save();

            // create needed directories
            GPGSUtil.EnsureDirExists("Assets/Plugins");
            GPGSUtil.EnsureDirExists("Assets/Plugins/Android");

            GPGSUtil.CopySupportLibs();

            // Generate AndroidManifest.xml
            GPGSUtil.GenerateAndroidManifest();

            // refresh assets, and we're done
            AssetDatabase.Refresh();
            GPGSProjectSettings.Instance.Set("android.NearbySetupDone", true);
            GPGSProjectSettings.Instance.Save();
            EditorUtility.DisplayDialog(GPGSStrings.Success,
                                        GPGSStrings.NearbyConnections.SetupComplete, GPGSStrings.Ok);
        }
Beispiel #4
0
        /// <summary>
        /// Provide static access to setup for facilitating automated builds.
        /// </summary>
        /// <param name="appId">App identifier.</param>
        /// <param name="nearbySvcId">Optional nearby connection serviceId</param>
        public static bool PerformSetup(string clientId, string appId, string nearbySvcId)
        {
            if (!string.IsNullOrEmpty(clientId))
            {
                if (!GPGSUtil.LooksLikeValidClientId(clientId))
                {
                    GPGSUtil.Alert(GPGSStrings.Setup.ClientIdError);
                    return(false);
                }
                appId = clientId.Split('-')[0];
            }
            else
            {
                // check for valid app id
                if (!GPGSUtil.LooksLikeValidAppId(appId))
                {
                    GPGSUtil.Alert(GPGSStrings.Setup.AppIdError);
                    return(false);
                }
            }

            if (nearbySvcId != null)
            {
                if (!NearbyConnectionUI.PerformSetup(nearbySvcId, true))
                {
                    return(false);
                }
            }

            GPGSProjectSettings.Instance.Set("proj.AppId", appId);
            GPGSProjectSettings.Instance.Set(GPGSUtil.ANDROIDCLIENTIDKEY, clientId);
            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);
            }

            GPGSUtil.CopySupportLibs();

            // Generate AndroidManifest.xml
            GPGSUtil.GenerateAndroidManifest();

            FillInAppData(GameInfoPath, GameInfoPath, clientId);

            // refresh assets, and we're done
            AssetDatabase.Refresh();
            GPGSProjectSettings.Instance.Set("android.SetupDone", true);
            GPGSProjectSettings.Instance.Save();

            return(true);
        }
        /// <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>
        /// <returns>true if successful</returns>
        public static bool PerformSetup(string webClientId, string appId, string nearbySvcId)
        {
            bool needTokenPermissions = false;

            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);
                }

                needTokenPermissions = true;
            }
            else
            {
                needTokenPermissions = false;
            }

            // check for valid app id
            if (!GPGSUtil.LooksLikeValidAppId(appId) && string.IsNullOrEmpty(nearbySvcId))
            {
                GPGSUtil.Alert(GPGSStrings.Setup.AppIdError);
                return(false);
            }

            if (nearbySvcId != null)
            {
                if (!NearbyConnectionUI.PerformSetup(nearbySvcId, true))
                {
                    return(false);
                }
            }

            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);
            }

            GPGSUtil.CopySupportLibs();

            // Generate AndroidManifest.xml
            GPGSUtil.GenerateAndroidManifest(needTokenPermissions);

            // refresh assets, and we're done
            AssetDatabase.Refresh();
            GPGSProjectSettings.Instance.Set(GPGSUtil.ANDROIDSETUPDONEKEY, true);
            GPGSProjectSettings.Instance.Save();

            return(true);
        }