Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (isRotate == true)
        {
            checkText();
            rotateBoxes();
        }

        if (Input.GetKeyDown(KeyCode.UpArrow) && !isRotate)
        {
            //  Debug.Log("Key Up " + index);
            index = plusIndex(index);
            //  Debug.Log("Update : "+ index);
            changeColor(index, minIndex(index));
        }

        if (Input.GetKeyDown(KeyCode.DownArrow) && !isRotate)
        {
            // Debug.Log("Key Up " + index);
            index = minIndex(index);
            // Debug.Log("Update : " + index);
            changeColor(index, plusIndex(index));
        }

        if (Input.GetKeyDown(KeyCode.Return) && !isRotate)
        {
            if (index == 9)
            {
                // play
                index = 4;
                changeColor(index, 9);
                resetFinish();
                isRotate = true;
                //changeCanvasTo(0);
                indexing = new Indexing(0, 4);
            }

            else if (index == 8)
            {
                // design map
                ms.setIndex(2);
                SceneManager.LoadScene("LoadingScreen");
            }

            else if (index == 5)
            {
                //exit
                Debug.Log("Exit");
                Application.Quit();
            }

            else if (index == 4)
            {
                //play game
                ms.setChoosenMap(1);
                TxtController.getInstance().updateText();
                ms.setIndex(1);
                SceneManager.LoadScene("LoadingScreen");
            }

            else if (index == 3 || index == 2 || index == 1)
            {
                //play game

                int temp = (index != 2 && index == 3) ? 1 : 3;
                if (index == 2)
                {
                    temp = 2;
                }
                //Debug.Log(temp);
                //Debug.Log(ms.getStatus());
                //Debug.Log(ms.isAvailable(temp));
                if (ms.isAvailable(temp))
                {
                    ms.setToPlay(true);
                    ms.setChoosenMap(temp + 1);
                    TxtController.getInstance().updateText();
                    ms.setIndex(1);
                    SceneManager.LoadScene("LoadingScreen");
                }
            }

            else if (index == 0)
            {
                //back
                index = 9;
                changeColor(index, 0);
                resetFinish();
                isRotate = true;
                //changeCanvasTo(1);
                indexing = new Indexing(5, 9);
            }
        }

        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            //Debug.Log("Right");
            if (index == 7)
            {
                //resol
                plusResol();
                //Debug.Log(idxR);
                Screen.SetResolution(resol[idxR].width, resol[idxR].height, true);
                changeText(7, resol[idxR].text);
            }

            else if (index == 6)
            {
                //quality
                plusQuality();
                QualitySettings.SetQualityLevel(idxQ, true);
                changeText(6, quality[idxQ]);
            }
        }

        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            //Debug.Log("Left");
            if (index == 7)
            {
                //change resol
                minResol();
                Screen.SetResolution(resol[idxR].width, resol[idxR].height, true);
                //Debug.Log(idxR);
                changeText(7, resol[idxR].text);
            }

            else if (index == 6)
            {
                minQuality();
                QualitySettings.SetQualityLevel(idxQ, true);
                changeText(6, quality[idxQ]);
            }
        }
    }