internal override void ApplyChanges(IList <string> enabled) { lock (LOCK) { var config = Configuration(); config .Descendants("iosPod") .Remove(); var packages = config.Descendants("iosPods").First(); foreach (var network in enabled) { packages.Add(new XElement( "iosPod", new object[] { new XAttribute( "name", "DeltaDNAAds/" + network), new XAttribute( "version", VERSION), new XAttribute( "bitcodeEnabled", "true"), new XAttribute( "minTargetSdk", InitialisationHelper.IosMinTargetVersion()), new XElement("sources", sources) })); } if (InitialisationHelper.IsDevelopment() && InitialisationHelper.IsDebugNotifications()) { packages.Add(new XElement( "iosPod", new object[] { new XAttribute( "name", "DeltaDNADebug"), new XAttribute( "version", VERSION_DEBUG), new XAttribute( "bitcodeEnabled", "true"), new XAttribute( "minTargetSdk", InitialisationHelper.IosMinTargetVersion()), new XElement("sources", sources) })); } config.Save(CONFIG); } }
public NetworksWindow() : base() { networks = Json.Deserialize(File.ReadAllText(DEFINITIONS)) as IList <object>; debugNotifications = InitialisationHelper.IsDebugNotifications(); foreach (var handler in handlers) { enabled[handler] = new SortedDictionary <string, bool>(); var persisted = handler.GetPersisted(); foreach (IDictionary <string, object> network in networks) { var value = network[handler.platform] as string; if (value != null) { enabled[handler][value] = persisted.Contains(value) || false; } } } }
internal override void ApplyChanges(IList <string> enabled) { lock (LOCK) { var config = Configuration(); config .Descendants("androidPackage") .Remove(); var packages = config.Descendants("androidPackages").First(); if (enabled.Count > 0) { packages.Add(new XElement( "androidPackage", new object[] { new XAttribute( "spec", "com.deltadna.android:deltadna-smartads-core:" + VERSION), new XElement( "repositories", new object[] { new XElement("repository", REPO) }) })); } foreach (var network in enabled) { var repos = new List <object>() { new XElement("repository", REPO) }; if (network.Equals("hyprmx")) { repos.Add(new XElement( "repository", "https://raw.githubusercontent.com/HyprMXMobile/Android-SDKs/master")); } if (network.Equals("mopub")) { repos.Add(new XElement( "repository", "https://s3.amazonaws.com/moat-sdk-builds")); } if (network.Equals("tapjoy")) { repos.Add(new XElement( "repository", "https://tapjoy.bintray.com/maven")); } packages.Add(new XElement( "androidPackage", new object[] { new XAttribute( "spec", "com.deltadna.android:deltadna-smartads-provider-" + network + ":" + VERSION), new XElement( "repositories", repos.ToArray()) })); } if (InitialisationHelper.IsDevelopment() && InitialisationHelper.IsDebugNotifications()) { packages.Add(new XElement( "androidPackage", new object[] { new XAttribute( "spec", "com.deltadna.android:deltadna-smartads-debug:" + VERSION), new XElement( "repositories", new object[] { new XElement("repository", REPO) }) })); } config.Save(CONFIG); } if (download) { DownloadLibraries(); } }
void OnGUI() { GUILayout.BeginVertical(); var style = new GUIStyle(); style.wordWrap = true; style.margin = new RectOffset(5, 5, 5, 5); GUILayout.Label( "Select the ad networks to build into the game.\n" + "\n" + "After making changes press 'Apply', " + "which will update the build scripts for Android and iOS. " + "These should be committed to your version control system.\n" + "\n" + "For Android the ad network libraries will be downloaded automatically, " + "however for iOS the project will need to be built from Unity in order " + "for CocoaPods to download the dependencies and export it as an Xcode project.\n" + "\n" + "Most networks work out of the box [A], to use others that require additional integration, " + "contact [email protected] for more details.\n" + "\n" + "The networks are labelled as supporting interstitial type ads [I] and/or rewarded type ads [R].", style); GUILayout.Space(HEIGHT_SEPARATOR); GUILayout.BeginHorizontal(); GUILayout.Label("A", GUILayout.Width(WIDTH_TOGGLE_SMALL)); GUILayout.Label("Network", GUILayout.Width(WIDTH_LABEL)); foreach (var handler in handlers) { GUILayout.Label( handler.platformVisible, GUILayout.Width(WIDTH_TOGGLE)); } GUILayout.Label("I", GUILayout.Width(WIDTH_TOGGLE_SMALL)); GUILayout.Label("R", GUILayout.Width(WIDTH_TOGGLE)); GUILayout.EndHorizontal(); foreach (IDictionary <string, object> network in networks) { GUILayout.BeginHorizontal(); var integration = network["integration"] as string; if (integration != null && integration == "manual") { GUILayout.Label("", GUILayout.Width(WIDTH_TOGGLE_SMALL)); } else { GUILayout.Label('\u25CF'.ToString(), GUILayout.Width(WIDTH_TOGGLE_SMALL)); } GUILayout.Label( network[NAME] as string, GUILayout.Width(WIDTH_LABEL)); foreach (var handler in handlers) { var value = network[handler.platform] as string; if (value == null) { // empty label to fill the space GUILayout.Label("", GUILayout.Width(WIDTH_TOGGLE)); continue; } enabled[handler][value] = GUILayout.Toggle( enabled[handler].ContainsKey(value) ? enabled[handler][value] : true, "", GUILayout.Width(WIDTH_TOGGLE)); } bool interstitialFound = false; bool rewardedFound = false; var adTypes = network["type"] as IList <object>; foreach (string adType in adTypes) { if (adType == "interstitial") { interstitialFound = true; } if (adType == "rewarded") { rewardedFound = true; } } if (interstitialFound) { GUILayout.Label('\u25CF'.ToString(), GUILayout.Width(WIDTH_TOGGLE_SMALL)); } else { GUILayout.Label("", GUILayout.Width(WIDTH_TOGGLE_SMALL)); } if (rewardedFound) { GUILayout.Label('\u25CF'.ToString(), GUILayout.Width(WIDTH_TOGGLE)); } else { GUILayout.Label("", GUILayout.Width(WIDTH_TOGGLE)); } GUILayout.EndHorizontal(); } GUILayout.Space(HEIGHT_SEPARATOR); EditorGUI.BeginDisabledGroup(!InitialisationHelper.IsDevelopment()); debugNotifications = GUILayout.Toggle(debugNotifications, "Enable debug notifications in development builds"); EditorGUI.EndDisabledGroup(); GUILayout.Space(HEIGHT_SEPARATOR); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Apply", GUILayout.Width(WIDTH_BUTTON))) { Apply(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }