示例#1
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);
        }