예제 #1
0
    void Enter(UIState state)
    {
        if (mCurWndOptioner != null)
        {
            Debug.LogWarning("������������Enter?");
            Destroy(mCurWndOptioner.gameObject);
            mCurWndOptioner = null;
        }

        gameObject.SetActiveRecursively(true);
        mUIState = state;

        switch (state)
        {
        case UIState.Admin:
        {
            mCurWndOptioner = Instantiate(Prefab_WndOptionMoverAdmin, transform.position, Quaternion.identity) as Wnd_OptionMoveAble;

            Transform       ts         = mCurWndOptioner.transform.Find("option4/ctrl_��ǰ��ʾ״̬");
            Ctrl_OptionText ctrlOption = null;
            if (ts != null)
            {
                ctrlOption = ts.GetComponent <Ctrl_OptionText>();
            }
            if (ctrlOption != null)
            {
                ctrlOption.ViewIdx = GameMain.Singleton.BSSetting.Dat_GameShowLanguageSetup.Val ? 0 : 1;
                ctrlOption.UpdateText();
            }
        }
        break;

        case UIState.Arena:
            mCurWndOptioner = Instantiate(Prefab_WndOptionMoverArena, transform.position, Quaternion.identity) as Wnd_OptionMoveAble;
            break;
        }
        mCurWndOptioner.transform.parent        = transform;
        mCurWndOptioner.transform.localPosition = Vector3.zero;

        mCurWndOptioner.EvtSelectChanged += Handle_OptionSelectorChanged;
        mCurWndOptioner.EvtConfirm       += Handle_OptionSelectorConfirm;

        GameMain.EvtInputKey += Handle_Input;

        UpdateView();
    }
예제 #2
0
    void Handle_Input(int control, HpyInputKey key, bool down)
    {
        if (key == HpyInputKey.BS_Cancel && down)
        {
            if (mCurNumInputer != null)
            {
                Destroy(mCurNumInputer.gameObject);
                mCurNumInputer = null;

                mCurWndOptioner.IsControlable = true;
            }
        }
        else if ((key == HpyInputKey.BS_Left || key == HpyInputKey.BS_Right) && down)
        {
            if (mCurSelectIdx == 4)
            {
                Transform       ts         = mCurWndOptioner.transform.Find("option4/ctrl_��ǰ��ʾ״̬");
                Ctrl_OptionText ctrlOption = null;
                if (ts != null)
                {
                    ctrlOption = ts.GetComponent <Ctrl_OptionText>();
                }
                if (ctrlOption != null)
                {
                    PersistentData <bool, bool> isShowLanguageSetup = GameMain.Singleton.BSSetting.Dat_GameShowLanguageSetup;
                    isShowLanguageSetup.Val = !isShowLanguageSetup.Val;
                    ctrlOption.ViewIdx      = isShowLanguageSetup.Val ? 0 : 1;
                    ctrlOption.UpdateText();
                }
                else
                {
                    Debug.LogError("ctrlOption == null");
                }
            }
        }
    }