Exemple #1
0
    //Init the InhaTimes list and fill it with the physiotherapy times from activetherapies
    void InitInhaTimes()
    {
        TherapiePlanManager manager = TherapiePlanManager.instance;

        inhaTimes = new List <float>();
        foreach (float time in manager.AktiveTherapieZeiten)
        {
            int dayOfWeek = (int)System.DateTime.Now.DayOfWeek - 1;
            dayOfWeek = dayOfWeek < 0 ? 6 : dayOfWeek;

            //If the time is from yesterday
            if (time > System.DateTime.Now.Hour)
            {
                dayOfWeek -= 1;
                dayOfWeek  = dayOfWeek < 0 ? 6 : dayOfWeek;
            }

            foreach (TherapiePlan.TherapieInfo therapieInfo in manager.TherapiePlan.GetTherapieInfoFor(dayOfWeek, time))
            {
                Therapie   t    = manager.TherapiePlan.Therapien[therapieInfo.index];
                Inhalation inha = t as Inhalation;
                if (inha != null)
                {
                    inhaTimes.Add(time);
                    int i = inha.Times.IndexOf(time);
                    m_fLengthInhalationMin = inha.Durations[i];
                }
            }
        }
    }
Exemple #2
0
    //Init the Physiotimes list and fill it with the physiotherapy times from activetherapies
    void InitPhysioTimes()
    {
        TherapiePlanManager manager = TherapiePlanManager.instance;

        physioTimes = new List <float>();
        foreach (float time in manager.AktiveTherapieZeiten)
        {
            int dayOfWeek = (int)System.DateTime.Now.DayOfWeek - 1;
            dayOfWeek = dayOfWeek < 0 ? 6 : dayOfWeek;

            //If the time is from yesterday
            if (time > System.DateTime.Now.Hour)
            {
                dayOfWeek -= 1;
                dayOfWeek  = dayOfWeek < 0 ? 6 : dayOfWeek;
            }

            foreach (TherapiePlan.TherapieInfo therapieInfo in manager.TherapiePlan.GetTherapieInfoFor(dayOfWeek, time))
            {
                Therapie       t = manager.TherapiePlan.Therapien[therapieInfo.index];
                Physiotherapie p = t as Physiotherapie;
                if (p != null)
                {
                    physioTimes.Add(time);
                }
            }
        }
    }
Exemple #3
0
    public void AddElement(Therapie _therapie)
    {
        TherapieListElement element = GameObject.Instantiate(therapyListElementPrefab, transform).GetComponent <TherapieListElement>();

        element.SetTherapie(_therapie);
        elements.Add(element);
    }
Exemple #4
0
    public void SpawnAllMedicine()
    {
        removalList = new List <float>();
        TherapiePlanManager manager = TherapiePlanManager.instance;

        if (manager == null)
        {
            Debug.LogError("No Manager on MedizinButton");
            return;
        }
        foreach (float time in manager.AktiveTherapieZeiten)
        {
            int dayOfWeek = (int)System.DateTime.Now.DayOfWeek - 1;
            dayOfWeek = dayOfWeek < 0 ? 6 : dayOfWeek;

            //If the time is from yesterday
            if (time > System.DateTime.Now.Hour)
            {
                dayOfWeek -= 1;
                dayOfWeek  = dayOfWeek < 0 ? 6 : dayOfWeek;
            }

            foreach (TherapiePlan.TherapieInfo therapieInfo in manager.TherapiePlan.GetTherapieInfoFor(dayOfWeek, time))
            {
                Therapie t = manager.TherapiePlan.Therapien[therapieInfo.index];
                if (therapieInfo.count != 0)
                {
                    Debug.Log("Spawn" + therapieInfo.count + t.Name);

                    for (int i = 0; i < therapieInfo.count; i++)
                    {
                        //Spawn medikamente
                        SpriteRenderer sprite = Instantiate(medicamentPrefab).GetComponent <SpriteRenderer>();
                        sprite.sprite = images[(t as Medikament).ImageIndex];
                        sprite.color  = (t as Medikament).Color;
                    }
                    removalList.Add(time);
                }
            }
        }
        foreach (float time in removalList)
        {
            manager.RemoveActiveTherapy(time);
        }
        removalList.Clear();
        ButtonWiggleBlinkManager.instance.CheckActiveTherapies();
    }
