private void OnDestroy() { TrayNotificationManager obj = trayNotificationManager; obj.NotificationStart = (Action <DNotification>)Delegate.Remove(obj.NotificationStart, new Action <DNotification>(onNotificationStart)); TrayNotificationManager obj2 = trayNotificationManager; obj2.NotificationDismissed = (Action <NotificationCompleteEnum, DNotification>)Delegate.Remove(obj2.NotificationDismissed, new Action <NotificationCompleteEnum, DNotification>(onNotificationDismissed)); }
public static void ShowTestNotification(string message = "Test message", float delayTime = 5f, bool containsButtons = false, DNotification.NotificationType type = DNotification.NotificationType.Generic) { DNotification dNotification = new DNotification(); dNotification.ContainsButtons = containsButtons; dNotification.Message = message; dNotification.PopUpDelayTime = delayTime; dNotification.Type = type; if (containsButtons) { TrayNotificationManager trayNotificationManager = Service.Get <TrayNotificationManager>(); trayNotificationManager.NotificationDismissed = (Action <NotificationCompleteEnum, DNotification>)Delegate.Combine(trayNotificationManager.NotificationDismissed, new Action <NotificationCompleteEnum, DNotification>(onNotificationDismissed)); } Service.Get <TrayNotificationManager>().ShowNotification(dNotification); }
private void Start() { trayNotificationManager = Service.Get <TrayNotificationManager>(); TrayNotificationManager obj = trayNotificationManager; obj.NotificationStart = (Action <DNotification>)Delegate.Combine(obj.NotificationStart, new Action <DNotification>(onNotificationStart)); TrayNotificationManager obj2 = trayNotificationManager; obj2.NotificationDismissed = (Action <NotificationCompleteEnum, DNotification>)Delegate.Combine(obj2.NotificationDismissed, new Action <NotificationCompleteEnum, DNotification>(onNotificationDismissed)); start(); if (trayNotificationManager.IsShowingNotification && trayNotificationManager.DisplayingNotificationData.AdjustRectPositionForNotification && trayNotificationManager.DisplayingNotificationData.Type != DNotification.NotificationType.DailyComplete && trayNotificationManager.DisplayingNotificationData.Type != DNotification.NotificationType.ActivityTracker) { CoroutineRunner.Start(moveDownDelayed(), this, ""); } }
private static void onNotificationDismissed(NotificationCompleteEnum notificationOutcome, DNotification notification) { TrayNotificationManager trayNotificationManager = Service.Get <TrayNotificationManager>(); trayNotificationManager.NotificationDismissed = (Action <NotificationCompleteEnum, DNotification>)Delegate.Remove(trayNotificationManager.NotificationDismissed, new Action <NotificationCompleteEnum, DNotification>(onNotificationDismissed)); DNotification dNotification = new DNotification(); dNotification.PopUpDelayTime = 5f; switch (notificationOutcome) { case NotificationCompleteEnum.acceptButton: dNotification.Message = "Accepted"; Service.Get <TrayNotificationManager>().ShowNotification(dNotification); break; case NotificationCompleteEnum.declineButton: dNotification.Message = "Declined"; Service.Get <TrayNotificationManager>().ShowNotification(dNotification); break; } }