Beispiel #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];
                }
            }
        }
    }
Beispiel #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);
                }
            }
        }
    }
Beispiel #3
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();
    }
Beispiel #4
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();
    }
Beispiel #5
0
 public void Start()
 {
     manager = TherapiePlanManager.instance;
     therapiePanel.UpdateList(manager.TherapiePlan.Therapien);
 }
Beispiel #6
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);
        }
    }