Decompiled source of CaspuinoxGUI v1.1.0
plugins/CasperEquinoxGUI/CasperEquinoxGUI.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using CasperEquinoxGUI.BaseClasses; using CasperEquinoxGUI.Controls; using CasperEquinoxGUI.Layouts; using CasperEquinoxGUI.Utilities; using EquinoxsModUtils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CasperEquinoxGUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CasperEquinoxGUI")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("73d19129-b6f7-43db-9857-06ba9470bbbb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace CasperEquinoxGUI { [BepInPlugin("com.caspuinox.CasperEquinoxGUI", "CasperEquinoxGUI", "1.1.0")] public class CasperEquinoxGUIs : BaseUnityPlugin { private const string GUID = "com.caspuinox.CasperEquinoxGUI"; private int lastScreenWidth; private int lastScreenHeight; internal const bool showTestWindows = false; internal static event Action ScreenSizeChanged; private void Awake() { CaspuinoxGUI.ReadyForGUI += OnReadyForGUI; Debug.Log((object)"CasperEquinoxGUI Loaded"); } private void OnGUI() { StyleInitialiser.InitializeStyles(); if (Screen.width != lastScreenWidth || Screen.height != lastScreenHeight) { lastScreenWidth = Screen.width; lastScreenHeight = Screen.height; CasperEquinoxGUIs.ScreenSizeChanged?.Invoke(); } if (!Images.initialised) { Images.InitialiseStyles(); } GUIManager.DrawAllWindows(); } private void OnReadyForGUI() { } private StackPanel DoStackPanelTest() { StackPanel stackPanel = new StackPanel { Orientation = Orientation.Vertical }; for (int i = 0; i < 20; i++) { stackPanel.AddControl(new Button($"Click me {i}") { Margin = new Thickness(10, 5, 10, 10) }); } return stackPanel; } private WrapPanel DoWrapPanelTest() { WrapPanel wrapPanel = new WrapPanel(); using List<string>.Enumerator enumerator = Resources.SafeResources.GetEnumerator(); while (enumerator.MoveNext()) { ResourceButton resourceButton = new ResourceButton(enumerator.Current) { Margin = new Thickness(5), Padding = new Thickness(10), ImageWidth = 50, ImageHeight = 50 }; resourceButton.LeftClicked += OnResourceButtonClicked; resourceButton.RightClicked += OnResourceButtonRightClicked; wrapPanel.AddControl(resourceButton); } return wrapPanel; } private void OnTextboxEnterPressed(object sender, EventArgs e) { Textbox textbox = sender as Textbox; Debug.Log((object)$"Enter pressed in Textbox #{textbox.ID}"); } private void OnResourceButtonClicked(object sender, EventArgs e) { Debug.Log((object)((sender as ResourceButton).ResourceName + " left clicked!")); } private void OnResourceButtonRightClicked(object sender, EventArgs e) { Debug.Log((object)((sender as ResourceButton).ResourceName + " right clicked!")); } } public enum HorizontalAlignment { Left, Center, Right, Stretch } public enum VerticalAlignment { Top, Center, Bottom, Stretch } internal static class Testing { internal static void DrawTestWindows() { DoGridTest(); DoStackPanelTest(); DoWrapPanelTest(); DoPanelTest(); } private static void DoGridTest() { Grid grid = new Grid(5u, 5u, "equal", "equal") { VerticalAlignment = VerticalAlignment.Top }; for (uint num = 0u; num < 5; num++) { for (uint num2 = 0u; num2 < 5; num2++) { grid.AddControl(new TitleLabel($"{num},{num2}") { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, ColumnIndex = num, RowIndex = num2, Padding = new Thickness(0), Margin = new Thickness(0) }); } } Window window = new Window { Title = "Grid Test", ShowShader = false, FreeCursor = false, RootLayout = grid, Width = 500, Height = 500, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(20) }; GUIManager.AddWindow(ref window); } private static void DoStackPanelTest() { StackPanel stackPanel = new StackPanel { Orientation = Orientation.Vertical }; for (int i = 0; i < 20; i++) { stackPanel.AddControl(new Button($"Click me {i}") { Margin = new Thickness(10, 5, 10, 10) }); } Window window = new Window { Title = "Stack Panel Test", ShowShader = false, FreeCursor = false, RootLayout = stackPanel, Width = 500, Height = 500, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(20) }; GUIManager.AddWindow(ref window); } private static void DoWrapPanelTest() { WrapPanel wrapPanel = new WrapPanel(); using (List<string>.Enumerator enumerator = Resources.SafeResources.GetEnumerator()) { while (enumerator.MoveNext()) { ResourceButton child = new ResourceButton(enumerator.Current) { Margin = new Thickness(5), Padding = new Thickness(10), ImageWidth = 50, ImageHeight = 50 }; wrapPanel.AddControl(child); } } Window window = new Window { Title = "Wrap Panel Test", ShowShader = false, FreeCursor = false, RootLayout = wrapPanel, Width = 500, Height = 500, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(20) }; GUIManager.AddWindow(ref window); } private static void DoPanelTest() { Panel panel = new Panel { Margin = new Thickness(20) }; Panel panel2 = new Panel { Margin = new Thickness(20) }; Grid grid = new Grid(1u, 1u, "equal", "equal"); grid.AddControl(new TextBlock { Text = "Test", Margin = new Thickness(10) }); panel2.Layout = grid; panel.Layout = panel2; Window window = new Window { Title = "Panel Test", ShowShader = false, FreeCursor = false, RootLayout = panel, Width = 500, Height = 500, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(20) }; GUIManager.AddWindow(ref window); } } public class Window { private string _title; private int _width = 300; private int _height = 600; private HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center; private VerticalAlignment _verticalAlignment = VerticalAlignment.Center; private Rect _rect; private Thickness _margin = new Thickness(0); private bool _freeCursor; private bool _visible = true; private bool _showBackground = true; private bool _showShader; private bool _showTitle = true; private bool _showCloseButton = true; protected Grid rootGrid = new Grid(1u, 2u, new string[1] { "equal" }, new string[2] { "min", "equal" }); private TitleLabel titleLabel; private Button closeButton; private Layout _rootLayout; public string Title { get { return _title; } set { _title = value; titleLabel.Title = value; } } public int Width { get { return _width; } set { _width = value; SetRect(); } } public int Height { get { return _height; } set { _height = value; SetRect(); } } public HorizontalAlignment HorizontalAlignment { get { return _horizontalAlignment; } set { _horizontalAlignment = value; SetRect(); } } public VerticalAlignment VerticalAlignment { get { return _verticalAlignment; } set { _verticalAlignment = value; SetRect(); } } public Thickness Margin { get { return _margin; } set { _margin = value; SetRect(); } } public bool FreeCursor { get { return _freeCursor; } set { _freeCursor = value; } } public bool Visible { get { return _visible; } set { _visible = value; } } public bool ShowBackground { get { return _showBackground; } set { _showBackground = value; } } public bool ShowShader { get { return _showShader; } set { _showShader = value; } } public bool ShowTitle { get { return _showTitle; } set { _showTitle = value; titleLabel.Visible = value; } } public bool ShowCloseButton { get { return _showCloseButton; } set { _showCloseButton = value; closeButton.Visible = value; } } public Layout RootLayout { get { return _rootLayout; } set { _rootLayout = value; _rootLayout.Parent = rootGrid; _rootLayout.RowIndex = 1u; int top = ((!ShowTitle && !ShowCloseButton) ? 10 : 0); _rootLayout.Margin = new Thickness(10, top, 10, 10); rootGrid.Children.RemoveAt(2); rootGrid.AddControl(_rootLayout); } } internal Rect Rect { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _rect; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) _rect = value; } } public Window() { if (!StyleInitialiser.stylesInitialised) { throw new Exception("Can't create GUI before styles are initialised. Use event ModUI.ReadyForGUI"); } titleLabel = new TitleLabel(_title) { ContentOffset = new Thickness(0, 5, 0, 0), Margin = new Thickness(10), Padding = new Thickness(0, 0, 0, 20), Visible = ShowTitle, VerticalAlignment = VerticalAlignment.Top }; closeButton = new Button("Close") { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(10), Padding = new Thickness(10), Visible = ShowCloseButton }; closeButton.LeftClicked += OnCloseButtonClicked; _rootLayout = new Grid(1u, 1u, new string[1] { "equal" }, new string[1] { "equal" }); rootGrid.AddControl(titleLabel); rootGrid.AddControl(closeButton); rootGrid.AddControl(_rootLayout); SetRect(); CasperEquinoxGUIs.ScreenSizeChanged += OnScreenSizeChanged; } private void OnScreenSizeChanged() { SetRect(); } private void OnCloseButtonClicked(object sender, EventArgs e) { Hide(); } public void Show() { _visible = true; if (_freeCursor) { EMU.FreeCursor(true); } } public void Hide() { _visible = false; if (_freeCursor) { EMU.FreeCursor(false); } } public virtual void Draw() { if (_visible) { if (_freeCursor) { EMU.FreeCursor(true); } if (ShowShader) { DrawShader(); } if (ShowBackground) { DrawBackground(); } if (!ShowTitle && !ShowCloseButton) { _rootLayout.Margin.Top = 10; } rootGrid.Draw(); } } private void SetRect() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; if (_horizontalAlignment == HorizontalAlignment.Stretch) { _width = Screen.width - _margin.Left - _margin.Right; } if (_verticalAlignment == VerticalAlignment.Stretch) { _height = Screen.height - _margin.Top - _margin.Bottom; } switch (_horizontalAlignment) { case HorizontalAlignment.Left: case HorizontalAlignment.Stretch: num = _margin.Left; break; case HorizontalAlignment.Center: num = (int)((double)(Screen.width - _width) / 2.0); break; case HorizontalAlignment.Right: num = Screen.width - _width - _margin.Right; break; } switch (_verticalAlignment) { case VerticalAlignment.Top: case VerticalAlignment.Stretch: num2 = _margin.Top; break; case VerticalAlignment.Center: num2 = (int)((double)(Screen.height - _height) / 2.0); break; case VerticalAlignment.Bottom: num2 = Screen.height - _height - _margin.Bottom; break; } _rect = new Rect((float)num, (float)num2, (float)_width, (float)_height); rootGrid.ParentRect = new RectInt(num, num2, _width, _height); rootGrid.UpdateRects(); } protected void DrawShader() { if (_showShader) { Images.Pixels.shaderTile.Draw(0f, 0f, Screen.width, Screen.height); } } protected void DrawBackground() { int num = (int)(((Rect)(ref _rect)).width - 2f * Images.WindowBackground.topLeft.width); int num2 = (int)(((Rect)(ref _rect)).height - 2f * Images.WindowBackground.topRight.height); Images.WindowBackground.topLeft.Draw(((Rect)(ref _rect)).x, ((Rect)(ref _rect)).y); Images.WindowBackground.top.Draw(((Rect)(ref _rect)).x + Images.WindowBackground.topLeft.width, ((Rect)(ref _rect)).y, num, Images.WindowBackground.top.height); Images.WindowBackground.topRight.Draw(((Rect)(ref _rect)).x + ((Rect)(ref _rect)).width - Images.WindowBackground.topRight.width, ((Rect)(ref _rect)).y); Images.WindowBackground.right.Draw(((Rect)(ref _rect)).x + ((Rect)(ref _rect)).width - Images.WindowBackground.right.width, ((Rect)(ref _rect)).y + Images.WindowBackground.topRight.height, Images.WindowBackground.right.width, num2); Images.WindowBackground.bottomRight.Draw(((Rect)(ref _rect)).x + ((Rect)(ref _rect)).width - Images.WindowBackground.bottomRight.width, ((Rect)(ref _rect)).y + ((Rect)(ref _rect)).height - Images.WindowBackground.bottomRight.height); Images.WindowBackground.bottom.Draw(((Rect)(ref _rect)).x + Images.WindowBackground.bottomLeft.width, ((Rect)(ref _rect)).y + ((Rect)(ref _rect)).height - Images.WindowBackground.bottom.height, num, Images.WindowBackground.bottom.height); Images.WindowBackground.bottomLeft.Draw(((Rect)(ref _rect)).x, ((Rect)(ref _rect)).y + ((Rect)(ref _rect)).height - Images.WindowBackground.bottomLeft.height); Images.WindowBackground.left.Draw(((Rect)(ref _rect)).x, ((Rect)(ref _rect)).y + Images.WindowBackground.topLeft.height, Images.WindowBackground.left.width, num2); Images.Pixels.darkBackground.Draw(((Rect)(ref _rect)).x + Images.WindowBackground.topLeft.width, ((Rect)(ref _rect)).y + Images.WindowBackground.topLeft.height, num, num2); } } internal static class Images { internal static class Controls { internal static class Button { internal static class Active { internal static ModImage bottomLeft = new ModImage("Controls.Button.Active.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("Controls.Button.Active.BottomRight.png", 10f, 10f); internal static ModImage topLeft = new ModImage("Controls.Button.Active.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("Controls.Button.Active.TopRight.png", 10f, 10f); } internal static class Normal { internal static ModImage bottom = new ModImage("Controls.Button.Normal.Bottom.png", 180f, 10f); internal static ModImage bottomLeft = new ModImage("Controls.Button.Normal.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("Controls.Button.Normal.BottomRight.png", 10f, 10f); internal static ModImage left = new ModImage("Controls.Button.Normal.Left.png", 10f, 20f); internal static ModImage right = new ModImage("Controls.Button.Normal.Right.png", 10f, 20f); internal static ModImage top = new ModImage("Controls.Button.Normal.Top.png", 1f, 10f); internal static ModImage topLeft = new ModImage("Controls.Button.Normal.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("Controls.Button.Normal.TopRight.png", 10f, 10f); } } internal static class Checkbox { internal static ModImage checkboxTicked = new ModImage("Controls.Checkbox.CheckboxTicked.png", 40f, 40f); internal static ModImage checkboxUnticked = new ModImage("Controls.Checkbox.CheckboxUnticked.png", 40f, 40f); } internal static class RadioButton { internal static ModImage radioButtonTicked = new ModImage("Controls.RadioButton.RadioButtonTicked.png", 40f, 40f); internal static ModImage radioButtonUnticked = new ModImage("Controls.RadioButton.RadioButtonUnticked.png", 40f, 40f); } internal static class Textbox { internal static class Active { internal static ModImage bottom = new ModImage("Controls.Textbox.Active.Bottom.png", 180f, 10f); internal static ModImage bottomLeft = new ModImage("Controls.Textbox.Active.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("Controls.Textbox.Active.BottomRight.png", 10f, 10f); internal static ModImage left = new ModImage("Controls.Textbox.Active.Left.png", 10f, 20f); internal static ModImage right = new ModImage("Controls.Textbox.Active.Right.png", 10f, 20f); internal static ModImage top = new ModImage("Controls.Textbox.Active.Top.png", 1f, 10f); internal static ModImage topLeft = new ModImage("Controls.Textbox.Active.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("Controls.Textbox.Active.TopRight.png", 10f, 10f); } internal static class Normal { internal static ModImage bottomLeft = new ModImage("Controls.Textbox.Normal.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("Controls.Textbox.Normal.BottomRight.png", 10f, 10f); internal static ModImage topLeft = new ModImage("Controls.Textbox.Normal.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("Controls.Textbox.Normal.TopRight.png", 10f, 10f); } } } internal static class Panels { internal static class One { internal static ModImage bottomLeft = new ModImage("Panels.One.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("Panels.One.BottomRight.png", 10f, 10f); internal static ModImage topLeft = new ModImage("Panels.One.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("Panels.One.TopRight.png", 10f, 10f); } internal static class Two { internal static ModImage bottomLeft = new ModImage("Panels.Two.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("Panels.Two.BottomRight.png", 10f, 10f); internal static ModImage topLeft = new ModImage("Panels.Two.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("Panels.Two.TopRight.png", 10f, 10f); } } internal static class Pixels { internal static ModImage darkBackground = new ModImage("Pixels.DarkBackground.png", 1f, 1f); internal static ModImage orange = new ModImage("Pixels.Orange.png", 1f, 1f); internal static ModImage shaderTile = new ModImage("Pixels.ShaderTile.png", 512f, 512f); internal static ModImage uiBackground = new ModImage("Pixels.uiBackground.png", 1f, 1f); internal static ModImage yellow = new ModImage("Pixels.Yellow.png", 1f, 1f); } internal static class ScrollBars { internal static ModImage horizontalOuter = new ModImage("ScrollBars.HorizontalOuter.png", 200f, 20f); internal static ModImage verticalOuter = new ModImage("ScrollBars.VerticalOuter.png", 20f, 200f); } internal static class WindowBackground { internal static ModImage bottom = new ModImage("WindowBackground.Bottom.png", 180f, 10f); internal static ModImage bottomLeft = new ModImage("WindowBackground.BottomLeft.png", 10f, 10f); internal static ModImage bottomRight = new ModImage("WindowBackground.BottomRight.png", 10f, 10f); internal static ModImage left = new ModImage("WindowBackground.Left.png", 10f, 20f); internal static ModImage right = new ModImage("WindowBackground.Right.png", 10f, 20f); internal static ModImage top = new ModImage("WindowBackground.Top.png", 180f, 10f); internal static ModImage topLeft = new ModImage("WindowBackground.TopLeft.png", 10f, 10f); internal static ModImage topRight = new ModImage("WindowBackground.TopRight.png", 10f, 10f); } internal static bool initialised = false; private static List<ModImage> modImages = new List<ModImage> { Controls.Button.Active.bottomLeft, Controls.Button.Active.bottomRight, Controls.Button.Active.topLeft, Controls.Button.Active.topRight, Controls.Button.Normal.bottom, Controls.Button.Normal.bottomLeft, Controls.Button.Normal.bottomRight, Controls.Button.Normal.left, Controls.Button.Normal.right, Controls.Button.Normal.top, Controls.Button.Normal.topLeft, Controls.Button.Normal.topRight, Controls.Checkbox.checkboxTicked, Controls.Checkbox.checkboxUnticked, Controls.RadioButton.radioButtonTicked, Controls.RadioButton.radioButtonUnticked, Controls.Textbox.Active.bottom, Controls.Textbox.Active.bottomLeft, Controls.Textbox.Active.bottomRight, Controls.Textbox.Active.left, Controls.Textbox.Active.right, Controls.Textbox.Active.top, Controls.Textbox.Active.topLeft, Controls.Textbox.Active.topRight, Controls.Textbox.Normal.bottomLeft, Controls.Textbox.Normal.bottomRight, Controls.Textbox.Normal.topLeft, Controls.Textbox.Normal.topRight, Panels.One.bottomLeft, Panels.One.bottomRight, Panels.One.topLeft, Panels.One.topRight, Panels.Two.bottomLeft, Panels.Two.bottomRight, Panels.Two.topLeft, Panels.Two.topRight, Pixels.darkBackground, Pixels.orange, Pixels.shaderTile, Pixels.uiBackground, Pixels.yellow, ScrollBars.horizontalOuter, ScrollBars.verticalOuter, WindowBackground.bottom, WindowBackground.bottomLeft, WindowBackground.bottomRight, WindowBackground.left, WindowBackground.right, WindowBackground.top, WindowBackground.topLeft, WindowBackground.topRight }; internal static void InitialiseStyles() { initialised = true; foreach (ModImage modImage in modImages) { modImage.InitialiseStyle(); } } } internal class ModImage { internal float width; internal float height; internal Texture2D texture2d; internal Sprite sprite; internal Rect rect; internal GUIStyle style; internal void InitialiseStyle() { //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_001c: Expected O, but got Unknown GUIStyle val = new GUIStyle(); val.normal.background = texture2d; style = val; } internal void Draw(float xPos, float yPos) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref rect)).x = xPos; ((Rect)(ref rect)).y = yPos; GUI.Box(rect, "", style); } internal void Draw(float xPos, float yPos, float _width, float _height) { //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_0011: Unknown result type (might be due to invalid IL or missing references) rect = new Rect(xPos, yPos, _width, _height); GUI.Box(rect, "", style); } internal bool DrawAsButton(float xPos, float yPos) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref rect)).x = xPos; ((Rect)(ref rect)).y = yPos; return GUI.Button(rect, "", style); } internal bool DrawAsButton(float xPos, float yPos, float _width, float _height) { //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_0011: Unknown result type (might be due to invalid IL or missing references) rect = new Rect(xPos, yPos, _width, _height); return GUI.Button(rect, "", style); } internal ModImage(string path, float _width, float _height) { //IL_002b: 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) width = _width; height = _height; rect = new Rect(0f, 0f, width, height); string text = path ?? ""; texture2d = Images.LoadTexture2DFromFile(text, false, (Assembly)null); sprite = Images.LoadSpriteFromFile(text, false); } } public enum Orientation { Horizontal, Vertical } public static class CaspuinoxGUI { public static event Action ReadyForGUI; internal static void FireReadyForGUI() { CaspuinoxGUI.ReadyForGUI?.Invoke(); } public static void RegisterWindow(ref Window window) { GUIManager.AddWindow(ref window); } } internal static class GUIManager { private static int _highestControlID = 0; private static List<Window> windows = new List<Window>(); internal static void DrawAllWindows() { foreach (Window window in windows) { window.Draw(); } } internal static void AddWindow(ref Window window) { windows.Add(window); } internal static int GetControlID() { _highestControlID++; return _highestControlID; } } } namespace CasperEquinoxGUI.Utilities { internal static class StyleInitialiser { public static GUIStyle guiStyleButton; public static GUIStyle guiStyleLabel; public static GUIStyle guiStyleLabelI; public static GUIStyle guiStyleBox; public static GUIStyle guiStyleTitle; public static GUIStyle guiStyleToggle; public static GUIStyle guiStyleToggleI; public static GUIStyle guiStyleBorder; public static bool stylesInitialised; public static void InitializeStyles() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_003f: 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_004c: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0068: 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_0075: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0091: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ba: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0109: 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_0124: Expected O, but got Unknown //IL_0124: 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_0131: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0159: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_01cc: 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_01e6: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown //IL_0205: Expected O, but got Unknown //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_022e: 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) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_024d: Expected O, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_0290: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown //IL_02e7: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: 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_03a5: 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_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Expected O, but got Unknown //IL_043e: 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_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: 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_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: 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_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Expected O, but got Unknown //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Expected O, but got Unknown //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Expected O, but got Unknown //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Expected O, but got Unknown //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Expected O, but got Unknown //IL_05d3: Expected O, but got Unknown if (!stylesInitialised) { GUIStyle val = new GUIStyle { fontSize = 25, alignment = (TextAnchor)3 }; val.normal.textColor = CustomColours.Yellow; val.normal.background = null; TitleLabel.style = val; GUIStyle val2 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)0 }; val2.normal.textColor = Color.white; TextBlock.style = val2; GUIStyle val3 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)3 }; val3.normal.textColor = Color.white; Checkbox.labelStyle = val3; GUIStyle val4 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)3 }; val4.normal.textColor = Color.white; RadioButton.labelStyle = val4; GUIStyle val5 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)4 }; val5.normal.textColor = Color.white; val5.normal.background = null; Button._style = val5; GUIStyle val6 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)4 }; val6.normal.textColor = CustomColours.DarkText; val6.normal.background = null; Button._activeStyle = val6; GUIStyle val7 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)3 }; val7.normal.textColor = Color.white; val7.normal.background = null; Textbox.style = val7; GUIStyle val8 = new GUIStyle { fontSize = 16, alignment = (TextAnchor)3 }; val8.normal.textColor = Color.gray; val8.normal.background = null; Textbox.hintLabelStyle = val8; GUIStyle val9 = new GUIStyle(); val9.normal.background = CustomColours.LightBackgroundTexture; Panel.panelOneStyle = val9; GUIStyle val10 = new GUIStyle(); val10.normal.background = CustomColours.LightestBackgroundTexture; Panel.panelTwoStyle = val10; GUIStyle val11 = new GUIStyle(GUI.skin.horizontalScrollbar); val11.normal.background = Images.ScrollBars.horizontalOuter.texture2d; val11.fixedHeight = 18f; val11.margin = new RectOffset(0, 2, 0, 0); StackPanel.horizontalStyle = val11; GUISkin skin = GUI.skin; GUIStyle val12 = new GUIStyle(GUI.skin.horizontalScrollbarThumb); val12.normal.background = Images.Pixels.yellow.texture2d; val12.fixedHeight = 12f; val12.margin = new RectOffset(0, 0, 2, 0); skin.horizontalScrollbarThumb = val12; GUIStyle val13 = new GUIStyle(GUI.skin.verticalScrollbar); val13.normal.background = Images.ScrollBars.verticalOuter.texture2d; val13.fixedWidth = 18f; val13.margin = new RectOffset(2, 0, 0, 0); StackPanel.verticalStyle = val13; GUISkin skin2 = GUI.skin; GUIStyle val14 = new GUIStyle(GUI.skin.verticalScrollbarThumb); val14.normal.background = Images.Pixels.yellow.texture2d; val14.fixedWidth = 12f; val14.margin = new RectOffset(3, 0, 4, 8); val14.padding = new RectOffset(0, 0, 0, 4); skin2.verticalScrollbarThumb = val14; GUIStyle val15 = new GUIStyle(); val15.normal.background = CustomColours.CreateColorTexture(Color.red); Control.debugMarginStyle = val15; GUIStyle val16 = new GUIStyle(); val16.normal.background = CustomColours.CreateColorTexture(Color.green); Control.debugPaddingStyle = val16; GUIStyle val17 = new GUIStyle(); val17.normal.background = CustomColours.CreateColorTexture(Color.blue); Control.debugContentStyle = val17; GUIStyle val18 = new GUIStyle(GUI.skin.box) { fontSize = 16, alignment = (TextAnchor)1 }; val18.normal.textColor = CustomColours.Yellow; val18.normal.background = CustomColours.DarkBackgroundTexture; guiStyleBox = val18; GUIStyle val19 = new GUIStyle(GUI.skin.box) { fontSize = 18, alignment = (TextAnchor)1, richText = true }; val19.normal.textColor = CustomColours.Yellow; val19.normal.background = CustomColours.DarkBackgroundTexture; guiStyleTitle = val19; GUIStyle val20 = new GUIStyle(GUI.skin.button) { fontSize = 14, alignment = (TextAnchor)4 }; val20.normal.textColor = CustomColours.Yellow; val20.normal.background = CustomColours.LightBackgroundTexture; val20.hover.textColor = CustomColours.Yellow; val20.hover.background = CustomColours.LightestBackgroundTexture; guiStyleButton = val20; GUIStyle val21 = new GUIStyle(GUI.skin.toggle) { fontSize = 14, alignment = (TextAnchor)4 }; val21.normal.textColor = CustomColours.Yellow; val21.normal.background = CustomColours.LightBackgroundTexture; val21.hover.textColor = CustomColours.Yellow; val21.hover.background = CustomColours.LightestBackgroundTexture; val21.active.textColor = CustomColours.Yellow; val21.active.background = CustomColours.LightestBackgroundTexture; val21.onNormal.textColor = CustomColours.Yellow; val21.onNormal.background = CustomColours.LightestBackgroundTexture; val21.onHover.textColor = CustomColours.Yellow; val21.onHover.background = CustomColours.LightestBackgroundTexture; val21.onActive.textColor = CustomColours.Yellow; val21.onActive.background = CustomColours.LightestBackgroundTexture; guiStyleToggle = val21; guiStyleToggleI = new GUIStyle(GUI.skin.toggle) { fontSize = 14, alignment = (TextAnchor)4 }; GUIStyle val22 = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)4 }; val22.normal.textColor = CustomColours.Yellow; guiStyleLabel = val22; GUIStyle val23 = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)3 }; val23.normal.textColor = CustomColours.Yellow; guiStyleLabelI = val23; GUIStyle val24 = new GUIStyle(GUI.skin.box); val24.normal.background = CustomColours.OrangeBrightestTexture; val24.border = new RectOffset(3, 3, 3, 3); guiStyleBorder = val24; stylesInitialised = true; CaspuinoxGUI.FireReadyForGUI(); } } } public static class CustomColours { public static Color DarkBackground { get; } = HexToColor("#161626"); public static Color LightBackground { get; } = HexToColor("#303040"); public static Color LightestBackground { get; } = HexToColor("#3A3A58"); public static Color OrangeDim { get; } = HexToColor("#442E37"); public static Color OrangeMid { get; } = HexToColor("#5B4136"); public static Color OrangeBright { get; } = HexToColor("#795933"); public static Color OrangeBrightest { get; } = HexToColor("#947022"); public static Color Yellow { get; } = HexToColor("#FFFF16"); public static Color DarkText { get; } = HexToColor("#22164F"); public static Color OrangeText { get; } = HexToColor("#F4B819"); public static Texture2D DarkBackgroundTexture { get; } = CreateColorTexture(DarkBackground); public static Texture2D LightBackgroundTexture { get; } = CreateColorTexture(LightBackground); public static Texture2D LightestBackgroundTexture { get; } = CreateColorTexture(LightestBackground); public static Texture2D OrangeDimTexture { get; } = CreateColorTexture(OrangeDim); public static Texture2D OrangeMidTexture { get; } = CreateColorTexture(OrangeMid); public static Texture2D OrangeBrightTexture { get; } = CreateColorTexture(OrangeBright); public static Texture2D OrangeBrightestTexture { get; } = CreateColorTexture(OrangeBrightest); public static Texture2D YellowTexture { get; } = CreateColorTexture(Yellow); public static Texture2D DarkTextTexture { get; } = CreateColorTexture(DarkText); public static Texture2D OrangeTextTexture { get; } = CreateColorTexture(OrangeText); public static Color HexToColor(string hex) { //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_000f: Unknown result type (might be due to invalid IL or missing references) Color black = Color.black; ColorUtility.TryParseHtmlString(hex, ref black); return black; } public static Texture2D CreateColorTexture(Color color) { //IL_0002: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } public static Texture2D CreateBorderedTexture(int width, int height, Color interiorColor, Color borderColor, int borderWidth) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_004f: 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_0050: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)0; Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { bool flag = j < borderWidth || i < borderWidth || j >= width - borderWidth || i >= height - borderWidth; array[i * width + j] = (flag ? borderColor : interiorColor); } } val.SetPixels(array); val.Apply(); return val; } } public class Thickness { private int _left; private int _top; private int _right; private int _bottom; public int Left { get { return _left; } set { _left = value; } } public int Top { get { return _top; } set { _top = value; } } public int Right { get { return _right; } set { _right = value; } } public int Bottom { get { return _bottom; } set { _bottom = value; } } public Thickness(int all) { _left = all; _top = all; _right = all; _bottom = all; } public Thickness(int leftRight, int topBottom) { _left = leftRight; _top = topBottom; _right = leftRight; _bottom = topBottom; } public Thickness(int left, int top, int right, int bottom) { _left = left; _top = top; _right = right; _bottom = bottom; } public override string ToString() { return $"({Left},{Top},{Right},{Bottom})"; } } } namespace CasperEquinoxGUI.Layouts { public class Panel : Layout { private Layout _layout; private bool _showBackground = true; private int panelIndex; private Rect horizontalPartRect; private Rect verticalPartRect; internal static GUIStyle panelOneStyle; internal static GUIStyle panelTwoStyle; public Layout Layout { get { return _layout; } set { //IL_001a: Unknown result type (might be due to invalid IL or missing references) _layout = value; _layout.Parent = this; _layout.ParentRect = base.ContentRect; _layout.UpdateRects(); } } public bool ShowBackground { get { return _showBackground; } set { _showBackground = value; if (!_showBackground) { panelIndex = -1; } else { CalculatePaneIndex(); } } } public Panel() { base.ContentRectChanged += OnPanelContentRectChanged; } private void OnPanelContentRectChanged() { //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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (Layout != null) { Layout.ParentRect = base.ContentRect; Layout.UpdateRects(); } CalculatePaneIndex(); RectInt paddingRect = base.PaddingRect; float num = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; float num2 = (float)((RectInt)(ref paddingRect)).y + Images.Panels.One.topLeft.height; paddingRect = base.PaddingRect; float num3 = ((RectInt)(ref paddingRect)).width; paddingRect = base.PaddingRect; horizontalPartRect = new Rect(num, num2, num3, (float)((RectInt)(ref paddingRect)).height - 2f * Images.Panels.One.topLeft.height); paddingRect = base.PaddingRect; float num4 = (float)((RectInt)(ref paddingRect)).x + Images.Panels.One.topLeft.width; paddingRect = base.PaddingRect; float num5 = ((RectInt)(ref paddingRect)).y; paddingRect = base.PaddingRect; float num6 = (float)((RectInt)(ref paddingRect)).width - 2f * Images.Panels.One.topLeft.width; paddingRect = base.PaddingRect; verticalPartRect = new Rect(num4, num5, num6, (float)((RectInt)(ref paddingRect)).height); } public override void Draw() { DrawBackground(); Layout?.Draw(); } protected override int CalculateContentWidth() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (base.HorizontalAlignment == HorizontalAlignment.Stretch) { RectInt parentRect = base.ParentRect; return ((RectInt)(ref parentRect)).width - base.Margin.Left - base.Margin.Right - base.Padding.Left - base.Padding.Right; } return Layout?.CalculateWidth() ?? 20; } protected override int CalculateContentHeight() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (base.VerticalAlignment == VerticalAlignment.Stretch) { RectInt parentRect = base.ParentRect; return ((RectInt)(ref parentRect)).height - base.Margin.Top - base.Margin.Bottom - base.Padding.Top - base.Padding.Bottom; } return Layout?.CalculateHeight() ?? 20; } private void DrawBackground() { //IL_0011: 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_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_0039: 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_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_006c: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01f0: Unknown result type (might be due to invalid IL or missing references) RectInt paddingRect; if (panelIndex == 0) { ModImage topLeft = Images.Panels.One.topLeft; paddingRect = base.PaddingRect; float xPos = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; topLeft.Draw(xPos, ((RectInt)(ref paddingRect)).y); ModImage topRight = Images.Panels.One.topRight; paddingRect = base.PaddingRect; float xPos2 = (float)((RectInt)(ref paddingRect)).xMax - Images.Panels.One.topRight.width; paddingRect = base.PaddingRect; topRight.Draw(xPos2, ((RectInt)(ref paddingRect)).y); ModImage bottomRight = Images.Panels.One.bottomRight; paddingRect = base.PaddingRect; float xPos3 = (float)((RectInt)(ref paddingRect)).xMax - Images.Panels.One.topRight.width; paddingRect = base.PaddingRect; bottomRight.Draw(xPos3, (float)((RectInt)(ref paddingRect)).yMax - Images.Panels.One.bottomRight.height); ModImage bottomLeft = Images.Panels.One.bottomLeft; paddingRect = base.PaddingRect; float xPos4 = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; bottomLeft.Draw(xPos4, (float)((RectInt)(ref paddingRect)).yMax - Images.Panels.One.bottomRight.height); GUI.Box(horizontalPartRect, GUIContent.none, panelOneStyle); GUI.Box(verticalPartRect, GUIContent.none, panelOneStyle); } else if (panelIndex == 1) { ModImage topLeft2 = Images.Panels.Two.topLeft; paddingRect = base.PaddingRect; float xPos5 = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; topLeft2.Draw(xPos5, ((RectInt)(ref paddingRect)).y); ModImage topRight2 = Images.Panels.Two.topRight; paddingRect = base.PaddingRect; float xPos6 = (float)((RectInt)(ref paddingRect)).xMax - Images.Panels.One.topRight.width; paddingRect = base.PaddingRect; topRight2.Draw(xPos6, ((RectInt)(ref paddingRect)).y); ModImage bottomRight2 = Images.Panels.Two.bottomRight; paddingRect = base.PaddingRect; float xPos7 = (float)((RectInt)(ref paddingRect)).xMax - Images.Panels.One.topRight.width; paddingRect = base.PaddingRect; bottomRight2.Draw(xPos7, (float)((RectInt)(ref paddingRect)).yMax - Images.Panels.One.bottomRight.height); ModImage bottomLeft2 = Images.Panels.Two.bottomLeft; paddingRect = base.PaddingRect; float xPos8 = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; bottomLeft2.Draw(xPos8, (float)((RectInt)(ref paddingRect)).yMax - Images.Panels.One.bottomRight.height); GUI.Box(horizontalPartRect, GUIContent.none, panelTwoStyle); GUI.Box(verticalPartRect, GUIContent.none, panelTwoStyle); } } private void CalculatePaneIndex() { if (!ShowBackground) { panelIndex = -1; return; } panelIndex = 0; for (Control parent = base.Parent; parent != null; parent = parent.Parent) { if (parent is Panel) { panelIndex++; } } } } public class Grid : Layout { private uint _numColumns; private uint _numRows; private string[] _columnWidths; private string[] _rowHeights; private string[] allMinWidths; private string[] allMinHeights; public uint NumColumns { get { return _numColumns; } set { _numColumns = value; UpdateRects(); } } public uint NumRows { get { return _numRows; } set { _numRows = value; UpdateRects(); } } public string[] ColumnWidths { get { if (base.HorizontalAlignment == HorizontalAlignment.Stretch) { return _columnWidths; } return allMinWidths; } set { _columnWidths = value; UpdateRects(); } } public string[] RowHeights { get { if (base.VerticalAlignment == VerticalAlignment.Stretch) { return _rowHeights; } return allMinHeights; } set { _rowHeights = value; UpdateRects(); } } public Grid() { _numColumns = 1u; _numRows = 1u; _columnWidths = new string[1] { "equal" }; _rowHeights = new string[1] { "equal" }; allMinWidths = new string[1] { "min" }; allMinHeights = new string[1] { "min" }; } public Grid(uint columns, uint rows, string[] columnWidths, string[] rowHeights) { if (columns == 0) { throw new Exception("Grid cannot have 0 columns"); } if (rows == 0) { throw new Exception("Grid cannot have 0 rows"); } if (columnWidths.Length != columns) { throw new Exception($"columnWidths.Length ({columnWidths.Length}) != columns ({columns})"); } if (rowHeights.Length != rows) { throw new Exception($"rowHeights.Length ({rowHeights.Length}) != rows ({rows})"); } _numColumns = columns; _numRows = rows; _columnWidths = columnWidths; _rowHeights = rowHeights; allMinWidths = Enumerable.Repeat("min", (int)columns).ToArray(); allMinHeights = Enumerable.Repeat("min", (int)rows).ToArray(); } public Grid(uint columns, uint rows, string allColumnWidths, string allRowHeights) { _numColumns = columns; _numRows = rows; _columnWidths = Enumerable.Repeat(allColumnWidths, (int)columns).ToArray(); _rowHeights = Enumerable.Repeat(allRowHeights, (int)rows).ToArray(); allMinWidths = Enumerable.Repeat("min", (int)columns).ToArray(); allMinHeights = Enumerable.Repeat("min", (int)rows).ToArray(); } public Grid(uint columns, uint rows, string allColumnWidths, string[] rowHeights) { _numColumns = columns; _numRows = rows; _columnWidths = Enumerable.Repeat(allColumnWidths, (int)columns).ToArray(); _rowHeights = rowHeights; allMinWidths = Enumerable.Repeat("min", (int)columns).ToArray(); allMinHeights = Enumerable.Repeat("min", (int)rows).ToArray(); } public Grid(uint columns, uint rows, string[] columnWidths, string allRowHeights) { _numColumns = columns; _numRows = rows; _columnWidths = columnWidths; _rowHeights = Enumerable.Repeat(allRowHeights, (int)rows).ToArray(); allMinWidths = Enumerable.Repeat("min", (int)columns).ToArray(); allMinHeights = Enumerable.Repeat("min", (int)rows).ToArray(); } internal int GetColumnWidth(uint index) { //IL_00c0: 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_0077: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (_columnWidths == null) { return 0; } string text = _columnWidths[index].ToLower(); RectInt val; if (text == "min") { int num = 0; { foreach (Control item in base.Children.Where((Control child) => child.ColumnIndex == index)) { val = item.MarginRect; if (((RectInt)(ref val)).width > num) { val = item.MarginRect; num = ((RectInt)(ref val)).width; } } return num; } } if (text == "equal") { val = base.ContentRect; int num2 = ((RectInt)(ref val)).width; int num3 = _columnWidths.Where((string column) => column.ToLower() != "equal").Count(); for (uint num4 = 0u; num4 < _numColumns; num4++) { if (_columnWidths[num4].ToLower() != "equal") { num2 -= GetColumnWidth(num4); } } return Mathf.FloorToInt((float)num2 / (float)(_numColumns - num3)); } if (int.TryParse(text, out var result)) { return result; } throw new Exception("Couldn't process column width '" + text + "'"); } internal int GetRowHeight(uint index) { //IL_00c0: 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_0077: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (RowHeights == null) { return 0; } string text = RowHeights[index].ToLower(); RectInt val; if (text == "min") { int num = 0; { foreach (Control item in base.Children.Where((Control child) => child.RowIndex == index && child.Visible)) { val = item.MarginRect; if (((RectInt)(ref val)).height > num) { val = item.MarginRect; num = ((RectInt)(ref val)).height; } } return num; } } if (text == "equal") { val = base.ContentRect; int num2 = ((RectInt)(ref val)).height; base.Children.Where((Control child) => child.RowIndex == index); int num3 = RowHeights.Where((string row) => row.ToLower() != "equal").Count(); for (uint num4 = 0u; num4 < _numRows; num4++) { if (RowHeights[num4].ToLower() != "equal") { num2 -= GetRowHeight(num4); } } return Mathf.FloorToInt((float)num2 / ((float)_numRows - (float)num3)); } if (int.TryParse(text, out var result)) { return result; } throw new Exception("Could not process row height '" + text + "'"); } internal int GetColumnStart(uint index) { //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) RectInt contentRect = base.ContentRect; int num = ((RectInt)(ref contentRect)).x; for (uint num2 = 0u; num2 < index; num2++) { num += GetColumnWidth(num2); } return num; } internal int GetRowStart(uint index) { //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) RectInt contentRect = base.ContentRect; int num = ((RectInt)(ref contentRect)).y; for (uint num2 = 0u; num2 < index; num2++) { num += GetRowHeight(num2); } return num; } internal RectInt GetCellRect(uint column, uint row) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) return new RectInt(GetColumnStart(column), GetRowStart(row), GetColumnWidth(column), GetRowHeight(row)); } internal void DebugGrid() { //IL_0006: 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_002c: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"Grid Content Rect: {base.ContentRect}"); RectInt contentRect; for (uint num = 0u; num <= NumColumns; num++) { float num2 = GetColumnStart(num); contentRect = base.ContentRect; GUI.Box(new Rect(num2, (float)((RectInt)(ref contentRect)).y, 1f, (float)CalculateInternalHeight()), "", Control.debugContentStyle); } for (uint num3 = 0u; num3 <= NumRows; num3++) { contentRect = base.ContentRect; GUI.Box(new Rect((float)((RectInt)(ref contentRect)).x, (float)GetRowStart(num3), (float)CalculateInternalWidth(), 1f), "", Control.debugContentStyle); } } protected override int CalculateContentWidth() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_006d: Unknown result type (might be due to invalid IL or missing references) RectInt val; if (base.HorizontalAlignment == HorizontalAlignment.Stretch) { if (base.Parent is Grid grid) { return grid.GetColumnWidth(base.ColumnIndex) - base.Margin.Left - base.Margin.Right - base.Padding.Left - base.Padding.Right; } if (base.Parent is Panel panel) { val = panel.ContentRect; return ((RectInt)(ref val)).width - base.Margin.Left - base.Margin.Right - base.Padding.Left - base.Padding.Right; } } if (base.Parent == null) { val = base.ParentRect; return ((RectInt)(ref val)).width; } int num = 0; for (uint num2 = 0u; num2 < _numColumns; num2++) { num += GetColumnWidth(num2); } return num; } protected override int CalculateContentHeight() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_006d: Unknown result type (might be due to invalid IL or missing references) RectInt val; if (base.VerticalAlignment == VerticalAlignment.Stretch) { if (base.Parent is Grid grid) { return grid.GetRowHeight(base.RowIndex) - base.Margin.Top - base.Margin.Bottom - base.Padding.Top - base.Padding.Bottom; } if (base.Parent is Panel panel) { val = panel.ContentRect; return ((RectInt)(ref val)).height - base.Margin.Top - base.Margin.Bottom - base.Padding.Top - base.Padding.Bottom; } } if (base.Parent == null) { val = base.ParentRect; return ((RectInt)(ref val)).height; } int num = 0; for (uint num2 = 0u; num2 < _numRows; num2++) { num += GetRowHeight(num2); } return num; } } public class StackPanel : Layout { private Orientation _orientation; private bool _showScroller; private Vector2 _scrollPos = Vector2.zero; private Rect scrollerInternalRect; internal static GUIStyle horizontalStyle; internal static GUIStyle verticalStyle; public Orientation Orientation { get { return _orientation; } set { _orientation = value; UpdateRects(); } } public bool ShowScroller { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) int num = CalculateContentHeight(); RectInt parentRect = base.ParentRect; if (num <= ((RectInt)(ref parentRect)).height) { int num2 = CalculateContentWidth(); parentRect = base.ParentRect; return num2 > ((RectInt)(ref parentRect)).width; } return true; } } public Vector2 ScrollerPosition => _scrollPos; internal Vector2Int GetChildStartPos(Control control) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0073: 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_0091: 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) int num = base.VisibleChildren.IndexOf(control); RectInt val = base.ContentRect; Vector2Int position = ((RectInt)(ref val)).position; if (_orientation == Orientation.Horizontal) { for (int i = 0; i < num; i++) { int x = ((Vector2Int)(ref position)).x; val = base.VisibleChildren[i].MarginRect; ((Vector2Int)(ref position)).x = x + ((RectInt)(ref val)).width; } } else { for (int j = 0; j < num; j++) { int y = ((Vector2Int)(ref position)).y; val = base.VisibleChildren[j].MarginRect; ((Vector2Int)(ref position)).y = y + ((RectInt)(ref val)).height; } } return position; } public override void Draw() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0024: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (ShowScroller) { Rect contentRectFloat = base.ContentRectFloat; Vector2 scrollPos = _scrollPos; Rect contentRectFloat2 = base.ContentRectFloat; float x = ((Rect)(ref contentRectFloat2)).x; contentRectFloat2 = base.ContentRectFloat; _scrollPos = GUI.BeginScrollView(contentRectFloat, scrollPos, new Rect(x, ((Rect)(ref contentRectFloat2)).y, (float)CalculateContentWidth(), (float)CalculateContentHeight()), false, false, horizontalStyle, verticalStyle); } base.Draw(); if (ShowScroller) { GUI.EndScrollView(); } } protected override int CalculateContentWidth() { //IL_004c: 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) if (base.VisibleChildren.Count == 0) { return 0; } if (Orientation == Orientation.Horizontal) { return base.VisibleChildren.Sum(delegate(Control child) { //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) RectInt marginRect3 = child.MarginRect; return ((RectInt)(ref marginRect3)).width; }); } if (base.HorizontalAlignment == HorizontalAlignment.Stretch) { RectInt marginRect = base.MarginRect; return ((RectInt)(ref marginRect)).width - base.Padding.Left - base.Padding.Right - base.Margin.Left - base.Margin.Right - 20; } return base.VisibleChildren.Max(delegate(Control child) { //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) RectInt marginRect2 = child.MarginRect; return ((RectInt)(ref marginRect2)).width; }); } protected override int CalculateContentHeight() { if (base.VisibleChildren.Count == 0) { return 0; } if (Orientation == Orientation.Horizontal) { return base.VisibleChildren.Max(delegate(Control child) { //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) RectInt marginRect2 = child.MarginRect; return ((RectInt)(ref marginRect2)).height; }) + 10; } return base.VisibleChildren.Sum(delegate(Control child) { //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) RectInt marginRect = child.MarginRect; return ((RectInt)(ref marginRect)).height; }); } } public class WrapPanel : Layout { private Dictionary<int, Vector2Int> childPositions = new Dictionary<int, Vector2Int>(); private int _currentChildrenWidth; private int _currentChildrenHeight; private bool _showScroller; private Vector2 _scrollPos = Vector2.zero; private Rect scrollerInternalRect; internal int CurrentChildrenWidth { get { return _currentChildrenWidth; } set { _currentChildrenWidth = value; } } internal int CurrentChildrenHeight { get { return _currentChildrenHeight; } set { _currentChildrenHeight = value; } } public bool ShowScroller { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) int currentChildrenHeight = CurrentChildrenHeight; RectInt parentRect = base.ParentRect; return currentChildrenHeight > ((RectInt)(ref parentRect)).height; } } public Vector2 ScrollerPosition => _scrollPos; internal RectInt GetChildPosition(Control child) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Vector2Int val = childPositions[child.ID]; return new RectInt(((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y, child.CalculateWidth(), child.CalculateHeight()); } private Vector2Int GetStartPosForChild(Control child) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_009b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) int currentChildrenWidth = CurrentChildrenWidth; RectInt val = child.MarginRect; if (currentChildrenWidth + ((RectInt)(ref val)).width > CalculateContentWidth()) { CurrentChildrenWidth = 0; CurrentChildrenHeight += base.VisibleChildren.Max(delegate(Control childControl) { //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) RectInt marginRect = childControl.MarginRect; return ((RectInt)(ref marginRect)).height; }); } Vector2Int val2 = default(Vector2Int); ((Vector2Int)(ref val2)).x = CurrentChildrenWidth; ((Vector2Int)(ref val2)).y = CurrentChildrenHeight; Vector2Int val3 = val2; int currentChildrenWidth2 = CurrentChildrenWidth; val = child.MarginRect; CurrentChildrenWidth = currentChildrenWidth2 + ((RectInt)(ref val)).width; val = base.ContentRect; return ((RectInt)(ref val)).position + val3; } public override void AddControl(Control child) { //IL_0002: 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_0014: Unknown result type (might be due to invalid IL or missing references) Vector2Int startPosForChild = GetStartPosForChild(child); childPositions.Add(child.ID, startPosForChild); base.AddControl(child); UpdateRects(); } public override void ClearChildren() { _children.Clear(); childPositions.Clear(); CurrentChildrenWidth = 0; CurrentChildrenHeight = 0; UpdateRects(); } internal override void UpdateRects() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) SetRect(); ref Rect reference = ref scrollerInternalRect; RectInt val = base.ContentRect; ((Rect)(ref reference)).x = ((RectInt)(ref val)).x; ref Rect reference2 = ref scrollerInternalRect; val = base.ContentRect; ((Rect)(ref reference2)).y = ((RectInt)(ref val)).y; CurrentChildrenWidth = 0; CurrentChildrenHeight = 0; childPositions.Clear(); foreach (Control visibleChild in base.VisibleChildren) { Vector2Int startPosForChild = GetStartPosForChild(visibleChild); childPositions.Add(visibleChild.ID, startPosForChild); ((Rect)(ref scrollerInternalRect)).width = CurrentChildrenWidth; ref Rect reference3 = ref scrollerInternalRect; int currentChildrenHeight = CurrentChildrenHeight; val = visibleChild.MarginRect; ((Rect)(ref reference3)).height = currentChildrenHeight + ((RectInt)(ref val)).height; } base.UpdateRects(); } public override void Draw() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_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_002c: Unknown result type (might be due to invalid IL or missing references) if (ShowScroller) { _scrollPos = GUI.BeginScrollView(base.ContentRectFloat, _scrollPos, scrollerInternalRect, false, false, StackPanel.horizontalStyle, StackPanel.verticalStyle); } base.Draw(); if (ShowScroller) { GUI.EndScrollView(); } } protected override int CalculateContentHeight() { //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) RectInt paddingRect = base.PaddingRect; return ((RectInt)(ref paddingRect)).height - base.Padding.Top - base.Padding.Bottom; } protected override int CalculateContentWidth() { //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) RectInt paddingRect = base.PaddingRect; return ((RectInt)(ref paddingRect)).width - base.Padding.Left - base.Padding.Right; } } } namespace CasperEquinoxGUI.Controls { public class Button : ClickableControl { private GUIContent _content; internal static GUIStyle _style; internal static GUIStyle _activeStyle; public GUIContent Content { get { return _content; } set { _content = value; } } internal GUIStyle Style { get { if (!base.IsMouseOver) { return _style; } return _activeStyle; } } public Button(string buttonText) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown _content = new GUIContent(buttonText); base.Padding = new Thickness(10); } public Button(Texture2D buttonImage) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown _content = new GUIContent((Texture)(object)buttonImage); base.Padding = new Thickness(10); } public override void Draw() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (base.Visible && (DrawBackground() || GUI.Button(base.ContentRectFloat, _content, Style))) { HandleClick(); } } protected override int CalculateContentWidth() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return (int)Style.CalcSize(_content).x; } protected override int CalculateContentHeight() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return (int)Style.CalcSize(_content).y; } private bool DrawBackground() { //IL_0035: 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_004c: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) int num = (int)((float)CalculateInternalWidth() - 2f * Images.Controls.Button.Normal.topLeft.width); int num2 = (int)((float)CalculateInternalHeight() - 2f * Images.Controls.Button.Normal.topLeft.height); RectInt paddingRect = base.PaddingRect; int num3 = ((RectInt)(ref paddingRect)).x + CalculateInternalWidth(); paddingRect = base.PaddingRect; int num4 = ((RectInt)(ref paddingRect)).y + CalculateInternalHeight(); if (!base.IsMouseOver) { ModImage topLeft = Images.Controls.Button.Normal.topLeft; paddingRect = base.PaddingRect; float xPos = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; if (topLeft.DrawAsButton(xPos, ((RectInt)(ref paddingRect)).y)) { return true; } ModImage top = Images.Controls.Button.Normal.top; paddingRect = base.PaddingRect; float xPos2 = (float)((RectInt)(ref paddingRect)).x + Images.Controls.Button.Normal.topLeft.width; paddingRect = base.PaddingRect; if (top.DrawAsButton(xPos2, ((RectInt)(ref paddingRect)).y, num, Images.Controls.Button.Normal.top.height)) { return true; } ModImage topRight = Images.Controls.Button.Normal.topRight; float xPos3 = (float)num3 - Images.Controls.Button.Normal.topRight.width; paddingRect = base.PaddingRect; if (topRight.DrawAsButton(xPos3, ((RectInt)(ref paddingRect)).y)) { return true; } ModImage right = Images.Controls.Button.Normal.right; float xPos4 = (float)num3 - Images.Controls.Button.Normal.right.width; paddingRect = base.PaddingRect; if (right.DrawAsButton(xPos4, (float)((RectInt)(ref paddingRect)).y + Images.Controls.Button.Normal.topRight.height, Images.Controls.Button.Normal.right.width, num2)) { return true; } if (Images.Controls.Button.Normal.bottomRight.DrawAsButton((float)num3 - Images.Controls.Button.Normal.bottomRight.width, (float)num4 - Images.Controls.Button.Normal.bottomRight.height)) { return true; } ModImage bottom = Images.Controls.Button.Normal.bottom; paddingRect = base.PaddingRect; if (bottom.DrawAsButton((float)((RectInt)(ref paddingRect)).x + Images.Controls.Button.Normal.bottomLeft.width, (float)num4 - Images.Controls.Button.Normal.bottom.height, num, Images.Controls.Button.Normal.bottom.height)) { return true; } ModImage bottomLeft = Images.Controls.Button.Normal.bottomLeft; paddingRect = base.PaddingRect; if (bottomLeft.DrawAsButton(((RectInt)(ref paddingRect)).x, (float)num4 - Images.Controls.Button.Normal.bottomLeft.height)) { return true; } ModImage left = Images.Controls.Button.Normal.left; paddingRect = base.PaddingRect; float xPos5 = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; if (left.DrawAsButton(xPos5, (float)((RectInt)(ref paddingRect)).y + Images.Controls.Button.Normal.topLeft.height, Images.Controls.Button.Normal.left.width, num2)) { return true; } ModImage uiBackground = Images.Pixels.uiBackground; paddingRect = base.PaddingRect; float xPos6 = (float)((RectInt)(ref paddingRect)).x + Images.Controls.Button.Normal.topLeft.width; paddingRect = base.PaddingRect; if (uiBackground.DrawAsButton(xPos6, (float)((RectInt)(ref paddingRect)).y + Images.Controls.Button.Normal.topLeft.height, num, num2)) { return true; } } else { ModImage topLeft2 = Images.Controls.Button.Active.topLeft; paddingRect = base.PaddingRect; float xPos7 = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; if (topLeft2.DrawAsButton(xPos7, ((RectInt)(ref paddingRect)).y)) { return true; } ModImage orange = Images.Pixels.orange; paddingRect = base.PaddingRect; float xPos8 = (float)((RectInt)(ref paddingRect)).x + Images.Controls.Button.Active.topLeft.width; paddingRect = base.PaddingRect; if (orange.DrawAsButton(xPos8, ((RectInt)(ref paddingRect)).y, num, Images.Controls.Button.Active.topLeft.height)) { return true; } ModImage topRight2 = Images.Controls.Button.Active.topRight; float xPos9 = (float)num3 - Images.Controls.Button.Active.topRight.width; paddingRect = base.PaddingRect; if (topRight2.DrawAsButton(xPos9, ((RectInt)(ref paddingRect)).y)) { return true; } ModImage orange2 = Images.Pixels.orange; float xPos10 = (float)num3 - Images.Controls.Button.Active.topRight.width; paddingRect = base.PaddingRect; if (orange2.DrawAsButton(xPos10, (float)((RectInt)(ref paddingRect)).y + Images.Controls.Button.Active.topRight.height, Images.Controls.Button.Active.topRight.width, num2)) { return true; } if (Images.Controls.Button.Active.bottomRight.DrawAsButton((float)num3 - Images.Controls.Button.Active.bottomRight.width, (float)num4 - Images.Controls.Button.Active.bottomRight.height)) { return true; } ModImage orange3 = Images.Pixels.orange; paddingRect = base.PaddingRect; if (orange3.DrawAsButton((float)((RectInt)(ref paddingRect)).x + Images.Controls.Button.Active.bottomLeft.width, (float)num4 - Images.Controls.Button.Active.bottomLeft.height, num, Images.Controls.Button.Active.bottomLeft.height)) { return true; } ModImage bottomLeft2 = Images.Controls.Button.Active.bottomLeft; paddingRect = base.PaddingRect; if (bottomLeft2.DrawAsButton(((RectInt)(ref paddingRect)).x, (float)num4 - Images.Controls.Button.Active.bottomLeft.height)) { return true; } ModImage orange4 = Images.Pixels.orange; paddingRect = base.PaddingRect; float xPos11 = ((RectInt)(ref paddingRect)).x; paddingRect = base.PaddingRect; if (orange4.DrawAsButton(xPos11, (float)((RectInt)(ref paddingRect)).y + Images.Controls.Button.Active.topLeft.height, Images.Controls.Button.Active.bottomLeft.width, num2)) { return true; } ModImage orange5 = Images.Pixels.orange; paddingRect = base.PaddingRect; float xPos12 = (float)((RectInt)(ref paddingRect)).x + Images.Controls.Button.Active.topLeft.width; paddingRect = base.PaddingRect; if (orange5.DrawAsButton(xPos12, (float)((RectInt)(ref paddingRect)).y + Images.Controls.Button.Active.topLeft.height, num, num2)) { return true; } } return false; } } public class Checkbox : Control { private bool _isChecked; private string _label = ""; private Rect labelRect; private RectInt lastMarginRect; private const int labelLeftMargin = 10; internal static GUIStyle labelStyle; public bool IsChecked { get { return _isChecked; } private set { _isChecked = value; this.IsCheckedChanged?.Invoke(this, EventArgs.Empty); if (_isChecked) { this.Checked?.Invoke(this, EventArgs.Empty); } else { this.Unchecked?.Invoke(this, EventArgs.Empty); } } } public string Label { get { return _label; } set { _label = value; } } public event EventHandler IsCheckedChanged; public event EventHandler Checked; public event EventHandler Unchecked; public Checkbox(bool defaultState) { _isChecked = defaultState; } public override void Draw() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0075: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) ModImage obj = (IsChecked ? Images.Controls.Checkbox.checkboxTicked : Images.Controls.Checkbox.checkboxUnticked); RectInt val = base.PaddingRect; float xPos = ((RectInt)(ref val)).x; val = base.PaddingRect; if (obj.DrawAsButton(xPos, ((RectInt)(ref val)).y)) { IsChecked = !IsChecked; } _ = labelRect; val = base.MarginRect; if (!((RectInt)(ref val)).Equals(lastMarginRect)) { Vector2 val2 = TextBlock.style.CalcSize(new GUIContent(Label)); Rect contentRectFloat = base.ContentRectFloat; float num = ((Rect)(ref contentRectFloat)).xMin + 40f + 10f; contentRectFloat = base.ContentRectFloat; labelRect = new Rect(num, ((Rect)(ref contentRectFloat)).y, val2.x, (float)CalculateContentHeight()); } if (!string.IsNullOrEmpty(Label)) { GUI.TextArea(labelRect, Label, labelStyle); } } protected override int CalculateContentHeight() { return 40; } protected override int CalculateContentWidth() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) return 50 + (int)labelStyle.CalcSize(new GUIContent(Label)).x; } } public class Image : Control { private int _width; private int _height; private Texture2D _imageToRender; private GUIStyle style; public int Width { get { return _width; } set { _width = value; } } public int Height { get { return _height; } set { _height = value; } } public Texture2D ImageToRender { ge