private void StartDriveNotification()
    {
        IGameNotification startNotification = notificationManager.CreateNotification();

        startNotification.Title = "Rider Reminder";
        startNotification.Body  = "Click to launch app";

        startNotification.DeliveryTime = System.DateTime.Now.AddSeconds(3f);

        notificationManager.ScheduleNotification(startNotification);
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Queue a notification with the given parameters.
        /// </summary>
        /// <param name="title">The title for the notification.</param>
        /// <param name="body">The body text for the notification.</param>
        /// <param name="deliveryTime">The time to deliver the notification.</param>
        /// <param name="badgeNumber">The optional badge number to display on the application icon.</param>
        /// <param name="reschedule">
        /// Whether to reschedule the notification if foregrounding and the notification hasn't yet been shown.
        /// </param>
        /// <param name="channelId">Channel ID to use. If this is null/empty then it will use the default ID. For Android
        /// the channel must be registered in <see cref="GameNotificationsManager.Initialize"/>.</param>
        /// <param name="smallIcon">Notification small icon.</param>
        /// <param name="largeIcon">Notification large icon.</param>
        public void SendNotification(string title, string body, DateTime deliveryTime, int?badgeNumber = null,
                                     bool reschedule  = false, string channelId = null,
                                     string smallIcon = null, string largeIcon  = null)
        {
            IGameNotification notification = manager.CreateNotification();

            if (notification == null)
            {
                return;
            }

            notification.Title        = title;
            notification.Body         = body;
            notification.Group        = !string.IsNullOrEmpty(channelId) ? channelId : ChannelId;
            notification.DeliveryTime = deliveryTime;
            notification.SmallIcon    = smallIcon;
            notification.LargeIcon    = largeIcon;
            if (badgeNumber != null)
            {
                notification.BadgeNumber = badgeNumber;
            }

            PendingNotification notificationToDisplay = manager.ScheduleNotification(notification);

            notificationToDisplay.Reschedule = reschedule;
            updatePendingNotifications       = true;

            QueueEvent($"Queued event with ID \"{notification.Id}\" at time {deliveryTime:HH:mm}");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create notifications for the host system in realtime game mode.
        /// </summary>
        private void CreateRealtimeModeNotifications()
        {
            List <HostNotification> notifications = MissionManager.Instance.GenerateHostNotifications();
            int remainingTicksPayday = GameTime.GameTime.Instance.RemainingTicksTillPayday();

            notifications.Append(new HostNotification("Payday arrives soon!", "",
                                                      (int)Math.Max(remainingTicksPayday * GameTime.GameTime.Instance.RealtimeMinutesPerTick, 60)));
            if (EmployeeManager.Instance.AllEmployeesIdle())
            {
                notifications.Append(new HostNotification("Your employees don't have anything to do.", "",
                                                          120));
            }

            foreach (var notification in notifications)
            {
                IGameNotification n = NotificationsManager.CreateNotification();
                n.Title     = notification.Title;
                n.Body      = notification.Body;
                n.SmallIcon = "small";
                n.LargeIcon = "large";
                DateTime date = DateTime.Now;
                n.DeliveryTime = date.Add(new TimeSpan(0, notification.Delay, 0));
                NotificationsManager.ScheduleNotification(n);
            }
        }
Ejemplo n.º 4
0
    public void SendNotification(string title, string body, DateTime deliveryTime, int?badgeNumber = null, bool reschedule = false, string channelId = null, string smallIcon = null, string largeIcon = null)
    {
        IGameNotification notification = manager.CreateNotification();

        if (notification == null)
        {
            return;
        }
        notification.Title = title;
        notification.Body  = body;
        notification.Group =
            !string.IsNullOrEmpty(channelId) ? channelId : NOTIFICATION_CHANNEL_ID;
        notification.DeliveryTime = deliveryTime;
        notification.SmallIcon    = smallIcon;
        notification.LargeIcon    = largeIcon;
        if (badgeNumber != null)
        {
            notification.BadgeNumber = badgeNumber;
        }
        PendingNotification notificationToDisplay = manager.ScheduleNotification(notification);

        notificationToDisplay.Reschedule = reschedule;
        //
        Debug.Log($"Queued notification for unactivity with ID \"{notification.Id}\" at time {deliveryTime:dd.MM.yyyy HH:mm:ss}");
    }
Ejemplo n.º 5
0
    public void CreateNotifocation(string title, string body, DateTime delay)      //метод создания оповещения(передаться заголовок, описание и время отправления(по желанию картинка, но я не писал)
    {
        IGameNotification notification = notificationManager.CreateNotification(); //обьясляем переменную оповещения в менеджере

        if (notification != null)                                                  //если создалось
        {
            notification.Title        = title;                                     //заголовок оповещения
            notification.Body         = body;                                      //тело оповещени
            notification.DeliveryTime = delay;                                     //DateTime.Now.AddSeconds(3); время отправления
            notificationManager.ScheduleNotification(notification);                //Отправка оповещения
        }
    }
Ejemplo n.º 6
0
    private void CreateNotification(string title, string body, System.DateTime time)
    {
        IGameNotification notification = notificationsManager.CreateNotification();

        if (notification != null)
        {
            notification.Title        = title;
            notification.Body         = body;
            notification.DeliveryTime = time;
            notification.SmallIcon    = "icon_0";
            notificationsManager.ScheduleNotification(notification);
        }
    }
Ejemplo n.º 7
0
    public void CreateAndSentNotificationSecondVer(string title, string textOfMessage, double time) /// Рабочая версия
    {
        loadPersonInfoFromFilesScript.personNotification.Add(new LoadPersonInfoFromFilesScript.notificationObject(textOfMessage, DateTime.Now.AddSeconds(time).ToShortDateString() + " " + DateTime.Now.AddSeconds(time).ToShortTimeString()));

        IGameNotification notification = gameNotificationManager.CreateNotification();

        if (notification != null)
        {
            notification.Title        = title;
            notification.Body         = textOfMessage;
            notification.DeliveryTime = DateTime.Now.AddSeconds(time);
            gameNotificationManager.ScheduleNotification(notification);
        }
    }
Ejemplo n.º 8
0
    public void ShowNotification(string title,
                                 string body,
                                 DateTime deliveryTime)
    {
        IGameNotification notification =
            notificationsManager.CreateNotification();

        if (notification != null)
        {
            notification.Title        = title;
            notification.Body         = body;
            notification.DeliveryTime = deliveryTime;

            notificationsManager.ScheduleNotification(notification);
        }
    }