Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ResizeShield v1.0.6
ResizeShieldGenerator.dll
Decompiled 5 hours agousing System; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ShieldGeneratorCustomizer { [BepInPlugin("com.custom.shieldgeneratorcustomizer", "Shield Generator Customizer", "1.1.0")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "com.custom.shieldgeneratorcustomizer"; public const string ModName = "Shield Generator Customizer"; public const string ModVersion = "1.1.0"; public const string ZDO_KEY_MIN_RADIUS = "SG_Custom_MinRadius"; public const string ZDO_KEY_MAX_RADIUS = "SG_Custom_MaxRadius"; public const float DEFAULT_MIN_RADIUS = 10f; public const float DEFAULT_MAX_RADIUS = 30f; private Harmony _harmony; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("com.custom.shieldgeneratorcustomizer"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Shield Generator Customizer] Loaded successfully!"); } private void Update() { if (ShieldConfigMenu.IsOpen && Input.GetKeyDown((KeyCode)27)) { ShieldConfigMenu.CloseMenu(); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } public static class ShieldPatches { [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] public static class GameCamera_UpdateMouseCapture_Patch { public static bool Prefix() { if (ShieldConfigMenu.IsOpen) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); return false; } return true; } } [HarmonyPatch(typeof(Player), "TakeInput")] public static class Player_TakeInput_Patch { public static void Postfix(ref bool __result) { if (ShieldConfigMenu.IsOpen) { __result = false; } } } [HarmonyPatch(typeof(ShieldGenerator), "UpdateShield")] public static class ShieldGenerator_UpdateShield_Patch { public static void Prefix(ShieldGenerator __instance) { if (!((Object)(object)__instance == (Object)null)) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { float minShieldRadius = component.GetZDO().GetFloat("SG_Custom_MinRadius", 10f); float maxShieldRadius = component.GetZDO().GetFloat("SG_Custom_MaxRadius", 30f); __instance.m_minShieldRadius = minShieldRadius; __instance.m_maxShieldRadius = maxShieldRadius; } } } } [HarmonyPatch(typeof(ShieldGenerator), "GetHoverText")] public static class ShieldGenerator_GetHoverText_Patch { public static void Postfix(ShieldGenerator __instance, ref string __result) { if (!((Object)(object)__instance == (Object)null)) { string text = Localization.instance.Localize("\n[<color=yellow><b>Hold $KEY_Use</b></color>] Configure Radius"); __result += text; } } } [HarmonyPatch(typeof(Player), "Update")] public static class Player_HoldE_Patch { public static void Postfix(Player __instance) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } if (ShieldConfigMenu.IsOpen) { _holdTimer = 0f; _holdExecuted = false; return; } if (!ZInput.GetButton("Use") && !ZInput.GetButton("JoyUse")) { _holdTimer = 0f; _holdExecuted = false; return; } GameObject hoverObject = ((Humanoid)__instance).GetHoverObject(); if ((Object)(object)hoverObject == (Object)null) { return; } ShieldGenerator componentInParent = hoverObject.GetComponentInParent<ShieldGenerator>(); if ((Object)(object)componentInParent == (Object)null) { return; } ZNetView component = ((Component)componentInParent).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { _holdTimer += Time.deltaTime; if (_holdTimer >= 0.6f && !_holdExecuted) { _holdExecuted = true; ShieldConfigMenu.OpenMenu(componentInParent); } } } } [HarmonyPatch(typeof(ShieldDomeImageEffect), "Awake")] public static class ShieldDomeImageEffect_Awake_Patch { public static void Postfix(ShieldDomeImageEffect __instance) { if (!((Object)(object)__instance == (Object)null) && __instance.m_drawDistance < 500f) { __instance.m_drawDistance = 500f; } } } private static float _holdTimer; private const float HOLD_REQUIRED_TIME = 0.6f; private static bool _holdExecuted; } public static class ShieldConfigMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<float> <>9__6_0; public static Action<float> <>9__6_1; public static UnityAction <>9__6_2; internal void <OpenMenu>b__6_0(float val) { _tempMinRadius = Mathf.Max(1f, val); } internal void <OpenMenu>b__6_1(float val) { _tempMaxRadius = Mathf.Max(1f, val); } internal void <OpenMenu>b__6_2() { SaveAndApply(); CloseMenu(); } } private static GameObject _settingsCanvas; private static ShieldGenerator _targetShield; private static float _tempMinRadius; private static float _tempMaxRadius; public static bool IsOpen => (Object)(object)_settingsCanvas != (Object)null; public static void OpenMenu(ShieldGenerator shield) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown if ((Object)(object)_settingsCanvas != (Object)null) { CloseMenu(); } _targetShield = shield; if ((Object)(object)_targetShield == (Object)null) { return; } ZNetView component = ((Component)_targetShield).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return; } _tempMinRadius = component.GetZDO().GetFloat("SG_Custom_MinRadius", 10f); _tempMaxRadius = component.GetZDO().GetFloat("SG_Custom_MaxRadius", 30f); _settingsCanvas = new GameObject("ShieldConfigCanvas"); _settingsCanvas.layer = 5; Object.DontDestroyOnLoad((Object)(object)_settingsCanvas); Canvas val = _settingsCanvas.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 10000; _settingsCanvas.AddComponent<CanvasScaler>(); _settingsCanvas.AddComponent<GraphicRaycaster>(); GameObject val2 = MakeRect("Background", _settingsCanvas.transform, new Color(0.06f, 0.06f, 0.07f, 0.98f)); SetRect(val2, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(680f, 290f), Vector2.zero); Outline val3 = val2.AddComponent<Outline>(); ((Shadow)val3).effectColor = new Color(0.3f, 0.3f, 0.3f, 1f); ((Shadow)val3).effectDistance = new Vector2(2f, -2f); Text val4 = MakeText("Header", val2.transform, "SHIELD GENERATOR CONFIGURATION", 18, new Color(1f, 0.72f, 0.15f), (FontStyle)1); SetRect(((Component)val4).gameObject, new Vector2(0f, 0.82f), new Vector2(1f, 1f), Vector2.zero, new Vector2(0f, -5f)); GameObject val5 = MakeRect("Content", val2.transform, Color.clear); SetRect(val5, new Vector2(0.04f, 0.28f), new Vector2(0.96f, 0.82f), Vector2.zero, Vector2.zero); VerticalLayoutGroup val6 = val5.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val6).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val6).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val6).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val6).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val6).spacing = 10f; ((LayoutGroup)val6).padding = new RectOffset(8, 8, 8, 8); CreateRadiusSliderRow(val5.transform, "Min Radius (Low Fuel)", _tempMinRadius, 10f, 1f, 100f, delegate(float num) { _tempMinRadius = Mathf.Max(1f, num); }); CreateRadiusSliderRow(val5.transform, "Max Radius (Full Fuel)", _tempMaxRadius, 30f, 5f, 200f, delegate(float num) { _tempMaxRadius = Mathf.Max(1f, num); }); GameObject val7 = MakeRect("CloseBtn", val2.transform, new Color(0.75f, 0.2f, 0.2f, 1f)); SetRect(val7, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(240f, 38f), new Vector2(0f, 28f)); MakeText("CloseTxt", val7.transform, "SAVE & CLOSE", 15, Color.white, (FontStyle)1); Button val8 = val7.AddComponent<Button>(); ButtonClickedEvent onClick = val8.onClick; object obj = <>c.<>9__6_2; if (obj == null) { UnityAction val9 = delegate { SaveAndApply(); CloseMenu(); }; <>c.<>9__6_2 = val9; obj = (object)val9; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } public static void CloseMenu() { if ((Object)(object)_settingsCanvas != (Object)null) { Object.Destroy((Object)(object)_settingsCanvas); _settingsCanvas = null; } _targetShield = null; } private static void SaveAndApply() { if ((Object)(object)_targetShield == (Object)null) { return; } ZNetView component = ((Component)_targetShield).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { if (_tempMinRadius > _tempMaxRadius) { _tempMinRadius = _tempMaxRadius; } component.ClaimOwnership(); component.GetZDO().Set("SG_Custom_MinRadius", _tempMinRadius); component.GetZDO().Set("SG_Custom_MaxRadius", _tempMaxRadius); _targetShield.m_minShieldRadius = _tempMinRadius; _targetShield.m_maxShieldRadius = _tempMaxRadius; if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)1, $"[Shield] Radius saved: {_tempMinRadius:0}m - {_tempMaxRadius:0}m", 0, (Sprite)null, false); } } } private static void CreateRadiusSliderRow(Transform parent, string labelText, float initialValue, float defaultValue, float minSliderLimit, float maxSliderLimit, Action<float> onChanged) { //IL_0036: 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_00a4: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown GameObject val = MakeRect("Row_" + labelText, parent, new Color(1f, 1f, 1f, 0.06f)); LayoutElement val2 = val.AddComponent<LayoutElement>(); val2.minHeight = 44f; val2.preferredHeight = 44f; HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f; ((LayoutGroup)val3).padding = new RectOffset(12, 12, 5, 5); Text val4 = MakeText("Label", val.transform, labelText, 14, Color.white, (FontStyle)0); val4.alignment = (TextAnchor)3; LayoutElement val5 = ((Component)val4).gameObject.AddComponent<LayoutElement>(); val5.minWidth = 190f; val5.preferredWidth = 190f; float currentValue = initialValue; bool isUpdating = false; float maxVal = Mathf.Max(maxSliderLimit, currentValue); Slider slider = CreateSlider(val.transform, minSliderLimit, maxVal, currentValue); GameObject val6 = MakeRect("InputBg", val.transform, new Color(0.12f, 0.12f, 0.14f, 1f)); Outline val7 = val6.AddComponent<Outline>(); ((Shadow)val7).effectColor = new Color(0.25f, 0.25f, 0.25f, 0.8f); ((Shadow)val7).effectDistance = new Vector2(1f, -1f); LayoutElement val8 = val6.AddComponent<LayoutElement>(); val8.minWidth = 65f; val8.preferredWidth = 65f; val8.flexibleWidth = 0f; string text = initialValue.ToString("0.#", CultureInfo.InvariantCulture); Text val9 = MakeText("Text", val6.transform, text, 14, Color.white, (FontStyle)0); val9.alignment = (TextAnchor)4; InputField inputField = val6.AddComponent<InputField>(); inputField.textComponent = val9; inputField.text = text; ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float num) { if (!isUpdating) { isUpdating = true; currentValue = (float)Math.Round(num, 1); inputField.text = currentValue.ToString("0.#", CultureInfo.InvariantCulture); onChanged?.Invoke(currentValue); isUpdating = false; } }); ((UnityEvent<string>)(object)inputField.onEndEdit).AddListener((UnityAction<string>)delegate(string s) { if (!isUpdating) { if (float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { isUpdating = true; currentValue = Mathf.Max(1f, (float)Math.Round(result, 1)); if (currentValue > slider.maxValue) { slider.maxValue = currentValue; } slider.value = currentValue; inputField.text = currentValue.ToString("0.#", CultureInfo.InvariantCulture); onChanged?.Invoke(currentValue); isUpdating = false; } else { inputField.text = currentValue.ToString("0.#", CultureInfo.InvariantCulture); } } }); GameObject val10 = MakeRect("ResetBtn", val.transform, new Color(0.18f, 0.45f, 0.85f, 1f)); LayoutElement val11 = val10.AddComponent<LayoutElement>(); val11.minWidth = 34f; val11.preferredWidth = 34f; val11.minHeight = 34f; val11.preferredHeight = 34f; val11.flexibleWidth = 0f; Text val12 = MakeText("ResetTxt", val10.transform, "↺", 16, Color.white, (FontStyle)1); val12.alignment = (TextAnchor)4; ((UnityEvent)val10.AddComponent<Button>().onClick).AddListener((UnityAction)delegate { isUpdating = true; currentValue = defaultValue; slider.value = defaultValue; inputField.text = defaultValue.ToString("0.#", CultureInfo.InvariantCulture); onChanged?.Invoke(currentValue); isUpdating = false; }); } private static Slider CreateSlider(Transform parent, float minVal, float maxVal, float curVal) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakeRect("Slider", parent, Color.clear); LayoutElement val2 = val.AddComponent<LayoutElement>(); val2.minWidth = 180f; val2.flexibleWidth = 1f; val2.preferredHeight = 30f; GameObject val3 = MakeRect("Background", val.transform, new Color(0.15f, 0.15f, 0.18f, 1f)); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0.35f); component.anchorMax = new Vector2(1f, 0.65f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; GameObject val4 = MakeRect("Fill Area", val.transform, Color.clear); RectTransform component2 = val4.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0.35f); component2.anchorMax = new Vector2(1f, 0.65f); component2.offsetMin = new Vector2(5f, 0f); component2.offsetMax = new Vector2(-5f, 0f); GameObject val5 = MakeRect("Fill", val4.transform, new Color(0.9f, 0.65f, 0.15f, 1f)); RectTransform component3 = val5.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 0f); component3.anchorMax = new Vector2(0f, 1f); component3.sizeDelta = Vector2.zero; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; GameObject val6 = MakeRect("Handle Slide Area", val.transform, Color.clear); RectTransform component4 = val6.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = new Vector2(1f, 1f); component4.offsetMin = new Vector2(8f, 0f); component4.offsetMax = new Vector2(-8f, 0f); GameObject val7 = MakeRect("Handle", val6.transform, new Color(0.95f, 0.95f, 0.95f, 1f)); RectTransform component5 = val7.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 0f); component5.anchorMax = new Vector2(0f, 1f); component5.sizeDelta = new Vector2(16f, 0f); component5.offsetMin = new Vector2(-8f, 3f); component5.offsetMax = new Vector2(8f, -3f); Outline val8 = val7.AddComponent<Outline>(); ((Shadow)val8).effectColor = new Color(0.1f, 0.1f, 0.1f, 0.8f); ((Shadow)val8).effectDistance = new Vector2(1f, -1f); Slider val9 = val.AddComponent<Slider>(); val9.fillRect = component3; val9.handleRect = component5; ((Selectable)val9).targetGraphic = (Graphic)(object)val7.GetComponent<Image>(); val9.direction = (Direction)0; val9.minValue = minVal; val9.maxValue = maxVal; val9.wholeNumbers = false; val9.value = curVal; return val9; } public static GameObject MakeRect(string name, Transform parent, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.layer = 5; val.transform.SetParent(parent, false); ((Graphic)val.AddComponent<Image>()).color = color; return val; } public static Text MakeText(string name, Transform parent, string text, int size, Color color, FontStyle style = (FontStyle)0) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007b: 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) GameObject val = new GameObject(name); val.layer = 5; val.transform.SetParent(parent, false); Text val2 = val.AddComponent<Text>(); val2.text = text; val2.font = GetValheimFont(); val2.fontSize = size; ((Graphic)val2).color = color; val2.fontStyle = style; val2.alignment = (TextAnchor)4; RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; component.anchoredPosition = Vector2.zero; return val2; } public static void SetRect(GameObject go, Vector2 min, Vector2 max, Vector2 size, Vector2 pos) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform component = go.GetComponent<RectTransform>(); component.anchorMin = min; component.anchorMax = max; component.sizeDelta = size; component.anchoredPosition = pos; } public static Font GetValheimFont() { Font[] array = Object.FindObjectsByType<Font>((FindObjectsSortMode)0); Font[] array2 = array; foreach (Font val in array2) { if ((Object)(object)val != (Object)null && ((Object)val).name.Contains("Averia")) { return val; } } return Resources.GetBuiltinResource<Font>("Arial.ttf"); } } }