Пример #1
0
        private void AddRow()
        {
            IsEditing = true;
            Data data = new Data("", "", "");

            dataModel.AddData(data);
        }
Пример #2
0
    //calculates the treatment assignment results for today;
    //creates a next day and displays it;
    //checks if player has reached a lose/win state;
    public IEnumerator taskOnClick()
    {
        //Calculate treatment decisions/apply treatment;
        if (state == 0)
        {
            if (clicked == true)
            {
                nextDay.enabled = false;
                lefty.GetComponent <Slider> ().enabled  = false;
                righty.GetComponent <Slider> ().enabled = false;
                world.calculate(init);
                if (world.totalDays() == 1)
                {
                    end = "none";
                    csv.firstDayAdder(world, init);
                }
                else
                {
                    csv.nextDayAdder(world, init);
                }

                data.AddData(world, init);
                //scoreList.UpdateTable();


                txt.updateText(world, 1);
                fill.nextDay(world, 1);

                //1. cure people in clinic and population
                yield return(StartCoroutine(spawner.cure(init, world)));

                spawner2.cure(init, world);


                //2. make cured/still sick people move from clinic to population
                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("Pump", true);
                pump.Play();
                yield return(StartCoroutine(spawner.disappear()));

                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("Pump", false);

                yield return(StartCoroutine(spawner2.appear()));

                clicked = false;
            }
            //Create a New Day;
            if (checker == true && end == "none")
            {
                world.nextDay(init);
                PercentageSlider.setter();
                txt.updateDay(world, 1);

                //commented out for now since we don't want to reset the values to 0;
                //lefty.GetComponent<Slider> ().value = 0f;
                //righty.GetComponent<Slider> ().value = 0f;

                //3. make people catch disease in population
                yield return(StartCoroutine(spawner2.catchDisease(world)));

                //yield return new WaitForSecondsRealtime (1f);

                //4. move sick people from population to clinic

                yield return(StartCoroutine(spawner2.disappear()));

                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("PumpBack", true);
                //yield return new WaitForSecondsRealtime (1f);
                yield return(StartCoroutine(spawner.appear(world)));

                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("PumpBack", false);

                end = StopRule.check(world, init);

                if (end != "none")
                {
                    world.calculate(init);
                    go.gmOver(end);
                    yield return(null);
                }
                else
                {
                    checker         = false;
                    nextDay.enabled = true;
                    lefty.GetComponent <Slider> ().enabled  = true;
                    righty.GetComponent <Slider> ().enabled = true;
                    txt.sickUpdate(world);
                }
                yield return(null);
            }
            yield return(null);
        }
        yield return(null);
    }