Ejemplo n.º 1
0
    public void SetValues(float _time, int _count, float _duration)
    {
        ftime     = _time;
        icount    = _count;
        fduration = _duration;
        int[] time = TherapiePlan.TimeFloatToInt(_time);
        time_hour.text   = time[0].ToString();
        time_minute.text = time[1].ToString("D2");

        countField.text  = icount.ToString();
        countField.color = icount == 0 ? fadedColor : normalColor;


        int[] duration = TherapiePlan.TimeFloatToInt(_duration);
        duration_min.text = duration[0].ToString();
        duration_sec.text = duration[1].ToString("D2");

        duration_min.color = fduration == 0.0f ? fadedColor : normalColor;
        duration_sec.color = fduration == 0.0f ? fadedColor : normalColor;
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Awake()
    {
        if (instance != null)
        {
            Destroy(this);
        }
        else
        {
            instance = this;
        }

        //DontDestroyOnLoad(gameObject);
        savePath = Application.persistentDataPath + "/PlanData.dat";
        //init new List
        therapiePlan         = new TherapiePlan();
        aktiveTherapieZeiten = new List <float>();
        //fill new List with SavedData
        LoadDataFromDisk();
        //Init Inheritance List
        therapiePlan.InitTherapieListe();
        therapiePlan.BuildCalendar();
    }
Ejemplo n.º 3
0
 //Lädt den Therapieplan aus einer Binärdatei
 public void LoadDataFromDisk()
 {
     if (File.Exists(savePath))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(savePath, FileMode.Open);
         DataToSave      data = (DataToSave)bf.Deserialize(file);
         if (data.plan != null)
         {
             therapiePlan = data.plan;
         }
         else
         {
             Debug.LogWarning("Die Daten enthalten keinen Therapieplan.");
         }
         if (data.actives != null)
         {
             aktiveTherapieZeiten = data.actives;
         }
         else
         {
             Debug.LogWarning("Die Daten enthalten keine aktiven Therapiezeiten.");
         }
         if (DateTime.Today == new DateTime(data.savingYear, data.savingMonth, data.savingDay))
         {
             latestTimeCheckedToday = data.latestTime;
         }
         else
         {
             latestTimeCheckedToday = 0;
         }
         file.Close();
     }
     else
     {
         Debug.LogWarning("Es gibt keinen gespeicherten Therapieplan.");
     }
 }
Ejemplo n.º 4
0
    public void AddTime()
    {
        float fTime = TherapiePlan.TimeIntToFloat(hour, minute);

        //If this timeslot is already taken, do not add it
        if (times.Contains(fTime))
        {
            return;
        }

        //Add timeslot to list
        times.Add(fTime);
        //Add count/duration depending on TherapieType
        if (therapieTyp == TherapieTyp.MEDIKAMENT)
        {
            counts.Add(count);
        }
        else if (therapieTyp == TherapieTyp.INHALATION)
        {
            durations.Add(duration);
        }
        //Update the timeListPanel to show the new Timeslot
        timesListPanel.UpdateList(times, counts, durations);
    }
Ejemplo n.º 5
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;
    }
Ejemplo n.º 6
0
 public void SetDurationSeconds(int i)
 {
     durSec   = i;
     duration = TherapiePlan.TimeIntToFloat(durMin, durSec);
 }
Ejemplo n.º 7
0
 public void SetDurationMinute(int i)
 {
     durMin   = i;
     duration = TherapiePlan.TimeIntToFloat(durMin, durSec);
 }