/// <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="moveType"></param>
    public void GetKeyDown(UIFocusPath.MoveType moveType)
    {
        Action <UIFocusPath.MoveType> MoveNextAction = (_moveType) =>
        {
            if (!nowUIFocus)
            {
                nowUIFocus = uiFocusPath.GetFirstFocus();
            }
            if (nowUIFocus)
            {
                UIFocus nextUIFocus = uiFocusPath.GetNewNextFocus(nowUIFocus, _moveType);
                if (nextUIFocus != null)
                {
                    nowUIFocus = nextUIFocus;
                }
                nowUIFocus.SetForcus();
            }
        };

        switch (moveType)
        {
        case UIFocusPath.MoveType.LEFT:
        case UIFocusPath.MoveType.RIGHT:
            MoveNextAction(moveType);
            break;

        case UIFocusPath.MoveType.OK:
            UIFocusButton uiFocusButton = nowUIFocus as UIFocusButton;
            if (uiFocusButton)
            {
                uiFocusButton.ClickThisButton();    //激活事件
            }
            break;
        }
    }
 private void OnEnable()
 {
     UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle;
     if (uiFocusPath)
     {
         nowTabPageFocus = uiFocusPath.GetFirstFocus() as UIFocusTabPage;
         if (nowTabPageFocus)
         {
             nowTabPageFocus.SetForcus();
         }
         if (nowTabPageFocus != null && nowTabPageFocus.panel)
         {
             nowTabPageFocus.panel.gameObject.SetActive(true);
         }
         if (nowTabPageFocus != null && nowTabPageFocus.panelFocusPath)
         {
             tabPanelFocus = nowTabPageFocus.panelFocusPath.GetFirstFocus();
             if (tabPanelFocus != null)
             {
                 tabPanelFocus.SetForcus();
             }
         }
     }
     //重新载入数据
     //throw new NotImplementedException();
 }
    /// <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;
            }
        }
    }
 private void OnEnable()
 {
     nowUIFocus = uiFocusPath.GetFirstFocus();
     if (nowUIFocus)
     {
         nowUIFocus.SetForcus();
     }
 }
    /// <summary>
    /// 创建时选择种族状态的手柄输入检测
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void CreateSelectRoleOfRaceType_HandleUpdate(UIManager.KeyType keyType, Vector2 rockValue)
    {
        if (nowRoleOfRaceFocus == null && roleOfRaceUIFocusPath)
        {
            nowRoleOfRaceFocus = roleOfRaceUIFocusPath.GetFirstFocus();
            if (nowRoleOfRaceFocus)
            {
                nowRoleOfRaceFocus.SetForcus();
            }
        }
        if (nowRoleOfRaceFocus)
        {
            //判断键位
            Action <UIFocusPath.MoveType> MoveFocusAction = (moveType) =>
            {
                UIFocus next = roleOfRaceUIFocusPath.GetNewNextFocus(nowRoleOfRaceFocus, moveType);// uiFocusPath.GetNextFocus(nowFocus, moveType, true);
                if (next)
                {
                    nowRoleOfRaceFocus = next;
                    CreateSelectRoleOfRaceUpdateNowFocus();
                }
            };
            switch (keyType)
            {
            case UIManager.KeyType.A:
                if (nowRoleOfRaceFocus)
                {
                    UIFocusButton uiFocusButton = nowRoleOfRaceFocus as UIFocusButton;
                    if (uiFocusButton)
                    {
                        uiFocusButton.ClickThisButton();
                    }
                }
                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;
            }
        }
    }
    void Start()
    {
        entranceType = EnumEntranceType.Start;

        playerCreateTrans = GameObject.Find("PlayerInit").transform;

        if (settingCanvasPrefab)
        {
            GameObject settingGameObject = Instantiate(settingCanvasPrefab);
            settingCanvas = settingGameObject.GetComponent <Canvas>();
            settingGameObject.SetActive(false);
        }
        UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle;
        StartCoroutine(CrossoverMaskImageAlpha(0));

        //判断现在是否有默认存档,如果有则显示继续,如果没有则显示新建
        List <Archive> archiveList    = DataCenter.Instance.GetAllArchive();//获取所有存档名
        Archive        defaultArchive = archiveList.FirstOrDefault(temp => temp.ID == 1);
        UIFocus        continueFoucs  = startUIFocusPath.NewUIFocusArray.FirstOrDefault(temp => string.Equals(temp.Tag, "Continue"));
        UIFocus        newFocus       = startUIFocusPath.NewUIFocusArray.FirstOrDefault(temp => string.Equals(temp.Tag, "New"));

        if (defaultArchive == null)
        {
            if (continueFoucs)
            {
                continueFoucs.gameObject.SetActive(false);
            }
            if (newFocus)
            {
                newFocus.gameObject.SetActive(true);
            }
        }
        else
        {
            if (continueFoucs)
            {
                continueFoucs.gameObject.SetActive(true);
            }
            if (newFocus)
            {
                newFocus.gameObject.SetActive(false);
            }
        }
        //设置当前选中
        if (nowStartFocus == null && startUIFocusPath)
        {
            nowStartFocus = startUIFocusPath.GetFirstFocus();
            if (nowStartFocus)
            {
                nowStartFocus.SetForcus();
            }
        }
    }
    /// <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;
        }
    }
