/// <summary> /// 按键检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { if (!CanGetInput) { return; } switch (entranceType) { case EnumEntranceType.Start: StartType_HandleUpdate(keyType, rockValue); break; case EnumEntranceType.Create_SelectRoleOfRace: CreateSelectRoleOfRaceType_HandleUpdate(keyType, rockValue); break; case EnumEntranceType.Create_InputName: CreateNameInputType_HandleUpdate(keyType, rockValue); break; case EnumEntranceType.Enter: EnterType_HandleUpDate(keyType, rockValue); break; } }
/// <summary> /// 按键检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { switch (keyType) { case UIManager.KeyType.A: if (synthesisItemTree.SelectNode.value == null) //展开或收起该节点 { synthesisItemTree.SelectNode.IsExpand = !synthesisItemTree.SelectNode.IsExpand; } else if (synthesisItemTree.SelectNode.value.GetType().Equals(typeof(SynthesisDataStruct))) { //合成物品 iSynthesisState.SynthesisGoods(synthesisItemTree.SelectNode.value as SynthesisDataStruct); } break; case UIManager.KeyType.B: //返回 this.gameObject.SetActive(false); break; case UIManager.KeyType.UP: synthesisItemTree.SelectUPTreeNode(); break; case UIManager.KeyType.DOWN: synthesisItemTree.SelectDownTreeNode(); break; } }
/// <summary> /// 按键检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { if (isSaving) { return; } if (uiFocusPath && CanChangeTab)//切换标签页 { UIFocus nextTabPageFocus = null; switch (keyType) { case UIManager.KeyType.R1: //nextTabPageFocus = uiFocusPath.GetNewNextFocus(nowTabPageFocus, UIFocusPath.MoveType.RIGHT);// uiFocusPath.GetNextFocus(nowTabPageFocus, UIFocusPath.MoveType.RIGHT, true); nextTabPageFocus = GetNextEnableTabPage(UIFocusPath.MoveType.RIGHT); break; case UIManager.KeyType.L1: //nextTabPageFocus = uiFocusPath.GetNewNextFocus(nowTabPageFocus, UIFocusPath.MoveType.LEFT);//uiFocusPath.GetNextFocus(nowTabPageFocus, UIFocusPath.MoveType.LEFT, true); nextTabPageFocus = GetNextEnableTabPage(UIFocusPath.MoveType.LEFT); break; } TabPageClick(nextTabPageFocus as UIFocusTabPage); } switch (keyType) { case UIManager.KeyType.START: //返回 CloseActionClick(); break; } }
/// <summary> /// 移动选择条目 /// </summary> /// <param name="keyType"></param> protected virtual void MoveItemSelect(UIManager.KeyType keyType) { switch (keyType) { case UIManager.KeyType.UP: case UIManager.KeyType.DOWN: UIListItem[] uiListItems = ItemUIList.GetAllImtes(); int index = uiListItems.ToList().IndexOf(SelectGoods); index += keyType == UIManager.KeyType.UP ? -1 : 1; if (index >= uiListItems.Length) { index = uiListItems.Length - 1; } else if (index < 0) { index = 0; } if (index < uiListItems.Length && index >= 0) { UIListItem nextSelectGoods = uiListItems[index]; if (nextSelectGoods != null) { SelectGoods.childImage.enabled = false; SelectGoods.childImage.gameObject.SetActive(false); SelectGoods = nextSelectGoods; SelectGoods.childImage.enabled = true; SelectGoods.childImage.gameObject.SetActive(true); ItemUIList.ShowItem(SelectGoods); ItemUIList.UpdateUI(); } } break; } }
/// <summary> /// 按键检测(松开) /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { switch (keyType) { case UIManager.KeyType.A: //展开或收起节点 if (uiTree.SelectNode != null) { uiTree.SelectNode.IsExpand = !uiTree.SelectNode.IsExpand; } break; case UIManager.KeyType.UP: if (uiTree.SelectNode) { uiTree.SelectUPTreeNode(); } else if (uiTree.Count > 0) { uiTree[0].IsSelect = true; } break; case UIManager.KeyType.DOWN: if (uiTree.SelectNode) { uiTree.SelectDownTreeNode(); } else if (uiTree.Count > 0) { uiTree[0].IsSelect = true; } break; } }
/// <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; } } }
/// <summary> /// 进入状态时手柄输入检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void EnterType_HandleUpDate(UIManager.KeyType keyType, Vector2 rockValue) { if (keyType == UIManager.KeyType.A) { //进入游戏 GetArchiveData(); } }
/// <summary> /// 检测按键 /// </summary> /// <param name="arg1"></param> /// <param name="arg2"></param> private void Instance_KeyUpHandle(UIManager.KeyType arg1, Vector2 arg2) { if (canPause) { ++playCurrent; SetPlayCurrent(playCurrent); canPause = false; } }
/// <summary> /// 按键检测(按住) /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyPressHandle(UIManager.KeyType keyType, Vector2 rockValue) { switch (keyType) { case UIManager.KeyType.LEFT_ROCKER: scrollbar.value += rockValue.y * Time.deltaTime * 0.2f; break; } }
/// <summary> /// 按键检测 /// 检测功能,移动处理在MoveChild /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { if (focused) { switch (keyType) { case UIManager.KeyType.A: ItemAction(); break; } } }
/// <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; } } }
/// <summary> /// 按键检测 /// 处理每个单元格的状态 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { if (nowLattice) { switch (keyType) { case UIManager.KeyType.A: EquipmentLatticeAction(); break; } } }
/// <summary> /// 按键检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { Action <int> MoveListAction = (addOffset) => { UIListItem[] tempArrays = uiTaskList.GetAllImtes(); if (tempArrays.Length == 0) { return; } int index = 0; if (nowTaskItem) { index = tempArrays.ToList().IndexOf(nowTaskItem); } if (index < 0) { index = 0; } index += addOffset; index = Mathf.Clamp(index, 0, tempArrays.Length - 1); if (index < tempArrays.Length) { uiTaskList.ShowItem(tempArrays[index]); if (nowTaskItem && nowTaskItem.childImage) { nowTaskItem.childImage.enabled = false; } nowTaskItem = tempArrays[index]; if (nowTaskItem && nowTaskItem.childImage) { nowTaskItem.childImage.enabled = true; } ExplanNowItem(); } }; switch (keyType) { case UIManager.KeyType.Y: //任务追踪 MarkTaskToMap(); break; case UIManager.KeyType.UP: MoveListAction(-1); break; case UIManager.KeyType.DOWN: MoveListAction(1); break; } }
/// <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; } }
private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { if (!fisrtKeyUP) { fisrtKeyUP = true; return; } switch (keyType) { case UIManager.KeyType.A: case UIManager.KeyType.B: NextTalkOrEnd(); break; } }
/// <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="arg1"></param> /// <param name="arg2"></param> private void Instance_KeyUpHandle(UIManager.KeyType arg1, Vector2 arg2) { if (iGameState.GameRunType == EnumGameRunType.Safe || iGameState.GameRunType == EnumGameRunType.Unsafa) { switch (arg1) { case UIManager.KeyType.START: //开启功能界面 iInteractiveState.ClickInteractiveNPCID = -1; actionPanel.gameObject.SetActive(true); break; case UIManager.KeyType.Back: //开启设置界面 //settingPanel.gameObject.SetActive(true); //UISetting uiSetting = settingPanel.GetComponent<UISetting>() ; break; } } }
private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { switch (keyType) { case UIManager.KeyType.L1: case UIManager.KeyType.LEFT: LeftClick(null); break; case UIManager.KeyType.R1: case UIManager.KeyType.RIGHT: RightClick(null); break; case UIManager.KeyType.B: ExitClick(null); break; } }
/// <summary> /// 按键检测(主要是左摇杆和右摇杆) /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyPressHandle(UIManager.KeyType keyType, Vector2 rockValue) { switch (bigMapOperateState) { case EnumBigMapOperateState.OperateMap: switch (keyType) { case UIManager.KeyType.LEFT_ROCKER: uiMapControl.MoveHandleMapPixel(rockValue * 500); //uiMapControl.MoveHandleImagePixel(rockValue * 50); break; case UIManager.KeyType.RIGHT_ROCKER: uiMapControl.Scale -= rockValue.y * 0.01f; break; } break; } }
private void Instance_KeyUpHandle(UIManager.KeyType arg1, Vector2 arg2) { if (!firstKeyUP) { firstKeyUP = true; return; } if (!waitTip) { base.MoveItemSelect(arg1); if (arg1 == UIManager.KeyType.A) { if (SelectGoods != null) { waitTip = true; uiShowTip.Show(result => { waitTip = false; if (result)//如果确认后则将现在选择的条目进行处理 { ItemClickAction(); } }); } } } else { if (arg1 == UIManager.KeyType.B) { uiShowTip.gameObject.SetActive(false); waitTip = false; } else { uiShowTip.GetKeyDown(arg1 == UIManager.KeyType.LEFT ? UIFocusPath.MoveType.LEFT : (arg1 == UIManager.KeyType.RIGHT ? UIFocusPath.MoveType.RIGHT : (arg1 == UIManager.KeyType.A ? UIFocusPath.MoveType.OK : UIFocusPath.MoveType.DOWN))); } } }
private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { if (!fisrtKeyUP) { fisrtKeyUP = true; return; } switch (keyType) { case UIManager.KeyType.A: SetSelectItemIndex(); Transform nextTrans = showItemList[selectItemIndex]; EventTrigger.Entry nextEntry = nextTrans.GetComponent <EventTrigger>().triggers.Where(temp => temp.eventID == EventTriggerType.PointerClick).FirstOrDefault(); if (nextEntry != null) { nextEntry.callback.Invoke(null); } break; case UIManager.KeyType.B: Transform returnTrans = showItemList[showItemList.Count - 1]; EventTrigger.Entry returnEntry = returnTrans.GetComponent <EventTrigger>().triggers.Where(temp => temp.eventID == EventTriggerType.PointerClick).FirstOrDefault(); if (returnEntry != null) { returnEntry.callback.Invoke(null); } break; case UIManager.KeyType.UP: selectItemIndex--; SetSelectItemIndex(); break; case UIManager.KeyType.DOWN: selectItemIndex++; SetSelectItemIndex(); break; } }
private void Instance_KeyPressHandle(UIManager.KeyType arg1, Vector2 arg2) { if (keyContactData != null) { switch (arg1) { case UIManager.KeyType.R1: r1Press = true; break; case UIManager.KeyType.R2: r2Press = true; break; case UIManager.KeyType.L1: l1Press = true; break; case UIManager.KeyType.L2: l2Press = true; 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.GetNewNextFocus(nowTabPageFocus, UIFocusPath.MoveType.RIGHT); break; case UIManager.KeyType.L1: nextTabPageFocus = uiFocusPath.GetNewNextFocus(nowTabPageFocus, UIFocusPath.MoveType.LEFT); break; } TabPageClick(nextTabPageFocus as UIFocusTabPage); } switch (keyType) { case UIManager.KeyType.B: //返回 CloseActionClick(); break; } }
/// <summary> /// 检测持续按下 /// 主要用于检测摇杆实现快速翻动 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyPressHandle(UIManager.KeyType keyType, Vector2 rockValue) { //只有获取焦点时才可以使用摇杆 if (focused && keyType == UIManager.KeyType.LEFT_ROCKER) { //向上- 向下+ if (Mathf.Abs(rockValue.y) > 0) { uiDepostiList.MoveScroll(-rockValue.y); if (!uiDepostiList.ItemIsShow(focusUIListItem)) { if (focusUIListItem && focusUIListItem.childImage) { focusUIListItem.childImage.enabled = false; } focusUIListItem = rockValue.y > 0 ? uiDepostiList.FirstShowItem() : uiDepostiList.LastShowItem(); if (focusUIListItem && focusUIListItem.childImage) { focusUIListItem.childImage.enabled = true; } } } } }
/// <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 (!nowKeySettingLattice && keySettingFocusPath) { nowKeySettingLattice = keySettingFocusPath.GetFirstFocus() as UIFocusKeySettingLattice; } switch (enumKeySettingType) { case EnumKeySettingType.Lattice: //此时可以移动和确认 Action <UIFocusPath.MoveType> MoveNExtEndAction = (moveType) => { if (keySettingFocusPath) { //UIFocusKeySettingLattice currentKeySettingLattice = keySettingFocusPath.GetNextFocus(nowKeySettingLattice, moveType) as UIFocusKeySettingLattice; //UIFocusKeySettingLattice currentKeySettingLattice = keySettingFocusPath.GetNextFocus(nowKeySettingLattice, moveType, UIFocusPath.EnumFocusCheckModel.Vertical) as UIFocusKeySettingLattice; UIFocusKeySettingLattice currentKeySettingLattice = keySettingFocusPath.GetNewNextFocus(nowKeySettingLattice, moveType) as UIFocusKeySettingLattice; if (currentKeySettingLattice != null && !object.Equals(currentKeySettingLattice, nowKeySettingLattice)) { nowKeySettingLattice.LostForcus(); nowKeySettingLattice = currentKeySettingLattice; nowKeySettingLattice.SetForcus(); } } }; switch (keyType) { case UIManager.KeyType.A: //进入选择 //显示集合 ShowUIList(); break; case UIManager.KeyType.LEFT: MoveNExtEndAction(UIFocusPath.MoveType.LEFT); break; case UIManager.KeyType.RIGHT: MoveNExtEndAction(UIFocusPath.MoveType.RIGHT); break; case UIManager.KeyType.UP: MoveNExtEndAction(UIFocusPath.MoveType.UP); break; case UIManager.KeyType.DOWN: MoveNExtEndAction(UIFocusPath.MoveType.DOWN); break; } break; case EnumKeySettingType.Select: //此时可以选择技能 Action <int> MoveListSelect = (addOffset) => { UIListItem[] tempArrays = uiKeySettingList.GetAllImtes(); int index = 0; if (nowKeySettingListItem) { index = tempArrays.ToList().IndexOf(nowKeySettingListItem); } if (index < 0) { index = 0; } index += addOffset; index = Mathf.Clamp(index, 0, tempArrays.Length - 1); if (index < tempArrays.Length && tempArrays.Length > 0) { uiKeySettingList.ShowItem(tempArrays[index]); if (nowKeySettingListItem && nowKeySettingListItem.childImage) { nowKeySettingListItem.childImage.enabled = false; } nowKeySettingListItem = tempArrays[index]; if (nowKeySettingListItem && nowKeySettingListItem.childImage) { nowKeySettingListItem.childImage.enabled = true; } } }; switch (keyType) { case UIManager.KeyType.A: //确认选择 SelectAction(); break; case UIManager.KeyType.UP: MoveListSelect(-1); break; case UIManager.KeyType.DOWN: MoveListSelect(1); 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; } }
/// <summary> /// 按键检测 /// </summary> /// <param name="keyType"></param> /// <param name="rockValue"></param> private void Instance_KeyUpHandle(UIManager.KeyType keyType, Vector2 rockValue) { switch (enumUISkillCombine) { case EnumUISkillCombine.CombineSkillItem: //处于左侧状态 switch (keyType) { case UIManager.KeyType.A: if (nowCombineSkillItem) { //设置技能框的边框显示 nowUISkilCombineLattice = uiFocusPath.GetFirstFocus <UIFocusSkillCombineLattice>(); if (nowUISkilCombineLattice) { nowUISkilCombineLattice.SetForcus(); } //同时将模式更改为CombineSkillLattice enumUISkillCombine = EnumUISkillCombine.CombineSkillLattice; uiCombineSkillList.CanClickListItem = false; } break; case UIManager.KeyType.UP: case UIManager.KeyType.DOWN: { UIListItem[] tempArrays = uiCombineSkillList.GetAllImtes(); int index = 0; if (nowCombineSkillItem) { index = tempArrays.ToList().IndexOf(nowCombineSkillItem); } if (index < 0) { index = 0; } switch (keyType) { case UIManager.KeyType.UP: index--; break; case UIManager.KeyType.DOWN: index++; break; } index = Mathf.Clamp(index, 0, tempArrays.Length - 1); if (index < tempArrays.Length) { uiCombineSkillList.ShowItem(tempArrays[index]); if (nowCombineSkillItem && nowCombineSkillItem.childImage) { nowCombineSkillItem.childImage.enabled = false; nowCombineSkillItem.childImage.gameObject.SetActive(false); } nowCombineSkillItem = tempArrays[index]; if (nowCombineSkillItem && nowCombineSkillItem.childImage) { nowCombineSkillItem.childImage.enabled = true; nowCombineSkillItem.childImage.gameObject.SetActive(true); } if (nowCombineSkillItem) { SetSkillCombineLatticeAndShowVadio((EnumSkillType[])nowCombineSkillItem.value); } } } break; } break; case EnumUISkillCombine.CombineSkillLattice: //处于右侧状态 switch (keyType) { case UIManager.KeyType.A: SetSelectSkill(); break; case UIManager.KeyType.B: if (nowUISkilCombineLattice) { nowUISkilCombineLattice.LostForcus(); } enumUISkillCombine = EnumUISkillCombine.CombineSkillItem; //切换模式到组合技能集合 uiCombineSkillList.CanClickListItem = true; break; case UIManager.KeyType.LEFT: case UIManager.KeyType.RIGHT: if (nowUISkilCombineLattice) { UIFocusSkillCombineLattice tempUIFocuesSkillCombineLattice = uiFocusPath.GetNewNextFocus(nowUISkilCombineLattice, keyType == UIManager.KeyType.LEFT ? UIFocusPath.MoveType.LEFT : UIFocusPath.MoveType.RIGHT) as UIFocusSkillCombineLattice; //uiFocusPath.GetNextFocus(nowUISkilCombineLattice, keyType == UIManager.KeyType.LEFT ? UIFocusPath.MoveType.LEFT : UIFocusPath.MoveType.RIGHT) as UIFocusSkillCombineLattice; if (tempUIFocuesSkillCombineLattice) { nowUISkilCombineLattice.LostForcus(); nowUISkilCombineLattice = tempUIFocuesSkillCombineLattice; nowUISkilCombineLattice.SetForcus(); } } break; } break; case EnumUISkillCombine.CombineSkillSelect: //处于选择技能状态 switch (keyType) { case UIManager.KeyType.A: ResetCombineSkillLattice(); break; case UIManager.KeyType.B: //切换状态 uiSelectSkillList.gameObject.SetActive(false); enumUISkillCombine = EnumUISkillCombine.CombineSkillLattice; break; case UIManager.KeyType.UP: case UIManager.KeyType.DOWN: { UIListItem[] tempArrays = uiSelectSkillList.GetAllImtes(); int index = 0; if (nowCombineSkillItem) { index = tempArrays.ToList().IndexOf(nowSelectSkillItem); } if (index < 0) { index = 0; } switch (keyType) { case UIManager.KeyType.UP: index--; break; case UIManager.KeyType.DOWN: index++; break; } index = Mathf.Clamp(index, 0, tempArrays.Length - 1); if (index < tempArrays.Length) { uiSelectSkillList.ShowItem(tempArrays[index]); if (uiSelectSkillList && nowSelectSkillItem.childImage) { nowSelectSkillItem.childImage.enabled = false; nowSelectSkillItem.childImage.gameObject.SetActive(false); } nowSelectSkillItem = tempArrays[index]; if (uiSelectSkillList && nowSelectSkillItem.childImage) { nowSelectSkillItem.childImage.enabled = true; nowSelectSkillItem.childImage.gameObject.SetActive(true); } } } break; } break; } }