Example #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);
        }
    }
Example #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;
    }
Example #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);
        }
    }
Example #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());
         }
     }
 }
Example #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;
        }
    }
Example #6
0
 void Start()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(
         villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES);
 }
Example #7
0
 public void cancelAllNotifications()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelAllNotificationsForCurrentUser();
 }
Example #8
0
 public void cancelAll5MinsNotifications()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledTypeOfNotifications(test2);
 }
Example #9
0
 public void cancelLastNotification()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).cancelScheduledNotification(lastNotification);
 }
Example #10
0
 public void setNotification5Minute()
 {
     lastNotification = (LocalNotificationManager.GetInstance() as LocalNotificationManager).scheduleNotificationByName(test2);
 }
Example #11
0
 public void setNotification1Minute()
 {
     (LocalNotificationManager.GetInstance() as LocalNotificationManager).scheduleNotificationByName(test1);
 }