public static void CopyAssets(Platform oldPlatform, Platform newPlatform) { // start editing AssetDatabase.StartAssetEditing(); string submodulePath; submodulePath = SubmoduleMap.GetSubmodulePath(typeof(SagoPlatform.SubmoduleInfo)); // copy manifest AssetUtil.CopyAsset( Path.Combine(submodulePath, "Plugins/Android/AndroidManifest.xml"), "Assets/Plugins/Android/AndroidManifest.xml", true ); // copy plugins to dot folders foreach (Platform platform in PlatformUtilEditor.AndroidPlatforms) { string srcPath; srcPath = string.Format( Path.Combine(submodulePath, "Plugins/{0}/.{1}"), platform.ToBuildTargetGroup().ToString(), platform.ToString() ); string dstPath; dstPath = string.Format( "Assets/Plugins/{0}/.{1}", platform.ToBuildTargetGroup().ToString(), platform.ToString() ); AssetUtil.CopyAsset(srcPath, dstPath, false); } // stop editing AssetDatabase.StopAssetEditing(); AssetDatabase.Refresh(); }
/// <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); }