Пример #1
0
    public void takeALife()
    {
        KuberaUser tempUsr = currentUser;

        if (tempUsr.playerLifes == maximumLifes)
        {
            setLifeDate();

            currentMinutes = timeForLifeInMinutes;
            currentSeconds = 0;
        }

        giveLifesToUser(-1);

        showTimer = true;

        //setLifeDate ();

        //LocalNotification*******De cuando se queda sin vidas y gana 1 vida
        if (tempUsr.playerLifes == 0)
        {
            int currentLevel = tempUsr.levels.Count;

            life1NotificationID = (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                villavanilla.Notifications.ERegisteredNotification.LIFE_1,
                MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_LIFE1).Replace("{{level}}", currentLevel.ToString()),
                "Kubera", timeForLifeInMinutes * 60.0);
        }
    }
Пример #2
0
    protected void setNoPlayingDaysNotifications()
    {
        //86400 sconds per day

        if (DataManagerKubera.GetCastedInstance <DataManagerKubera> () != null)
        {
            //3 days
            int currentLevel = DataManagerKubera.GetCastedInstance <DataManagerKubera> ().currentUser.levels.Count + 1;
            (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
                MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_3_DAYS).Replace("{{level}}", currentLevel.ToString()),
                "Kubera", 259200);
        }

        //7 days
        (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
            villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
            MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_7_DAYS),
            "Kubera", 604800);

        //14 days
        (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
            villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
            MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_14_DAYS),
            "Kubera", 1209600);

        //30 days
        (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
            villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES,
            MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_30_DAYS),
            "Kubera", 2592000);

        scheduled = true;
    }
Пример #3
0
    public void giveALife(int amount = 1, bool fromGame = false)
    {
        gotALife(amount, fromGame);

        //CancelLocalNotification*******De cuando se queda sin vidas y gana 1 vida
        if (currentUser.playerLifes == 1)
        {
            (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledNotification(life1NotificationID);
        }
    }
Пример #4
0
 protected void setFullLifesNotification()
 {
     if (LifesManager.GetInstance() != null)
     {
         if (LifesManager.GetInstance().getTimeToWait() > 5)
         {
             (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName(
                 villavanilla.Notifications.ERegisteredNotification.FULL_LIFES,
                 MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_FULL_LIFES),
                 "Kubera", LifesManager.GetInstance().getTimeToWait());
         }
     }
 }
Пример #5
0
    void OnApplicationPause(bool pauseStatus)
    {
        if (pauseStatus && !scheduled)
        {
            setNoPlayingDaysNotifications();

            setFullLifesNotification();
        }
        else if (LocalNotificationManager.GetInstance().currentUserId != null)
        {
            (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(
                villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES);

            scheduled = false;
        }
    }
Пример #6
0
 void Start()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(
         villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES);
 }
Пример #7
0
 public void cancelAllNotifications()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelAllNotificationsForCurrentUser();
 }
Пример #8
0
 public void cancelAll5MinsNotifications()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(test2);
 }
Пример #9
0
 public void cancelLastNotification()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledNotification(lastNotification);
 }
Пример #10
0
 public void setNotification5Minute()
 {
     lastNotification = (LocalNotificationManager.GetInstance() as LocalNotificationManager).scheduleNotificationByName(test2);
 }
Пример #11
0
 public void setNotification1Minute()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).scheduleNotificationByName(test1);
 }