using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ClientUI.Hooks;
using ClientUI.UI;
using ClientUI.UI.Panel;
using ClientUI.UI.Util;
using ClientUI.UniverseLib.UI;
using ClientUI.UniverseLib.UI.Models;
using ClientUI.UniverseLib.UI.ObjectPool;
using ClientUI.UniverseLib.UI.Panels;
using ClientUI.UniverseLib.UI.Widgets;
using ClientUI.UniverseLib.UI.Widgets.ScrollView;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Network;
using ProjectM.UI;
using TMPro;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
using XPShared;
using XPShared.Hooks;
using XPShared.Services;
using XPShared.Transport.Messages;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("XPRising.ClientUI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: AssemblyInformationalVersion("0.5.0+Branch.main.Sha.88e08e70b1909042835afd8181f156e72d7c97d2.88e08e70b1909042835afd8181f156e72d7c97d2")]
[assembly: AssemblyProduct("XPRising.ClientUI")]
[assembly: AssemblyTitle("XPRising.ClientUI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 ClientUI
{
public static class ChatUtils
{
private static readonly ComponentType[] NetworkEventComponents = (ComponentType[])(object)new ComponentType[4]
{
ComponentType.ReadOnly(Il2CppType.Of<FromCharacter>()),
ComponentType.ReadOnly(Il2CppType.Of<NetworkEventType>()),
ComponentType.ReadOnly(Il2CppType.Of<SendNetworkEventTag>()),
ComponentType.ReadOnly(Il2CppType.Of<ChatMessageEvent>())
};
private static readonly NetworkEventType ChatEventType = new NetworkEventType
{
IsAdminEvent = false,
EventId = NetworkEvents.EventId_ChatMessageEvent,
IsDebugEvent = false
};
private static readonly int ClientNonce = Random.Shared.Next();
public static void SendInitialisation()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
if (!(ClientChatPatch.LocalUser == Entity.Null))
{
ChatService.RegisterClientNonce(ClientChatPatch.LocalSteamId, ClientNonce);
ChatUtils.SendToServer<ClientRegisterMessage>(new ClientRegisterMessage(ClientNonce, ClientChatPatch.LocalSteamId));
}
}
public static void SendToServer<T>(T msg) where T : IChatMessage
{
//IL_001a: 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_0030: 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)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_0080: 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_0088: 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)
Plugin.Log((LogLevel)32, "[CLIENT] [SEND] IChatMessage");
string text = ChatService.SerialiseMessage<T>(msg, ClientNonce);
ChatMessageEvent val = default(ChatMessageEvent);
val.MessageText = new FixedString512Bytes(text);
val.MessageType = (ChatMessageType)4;
val.ReceiverEntity = Extensions.Read<NetworkId>(ClientChatPatch.LocalUser);
ChatMessageEvent val2 = val;
EntityManager entityManager = Plugin.World.EntityManager;
Entity val3 = ((EntityManager)(ref entityManager)).CreateEntity(NetworkEventComponents);
Extensions.Write<FromCharacter>(val3, new FromCharacter
{
Character = ClientChatPatch.LocalCharacter,
User = ClientChatPatch.LocalUser
});
Extensions.Write<NetworkEventType>(val3, ChatEventType);
Extensions.Write<ChatMessageEvent>(val3, val2);
}
}
[BepInPlugin("XPRising.ClientUI", "XPRising.ClientUI", "0.5.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
private static ManualLogSource _logger;
private const string ConnectionGroup = "InternalConnection";
private static FrameTimer _uiInitialisedTimer = new FrameTimer();
private static FrameTimer _connectUiTimer;
private static FrameTimer _connectionUpdateTimer;
private float _connectionProgressValue;
private static Harmony _harmonyBootPatch;
private static Harmony _harmonyCanvasPatch;
private static Harmony _harmonyMenuPatch;
internal static Harmony _harmonyVersionStringPatch;
private const string TurboColourMap = "@#30123B@#445ACD@#3E9BFE@#18D6CB@#46F783@#A2FC3C@#E1DC37@#FDA531@#EF5A11@#C42502@#7A0402";
private float _testValue;
private FrameTimer _testTimer1;
private FrameTimer _testTimer2;
private bool _buttonEnabled;
private int _testValue2;
internal static Plugin Instance { get; private set; }
public override void Load()
{
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
Instance = this;
_logger = ((BasePlugin)this).Log;
if (Plugin.IsServer)
{
Log((LogLevel)4, "Plugin XPRising.ClientUI is a client plugin only. Not continuing to load on server.");
return;
}
UIManager.Initialize();
_harmonyBootPatch = Harmony.CreateAndPatchAll(typeof(GameManangerPatch), (string)null);
_harmonyMenuPatch = Harmony.CreateAndPatchAll(typeof(MainMenuNewViewPatch), (string)null);
_harmonyCanvasPatch = Harmony.CreateAndPatchAll(typeof(UICanvasSystemPatch), (string)null);
_harmonyVersionStringPatch = Harmony.CreateAndPatchAll(typeof(VersionStringPatch), (string)null);
_connectUiTimer = new FrameTimer();
_connectUiTimer.Initialise((Action)delegate
{
ChatUtils.SendInitialisation();
Log((LogLevel)16, "Sending client initialisation...");
}, TimeSpan.FromSeconds(1.0), 5);
_connectionUpdateTimer = new FrameTimer();
_connectionUpdateTimer.Initialise((Action)delegate
{
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: 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_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: 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_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
//IL_01b0: Expected O, but got Unknown
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Expected O, but got Unknown
if (_connectUiTimer.Enabled)
{
_connectionProgressValue = (_connectionProgressValue + 0.0125f) % 100f;
UIManager.ContentPanel.ChangeProgress(new ProgressSerialisedMessage
{
Group = "InternalConnection",
Label = "Connecting",
Colour = "@#30123B@#445ACD@#3E9BFE@#18D6CB@#46F783@#A2FC3C@#E1DC37@#FDA531@#EF5A11@#C42502@#7A0402",
Active = (ActiveState)2,
Change = "",
Header = "",
ProgressPercentage = _connectionProgressValue % 1f,
Tooltip = $"Connecting ... {_connectUiTimer.TimeSinceStart.Seconds}s ({_connectUiTimer.RunCount}/5)"
});
}
else
{
UIManager.ContentPanel.ChangeProgress(new ProgressSerialisedMessage
{
Group = "InternalConnection",
Label = "Connecting",
Colour = "red",
Active = (ActiveState)2,
Change = "",
Header = "",
ProgressPercentage = 1f,
Tooltip = "Server connection failed!"
});
UIManager.ContentPanel.SetButton(new ActionSerialisedMessage
{
Group = "InternalConnection",
ID = "RetryConnection",
Label = "Retry Connection?",
Colour = "red",
Enabled = true
}, delegate
{
ClientChatPatch.ResetUser();
UIManager.Reset();
_connectUiTimer.Start();
});
UIManager.ContentPanel.SetButton(new ActionSerialisedMessage
{
Group = "InternalConnection",
ID = "HideUI",
Label = "Hide UI",
Colour = "red",
Enabled = true
}, delegate
{
ClientChatPatch.ResetUser();
UIManager.Reset();
UIManager.SetActive(active: false);
});
UIManager.ContentPanel.OpenActionPanel("InternalConnection");
}
}, TimeSpan.FromMilliseconds(50.0), -1);
RegisterMessages();
Log((LogLevel)16, "Plugin XPRising.ClientUI is loaded!");
}
public override bool Unload()
{
_harmonyBootPatch.UnpatchSelf();
_harmonyCanvasPatch.UnpatchSelf();
_harmonyMenuPatch.UnpatchSelf();
_harmonyVersionStringPatch.UnpatchSelf();
return true;
}
public static void GameDataOnInitialize(World world)
{
if (!Plugin.IsClient)
{
return;
}
_uiInitialisedTimer.Initialise((Action)delegate
{
if (!UIManager.IsInitialised)
{
UIManager.OnInitialized();
}
_connectUiTimer.Start();
_connectionUpdateTimer.Start();
}, TimeSpan.FromSeconds(5.0), 1).Start();
}
private static void GameDataOnDestroy()
{
}
private static void RegisterMessages()
{
ChatService.RegisterType<ProgressSerialisedMessage>((Action<ProgressSerialisedMessage, ulong>)delegate(ProgressSerialisedMessage message, ulong steamId)
{
if (UIManager.IsInitialised)
{
UIManager.ContentPanel.ChangeProgress(message);
}
});
ChatService.RegisterType<ActionSerialisedMessage>((Action<ActionSerialisedMessage, ulong>)delegate(ActionSerialisedMessage message, ulong steamId)
{
if (UIManager.IsInitialised)
{
UIManager.ContentPanel.SetButton(message);
}
});
ChatService.RegisterType<NotificationMessage>((Action<NotificationMessage, ulong>)delegate(NotificationMessage message, ulong steamId)
{
if (UIManager.IsInitialised)
{
UIManager.ContentPanel.AddMessage(message);
}
});
ChatService.RegisterType<ConnectedMessage>((Action<ConnectedMessage, ulong>)delegate
{
_connectUiTimer.Stop();
_connectionUpdateTimer.Stop();
UIManager.Reset();
Log((LogLevel)16, "Client initialisation successful");
});
ChatService.RegisterType<DisplayTextMessage>((Action<DisplayTextMessage, ulong>)delegate(DisplayTextMessage message, ulong steamId)
{
if (message.Reset)
{
UIManager.TextPanel.SetText(message.Title, message.Text);
}
else
{
UIManager.TextPanel.AddText(message.Text);
}
});
}
public static void Log(LogLevel level, string message)
{
//IL_0005: 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_0007: 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)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource logger = _logger;
bool flag = default(bool);
BepInExLogInterpolatedStringHandler val = new BepInExLogInterpolatedStringHandler(2, 2, level, ref flag);
if (flag)
{
val.AppendFormatted<DateTime>(DateTime.Now, "u");
val.AppendLiteral(": ");
val.AppendFormatted<string>(message);
}
logger.Log(level, val);
}
private void AddTestUI()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_004d: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_0108: 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)
//IL_0143: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: 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_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: 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_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: 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_024a: Expected O, but got Unknown
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: 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_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Expected O, but got Unknown
UIManager.OnInitialized();
_testTimer1 = new FrameTimer();
_testTimer2 = new FrameTimer();
UIManager.ContentPanel.ChangeProgress(new ProgressSerialisedMessage
{
Group = "Test1",
Label = "TEST BAR",
Colour = "red",
Active = (ActiveState)2,
Change = "",
Header = "1X",
ProgressPercentage = 0.45f,
Tooltip = "Test Progress"
});
UIManager.ContentPanel.ChangeProgress(new ProgressSerialisedMessage
{
Group = "Test",
Label = "TEST BAR 2",
Colour = "@#30123B@#445ACD@#3E9BFE@#18D6CB@#46F783@#A2FC3C@#E1DC37@#FDA531@#EF5A11@#C42502@#7A0402",
Active = (ActiveState)2,
Change = "",
Header = "00",
ProgressPercentage = 0f,
Tooltip = "Test Progress 2",
Flash = false
});
UIManager.ContentPanel.SetButton(new ActionSerialisedMessage
{
Group = "Test",
ID = "TestButton2",
Label = "Test disabled",
Enabled = _buttonEnabled
}, delegate
{
});
UIManager.ContentPanel.SetButton(new ActionSerialisedMessage
{
Group = "Test",
ID = "TestButton",
Label = "Test colour and enable",
Colour = "blue",
Enabled = true
}, delegate
{
//IL_0014: 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_0024: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
_buttonEnabled = !_buttonEnabled;
UIManager.ContentPanel.SetButton(new ActionSerialisedMessage
{
Group = "Test",
ID = "TestButton2",
Label = (_buttonEnabled ? "Test enabled" : "Test disabled"),
Enabled = _buttonEnabled
});
});
_testTimer1.Initialise((Action)delegate
{
//IL_0052: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
float num = 0.0125f;
bool flash = _testValue % 1f > (_testValue + num) % 1f && _testValue % 2f < 1f;
_testValue = (_testValue + num) % 100f;
UIManager.ContentPanel.ChangeProgress(new ProgressSerialisedMessage
{
Group = "Test",
Label = "TEST BAR 2",
Colour = "@#30123B@#445ACD@#3E9BFE@#18D6CB@#46F783@#A2FC3C@#E1DC37@#FDA531@#EF5A11@#C42502@#7A0402",
Active = (ActiveState)2,
Change = "whoop",
Header = $"{(int)_testValue:D2}",
ProgressPercentage = _testValue % 1f,
Tooltip = "Test Progress 2",
Flash = flash
});
}, TimeSpan.FromMilliseconds(50.0), -1).Start();
_testTimer2.Initialise((Action)delegate
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0049: 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_0055: Expected O, but got Unknown
UIManager.ContentPanel.AddMessage(new NotificationMessage
{
ID = "testMessage",
Message = $"{DateTime.Now:u}: This is a test message",
Severity = (LogLevel)4
});
_testValue2++;
if (_testValue2 % 3 == 0)
{
_testValue2 = 0;
UIManager.TextPanel.AddText($"{DateTime.Now:u}: This is a bunch of text to be added to the scrollable panel.\n\n");
}
}, TimeSpan.FromSeconds(3.0), -1).Start();
UIManager.ContentPanel.ChangeProgress(new ProgressSerialisedMessage
{
Group = "Test",
Label = "TEST BAR 3",
Colour = "white",
Active = (ActiveState)2,
Change = "",
Header = "Xx",
ProgressPercentage = 0.65f,
Tooltip = "Test text colour"
});
UIManager.TextPanel.SetText("Test text panel", "This is some multiline text and this text should be able to be scrollable.\n\nThis is some more text\n\n");
UIManager.ContentPanel.SetButton(new ActionSerialisedMessage
{
Group = "Test",
ID = "TestButton3",
Label = "Show test text panel",
Colour = "white",
Enabled = true
}, delegate
{
UIManager.TextPanel.SetText("Test text panel", "Restarting the multiline, scrollable, test text panel.\n\n");
});
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "XPRising.ClientUI";
public const string PLUGIN_NAME = "XPRising.ClientUI";
public const string PLUGIN_VERSION = "0.5.0";
}
}
namespace ClientUI.UniverseLib.UI
{
public static class CoroutineUtility
{
private static ConcurrentBag<IEnumerator> _nextFrameRoutines = new ConcurrentBag<IEnumerator>();
private static ConcurrentBag<IEnumerator> _thisFrameRoutines = new ConcurrentBag<IEnumerator>();
public static void StartCoroutine(IEnumerator coroutine)
{
_nextFrameRoutines.Add(coroutine);
}
public static void TickRoutines()
{
ConcurrentBag<IEnumerator> nextFrameRoutines = _nextFrameRoutines;
ConcurrentBag<IEnumerator> thisFrameRoutines = _thisFrameRoutines;
_thisFrameRoutines = nextFrameRoutines;
_nextFrameRoutines = thisFrameRoutines;
while (!_thisFrameRoutines.IsEmpty)
{
if (_thisFrameRoutines.TryTake(out var result) && result.MoveNext())
{
_nextFrameRoutines.Add(result);
}
}
}
}
public static class Il2CppExtensions
{
public static void AddListener(this UnityEvent action, Action listener)
{
action.AddListener(UnityAction.op_Implicit(listener));
}
public static void AddListener<T>(this UnityEvent<T> action, Action<T> listener)
{
action.AddListener(UnityAction<T>.op_Implicit(listener));
}
public static void RemoveListener(this UnityEvent action, Action listener)
{
action.RemoveListener(UnityAction.op_Implicit(listener));
}
public static void RemoveListener<T>(this UnityEvent<T> action, Action<T> listener)
{
action.RemoveListener(UnityAction<T>.op_Implicit(listener));
}
public static void SetChildControlHeight(this HorizontalOrVerticalLayoutGroup group, bool value)
{
group.childControlHeight = value;
}
public static void SetChildControlWidth(this HorizontalOrVerticalLayoutGroup group, bool value)
{
group.childControlWidth = value;
}
}
public class UIBase
{
internal static readonly int TOP_SORTORDER = 30000;
public string ID { get; }
public GameObject RootObject { get; }
public RectTransform RootRect { get; }
public Canvas Canvas { get; }
public CanvasScaler Scaler { get; }
public Action UpdateMethod { get; }
public PanelManager Panels { get; }
public bool Enabled
{
get
{
if (Object.op_Implicit((Object)(object)RootObject))
{
return RootObject.activeSelf;
}
return false;
}
set
{
UniversalUI.SetUIActive(ID, value);
}
}
public UIBase(string id, Action updateMethod)
{
//IL_005d: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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)
if (string.IsNullOrEmpty(id))
{
throw new ArgumentException("Cannot register a UI with a null or empty id!");
}
if (UniversalUI.registeredUIs.ContainsKey(id))
{
throw new ArgumentException("A UI with the id '" + id + "' is already registered!");
}
ID = id;
UpdateMethod = updateMethod;
RootObject = UIFactory.CreateUIObject(id + "_Root", UniversalUI.CanvasRoot);
RootObject.SetActive(false);
RootRect = RootObject.GetComponent<RectTransform>();
Canvas = RootObject.AddComponent<Canvas>();
Canvas.renderMode = (RenderMode)0;
Canvas.referencePixelsPerUnit = 100f;
Canvas.sortingOrder = TOP_SORTORDER;
Canvas.overrideSorting = true;
Scaler = RootObject.AddComponent<CanvasScaler>();
Scaler.referenceResolution = UniversalUI.CanvasDimensions;
Scaler.uiScaleMode = (ScaleMode)1;
Scaler.screenMatchMode = (ScreenMatchMode)0;
RootObject.AddComponent<GraphicRaycaster>();
RectTransform component = RootObject.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.pivot = new Vector2(0.5f, 0.5f);
Panels = CreatePanelManager();
RootObject.SetActive(true);
UniversalUI.registeredUIs.Add(id, this);
UniversalUI.uiBases.Add(this);
}
protected virtual PanelManager CreatePanelManager()
{
return new PanelManager(this);
}
public void SetOnTop()
{
RootObject.transform.SetAsLastSibling();
foreach (UIBase uiBasis in UniversalUI.uiBases)
{
int num = UniversalUI.CanvasRoot.transform.childCount - ((Transform)uiBasis.RootRect).GetSiblingIndex();
uiBasis.Canvas.sortingOrder = TOP_SORTORDER - num;
}
UniversalUI.uiBases.Sort((UIBase a, UIBase b) => b.RootObject.transform.GetSiblingIndex().CompareTo(a.RootObject.transform.GetSiblingIndex()));
}
internal void Update()
{
try
{
Panels.Update();
UpdateMethod?.Invoke();
}
catch (Exception value)
{
Plugin.Log((LogLevel)4, $"Exception invoking update method for {ID}: {value}");
}
}
}
public static class UIFactory
{
internal static Vector2 largeElementSize = new Vector2(100f, 30f);
internal static Vector2 smallElementSize = new Vector2(25f, 25f);
internal static Vector2 outlineDistance = new Vector2(2f, 2f);
public static GameObject PlayerHUDCanvas { get; set; }
public static TMP_FontAsset Font { get; set; }
public static Material FontMaterial { get; set; }
public static GameObject CreateUIObject(string name, GameObject parent, Vector2 sizeDelta = default(Vector2))
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name)
{
layer = 5,
hideFlags = (HideFlags)61
};
if (Object.op_Implicit((Object)(object)parent))
{
val.transform.SetParent(parent.transform, false);
}
val.AddComponent<RectTransform>().sizeDelta = sizeDelta;
return val;
}
internal static void SetDefaultTextValues(TextMeshProUGUI text)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
((Graphic)text).color = Colour.DefaultText;
((TMP_Text)text).font = Font;
((TMP_Text)text).fontSize = 14f;
}
internal static ColorBlock CreateColourBlock(Color baseColour)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
float num = default(float);
float num2 = default(float);
float num3 = default(float);
Color.RGBToHSV(baseColour, ref num, ref num2, ref num3);
ColorBlock result = default(ColorBlock);
((ColorBlock)(ref result)).normalColor = baseColour;
((ColorBlock)(ref result)).highlightedColor = Color.HSVToRGB(num, num2, num3 * 1.2f);
((ColorBlock)(ref result)).selectedColor = Color.HSVToRGB(num, num2, num3 * 1.1f);
((ColorBlock)(ref result)).pressedColor = Color.HSVToRGB(num, num2, num3 * 0.7f);
((ColorBlock)(ref result)).disabledColor = Color.HSVToRGB(num, num2, num3 * 0.4f);
((ColorBlock)(ref result)).colorMultiplier = 1f;
return result;
}
internal static void SetDefaultSelectableValues(Selectable selectable)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
Navigation navigation = selectable.navigation;
navigation.mode = (Mode)4;
selectable.navigation = navigation;
selectable.colors = CreateColourBlock(new Color(0.2f, 0.2f, 0.2f));
}
public static LayoutElement SetLayoutElement(GameObject gameObject, int? minWidth = null, int? minHeight = null, int? flexibleWidth = null, int? flexibleHeight = null, int? preferredWidth = null, int? preferredHeight = null, bool? ignoreLayout = null)
{
LayoutElement val = gameObject.GetComponent<LayoutElement>();
if (!Object.op_Implicit((Object)(object)val))
{
val = gameObject.AddComponent<LayoutElement>();
}
if (minWidth.HasValue)
{
val.minWidth = minWidth.Value;
}
if (minHeight.HasValue)
{
val.minHeight = minHeight.Value;
}
if (flexibleWidth.HasValue)
{
val.flexibleWidth = flexibleWidth.Value;
}
if (flexibleHeight.HasValue)
{
val.flexibleHeight = flexibleHeight.Value;
}
if (preferredWidth.HasValue)
{
val.preferredWidth = preferredWidth.Value;
}
if (preferredHeight.HasValue)
{
val.preferredHeight = preferredHeight.Value;
}
if (ignoreLayout.HasValue)
{
val.ignoreLayout = ignoreLayout.Value;
}
return val;
}
public static T SetLayoutGroup<T>(GameObject gameObject, bool? forceWidth = null, bool? forceHeight = null, bool? childControlWidth = null, bool? childControlHeight = null, int? spacing = null, int? padTop = null, int? padBottom = null, int? padLeft = null, int? padRight = null, TextAnchor? childAlignment = null) where T : HorizontalOrVerticalLayoutGroup
{
T val = gameObject.GetComponent<T>();
if (!Object.op_Implicit((Object)(object)val))
{
val = gameObject.AddComponent<T>();
}
return SetLayoutGroup(val, forceWidth, forceHeight, childControlWidth, childControlHeight, spacing, padTop, padBottom, padLeft, padRight, childAlignment);
}
public static T SetLayoutGroup<T>(T group, bool? forceWidth = null, bool? forceHeight = null, bool? childControlWidth = null, bool? childControlHeight = null, int? spacing = null, int? padTop = null, int? padBottom = null, int? padLeft = null, int? padRight = null, TextAnchor? childAlignment = null) where T : HorizontalOrVerticalLayoutGroup
{
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
if (forceWidth.HasValue)
{
((HorizontalOrVerticalLayoutGroup)group).childForceExpandWidth = forceWidth.Value;
}
if (forceHeight.HasValue)
{
((HorizontalOrVerticalLayoutGroup)group).childForceExpandHeight = forceHeight.Value;
}
if (childControlWidth.HasValue)
{
((HorizontalOrVerticalLayoutGroup)group).childControlWidth = childControlWidth.Value;
}
if (childControlHeight.HasValue)
{
((HorizontalOrVerticalLayoutGroup)group).childControlHeight = childControlHeight.Value;
}
if (spacing.HasValue)
{
((HorizontalOrVerticalLayoutGroup)group).spacing = spacing.Value;
}
if (padTop.HasValue)
{
((LayoutGroup)(object)group).padding.top = padTop.Value;
}
if (padBottom.HasValue)
{
((LayoutGroup)(object)group).padding.bottom = padBottom.Value;
}
if (padLeft.HasValue)
{
((LayoutGroup)(object)group).padding.left = padLeft.Value;
}
if (padRight.HasValue)
{
((LayoutGroup)(object)group).padding.right = padRight.Value;
}
if (childAlignment.HasValue)
{
((LayoutGroup)(object)group).childAlignment = childAlignment.Value;
}
return group;
}
public static GameObject CreatePanel(string name, GameObject parent, out GameObject contentHolder, Color? bgColor = null)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.anchoredPosition = Vector2.zero;
component.sizeDelta = Vector2.zero;
contentHolder = CreateUIObject("Content", val);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(contentHolder, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
Image obj = contentHolder.AddComponent<Image>();
obj.type = (Type)3;
((Graphic)obj).color = (Color)(((??)bgColor) ?? Colour.DarkBackground);
Outline obj2 = contentHolder.AddComponent<Outline>();
((Shadow)obj2).effectColor = Colour.DarkBackground;
((Shadow)obj2).effectDistance = outlineDistance;
return val;
}
public static GameObject CreateVerticalGroup(GameObject parent, string name, bool forceWidth, bool forceHeight, bool childControlWidth, bool childControlHeight, int spacing = 0, Vector4 padding = default(Vector4), Color? bgColor = null, TextAnchor? childAlignment = null)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = CreateUIObject(name, parent);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(obj, (bool?)forceWidth, (bool?)forceHeight, (bool?)childControlWidth, (bool?)childControlHeight, (int?)spacing, (int?)(int)padding.x, (int?)(int)padding.y, (int?)(int)padding.z, (int?)(int)padding.w, childAlignment);
((Graphic)obj.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Colour.PanelBackground);
return obj;
}
public static GameObject CreateHorizontalGroup(GameObject parent, string name, bool forceExpandWidth, bool forceExpandHeight, bool childControlWidth, bool childControlHeight, int spacing = 0, Vector4 padding = default(Vector4), Color? bgColor = null, TextAnchor? childAlignment = null)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = CreateUIObject(name, parent);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(obj, (bool?)forceExpandWidth, (bool?)forceExpandHeight, (bool?)childControlWidth, (bool?)childControlHeight, (int?)spacing, (int?)(int)padding.x, (int?)(int)padding.y, (int?)(int)padding.z, (int?)(int)padding.w, childAlignment);
((Graphic)obj.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Colour.PanelBackground);
return obj;
}
public static GameObject CreateGridGroup(GameObject parent, string name, Vector2 cellSize, Vector2 spacing, Color? bgColor = null)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = CreateUIObject(name, parent);
GridLayoutGroup obj2 = obj.AddComponent<GridLayoutGroup>();
((LayoutGroup)obj2).childAlignment = (TextAnchor)0;
obj2.cellSize = cellSize;
obj2.spacing = spacing;
((Graphic)obj.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Colour.PanelBackground);
return obj;
}
public static TextMeshProUGUI CreateLabel(GameObject parent, string name, string defaultText, TextAlignmentOptions alignment = 514, Color? color = null, int fontSize = 14)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI val = CreateUIObject(name, parent).AddComponent<TextMeshProUGUI>();
((Graphic)val).color = (Color)(((??)color) ?? Colour.DefaultText);
((TMP_Text)val).font = Font;
((TMP_Text)val).text = defaultText;
((TMP_Text)val).alignment = alignment;
((TMP_Text)val).fontSize = fontSize;
try
{
((TMP_Text)val).outlineWidth = 0.15f;
((TMP_Text)val).outlineColor = Color32.op_Implicit(Color.black);
}
catch (Exception)
{
}
return val;
}
public static ButtonRef CreateButton(GameObject parent, string name, string text, Color? normalColor = null)
{
//IL_0014: 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)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
Color baseColour = (Color)(((??)normalColor) ?? Colour.SliderFill);
ButtonRef buttonRef = CreateButton(parent, name, text, default(ColorBlock));
((Selectable)buttonRef.Component).colors = CreateColourBlock(baseColour);
return buttonRef;
}
public static ButtonRef CreateButton(GameObject parent, string name, string text, ColorBlock colors)
{
//IL_0002: 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_001b: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent, smallElementSize);
GameObject val2 = CreateUIObject("Text", val);
Image obj = val.AddComponent<Image>();
obj.type = (Type)1;
((Graphic)obj).color = Color.white;
Outline obj2 = val.AddComponent<Outline>();
((Shadow)obj2).effectColor = Colour.DarkBackground;
((Shadow)obj2).effectDistance = outlineDistance;
Button obj3 = val.AddComponent<Button>();
SetDefaultSelectableValues((Selectable)(object)obj3);
((ColorBlock)(ref colors)).colorMultiplier = 1f;
((Selectable)obj3).colors = colors;
TextMeshProUGUI obj4 = val2.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj4).text = text;
SetDefaultTextValues(obj4);
((TMP_Text)obj4).alignment = (TextAlignmentOptions)514;
RectTransform component = val2.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
SetButtonDeselectListener(obj3);
return new ButtonRef(obj3);
}
internal static void SetButtonDeselectListener(Button button)
{
((UnityEvent)(object)button.onClick).AddListener(delegate
{
((Selectable)button).OnDeselect((BaseEventData)null);
});
}
public static GameObject CreateSlider(GameObject parent, string name, out Slider slider)
{
//IL_0002: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_005c: 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_0072: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: 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_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent, smallElementSize);
GameObject obj = CreateUIObject("Background", val);
GameObject val2 = CreateUIObject("Fill Area", val);
GameObject val3 = CreateUIObject("Fill", val2);
GameObject val4 = CreateUIObject("Handle Slide Area", val);
GameObject val5 = CreateUIObject("Handle", val4);
Image obj2 = obj.AddComponent<Image>();
obj2.type = (Type)1;
((Graphic)obj2).color = Colour.PanelBackground;
RectTransform component = obj.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0.25f);
component.anchorMax = new Vector2(1f, 0.75f);
component.sizeDelta = new Vector2(0f, 0f);
RectTransform component2 = val2.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 0.25f);
component2.anchorMax = new Vector2(1f, 0.75f);
component2.anchoredPosition = new Vector2(-5f, 0f);
component2.sizeDelta = new Vector2(-20f, 0f);
Image obj3 = val3.AddComponent<Image>();
obj3.type = (Type)1;
((Graphic)obj3).color = Colour.SliderFill;
val3.GetComponent<RectTransform>().sizeDelta = new Vector2(10f, 0f);
RectTransform component3 = val4.GetComponent<RectTransform>();
component3.sizeDelta = new Vector2(-20f, 0f);
component3.anchorMin = new Vector2(0f, 0f);
component3.anchorMax = new Vector2(1f, 1f);
Image val6 = val5.AddComponent<Image>();
((Graphic)val6).color = Colour.SliderHandle;
Outline obj4 = val5.AddComponent<Outline>();
((Shadow)obj4).effectColor = Colour.DarkBackground;
((Shadow)obj4).effectDistance = outlineDistance;
val5.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f);
slider = val.AddComponent<Slider>();
slider.fillRect = val3.GetComponent<RectTransform>();
slider.handleRect = val5.GetComponent<RectTransform>();
((Selectable)slider).targetGraphic = (Graphic)(object)val6;
slider.direction = (Direction)0;
((Selectable)slider).colors = CreateColourBlock(new Color(0.4f, 0.4f, 0.4f));
return val;
}
public static GameObject CreateScrollbar(GameObject parent, string name, out Scrollbar scrollbar)
{
//IL_0002: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
//IL_005e: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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)
GameObject val = CreateUIObject(name, parent, smallElementSize);
GameObject val2 = CreateUIObject("Sliding Area", val);
GameObject obj = CreateUIObject("Handle", val2);
Image obj2 = val.AddComponent<Image>();
obj2.type = (Type)1;
((Graphic)obj2).color = Colour.DarkBackground;
Image val3 = obj.AddComponent<Image>();
val3.type = (Type)1;
((Graphic)val3).color = Colour.SliderHandle;
RectTransform component = val2.GetComponent<RectTransform>();
component.sizeDelta = new Vector2(-20f, -20f);
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
RectTransform component2 = obj.GetComponent<RectTransform>();
component2.sizeDelta = new Vector2(20f, 20f);
scrollbar = val.AddComponent<Scrollbar>();
scrollbar.handleRect = component2;
((Selectable)scrollbar).targetGraphic = (Graphic)(object)val3;
SetDefaultSelectableValues((Selectable)(object)scrollbar);
return val;
}
public static GameObject CreateToggle(GameObject parent, string name, out Toggle toggle, out TextMeshProUGUI text, Color bgColor = default(Color), int checkWidth = 20, int checkHeight = 20)
{
//IL_0008: 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_009b: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: 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_018c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent, smallElementSize);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)5, (int?)0, (int?)0, (int?)0, (int?)0, (TextAnchor?)(TextAnchor)3);
toggle = val.AddComponent<Toggle>();
toggle.isOn = true;
SetDefaultSelectableValues((Selectable)(object)toggle);
Toggle t2 = toggle;
((UnityEvent<bool>)(object)toggle.onValueChanged).AddListener<bool>(delegate
{
((Selectable)t2).OnDeselect((BaseEventData)null);
});
GameObject val2 = CreateUIObject("Background", val);
Image val3 = val2.AddComponent<Image>();
((Graphic)val3).color = ((bgColor == default(Color)) ? Colour.DarkBackground : bgColor);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val2, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)null);
SetLayoutElement(val2, checkWidth, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0);
Image val4 = CreateUIObject("Checkmark", val2).AddComponent<Image>();
((Graphic)val4).color = Colour.CheckMark;
GameObject val5 = CreateUIObject("Label", val);
text = val5.AddComponent<TextMeshProUGUI>();
((TMP_Text)text).text = "";
((TMP_Text)text).alignment = (TextAlignmentOptions)4097;
SetDefaultTextValues(text);
SetLayoutElement(val5, 0, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0);
toggle.graphic = (Graphic)(object)val4;
((Selectable)toggle).targetGraphic = (Graphic)(object)val3;
return val;
}
public static InputFieldRef CreateInputField(GameObject parent, string name, string placeHolderText)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_00c8: 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_00f7: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: 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_01db: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent);
Image val2 = val.AddComponent<Image>();
val2.type = (Type)1;
((Graphic)val2).color = Colour.DarkBackground;
TMP_InputField obj = val.AddComponent<TMP_InputField>();
Navigation navigation = ((Selectable)obj).navigation;
navigation.mode = (Mode)0;
((Selectable)obj).navigation = navigation;
obj.lineType = (LineType)0;
((Selectable)obj).interactable = true;
((Selectable)obj).transition = (Transition)1;
((Selectable)obj).targetGraphic = (Graphic)(object)val2;
((Selectable)obj).colors = CreateColourBlock(Color.white);
GameObject val3 = CreateUIObject("TextArea", val);
val3.AddComponent<RectMask2D>();
RectTransform component = val3.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
GameObject obj2 = CreateUIObject("Placeholder", val3);
TextMeshProUGUI val4 = obj2.AddComponent<TextMeshProUGUI>();
SetDefaultTextValues(val4);
((TMP_Text)val4).text = placeHolderText ?? "...";
((Graphic)val4).color = Colour.PlaceHolderText;
((TMP_Text)val4).enableWordWrapping = true;
((TMP_Text)val4).alignment = (TextAlignmentOptions)4097;
((TMP_Text)val4).fontSize = 14f;
RectTransform component2 = obj2.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.offsetMin = Vector2.zero;
component2.offsetMax = Vector2.zero;
obj.placeholder = (Graphic)(object)val4;
GameObject obj3 = CreateUIObject("Text", val3);
TextMeshProUGUI val5 = obj3.AddComponent<TextMeshProUGUI>();
SetDefaultTextValues(val5);
((TMP_Text)val5).text = "";
((Graphic)val5).color = Colour.DefaultText;
((TMP_Text)val5).enableWordWrapping = true;
((TMP_Text)val5).alignment = (TextAlignmentOptions)4097;
((TMP_Text)val5).fontSize = 14f;
RectTransform component3 = obj3.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.offsetMin = Vector2.zero;
component3.offsetMax = Vector2.zero;
obj.textComponent = (TMP_Text)(object)val5;
obj.characterLimit = 16000;
return new InputFieldRef(obj);
}
public static GameObject CreateDropdown(GameObject parent, string name, out TMP_Dropdown dropdown, string defaultItemText, int itemFontSize, Action<int> onValueChanged, string[] defaultOptions = null)
{
//IL_0008: 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_0021: 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_0036: 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)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_00a1: 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_00b9: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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)
//IL_010b: 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_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: 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_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: 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_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: 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_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_049c: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_053c: Unknown result type (might be due to invalid IL or missing references)
//IL_0550: Unknown result type (might be due to invalid IL or missing references)
//IL_0562: Unknown result type (might be due to invalid IL or missing references)
//IL_056d: Unknown result type (might be due to invalid IL or missing references)
//IL_0577: Unknown result type (might be due to invalid IL or missing references)
//IL_0589: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_060c: Expected O, but got Unknown
GameObject val = CreateUIObject(name, parent, largeElementSize);
GameObject obj = CreateUIObject("Label", val);
GameObject obj2 = CreateUIObject("Arrow", val);
GameObject val2 = CreateUIObject("Template", val);
GameObject val3 = CreateUIObject("Viewport", val2);
GameObject val4 = CreateUIObject("Content", val3);
GameObject val5 = CreateUIObject("Item", val4);
GameObject val6 = CreateUIObject("Item Background", val5);
CreateUIObject("Item Checkmark", val5);
GameObject val7 = CreateUIObject("Item Label", val5);
Scrollbar scrollbar;
GameObject obj3 = CreateScrollbar(val2, "DropdownScroll", out scrollbar);
scrollbar.SetDirection((Direction)2, true);
((Selectable)scrollbar).colors = CreateColourBlock(new Color(0.45f, 0.45f, 0.45f));
RectTransform component = obj3.GetComponent<RectTransform>();
component.anchorMin = Vector2.right;
component.anchorMax = Vector2.one;
component.pivot = Vector2.one;
component.sizeDelta = new Vector2(component.sizeDelta.x, 0f);
TextMeshProUGUI val8 = val7.AddComponent<TextMeshProUGUI>();
SetDefaultTextValues(val8);
((TMP_Text)val8).alignment = (TextAlignmentOptions)4097;
((TMP_Text)val8).text = defaultItemText;
((TMP_Text)val8).fontSize = itemFontSize;
TextMeshProUGUI obj4 = obj2.AddComponent<TextMeshProUGUI>();
SetDefaultTextValues(obj4);
((TMP_Text)obj4).text = "▼";
RectTransform component2 = obj2.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(1f, 0.5f);
component2.anchorMax = new Vector2(1f, 0.5f);
component2.sizeDelta = new Vector2(20f, 20f);
component2.anchoredPosition = new Vector2(-15f, 0f);
Image val9 = val6.AddComponent<Image>();
((Graphic)val9).color = Colour.SliderFill;
Toggle itemToggle = val5.AddComponent<Toggle>();
((Selectable)itemToggle).targetGraphic = (Graphic)(object)val9;
itemToggle.isOn = true;
ColorBlock val10 = default(ColorBlock);
((ColorBlock)(ref val10)).normalColor = new Color(0.35f, 0.35f, 0.35f, 1f);
((ColorBlock)(ref val10)).highlightedColor = new Color(0.25f, 0.55f, 0.25f, 1f);
((ColorBlock)(ref val10)).colorMultiplier = 1f;
ColorBlock colors = val10;
((Selectable)itemToggle).colors = colors;
((UnityEvent<bool>)(object)itemToggle.onValueChanged).AddListener<bool>(delegate
{
((Selectable)itemToggle).OnDeselect((BaseEventData)null);
});
Image obj5 = val2.AddComponent<Image>();
obj5.type = (Type)1;
((Graphic)obj5).color = Color.black;
ScrollRect obj6 = val2.AddComponent<ScrollRect>();
obj6.scrollSensitivity = 35f;
obj6.content = val4.GetComponent<RectTransform>();
obj6.viewport = val3.GetComponent<RectTransform>();
obj6.horizontal = false;
obj6.movementType = (MovementType)2;
obj6.verticalScrollbar = scrollbar;
obj6.verticalScrollbarVisibility = (ScrollbarVisibility)2;
obj6.verticalScrollbarSpacing = -3f;
val3.AddComponent<Mask>().showMaskGraphic = false;
val3.AddComponent<Image>().type = (Type)1;
TextMeshProUGUI val11 = obj.AddComponent<TextMeshProUGUI>();
SetDefaultTextValues(val11);
((TMP_Text)val11).alignment = (TextAlignmentOptions)4097;
Image val12 = val.AddComponent<Image>();
((Graphic)val12).color = Colour.DarkBackground;
val12.type = (Type)1;
dropdown = val.AddComponent<TMP_Dropdown>();
((Selectable)dropdown).targetGraphic = (Graphic)(object)val12;
dropdown.template = val2.GetComponent<RectTransform>();
dropdown.captionText = (TMP_Text)(object)val11;
dropdown.itemText = (TMP_Text)(object)val8;
dropdown.RefreshShownValue();
RectTransform component3 = obj.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.offsetMin = new Vector2(10f, 2f);
component3.offsetMax = new Vector2(-28f, -2f);
RectTransform component4 = val2.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(0f, 0f);
component4.anchorMax = new Vector2(1f, 0f);
component4.pivot = new Vector2(0.5f, 1f);
component4.anchoredPosition = new Vector2(0f, 2f);
component4.sizeDelta = new Vector2(0f, 150f);
RectTransform component5 = val3.GetComponent<RectTransform>();
component5.anchorMin = new Vector2(0f, 0f);
component5.anchorMax = new Vector2(1f, 1f);
component5.sizeDelta = new Vector2(-18f, 0f);
component5.pivot = new Vector2(0f, 1f);
RectTransform component6 = val4.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0f, 1f);
component6.anchorMax = new Vector2(1f, 1f);
component6.pivot = new Vector2(0.5f, 1f);
component6.anchoredPosition = new Vector2(0f, 0f);
component6.sizeDelta = new Vector2(0f, 28f);
RectTransform component7 = val5.GetComponent<RectTransform>();
component7.anchorMin = new Vector2(0f, 0.5f);
component7.anchorMax = new Vector2(1f, 0.5f);
component7.sizeDelta = new Vector2(0f, 25f);
RectTransform component8 = val6.GetComponent<RectTransform>();
component8.anchorMin = Vector2.zero;
component8.anchorMax = Vector2.one;
component8.sizeDelta = Vector2.zero;
RectTransform component9 = val7.GetComponent<RectTransform>();
component9.anchorMin = Vector2.zero;
component9.anchorMax = Vector2.one;
component9.offsetMin = new Vector2(20f, 1f);
component9.offsetMax = new Vector2(-10f, -2f);
val2.SetActive(false);
if (onValueChanged != null)
{
((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener(UnityAction<int>.op_Implicit(onValueChanged));
}
if (defaultOptions != null)
{
foreach (string text in defaultOptions)
{
dropdown.options.Add(new OptionData(text));
}
}
return val;
}
public static ScrollPool<T> CreateScrollPool<T>(GameObject parent, string name, out GameObject uiRoot, out GameObject content, Color? bgColor = null) where T : ICell
{
//IL_000c: 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_002a: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: 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_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent, new Vector2(1f, 1f));
((Graphic)val.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Colour.DarkBackground);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)false, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
int? flexibleHeight = 9999;
int? flexibleWidth = 9999;
SetLayoutElement(val, null, null, flexibleWidth, flexibleHeight);
GameObject val2 = CreateUIObject("Viewport", val);
flexibleWidth = 9999;
flexibleHeight = 9999;
SetLayoutElement(val2, null, null, flexibleWidth, flexibleHeight);
RectTransform component = val2.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.pivot = new Vector2(0f, 1f);
component.sizeDelta = new Vector2(0f, 0f);
component.offsetMax = new Vector2(-10f, 0f);
val2.AddComponent<RectMask2D>();
((Graphic)val2.AddComponent<Image>()).color = Colour.ViewportBackground;
val2.AddComponent<Mask>();
content = CreateUIObject("Content", val2);
RectTransform component2 = content.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.pivot = new Vector2(0.5f, 1f);
component2.sizeDelta = new Vector2(0f, 0f);
component2.offsetMax = new Vector2(0f, 0f);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(content, (bool?)true, (bool?)false, (bool?)true, (bool?)true, (int?)0, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)(TextAnchor)1);
content.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
ScrollRect obj = val.AddComponent<ScrollRect>();
obj.movementType = (MovementType)2;
obj.inertia = true;
obj.elasticity = 0.125f;
obj.scrollSensitivity = 25f;
obj.horizontal = false;
obj.vertical = true;
obj.viewport = component;
obj.content = component2;
GameObject obj2 = CreateVerticalGroup(val, "SliderContainer", forceWidth: false, forceHeight: false, childControlWidth: true, childControlHeight: true);
int? minWidth = 25;
flexibleHeight = 0;
flexibleWidth = 9999;
SetLayoutElement(obj2, minWidth, null, flexibleHeight, flexibleWidth);
obj2.AddComponent<Mask>().showMaskGraphic = false;
CreateSliderScrollbar(obj2, out var slider);
ColorBlock val3 = default(ColorBlock);
((ColorBlock)(ref val3)).disabledColor = new Color(0.1f, 0.1f, 0.1f);
((ColorBlock)(ref val3)).colorMultiplier = 1f;
ColorBlock colors = val3;
((Selectable)slider).colors = colors;
uiRoot = val;
return new ScrollPool<T>(obj);
}
public static GameObject CreateSliderScrollbar(GameObject parent, out Slider slider)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_003f: 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)
//IL_0053: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject("SliderScrollbar", parent, smallElementSize);
((Graphic)val.AddComponent<Image>()).color = Colour.DarkBackground;
GameObject val2 = CreateUIObject("Handle Slide Area", val);
GameObject obj = CreateUIObject("Handle", val2);
RectTransform component = val2.GetComponent<RectTransform>();
component.anchorMin = Vector2.op_Implicit(Vector3.zero);
component.anchorMax = Vector2.op_Implicit(Vector3.one);
component.pivot = Vector2.op_Implicit(new Vector3(0.5f, 0.5f));
Image val3 = obj.AddComponent<Image>();
((Graphic)val3).color = Colour.SliderHandle;
RectTransform component2 = obj.GetComponent<RectTransform>();
component2.pivot = new Vector2(0.5f, 0.5f);
int? minWidth = 21;
int? flexibleWidth = 0;
SetLayoutElement(obj, minWidth, null, flexibleWidth);
LayoutElement obj2 = val.AddComponent<LayoutElement>();
obj2.minWidth = 25f;
obj2.flexibleWidth = 0f;
obj2.minHeight = 30f;
obj2.flexibleHeight = 9999f;
slider = val.AddComponent<Slider>();
slider.handleRect = component2;
slider.fillRect = component2;
((Selectable)slider).targetGraphic = (Graphic)(object)val3;
slider.direction = (Direction)3;
int? minWidth2 = 25;
flexibleWidth = 0;
int? flexibleHeight = 9999;
SetLayoutElement(val, minWidth2, null, flexibleWidth, flexibleHeight);
((Selectable)slider).colors = CreateColourBlock(new Color(0.4f, 0.4f, 0.4f));
return val;
}
public static GameObject CreateScrollView(GameObject parent, string name, out GameObject content, out AutoSliderScrollbar autoScrollbar, Color color = default(Color))
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0023: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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)
//IL_0132: 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_01f7: 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_0217: 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_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateUIObject(name, parent);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
Image obj = val.AddComponent<Image>();
obj.type = (Type)3;
((Graphic)obj).color = ((color == default(Color)) ? Colour.DarkBackground : color);
int? flexibleHeight = 9999;
int? flexibleWidth = 9999;
SetLayoutElement(val, null, null, flexibleWidth, flexibleHeight);
GameObject val2 = CreateUIObject("Viewport", val);
RectTransform component2 = val2.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.pivot = new Vector2(0f, 1f);
component2.offsetMax = new Vector2(-28f, 0f);
((Graphic)val2.AddComponent<Image>()).color = Colour.ViewportBackground;
val2.AddComponent<Mask>().showMaskGraphic = false;
content = CreateUIObject("Content", val2);
GameObject gameObject = content;
bool? forceWidth = true;
bool? forceHeight = false;
bool? childControlWidth = true;
bool? childControlHeight = true;
TextAnchor? childAlignment = (TextAnchor)0;
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(gameObject, forceWidth, forceHeight, childControlWidth, childControlHeight, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, childAlignment);
GameObject gameObject2 = content;
flexibleWidth = 9999;
SetLayoutElement(gameObject2, null, null, null, flexibleWidth);
RectTransform component3 = content.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.pivot = new Vector2(0f, 1f);
content.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
GameObject val3 = CreateUIObject("AutoSliderScrollbar", val);
RectTransform component4 = val3.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(1f, 0f);
component4.anchorMax = Vector2.one;
component4.offsetMin = new Vector2(-25f, 0f);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val3, (bool?)false, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null);
((Graphic)val3.AddComponent<Image>()).color = Colour.PanelBackground;
val3.AddComponent<Mask>().showMaskGraphic = false;
Scrollbar scrollbar;
GameObject val4 = CreateScrollbar(val3, "HiddenScrollviewScroller", out scrollbar);
scrollbar.SetDirection((Direction)2, true);
for (int i = 0; i < val4.transform.childCount; i++)
{
((Component)val4.transform.GetChild(i)).gameObject.SetActive(false);
}
CreateSliderScrollbar(val3, out var slider);
autoScrollbar = new AutoSliderScrollbar(scrollbar, slider, component3, component2);
ScrollRect obj2 = val.AddComponent<ScrollRect>();
obj2.horizontal = false;
obj2.vertical = true;
obj2.verticalScrollbar = scrollbar;
obj2.movementType = (MovementType)2;
obj2.scrollSensitivity = 35f;
obj2.horizontalScrollbarVisibility = (ScrollbarVisibility)2;
obj2.verticalScrollbarVisibility = (ScrollbarVisibility)0;
obj2.viewport = component2;
obj2.content = component3;
return val;
}
}
public static class UniversalUI
{
[CompilerGenerated]
private static class <>O
{
public static GameFrameUpdateEventHandler <0>__Update;
}
internal static readonly Dictionary<string, UIBase> registeredUIs = new Dictionary<string, UIBase>();
internal static readonly List<UIBase> uiBases = new List<UIBase>();
public const int MAX_INPUTFIELD_CHARS = 16000;
public static Vector2 CanvasDimensions = new Vector2(1920f, 1080f);
public static bool Initializing { get; internal set; } = true;
public static bool AnyUIShowing => registeredUIs.Any((KeyValuePair<string, UIBase> it) => it.Value.Enabled);
public static GameObject CanvasRoot { get; private set; }
public static GameObject PoolHolder { get; private set; }
public static Font DefaultFont { get; private set; }
public static UIBase RegisterUI(string id, Action updateMethod)
{
return new UIBase(id, updateMethod);
}
public static T RegisterUI<T>(string id, Action updateMethod) where T : UIBase
{
return (T)Activator.CreateInstance(typeof(T), id, updateMethod);
}
public static void SetUIActive(string id, bool active)
{
if (registeredUIs.TryGetValue(id, out var value))
{
value.RootObject.SetActive(active);
if (active)
{
value.SetOnTop();
}
else if (value != PanelManager.resizeCursorUIBase)
{
PanelManager.ForceEndResize();
}
return;
}
throw new ArgumentException("There is no UI registered with the id '" + id + "'");
}
internal static void Init()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_0048: 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_0053: Expected O, but got Unknown
CreateRootCanvas();
PoolHolder = new GameObject("PoolHolder");
PoolHolder.transform.parent = CanvasRoot.transform;
PoolHolder.SetActive(false);
object obj = <>O.<0>__Update;
if (obj == null)
{
GameFrameUpdateEventHandler val = Update;
<>O.<0>__Update = val;
obj = (object)val;
}
GameFrame.OnUpdate += (GameFrameUpdateEventHandler)obj;
Initializing = false;
}
internal static void Update()
{
if (Initializing)
{
return;
}
CoroutineUtility.TickRoutines();
if (!AnyUIShowing || !Object.op_Implicit((Object)(object)CanvasRoot))
{
return;
}
InputManager.Update();
InputFieldRef.UpdateInstances();
UIBehaviourModel.UpdateInstances();
PanelManager.focusHandledThisFrame = false;
PanelManager.draggerHandledThisFrame = false;
for (int i = 0; i < uiBases.Count; i++)
{
UIBase uIBase = uiBases[i];
if (uIBase.Enabled)
{
uIBase.Update();
}
}
}
private static void CreateRootCanvas()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_001f: 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_0050: Unknown result type (might be due to invalid IL or missing references)
CanvasRoot = new GameObject("UniverseLibCanvas");
Object.DontDestroyOnLoad((Object)(object)CanvasRoot);
GameObject canvasRoot = CanvasRoot;
((Object)canvasRoot).hideFlags = (HideFlags)(((Object)canvasRoot).hideFlags | 0x3D);
CanvasRoot.layer = 5;
CanvasRoot.transform.position = new Vector3(0f, 0f, 1f);
CanvasRoot.SetActive(false);
CanvasRoot.SetActive(true);
}
}
}
namespace ClientUI.UniverseLib.UI.Widgets
{
public class AutoSliderScrollbar : UIBehaviourModel
{
private float lastAnchorPosition;
private float lastContentHeight;
private float lastViewportHeight;
private bool _refreshWanted;
public override GameObject UIRoot
{
get
{
if (Object.op_Implicit((Object)(object)Slider))
{
return ((Component)Slider).gameObject;
}
return null;
}
}
public Slider Slider { get; }
public Scrollbar Scrollbar { get; }
public RectTransform ContentRect { get; }
public RectTransform ViewportRect { get; }
public AutoSliderScrollbar(Scrollbar scrollbar, Slider slider, RectTransform contentRect, RectTransform viewportRect)
{
Scrollbar = scrollbar;
Slider = slider;
ContentRect = contentRect;
ViewportRect = viewportRect;
((UnityEvent<float>)(object)Scrollbar.onValueChanged).AddListener<float>(OnScrollbarValueChanged);
((UnityEvent<float>)(object)Slider.onValueChanged).AddListener<float>(OnSliderValueChanged);
Slider.Set(0f, false);
UpdateSliderHandle();
}
public override void Update()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_00a6: 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_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_00d2: 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)
if (base.Enabled)
{
_refreshWanted = false;
if ((double)Math.Abs(((Transform)ContentRect).localPosition.y - lastAnchorPosition) > 0.0001)
{
lastAnchorPosition = ((Transform)ContentRect).localPosition.y;
_refreshWanted = true;
}
Rect rect = ContentRect.rect;
if ((double)Math.Abs(((Rect)(ref rect)).height - lastContentHeight) > 0.0001)
{
rect = ContentRect.rect;
lastContentHeight = ((Rect)(ref rect)).height;
_refreshWanted = true;
}
rect = ViewportRect.rect;
if ((double)Math.Abs(((Rect)(ref rect)).height - lastViewportHeight) > 0.0001)
{
rect = ViewportRect.rect;
lastViewportHeight = ((Rect)(ref rect)).height;
_refreshWanted = true;
}
if (_refreshWanted)
{
UpdateSliderHandle();
}
}
}
public void UpdateSliderHandle()
{
//IL_0006: 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)
//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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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_00b8: 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_0113: 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)
Rect rect = ContentRect.rect;
float height = ((Rect)(ref rect)).height;
rect = ViewportRect.rect;
float height2 = ((Rect)(ref rect)).height;
if (height <= height2)
{
Slider.handleRect.SetSizeWithCurrentAnchors((Axis)1, 0f);
Slider.value = 0f;
((Selectable)Slider).interactable = false;
return;
}
float val = height2 * Math.Min(1f, height2 / height);
val = Math.Max(15f, val);
RectTransform handleContainerRect = Slider.m_HandleContainerRect;
handleContainerRect.offsetMax = new Vector2(handleContainerRect.offsetMax.x, 0f - val * 0.5f);
handleContainerRect.offsetMin = new Vector2(handleContainerRect.offsetMin.x, val * 0.5f);
Slider.handleRect.SetSizeWithCurrentAnchors((Axis)1, val);
((Selectable)Slider).interactable = !Mathf.Approximately(val, height2);
float num = 0f;
if (height > 0f)
{
decimal num2 = (decimal)((Transform)ContentRect).localPosition.y;
rect = ViewportRect.rect;
num = (float)(num2 / (decimal)(height - ((Rect)(ref rect)).height));
}
Slider.Set(num, true);
}
public void OnScrollbarValueChanged(float value)
{
value = 1f - value;
if ((double)Math.Abs(Slider.value - value) > 0.0001)
{
Slider.Set(value, true);
}
}
public void OnSliderValueChanged(float value)
{
value = 1f - value;
if ((double)Math.Abs(Scrollbar.value - value) > 0.0001)
{
Scrollbar.Set(value, true);
}
}
}
}
namespace ClientUI.UniverseLib.UI.Widgets.ScrollView
{
public class DataHeightCache<T> where T : ICell
{
private readonly List<DataViewInfo> heightCache = new List<DataViewInfo>();
private float totalHeight;
private float? m_defaultHeight;
private readonly List<int> rangeCache = new List<int>();
private ScrollPool<T> ScrollPool { get; }
public DataViewInfo this[int index]
{
get
{
return heightCache[index];
}
set
{
SetIndex(index, value);
}
}
public int Count => heightCache.Count;
public float TotalHeight => totalHeight;
public float DefaultHeight
{
get
{
float? defaultHeight = m_defaultHeight;
if (!defaultHeight.HasValue)
{
float? num = (m_defaultHeight = ScrollPool.PrototypeHeight);
return num.Value;
}
return defaultHeight.GetValueOrDefault();
}
}
public DataHeightCache(ScrollPool<T> scrollPool)
{
ScrollPool = scrollPool;
}
private int GetRangeCeilingOfPosition(float position)
{
return (int)Math.Ceiling((decimal)position / (decimal)DefaultHeight);
}
private int GetRangeFloorOfPosition(float position)
{
return (int)Math.Floor((decimal)position / (decimal)DefaultHeight);
}
public int GetFirstDataIndexAtPosition(float desiredHeight)
{
if (!heightCache.Any())
{
return 0;
}
int rangeFloorOfPosition = GetRangeFloorOfPosition(desiredHeight);
if (rangeFloorOfPosition < 0)
{
return 0;
}
if (rangeFloorOfPosition >= rangeCache.Count)
{
return ScrollPool.DataSource.ItemCount - 1;
}
int num = rangeCache[rangeFloorOfPosition];
DataViewInfo dataViewInfo = heightCache[num];
int rangeCeilingOfPosition = GetRangeCeilingOfPosition(dataViewInfo.startPosition);
int num2 = rangeCeilingOfPosition + dataViewInfo.normalizedSpread - 1;
if (rangeFloorOfPosition < rangeCeilingOfPosition || rangeFloorOfPosition > num2)
{
RecalculateStartPositions(ScrollPool.DataSource.ItemCount - 1);
rangeFloorOfPosition = GetRangeFloorOfPosition(desiredHeight);
num = rangeCache[rangeFloorOfPosition];
}
return num;
}
private int GetRangeSpread(float startPosition, float height)
{
float num = startPosition % DefaultHeight;
if (num != 0f)
{
height -= DefaultHeight - num;
}
return (int)Math.Ceiling((decimal)height / (decimal)DefaultHeight);
}
public void Add(float value)
{
value = Math.Max(DefaultHeight, value);
int rangeSpread = GetRangeSpread(totalHeight, value);
heightCache.Add(new DataViewInfo(heightCache.Count, value, totalHeight, rangeSpread));
int item = heightCache.Count - 1;
for (int i = 0; i < rangeSpread; i++)
{
rangeCache.Add(item);
}
totalHeight += value;
}
public void RemoveLast()
{
if (heightCache.Any())
{
totalHeight -= heightCache[heightCache.Count - 1];
heightCache.RemoveAt(heightCache.Count - 1);
int count = heightCache.Count;
while (rangeCache.Count > 0 && rangeCache[rangeCache.Count - 1] == count)
{
rangeCache.RemoveAt(rangeCache.Count - 1);
}
}
}
public void SetIndex(int dataIndex, float height)
{
height = (float)Math.Floor(height);
height = Math.Max(DefaultHeight, height);
if (dataIndex >= ScrollPool.DataSource.ItemCount)
{
while (heightCache.Count > dataIndex)
{
RemoveLast();
}
return;
}
if (dataIndex >= heightCache.Count)
{
while (dataIndex > heightCache.Count)
{
Add(DefaultHeight);
}
Add(height);
return;
}
DataViewInfo value = heightCache[dataIndex];
if (value.height != height)
{
float num = height - value.height;
totalHeight += num;
value.height = height;
}
if (dataIndex > 0)
{
DataViewInfo dataViewInfo = heightCache[dataIndex - 1];
value.startPosition = dataViewInfo.startPosition + dataViewInfo.height;
}
int rangeCeilingOfPosition = GetRangeCeilingOfPosition(value.startPosition);
int rangeSpread = GetRangeSpread(value.startPosition, height);
if (rangeCache[rangeCeilingOfPosition] != dataIndex)
{
RecalculateStartPositions(ScrollPool.DataSource.ItemCount - 1);
rangeCeilingOfPosition = GetRangeCeilingOfPosition(value.startPosition);
rangeSpread = GetRangeSpread(value.startPosition, height);
}
if (rangeCache[rangeCeilingOfPosition] != dataIndex)
{
throw new IndexOutOfRangeException($"Trying to set dataIndex {dataIndex} at rangeIndex {rangeCeilingOfPosition}, but cache is corrupt or invalid!");
}
if