Пример #1
0
 void Remove4thButton()
 {
     // Debug.Log("Remove 4th button");
     UIButtons[3].gameObject.SetActive(false);
     if (Button4TimerUI != null)
     {
         Button4TimerUI.SetActive(false);
     }
 }
Пример #2
0
    private void SetupCanvas(GameObject myCanvas)
    {
        //This function grabs the referances to the UI buttons and UI Timers from the provided Canvas to use

        if (myCanvas.transform.Find("QTE_UI/SuccessMessage") != null)
        {
            SuccessUI = myCanvas.transform.Find("QTE_UI/SuccessMessage").gameObject;
            SuccessUI.SetActive(false);
            Debug.Log(myCanvas.name);
        }
        else
        {
            //  Debug.LogError("QTE_main: Sucess Message Prefab Not Found!, Please Place the QTE_UI Prefab in your Canvas");
        }

        if (myCanvas.transform.Find("QTE_UI/Button1"))
        {
            UIButtons[0] = myCanvas.transform.Find("QTE_UI/Button1").GetComponent <Image>();
            UIButtons[0].gameObject.SetActive(false);
            if (myCanvas.transform.Find("QTE_TimerUI/QTE_Timer1") != null)
            {
                Button1TimerUI = myCanvas.transform.Find("QTE_TimerUI/QTE_Timer1").gameObject;
                Button1TimerUI.SetActive(false);
                Button1CircleUI = Button1TimerUI.GetComponent <QTE_CircleTimerUI>();
            }
        }
        else
        {
            Debug.LogError("QTE_main: Button1 Prefab Not Found!, Please Place the QTE_UI Prefab in your Canvas");
            //break;
        }
        if (myCanvas.transform.Find("QTE_UI/Button2"))
        {
            UIButtons[1] = myCanvas.transform.Find("QTE_UI/Button2").GetComponent <Image>();
            UIButtons[1].gameObject.SetActive(false);
            if (myCanvas.transform.Find("QTE_TimerUI/QTE_Timer2") != null)
            {
                Button2TimerUI = myCanvas.transform.Find("QTE_TimerUI/QTE_Timer2").gameObject;
                Button2TimerUI.SetActive(false);
                Button2CircleUI = Button2TimerUI.GetComponent <QTE_CircleTimerUI>();
            }
        }
        else
        {
            Debug.LogError("QTE_main: Button2 Prefab Not Found!, Please Place the QTE_UI Prefab in your Canvas");
            //break;
        }
        if (myCanvas.transform.Find("QTE_UI/Button3"))
        {
            UIButtons[2] = myCanvas.transform.Find("QTE_UI/Button3").GetComponent <Image>();
            UIButtons[2].gameObject.SetActive(false);
            if (myCanvas.transform.Find("QTE_TimerUI/QTE_Timer3") != null)
            {
                Button3TimerUI = myCanvas.transform.Find("QTE_TimerUI/QTE_Timer3").gameObject;
                Button3TimerUI.SetActive(false);
                Button3CircleUI = Button3TimerUI.GetComponent <QTE_CircleTimerUI>();
            }
        }
        else
        {
            Debug.LogError("QTE_main: Button3 Prefab Not Found!, Please Place the QTE_UI Prefab in your Canvas");
            //break;
        }
        if (myCanvas.transform.Find("QTE_UI/Button4"))
        {
            UIButtons[3] = myCanvas.transform.Find("QTE_UI/Button4").GetComponent <Image>();
            UIButtons[3].gameObject.SetActive(false);
            if (myCanvas.transform.Find("QTE_TimerUI/QTE_Timer4") != null)
            {
                Button4TimerUI = myCanvas.transform.Find("QTE_TimerUI/QTE_Timer4").gameObject;
                Button4TimerUI.SetActive(false);
                Button4CircleUI = Button4TimerUI.GetComponent <QTE_CircleTimerUI>();
            }
        }
        else
        {
            Debug.LogError("QTE_main: Button4 Prefab Not Found!, Please Place the QTE_UI Prefab in your Canvas");
            //break;
        }

        if (myCanvas.transform.Find("QTE_MashUI") != null)
        {
            MashUI     = myCanvas.transform.Find("QTE_MashUI").gameObject;
            MashParent = MashUI.transform.Find("QTE_MashParent").gameObject;
            MashCircle = MashParent.transform.Find("QTE_MashCircle").GetComponent <QTE_MashCircleUI>();
            MashRing   = MashParent.transform.Find("QTE_MashRing").gameObject;
            MashUI.SetActive(false);
        }
    }