public static void RequestAdView(string zoneId, AdSize adSize, AdPosition adPosition, AdOptions adOptions) { if (Ads.IsInitialized()) { SharedInstance.RequestAdView(zoneId, adSize, adPosition, adOptions); } }
/// <summary> /// Cancels the interstitial and returns control back to the application. /// </summary> /// Call this method to cancel the interstitial. Canceling interstitials before they finish will diminish publisher revenue. /// Note this has no affect on Android. /// <param name="ad">The interstitial ad returned from RequestInterstitialAd.</param> public static void CancelAd(InterstitialAd ad) { if (IsInitialized()) { SharedInstance.CancelAd(ad); } }
/// <summary> /// Sends a custom message to the AdColony SDK. /// </summary> /// Use this method to send custom messages to the AdColony SDK. /// <param name="type">The type of the custom message. Must be 128 characters or less.</param> /// <param name="content">The content of the custom message. Must be 1024 characters or less.</param> /// <param name="reply">A block of code to be executed when a reply is sent to the custom message.</param> public static void SendCustomMessage(string type, string content) { if (IsInitialized()) { SharedInstance.SendCustomMessage(type, content); } }
/// <summary> /// Sets the current, global set of AppOptions. /// </summary> /// Use the object's option-setting methods to configure currently-supported options. /// <param name="options">The AppOptions object to be used for configuring global options such as a custom user identifier.</param> /// <see cref="AppOptions" /> public static void SetAppOptions(AppOptions options) { if (IsInitialized()) { SharedInstance.SetAppOptions(options); } }
/// <summary> /// Reports IAPs within your application. /// </summary> /// Note that this API can be used to report standard IAPs as well as those triggered by AdColony’s IAP Promo (IAPP) advertisements. /// Leveraging this API will improve overall ad targeting for your application. /// <param name="transactionID">An string representing the unique SKPaymentTransaction identifier for the IAP. Must be 128 chars or less.</param> /// <param name="productID">An string identifying the purchased product. Must be 128 chars or less.</param> /// <param name="price">(optional) Total price of the items purchased in micro-cents, $0.99 = 990000</param> /// <param name="currencyCode">(optional) An string indicating the real-world, three-letter ISO 4217 (e.g. USD) currency code of the transaction.</param> public static void LogInAppPurchase(string transactionId, string productId, int purchasePriceMicro, string currencyCode) { if (IsInitialized()) { SharedInstance.LogInAppPurchase(transactionId, productId, purchasePriceMicro, currencyCode); } }
/// <summary> /// Requests an AdColonyInterstitial. /// </summary> /// This method returns immediately, before the ad request completes. /// If the request is successful, an AdColonyInterstitial object will be passed to the success block. /// If the request is unsuccessful, the failure block will be called and an AdColonyAdRequestError will be passed to the handler. /// <param name="zoneId">The zone identifier string indicating which zone the ad request is for.</param> /// <param name="adOptions">An AdOptions object used to set configurable aspects of the ad request.</param> /// <see cref="AdOptions" /> /// <see cref="InterstitialAd" /> /// <see cref="OnRequestInterstitial" /> /// <see cref="OnRequestInterstitialFailedWithZone" /> public static void RequestInterstitialAd(string zoneId, AdOptions adOptions) { if (IsInitialized()) { SharedInstance.RequestInterstitialAd(zoneId, adOptions); } }
/// <summary> /// Returns the current, global set of AppOptions. /// </summary> /// Use this method to obtain the current set of app options used to configure SDK behavior. /// If no options object has been set, this method will return `null`. /// <returns>The current AppOptions object being used by the SDK.</returns> /// <see cref="AppOptions" /> public static AppOptions GetAppOptions() { if (IsInitialized()) { return(SharedInstance.GetAppOptions()); } return(null); }
/// <summary> /// Retrieve a string-based representation of the SDK version. /// </summary> /// The returned string will be in the form of "<Major Version>.<Minor Version>.<External Revision>.<Internal Revision>" /// <returns>The current AdColony SDK version string.</returns> public static string GetSDKVersion() { if (IsInitialized()) { return(SharedInstance.GetSDKVersion()); } return(null); }
// Asynchronously request an Interstitial Ad // see OnRequestInterstitial, OnRequestInterstitialFailed /// <summary> /// Retrieves a Zone object. /// </summary> /// AdColonyZone objects aggregate informative data about unique AdColony zones such as their identifiers, whether or not they are configured for rewards, etc. /// AdColony zone IDs can be created and retrieved at the [Control Panel](http://clients.adcolony.com). /// <param name="zoneId">The AdColony zone identifier string indicating which zone to return.</param> /// <returns>A Zone object. Returns `null` if an invalid zone ID is passed.</returns> /// <see cref="Zone" /> public static Zone GetZone(string zoneId) { if (IsInitialized()) { return(SharedInstance.GetZone(zoneId)); } return(null); }
/// <summary> /// Retrieves a custom identifier for the current user if it has been set. /// </summary> /// This is an arbitrary, application-specific identifier string for the current user. /// To configure this identifier, use the `AppOptions.UserId` property of the object passed to `Configure()`. /// Note that if this method is called before `Configure()`, it will return an empty string. /// <returns>The identifier for the current user.</returns> /// <see cref="AppOptions" /> public static string GetUserID() { if (IsInitialized()) { return(SharedInstance.GetUserID()); } return(null); }
public static void ShowNotificationViewWithImage(UIImage image, string title, string message, int timerLength, Action onTouch) { //Always remove auto hide when onTouch not is filled if (onTouch == null) { timerLength = (int)NotificationView.NotificationViewShowingDuration; } UIApplication.SharedApplication.InvokeOnMainThread(() => SharedInstance.ShowNotificationViewWithImage(image, title, message, timerLength, onTouch)); }
// --------------------------------------------------------------------------- /// <summary> /// Configures AdColony specifically for your app; required for usage of the rest of the API. /// </summary> /// This method returns immediately; any long-running work such as network connections are performed in the background. /// AdColony does not begin preparing ads for display or performing reporting until after it is configured by your app. /// The required appId and zoneIds parameters for this method can be created and retrieved at the [Control Panel](http://clients.adcolony.com). /// If either of these are `null`, app will be unable to play ads and AdColony will only provide limited reporting and install-tracking functionality. /// You should not start requesting ads until `OnConfigurationCompleted` event has fired. /// If there is a configuration error, the set of zones passed to the completion handler will be null. /// <param name="appId">The AdColony app ID for your app.</param> /// <param name="zoneIds">An array of at least one AdColony zone ID string.</param> /// <param name="options">(optional) Configuration options for your app.</param> /// <see cref="AppOptions" /> /// <see cref="Zone" /> /// <see cref="OnConfigurationCompleted" /> public static void Configure(string appId, AppOptions options, params string[] zoneIds) { // Using SharedInstance to make sure the MonoBehaviour is instantiated if (SharedInstance == null) { Debug.LogWarning(Constants.AdsMessageSDKUnavailable); return; } SharedInstance.Configure(appId, options, zoneIds); _initialized = true; }
/// <summary> /// Constructor. /// </summary> /// <param name="contractType">Required.</param> /// <param name="sharedInstance">Required.</param> /// <exception cref="ArgumentNullException"/> /// <exception cref="ArgumentException">If the <c>sharedInstance</c> does /// not extend the <c>contractType</c>.</exception> public SharedInstanceExportDescriptorProvider(Type contractType, object sharedInstance) { ContractType = contractType ?? throw new ArgumentNullException(nameof(contractType)); SharedInstance = sharedInstance ?? new ArgumentNullException(nameof(sharedInstance)); if (!ContractType.IsInstanceOfType(SharedInstance)) { throw new ArgumentException( $"Shared instance '{SharedInstance.GetType().GetFriendlyFullName()}'" + $" does not extend service contract type '{ContractType.GetFriendlyFullName()}'."); } }
public override float GetElementHeight(GUIContent label, SharedInstance <T, TSerializer> element, fiGraphMetadata metadata) { if (typeof(TActual).IsGenericType == false) { return(PropertyEditor.Get(typeof(T), null).FirstEditor.GetElementHeight(new GUIContent("Instance"), element.Instance, new fiGraphMetadataChild { Metadata = metadata })); } TryEnsureScript(); return(EditorChain.GetNextEditor(this).GetElementHeight(label, element, metadata.Enter("ObjectReference", metadata.Context))); }
/// <summary> /// Shows an interstitial ad. /// </summary> /// <param name="ad">The interstitial ad returned from RequestInterstitialAd.</param> /// <see cref="OnOpened" /> /// <see cref="OnClosed" /> /// <see cref="OnExpiring" /> /// <see cref="OnAudioStarted" /> /// <see cref="OnAudioStopped" /> public static void ShowAd(InterstitialAd ad) { if (IsInitialized()) { if (ad != null) { SharedInstance.ShowAd(ad); } else { Debug.LogError(Constants.AdsMessageErrorNullAd); } } }
public static void DismissWithAction(Action ac) { if (ac == null) { Dismiss(); return; } if (IsVisible) { UIApplication.SharedApplication.InvokeOnMainThread(() => SharedInstance.HideNotificationViewOnComplete(ac)); } else { ac(); } }
public static void ShowNotificationViewWithImage(UIImage image, string title, string message) { UIApplication.SharedApplication.InvokeOnMainThread(() => SharedInstance.ShowNotificationViewWithImage(image, title, message, (int)NotificationView.NotificationViewShowingDuration, Dismiss)); }
protected override void OnEdit(Rect rect, SharedInstance <T, TSerializer> behavior, fiGraphMetadata metadata) { behavior.Instance = PropertyEditor.Get(typeof(T), null).FirstEditor.Edit(rect, GUIContent.none, behavior.Instance, metadata.Enter("Instance")); }
protected override float OnGetHeight(SharedInstance <T, TSerializer> behavior, fiGraphMetadata metadata) { return(PropertyEditor.Get(typeof(T), null).FirstEditor.GetElementHeight(GUIContent.none, behavior.Instance, metadata.Enter("Instance"))); }
protected override void OnSceneGUI(SharedInstance <T, TSerializer> behavior) { }
public void AddMail(SerializableMailMessage message) { string tempPath = Files.CreateEmptyTempFile(); if (WriteMailToFile(message, tempPath)) { string queuePath = Properties.Settings.Default.QueueFolder; try { queuePath = Files.MapPath(queuePath); } catch { } bool success = false; string file = Path.Combine(queuePath, DateTime.Now.ToString(@"yyyyMMddHHmmss") + @"_" + mailIdCounter.ToString().PadLeft(8, '0') + @".mail"); while (File.Exists(file)) { mailIdCounter++; file = Path.Combine(queuePath, DateTime.Now.ToString(@"yyyyMMddHHmmss") + @"_" + mailIdCounter.ToString().PadLeft(8, '0') + @".mail"); var originalSendingState = _sendingFileNames.ContainsKey(file); try { _sendingFileNames[file] = true; File.Move(tempPath, file); success = true; break; } catch (DirectoryNotFoundException) { break; } catch (PathTooLongException) { break; } catch (FileNotFoundException) { break; } catch (IOException) { continue; } finally { if (!originalSendingState) { _sendingFileNames.TryRemove(file, out originalSendingState); } } } if (!success) { var originalSendingState = _sendingFileNames.ContainsKey(file); try { _sendingFileNames[file] = true; File.Move(tempPath, file); success = true; } catch { } finally { if (!originalSendingState) { _sendingFileNames.TryRemove(file, out originalSendingState); } } } if (success) { SharedInstance.ContinueSendingEmails(); } } }
public override SharedInstance <T, TSerializer> Edit(Rect region, GUIContent label, SharedInstance <T, TSerializer> element, fiGraphMetadata metadata) { TryEnsureScript(); if (typeof(TActual).IsGenericType) { region = EditorGUI.PrefixLabel(region, label); float ButtonRectWidth = 23; Rect buttonRect = region, objectRect = region; buttonRect.x += buttonRect.width - ButtonRectWidth; buttonRect.width = ButtonRectWidth; buttonRect.height = EditorGUIUtility.singleLineHeight; objectRect.width -= buttonRect.width; if (GUI.Button(buttonRect, new GUIContent("\u2261"))) { fiSharedInstanceSelectorWindow.Show(typeof(T), typeof(SharedInstance <T, TSerializer>), instance => { metadata.GetMetadata <SharedInstanceMetadata>().UpdatedInstance = fiOption.Just((SharedInstance <T, TSerializer>)instance); }); } element = EditorChain.GetNextEditor(this).Edit(objectRect, GUIContent.none, element, metadata.Enter("ObjectReference")); } else { if (element != null) { element.Instance = PropertyEditor.Get(typeof(T), null).FirstEditor.Edit(region, new GUIContent("Instance"), element.Instance, new fiGraphMetadataChild { Metadata = metadata }); } } var sharedInstanceMetadata = metadata.GetMetadata <SharedInstanceMetadata>(); if (sharedInstanceMetadata.UpdatedInstance.HasValue) { element = sharedInstanceMetadata.UpdatedInstance.Value; sharedInstanceMetadata.UpdatedInstance = fiOption <SharedInstance <T, TSerializer> > .Empty; GUI.changed = true; } return(element); }
public static void ShowNotificationViewWithImageAndFireOnClose(UIImage image, string title, string message, int timerLength, Action onTouch, Action onClose, NSUrl sound) { UIApplication.SharedApplication.InvokeOnMainThread(() => SharedInstance.ShowNotificationViewWithImageAndFireOnClose(image, title, message, timerLength, onTouch, onClose, sound)); }