private IEnumerator loadNotificationPrefab() { PrefabContentKey prefabLocation = notificationData.PrefabLocation; if (prefabLocation == null || string.IsNullOrEmpty(prefabLocation.Key)) { prefabLocation = TrayNotificationManager.NonDisruptiveNotificationContentKey; } AssetRequest <GameObject> asset = Content.LoadAsync(prefabLocation); yield return(asset); GameObject loadedGameObject = UnityEngine.Object.Instantiate(asset.Asset); loadedGameObject.transform.SetParent(notificationParentTransform, worldPositionStays: false); notification = loadedGameObject.GetComponent <TrayNotification>(); if (notification == null) { throw new NullReferenceException("Unable to retrieve TrayNotification component in asset. Please check path: " + notificationData.PrefabLocation); } TrayNotification trayNotification = notification; trayNotification.ENotificationCompleted = (Action <NotificationCompleteEnum>)Delegate.Combine(trayNotification.ENotificationCompleted, new Action <NotificationCompleteEnum>(notificationTrayComplete)); notification.Show(notificationData); if (NotificationCreated != null) { NotificationCreated(notification); } }
private void notificationTrayComplete(NotificationCompleteEnum completed) { TrayNotification trayNotification = notification; trayNotification.ENotificationCompleted = (Action <NotificationCompleteEnum>)Delegate.Remove(trayNotification.ENotificationCompleted, new Action <NotificationCompleteEnum>(notificationTrayComplete)); if (NotificationDismissed != null) { NotificationDismissed(completed, notificationData); NotificationDismissed = null; } UnityEngine.Object.Destroy(notification.gameObject); }
private void notificationComplete(NotificationCompleteEnum notificationOutcome, DNotification notificationData) { currentNotification = null; if (notificationOutcome == NotificationCompleteEnum.leftRoom && persistCurrentNotification) { reshowPreviousNotification = true; return; } if (NotificationDismissed != null) { NotificationDismissed(notificationOutcome, notificationData); } showingNotification = false; checkQueue(); }
private void onNotificationCreated(TrayNotification notification) { currentNotification = notification; }