/// <summary>
    /// 按键检测(抬起)
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue)
    {
        Func <UIFocusPath.MoveType, UIFocus> GetNext = (key) =>
        {
            UIFocus nextFocus = uiFocusPath.GetNewNextFocus(nowUIFocus, key);
            return(nextFocus);
        };

        switch (keyType)
        {
        case UIManager.KeyType.A:
            if (nowUIFocus)
            {
                nowUIFocus.MoveChild(UIFocusPath.MoveType.OK);
            }
            break;

        case UIManager.KeyType.LEFT:
            if (nowUIFocus)
            {
                nowUIFocus.MoveChild(UIFocusPath.MoveType.LEFT);
            }
            break;

        case UIManager.KeyType.RIGHT:
            if (nowUIFocus)
            {
                nowUIFocus.MoveChild(UIFocusPath.MoveType.RIGHT);
            }
            break;

        case UIManager.KeyType.UP:
        case UIManager.KeyType.DOWN:
            if (!nowUIFocus)
            {
                nowUIFocus = uiFocusPath.GetFirstFocus();
            }
            else
            {
                UIFocus nextFocus = GetNext(keyType == UIManager.KeyType.UP ? UIFocusPath.MoveType.UP : UIFocusPath.MoveType.DOWN);
                nowUIFocus.LostForcus();
                nowUIFocus = nextFocus;
            }
            if (nowUIFocus)
            {
                nowUIFocus.SetForcus();
            }
            break;
        }
    }
    /// <summary>
    /// 按键检测
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue)
    {
        if (!fisrtKeyUP)
        {
            fisrtKeyUP = true;
            return;
        }
        if (UIAction.isSaving)
        {
            return;
        }
        Action <UIFocusPath.MoveType> MoveNextEndAction = (moveType) =>
        {
            if (nowUIFocus)
            {
                UIFocus uiFocus = uiFocusPath.GetNewNextFocus(nowUIFocus, moveType);
                if (uiFocus)
                {
                    nowUIFocus.LostForcus();
                    nowUIFocus = uiFocus;
                    nowUIFocus.SetForcus();
                }
            }
            else
            {
                nowUIFocus = uiFocusPath.GetFirstFocus();
                nowUIFocus.SetForcus();
            }
        };

        switch (keyType)
        {
        case UIManager.KeyType.A:
            UIFocusButton uiFocusButton = nowUIFocus as UIFocusButton;
            if (uiFocusButton)
            {
                uiFocusButton.ClickThisButton();
            }
            break;

        case UIManager.KeyType.UP:
            MoveNextEndAction(UIFocusPath.MoveType.UP);
            break;

        case UIManager.KeyType.DOWN:
            MoveNextEndAction(UIFocusPath.MoveType.DOWN);
            break;
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 创建时输入名字状态的手柄输入检测
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void CreateNameInputType_HandleUpdate(UIManager.KeyType keyType, Vector2 rockValue)
    {
        if (nowNameInputFocus == null && nameInputUIFocusPath)
        {
            nowNameInputFocus = nameInputUIFocusPath.GetFirstFocus();
            if (nowNameInputFocus)
            {
                nowNameInputFocus.SetForcus();
            }
        }
        if (nowNameInputFocus)
        {
            //判断键位
            Action <UIFocusPath.MoveType> MoveFocusAction = (moveType) =>
            {
                UIFocus next = nameInputUIFocusPath.GetNewNextFocus(nowNameInputFocus, moveType);// uiFocusPath.GetNextFocus(nowFocus, moveType, true);
                if (next)
                {
                    nowNameInputFocus.LostForcus();
                    nowNameInputFocus = next;
                    nowNameInputFocus.SetForcus();
                }
            };
            switch (keyType)
            {
            case UIManager.KeyType.A:
                if (nowNameInputFocus)
                {
                    UIFocusButton     uiFocusButton     = nowNameInputFocus as UIFocusButton;
                    UIFocusInputField uiFocusInputField = nowNameInputFocus as UIFocusInputField;
                    if (uiFocusButton)
                    {
                        uiFocusButton.ClickThisButton();
                    }
                    else if (uiFocusInputField)
                    {
                        uiFocusInputField.EnterInputField();
                    }
                }
                break;

            case UIManager.KeyType.LEFT:
                MoveFocusAction(UIFocusPath.MoveType.LEFT);
                break;

            case UIManager.KeyType.RIGHT:
                MoveFocusAction(UIFocusPath.MoveType.RIGHT);
                break;

            case UIManager.KeyType.UP:
                MoveFocusAction(UIFocusPath.MoveType.UP);
                break;

            case UIManager.KeyType.DOWN:
                MoveFocusAction(UIFocusPath.MoveType.DOWN);
                break;
            }
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// 点击标签页
 /// </summary>
 /// <param name="nextTabPageFocus"></param>
 public void TabPageClick(UIFocusTabPage nextTabPageFocus)
 {
     if (nextTabPageFocus != null)
     {
         nowTabPageFocus.LostForcus();
         nowTabPageFocus.panel.gameObject.SetActive(false);
         nowTabPageFocus = nextTabPageFocus;
         nowTabPageFocus.panel.gameObject.SetActive(true);
         nowTabPageFocus.SetForcus();
         if (nowTabPageFocus.panelFocusPath)
         {
             if (tabPanelFocus)
             {
                 tabPanelFocus.LostForcus();
             }
             tabPanelFocus = nowTabPageFocus.panelFocusPath.GetFirstFocus();
             if (tabPanelFocus)
             {
                 tabPanelFocus.SetForcus();
             }
         }
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// 按键检测(功能键)
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue)
    {
        if (!fisrtKeyUP)
        {
            fisrtKeyUP = true;
            return;
        }
        switch (bigMapOperateState)
        {
        case EnumBigMapOperateState.OperateMap:    //操作地图
            switch (keyType)
            {
            case UIManager.KeyType.A:
                Vector2 handlePos = uiMapControl.GetHandlePosInTerrain();
                ActionAtTerrain(handlePos);
                break;

            case UIManager.KeyType.Y:
                bigMapOperateState = EnumBigMapOperateState.CheckSetting;
                showSettingPanel.gameObject.SetActive(true);
                if (uiFocusPath)
                {
                    nowUIFocus = uiFocusPath.GetFirstFocus();
                }
                if (nowUIFocus)
                {
                    nowUIFocus.SetForcus();
                }
                break;
            }
            break;

        case EnumBigMapOperateState.CheckSetting:    //操作设置
            if (!nowUIFocus)
            {
                if (uiFocusPath)
                {
                    nowUIFocus = uiFocusPath.GetFirstFocus();
                }
            }
            if (nowUIFocus)
            {
                Action <UIFocusPath.MoveType> MoveUIFocusAction = (moveType) =>
                {
                    UIFocus nextUIFocus = uiFocusPath.GetNewNextFocus(nowUIFocus, moveType);    //uiFocusPath.GetNextFocus(nowUIFocus, moveType);
                    if (nextUIFocus != null)
                    {
                        nowUIFocus.LostForcus();
                        nowUIFocus = nextUIFocus;
                        nowUIFocus.SetForcus();
                    }
                };
                switch (keyType)
                {
                case UIManager.KeyType.A:
                    if (nowUIFocus.GetType().Equals(typeof(UIFocusButton)))
                    {
                        ((UIFocusButton)nowUIFocus).ClickThisButton();
                    }
                    else if (nowUIFocus.GetType().Equals(typeof(UIFocusToggle)))
                    {
                        ((UIFocusToggle)nowUIFocus).MoveChild(UIFocusPath.MoveType.OK);
                    }
                    break;

                case UIManager.KeyType.B:
                    ExitSetting_Click();
                    break;

                case UIManager.KeyType.LEFT:
                    MoveUIFocusAction(UIFocusPath.MoveType.LEFT);
                    break;

                case UIManager.KeyType.RIGHT:
                    MoveUIFocusAction(UIFocusPath.MoveType.RIGHT);
                    break;

                case UIManager.KeyType.UP:
                case UIManager.KeyType.DOWN:
                    if (string.Equals(nowUIFocus.Tag, "SceneDropDown"))
                    {
                        UIFocusDropdown uiFocusDropDown = nowUIFocus as UIFocusDropdown;
                        if (uiFocusDropDown != null)
                        {
                            uiFocusDropDown.MoveChild(keyType == UIManager.KeyType.UP ? UIFocusPath.MoveType.UP : UIFocusPath.MoveType.DOWN);
                        }
                    }
                    break;
                }
            }
            break;
        }
    }