public void init() { #if UNITY_IPHONE IOSDialog dialog = IOSDialog.Create(title, message, yesButton, noButton); dialog.urlString = urlString; #endif }
//-------------------------------------- // GET/SET //-------------------------------------- //-------------------------------------- // EVENTS //-------------------------------------- private void OnDeviceTokenReceived(IOSNotificationDeviceToken token) { UnityEngine.Debug.Log("OnTokenReceived"); UnityEngine.Debug.Log(token.tokenString); IOSDialog.Create("OnTokenReceived", token.tokenString); IOSNotificationController.OnDeviceTokenReceived -= OnDeviceTokenReceived; }
//-------------------------------------- // GET/SET //-------------------------------------- //-------------------------------------- // EVENTS //-------------------------------------- private void OnTokenReceived(CEvent e) { IOSNotificationDeviceToken token = e.data as IOSNotificationDeviceToken; UnityEngine.Debug.Log("OnTokenReceived"); UnityEngine.Debug.Log(token.tokenString); IOSDialog.Create("OnTokenReceived", token.tokenString); IOSNotificationController.instance.removeEventListener(IOSNotificationController.DEVICE_TOKEN_RECEIVED, OnTokenReceived); }
void OnReceiptRefreshComplete(ISN_Result res) { if (res.IsSucceeded) { IOSDialog dialog = IOSDialog.Create("Success", "Receipt Refreshed, would you like to check it again?"); dialog.OnComplete += Dialog_RetrieveLocalReceipt; } else { IOSNativePopUpManager.showMessage("Fail", "Receipt Refresh Failed"); } }
void OnReceiptLoaded(ISN_LocalReceiptResult result) { Debug.Log("OnReceiptLoaded"); ISN_Security.OnReceiptLoaded -= OnReceiptLoaded; if (result.Receipt != null) { IOSNativePopUpManager.showMessage("Success", "Receipt loaded, byte array length: " + result.Receipt.Length); } else { IOSDialog dialog = IOSDialog.Create("Failed", "No Receipt found on the device. Would you like to refresh local Receipt?"); dialog.OnComplete += OnComplete; } }
void OnReceiptLoaded(ISN_LocalReceiptResult result) { ISN_Logger.Log("OnReceiptLoaded"); ISN_Security.OnReceiptLoaded -= OnReceiptLoaded; if (result.Receipt != null) { ReceiptData = result.Receipt; IOSDialog dialog = IOSDialog.Create("Success", "Receipt loaded, byte array length: " + result.Receipt.Length + " Would you like to veriday it with Apple Sandbox server?"); dialog.OnComplete += OnVerifayComplete; } else { IOSDialog dialog = IOSDialog.Create("Failed", "No Receipt found on the device. Would you like to refresh local Receipt?"); dialog.OnComplete += OnComplete; } }
//-------------------------------------- // PUBLIC METHODS //-------------------------------------- void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Native Pop-ups", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Rate Pop-up with events")) { IOSRateUsPopUp rate = IOSRateUsPopUp.Create("Like this game?", "Please rate to support future updates!"); rate.OnComplete += onRatePopUpClose; } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dialog Pop-up")) { IOSDialog dialog = IOSDialog.Create("Dialog Title", "Dialog message"); dialog.OnComplete += onDialogClose; } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Message Pop-up")) { IOSMessage msg = IOSMessage.Create("Message Title", "Message body"); msg.OnComplete += onMessageClose; } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dismissed Pop-up")) { Invoke("dismissAlert", 2f); IOSMessage.Create("Hello", "I will die in 2 sec"); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Open App Store")) { IOSNativeUtility.RedirectToAppStoreRatingPage(); } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Preloader ")) { IOSNativeUtility.ShowPreloader(); Invoke("HidePreloader", 3f); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Hide Preloader")) { HidePreloader(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Locale")) { IOSNativeUtility.OnLocaleLoaded += GetLocale; IOSNativeUtility.Instance.GetLocale(); } }