Exemplo n.º 1
0
    public void checkstate()
    {
        Text text = InfoModeText.GetComponent <Text>();

        if (gm.state == "Options")
        {
            text.text = "Options";
            AllOptions.SetActive(true);
            PoseWavePanel.SetActive(false);
            modepanel.SetActive(false);
        }
        else if (gm.state == "Information")
        {
            text.text = "Information";
            AllOptions.SetActive(false);
            PoseWavePanel.SetActive(false);
            modepanel.SetActive(false);
        }
        else if (gm.state == "SwitchingPose")
        {
            text.text = "Here you can choose needed mode or pose";
            AllOptions.SetActive(false);
            PoseWavePanel.SetActive(true);
            for (int i = 0; i < 5; i++)
            {
                ModeButtons[i].interactable = false;
                ModeButtons[i].GetComponent <Image>().color = new Color(1, 1, 1, 0.5f);
                ModeButtons[5].interactable = true;
                ModeButtons[5].GetComponent <Image>().color = new Color(1, 1, 1, 1);
            }
            if (Input.touchCount > 0)
            {
                Touch touch = Input.GetTouch(0);
                if (touch.phase == TouchPhase.Began)
                {
                    beginpoint = touch.position;
                }
                else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Moved)
                {
                    endpoint       = touch.position;
                    touchdirection = (endpoint - beginpoint).normalized;
                    PoseWavePanel.transform.Translate(new Vector3(touchdirection.x, 0, 0) * 1000 * Time.deltaTime);
                }
            }
            // gm.mode = null;
        }
        else if (gm.state == "Quit")
        {
            text.text  = "Quitting from app.\n Please wait untill calibration";
            text.color = Color.red;
            MotionPanel.SetActive(false);
            StartStopPanel.SetActive(false);
            AllOptions.SetActive(false);
            PoseWavePanel.SetActive(false);
            anglepanel.SetActive(false);
            foreach (Button mode in ModeButtons)
            {
                mode.interactable = false;
            }
            gm.mode = null;
            foreach (Button option in OptionButtons)
            {
                option.GetComponent <Button>().interactable = false;
            }
        }
        else if (gm.state == "Chair" || gm.state == "ModifiedChair" || gm.state == "Dinner" || gm.state == "Verticalize" || gm.state == "AntiModifiedChair")
        {
            text.text = "Calibrating to " + gm.state + " position";
            gm.mode   = null;
            foreach (Button option in OptionButtons)
            {
                option.GetComponent <Button>().interactable = false;
            }
            foreach (Button mode in ModeButtons)
            {
                mode.GetComponent <Button>().interactable = false;
            }
            StartStopPanel.SetActive(false);
            MotionPanel.SetActive(false);
            PoseWavePanel.SetActive(false);
        }
        else
        {
            if (gm.state != "Calibrating")
            {
                modepanel.SetActive(true);
                AllOptions.SetActive(false);
                PoseWavePanel.SetActive(false);
                foreach (Button option in OptionButtons)
                {
                    option.GetComponent <Button>().interactable = true;
                }
            }
        }
    }
