public float GetActionHoldProgress(TriggerAction.TYPE action) { if (!this.m_ActiveHoldActionsByTriggerAction.ContainsKey((int)action)) { return(0f); } InputActionData inputActionData = null; this.m_ActiveHoldActionsByTriggerAction.TryGetValue((int)action, out inputActionData); if (inputActionData.m_Hold == 0f) { return(0f); } return(Mathf.Clamp01((Time.time - inputActionData.m_StartHoldTime) / inputActionData.m_Hold)); }
public void OnInputAction(InputActionData action_data) { if (action_data.m_Action == InputsManager.InputAction.StartCrafting) { if (CraftingManager.Get().m_Results.Count > 0) { CraftingManager.Get().StartCrafting(CraftingManager.Get().m_Results[0].m_ID); return; } } else if (action_data.m_Action == InputsManager.InputAction.Button_X && this.IsOverCraftButton() && CraftingManager.Get().m_Results.Count > 0) { CraftingManager.Get().StartCrafting(CraftingManager.Get().m_Results[0].m_ID); } }
protected override void OnHandleInputAction(InputActionData _inputData) { InputType _type = _inputData.Type; Vector2 _cursorPosition = _inputData.CursorPosition; Vector2 _clickPosition = _inputData.ClickPosition; float _distanceFromScreen = _inputData.ProgressToClick; switch (_type) { case InputType.MOVE: UpdateCursor(_cursorPosition, _distanceFromScreen); break; case InputType.DOWN: case InputType.HOLD: openHandImage.enabled = false; closedHandImage.enabled = true; break; case InputType.DRAG: openHandImage.enabled = false; closedHandImage.enabled = true; break; case InputType.UP: case InputType.HOVER: case InputType.CANCEL: openHandImage.enabled = true; closedHandImage.enabled = false; break; case InputType.SETLEFT: if (!leftHanded) { cursorDot.transform.Rotate(0f, 180f, 0f); leftHanded = true; } break; case InputType.SETRIGHT: if (leftHanded) { cursorDot.transform.Rotate(0f, 180f, 0f); leftHanded = false; } break; } }
public override void OnInputAction(InputActionData action_data) { if (action_data.m_Action == InputsManager.InputAction.LSBackward || action_data.m_Action == InputsManager.InputAction.DPadDown) { for (int i = 0; i < this.m_Slots.Count; i++) { if ((!this.IsLoadGameMenu() || this.m_Slots[i].m_SaveInfo.loadable) && this.m_Slots[i].IsHighlighted()) { for (int j = i + 1; j < this.m_Slots.Count; j++) { if (!this.IsLoadGameMenu() || this.m_Slots[j].m_SaveInfo.loadable) { this.m_Slots[j].Select(); this.m_Slots[j].OnSelect(null); return; } } return; } } return; } if (action_data.m_Action == InputsManager.InputAction.LSForward || action_data.m_Action == InputsManager.InputAction.DPadUp) { for (int k = 0; k < this.m_Slots.Count; k++) { if ((!this.IsLoadGameMenu() || this.m_Slots[k].m_SaveInfo.loadable) && this.m_Slots[k].IsHighlighted()) { for (int l = k - 1; l >= 0; l--) { if (!this.IsLoadGameMenu() || this.m_Slots[l].m_SaveInfo.loadable) { this.m_Slots[l].Select(); this.m_Slots[l].OnSelect(null); break; } } } } return; } if (action_data.m_Action == InputsManager.InputAction.Button_A) { this.CheckSelection(); return; } base.OnInputAction(action_data); }
protected override void OnHandleInputAction(InputActionData _inputData) { InputType _type = _inputData.Type; Vector2 _cursorPosition = _inputData.CursorPosition; Vector2 _clickPosition = _inputData.ClickPosition; float _distanceFromScreen = _inputData.ProgressToClick; clickPosition = _clickPosition; cursorPosition = _cursorPosition; switch (_type) { case InputType.MOVE: UpdateBlobCursor(); if (_distanceFromScreen > maxScreenDistance) { ChangeToCursor(BlobState.HIDDEN); } else if (cursorState == BlobState.HIDDEN) { ChangeToCursor(BlobState.PASSIVE); } break; case InputType.DOWN: if (_distanceFromScreen <= maxScreenDistance) { ChangeToCursor(BlobState.ACTIVE); } break; case InputType.DRAG: break; case InputType.CANCEL: break; case InputType.UP: if (cursorState != BlobState.HIDDEN) { ChangeToCursor(BlobState.PASSIVE); } break; case InputType.HOVER: break; } }
private void OnTriggerAction(ref TriggerController.TriggerData data, ref List <TriggerHoldData> hold_data, TriggerAction.TYPE action) { if (data.trigger && data.actions.Contains(action) && data.trigger.CanExecuteActions()) { InputActionData inputActionData = InputsManager.Get().GetInputActionData(action); if (this.m_TriggerInAction) { return; } if (inputActionData.m_Hold == 0f) { TriggerAction.TYPE type = TriggerAction.TYPE.None; for (int i = 0; i < data.actions.Count; i++) { InputActionData inputActionData2 = InputsManager.Get().GetInputActionData(data.actions[i]); if (inputActionData2 != null && inputActionData2.m_TriggerAction != action && inputActionData2.m_KeyCode == inputActionData.m_KeyCode && inputActionData2.m_Hold > 0f) { type = inputActionData2.m_TriggerAction; break; } } if (type != TriggerAction.TYPE.None) { hold_data.Add(new TriggerHoldData(action, type)); return; } this.ExecuteTrigger(data.trigger, action); return; } else { int j = 0; while (j < hold_data.Count) { if (hold_data[j].m_HoldAction == action) { hold_data.RemoveAt(j); } else { j++; } } this.ExecuteTrigger(data.trigger, action); } } }
public override void OnInputAction(InputActionData action_data) { base.OnInputAction(action_data); if (action_data.m_Action == InputsManager.InputAction.BowAim) { if (!Inventory3DManager.Get().gameObject.activeSelf&& this.m_State == BowController.State.Idle && this.m_Arrow != null && Time.time - this.m_EnterStateTime >= 0.5f && !PlayerConditionModule.Get().IsLowStamina()) { this.SetState(BowController.State.AimLoop); this.PlayDrawSound(); return; } } else if (action_data.m_Action == InputsManager.InputAction.BowShot) { if (this.m_State == BowController.State.AimLoop && this.m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash == this.m_BowAimLoop) { this.SetState(BowController.State.Shot); this.PlayShotSound(); return; } this.SetState(BowController.State.Idle); return; } else if (action_data.m_Action == InputsManager.InputAction.BowCancelAim) { if (this.m_State == BowController.State.AimLoop) { this.SetState(BowController.State.Idle); return; } } else if (action_data.m_Action == InputsManager.InputAction.BowMaxAim) { if (this.m_State == BowController.State.AimLoop && !this.m_MaxAim && !PlayerConditionModule.Get().IsStaminaCriticalLevel()) { Player.Get().StopShake(0.5f); this.m_MaxAim = true; return; } } else if (action_data.m_Action == InputsManager.InputAction.BowStopMaxAim && this.m_State == BowController.State.AimLoop && this.m_MaxAim) { this.StartShake(); this.m_MaxAim = false; } }
protected override void OnHandleInputAction(InputActionData _inputData) { if (_inputData.Type == InputType.MOVE) { if (_inputData.Source == moveInteraction) { UpdateCursor(_inputData.CursorPosition, _inputData.ProgressToClick); } } if (_inputData.Source == clickInteraction) { switch (_inputData.Type) { case InputType.DOWN: if (!dotShrunk) { if (cursorScalingRoutine != null) { StopCoroutine(cursorScalingRoutine); } cursorScalingRoutine = StartCoroutine(ShrinkCursorDot()); } break; case InputType.UP: case InputType.HOVER: if (dotShrunk) { if (cursorScalingRoutine != null) { StopCoroutine(cursorScalingRoutine); } cursorScalingRoutine = StartCoroutine(GrowCursorDot()); } break; case InputType.MOVE: case InputType.CANCEL: break; } } }
private void Setup() { this.m_PosY = this.m_Dummy.transform.localPosition.y; this.m_MaxBGWidth = 0f; int num = 0; foreach (DialogNode dialogNode in this.m_Nodes) { if (!dialogNode.m_Additional) { this.AddNode(dialogNode, num++); } } float x = ((RectTransform)HUDManager.Get().m_CanvasGameObject.transform).localScale.x; foreach (UISelectDialogNodeData uiselectDialogNodeData in this.m_UINodeDatas) { uiselectDialogNodeData.m_BG.rectTransform.sizeDelta = new Vector2(this.m_MaxBGWidth, uiselectDialogNodeData.m_BG.rectTransform.sizeDelta.y); Vector3 position = uiselectDialogNodeData.m_BG.transform.position; position.x += this.m_MaxBGWidth * 0.29f * x + uiselectDialogNodeData.m_PadIcon.rectTransform.rect.width * 0.3f * x; uiselectDialogNodeData.m_PadIcon.transform.position = position; uiselectDialogNodeData.m_PadIcon.gameObject.SetActive(false); } string str = (this.m_Nodes[0].m_Prevs.Count > 0 && this.m_Nodes[0].m_Prevs[0].m_IconName != string.Empty) ? this.m_Nodes[0].m_Prevs[0].m_IconName : "Walkie_talkie_icon"; this.m_Icon.texture = Resources.Load <Texture>("HUD/HUD_Walkie_Talkie/" + str); this.m_TimerBelt[GreenHellGame.IsPCControllerActive() ? 0 : 1].gameObject.SetActive(this.m_Duration > 0f); InputActionData actionDataByInputAction = InputsManager.Get().GetActionDataByInputAction(InputsManager.InputAction.ShowSelectDialogNode, ControllerType._Count); this.m_KeyText.text = KeyCodeToString.GetString((actionDataByInputAction != null) ? actionDataByInputAction.m_KeyCode : KeyCode.None); GameObject gameObject = GreenHellGame.IsPCControllerActive() ? this.m_Reply : this.m_ReplyPad; Vector3 position2 = this.m_KeyFrame.transform.position; position2.x = gameObject.transform.position.x; Text component = gameObject.GetComponent <Text>(); TextGenerationSettings generationSettings = component.GetGenerationSettings(component.rectTransform.rect.size); generationSettings.scaleFactor = 1f; float num2 = this.m_TextGen.GetPreferredWidth(component.text, generationSettings) * x; position2.x -= num2 * 0.5f; position2.x -= this.m_KeyFrame.GetComponent <RectTransform>().sizeDelta.x * 1.1f * x; this.m_KeyFrame.transform.position = position2; this.m_PadIcon.transform.position = position2; }
public override void OnInputAction(InputActionData action_data) { InputsManager.InputAction action = action_data.m_Action; if (action == InputsManager.InputAction.Drop) { this.m_Player.DropItem(this.m_Bowl); return; } if (action == InputsManager.InputAction.BowlSpil) { this.Spill(-1f); return; } if (action != InputsManager.InputAction.BowlDrink) { return; } this.Drink(); }
protected override void HandleInputAction(InputActionData _inputData) { base.HandleInputAction(_inputData); InputType _type = _inputData.Type; Vector2 _cursorPosition = _inputData.CursorPosition; Vector2 _clickPosition = _inputData.ClickPosition; float _distanceFromScreen = _inputData.ProgressToClick; touchPosition = _clickPosition; if (_type == InputType.MOVE || _type == InputType.HOVER) { return; } touchPhase = TouchPhase.Ended; eventSystem.pixelDragThreshold = baseDragThreshold; switch (_type) { case InputType.DOWN: touchPhase = TouchPhase.Began; break; case InputType.HOLD: touchPhase = TouchPhase.Moved; break; case InputType.DRAG: touchPhase = TouchPhase.Moved; eventSystem.pixelDragThreshold = 0; break; case InputType.CANCEL: touchPhase = TouchPhase.Canceled; break; case InputType.UP: touchPhase = TouchPhase.Ended; break; } }
protected override void OnHandleInputAction(InputActionData _inputData) { InputType _type = _inputData.Type; Vector2 _cursorPosition = _inputData.CursorPosition; Vector2 _clickPosition = _inputData.ClickPosition; float _distanceFromScreen = _inputData.ProgressToClick; switch (_type) { case InputType.MOVE: UpdateCursor(_cursorPosition, _distanceFromScreen); break; case InputType.DOWN: if (!shrunk) { if (cursorScalingRoutine != null) { StopCoroutine(cursorScalingRoutine); } cursorScalingRoutine = StartCoroutine(ShrinkCursorDot()); } break; case InputType.UP: case InputType.HOVER: if (shrunk) { if (cursorScalingRoutine != null) { StopCoroutine(cursorScalingRoutine); } cursorScalingRoutine = StartCoroutine(GrowCursorDot()); } break; case InputType.CANCEL: break; } }
private void OnAction(InputActionData action) { if (action.m_TriggerAction != TriggerAction.TYPE.None) { if (TriggerController.Get() != null) { TriggerController.Get().OnTriggerAction(action.m_TriggerAction); } } else { foreach (IInputsReceiver inputsReceiver in this.m_Receivers) { if (inputsReceiver.CanReceiveAction()) { inputsReceiver.OnInputAction(action.m_Action); } } } }
public override void OnInputAction(InputActionData action_data) { base.OnInputAction(action_data); InputsManager.InputAction action = action_data.m_Action; if (action != InputsManager.InputAction.BlowpipeAim) { if (action != InputsManager.InputAction.BlowpipeShot) { return; } if (this.m_State == BlowpipeController.State.Aim) { this.SetState(BlowpipeController.State.Shot); } } else if (!Inventory3DManager.Get().gameObject.activeSelf&& this.m_State == BlowpipeController.State.Idle) { this.SetState(BlowpipeController.State.Aim); return; } }
public void OnInputAction(InputActionData action_data) { if ((action_data.m_Action == InputsManager.InputAction.LSBackward || action_data.m_Action == InputsManager.InputAction.DPadDown) && this.m_PadSelectionIndex < this.m_Datas.Count - 1) { this.m_PadSelectionIndex++; if (this.m_PadSelectionIndex >= this.m_MaxElements) { this.m_ScrollStep++; this.ApplyScroll(); } } if ((action_data.m_Action == InputsManager.InputAction.LSForward || action_data.m_Action == InputsManager.InputAction.DPadUp) && this.m_PadSelectionIndex > 0) { this.m_PadSelectionIndex--; if (this.m_PadSelectionIndex < this.m_ScrollStep) { this.m_ScrollStep--; this.ApplyScroll(); } } }
public void OnInputAction(InputActionData action_data) { if (action_data.m_Action == InputsManager.InputAction.HUDItemPrev || action_data.m_Action == InputsManager.InputAction.DPadDown) { this.m_PadSelectedIndex++; if (this.m_PadSelectedIndex >= this.m_ActiveButtons.Count) { this.m_PadSelectedIndex = 0; return; } } else if (action_data.m_Action == InputsManager.InputAction.HUDItemNext || action_data.m_Action == InputsManager.InputAction.DPadUp) { this.m_PadSelectedIndex--; if (this.m_PadSelectedIndex < 0) { this.m_PadSelectedIndex = this.m_ActiveButtons.Count - 1; return; } } else { if (action_data.m_Action == InputsManager.InputAction.HUDItemSelect) { this.Execute(); return; } if (action_data.m_Action == InputsManager.InputAction.HUDItemCancel) { if (this.m_DestroyButton != null && this.m_DestroyButton.confirm && this.m_DestroyButton.confirm.gameObject.activeSelf) { this.m_DestroyButton.confirm.gameObject.SetActive(false); this.m_DestroyButton.confirm_sel.gameObject.SetActive(false); return; } this.Deactivate(); } } }
public void OnInputAction(InputActionData action_data) { if (GreenHellGame.GetYesNoDialog().gameObject.activeSelf) { return; } if (this.m_ButtonsGrp.activeSelf) { if (action_data.m_Action == InputsManager.InputAction.Button_A) { this.OnLoadGame(); } else if (action_data.m_Action == InputsManager.InputAction.Button_B) { this.OnQuit(); } } if (this.m_CoopButtonsGrp.activeSelf && action_data.m_Action == InputsManager.InputAction.Button_A) { this.OnRespawn(); } }
public void OnInputAction(InputActionData action_data) { if (action_data.m_Action == InputsManager.InputAction.ShowWheel && !this.m_Active && Player.Get().CanInvokeWheelHUD()) { this.Activate(); } if (!base.enabled) { return; } if (action_data.m_Action == InputsManager.InputAction.HideWheel && this.m_Active) { this.Deactivate(true); return; } if (action_data.m_Action == InputsManager.InputAction.WheelSelect) { this.Execute(); this.m_Active = false; base.Show(false); } }
private void LoadAxis(Key key, bool analog) { InputActionData inputActionData = new InputActionData(); ControllerType controllerType = (ControllerType)Enum.Parse(typeof(ControllerType), key.GetVariable(2).SValue); inputActionData.m_Action = (InputsManager.InputAction)Enum.Parse(typeof(InputsManager.InputAction), key.GetVariable(0).SValue); inputActionData.m_AxisName = key.GetVariable(1).SValue; inputActionData.m_Inverted = key.GetVariable(3).BValue; inputActionData.m_Analog = analog; inputActionData.m_ControllerType = controllerType; if (inputActionData.m_ControllerType == ControllerType.Pad) { inputActionData.m_PadIcon = InputHelpers.GetPadIcon(inputActionData); } if (!analog) { inputActionData.m_Histeresis.x = ((key.GetVariable(4) != null) ? Mathf.Min(0.99f, key.GetVariable(4).FValue) : 0.5f); inputActionData.m_Histeresis.y = ((key.GetVariable(5) != null) ? Mathf.Min(0.99f, key.GetVariable(5).FValue) : 0.5f); inputActionData.m_Type = ((key.GetVariable(6) != null) ? ((InputsManager.InputActionType)Enum.Parse(typeof(InputsManager.InputActionType), key.GetVariable(6).SValue)) : InputsManager.InputActionType.Down); inputActionData.m_Hold = ((key.GetVariable(7) != null) ? key.GetVariable(7).FValue : 0f); } InputActionData[] array; if (!this.m_ActionsByInputAction.TryGetValue((int)inputActionData.m_Action, out array)) { array = new InputActionData[2]; this.m_ActionsByInputAction.Add((int)inputActionData.m_Action, array); } array[(int)controllerType] = inputActionData; List <InputActionData> list; if (!this.m_ActionsByAxis.TryGetValue(inputActionData.m_AxisName, out list)) { list = new List <InputActionData>(); this.m_ActionsByAxis.Add(inputActionData.m_AxisName, list); } list.Add(inputActionData); }
public void OnInputAction(InputActionData action_data) { if (action_data.m_Action == InputsManager.InputAction.BIShowHideArmor) { this.m_ArmorEnabled = !this.m_ArmorEnabled; PlayerArmorModule.Get().SetMeshesVisible(this.m_ArmorEnabled); if (this.m_ArmorEnabled) { BodyInspectionController.Get().OnArmorMeshesEnabled(); } else { BodyInspectionController.Get().OnArmorMeshesDisabled(); } if (this.m_ArmorEnabled) { this.m_ArmorOff.gameObject.SetActive(false); this.m_ArmorOn.gameObject.SetActive(true); return; } this.m_ArmorOff.gameObject.SetActive(true); this.m_ArmorOn.gameObject.SetActive(false); } }
private void UpdateActions() { foreach (HUDItemInHand.Action action in this.m_Actions) { action.rect_trans.anchoredPosition = action.disbled_pos; } if (!Player.Get().GetCurrentItem()) { return; } this.m_ActionsTemp.Clear(); Player.Get().GetInputActions(ref this.m_ActionsTemp); if (this.m_ActionsTemp.Count > this.m_Actions.Count) { DebugUtils.Assert("HUDItemInHand - Not enough action slots!", true, DebugUtils.AssertType.Info); } bool flag = GreenHellGame.IsPadControllerActive(); int num = 0; while (num < this.m_ActionsTemp.Count && num < this.m_Actions.Count) { InputActionData inputActionData = InputsManager.Get().GetInputActionData((InputsManager.InputAction) this.m_ActionsTemp[num]); string text; if (!this.m_CachedTexts.TryGetValue(this.m_ActionsTemp[num], out text)) { text = this.GetText(inputActionData); this.m_CachedTexts[this.m_ActionsTemp[num]] = text; } if (!text.Empty()) { HUDItemInHand.Action action2 = this.m_Actions[num]; action2.rect_trans.anchoredPosition = action2.position; action2.text.text = text; if (flag) { action2.pad_icon.sprite = inputActionData.m_PadIcon; action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.key_text_long.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(false); } else { string keyText = this.GetKeyText(inputActionData); if (inputActionData.m_KeyCode == KeyCode.Mouse0) { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.key_text_long.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(true); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(false); } else if (inputActionData.m_KeyCode == KeyCode.Mouse1) { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.key_text_long.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(true); action2.mouse_icon_mmb.gameObject.SetActive(false); } else if (inputActionData.m_KeyCode == KeyCode.Mouse2) { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.key_text_long.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(true); } else if (action2.key_text.text.Length <= 1) { action2.key_frame.gameObject.SetActive(true); action2.key_text.gameObject.SetActive(true); action2.key_text_long.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(false); action2.key_text.text = keyText; } else { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.key_text_long.gameObject.SetActive(true); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(false); action2.key_text_long.text = keyText; } } } num++; } }
public override void OnInputAction(InputActionData action_data) { InputsManager.InputAction action = action_data.m_Action; switch (action) { case InputsManager.InputAction.Drop: if (this.m_Animator.GetBool(this.m_FireHash) && this.m_Item && this.m_Item.gameObject && !this.m_Item.m_IsBeingDestroyed) { UnityEngine.Object.Destroy(this.m_Item.gameObject); Player.Get().SetWantedItem(Hand.Right, null, true); } break; case InputsManager.InputAction.MeleeAttack: break; case InputsManager.InputAction.ItemSwing: if (this.CanSwing()) { this.SetState(ItemController.State.Swing); return; } break; case InputsManager.InputAction.ItemAim: if (this.CanThrow()) { this.SetState(ItemController.State.Aim); return; } break; case InputsManager.InputAction.ItemCancelAim: if (this.m_State == ItemController.State.Aim || this.m_State == ItemController.State.StoneAim) { if (this.m_Item.m_Info.IsStone()) { InventoryBackpack.Get().InsertItem(this.m_Item, null, null, true, true, true, true, true); Player.Get().SetWantedItem(Hand.Right, null, true); } this.m_LastUnAimTime = Time.time; this.SetState(ItemController.State.None); return; } break; case InputsManager.InputAction.ItemThrow: if (this.m_State == ItemController.State.Aim) { this.SetState(ItemController.State.Throw); return; } break; default: if (action != InputsManager.InputAction.ThrowStonePad) { return; } if (this.m_State == ItemController.State.StoneAim) { Camera mainCamera = CameraManager.Get().m_MainCamera; Player.Get().m_StopAimCameraMtx.SetColumn(0, mainCamera.transform.right); Player.Get().m_StopAimCameraMtx.SetColumn(1, mainCamera.transform.up); Player.Get().m_StopAimCameraMtx.SetColumn(2, mainCamera.transform.forward); Player.Get().m_StopAimCameraMtx.SetColumn(3, mainCamera.transform.position); this.SetState(ItemController.State.Throw); return; } break; } }
private void UpdateActions() { foreach (HUDItemInHand.Action action in this.m_Actions) { action.rect_trans.anchoredPosition = action.disbled_pos; } if (!Player.Get().GetCurrentItem()) { return; } this.m_ActionsTemp.Clear(); Player.Get().GetInputActions(ref this.m_ActionsTemp); if (this.m_ActionsTemp.Count > this.m_Actions.Count) { DebugUtils.Assert("HUDItemInHand - Not enough action slots!", true, DebugUtils.AssertType.Info); } int num = 0; while (num < this.m_ActionsTemp.Count && num < this.m_Actions.Count) { InputActionData inputActionData = InputsManager.Get().GetInputActionData((InputsManager.InputAction) this.m_ActionsTemp[num]); string text = this.GetText(inputActionData); if (!text.Empty()) { HUDItemInHand.Action action2 = this.m_Actions[num]; action2.rect_trans.anchoredPosition = action2.position; if (inputActionData.m_KeyCode == KeyCode.Mouse0) { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(true); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(false); } else if (inputActionData.m_KeyCode == KeyCode.Mouse1) { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(true); action2.mouse_icon_mmb.gameObject.SetActive(false); } else if (inputActionData.m_KeyCode == KeyCode.Mouse2) { action2.key_frame.gameObject.SetActive(false); action2.key_text.gameObject.SetActive(false); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(true); } else { action2.key_frame.gameObject.SetActive(true); action2.key_text.gameObject.SetActive(true); action2.mouse_icon_lmb.gameObject.SetActive(false); action2.mouse_icon_rmb.gameObject.SetActive(false); action2.mouse_icon_mmb.gameObject.SetActive(false); } action2.text.text = text; action2.key_text.text = this.GetKeyText(inputActionData); } num++; } }
private void HandleInteractionModuleInputAction(InputActionData _inputData) { HandleInputAction?.Invoke(_inputData); }
public virtual void OnInputAction(InputActionData action_data) { }
protected void SendInputAction(InputType _type, Vector2 _cursorPosition, Vector2 _clickPosition, float _distanceFromScreen) { InputActionData actionData = new InputActionData(InteractionType, _type, _cursorPosition, _clickPosition, _distanceFromScreen); HandleInputAction?.Invoke(actionData); }
private void SetupPadText() { string text = this.m_ActiveHint.m_LocalizedPadText; foreach (Image image in this.m_PadIcons) { image.gameObject.SetActive(false); } TextGenerationSettings generationSettings = this.m_Text.GetGenerationSettings(this.m_Text.rectTransform.rect.size); generationSettings.scaleFactor = 1f; float num = 20f; float preferredWidth = this.m_TextGen.GetPreferredWidth(" ", generationSettings); int num2 = (int)(num / preferredWidth); string text2 = ""; for (int i = 0; i < num2; i++) { text2 += " "; } float preferredWidth2 = this.m_TextGen.GetPreferredWidth(text2, generationSettings); int j = 0; int num3 = 0; int num4 = 0; j = text.IndexOf("[", j); if (j < 0) { this.m_Text.text = text; return; } string text3 = text; int num5 = 0; while (j >= 0) { num3 = text3.IndexOf("]", j); if (num4 == 0) { text = text3.Substring(num4, j - num4); } else { text += text3.Substring(num4 + 1, j - num4 - 1); } text += text2; string value = text3.Substring(j + 1, num3 - j - 1); InputsManager.InputAction input_action = InputsManager.InputAction.None; Enum.TryParse <InputsManager.InputAction>(value, true, out input_action); InputActionData actionDataByInputAction = InputsManager.Get().GetActionDataByInputAction(input_action, ControllerType.Pad); if (actionDataByInputAction != null) { this.m_PadIcons[num5].sprite = actionDataByInputAction.m_PadIcon; this.m_PadIcons[num5].gameObject.SetActive(true); } num4 = num3; j = text3.IndexOf("[", num4); num5++; } text += text3.Substring(num3 + 1, text3.Length - num3 - 1); this.m_Text.text = text; float preferredWidth3 = this.m_TextGen.GetPreferredWidth(text, generationSettings); Vector3 localPosition = this.m_Text.rectTransform.localPosition; localPosition.x -= preferredWidth3 * 0.5f; j = 0; text3 = text; num5 = 0; j = text.IndexOf(text2, j); while (j >= 0) { text = text3.Substring(0, j); float preferredWidth4 = this.m_TextGen.GetPreferredWidth(text, generationSettings); Vector3 localPosition2 = localPosition; localPosition2.x += preferredWidth4 + preferredWidth + preferredWidth2 * 0.5f; this.m_PadIcons[num5].rectTransform.localPosition = localPosition2; num4 = j + num2; j = text3.IndexOf(text2, num4); num5++; } }
public void OnInputAction(InputActionData action_data) { if (action_data.m_Action == InputsManager.InputAction.PrevItemOrPage) { if (!WatchController.Get().IsActive()) { this.SetPrevPage(); return; } } else if (action_data.m_Action == InputsManager.InputAction.NextItemOrPage) { if (!WatchController.Get().IsActive()) { this.SetNextPage(); return; } } else if (action_data.m_Action == InputsManager.InputAction.NotepadNextTab) { switch (this.m_ActiveTab) { case MenuNotepad.MenuNotepadTab.StoryTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, false); return; case MenuNotepad.MenuNotepadTab.MapTab: break; case MenuNotepad.MenuNotepadTab.ItemsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.PlantsTab, false); return; case MenuNotepad.MenuNotepadTab.ConstructionsTab: if (GreenHellGame.Instance.m_GameMode == GameMode.Survival) { this.SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, false); return; } this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryObjectivesTab, false); return; case MenuNotepad.MenuNotepadTab.FirecampTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.WaterConstructionsTab, false); return; case MenuNotepad.MenuNotepadTab.TrapsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, false); return; case MenuNotepad.MenuNotepadTab.SkillsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.MudBuildingsTab, false); return; case MenuNotepad.MenuNotepadTab.WaterConstructionsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.TrapsTab, false); return; case MenuNotepad.MenuNotepadTab.HealingItemsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.SkillsTab, false); return; case MenuNotepad.MenuNotepadTab.PlantsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.HealingItemsTab, false); return; case MenuNotepad.MenuNotepadTab.CustomConstructionsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.FirecampTab, false); return; case MenuNotepad.MenuNotepadTab.StoryObjectivesTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryTab, false); return; case MenuNotepad.MenuNotepadTab.MudBuildingsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.CustomConstructionsTab, false); return; default: return; } } else if (action_data.m_Action == InputsManager.InputAction.NotepadPrevTab) { switch (this.m_ActiveTab) { case MenuNotepad.MenuNotepadTab.StoryTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryObjectivesTab, false); return; case MenuNotepad.MenuNotepadTab.MapTab: break; case MenuNotepad.MenuNotepadTab.ItemsTab: if (GreenHellGame.Instance.m_GameMode == GameMode.Survival) { this.SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, false); return; } this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryTab, false); return; case MenuNotepad.MenuNotepadTab.ConstructionsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.TrapsTab, false); break; case MenuNotepad.MenuNotepadTab.FirecampTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.CustomConstructionsTab, false); return; case MenuNotepad.MenuNotepadTab.TrapsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.WaterConstructionsTab, false); return; case MenuNotepad.MenuNotepadTab.SkillsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.HealingItemsTab, false); return; case MenuNotepad.MenuNotepadTab.WaterConstructionsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.FirecampTab, false); return; case MenuNotepad.MenuNotepadTab.HealingItemsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.PlantsTab, false); return; case MenuNotepad.MenuNotepadTab.PlantsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, false); return; case MenuNotepad.MenuNotepadTab.CustomConstructionsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.MudBuildingsTab, false); return; case MenuNotepad.MenuNotepadTab.StoryObjectivesTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, false); return; case MenuNotepad.MenuNotepadTab.MudBuildingsTab: this.SetActiveTab(MenuNotepad.MenuNotepadTab.SkillsTab, false); return; default: return; } } }
private void UpdateActions() { Trigger trigger = this.GetTrigger(); if (!trigger || !trigger.CanExecuteActions() || this.IsExpanded()) { for (int i = 0; i < this.m_Actions.Length; i++) { this.m_KeyFrames[i].gameObject.SetActive(false); this.m_Keys[i].gameObject.SetActive(false); this.m_Actions[i].gameObject.SetActive(false); if (this.m_MouseRMBIcon[i]) { this.m_MouseRMBIcon[i].gameObject.SetActive(false); } } return; } this.m_TriggerActions.Clear(); if (!this.IsExpanded()) { if (Inventory3DManager.Get().gameObject.activeSelf) { Item item = (!trigger.IsItem()) ? null : ((Item)trigger); if (item && item.m_OnCraftingTable) { this.m_TriggerActions.Add(TriggerAction.TYPE.Remove); } else { this.m_TriggerActions.Add(TriggerAction.TYPE.InventoryExpand); } } else { trigger.GetActions(this.m_TriggerActions); } } Vector3 position = Vector3.zero; int num = 0; while (num < this.m_TriggerActions.Count && num < 2) { this.m_KeyFrames[num].gameObject.SetActive(true); this.m_Keys[num].gameObject.SetActive(true); this.m_Actions[num].gameObject.SetActive(true); if (this.m_MouseRMBIcon[num]) { this.m_MouseRMBIcon[num].gameObject.SetActive(false); } this.m_Keys[num].text = string.Empty; this.m_Actions[num].text = string.Empty; TriggerAction.TYPE action = this.m_TriggerActions[num]; InputActionData inputActionData = InputsManager.Get().GetInputActionData(action); if (inputActionData != null) { if (inputActionData.m_KeyCode == KeyCode.Mouse1) { if (this.m_MouseRMBIcon[num]) { this.m_MouseRMBIcon[num].gameObject.SetActive(true); this.m_KeyFrames[num].gameObject.SetActive(false); } this.m_Keys[num].gameObject.SetActive(false); } else { Text text = this.m_Keys[num]; text.text += inputActionData.m_KeyCode.ToString(); } if (inputActionData.m_Hold > 0f) { Text text2 = this.m_Actions[num]; text2.text = text2.text + GreenHellGame.Instance.GetLocalization().Get("HUD_Trigger_Hold") + " "; } Text text3 = this.m_Actions[num]; text3.text += GreenHellGame.Instance.GetLocalization().Get(TriggerAction.GetText(action)); } else { this.m_Actions[num].text = GreenHellGame.Instance.GetLocalization().Get(TriggerAction.GetText(action)); } if (num == 0) { TextGenerationSettings generationSettings = this.m_Actions[num].GetGenerationSettings(this.m_Actions[num].rectTransform.rect.size); float width = ((RectTransform)HUDManager.Get().m_CanvasGameObject.transform).rect.width; float x = ((RectTransform)HUDManager.Get().m_CanvasGameObject.transform).localScale.x; generationSettings.scaleFactor = x; float preferredWidth = this.m_TextGen.GetPreferredWidth(this.m_Actions[num].text, generationSettings); position = this.m_KeyFrames[num].rectTransform.position; position.x += this.m_KeyFrames[num].rectTransform.rect.width * 0.5f * x; position.x += preferredWidth + width * x * 0.01f; position.x += this.m_KeyFrames[num].rectTransform.rect.width * x; } else if (num == 1 && this.m_KeyFrameParents[num] != null) { this.m_KeyFrameParents[num].position = position; } num++; } for (int j = this.m_TriggerActions.Count; j < this.m_Actions.Length; j++) { this.m_KeyFrames[j].gameObject.SetActive(false); this.m_Keys[j].gameObject.SetActive(false); this.m_Actions[j].gameObject.SetActive(false); if (this.m_MouseRMBIcon[j] != null) { this.m_MouseRMBIcon[j].gameObject.SetActive(false); } } }
public override void OnInputAction(InputActionData action_data) { }