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 completed)
        {
            TrayNotification trayNotification = currentNotification;

            trayNotification.ENotificationCompleted = (Action <NotificationCompleteEnum>)Delegate.Remove(trayNotification.ENotificationCompleted, new Action <NotificationCompleteEnum>(notificationComplete));
            currentNotificationPanel.SetActive(value: false);
            DNotification arg = notificationData;

            notificationData = null;
            if (NotificationDismissed != null)
            {
                NotificationDismissed(completed, arg);
            }
            SetParticlesActive(state: false);
        }
        public void ShowNotification(DNotification notificationData)
        {
            this.notificationData = notificationData;
            switch (notificationData.Type)
            {
            case DNotification.NotificationType.DailyComplete:
                currentNotificationPanel = DailyNotificationPanel;
                currentNotification      = DailyNotification;
                break;

            case DNotification.NotificationType.ActivityTracker:
                currentNotificationPanel = ActivityTrackerNotificationPanel;
                currentNotification      = ActivityTrackerNotification;
                break;
            }
            currentNotificationPanel.SetActive(value: true);
            TrayNotification trayNotification = currentNotification;

            trayNotification.ENotificationCompleted = (Action <NotificationCompleteEnum>)Delegate.Combine(trayNotification.ENotificationCompleted, new Action <NotificationCompleteEnum>(notificationComplete));
            currentNotification.Show(notificationData);
            SetParticlesActive(state: true);
        }
Exemplo n.º 5
0
 void ProcessBalloon(TrayNotification currentNotifyEvent)
 {
     _lastTrayBalloon = CreateBalloon(currentNotifyEvent.Title,
                                      currentNotifyEvent.Message);
     TaskbarIcon.ShowCustomBalloon(_lastTrayBalloon, PopupAnimation.Slide, null);
 }