public override void OnInspectorGUI() { base.OnInspectorGUI(); GooglePlayProductInfo productInfo = target as GooglePlayProductInfo; EditorGUI.BeginChangeCheck(); productInfo.GooglePlayDownloaderDebugMode = EditorGUILayout.Toggle("Debug Expansion File", productInfo.GooglePlayDownloaderDebugMode); EditorGUILayout.BeginVertical(GUI.skin.box); { productInfo.LicensePublicKey = EditorGUILayout.TextField("License Public Key", productInfo.LicensePublicKey); } EditorGUILayout.EndVertical(); bool objectIsModified = EditorGUI.EndChangeCheck(); if (objectIsModified) { EditorUtility.SetDirty(target); } #if SAGO_GOOGLE_PLAY_EXPANSION_DOWNLOADER if (string.IsNullOrEmpty(productInfo.LicensePublicKey)) // The RSA key { EditorGUILayout.HelpBox("Please enter the License Public Key.", MessageType.Error); } #endif }
public static void UpdateGooglePlayProjectResources(Platform oldPlatform, Platform newPlatform) { bool defineSymbolSagoGooglePlayExpansionDownloader = false; #if SAGO_GOOGLE_PLAY_EXPANSION_DOWNLOADER defineSymbolSagoGooglePlayExpansionDownloader = true; #endif GooglePlayProductInfo productInfo = null; if (newPlatform == Platform.GooglePlay) { productInfo = PlatformUtil.GetSettings <GooglePlayProductInfo>(Platform.GooglePlay); } else if (newPlatform == Platform.GooglePlayFree) { productInfo = PlatformUtil.GetSettings <GooglePlayProductInfo>(Platform.GooglePlayFree); } if (productInfo != null) { UpdateStringsXml(productInfo, newPlatform); } }
/// <summary> /// Updates the strings.xml. /// </summary> /// <param name="productInfo">Product info.</param> public static void UpdateStringsXml(GooglePlayProductInfo productInfo, Platform targetPlatform) { bool defineSymbolSagoGooglePlayExpansionDownloader = false; #if SAGO_GOOGLE_PLAY_EXPANSION_DOWNLOADER defineSymbolSagoGooglePlayExpansionDownloader = true; #endif string licensePath = ""; string licensePathTemplate = ""; if (targetPlatform == SagoPlatform.Platform.GooglePlay) { licensePath = licensePublicKeyPath; licensePathTemplate = licensePublicKeyPathTemplate; } else { licensePath = licensePublicKeyPathGooglePlayFree; licensePathTemplate = licensePublicKeyPathTemplateGooglePlayFree; } if (!File.Exists(licensePath)) { AssetDatabase.StartAssetEditing(); AssetUtil.CopyAsset(licensePathTemplate, licensePath, true); AssetDatabase.StopAssetEditing(); AssetDatabase.Refresh(); } XDocument xmlFile = XDocument.Load(licensePath); try { var querySkipDownload = from c in xmlFile.Elements("resources").Elements("string") where c.Attribute("name").Value == xmlNodeUseExpansionFile select c; foreach (XElement googlePlayUseExpansionFile in querySkipDownload) { googlePlayUseExpansionFile.Value = defineSymbolSagoGooglePlayExpansionDownloader ? "true" : "false"; } } catch (System.Exception ex) { Debug.LogException(ex); } // Set License Public Key try { var queryLicensePublicKey = from c in xmlFile.Elements("resources").Elements("string") where c.Attribute("name").Value == xmlNodeLicensePublicKey select c; foreach (XElement licenseKey in queryLicensePublicKey) { if (!defineSymbolSagoGooglePlayExpansionDownloader || productInfo.LicensePublicKey == null) { licenseKey.Value = ""; } else { licenseKey.Value = productInfo.LicensePublicKey; } } } catch (System.Exception ex) { Debug.LogException(ex); } // Enable/Disable googleplay debug mode try { var queryDownloaderDebugMode = from c in xmlFile.Elements("resources").Elements("string") where c.Attribute("name").Value == xmlNodeDebugExpansionFile select c; foreach (XElement debugMode in queryDownloaderDebugMode) { debugMode.Value = productInfo.GooglePlayDownloaderDebugMode ? "true" : "false"; } } catch (System.Exception ex) { Debug.LogException(ex); } xmlFile.Save(licensePath); }