Exemplo n.º 2
0
    public void checktextinfo()
    {
        Text text = InfoModeText.GetComponent <Text>();

        text.color = Color.white;
        if (gm.mode == "HeadMode" || gm.mode == "BodyMode" || gm.mode == "LegMode" || gm.mode == "SpineMode")
        {
            anglepanel.SetActive(true);
            MotionPanel.SetActive(true);
            StartStopPanel.SetActive(false);
            if (gm.state != "Quit" || gm.state != "SwitchingPose" || gm.state != "Options")
            {
                if (gm.mode == "HeadMode")
                {
                    text.text = "Position:Head\tAngle:" + gm.localheadangle;
                    foreach (Button mode in ModeButtons)
                    {
                        mode.GetComponent <Image>().color           = new Color(1, 1, 1, 0.5f);
                        ModeButtons[0].GetComponent <Image>().color = new Color(1, 1, 1, 1);
                    }
                    foreach (GameObject angle in anglebuttons)
                    {
                        if (Convert.ToSingle(angle.gameObject.name) > gm.AngularHeadLimit)
                        {
                            angle.SetActive(false);
                        }
                        else
                        {
                            angle.SetActive(true);
                        }
                    }
                }
                else if (gm.mode == "BodyMode")
                {
                    text.text = "Position:Body\tAngle:" + gm.localbodyangle;
                    foreach (Button mode in ModeButtons)
                    {
                        mode.GetComponent <Image>().color           = new Color(1, 1, 1, 0.5f);
                        ModeButtons[1].GetComponent <Image>().color = new Color(1, 1, 1, 1);
                    }
                    foreach (GameObject angle in anglebuttons)
                    {
                        if (Convert.ToSingle(angle.gameObject.name) > gm.AngularBodyLimit)
                        {
                            angle.SetActive(false);
                        }
                        else
                        {
                            angle.SetActive(true);
                        }
                    }
                }
                else if (gm.mode == "LegMode")
                {
                    text.text = "Position:Legs\tAngle:" + gm.locallegangle;
                    foreach (Button mode in ModeButtons)
                    {
                        mode.GetComponent <Image>().color           = new Color(1, 1, 1, 0.5f);
                        ModeButtons[2].GetComponent <Image>().color = new Color(1, 1, 1, 1);
                    }
                    anglepanel.SetActive(false);
                }
                else if (gm.mode == "SpineMode")
                {
                    text.text = "Position:Spine\tAngle:" + gm.spineangle;
                    foreach (Button mode in ModeButtons)
                    {
                        mode.GetComponent <Image>().color           = new Color(1, 1, 1, 0.5f);
                        ModeButtons[3].GetComponent <Image>().color = new Color(1, 1, 1, 1);
                    }
                    foreach (GameObject angle in anglebuttons)
                    {
                        if (Convert.ToSingle(angle.gameObject.name) > gm.AngularSpineLimit)
                        {
                            angle.SetActive(false);
                        }
                        else
                        {
                            angle.SetActive(true);
                        }
                    }
                }
            }
            if (gm.state == "Calibrating")
            {
                MotionButtons[0].GetComponent <Button>().interactable = false;
                MotionButtons[2].GetComponent <Button>().interactable = false;
                MotionButtons[1].GetComponent <Button>().interactable = true;
                foreach (Button mode in ModeButtons)
                {
                    mode.GetComponent <Button>().interactable = false;
                }
                foreach (Button option in OptionButtons)
                {
                    option.GetComponent <Button>().interactable = false;
                }
                foreach (GameObject angle in anglebuttons)
                {
                    angle.GetComponent <Button>().interactable = false;
                }
                gm.up   = false;
                gm.down = false;
            }
            else if (gm.state != "Calibrating")
            {
                MotionButtons[0].GetComponent <Button>().interactable = true;
                MotionButtons[2].GetComponent <Button>().interactable = true;
                MotionButtons[1].GetComponent <Button>().interactable = false;
                foreach (Button mode in ModeButtons)
                {
                    mode.GetComponent <Button>().interactable = true;
                }
                foreach (Button option in OptionButtons)
                {
                    option.GetComponent <Button>().interactable = true;
                }
                foreach (GameObject angle in anglebuttons)
                {
                    angle.GetComponent <Button>().interactable = true;
                }
            }
        }
        else if (gm.mode == "GoingZeroMode" || gm.mode == "ProgramWave")
        {
            anglepanel.SetActive(false);
            MotionPanel.SetActive(false);
            StartStopPanel.SetActive(true);
            if (gm.state != "Quit" || gm.state != "SwitchingPose" || gm.state != "Options")
            {
                if (gm.mode == "GoingZeroMode")
                {
                    text.text = "Calibrating to Zero\n" + ((gm.pose == null || gm.pose == "") ? null : "Position:" + gm.pose);
                    foreach (Button mode in ModeButtons)
                    {
                        mode.GetComponent <Image>().color           = new Color(1, 1, 1, 0.5f);
                        ModeButtons[4].GetComponent <Image>().color = new Color(1, 1, 1, 1);
                    }
                }
                else if (gm.mode == "ProgramWave")
                {
                    text.text = "Wave Cycle\n" + ((gm.pose == null || gm.pose == "")?null:"Position:" + gm.pose);
                    foreach (Button mode in ModeButtons)
                    {
                        mode.GetComponent <Image>().color           = new Color(1, 1, 1, 0.5f);
                        ModeButtons[5].GetComponent <Image>().color = new Color(1, 1, 1, 1);
                    }
                    PoseWavePanel.SetActive(false);

                    /*if (gm.state != "Calibrating")
                     * {
                     *  gm.state = null;
                     * }*/
                }
            }
            if (gm.state == "Calibrating")
            {
                StartStopButtons[0].GetComponent <Button>().interactable = false;
                StartStopButtons[1].GetComponent <Button>().interactable = true;
                foreach (Button mode in ModeButtons)
                {
                    mode.GetComponent <Button>().interactable = false;
                }
                foreach (Button option in OptionButtons)
                {
                    option.GetComponent <Button>().interactable = false;
                }
                if (gm.mode == "GoingZeroMode")
                {
                    percantage.fillAmount = (gm.percentage - (gm.ZeroAngles[0] + gm.ZeroAngles[1] + gm.ZeroAngles[2] + gm.ZeroAngles[3])) / gm.percentage;
                }
                else
                {
                    percantage.fillAmount = (200 - gm.wavecount) / 200;
                }
            }
            else if (gm.state != "Calibrating")
            {
                StartStopButtons[0].GetComponent <Button>().interactable = true;
                StartStopButtons[1].GetComponent <Button>().interactable = false;
                foreach (Button mode in ModeButtons)
                {
                    mode.GetComponent <Button>().interactable = true;
                }
                foreach (Button option in OptionButtons)
                {
                    option.GetComponent <Button>().interactable = true;
                }
                percantage.fillAmount = 0;
            }
        }
        else
        {
            anglepanel.SetActive(false);
            MotionPanel.SetActive(false);
            StartStopPanel.SetActive(false);
            if (gm.state != "Quit" && gm.state != "SwitchingPose" && gm.state != "Options" && gm.state != "Chair" && gm.state != "ModifiedChair" && gm.state != "Dinner" && gm.state != "Verticalize" && gm.state != "AntiModifiedChair")
            {
                foreach (Button mode in ModeButtons)
                {
                    mode.GetComponent <Image>().color         = new Color(1, 1, 1, 0.5f);
                    mode.GetComponent <Button>().interactable = true;
                }
                text.text = "All Information Will Be Displayed Here";
            }
        }
    }