Exemple #5
0
    public void EditTherapie(Therapie _therapie)
    {
        Reset();
        therapieName   = _therapie.Name;
        inputName.text = therapieName;

        times = _therapie.Times;
        _therapie.Weekdays.CopyTo(weekdays, 0);

        for (int i = 0; i < 7; i++)
        {
            tgWeekDays[i].isOn = weekdays[i];
        }

        if (_therapie is Medikament)
        {
            therapieTyp = TherapieTyp.MEDIKAMENT;
            Medikament medi = (_therapie as Medikament);
            counts     = medi.Counts;
            imageIndex = medi.ImageIndex;
            FindColorIndex(medi.Color);
            ShowActiveColor();
            manager.TherapiePlan.RemoveMedikament(medi);
        }
        else if (_therapie is Inhalation)
        {
            therapieTyp = TherapieTyp.INHALATION;
            Inhalation inha = (_therapie as Inhalation);
            durations = inha.Durations;
            manager.TherapiePlan.RemoveInhalation(inha);
        }
        else
        {
            therapieTyp = TherapieTyp.PHYSIOTHERAPIE;
            manager.TherapiePlan.RemovePhysiotherapie(_therapie as Physiotherapie);
        }
        ShowActiveImage();
        therapiePlanCanvas.SetActive(false);
        therapieNeuCanvas.SetActive(true);
        timesListPanel.UpdateList(times, counts, durations);
        therapiePanel.UpdateList(manager.TherapiePlan.Therapien);
        manager.needsToSave = true;
    }
Exemple #6
0
    public void SetTherapie(Therapie _therapie)
    {
        therapie = _therapie;

        if (therapie is Medikament)
        {
            GetComponent <Image>().color = colorMedi;
        }
        else if (therapie is Inhalation)
        {
            GetComponent <Image>().color = colorInha;
        }
        else
        {
            GetComponent <Image>().color = colorPhysi;
        }

        therapyName.text = therapie.Name;

        bool[] weekdays = therapie.Weekdays;
        string days     = "";
        int    allCount = 0;

        if (weekdays[0])
        {
            days += "Mo ";
            allCount++;
        }
        if (weekdays[1])
        {
            days += "Di ";
            allCount++;
        }
        if (weekdays[2])
        {
            days += "Mi ";
            allCount++;
        }
        if (weekdays[3])
        {
            days += "Do ";
            allCount++;
        }
        if (weekdays[4])
        {
            days += "Fr ";
            allCount++;
        }
        if (weekdays[5])
        {
            days += "Sa ";
            allCount++;
        }

        if (weekdays[6])
        {
            days += "So ";
            allCount++;
        }

        if (allCount > 6)
        {
            days = "Täglich";
        }

        therapyWeekdays.text = days;

        string times = "";

        for (int i = 0; i < therapie.Times.Count; i++)
        {
            if (i > 2)
            {
                times += "...";
                break;
            }
            int[] hm = TherapiePlan.TimeFloatToInt(therapie.Times[i]);
            times += hm[0] + ":" + hm[1].ToString("D2");
            if (therapie is Medikament)
            {
                times += "(" + (therapie as Medikament).Counts[i] + ")";
            }
            else if (therapie is Inhalation)
            {
                int[] time = TherapiePlan.TimeFloatToInt((therapie as Inhalation).Durations[i]);
                times += "(" + time[0] + ":" + time[1].ToString("D2") + ")";
            }
            times += "\n";
        }
        therapyTimes.text = times;
    }
Exemple #7
0
 public void RemoveTherapie(Therapie _therapie)
 {
     therapieListe.Remove(_therapie);
     BuildCalendar();
 }
Exemple #8
0
 public void AddTherapie(Therapie _therapie)
 {
     therapieListe.Add(_therapie);
     BuildCalendar();
 }
Exemple #9
0
    public void CheckActiveTherapies()
    {
        //Reset All
        mediWiggle      = false;
        inhaWiggle      = false;
        physiWiggle     = false;
        rightArrowBlink = false;

        TherapiePlanManager manager = TherapiePlanManager.instance;

        if (manager == null)
        {
            Debug.LogError("No Manager on MedizinButton");
            return;
        }

        foreach (float time in manager.AktiveTherapieZeiten)
        {
            int dayOfWeek = (int)System.DateTime.Now.DayOfWeek - 1;
            dayOfWeek = dayOfWeek < 0 ? 6 : dayOfWeek;

            //If the time is from yesterday
            if (time > System.DateTime.Now.Hour)
            {
                dayOfWeek -= 1;
                dayOfWeek  = dayOfWeek < 0 ? 6 : dayOfWeek;
            }

            List <TherapiePlan.TherapieInfo> list = manager.TherapiePlan.GetTherapieInfoFor(dayOfWeek, time);
            if (list != null)
            {
                foreach (TherapiePlan.TherapieInfo therapieInfo in list)
                {
                    Therapie t = manager.TherapiePlan.Therapien[therapieInfo.index];
                    if (therapieInfo.count != 0)
                    {
                        mediWiggle = true;
                    }
                    else if (therapieInfo.duration != 0)
                    {
                        inhaWiggle = true;
                    }
                    else
                    {
                        physiWiggle = true;
                    }
                }
            }
            else
            {
                Debug.Log("This list does not exist in calendar" + dayOfWeek + "|" + time);
            }
        }


        if (mediWiggle || inhaWiggle || physiWiggle)
        {
            rightArrowBlink = true;
        }

        if (mediEvent != null)
        {
            mediEvent(mediWiggle);
        }
        if (inhaEvent != null)
        {
            inhaEvent(inhaWiggle);
        }
        if (physiEvent != null)
        {
            physiEvent(physiWiggle);
        }
        if (rightArrowEvent != null)
        {
            rightArrowEvent(rightArrowBlink);
        }
    }