using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BonkCoop;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Rewired;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BonkCoopNavigation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BonkCoopNavigation")]
[assembly: AssemblyTitle("BonkCoopNavigation")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte flag)
{
NullableFlags = new byte[1] { flag };
}
public NullableAttribute(byte[] flags)
{
NullableFlags = flags;
}
}
}
namespace BonkCoopNavigation
{
internal static class ArrowHotkey
{
internal static bool EditingText()
{
EventSystem current = EventSystem.current;
if ((Object)(object)current == (Object)null || (Object)(object)current.currentSelectedGameObject == (Object)null)
{
return false;
}
GameObject currentSelectedGameObject = current.currentSelectedGameObject;
if (!((Object)(object)currentSelectedGameObject.GetComponent<TMP_InputField>() != (Object)null))
{
return (Object)(object)currentSelectedGameObject.GetComponent<InputField>() != (Object)null;
}
return true;
}
internal static bool CanEnable(KeyCode key, out string message)
{
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
try
{
Player val = (ReInput.isReady ? MyInputManager.player : null);
if (val == null)
{
message = "Game bindings are not ready. Try the teammate toggle again in a moment.";
return false;
}
List<ControllerMap> val2 = new List<ControllerMap>();
val.controllers.maps.GetAllMaps((ControllerType)0, val2);
for (int i = 0; i < val2.Count; i++)
{
ControllerMap val3 = val2[i];
if (!val3.enabled)
{
continue;
}
IList<ActionElementMap> allMaps = val3.AllMaps;
int elementMapCount = val3.elementMapCount;
for (int j = 0; j < elementMapCount; j++)
{
ActionElementMap val4 = allMaps[j];
if (val4.enabled && val4.keyCode == key)
{
message = $"{key} is assigned to {val4.actionDescriptiveName}.\nChange Navigation > ToggleArrowsKey in the mod config.";
return false;
}
}
}
message = "";
return true;
}
catch (Exception ex)
{
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Could not check arrow key bindings: ");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val5);
message = "Could not check game bindings; teammate navigation remains off. See LogOutput.log.";
return false;
}
}
}
internal readonly record struct ArrowPlacement(float X, float Z, float HeadingDegrees);
internal static class ArrowLayout
{
internal static bool TryPlace(float originX, float originZ, float targetX, float targetZ, float radius, out ArrowPlacement placement)
{
placement = default(ArrowPlacement);
double num = (double)targetX - (double)originX;
double num2 = (double)targetZ - (double)originZ;
double num3 = Math.Sqrt(num * num + num2 * num2);
if (!double.IsFinite(num3) || num3 < 0.15 || !float.IsFinite(radius) || radius <= 0f)
{
return false;
}
placement = new ArrowPlacement((float)(num / num3 * (double)radius), (float)(num2 / num3 * (double)radius), (float)(Math.Atan2(num, num2) * 180.0 / Math.PI));
return true;
}
}
internal static class CoopBridge
{
private const BindingFlags Static = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
private const BindingFlags Instance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
private static FieldInfo _roster;
private static FieldInfo _mySlot;
private static FieldInfo _go;
private static FieldInfo _avatars;
private static FieldInfo _down;
private static FieldInfo _marks;
private static FieldInfo _root;
private static FieldInfo _label;
private static FieldInfo _placed;
private static Func<TMP_FontAsset> _font;
internal static Roster Roster => (Roster)_roster.GetValue(null);
internal static byte MySlot => (byte)_mySlot.GetValue(null);
internal static bool Playing => (bool)_go.GetValue(null);
private static IDictionary Avatars => (IDictionary)_avatars.GetValue(null);
private static IDictionary Down => (IDictionary)_down.GetValue(null);
private static IDictionary Marks => (IDictionary)_marks.GetValue(null);
internal static TMP_FontAsset Font => _font();
internal static void Initialize()
{
Assembly assembly = typeof(Plugin).Assembly;
_roster = Field(Type("Coop"), "Roster", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_mySlot = Field(Type("Coop"), "MySlot", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_go = Field(Type("Game"), "Go", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_avatars = Field(Type("Players"), "_avatars", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_down = Field(Type("Team"), "Down", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
_marks = Field(Type("Hud"), "_marks", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
Type? type = Type("Players").GetNestedType("Avatar", BindingFlags.NonPublic) ?? throw new TypeLoadException("BonkCoop.Players.Avatar is missing.");
_root = Field(type, "Root", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
_label = Field(type, "Label", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
_placed = Field(type, "Placed", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
_font = (Type("Hud").GetProperty("Font", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetGetMethod(nonPublic: true) ?? throw new MissingMethodException("BonkCoop.Hud.Font is missing.")).CreateDelegate<Func<TMP_FontAsset>>();
_ = Roster;
_ = MySlot;
_ = Playing;
_ = Avatars;
_ = Down;
_ = Marks;
static FieldInfo Field(Type type2, string name, BindingFlags flags)
{
return type2.GetField(name, flags) ?? throw new MissingFieldException(type2.FullName, name);
}
Type Type(string name)
{
return assembly.GetType("BonkCoop." + name, throwOnError: true);
}
}
internal static bool IsDown(byte slot)
{
return Down.Contains(slot);
}
internal static TextMeshProUGUI? NativeMarker(byte slot)
{
object? obj = Marks[slot];
return (TextMeshProUGUI?)((obj is TextMeshProUGUI) ? obj : null);
}
internal static bool TryAvatar(byte slot, out GameObject? root, out TextMeshPro? label)
{
root = null;
label = null;
object obj = Avatars[slot];
if (obj == null || !(bool)_placed.GetValue(obj))
{
return false;
}
object? value = _root.GetValue(obj);
root = (GameObject?)((value is GameObject) ? value : null);
object? value2 = _label.GetValue(obj);
label = (TextMeshPro?)((value2 is TextMeshPro) ? value2 : null);
if ((Object)(object)root != (Object)null)
{
return root.activeInHierarchy;
}
return false;
}
}
internal readonly record struct MarkerPosition(float X, float Y, bool OffScreen, string Direction);
internal static class MarkerLayout
{
internal static MarkerPosition Project(float viewportX, float viewportY, float depth, float width, float height, float labelWidth, float labelHeight)
{
float num = (viewportX - 0.5f) * width;
float num2 = (viewportY - 0.5f) * height;
float num3 = MathF.Max(1f, (width - labelWidth) * 0.5f - 24f);
float num4 = MathF.Max(1f, (height - labelHeight) * 0.5f - 24f);
if (!(depth <= 0f) && !(MathF.Abs(num) > num3) && !(MathF.Abs(num2) > num4))
{
return new MarkerPosition(num, num2, OffScreen: false, "");
}
if (depth <= 0f)
{
num = 0f - num;
num2 = 0f - num2;
}
if (MathF.Abs(num) + MathF.Abs(num2) < 0.001f)
{
num2 = -1f;
}
float num5 = MathF.Max(MathF.Abs(num) / num3, MathF.Abs(num2) / num4);
num /= num5;
num2 /= num5;
string direction = ((!(MathF.Abs(num) / num3 >= MathF.Abs(num2) / num4)) ? ((num2 < 0f) ? "v " : "^ ") : ((num < 0f) ? "< " : "> "));
return new MarkerPosition(num, num2, OffScreen: true, direction);
}
}
public sealed class NavigationOverlay : MonoBehaviour
{
private readonly Dictionary<byte, TextMeshProUGUI> _labels = new Dictionary<byte, TextMeshProUGUI>();
private readonly Dictionary<int, (Behaviour Label, bool WasEnabled)> _hidden = new Dictionary<int, (Behaviour, bool)>();
private readonly List<byte> _obsolete = new List<byte>();
private readonly TeammateArrows _arrows = new TeammateArrows();
private readonly TeammateToggleHint _toggleHint = new TeammateToggleHint();
private bool _navigationVisible;
private bool _arrowsFailed;
private TextMeshProUGUI? _status;
private float _statusUntil;
private GameObject? _canvasObject;
private RectTransform? _canvasRect;
private bool _failed;
public NavigationOverlay(IntPtr pointer)
: base(pointer)
{
}
public void LateUpdate()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
if (_failed)
{
return;
}
try
{
UpdateLabels();
}
catch (Exception ex)
{
_failed = true;
HideAll();
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(72, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Navigation overlay disabled after an error; BonkCoop's labels restored. ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
private void UpdateLabels()
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
Plugin instance = Plugin.Instance;
Camera main = Camera.main;
PlayerMovement player = PlayerMovement.Instance;
GameManager instance2 = GameManager.Instance;
bool flag = (Object)(object)player != (Object)null && ((Component)player).gameObject.activeInHierarchy && (Object)(object)instance2 != (Object)null && instance2.IsPlaying() && !instance2.isGameOver;
if (!instance.OverlayEnabled.Value || !flag || (Object)(object)main == (Object)null)
{
HideAll();
return;
}
TMP_FontAsset font = CoopBridge.Font;
if ((Object)(object)font == (Object)null)
{
HideAll();
return;
}
EnsureCanvas();
_canvasObject.SetActive(true);
Rect rect = _canvasRect.rect;
if (((Rect)(ref rect)).width < 1f || ((Rect)(ref rect)).height < 1f)
{
return;
}
UpdateNavigationHotkey();
_toggleHint.Update((Transform)(object)_canvasRect, font, instance.ToggleArrowsKey.Value, _navigationVisible, instance.ShowToggleHint.Value);
if ((Object)(object)_status != (Object)null)
{
((Component)_status).gameObject.SetActive(Time.unscaledTime < _statusUntil);
}
UpdateArrows(delegate
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
_arrows.BeginFrame(_navigationVisible, ((Component)player).transform.position);
});
_obsolete.Clear();
_obsolete.AddRange(_labels.Keys);
if (CoopBridge.Playing)
{
UpdateTeammates(main, font, rect);
}
UpdateArrows(_arrows.EndFrame);
foreach (byte item in _obsolete)
{
if ((Object)(object)_labels[item] != (Object)null)
{
Object.Destroy((Object)(object)((Component)_labels[item]).gameObject);
}
_labels.Remove(item);
}
int[] array = (from pair in _hidden
where (Object)(object)pair.Value.Label == (Object)null
select pair.Key).ToArray();
foreach (int key in array)
{
_hidden.Remove(key);
}
}
private void UpdateTeammates(Camera camera, TMP_FontAsset font, Rect size)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
byte mySlot = CoopBridge.MySlot;
Vector3? myPosition = null;
Player val = CoopBridge.Roster.BySlot(mySlot);
if (val != null)
{
myPosition = new Vector3(val.Pos.X, val.Pos.Y, val.Pos.Z);
}
foreach (Player player in CoopBridge.Roster.Players)
{
if (player.Slot != mySlot && CoopBridge.TryAvatar(player.Slot, out GameObject root, out TextMeshPro label))
{
Vector3 position = root.transform.position;
UpdateArrows(delegate
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
_arrows.Draw(player.Slot, position, CoopBridge.IsDown(player.Slot));
});
DrawLabel(player.Slot, CleanName(player.Name, player.Slot), position, myPosition, CoopBridge.IsDown(player.Slot), camera, font, size);
HideNative((Behaviour?)(object)label);
HideNative((Behaviour?)(object)CoopBridge.NativeMarker(player.Slot));
}
}
}
private bool DrawLabel(byte slot, string name, Vector3 position, Vector3? myPosition, bool down, Camera camera, TMP_FontAsset font, Rect size)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
if (!_navigationVisible)
{
return false;
}
Plugin instance = Plugin.Instance;
Vector3 val = camera.WorldToViewportPoint(position + Vector3.up * instance.HeightOffset.Value);
if (!float.IsFinite(val.x) || !float.IsFinite(val.y) || !float.IsFinite(val.z))
{
return false;
}
float num = instance.FontSize.Value * 2.6f;
float num2 = MathF.Min(420f, ((Rect)(ref size)).width - 48f);
MarkerPosition markerPosition = MarkerLayout.Project(val.x, val.y, val.z, ((Rect)(ref size)).width, ((Rect)(ref size)).height, num2, num);
if (markerPosition.OffScreen && !instance.ShowOffScreen.Value)
{
return false;
}
if (!_labels.TryGetValue(slot, out TextMeshProUGUI value) || (Object)(object)value == (Object)null)
{
value = CreateLabel(slot, font);
_labels[slot] = value;
}
_obsolete.Remove(slot);
((Component)value).gameObject.SetActive(true);
((TMP_Text)value).font = font;
((TMP_Text)value).fontSize = instance.FontSize.Value;
((TMP_Text)value).rectTransform.sizeDelta = new Vector2(num2, num);
((TMP_Text)value).rectTransform.anchoredPosition = new Vector2(markerPosition.X, markerPosition.Y);
((Graphic)value).color = TeammateColors.For(slot, down);
string text = ((instance.ShowDistance.Value && myPosition.HasValue) ? $" {Mathf.RoundToInt(Vector3.Distance(myPosition.Value, position))} m" : "");
string text2 = (markerPosition.OffScreen ? markerPosition.Direction : "") + name + text + (down ? "\nDOWN" : "");
if (((TMP_Text)value).text != text2)
{
((TMP_Text)value).text = text2;
}
return true;
}
private void UpdateNavigationHotkey()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
KeyCode value = Plugin.Instance.ToggleArrowsKey.Value;
if ((int)value != 0 && Input.GetKeyDown(value) && !ArrowHotkey.EditingText())
{
string message;
if (_navigationVisible)
{
_navigationVisible = false;
((BasePlugin)Plugin.Instance).Log.LogInfo((object)"Teammate names and arrows OFF");
ShowStatus("Teammates hidden");
}
else if (!ArrowHotkey.CanEnable(value, out message))
{
((BasePlugin)Plugin.Instance).Log.LogWarning((object)message);
ShowStatus(message, 8f);
}
else
{
_navigationVisible = true;
((BasePlugin)Plugin.Instance).Log.LogInfo((object)"Teammate names and arrows ON");
ShowStatus(_arrowsFailed ? "Teammate names ON (arrows unavailable)" : "Teammates visible");
}
}
}
private void ShowStatus(string text, float seconds = 3f)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_status == (Object)null)
{
_status = CreateLabel(248, CoopBridge.Font);
RectTransform rectTransform = ((TMP_Text)_status).rectTransform;
RectTransform rectTransform2 = ((TMP_Text)_status).rectTransform;
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0.5f, 0.8f);
rectTransform2.anchorMax = val;
rectTransform.anchorMin = val;
((TMP_Text)_status).rectTransform.sizeDelta = new Vector2(1100f, 90f);
((TMP_Text)_status).fontSize = 22f;
((Graphic)_status).color = Color.white;
}
((TMP_Text)_status).text = text;
_statusUntil = Time.unscaledTime + seconds;
((Component)_status).gameObject.SetActive(true);
}
private void UpdateArrows(Action action)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
if (_arrowsFailed)
{
return;
}
try
{
action();
}
catch (Exception ex)
{
_arrowsFailed = true;
_arrows.Hide();
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(72, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Arrows disabled after a rendering error; teammate names remain enabled. ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
ShowStatus("Arrow rendering is unavailable. See LogOutput.log.");
}
}
private void EnsureCanvas()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_canvasObject != (Object)null))
{
_canvasObject = new GameObject("BonkCoopNavigation_Overlay");
Object.DontDestroyOnLoad((Object)(object)_canvasObject);
_canvasRect = _canvasObject.AddComponent<RectTransform>();
Canvas obj = _canvasObject.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 100;
CanvasScaler obj2 = _canvasObject.AddComponent<CanvasScaler>();
obj2.uiScaleMode = (ScaleMode)1;
obj2.referenceResolution = new Vector2(1920f, 1080f);
obj2.screenMatchMode = (ScreenMatchMode)0;
obj2.matchWidthOrHeight = 0.5f;
}
}
private TextMeshProUGUI CreateLabel(byte slot, TMP_FontAsset font)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = new GameObject($"Teammate_{slot}").AddComponent<RectTransform>();
((Transform)obj).SetParent((Transform)(object)_canvasRect, false);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0.5f, 0.5f);
obj.pivot = val;
Vector2 anchorMin = (obj.anchorMax = val);
obj.anchorMin = anchorMin;
TextMeshProUGUI obj2 = ((Component)obj).gameObject.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj2).font = font;
((TMP_Text)obj2).alignment = (TextAlignmentOptions)514;
((TMP_Text)obj2).enableWordWrapping = false;
((TMP_Text)obj2).overflowMode = (TextOverflowModes)1;
((TMP_Text)obj2).richText = false;
((Graphic)obj2).raycastTarget = false;
((TMP_Text)obj2).outlineColor = Color32.op_Implicit(Color.black);
((TMP_Text)obj2).outlineWidth = 0.2f;
return obj2;
}
private static string CleanName(string? name, byte slot)
{
if (string.IsNullOrWhiteSpace(name))
{
return $"Player {slot + 1}";
}
return new string(name.Where((char character) => !char.IsControl(character)).Take(64).ToArray());
}
private void HideNative(Behaviour? label)
{
if (!((Object)(object)label == (Object)null))
{
int instanceID = ((Object)label).GetInstanceID();
if (!_hidden.ContainsKey(instanceID))
{
_hidden[instanceID] = (label, label.enabled);
}
label.enabled = false;
}
}
private void HideAll()
{
_arrows.Hide();
if ((Object)(object)_canvasObject != (Object)null)
{
_canvasObject.SetActive(false);
}
foreach (var (val, enabled) in _hidden.Values)
{
if ((Object)(object)val != (Object)null)
{
val.enabled = enabled;
}
}
_hidden.Clear();
}
public void OnDisable()
{
HideAll();
}
public void OnDestroy()
{
HideAll();
_arrows.Dispose();
if ((Object)(object)_canvasObject != (Object)null)
{
Object.Destroy((Object)(object)_canvasObject);
}
_labels.Clear();
}
}
[BepInPlugin("jerod.bonkcoopnavigation", "BonkCoopNavigation", "1.0.0")]
[BepInDependency("void.bonkcoop", "0.4.0")]
public sealed class Plugin : BasePlugin
{
public const string Id = "jerod.bonkcoopnavigation";
public const string Version = "1.0.0";
internal static Plugin Instance { get; private set; }
internal ConfigEntry<bool> OverlayEnabled { get; private set; }
internal ConfigEntry<bool> ShowDistance { get; private set; }
internal ConfigEntry<bool> ShowOffScreen { get; private set; }
internal ConfigEntry<float> FontSize { get; private set; }
internal ConfigEntry<float> HeightOffset { get; private set; }
internal ConfigEntry<KeyCode> ToggleArrowsKey { get; private set; }
internal ConfigEntry<float> ArrowRadius { get; private set; }
internal ConfigEntry<float> ArrowSize { get; private set; }
internal ConfigEntry<bool> ShowToggleHint { get; private set; }
public override void Load()
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Expected O, but got Unknown
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Expected O, but got Unknown
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Expected O, but got Unknown
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
OverlayEnabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Show teammate names through terrain and walls.");
ShowDistance = ((BasePlugin)this).Config.Bind<bool>("Display", "ShowDistance", true, "Show distance to each teammate in game units (meters).");
ShowOffScreen = ((BasePlugin)this).Config.Bind<bool>("Display", "ShowOffScreen", true, "Keep names at the screen edge when teammates are off screen or behind you.");
FontSize = ((BasePlugin)this).Config.Bind<float>("Display", "FontSize", 24f, new ConfigDescription("Name size at 1920x1080. Scales with the window resolution.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(12f, 48f), Array.Empty<object>()));
HeightOffset = ((BasePlugin)this).Config.Bind<float>("Display", "HeightOffset", 2f, new ConfigDescription("Height above a teammate's position in game units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 6f), Array.Empty<object>()));
ToggleArrowsKey = ((BasePlugin)this).Config.Bind<KeyCode>("Navigation", "ToggleArrowsKey", (KeyCode)113, "Toggle teammate names and arrows together. Both start off. Change this if it conflicts with another mod; None disables the hotkey. Active game bindings are checked before enabling teammate navigation.");
ArrowRadius = ((BasePlugin)this).Config.Bind<float>("Navigation", "ArrowRadius", 1.8f, new ConfigDescription("Distance of arrows from your character in game units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>()));
ArrowSize = ((BasePlugin)this).Config.Bind<float>("Navigation", "ArrowSize", 1f, new ConfigDescription("Size of each teammate arrow.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
ShowToggleHint = ((BasePlugin)this).Config.Bind<bool>("Display", "ShowToggleHint", true, "Show the teammate icon, toggle key, and Show/Hide teammates prompt in the bottom-left corner.");
bool flag = default(bool);
try
{
CoopBridge.Initialize();
((BasePlugin)this).AddComponent<NavigationOverlay>();
ManualLogSource log = ((BasePlugin)this).Log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(84, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BonkCoopNavigation ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded. Teammate names use a screen overlay; no network changes.");
}
log.LogInfo(val);
ManualLogSource log2 = ((BasePlugin)this).Log;
val = new BepInExInfoLogInterpolatedStringHandler(72, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Teammate names and arrows start off. Press ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<KeyCode>(ToggleArrowsKey.Value);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" during a run to toggle both.");
}
log2.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource log3 = ((BasePlugin)this).Log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(80, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Unable to connect to BonkCoop. Navigation is disabled. Expected BonkCoop 0.4.0. ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
log3.LogError(val2);
}
}
}
internal sealed class TeammateArrows
{
private sealed record Arrow(GameObject Root, Material Material);
private readonly Dictionary<byte, Arrow> _arrows = new Dictionary<byte, Arrow>();
private readonly HashSet<byte> _used = new HashSet<byte>();
private GameObject? _root;
private Mesh? _mesh;
private Material? _outline;
private Shader? _shader;
private bool _visible;
private Vector3 _origin;
internal void BeginFrame(bool visible, Vector3 origin)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
_visible = visible;
_origin = origin;
_used.Clear();
if ((Object)(object)_root != (Object)null)
{
_root.SetActive(_visible);
_root.transform.position = origin;
}
}
internal void Draw(byte slot, Vector3 target, bool down)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
if (_visible && ArrowLayout.TryPlace(_origin.x, _origin.z, target.x, target.z, Plugin.Instance.ArrowRadius.Value, out var placement) && EnsureResources())
{
if (!_arrows.TryGetValue(slot, out Arrow value))
{
GameObject val = new GameObject($"TeammateArrow_{slot}");
val.transform.SetParent(_root.transform, false);
Material material = NewMaterial(TeammateColors.For(slot, down), 4000);
value = (_arrows[slot] = new Arrow(val, material));
AddMesh(val.transform, "Outline", _outline, new Vector3(0f, -0.015f, 0f), 1.18f);
AddMesh(val.transform, "Arrow", material, Vector3.zero, 1f);
}
_used.Add(slot);
value.Root.SetActive(true);
value.Root.transform.localPosition = new Vector3(placement.X, 0.1f, placement.Z);
value.Root.transform.localRotation = Quaternion.Euler(0f, placement.HeadingDegrees, 0f);
value.Root.transform.localScale = Vector3.one * Plugin.Instance.ArrowSize.Value;
Tint(value.Material, TeammateColors.For(slot, down));
}
}
internal void EndFrame()
{
byte[] array = _arrows.Keys.Where((byte slot) => !_used.Contains(slot)).ToArray();
foreach (byte key in array)
{
_arrows[key].Root.SetActive(false);
Object.Destroy((Object)(object)_arrows[key].Root);
Object.Destroy((Object)(object)_arrows[key].Material);
_arrows.Remove(key);
}
}
private bool EnsureResources()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_root != (Object)null)
{
return true;
}
_shader = Shader.Find("Sprites/Default") ?? Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Unlit/Color") ?? Shader.Find("UI/Default");
if ((Object)(object)_shader == (Object)null)
{
throw new InvalidOperationException("No suitable unlit shader was found for teammate arrows.");
}
_root = new GameObject("BonkCoopNavigation_Arrows");
Object.DontDestroyOnLoad((Object)(object)_root);
_root.transform.position = _origin;
_mesh = new Mesh
{
name = "BonkCoopNavigation_Arrow"
};
_mesh.vertices = Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[7]
{
new Vector3(-0.16f, 0f, -0.5f),
new Vector3(0.16f, 0f, -0.5f),
new Vector3(0.16f, 0f, 0f),
new Vector3(0.45f, 0f, 0f),
new Vector3(0f, 0f, 0.65f),
new Vector3(-0.45f, 0f, 0f),
new Vector3(-0.16f, 0f, 0f)
});
_mesh.colors = Il2CppStructArray<Color>.op_Implicit(Enumerable.Repeat<Color>(Color.white, 7).ToArray());
_mesh.triangles = Il2CppStructArray<int>.op_Implicit(new int[18]
{
0, 1, 2, 0, 2, 6, 5, 3, 4, 2,
1, 0, 6, 2, 0, 4, 3, 5
});
_mesh.RecalculateBounds();
_outline = NewMaterial(new Color(0.03f, 0.04f, 0.06f, 1f), 3999);
return true;
}
private Material NewMaterial(Color color, int queue)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
Material val = new Material(_shader);
val.renderQueue = queue;
if (val.HasProperty("_Cull"))
{
val.SetInt("_Cull", 0);
}
if (val.HasProperty("_ZWrite"))
{
val.SetInt("_ZWrite", 0);
}
if (val.HasProperty("_ZTest"))
{
val.SetInt("_ZTest", 8);
}
Tint(val, color);
return val;
}
private static void Tint(Material material, Color color)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (material.HasProperty("_Color"))
{
material.SetColor("_Color", color);
}
if (material.HasProperty("_BaseColor"))
{
material.SetColor("_BaseColor", color);
}
}
private void AddMesh(Transform parent, string name, Material material, Vector3 offset, float scale)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(parent, false);
val.transform.localPosition = offset;
val.transform.localScale = Vector3.one * scale;
val.AddComponent<MeshFilter>().sharedMesh = _mesh;
MeshRenderer obj = val.AddComponent<MeshRenderer>();
((Renderer)obj).sharedMaterial = material;
((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)obj).receiveShadows = false;
}
internal void Hide()
{
_visible = false;
if ((Object)(object)_root != (Object)null)
{
_root.SetActive(false);
}
}
internal void Dispose()
{
Hide();
foreach (Arrow value in _arrows.Values)
{
Object.Destroy((Object)(object)value.Material);
}
_arrows.Clear();
if ((Object)(object)_root != (Object)null)
{
Object.Destroy((Object)(object)_root);
}
if ((Object)(object)_mesh != (Object)null)
{
Object.Destroy((Object)(object)_mesh);
}
if ((Object)(object)_outline != (Object)null)
{
Object.Destroy((Object)(object)_outline);
}
_root = null;
_mesh = null;
_outline = null;
}
}
internal static class TeammateColors
{
internal static Color For(byte slot, bool down)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
Color result = default(Color);
if (down)
{
((Color)(ref result))..ctor(1f, 0.42f, 0.37f, 1f);
return result;
}
result = (Color)((slot % 4) switch
{
0 => new Color(0.45f, 0.9f, 1f, 1f),
1 => new Color(1f, 0.85f, 0.35f, 1f),
2 => new Color(0.5f, 1f, 0.55f, 1f),
_ => new Color(0.85f, 0.65f, 1f, 1f),
});
return result;
}
}
internal sealed class TeammateToggleHint
{
private GameObject? _root;
private TextMeshProUGUI? _key;
private TextMeshProUGUI? _caption;
private Image? _accent;
private readonly List<Image> _people = new List<Image>();
internal unsafe void Update(Transform canvas, TMP_FontAsset font, KeyCode key, bool visible, bool showHint)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
if (!showHint)
{
if ((Object)(object)_root != (Object)null)
{
_root.SetActive(false);
}
return;
}
if ((Object)(object)_root == (Object)null)
{
Create(canvas, font);
}
_root.SetActive(true);
((TMP_Text)_key).font = font;
((TMP_Text)_caption).font = font;
((TMP_Text)_key).text = (((int)key == 0) ? "--" : ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString());
((TMP_Text)_caption).text = (((int)key == 0) ? "Set teammate key" : (visible ? "Hide teammates" : "Show teammates"));
Color color = (visible ? new Color(0.45f, 0.95f, 0.7f, 1f) : new Color(0.65f, 0.85f, 0.95f, 1f));
((Graphic)_accent).color = color;
foreach (Image person in _people)
{
((Graphic)person).color = color;
}
}
private void Create(Transform canvas, TMP_FontAsset font)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = new GameObject("BonkCoopNavigation_ToggleHint").AddComponent<RectTransform>();
((Transform)val).SetParent(canvas, false);
Vector2 val2 = (val.pivot = Vector2.zero);
Vector2 anchorMin = (val.anchorMax = val2);
val.anchorMin = anchorMin;
val.anchoredPosition = new Vector2(28f, 28f);
val.sizeDelta = new Vector2(360f, 52f);
_root = ((Component)val).gameObject;
Image obj = ((Component)val).gameObject.AddComponent<Image>();
((Graphic)obj).color = new Color(0.025f, 0.04f, 0.065f, 0.85f);
((Graphic)obj).raycastTarget = false;
_accent = Box((Transform)(object)val, "Accent", 2f, 0f, 3f, 52f, Color.white);
Person((Transform)(object)val, 16f, -1f, 7f, 9f);
Person((Transform)(object)val, 40f, -1f, 7f, 9f);
Person((Transform)(object)val, 28f, 2f, 9f, 12f);
Box((Transform)(object)val, "KeyBorder", 78f, 0f, 48f, 34f, new Color(0.35f, 0.45f, 0.55f, 1f));
Box((Transform)(object)val, "KeyBackground", 78f, 0f, 44f, 30f, new Color(0.075f, 0.1f, 0.14f, 1f));
_key = Text((Transform)(object)val, "ToggleKey", font, 78f, 0f, 44f, 30f, (TextAlignmentOptions)514);
((TMP_Text)_key).enableAutoSizing = true;
((TMP_Text)_key).fontSizeMin = 9f;
((TMP_Text)_key).fontSizeMax = 21f;
_caption = Text((Transform)(object)val, "ToggleCaption", font, 230f, 0f, 235f, 40f, (TextAlignmentOptions)4097);
((TMP_Text)_caption).fontSize = 22f;
}
private void Person(Transform parent, float x, float y, float headSize, float bodyHeight)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
_people.Add(Box(parent, "Head", x, y + 8f, headSize, headSize, Color.white));
_people.Add(Box(parent, "Body", x, y - 5f, headSize + 4f, bodyHeight, Color.white));
}
private static RectTransform Rect(Transform parent, string name, float x, float y, float width, float height)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = new GameObject(name).AddComponent<RectTransform>();
((Transform)obj).SetParent(parent, false);
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0f, 0.5f);
obj.anchorMax = val;
obj.anchorMin = val;
obj.pivot = new Vector2(0.5f, 0.5f);
obj.anchoredPosition = new Vector2(x, y);
obj.sizeDelta = new Vector2(width, height);
return obj;
}
private static Image Box(Transform parent, string name, float x, float y, float width, float height, Color color)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
Image obj = ((Component)Rect(parent, name, x, y, width, height)).gameObject.AddComponent<Image>();
((Graphic)obj).color = color;
((Graphic)obj).raycastTarget = false;
return obj;
}
private static TextMeshProUGUI Text(Transform parent, string name, TMP_FontAsset font, float x, float y, float width, float height, TextAlignmentOptions alignment)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI obj = ((Component)Rect(parent, name, x, y, width, height)).gameObject.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj).font = font;
((TMP_Text)obj).fontSize = 21f;
((TMP_Text)obj).alignment = alignment;
((TMP_Text)obj).enableWordWrapping = false;
((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
((TMP_Text)obj).richText = false;
((Graphic)obj).color = Color.white;
((Graphic)obj).raycastTarget = false;
return obj;
}
}
}