/// <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="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; } }