예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     menuController = GameObject.FindGameObjectWithTag("GameController").GetComponent <MenuController>();
     index          = 0;
     isLock         = false;
     setBtnState    = SetBtnState.Wait;
     SetTextColor();
     SetKeyBoardSprite();
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!isLock)
        {
            if (Input.GetKeyDown(Setting.Keys.KEY_DOWN) || Input.GetKeyDown(Setting.Keys.KEY_RIGHT))
            {
                index = index + 1 > scoreTextes.Length - 1 ? 0 : index + 1;
                menuController.PlaySw();
            }
            else if (Input.GetKeyDown(Setting.Keys.KEY_UP) || Input.GetKeyDown(Setting.Keys.KEY_LEFT))
            {
                index = index - 1 < 0 ? scoreTextes.Length - 1 : index - 1;
                menuController.PlaySw();
            }
            else if (Input.GetKeyDown(Setting.Keys.KEY_ABILITY))
            {
                index = scoreTextes.Length - 1;
                menuController.PlaySw();
            }
        }

        SetTextColor();

        if (Input.GetKeyDown(Setting.Keys.KEY_JUMP))
        {
            menuController.PlaySe();
            if (index == 7)
            {
                Setting.Keys.Default();
                SetKeyBoardSprite();
            }
            else if (index == 8)
            {
                menuController.SetMenuActive("OptionMenu");
            }
            else if (setBtnState == SetBtnState.Wait)
            {
                isLock      = true;
                setBtnState = SetBtnState.Lock;
            }
        }

        if (setBtnState == SetBtnState.Lock)
        {
            images[index].enabled = false;
            setBtnState           = SetBtnState.Change;
        }
        else if (setBtnState == SetBtnState.Change)
        {
            foreach (KeyCode kcode in Enum.GetValues(typeof(KeyCode)))
            {
                if (Input.GetKeyDown(kcode))
                {
                    menuController.PlaySe();
                    switch (index)
                    {
                    case 0:
                        Setting.Keys.KEY_UP = kcode;
                        break;

                    case 1:
                        Setting.Keys.KEY_DOWN = kcode;
                        break;

                    case 2:
                        Setting.Keys.KEY_LEFT = kcode;
                        break;

                    case 3:
                        Setting.Keys.KEY_RIGHT = kcode;
                        break;

                    case 4:
                        Setting.Keys.KEY_JUMP = kcode;
                        break;

                    case 5:
                        Setting.Keys.KEY_ABILITY = kcode;
                        break;

                    case 6:
                        Setting.Keys.KEY_CHANGEMODE = kcode;
                        break;

                    default:
                        break;
                    }
                    SetKeyBoardSprite();
                    setBtnState           = SetBtnState.Wait;
                    images[index].enabled = true;
                    isLock = false;
                    break;
                }
            }
        }
    }