Exemplo n.º 1
0
    void OnMouseDown()
    {
        PMTestHandler pm = Camera.main.GetComponent <PMTestHandler>();

        if (pm.frontEndItem.isExample && GameObject.Find("ArrowButton"))
        {
            return;
        }
        if (e == EventSystem.typeOfEvent.Mouse)
        {
            isClicked = !isClicked;
            foreach (ClickCardPM c in FindObjectsOfType(typeof(ClickCardPM)) as ClickCardPM[])
            {
                if (!c.Equals(this))
                {
                    c.isClicked = false;
                }
            }
            if (!pm.frontEndItem.isExample)
            {
                GameObject.Find("ArrowButton").GetComponent <Button>().interactable = isClicked;
            }
            else
            {
                Camera.main.GetComponent <ContinueButtonPM>().Continue(0);
            }
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        PMTestHandler pm = Camera.main.GetComponent <PMTestHandler>();

        e = pm.backEndItem.currentEvent.type;

        if (e == EventSystem.typeOfEvent.Destroy)
        {
            isAnim = false;
        }

        //get name of test
        //if its rhyming then do white

        //if(!LI.testAbbrev.Equals("RYM"))
        //{
        GameObject border = transform.Find("GameObject").gameObject;

        if (isClicked)
        {
            border.GetComponent <SpriteRenderer>().color = Color.yellow;
        }
        else if (isAnim)
        {
            border.GetComponent <SpriteRenderer>().color = Color.green;
        }
        else
        {
            border.GetComponent <SpriteRenderer>().color = new Color(41f / 255f, 171f / 255f, 226f / 255f);
        }
        //}
        //else
        //{
        //GameObject button = transform.gameObject;
        //if(button.GetComponent<SpriteRenderer>())
        //{
        //    if (isClicked)
        //        button.GetComponent<SpriteRenderer>().color = Color.gray;
        //    else if (isAnim)
        //        button.GetComponent<SpriteRenderer>().color = Color.green;
        //    else
        //        button.GetComponent<SpriteRenderer>().color = Color.white;
        //}

        //}
    }
    public void Continue(int val)
    {
        PMTestHandler pm = Camera.main.GetComponent <PMTestHandler>();

        e = pm.backEndItem.currentEvent.type;
        bool isCorrect = false;

        foreach (ClickCardPM c in FindObjectsOfType(typeof(ClickCardPM)) as ClickCardPM[])
        {
            if (c.isClicked)
            {
                clickedCard = c;
                isCorrect   = c.isCorrect;
                break;
            }
        }
        print("hit");
        PMOutputHandler.correct          = isCorrect;
        PMOutputHandler.responsePosition = clickedCard.responsePosition;
        PMOutputHandler.responseName     = clickedCard.responseName;

        if (GameObject.Find("ArrowButton") && val == 1)
        {
            GameObject.Find("ArrowButton").GetComponent <Button>().interactable = false;
            pm.backEndItem.eventNumber++;
            return;
        }

        if (isCorrect && !pm.backEndItem.currentEvent.jumpLabel.Equals(""))
        {
            for (int i = pm.backEndItem.eventNumber + 1; i < pm.backEndItem.events.Length; i++)
            {
                if (pm.backEndItem.currentEvent.jumpLabel.Equals(pm.backEndItem.events[i].jumpLabel))
                {
                    pm.backEndItem.eventNumber = i;
                    break;
                }
            }
        }
        else if (!GameObject.Find("ArrowButton"))
        {
            if (!isCorrect && pm.frontEndItem.isExample)
            {
                foreach (ClickCardPM c in FindObjectsOfType(typeof(ClickCardPM)) as ClickCardPM[])
                {
                    if (c.isCorrect)
                    {
                        c.isAnim = true;
                    }
                    c.isClicked = false;
                }
                pm.backEndItem.eventNumber++;
            }
            else
            {
                foreach (ClickCardPM c in FindObjectsOfType(typeof(ClickCardPM)) as ClickCardPM[])
                {
                    c.isClicked = false;
                }
                pm.backEndItem.eventNumber++;
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     pm = Camera.main.GetComponent <PMTestHandler>();
 }