// Token: 0x06001789 RID: 6025 RVA: 0x0006663C File Offset: 0x0006483C private static void AddUser(Player inputPlayer, UserProfile userProfile) { if (LocalUserManager.UserExists(inputPlayer)) { return; } int firstAvailableId = LocalUserManager.GetFirstAvailableId(); LocalUser localUser = new LocalUser { inputPlayer = inputPlayer, id = firstAvailableId, userProfile = userProfile }; LocalUserManager.localUsersList.Add(localUser); userProfile.OnLogin(); MPEventSystem.FindByPlayer(inputPlayer).localUser = localUser; if (LocalUserManager.onUserSignIn != null) { LocalUserManager.onUserSignIn(localUser); } if (LocalUserManager.onLocalUsersUpdated != null) { LocalUserManager.onLocalUsersUpdated(); } }
// Token: 0x0600184F RID: 6223 RVA: 0x00073D88 File Offset: 0x00071F88 private void InputMapperOnInputMappedEvent(InputMapper.InputMappedEventData inputMappedEventData) { Debug.Log("InputMapperOnInputMappedEvent"); InputMapperHelper.< > c__DisplayClass23_0 CS$ < > 8__locals1; CS$ < > 8__locals1.incomingActionElementMap = inputMappedEventData.actionElementMap; CS$ < > 8__locals1.incomingActionId = inputMappedEventData.actionElementMap.actionId; CS$ < > 8__locals1.incomingElementIndex = inputMappedEventData.actionElementMap.elementIndex; CS$ < > 8__locals1.incomingElementType = inputMappedEventData.actionElementMap.elementType; CS$ < > 8__locals1.map = inputMappedEventData.actionElementMap.controllerMap; foreach (ControllerMap controllerMap in this.maps) { if (controllerMap != CS$ < > 8__locals1.map) { controllerMap.DeleteElementMapsWithAction(CS$ < > 8__locals1.incomingActionId); } } while (InputMapperHelper.< InputMapperOnInputMappedEvent > g__DeleteFirstConflictingElementMap | 23_1 (ref CS$ < > 8__locals1)) { } MPEventSystem mpeventSystem = this.eventSystem; if (mpeventSystem != null) { LocalUser localUser = mpeventSystem.localUser; if (localUser != null) { localUser.userProfile.RequestSave(false); } } Debug.Log("Mapping accepted."); this.Stop(); }
// Token: 0x06001504 RID: 5380 RVA: 0x00059AEC File Offset: 0x00057CEC private static void RefreshEventSystems() { int count = LocalUserManager.readOnlyLocalUsersList.Count; ReadOnlyCollection <MPEventSystem> readOnlyInstancesList = MPEventSystem.readOnlyInstancesList; readOnlyInstancesList[0].enabled = (count <= 1); for (int i = 1; i < readOnlyInstancesList.Count; i++) { readOnlyInstancesList[i].enabled = (readOnlyInstancesList[i].localUser != null); } int num = 0; for (int j = 0; j < readOnlyInstancesList.Count; j++) { MPEventSystem mpeventSystem = readOnlyInstancesList[j]; int playerSlot; if (!readOnlyInstancesList[j].enabled) { playerSlot = -1; } else { num = (playerSlot = num) + 1; } mpeventSystem.playerSlot = playerSlot; } MPEventSystemManager.primaryEventSystem = ((count > 0) ? LocalUserManager.readOnlyLocalUsersList[0].eventSystem : MPEventSystemManager.combinedEventSystem); MPEventSystemManager.availability.MakeAvailable(); }
// Token: 0x06001503 RID: 5379 RVA: 0x000599F4 File Offset: 0x00057BF4 private static void Initialize() { GameObject original = Resources.Load <GameObject>("Prefabs/UI/MPEventSystem"); IList <Player> players = ReInput.players.Players; for (int i = 0; i < players.Count; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original, RoR2Application.instance.transform); gameObject.name = string.Format(CultureInfo.InvariantCulture, "MPEventSystem Player{0}", i); MPEventSystem component = gameObject.GetComponent <MPEventSystem>(); RewiredStandaloneInputModule component2 = gameObject.GetComponent <RewiredStandaloneInputModule>(); Player player = players[i]; component2.RewiredPlayerIds = new int[] { player.id }; gameObject.GetComponent <MPInput>().player = player; if (i == 1) { MPEventSystemManager.kbmEventSystem = component; component.allowCursorPush = false; } component.player = players[i]; MPEventSystemManager.eventSystems[players[i].id] = component; } MPEventSystemManager.combinedEventSystem = MPEventSystemManager.eventSystems[0]; MPEventSystemManager.combinedEventSystem.isCombinedEventSystem = true; MPEventSystemManager.RefreshEventSystems(); }
// Token: 0x060017EC RID: 6124 RVA: 0x00072344 File Offset: 0x00070544 public static string GetGlyphString(MPEventSystemLocator eventSystemLocator, string actionName) { MPEventSystem eventSystem = eventSystemLocator.eventSystem; if (eventSystem) { return(Glyphs.GetGlyphString(eventSystem, actionName, AxisRange.Full)); } return("UNKNOWN"); }
// Token: 0x060016F1 RID: 5873 RVA: 0x0006D413 File Offset: 0x0006B613 private Player GetPlayer() { MPEventSystem eventSystem = this.eventSystemLocator.eventSystem; if (eventSystem == null) { return(null); } return(eventSystem.player); }
// Token: 0x0600178F RID: 6031 RVA: 0x00066798 File Offset: 0x00064998 private static void RemoveUser(int userIndex) { LocalUser localUser = LocalUserManager.localUsersList[userIndex]; if (LocalUserManager.onUserSignOut != null) { LocalUserManager.onUserSignOut(localUser); } localUser.userProfile.OnLogout(); MPEventSystem.FindByPlayer(localUser.inputPlayer).localUser = null; LocalUserManager.localUsersList.RemoveAt(userIndex); if (LocalUserManager.onLocalUsersUpdated != null) { LocalUserManager.onLocalUsersUpdated(); } }
// Token: 0x060017EE RID: 6126 RVA: 0x00072380 File Offset: 0x00070580 public static string GetGlyphString(MPEventSystem eventSystem, string actionName, AxisRange axisRange, MPEventSystem.InputSource currentInputSource) { Glyphs.< > c__DisplayClass18_0 CS$ < > 8__locals1; CS$ < > 8__locals1.inputPlayer = eventSystem.player; InputAction action = ReInput.mapping.GetAction(actionName); CS$ < > 8__locals1.inputActionId = action.id; CS$ < > 8__locals1.controllerName = "Xbox One Controller"; CS$ < > 8__locals1.controllerType = (ControllerType)(-1); CS$ < > 8__locals1.axisContributionMatters = (axisRange > AxisRange.Full); CS$ < > 8__locals1.axisContribution = Pole.Positive; if (axisRange == AxisRange.Negative) { CS$ < > 8__locals1.axisContribution = Pole.Negative; } if (currentInputSource != MPEventSystem.InputSource.Keyboard) { if (currentInputSource != MPEventSystem.InputSource.Gamepad) { throw new ArgumentOutOfRangeException(); } CS$ < > 8__locals1.controllerType = ControllerType.Joystick; Glyphs.< GetGlyphString > g__SetController | 18_0 (CS$ < > 8__locals1.inputPlayer.controllers.GetLastActiveController(ControllerType.Joystick), ref CS$ < > 8__locals1); if (CS$ < > 8__locals1.actionElementMap == null) { foreach (Controller controller in CS$ < > 8__locals1.inputPlayer.controllers.Controllers) { if (controller.type == ControllerType.Joystick) { Glyphs.< GetGlyphString > g__SetController | 18_0 (controller, ref CS$ < > 8__locals1); if (CS$ < > 8__locals1.actionElementMap != null) { break; } } } } if (CS$ < > 8__locals1.actionElementMap == null && eventSystem.localUser != null) { using (IEnumerator <ActionElementMap> enumerator2 = eventSystem.localUser.userProfile.joystickMap.ElementMapsWithAction(CS$ < > 8__locals1.inputActionId).GetEnumerator()) { if (enumerator2.MoveNext()) { ActionElementMap actionElementMap = enumerator2.Current; CS$ < > 8__locals1.actionElementMap = actionElementMap; } } } if (CS$ < > 8__locals1.actionElementMap == null) { return("[NO GAMEPAD BINDING]"); } } else { Glyphs.< GetGlyphString > g__SetController | 18_0 (CS$ < > 8__locals1.inputPlayer.controllers.Keyboard, ref CS$ < > 8__locals1); if (CS$ < > 8__locals1.actionElementMap == null) { Glyphs.< GetGlyphString > g__SetController | 18_0 (CS$ < > 8__locals1.inputPlayer.controllers.Mouse, ref CS$ < > 8__locals1); } if (CS$ < > 8__locals1.actionElementMap == null) { return("[NO KB/M BINDING]"); } } int elementIdentifierId = CS$ < > 8__locals1.actionElementMap.elementIdentifierId; Glyphs.GlyphKey key = new Glyphs.GlyphKey(CS$ < > 8__locals1.controllerName, elementIdentifierId); string result; if (Glyphs.glyphMap.TryGetValue(key, out result)) { return(result); } if (CS$ < > 8__locals1.controllerType == ControllerType.Keyboard) { return(Glyphs.GetKeyboardGlyphString(CS$ < > 8__locals1.actionElementMap.elementIdentifierName)); } if (CS$ < > 8__locals1.controllerType == ControllerType.Mouse) { string text = CS$ < > 8__locals1.actionElementMap.elementIdentifierName; string text2; if (Glyphs.mouseElementRenameMap.TryGetValue(text, out text2)) { text = text2; } return(text); } return("UNKNOWN"); }
// Token: 0x060017ED RID: 6125 RVA: 0x0007236E File Offset: 0x0007056E public static string GetGlyphString(MPEventSystem eventSystem, string actionName, AxisRange axisRange = AxisRange.Full) { return(Glyphs.GetGlyphString(eventSystem, actionName, axisRange, eventSystem.currentInputSource)); }
private IEnumerator DelayTooltipOpen(MPEventSystem eventSystem, PointerEventData eventData) { yield return(new WaitForSeconds(delayInSeconds)); TooltipController.SetTooltip(eventSystem, this, eventData.position); }
// Token: 0x06001845 RID: 6213 RVA: 0x00073871 File Offset: 0x00071A71 public InputMapperHelper(MPEventSystem eventSystem) { this.eventSystem = eventSystem; }
// Token: 0x06000BF4 RID: 3060 RVA: 0x0003A450 File Offset: 0x00038650 private void Update() { if (Time.deltaTime == 0f) { return; } if (this.target != this.previousTarget) { this.previousTarget = this.target; Action <CameraRigController, GameObject> action = CameraRigController.onCameraTargetChanged; if (action != null) { action(this, this.target); } } this.lerpCameraTime += Time.deltaTime * this.lerpCameraTimeScale; this.firstPersonTarget = null; float num = this.baseFov; this.sceneCam.rect = this.viewport; Player player = null; UserProfile userProfile = null; bool flag = false; if (this.viewer && this.viewer.localUser != null) { player = this.viewer.localUser.inputPlayer; userProfile = this.viewer.localUser.userProfile; flag = this.viewer.localUser.isUIFocused; } if (this.cameraMode == CameraRigController.CameraMode.SpectateUser && player != null) { if (player.GetButtonDown("PrimarySkill")) { this.target = CameraRigController.GetNextSpectateGameObject(this.viewer, this.target); } if (player.GetButtonDown("SecondarySkill")) { this.target = CameraRigController.GetPreviousSpectateGameObject(this.viewer, this.target); } } LocalUser localUserViewer = this.localUserViewer; MPEventSystem mpeventSystem = (localUserViewer != null) ? localUserViewer.eventSystem : null; float num14; float num15; if ((!mpeventSystem || !mpeventSystem.isCursorVisible) && player != null && userProfile != null && !flag && this.overrideCam == null) { float mouseLookSensitivity = userProfile.mouseLookSensitivity; float num2 = userProfile.stickLookSensitivity * CameraRigController.aimStickGlobalScale.value * 45f; Vector2 vector = new Vector2(player.GetAxisRaw(2), player.GetAxisRaw(3)); Vector2 vector2 = new Vector2(player.GetAxisRaw(16), player.GetAxisRaw(17)); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector.x, userProfile.mouseLookInvertX); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector.y, userProfile.mouseLookInvertY); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector2.x, userProfile.stickLookInvertX); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector2.y, userProfile.stickLookInvertY); float magnitude = vector2.magnitude; float num3 = magnitude; this.aimStickPostSmoothing = Vector2.zero; this.aimStickPostDualZone = Vector2.zero; this.aimStickPostExponent = Vector2.zero; if (CameraRigController.aimStickDualZoneSmoothing.value != 0f) { float maxDelta = Time.deltaTime / CameraRigController.aimStickDualZoneSmoothing.value; num3 = Mathf.Min(Mathf.MoveTowards(this.stickAimPreviousAcceleratedMagnitude, magnitude, maxDelta), magnitude); this.stickAimPreviousAcceleratedMagnitude = num3; this.aimStickPostSmoothing = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero); } float num4 = num3; float value = CameraRigController.aimStickDualZoneSlope.value; float num5; if (num4 <= CameraRigController.aimStickDualZoneThreshold.value) { num5 = 0f; } else { num5 = 1f - value; } num3 = value * num4 + num5; this.aimStickPostDualZone = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero); num3 = Mathf.Pow(num3, CameraRigController.aimStickExponent.value); this.aimStickPostExponent = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero); if (magnitude != 0f) { vector2 *= num3 / magnitude; } if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic && this.targetBody && !this.targetBody.isSprinting) { AimAssistTarget exists = null; AimAssistTarget exists2 = null; float value2 = CameraRigController.aimStickAssistMinSize.value; float num6 = value2 * CameraRigController.aimStickAssistMaxSize.value; float value3 = CameraRigController.aimStickAssistMaxSlowdownScale.value; float value4 = CameraRigController.aimStickAssistMinSlowdownScale.value; float num7 = 0f; float value5 = 0f; float num8 = 0f; Vector2 v = Vector2.zero; Vector2 zero = Vector2.zero; Vector2 normalized = vector2.normalized; Vector2 vector3 = new Vector2(0.5f, 0.5f); for (int i = 0; i < AimAssistTarget.instancesList.Count; i++) { AimAssistTarget aimAssistTarget = AimAssistTarget.instancesList[i]; if (aimAssistTarget.teamComponent.teamIndex != this.targetTeamIndex) { Vector3 vector4 = this.sceneCam.WorldToViewportPoint(aimAssistTarget.point0.position); Vector3 vector5 = this.sceneCam.WorldToViewportPoint(aimAssistTarget.point1.position); float num9 = Mathf.Lerp(vector4.z, vector5.z, 0.5f); if (num9 > 3f) { float num10 = 1f / num9; Vector2 vector6 = Util.ClosestPointOnLine(vector4, vector5, vector3) - vector3; float num11 = Mathf.Clamp01(Util.Remap(vector6.magnitude, value2 * aimAssistTarget.assistScale * num10, num6 * aimAssistTarget.assistScale * num10, 1f, 0f)); float num12 = Mathf.Clamp01(Vector3.Dot(vector6, vector2.normalized)); float num13 = num12 * num11; if (num7 < num11) { num7 = num11; exists2 = aimAssistTarget; } if (num13 > num8) { num7 = num11; value5 = num12; exists = aimAssistTarget; v = vector6; } } } } Vector2 vector7 = vector2; if (exists2) { float magnitude2 = vector2.magnitude; float d = Mathf.Clamp01(Util.Remap(1f - num7, 0f, 1f, value3, value4)); vector7 *= d; } if (exists) { vector7 = Vector3.RotateTowards(vector7, v, Util.Remap(value5, 1f, 0f, CameraRigController.aimStickAssistMaxDelta.value, CameraRigController.aimStickAssistMinDelta.value), 0f); } vector2 = vector7; } num14 = vector.x * mouseLookSensitivity * userProfile.mouseLookScaleX + vector2.x * num2 * userProfile.stickLookScaleX * Time.deltaTime; num15 = vector.y * mouseLookSensitivity * userProfile.mouseLookScaleY + vector2.y * num2 * userProfile.stickLookScaleY * Time.deltaTime; } else { num14 = 0f; num15 = 0f; } NetworkUser networkUser = Util.LookUpBodyNetworkUser(this.target); NetworkedViewAngles networkedViewAngles = null; if (networkUser) { networkedViewAngles = networkUser.GetComponent <NetworkedViewAngles>(); } this.targetTeamIndex = TeamIndex.None; bool flag2 = false; if (this.target) { this.targetBody = this.target.GetComponent <CharacterBody>(); flag2 = this.targetBody.isSprinting; TeamComponent component = this.target.GetComponent <TeamComponent>(); if (component) { this.targetTeamIndex = component.teamIndex; } this.targetParams = this.target.GetComponent <CameraTargetParams>(); } Vector3 vector8 = this.desiredCameraState.position; if (this.targetParams) { Vector3 position = this.target.transform.position; Vector3 cameraPivotPosition = this.targetParams.cameraPivotPosition; if (this.targetParams.dontRaycastToPivot) { vector8 = cameraPivotPosition; } else { Vector3 direction = cameraPivotPosition - position; Ray ray = new Ray(position, direction); float distance = this.Raycast(ray, direction.magnitude, this.targetParams.cameraParams.wallCushion); vector8 = ray.GetPoint(distance); } } if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic || this.cameraMode == CameraRigController.CameraMode.SpectateUser) { float min = -89.9f; float max = 89.9f; Vector3 idealLocalCameraPos = new Vector3(0f, 0f, 0f); float wallCushion = 0.1f; Vector2 vector9 = Vector2.zero; if (this.targetParams) { min = this.targetParams.cameraParams.minPitch; max = this.targetParams.cameraParams.maxPitch; idealLocalCameraPos = this.targetParams.idealLocalCameraPos; wallCushion = this.targetParams.cameraParams.wallCushion; vector9 = this.targetParams.recoil; if (this.targetParams.aimMode == CameraTargetParams.AimType.FirstPerson) { this.firstPersonTarget = this.target; } if (this.targetParams.fovOverride >= 0f) { num = this.targetParams.fovOverride; num14 *= num / this.baseFov; num15 *= num / this.baseFov; } if (this.targetBody && flag2) { num14 *= 0.5f; num15 *= 0.5f; } } if (this.sprintingParticleSystem) { ParticleSystem.MainModule main = this.sprintingParticleSystem.main; if (flag2) { main.loop = true; if (!this.sprintingParticleSystem.isPlaying) { this.sprintingParticleSystem.Play(); } } else { main.loop = false; } } if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic) { float num16 = this.pitch - num15; float num17 = this.yaw + num14; num16 += vector9.y; num17 += vector9.x; this.pitch = Mathf.Clamp(num16, min, max); this.yaw = Mathf.Repeat(num17, 360f); } else if (this.cameraMode == CameraRigController.CameraMode.SpectateUser && this.target) { if (networkedViewAngles) { this.SetPitchYaw(networkedViewAngles.viewAngles); } else { InputBankTest component2 = this.target.GetComponent <InputBankTest>(); if (component2) { this.SetPitchYawFromLookVector(component2.aimDirection); } } } this.desiredCameraState.rotation = Quaternion.Euler(this.pitch, this.yaw, 0f); Vector3 direction2 = vector8 + this.desiredCameraState.rotation * idealLocalCameraPos - vector8; float num18 = direction2.magnitude; float num19 = (1f + this.pitch / -90f) * 0.5f; num18 *= Mathf.Sqrt(1f - num19); if (num18 < 0.25f) { num18 = 0.25f; } float a = this.Raycast(new Ray(vector8, direction2), num18, wallCushion); this.currentCameraDistance = Mathf.Min(a, Mathf.SmoothDamp(this.currentCameraDistance, a, ref this.cameraDistanceVelocity, 0.5f)); this.desiredCameraState.position = vector8 + direction2.normalized * this.currentCameraDistance; this.pitch -= vector9.y; this.yaw -= vector9.x; if (networkedViewAngles && networkedViewAngles.hasEffectiveAuthority) { networkedViewAngles.viewAngles = new PitchYawPair(this.pitch, this.yaw); } } if (this.targetBody) { num *= (this.targetBody.isSprinting ? 1.3f : 1f); } this.desiredCameraState.fov = Mathf.SmoothDamp(this.desiredCameraState.fov, num, ref this.fovVelocity, 0.2f, float.PositiveInfinity, Time.deltaTime); if (this.hud) { CharacterMaster targetMaster = this.targetBody ? this.targetBody.master : null; this.hud.targetMaster = targetMaster; } this.UpdateCrosshair(vector8); CameraState cameraState = this.desiredCameraState; if (this.overrideCam != null) { if ((UnityEngine.Object) this.overrideCam) { cameraState = this.overrideCam.GetCameraState(this); } this.overrideCam = null; } if (this.lerpCameraTime >= 1f) { this.currentCameraState = cameraState; } else { this.currentCameraState = CameraState.Lerp(ref this.lerpCameraState, ref cameraState, CameraRigController.RemapLerpTime(this.lerpCameraTime)); } this.SetCameraState(this.currentCameraState); }
private static void ChangedToCustom(On.RoR2.UI.MPEventSystem.orig_OnLastActiveControllerChanged orig, MPEventSystem self, Player player, Controller controller) { if (controller != null && controller.type == ControllerType.Custom) { isUsingMotionControls = true; self.currentInputSource = MPEventSystem.InputSource.MouseAndKeyboard; return; } isUsingMotionControls = false; orig(self, player, controller); }
private static string GetCustomGlyphString(On.RoR2.Glyphs.orig_GetGlyphString_MPEventSystem_string_AxisRange_InputSource orig, MPEventSystem eventSystem, string actionName, AxisRange axisRange, MPEventSystem.InputSource currentInputSource) { if (!eventSystem) { return("???"); } if (isUsingMotionControls) { Glyphs.resultsList.Clear(); eventSystem.player.controllers.maps.GetElementMapsWithAction(ControllerType.Custom, Controllers.ControllerID, actionName, false, Glyphs.resultsList); if (Glyphs.resultsList.Count() > 0) { ActionElementMap displayedMap = Glyphs.resultsList.First(); if (displayedMap.elementIdentifierId > 0 && displayedMap.elementIdentifierId < currentGlyphs.Length) { return(currentGlyphs[displayedMap.elementIdentifierId]); } } } return(orig(eventSystem, actionName, axisRange, currentInputSource)); }
private static void MatchTooltipToCanvas(On.RoR2.UI.TooltipController.orig_SetTooltip orig, MPEventSystem eventSystem, TooltipProvider newTooltipProvider, Vector2 tooltipPosition) { orig(eventSystem, newTooltipProvider, tooltipPosition); if (!eventSystem.currentTooltip || !lastHitCanvas) { return; } if (cursorInstance) { Vector3 relativeCursorPosition = lastHitCanvas.transform.InverseTransformPoint(cursorInstance.transform.position); Vector2 vector2 = new Vector2(0f, 0f); vector2.x = ((relativeCursorPosition.x > 0f) ? 1f : 0f); vector2.y = ((relativeCursorPosition.y > 0f) ? 1f : 0f); eventSystem.currentTooltip.tooltipFlipTransform.anchorMin = vector2; eventSystem.currentTooltip.tooltipFlipTransform.anchorMax = vector2; eventSystem.currentTooltip.tooltipFlipTransform.pivot = vector2; } Canvas canvas = eventSystem.currentTooltip.GetComponent <Canvas>(); canvas.renderMode = RenderMode.WorldSpace; RectTransform canvasTransform = canvas.transform as RectTransform; RectTransform lastHitTransform = lastHitCanvas.transform as RectTransform; canvasTransform.sizeDelta = lastHitTransform.sizeDelta; canvasTransform.pivot = lastHitTransform.pivot; canvasTransform.position = lastHitTransform.position; canvasTransform.rotation = lastHitTransform.rotation; canvasTransform.localScale = lastHitTransform.localScale; }