void Awake() { DontDestroyOnLoad(gameObject); //Remove this line after uncommenting FixedUpdate function. IOSMessage.Create("Push registration disabled", "Uncomment 'FixedUpdate' function inside DeviceTokenListner class"); }
private void OnUrlCheckResultAction(ISN_CheckUrlResult result) { if (result.IsSucceeded) { IOSMessage.Create("Success", "The " + result.url + " is registered"); } else { IOSMessage.Create("ERROR", "The " + result.url + " wasn't registered"); } }
private void OnImageSaved(SA.Common.Models.Result result) { IOSCamera.OnImageSaved -= OnImageSaved; if (result.IsSucceeded) { IOSMessage.Create("Success", "Image Successfully saved to Camera Roll"); } else { IOSMessage.Create("ERROR", "Image Save Failed"); } }
private void OnScoresListLoaded(SA.Common.Models.Result res) { if (res.IsSucceeded) { loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId_1); IOSMessage.Create("Success", "Scores loaded"); } else { IOSMessage.Create("Fail", "Failed to load scores"); } }
private void OnImageSaved(ISN_Result result) { IOSCamera.instance.OnImageSaved -= OnImageSaved; if (result.IsSucceeded) { IOSMessage.Create("Success", "Image Successfully saved to Camera Roll"); } else { IOSMessage.Create("ERROR", "Image Save Failed"); } }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { IOSNotificationController.instance.RequestNotificationPermissions(); IOSNotificationController.OnLocalNotificationReceived += HandleOnLocalNotificationReceived; if (IOSNotificationController.Instance.LaunchNotification != null) { ISN_LocalNotification notification = IOSNotificationController.Instance.LaunchNotification; IOSMessage.Create("Launch Notification", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data); } }
private void ShowDevoceInfo() { ISN_Device device = ISN_Device.CurrentDevice; IOSMessage.Create("Device Info", "Name: " + device.Name + "\n" + "System Name: " + device.SystemName + "\n" + "Model: " + device.Model + "\n" + "Localized Model: " + device.LocalizedModel + "\n" + "System Version: " + device.SystemVersion + "\n" + "Major System Version: " + device.MajorSystemVersion + "\n" + "User Interface Idiom: " + device.InterfaceIdiom + "\n" + "GUID in Base64: " + device.GUID.Base64String); }
private void OnImageSaved(ISN_Result result) { IOSCamera.OnImageSaved -= OnImageSaved; NextButton.isEnabled = true; if (result.IsSucceeded) { IOSMessage.Create("Success", "Image Successfully saved to Camera Roll"); } else { IOSMessage.Create("Success", "Image Save Failed"); } }
void ActionTrunEnded(GK_TBM_EndTrunResult result) { GameCenter_TBM.ActionTrunEnded -= ActionTrunEnded; ISN_Logger.Log("ActionTrunEnded IsSucceeded: " + result.IsSucceeded); if (result.IsFailed) { IOSMessage.Create("ActionTrunEnded", result.Error.Message); ISN_Logger.Log(result.Error.Message); } else { GameCenter_TBM.PrintMatchInfo(result.Match); } }
private void OnPostImageInstagram(IOSImagePickResult result) { if (result.IsSucceeded) { Destroy(drawTexture); drawTexture = result.Image; } else { IOSMessage.Create("ERROR", "Image Load Failed"); } IOSSocialManager.Instance.InstagramPost(drawTexture, "Some text to share"); IOSCamera.OnImagePicked -= OnPostImageInstagram; }
private void OnImage(IOSImagePickResult result) { if (result.IsSucceeded) { mImg = result.image; byte[] bArr = result.image.EncodeToJPG(); CreateReport(mImg, bArr); } else { IOSMessage.Create("ERROR", "Image Load Failed"); } // IOSCamera.instance.OnImagePicked -= OnImage; IOSCamera.OnImagePicked -= OnImage; }
private void TryDetectURL() { var url = SA.IOSNative.Core.AppController.LaunchUrl; if (!url.IsEmpty) { IOSMessage.Create("Open URL Detecetd", url.AbsoluteUrl); } var link = SA.IOSNative.Core.AppController.LaunchUniversalLink; if (!link.IsEmpty) { IOSMessage.Create("Launch Universal Link Detecetd", link.AbsoluteUrl); } }
private void OnImage(IOSImagePickResult result) { if (result.IsSucceeded) { //destroying old texture Destroy(drawTexture); //applaying new texture drawTexture = result.Image; IOSMessage.Create("Success", "Image Successfully Loaded, Image size: " + result.Image.width + "x" + result.Image.height); } else { IOSMessage.Create("ERROR", "Image Load Failed"); } IOSCamera.OnImagePicked -= OnImage; }
private void OnNotificationScheduleResult(SA.Common.Models.Result res) { ISN_LocalNotificationsController.OnNotificationScheduleResult -= OnNotificationScheduleResult; string msg = string.Empty; if (res.IsSucceeded) { msg += "Notification was successfully scheduled\n allowed notifications types: \n"; } else { msg += "Notification scheduling failed"; } IOSMessage.Create("On Notification Schedule Result", msg); }
private void OnImage(IOSImagePickResult result) { if (result.IsSucceeded) { if (target.mainTexture != initialTexture) { DestroyImmediate(target.mainTexture, true); } target.mainTexture = result.Image; next.isEnabled = true; // IOSMessage.Create("Success", "Image Successfully Loaded, Image size: " + result.image.width + "x" + result.image.height); } else { IOSMessage.Create("Success", "Image Load Failed"); } isTaking = false; IOSCamera.OnImagePicked -= OnImage; }
void OnAuthFinished(SA.Common.Models.Result res) { _IsUILocked = true; IOSMessage msg = null; if (res.IsSucceeded) { msg = IOSMessage.Create("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Alias: " + GameCenterManager.Player.Alias); GameCenterManager.LoadLeaderboardInfo(TEST_LEADERBOARD_1); } else { msg = IOSMessage.Create("Game Center ", "Player authentication failed"); } msg.OnComplete += delegate { _IsUILocked = false; }; }
private void ShowDevoceInfo() { ISN_Device device = ISN_Device.CurrentDevice; IOSMessage.Create("Device Info", "Name: " + device.Name + "\n" + "System Name: " + device.SystemName + "\n" + "Model: " + device.Model + "\n" + "Localized Model: " + device.LocalizedModel + "\n" + "System Version: " + device.SystemVersion + "\n" + "Major System Version: " + device.MajorSystemVersion + "\n" + "Preferred Language Code: " + device.PreferredLanguageCode + "\n" + "Preferred Language_ISO639_1: " + device.PreferredLanguage_ISO639_1 + "\n" + "User Interface Idiom: " + device.InterfaceIdiom + "\n" + "GUID in Base64: " + device.GUID.Base64String); Debug.Log("ISN_TimeZone.LocalTimeZone.Name: " + ISN_TimeZone.LocalTimeZone.Name); Debug.Log("ISN_TimeZone.LocalTimeZone.SecondsFromGMT: " + ISN_TimeZone.LocalTimeZone.SecondsFromGMT); Debug.Log("ISN_TimeZone.LocalTimeZone.Name: " + ISN_Build.Current.Version); Debug.Log("ISN_TimeZone.LocalTimeZone.Name: " + ISN_Build.Current.Number); }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { ISN_LocalNotificationsController.OnLocalNotificationReceived += HandleOnLocalNotificationReceived; //Checking for a local launch notification if (ISN_LocalNotificationsController.Instance.LaunchNotification != null) { ISN_LocalNotification notification = ISN_LocalNotificationsController.Instance.LaunchNotification; IOSMessage.Create("Launch Notification", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data); } //Checking for a remote launch notification if (ISN_RemoteNotificationsController.Instance.LaunchNotification != null) { ISN_RemoteNotification notification = ISN_RemoteNotificationsController.Instance.LaunchNotification; IOSMessage.Create("Launch Remote Notification", "Body: " + notification.Body); } }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { ISN_LocalNotificationsController.OnLocalNotificationReceived += HandleOnLocalNotificationReceived; NotificationCenter.OnWillPresentNotification += (NotificationRequest obj) => { Debug.Log("OnWillPresentNotification: " + obj.Content); }; var launchNotification = NotificationCenter.LaunchNotification; if (launchNotification.Content != null) { IOSMessage.Create("Launch Notification", "Messgae: " + launchNotification.Content + "\nNotification ID: " + launchNotification.Id); } //Checking for a local launch notification if (ISN_LocalNotificationsController.Instance.LaunchNotification != null) { ISN_LocalNotification notification = ISN_LocalNotificationsController.Instance.LaunchNotification; IOSMessage.Create("Launch Notification", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data); } //Checking for a remote launch notification if (ISN_RemoteNotificationsController.Instance.LaunchNotification != null) { ISN_RemoteNotification notification = ISN_RemoteNotificationsController.Instance.LaunchNotification; IOSMessage.Create("Launch Remote Notification", "Body: " + notification.Body); } }
private void OnNotificationScheduleResult(ISN_Result res) { IOSNotificationController.instance.OnNotificationScheduleResult -= OnNotificationScheduleResult; string msg = string.Empty; if (res.IsSucceeded) { msg += "Notification was successfully scheduled\n allowed notifications types: \n"; if ((IOSNotificationController.AllowedNotificationsType & IOSUIUserNotificationType.Alert) != 0) { msg += "Alert "; } if ((IOSNotificationController.AllowedNotificationsType & IOSUIUserNotificationType.Sound) != 0) { msg += "Sound "; } if ((IOSNotificationController.AllowedNotificationsType & IOSUIUserNotificationType.Badge) != 0) { msg += "Badge "; } } else { msg += "Notification scheduling failed"; } IOSMessage.Create("On Notification Schedule Result", msg); }
void OnContinueUserActivity(SA.IOSNative.Models.UniversalLink link) { IOSMessage.Create("Universal Link Detecetd", link.AbsoluteUrl); }
private void UrlNotFound(CEvent e) { string url = e.data as string; IOSMessage.Create("Url Exists", "The " + url + " wasn't registred"); }
//-------------------------------------- // GET/SET //-------------------------------------- //-------------------------------------- // Actions //-------------------------------------- void HandleInterstitialAdDidFinishAction() { Debug.Log("OnInterstitialFinish action fired"); IOSMessage.Create("Ad Event", "Ad Did Finish"); }
private void UrlExcists(CEvent e) { string url = e.data as string; IOSMessage.Create("Url Exists", "The " + url + " is registred"); }
//-------------------------------------- // 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(); } }
void HandleOnLocalNotificationReceived(ISN_LocalNotification notification) { IOSMessage.Create("Notification Received", "Messgae: " + notification.Message + "\nNotification Data: " + notification.Data); }
void OnAdvertisingIdentifierLoadedAction(string Identifier) { IOSMessage.Create("Identifier Loaded", Identifier); }
void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "System Utils", style); //SA.IOSNative. StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Check if FB App exists")) { bool result = SA.IOSNative.System.SharedApplication.CheckUrl("fb://"); if (result) { IOSMessage.Create("Success", "Facebook App is installed on current device"); } else { IOSMessage.Create("ERROR", "Facebook App is not installed on current device"); } } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Open FB Profile")) { SA.IOSNative.System.SharedApplication.OpenUrl("fb://profile"); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Open App Store")) { SA.IOSNative.System.SharedApplication.OpenUrl("itms-apps://"); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get IFA")) { IOSMessage.Create("Identifier Loaded", ISN_Device.CurrentDevice.AdvertisingIdentifier); } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Set App Bages Count")) { IOSNativeUtility.SetApplicationBagesNumber(10); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Clear Application Bages")) { IOSNativeUtility.SetApplicationBagesNumber(0); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Device Info")) { ShowDevoceInfo(); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Pick Contacts UI")) { SA.IOSNative.Contacts.ContactStore.Instance.ShowContactsPickerUI((result) => { if (result.IsSucceeded) { Debug.Log("Picked " + result.Contacts.Count + " contacts"); IOSMessage.Create("Success", "Picked " + result.Contacts.Count + " contacts"); foreach (var contact in result.Contacts) { Debug.Log("contact.GivenName: " + contact.GivenName); if (contact.PhoneNumbers.Count > 0) { Debug.Log("contact.PhoneNumber: " + contact.PhoneNumbers[0].Digits); } if (contact.Emails.Count > 0) { Debug.Log("contact.Email: " + contact.Emails[0]); } } } else { IOSMessage.Create("Error", result.Error.Code + " / " + result.Error.Message); } }); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Contacts")) { SA.IOSNative.Contacts.ContactStore.Instance.RetrievePhoneContacts((result) => { if (result.IsSucceeded) { Debug.Log("Loaded " + result.Contacts.Count + " contacts"); IOSMessage.Create("Success", "Loaded " + result.Contacts.Count + " contacts"); foreach (var contact in result.Contacts) { if (contact.PhoneNumbers.Count > 0) { Debug.Log(contact.GivenName + " / " + contact.PhoneNumbers[0].Digits); } } } else { IOSMessage.Create("Error", result.Error.Code + " / " + result.Error.Message); } }); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Date Time Picker", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Time")) { IOSDateTimePicker.Instance.Show(IOSDateTimePickerMode.Time); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Date")) { IOSDateTimePicker.Instance.Show(IOSDateTimePickerMode.Date); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Date And Time")) { IOSDateTimePicker.Instance.Show(IOSDateTimePickerMode.DateAndTime); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Countdown Timer")) { IOSDateTimePicker.Instance.Show(IOSDateTimePickerMode.CountdownTimer); } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Set Date Without UI")) { IOSDateTimePicker.Instance.Show(IOSDateTimePickerMode.Date, time); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Video", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Player Streamed video")) { IOSVideoManager.Instance.PlayStreamingVideo("https://dl.dropboxusercontent.com/u/83133800/Important/Doosan/GT2100-Video.mov"); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Open YouTube Video")) { IOSVideoManager.Instance.OpenYouTubeVideo("xzCEdSKMkdU"); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Camera Roll", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth + 10, buttonHeight), "Save Screenshot To Camera Roll")) { IOSCamera.OnImageSaved += OnImageSaved; IOSCamera.Instance.SaveScreenshotToCameraRoll(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Save Texture To Camera Roll")) { IOSCamera.OnImageSaved += OnImageSaved; IOSCamera.Instance.SaveTextureToCameraRoll(hello_texture); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Image From Camera")) { IOSCamera.OnImagePicked += OnImage; IOSCamera.Instance.PickImage(ISN_ImageSource.Camera); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Image From Album")) { IOSCamera.OnImagePicked += OnImage; IOSCamera.Instance.PickImage(ISN_ImageSource.Album); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Multiple Images")) { ISN_FilePicker.MediaPickFinished += delegate(ISN_FilePickerResult res) { Debug.Log("Picked " + res.PickedImages.Count + " images"); if (res.PickedImages.Count == 0) { return; } //destroying old texture Destroy(drawTexture); //applaying new texture drawTexture = res.PickedImages[0]; }; ISN_FilePicker.Instance.PickFromCameraRoll(); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "PickedImage", style); StartY += YLableStep; if (drawTexture != null) { GUI.DrawTexture(new Rect(StartX, StartY, buttonWidth, buttonWidth), drawTexture); } }
//-------------------------------------- // EVENTS //-------------------------------------- void OnOpenURL(SA.IOSNative.Models.LaunchUrl url) { IOSMessage.Create("Open URL Detecetd", url.AbsoluteUrl); }
private void init(string title, string message, string ok) { #if UNITY_IPHONE IOSMessage.Create(title, message, ok); #endif }