// Token: 0x06000500 RID: 1280 RVA: 0x00029D94 File Offset: 0x00027F94 private void UpdateCrosshair(Player player, float bowDrawPercentage) { GameObject hoverObject = player.GetHoverObject(); Hoverable hoverable = hoverObject ? hoverObject.GetComponentInParent <Hoverable>() : null; if (hoverable != null && !TextViewer.instance.IsVisible()) { this.m_hoverName.text = hoverable.GetHoverText(); this.m_crosshair.color = ((this.m_hoverName.text.Length > 0) ? Color.yellow : new Color(1f, 1f, 1f, 0.5f)); } else { this.m_crosshair.color = new Color(1f, 1f, 1f, 0.5f); this.m_hoverName.text = ""; } Piece hoveringPiece = player.GetHoveringPiece(); if (hoveringPiece) { WearNTear component = hoveringPiece.GetComponent <WearNTear>(); if (component) { this.m_pieceHealthRoot.gameObject.SetActive(true); this.m_pieceHealthBar.SetValue(component.GetHealthPercentage()); } else { this.m_pieceHealthRoot.gameObject.SetActive(false); } } else { this.m_pieceHealthRoot.gameObject.SetActive(false); } if (bowDrawPercentage > 0f) { float num = Mathf.Lerp(1f, 0.15f, bowDrawPercentage); this.m_crosshairBow.gameObject.SetActive(true); this.m_crosshairBow.transform.localScale = new Vector3(num, num, num); this.m_crosshairBow.color = Color.Lerp(new Color(1f, 1f, 1f, 0f), Color.yellow, bowDrawPercentage); return; } this.m_crosshairBow.gameObject.SetActive(false); }
private static void Player_Update(Player __instance) { if (Player.m_localPlayer == __instance) { if (Settings.PingWhereLooking.Value) { if (Enum.TryParse(Settings.PingKey.Value, out KeyCode key)) { if (__instance.InvokeMethod <bool>("TakeInput")) { if (Input.GetKeyDown(key)) { // TODO: improve object detection range var dir = __instance.GetAimDir(Vector3.zero); var ray = new Ray(GameCamera.instance.transform.position, GameCamera.instance.transform.forward); var mask = Pathfinding.instance.m_layers | Pathfinding.instance.m_waterLayers; Physics.Raycast(ray, out var hit, 500f, mask); string pingText = "Ping!"; Vector3 pos = hit.point; if (__instance.GetHoverCreature() != null) { pingText = __instance.GetHoverCreature().GetHoverName(); pos = __instance.GetHoverCreature().GetCenterPoint(); } else if (__instance.GetHoverObject()) { Hoverable hoverable = __instance.GetHoverObject().GetComponentInParent <Hoverable>(); if (hoverable != null) { pingText = hoverable.GetHoverText().Split('\n')[0]; } pos = __instance.GetHoverObject().transform.position; } ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", new object[] { pos, 3, __instance.GetPlayerName(), $"{pingText} at ({Mathf.FloorToInt(pos.x)}, {Mathf.FloorToInt(pos.z)})" }); } } } } if (Enum.TryParse(Settings.ShareMapKey.Value, out KeyCode mapKey)) { if (Input.GetKeyDown(mapKey)) { Plugin.ShareMap(); } } if (Enum.TryParse(Settings.SharePinsKey.Value, out KeyCode pinKey)) { if (Input.GetKeyDown(pinKey)) { Plugin.SharePins(); } } } }