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 BuildExpansion Renewed v1.0.9
BuildExpansion_Renewed.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.EventSystems; 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: AssemblyTitle("BuildExpansion")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("VPlus Team - Mixone")] [assembly: AssemblyProduct("BuildExpansion")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8d23e69f-aa5c-47a4-9dd9-69b358c2d879")] [assembly: AssemblyFileVersion("1.0.9")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.0")] [module: UnverifiableCode] namespace BuildExpansion; [BepInPlugin("mixone.valheimplus.buildexpansion", "Valheim Plus Build Expansion", "1.0.9")] public class BuildExpansionMod : BaseUnityPlugin { public const string ID = "mixone.valheimplus.buildexpansion"; public const string version = "1.0.9"; public static ConfigEntry<int> maxGridHeight; public static ConfigEntry<int> newGridWidth; public static ConfigEntry<bool> disableScrollCategories; public static ConfigEntry<bool> isEnabled; public Harmony harmony; public static ManualLogSource buildFilterLogger; public void Awake() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown maxGridHeight = ((BaseUnityPlugin)this).Config.Bind<int>("General.Constants", "MaxGridHeight", 15, "Sets a maximum value for grid height, if over 30 can impact performance."); newGridWidth = ((BaseUnityPlugin)this).Config.Bind<int>("General", "GridWidth", 15, "Width in number of columns of the build grid, maximum value of 15."); disableScrollCategories = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Toggles", "DisableScrollCategories", true, "Should the mousewheel stop scrolling categories, RECOMMEND TRUE."); isEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Toggles", "EnableExpansion", true, "Whether or not to expand the build grid."); if (newGridWidth.Value > 15) { newGridWidth.Value = 15; } harmony = new Harmony("mixone.valheimplus.buildexpansion"); harmony.PatchAll(); buildFilterLogger = ((BaseUnityPlugin)this).Logger; buildFilterLogger.LogDebug((object)"Build Expansion loaded."); } } public static class HudTranspilers { [HarmonyPatch(typeof(Hud), "GetSelectedGrid")] public static class Hud_GetSelectedGrid_Transpiler { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { if (BuildExpansionMod.isEnabled.Value) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); list[0].operand = BuildExpansionMod.newGridWidth.Value; list[2].opcode = OpCodes.Ldc_I4_S; list[2].operand = BuildExpansionMod.maxGridHeight.Value; return list; } return instructions; } } [HarmonyPatch(typeof(Hud), "UpdatePieceList")] public static class Hud_UpdatePieceList_Transpiler { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { if (BuildExpansionMod.isEnabled.Value) { List<CodeInstruction> list = new List<CodeInstruction>(instructions); list[3].operand = BuildExpansionMod.newGridWidth.Value; list[5].opcode = OpCodes.Ldc_I4_S; list[5].operand = HudPatches.calculatedRows; return list; } return instructions; } } } public static class HudPatches { [HarmonyPatch(typeof(Hud), "Awake")] public static class Hud_Awake_Patch { public static void Prefix(ref Hud __instance) { //IL_0015: 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) //IL_006c: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) if (BuildExpansionMod.isEnabled.Value) { Resources val = default(Resources); val.standard = ((Component)__instance.m_pieceCategoryRoot.transform.parent.GetChild(0)).gameObject.GetComponent<Image>().sprite; myScroll = DefaultControls.CreateScrollbar(val).GetComponent<Scrollbar>(); ((Component)myScroll).GetComponent<RectTransform>().anchorMin = new Vector2(1f, 0f); ((Component)myScroll).GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f); ((Component)myScroll).GetComponent<RectTransform>().pivot = new Vector2(1f, 1f); ((Transform)((Component)myScroll).GetComponent<RectTransform>()).localPosition = Vector2.op_Implicit(new Vector2(0f, 0f)); ((Component)myScroll).GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f); myScroll.direction = (Direction)2; ((Graphic)((Component)myScroll).gameObject.GetComponent<Image>()).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)150)); ((Component)myScroll).gameObject.transform.SetParent(((Component)__instance.m_pieceListRoot).transform.parent, false); PreventClickDragScrollRect preventClickDragScrollRect = ((Component)((Component)__instance.m_pieceListRoot).transform.parent).gameObject.AddComponent<PreventClickDragScrollRect>(); ((ScrollRect)preventClickDragScrollRect).content = __instance.m_pieceListRoot; ((ScrollRect)preventClickDragScrollRect).viewport = ((Component)((Component)__instance.m_pieceListRoot).transform.parent).gameObject.GetComponent<RectTransform>(); ((ScrollRect)preventClickDragScrollRect).verticalScrollbar = myScroll; ((ScrollRect)preventClickDragScrollRect).movementType = (MovementType)2; ((ScrollRect)preventClickDragScrollRect).inertia = false; ((ScrollRect)preventClickDragScrollRect).scrollSensitivity = __instance.m_pieceIconSpacing; ((ScrollRect)preventClickDragScrollRect).verticalScrollbarVisibility = (ScrollbarVisibility)1; visibilityInsurance = ((Component)preventClickDragScrollRect).gameObject.AddComponent<ScrollRectEnsureVisible>(); __instance.m_pieceListRoot.sizeDelta = new Vector2((float)(int)(__instance.m_pieceIconSpacing * (float)BuildExpansionMod.newGridWidth.Value), (float)((int)(__instance.m_pieceIconSpacing * (float)BuildExpansionMod.maxGridHeight.Value) + 16)); } } } [HarmonyPatch(typeof(Hud), "UpdatePieceList")] public static class Hud_UpdatePieceList_Patch { public static bool Prefix(ref Hud __instance, ref Player player, ref Vector2Int selectedNr, ref PieceCategory category, ref bool updateAllBuildStatuses) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Invalid comparison between Unknown and I4 //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) if (BuildExpansionMod.isEnabled.Value) { List<Piece> buildPieces = player.GetBuildPieces(); int num = BuildExpansionMod.newGridWidth.Value; calculatedRows = buildPieces.Count / num + 1; if (buildPieces.Count <= 1) { calculatedRows = 1; num = 1; } category = (PieceCategory)5; if (needRefresh || __instance.m_pieceIcons.Count((PieceIconData x) => x.m_go.activeSelf) != buildPieces.Count) { BuildExpansionMod.buildFilterLogger.LogDebug((object)$"\npieceIcons: {__instance.m_pieceIcons.Count((PieceIconData x) => x.m_go.activeSelf)}\nBuild pieces: {buildPieces.Count}"); BuildExpansionMod.buildFilterLogger.LogDebug((object)$"\nRows: {calculatedRows}\nColumns: {num}"); __instance.m_pieceListRoot.sizeDelta = new Vector2((float)(int)(__instance.m_pieceIconSpacing * (float)BuildExpansionMod.newGridWidth.Value), (float)((int)(__instance.m_pieceIconSpacing * (float)calculatedRows) + 16)); foreach (PieceIconData pieceIcon in __instance.m_pieceIcons) { Object.Destroy((Object)(object)pieceIcon.m_go); } __instance.m_pieceIcons.Clear(); for (int i = 0; i < calculatedRows; i++) { for (int j = 0; j < num; j++) { int num2 = i * num + j; GameObject val = Object.Instantiate<GameObject>(__instance.m_pieceIconPrefab, (Transform)(object)__instance.m_pieceListRoot); Transform transform = val.transform; ((RectTransform)((transform is RectTransform) ? transform : null)).anchorMin = new Vector2(0f, 1f); Transform transform2 = val.transform; ((RectTransform)((transform2 is RectTransform) ? transform2 : null)).anchorMax = new Vector2(0f, 1f); Transform transform3 = val.transform; ((RectTransform)((transform3 is RectTransform) ? transform3 : null)).pivot = new Vector2(0f, 1f); Transform transform4 = val.transform; ((RectTransform)((transform4 is RectTransform) ? transform4 : null)).anchoredPosition = Vector2.zero; Transform transform5 = val.transform; ((transform5 is RectTransform) ? transform5 : null).localPosition = Vector2.op_Implicit(new Vector2((float)j * __instance.m_pieceIconSpacing, -16f + (float)(-i) * __instance.m_pieceIconSpacing)); PieceIconData val2 = new PieceIconData(); val2.m_go = val; val2.m_tooltip = val.GetComponent<UITooltip>(); val2.m_icon = ((Component)val.transform.Find("icon")).GetComponent<Image>(); val2.m_marker = ((Component)val.transform.Find("selected")).gameObject; val2.m_upgrade = ((Component)val.transform.Find("upgrade")).gameObject; ((Graphic)val2.m_icon).color = new Color(1f, 0f, 1f, 0f); UIInputHandler component = val.GetComponent<UIInputHandler>(); component.m_onLeftDown = (Action<UIInputHandler>)Delegate.Combine(component.m_onLeftDown, new Action<UIInputHandler>(__instance.OnLeftClickPiece)); component.m_onRightDown = (Action<UIInputHandler>)Delegate.Combine(component.m_onRightDown, new Action<UIInputHandler>(__instance.OnRightClickPiece)); component.m_onPointerEnter = (Action<UIInputHandler>)Delegate.Combine(component.m_onPointerEnter, new Action<UIInputHandler>(__instance.OnHoverPiece)); component.m_onPointerExit = (Action<UIInputHandler>)Delegate.Combine(component.m_onPointerExit, new Action<UIInputHandler>(__instance.OnHoverPieceExit)); val2.m_marker.SetActive(new Vector2Int(j, i) == selectedNr); if (num2 < buildPieces.Count) { Piece val3 = buildPieces[num2]; val2.m_icon.sprite = val3.m_icon; ((Behaviour)val2.m_icon).enabled = true; val2.m_tooltip.m_text = val3.m_name; val2.m_upgrade.SetActive(val3.m_isUpgrade); val2.m_go.SetActive(true); } else { ((Behaviour)val2.m_icon).enabled = false; val2.m_tooltip.m_text = ""; val2.m_upgrade.SetActive(false); val2.m_go.SetActive(false); } BuildExpansionMod.buildFilterLogger.LogDebug((object)("\nPiece name: " + val2.m_tooltip.m_text + $"\nPiece icon: {((Behaviour)val2.m_icon).enabled}" + $"\nPiece index: {num2}" + $"\nPiece x: {j}" + $"\nPiece y: {i}")); __instance.m_pieceIcons.Add(val2); } } if (needRefresh) { needRefresh = false; } } for (int k = 0; k < calculatedRows; k++) { for (int l = 0; l < num; l++) { int index = k * num + l; __instance.m_pieceIcons[index].m_marker.SetActive(new Vector2Int(l, k) == selectedNr); } } __instance.UpdatePieceBuildStatus(buildPieces, player); if (updateAllBuildStatuses) { __instance.UpdatePieceBuildStatusAll(buildPieces, player); } if ((int)__instance.m_lastPieceCategory != (int)category) { __instance.m_lastPieceCategory = category; __instance.m_pieceBarPosX = __instance.m_pieceBarTargetPosX; __instance.UpdatePieceBuildStatusAll(buildPieces, player); } return false; } return true; } } public static Scrollbar myScroll; public static int calculatedRows = 1; public static ScrollRectEnsureVisible visibilityInsurance; public static bool needRefresh = true; } public static class PieceTablePatches { [HarmonyPatch(typeof(PieceTable), "SetCategory")] public static class PieceTable_SetCategory_Patch { public static void Postfix(ref PieceTable __instance) { if (BuildExpansionMod.isEnabled.Value) { HudPatches.needRefresh = true; } } } [HarmonyPatch(typeof(PieceTable), "PrevCategory")] public static class PieceTable_PrevCategory_Patch { public static bool Prefix(ref PieceTable __instance) { if (BuildExpansionMod.isEnabled.Value) { if (BuildExpansionMod.disableScrollCategories.Value && Input.GetAxis("Mouse ScrollWheel") != 0f) { return false; } HudPatches.needRefresh = true; } return true; } } [HarmonyPatch(typeof(PieceTable), "NextCategory")] public static class PieceTable_NextCategory_Patch { public static bool Prefix(ref PieceTable __instance) { if (BuildExpansionMod.isEnabled.Value) { if (BuildExpansionMod.disableScrollCategories.Value && Input.GetAxis("Mouse ScrollWheel") != 0f) { return false; } HudPatches.needRefresh = true; } return true; } } [HarmonyPatch(typeof(PieceTable), "RightPiece")] public static class PieceTable_RightPiece_Patch { public static bool Prefix(ref PieceTable __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected I4, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d4: Unknown result type (might be due to invalid IL or missing references) if (BuildExpansionMod.isEnabled.Value) { if (__instance.m_availablePieces[(int)__instance.m_selectedCategory].Count <= 1) { return false; } int num = Player.m_localPlayer.GetBuildPieces().Count % BuildExpansionMod.newGridWidth.Value; Vector2Int val = __instance.m_selectedPiece[__instance.m_selectedCategory]; ((Vector2Int)(ref val)).x = ((Vector2Int)(ref val)).x + 1; if ((((Vector2Int)(ref val)).y >= HudPatches.calculatedRows && num != 0 && ((Vector2Int)(ref val)).x > num - 1) || ((Vector2Int)(ref val)).x >= BuildExpansionMod.newGridWidth.Value) { ((Vector2Int)(ref val)).x = 0; } __instance.m_selectedPiece[__instance.m_selectedCategory] = val; ScrollRectEnsureVisible visibilityInsurance = HudPatches.visibilityInsurance; Transform transform = Hud.instance.m_pieceIcons[((Vector2Int)(ref val)).x + ((Vector2Int)(ref val)).y * BuildExpansionMod.newGridWidth.Value].m_go.transform; visibilityInsurance.CenterOnItem((RectTransform)(object)((transform is RectTransform) ? transform : null)); return false; } return true; } } [HarmonyPatch(typeof(PieceTable), "LeftPiece")] public static class PieceTable_LeftPiece_Patch { public static bool Prefix(ref PieceTable __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected I4, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (BuildExpansionMod.isEnabled.Value) { if (__instance.m_availablePieces[(int)__instance.m_selectedCategory].Count <= 1) { return false; } int num = Player.m_localPlayer.GetBuildPieces().Count % BuildExpansionMod.newGridWidth.Value; Vector2Int val = __instance.m_selectedPiece[__instance.m_selectedCategory]; ((Vector2Int)(ref val)).x = ((Vector2Int)(ref val)).x - 1; if (((Vector2Int)(ref val)).x < 0) { if (((Vector2Int)(ref val)).y >= HudPatches.calculatedRows - 1 && num != 0 && ((Vector2Int)(ref val)).x > num - 1) { ((Vector2Int)(ref val)).x = num - 1; } else { ((Vector2Int)(ref val)).x = BuildExpansionMod.newGridWidth.Value - 1; } } __instance.m_selectedPiece[__instance.m_selectedCategory] = val; ScrollRectEnsureVisible visibilityInsurance = HudPatches.visibilityInsurance; Transform transform = Hud.instance.m_pieceIcons[((Vector2Int)(ref val)).x + ((Vector2Int)(ref val)).y * BuildExpansionMod.newGridWidth.Value].m_go.transform; visibilityInsurance.CenterOnItem((RectTransform)(object)((transform is RectTransform) ? transform : null)); return false; } return true; } } [HarmonyPatch(typeof(PieceTable), "UpPiece")] public static class PieceTable_UpPiece_Patch { public static bool Prefix(ref PieceTable __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected I4, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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) if (BuildExpansionMod.isEnabled.Value) { if (__instance.m_availablePieces[(int)__instance.m_selectedCategory].Count <= 1) { return false; } int num = Player.m_localPlayer.GetBuildPieces().Count % BuildExpansionMod.newGridWidth.Value; Vector2Int val = __instance.m_selectedPiece[__instance.m_selectedCategory]; ((Vector2Int)(ref val)).y = ((Vector2Int)(ref val)).y - 1; if (((Vector2Int)(ref val)).y < 0) { ((Vector2Int)(ref val)).y = HudPatches.calculatedRows - 1; if (num != 0 && ((Vector2Int)(ref val)).x > num - 1) { ((Vector2Int)(ref val)).x = num - 1; } } __instance.m_selectedPiece[__instance.m_selectedCategory] = val; ScrollRectEnsureVisible visibilityInsurance = HudPatches.visibilityInsurance; Transform transform = Hud.instance.m_pieceIcons[((Vector2Int)(ref val)).x + ((Vector2Int)(ref val)).y * BuildExpansionMod.newGridWidth.Value].m_go.transform; visibilityInsurance.CenterOnItem((RectTransform)(object)((transform is RectTransform) ? transform : null)); return false; } return true; } } [HarmonyPatch(typeof(PieceTable), "DownPiece")] public static class PieceTable_DownPiece_Patch { public static bool Prefix(ref PieceTable __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected I4, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (BuildExpansionMod.isEnabled.Value) { if (__instance.m_availablePieces[(int)__instance.m_selectedCategory].Count <= 1) { return false; } int num = Player.m_localPlayer.GetBuildPieces().Count % BuildExpansionMod.newGridWidth.Value; Vector2Int val = __instance.m_selectedPiece[__instance.m_selectedCategory]; ((Vector2Int)(ref val)).y = ((Vector2Int)(ref val)).y + 1; if (((Vector2Int)(ref val)).y >= HudPatches.calculatedRows) { ((Vector2Int)(ref val)).y = 0; } if (((Vector2Int)(ref val)).y >= HudPatches.calculatedRows - 1 && num != 0 && ((Vector2Int)(ref val)).x > num - 1) { ((Vector2Int)(ref val)).x = num - 1; } __instance.m_selectedPiece[__instance.m_selectedCategory] = val; ScrollRectEnsureVisible visibilityInsurance = HudPatches.visibilityInsurance; Transform transform = Hud.instance.m_pieceIcons[((Vector2Int)(ref val)).x + ((Vector2Int)(ref val)).y * BuildExpansionMod.newGridWidth.Value].m_go.transform; visibilityInsurance.CenterOnItem((RectTransform)(object)((transform is RectTransform) ? transform : null)); return false; } return true; } } } public class PreventClickDragScrollRect : ScrollRect { public override void OnBeginDrag(PointerEventData eventData) { } public override void OnDrag(PointerEventData eventData) { } public override void OnEndDrag(PointerEventData eventData) { } } [RequireComponent(typeof(ScrollRect))] public class ScrollRectEnsureVisible : MonoBehaviour { public RectTransform maskTransform; private PreventClickDragScrollRect mScrollRect; private RectTransform mScrollTransform; private RectTransform mContent; public void CenterOnItem(RectTransform target) { //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_0014: 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_002e: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d7: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Invalid comparison between Unknown and I4 //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) Vector3 worldPointInWidget = GetWorldPointInWidget(mScrollTransform, GetWidgetWorldPoint(target)); Vector3 worldPointInWidget2 = GetWorldPointInWidget(mScrollTransform, GetWidgetWorldPoint(maskTransform)); Vector3 val = worldPointInWidget2 - worldPointInWidget; val.z = 0f; if (!((ScrollRect)mScrollRect).horizontal) { val.x = 0f; } if (!((ScrollRect)mScrollRect).vertical) { val.y = 0f; } float x = val.x; Rect rect = mContent.rect; float x2 = ((Rect)(ref rect)).size.x; rect = mScrollTransform.rect; float num = x / (x2 - ((Rect)(ref rect)).size.x); float y = val.y; rect = mContent.rect; float y2 = ((Rect)(ref rect)).size.y; rect = mScrollTransform.rect; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(num, y / (y2 - ((Rect)(ref rect)).size.y)); Vector2 val3 = ((ScrollRect)mScrollRect).normalizedPosition - val2; if ((int)((ScrollRect)mScrollRect).movementType > 0) { val3.x = Mathf.Clamp01(val3.x); val3.y = Mathf.Clamp01(val3.y); } ((ScrollRect)mScrollRect).normalizedPosition = val3; } private void Awake() { mScrollRect = ((Component)this).GetComponent<PreventClickDragScrollRect>(); ref RectTransform reference = ref mScrollTransform; Transform transform = ((Component)mScrollRect).transform; reference = (RectTransform)(object)((transform is RectTransform) ? transform : null); mContent = ((ScrollRect)mScrollRect).content; Reset(); } private void Reset() { if (!((Object)(object)maskTransform == (Object)null)) { return; } Mask componentInChildren = ((Component)this).GetComponentInChildren<Mask>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { maskTransform = componentInChildren.rectTransform; } if ((Object)(object)maskTransform == (Object)null) { RectMask2D componentInChildren2 = ((Component)this).GetComponentInChildren<RectMask2D>(true); if (Object.op_Implicit((Object)(object)componentInChildren2)) { maskTransform = componentInChildren2.rectTransform; } } } private Vector3 GetWidgetWorldPoint(RectTransform target) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_005d: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0073: Unknown result type (might be due to invalid IL or missing references) float num = 0.5f - target.pivot.x; Rect rect = target.rect; float num2 = num * ((Rect)(ref rect)).size.x; float num3 = 0.5f - target.pivot.y; rect = target.rect; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num2, num3 * ((Rect)(ref rect)).size.y, 0f); Vector3 val2 = ((Transform)target).localPosition + val; return ((Transform)target).parent.TransformPoint(val2); } private Vector3 GetWorldPointInWidget(RectTransform target, Vector3 worldPoint) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Transform)target).InverseTransformPoint(worldPoint); } }