public static void Postfix(MFDPTacticalSituationDisplay __instance, Actor a) { Vector3 position = __instance.tsc.weaponManager.actor.position; Vector3 position2 = a.position; int num = Mathf.RoundToInt(VectorUtils.Bearing(position, position2)); int num2 = Mathf.RoundToInt(__instance.measurements.ConvertedDistance(Vector3.Distance(position, position2))); if (__instance.measurements.distanceMode == MeasurementManager.DistanceModes.Feet || __instance.measurements.distanceMode == MeasurementManager.DistanceModes.Meters) { num2 /= 1000; } float num3 = Mathf.RoundToInt(__instance.measurements.ConvertedAltitude(WaterPhysics.GetAltitude(position2)) / 100f) / 10f; __instance.braNumsText.text = string.Format("{0}\n{1}\n{2}", num, num2, num3); }
private static void moveCursor(MFDPTacticalSituationDisplay tsd, GameObject buttonObject) { Vector3 targetPos = buttonObject.transform.position; targetPos = ClampedSelectorPosition(targetPos, tsd.selectorTf); tsd.selectorTf.position = targetPos; TSDContactIcon snapIcon = (TSDContactIcon)tsdTraverse.Field("snapIcon").GetValue(); if (snapIcon != buttonObject.GetComponent <TSDContactIcon>()) { tsdTraverse.Method("UnSnapCursor").GetValue(); } if ((TSDContactIcon)tsdTraverse.Field("snapIcon").GetValue() != null) { tsdTraverse.Method("M_OnInputButtonDown").GetValue(); return; } tsdTraverse.Field("snapIcon").SetValue(buttonObject.GetComponent <TSDContactIcon>()); tsdTraverse.Method("M_OnInputButtonDown").GetValue(); }
public static void Postfix(MFDPTacticalSituationDisplay __instance, ref TSDContactIcon __result) { if (VTOLAPI.GetPlayersVehicleEnum() == VTOLVehicles.F45A) { GameObject f45 = VTOLAPI.GetPlayersVehicleGameObject(); GameObject soiButton = GetChildWithName(f45, "ScaleButton (1)"); GameObject hvrObj = GetChildWithName(soiButton, "hvrObj"); tsdTraverse = Traverse.Create(__instance); GameObject contactHvrObj = UnityEngine.Object.Instantiate(hvrObj, __result.transform); float scaler = 1.3f; Vector2 hvrObjOrigSize = contactHvrObj.GetComponent <Image>().rectTransform.sizeDelta; contactHvrObj.GetComponent <Image>().rectTransform.sizeDelta *= scaler; __result.gameObject.SetActive(false); VRInteractable interact = __result.gameObject.AddComponent <VRInteractable>(); interact.interactableName = "Select"; interact.button = VRInteractable.Buttons.Trigger; interact.radius = 0; interact.useRect = true; interact.rect.center = Vector3.zero; interact.rect.extents = new Vector3(10, 10, 20); interact.requireMotion = false; interact.toggle = false; interact.tapOrHold = false; interact.sqrRadius = 0; interact.OnInteract = new UnityEvent(); interact.OnInteract.AddListener(f45.GetComponentInChildren <MFDPortalManager>().PlayInputSound); interact.OnInteract.AddListener(delegate { moveCursor(__instance, interact.gameObject); }); VRIHoverToggle hoverToggle = __result.gameObject.AddComponent <VRIHoverToggle>(); hoverToggle.hoverObj = contactHvrObj; __result.gameObject.SetActive(true); } }