Пример #1
0
 public void OnDestroy()
 {
     if (ChooserDialog.onClickHandler != null)
     {
         ChooserDialog.onClickHandler(null);
         ChooserDialog.onClickHandler = null;
     }
 }
        private static void UpdateJsonWithBundleIdChooserDialog(string bundleId, bool ignoreModificationDate)
        {
            GenerateXmlFromGoogleServicesJson.ConfigFileType configFileType;
            if ((int)EditorUserBuildSettings.selectedBuildTargetGroup == 7)
            {
                configFileType = GenerateXmlFromGoogleServicesJson.ConfigFileType.Json;
            }
            else
            {
                if ((int)EditorUserBuildSettings.selectedBuildTargetGroup != 4)
                {
                    return;
                }
                configFileType = GenerateXmlFromGoogleServicesJson.ConfigFileType.Plist;
            }
            GenerateXmlFromGoogleServicesJson.ConfigFileType             arg_62_0 = configFileType;
            GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode arg_62_2 = GenerateXmlFromGoogleServicesJson.FindGoogleServicesFileMode.ReturnBundleIdMatches;
            if (GenerateXmlFromGoogleServicesJson.f__mgcacheE == null)
            {
                GenerateXmlFromGoogleServicesJson.f__mgcacheE = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
            }
            GenerateXmlFromGoogleServicesJson.LogMessage arg_62_3 = GenerateXmlFromGoogleServicesJson.f__mgcacheE;
            if (GenerateXmlFromGoogleServicesJson.f__mgcacheF == null)
            {
                GenerateXmlFromGoogleServicesJson.f__mgcacheF = new GenerateXmlFromGoogleServicesJson.LogMessage(GenerateXmlFromGoogleServicesJson.LogNoMessage);
            }
            if (GenerateXmlFromGoogleServicesJson.FindGoogleServicesFile(arg_62_0, bundleId, arg_62_2, arg_62_3, GenerateXmlFromGoogleServicesJson.f__mgcacheF) != null || UnityCompat.InBatchMode)
            {
                GenerateXmlFromGoogleServicesJson.UpdateJson(UnityCompat.InBatchMode, null, null);
                return;
            }
            List <string> list = GenerateXmlFromGoogleServicesJson.BundleIdsFromBundleIdsByConfigFile(GenerateXmlFromGoogleServicesJson.ConfigFileDirectory);

            if (GenerateXmlFromGoogleServicesJson.spamguard || list.Count == 0)
            {
                return;
            }
            ChooserDialog.Show("请修复您的Bundle ID  大哥!!", "从Firebase配置中选择一个有效的Bundle ID", string.Format("您的捆绑包ID {0}不存在于您的FialBasic配置中。不匹配的捆绑ID会导致应用程序无法初始化。", bundleId), list.ToArray(), 0, "Apply", "Cancel", delegate(string selectedBundleId) {
                if (!string.IsNullOrEmpty(selectedBundleId))
                {
                    UnityCompat.ApplicationId = selectedBundleId;
                }
                else
                {
                    GenerateXmlFromGoogleServicesJson.spamguard = true;
                }
                GenerateXmlFromGoogleServicesJson.UpdateJson(true, null, null);
            });
            //ChooserDialog.Show("Please fix your Bundle ID", "Select a valid Bundle ID from your Firebase configuration.", string.Format("Your bundle ID {0} is not present in your Firebase configuration.  A mismatched bundle ID will result in your application to fail to initialize.\n\nNew Bundle ID:", bundleId), list.ToArray(), 0, "Apply", "Cancel", delegate (string selectedBundleId) {
            //    if (!string.IsNullOrEmpty(selectedBundleId)) {
            //        UnityCompat.ApplicationId = selectedBundleId;
            //    } else {
            //        GenerateXmlFromGoogleServicesJson.spamguard = true;
            //    }
            //    GenerateXmlFromGoogleServicesJson.UpdateJson(true, null, null);
            //});
        }
Пример #3
0
        public void OnGUI()
        {
            GUI.skin.label.wordWrap = true;
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUIStyle gUIStyle = new GUIStyle(GUI.skin.label);

            gUIStyle.normal.textColor = new Color(0.7f, 0.7f, 1f);
            GUILayout.Space(10f);
            GUIStyle gUIStyle2 = new GUIStyle(GUI.skin.label);

            gUIStyle2.fontStyle = FontStyle.Bold;
            GUILayout.Label(ChooserDialog.longHelpText, gUIStyle2, new GUILayoutOption[0]);
            GUILayout.Space(10f);
            GUILayout.Label(ChooserDialog.shortHelpText, new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(15f);
            if (ChooserDialog.options != null)
            {
                ChooserDialog.selectedOption = EditorGUILayout.Popup(ChooserDialog.selectedOption, ChooserDialog.options, new GUILayoutOption[0]);
            }
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(ChooserDialog.applyButtonText, new GUILayoutOption[]
            {
                GUILayout.Width(100f)
            }))
            {
                if (ChooserDialog.onClickHandler != null)
                {
                    ChooserDialog.onClickHandler(ChooserDialog.options[ChooserDialog.selectedOption]);
                    ChooserDialog.onClickHandler = null;
                }
                base.Close();
            }
            if (GUILayout.Button(ChooserDialog.cancelButtonText, new GUILayoutOption[]
            {
                GUILayout.Width(100f)
            }))
            {
                if (ChooserDialog.onClickHandler != null)
                {
                    ChooserDialog.onClickHandler(null);
                    ChooserDialog.onClickHandler = null;
                }
                base.Close();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(10f);
            GUILayout.EndVertical();
        }
        private static string CheckBundleId(string bundleId, bool promptUpdate = true, bool logErrorOnMissingBundleId = true)
        {
            if (XcodeProjectPatcher.configFile == null)
            {
                return(null);
            }
            Dictionary <string, string> config = XcodeProjectPatcher.GetConfig();
            string text;

            if (!config.TryGetValue("BUNDLE_ID", out text))
            {
                return(null);
            }
            if (!text.Equals(bundleId) && logErrorOnMissingBundleId && XcodeProjectPatcher.allBundleIds.Count > 0)
            {
                string[] array        = XcodeProjectPatcher.allBundleIds.ToArray <string>();
                string   errorMessage = DocStrings.DocRef.GoogleServicesFileBundleIdMissing.Format(new object[]
                {
                    bundleId,
                    "GoogleServices-Info.plist",
                    string.Join(", ", array),
                    DocStrings.Link.IOSAddApp
                });
                if (promptUpdate && !XcodeProjectPatcher.spamguard)
                {
                    ChooserDialog.Show("Please fix your Bundle ID", "Select a valid Bundle ID from your Firebase configuration.", string.Format("Your bundle ID {0} is not present in your Firebase configuration.  A mismatched bundle ID will result in your application to fail to initialize.\n\nNew Bundle ID:", bundleId), array, 0, "Apply", "Cancel", delegate(string selectedBundleId) {
                        if (!string.IsNullOrEmpty(selectedBundleId))
                        {
                            UnityCompat.ApplicationId = selectedBundleId;
                        }
                        else
                        {
                            XcodeProjectPatcher.spamguard = true;
                            Debug.LogError(errorMessage);
                        }
                        XcodeProjectPatcher.ReadConfig(true, null);
                    });
                }
                else
                {
                    Debug.LogError(errorMessage);
                }
            }
            return(text);
        }