Example #9
0
    private void OnEnable()
    {
        UIManager.Instance.KeyUpHandle += Instance_KeyUpHandle;
        if (uiFocusPath)
        {
            nowUIFocus = uiFocusPath.GetFirstFocus();
            if (nowUIFocus)
            {
                nowUIFocus.SetForcus();
            }
        }
        //给任务系统填入状态
        INowTaskState iNowTaskState = GameState.Instance.GetEntity <INowTaskState>();

        iNowTaskState.CheckNowTask(EnumCheckTaskType.Special, (int)TaskMap.Enums.EnumTaskSpecialCheck.OpenItemUI);
    }
 /// <summary>
 /// 点击按钮
 /// </summary>
 /// <param name="uiFocus"></param>
 public void ClickButtong(UIFocus uiFocus)
 {
     if (UIAction.isSaving)
     {
         return;
     }
     if (nowUIFocus != uiFocus)
     {
         if (nowUIFocus != null)
         {
             nowUIFocus.LostForcus();
         }
         nowUIFocus = uiFocus;
         nowUIFocus.SetForcus();
     }
     ButtonAction();
 }
Example #11
0
    /// <summary>
    /// 按键检测
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue)
    {
        //输入
        if (uiFocusPath)
        {
            Action <UIFocusPath.MoveType> MoveFocusAction = (moveType) =>
            {
                if (nowUIFocus)
                {
                    if (nowUIFocus.CanMoveNext(moveType))
                    {
                        UIFocus nextUIFocus = uiFocusPath.GetNewNextFocus(nowUIFocus, moveType);//uiFocusPath.GetNextFocus(nowUIFocus, moveType);
                        if (nextUIFocus)
                        {
                            nowUIFocus = nextUIFocus;
                            nowUIFocus.SetForcus();
                        }
                    }
                    else//移动控件内的控件
                    {
                        nowUIFocus.MoveChild(moveType);
                    }
                }
            };
            switch (keyType)
            {
            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;
            }
        }
    }
 /// <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();
             }
         }
     }
 }
 /// <summary>
 /// 初始化新建时的输入姓名
 /// </summary>
 private void InitCreateNameInput()
 {
     nowNameInputFocus = nameInputUIFocusPath.GetFirstFocus();
     nowNameInputFocus = nameInputUIFocusPath.GetFirstFocus();
     nowNameInputFocus.SetForcus();
 }
Example #14
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;
        }
    }
    /// <summary>
    /// 按键检测
    /// </summary>
    /// <param name="keyType"></param>
    /// <param name="rockValue"></param>
    private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue)
    {
        if (uiFocusPath)//标签页左右切换
        {
            UIFocus nextTabPageFocus = null;
            switch (keyType)
            {
            case UIManager.KeyType.R1:
                nextTabPageFocus = uiFocusPath.GetNextFocus(nowTabPageFocus, UIFocusPath.MoveType.RIGHT, true);
                break;

            case UIManager.KeyType.L1:
                nextTabPageFocus = uiFocusPath.GetNextFocus(nowTabPageFocus, UIFocusPath.MoveType.LEFT, true);
                break;
            }
            TabPageClick(nextTabPageFocus as UIFocusTabPage);

            /*
             * if (nextTabPageFocus != null)
             * {
             *  nowTabPageFocus.panel.gameObject.SetActive(false);
             *  nowTabPageFocus = nextTabPageFocus as UIFocusTabPage;
             *  nowTabPageFocus.gameObject.SetActive(true);
             *  if (nowTabPageFocus.panelFocusPath)
             *  {
             *      if (tabPanelFocus)
             *          tabPanelFocus.LostForcus();
             *      tabPanelFocus = nowTabPageFocus.panelFocusPath.GetFirstFocus();
             *      if (tabPanelFocus)
             *          tabPanelFocus.SetForcus();
             *  }
             * }
             */
        }

        if (nowTabPageFocus)//标签页内部切换
        {
            if (nowTabPageFocus.panelFocusPath)
            {
                if (!tabPanelFocus)
                {
                    tabPanelFocus = nowTabPageFocus.panelFocusPath.GetFirstFocus();
                }
                //判断键位
                Action <UIFocusPath.MoveType> MoveFocusAction = (moveType) =>
                {
                    if (tabPanelFocus)
                    {
                        if (tabPanelFocus.CanMoveNext(moveType))
                        {
                            UIFocus nextTabPanelFocus = nowTabPageFocus.panelFocusPath.GetNewNextFocus(tabPanelFocus, moveType);// nowTabPageFocus.panelFocusPath.GetNextFocus(tabPanelFocus, moveType);
                            if (nextTabPanelFocus)
                            {
                                tabPanelFocus = nextTabPanelFocus;
                                tabPanelFocus.SetForcus();
                            }
                        }
                        else
                        {
                            tabPanelFocus.MoveChild(moveType);
                        }
                    }
                };
                switch (keyType)
                {
                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;

                case UIManager.KeyType.A:
                    MoveFocusAction(UIFocusPath.MoveType.OK);
                    break;
                }
            }
        }

        switch (keyType)
        {
        case UIManager.KeyType.B:    //返回
            CloseSettingClick();
            break;
        }
    }