using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM.Network;
using ProjectM.UI;
using TMPro;
using Unity.Entities;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CommandBinds")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("CommandBinds")]
[assembly: AssemblyTitle("CommandBinds")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CommandBinds
{
public static class KeyCombo
{
private static readonly List<Key> _recorded = new List<Key>();
private static Action<List<Key>> _done;
public static bool Recording => _done != null;
public static List<Key> Recorded => _recorded;
public static void Record(Action<List<Key>> done)
{
_recorded.Clear();
_done = done;
}
public static void Cancel()
{
Action<List<Key>> done = _done;
if (done != null)
{
_done = null;
done(null);
}
}
public static void RecordFrame(Keyboard kb)
{
//IL_0043: 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_006a: Unknown result type (might be due to invalid IL or missing references)
if (_done == null || kb == null)
{
return;
}
if (_recorded.Count == 0 && ((ButtonControl)kb.escapeKey).wasPressedThisFrame)
{
Cancel();
return;
}
bool flag = false;
ReadOnlyArray<KeyControl> allKeys = kb.allKeys;
for (int i = 0; i < allKeys.Count; i++)
{
KeyControl val = allKeys[i];
if (val != null && (int)val.keyCode != 0)
{
if (((ButtonControl)val).wasPressedThisFrame && !_recorded.Contains(val.keyCode))
{
_recorded.Add(val.keyCode);
}
if (((ButtonControl)val).isPressed)
{
flag = true;
}
}
}
if (_recorded.Count > 0 && !flag)
{
Action<List<Key>> done = _done;
_done = null;
done(Ordered(_recorded));
}
}
private static bool IsModifier(Key k)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Invalid comparison between Unknown and I4
if (k - 51 <= 7)
{
return true;
}
return false;
}
private static List<Key> Ordered(List<Key> keys)
{
return keys.Where(IsModifier).Concat(keys.Where((Key k) => !IsModifier(k))).ToList();
}
public static Macro Pressed(Keyboard kb, List<Macro> macros)
{
//IL_0041: 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)
Macro macro = null;
foreach (Macro macro2 in macros)
{
Key[] keyCodes = macro2.KeyCodes;
if (keyCodes.Length == 0 || (macro != null && keyCodes.Length <= macro.KeyCodes.Length))
{
continue;
}
bool flag = true;
bool flag2 = false;
Key[] array = keyCodes;
foreach (Key val in array)
{
KeyControl val2 = kb[val];
if (!((ButtonControl)val2).isPressed)
{
flag = false;
break;
}
if (((ButtonControl)val2).wasPressedThisFrame)
{
flag2 = true;
}
}
if (flag && flag2)
{
macro = macro2;
}
}
return macro;
}
public static string Describe(IEnumerable<string> keys)
{
List<string> list = keys.Select(Name).ToList();
if (list.Count != 0)
{
return string.Join(" + ", list);
}
return "";
}
private unsafe static string Name(string key)
{
//IL_000c: 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_002d: Expected I4, but got Unknown
if (!Enum.TryParse<Key>(key, out Key result))
{
return key;
}
switch (result - 51)
{
case 4:
case 5:
return "Ctrl";
case 0:
case 1:
return "Shift";
case 2:
case 3:
return "Alt";
default:
{
string text = ((object)(*(Key*)(&result))/*cast due to .constrained prefix*/).ToString();
if (text.StartsWith("Numpad"))
{
return "Num" + text.Substring(6);
}
if (text.StartsWith("Digit"))
{
return text.Substring(5);
}
return text;
}
}
}
}
public class Macro
{
private Key[] _codes;
public string Name { get; set; } = "";
public string Color { get; set; } = "#e8d9c0";
public List<string> Commands { get; set; } = new List<string>();
public List<string> Keys { get; set; } = new List<string>();
public string Button { get; set; } = "";
[JsonIgnore]
public Key[] KeyCodes
{
get
{
Key result;
return _codes ?? (_codes = (from k in Keys
select (!Enum.TryParse<Key>(k, out result)) ? ((Key)0) : result into k
where (int)k > 0
select k).Distinct().ToArray());
}
}
public void KeysChanged()
{
_codes = null;
}
}
public static class Palette
{
public const string Default = "#e8d9c0";
public static readonly string[] Colors = new string[8] { "#e8d9c0", "#e05a5a", "#e8a24a", "#e8d84a", "#6fcf6f", "#4ac8e8", "#6a8de8", "#b07ae8" };
}
public static class Macros
{
public const int MaxName = 4;
public static List<Macro> All = new List<Macro>();
private static readonly JsonSerializerOptions Options = new JsonSerializerOptions
{
WriteIndented = true,
PropertyNameCaseInsensitive = true
};
private static readonly Regex NextCommand = new Regex("\\s+(?=\\.[\\p{L}\\d])");
private static string FilePath => Path.Combine(Paths.ConfigPath, "CommandBinds.macros.json");
private static string OldFilePath => Path.Combine(Paths.ConfigPath, "vrisingmod.commandbinds.txt");
public unsafe static void Load()
{
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Expected O, but got Unknown
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
if (File.Exists(FilePath))
{
All = JsonSerializer.Deserialize<List<Macro>>(File.ReadAllText(FilePath), Options) ?? new List<Macro>();
All.RemoveAll((Macro m) => m == null);
bool flag = false;
foreach (Macro item in All)
{
Macro macro = item;
if (macro.Commands == null)
{
List<string> list = (macro.Commands = new List<string>());
}
macro = item;
if (macro.Keys == null)
{
List<string> list = (macro.Keys = new List<string>());
}
macro = item;
if (macro.Button == null)
{
string text = (macro.Button = "");
}
macro = item;
if (macro.Name == null)
{
string text = (macro.Name = "?");
}
macro = item;
if (macro.Color == null)
{
string text = (macro.Color = "#e8d9c0");
}
List<string> list4 = item.Commands.SelectMany(Split).Take(6).ToList();
if (!list4.SequenceEqual(item.Commands))
{
item.Commands = list4;
flag = true;
}
}
if (flag)
{
Save();
}
return;
}
All = new List<Macro>();
if (!File.Exists(OldFilePath))
{
return;
}
string[] array = File.ReadAllLines(OldFilePath);
for (int num = 0; num < array.Length; num++)
{
string[] array2 = array[num].Split('\t');
if (array2.Length == 2 && Enum.TryParse<Key>(array2[0].Trim(), ignoreCase: true, out Key result) && (int)result != 0)
{
List<string> list5 = array2[1].Split(';').SelectMany(Split).Where(Plugin.IsCommand)
.Take(6)
.ToList();
if (list5.Count > 0)
{
All.Add(new Macro
{
Name = "M" + (All.Count + 1),
Commands = list5,
Keys = new List<string> { ((object)(*(Key*)(&result))/*cast due to .constrained prefix*/).ToString() }
});
}
}
}
if (All.Count > 0)
{
Save();
ManualLogSource l = Plugin.L;
bool flag2 = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(All.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" bind(s) from 0.1 turned into macros");
}
l.LogInfo(val);
}
}
public static void Save()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
try
{
File.WriteAllText(FilePath, JsonSerializer.Serialize(All, Options));
}
catch (Exception ex)
{
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("macros not saved: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
l.LogError(val);
}
}
public static Macro OnButton(string id)
{
return All.FirstOrDefault((Macro m) => m.Button == id);
}
private static IEnumerable<string> Split(string line)
{
return from c in NextCommand.Split(line.Trim())
select c.Trim() into c
where c.Length > 0
select c;
}
public static string Check(Macro m)
{
if (string.IsNullOrWhiteSpace(m.Name))
{
return Text.T("Нужно имя", "A name is required");
}
if (m.Name.Length > 4)
{
return Text.T($"Имя до {4} символов", $"Name: up to {4} characters");
}
if (m.Commands.Count == 0)
{
return Text.T("Нужна хотя бы одна команда", "At least one command is required");
}
string text = m.Commands.FirstOrDefault((string c) => !Plugin.IsCommand(c));
if (text != null)
{
return Text.T("«" + text + "» - не команда (должна начинаться с точки)", "'" + text + "' is not a command (must start with '.')");
}
string text2 = m.Commands.FirstOrDefault((string c) => NextCommand.IsMatch(c));
if (text2 != null)
{
return Text.T("«" + text2 + "» - одна строка, одна команда", "'" + text2 + "': one command per line");
}
return null;
}
}
public static class Overlay
{
private static Settings _cfg;
private static GameObject _root;
private static RectTransform _canvas;
private static Canvas _canvasComp;
private static readonly List<(Settings.Place place, RectTransform rt, TextMeshProUGUI label)> _screen = new List<(Settings.Place, RectTransform, TextMeshProUGUI)>();
private static Vector2 _winPos;
private static bool _dragging;
private static Vector2 _dragMouse;
private static Vector2 _dragPos;
private const float Pad = 10f;
private const float Header = 38f;
private const float Bar = 28f;
private static RectTransform _menu;
private static RectTransform _menuGrip;
private static RectTransform _grid;
private static RectTransform _editBox;
private static RectTransform _editTip;
private static RectTransform _actions;
private static Image _editFill;
private static TextMeshProUGUI _pageLabel;
private static TextMeshProUGUI _deleteLabel;
private static GameObject _pager;
private static bool _editMode;
private static Macro _selected;
private static int _page;
private static bool _confirmDelete;
private const float LabelW = 112f;
private const float FieldX = 126f;
private const float Row = 34f;
private const float FontSize = 15f;
private static RectTransform _editor;
private static RectTransform _editorGrip;
private static TMP_InputField _name;
private static readonly List<TMP_InputField> _commands = new List<TMP_InputField>();
private static readonly List<(Image box, Outline outline, string color)> _swatches = new List<(Image, Outline, string)>();
private static TextMeshProUGUI _keysLabel;
private static TextMeshProUGUI _buttonLabel;
private static TextMeshProUGUI _status;
private static Macro _editing;
private static string _color;
private static List<string> _keys = new List<string>();
private static string _button = "";
public static bool Visible
{
get
{
if ((Object)(object)_root != (Object)null)
{
return _root.activeSelf;
}
return false;
}
}
public static bool WindowOpen
{
get
{
if (Visible)
{
if (!((Component)_menu).gameObject.activeSelf)
{
return ((Component)_editor).gameObject.activeSelf;
}
return true;
}
return false;
}
}
private static string WindowFile => Path.Combine(Paths.ConfigPath, "CommandBinds.window.txt");
private static int PerPage => _cfg.Menu.Columns * _cfg.Menu.Rows;
private static float EW => _cfg.Window.EditorWidth;
public static void Init(Settings cfg)
{
_cfg = cfg;
}
public static void Second(bool inGame)
{
if ((Object)(object)_root == (Object)null)
{
if (!inGame || !Ui.FindFont())
{
return;
}
Build();
}
if (_root.activeSelf != inGame)
{
_root.SetActive(inGame);
}
if (!inGame)
{
KeyCombo.Cancel();
}
}
private static void Build()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_006d: 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_00b0: Expected O, but got Unknown
_root = new GameObject("CommandBindsOverlay");
Object.DontDestroyOnLoad((Object)(object)_root);
_canvas = _root.AddComponent<RectTransform>();
_canvasComp = _root.AddComponent<Canvas>();
_canvasComp.renderMode = (RenderMode)0;
_canvasComp.sortingOrder = 500;
CanvasScaler obj = _root.AddComponent<CanvasScaler>();
obj.uiScaleMode = (ScaleMode)1;
obj.referenceResolution = new Vector2(1920f, 1080f);
obj.matchWidthOrHeight = 0.5f;
_root.AddComponent<GraphicRaycaster>();
LoadWindowPos();
BuildScreenButtons();
BuildMenu();
BuildEditor();
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ui] built: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_cfg.Buttons.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" on-screen button(s)");
}
l.LogInfo(val);
}
private static void BuildScreenButtons()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
Settings.Place menuButton = _cfg.MenuButton;
RectTransform obj = Ui.Rect((Transform)(object)_canvas, "MenuButton").Anchored(menuButton.Anchor, menuButton.X, menuButton.Y, menuButton.Width, menuButton.Height);
Ui.Box(obj, Ui.Back, Ui.Border);
Ui.Label((Transform)(object)obj, string.IsNullOrEmpty(menuButton.Text) ? Text.T("Меню макросов", "Macros") : menuButton.Text, Math.Min(18f, menuButton.Height * 0.55f), Ui.TextColor, (TextAlignmentOptions)514);
Ui.Button(obj, ToggleMenu);
foreach (Settings.Place button in _cfg.Buttons)
{
RectTransform val = Ui.Rect((Transform)(object)_canvas, "Bind_" + button.Id).Anchored(button.Anchor, button.X, button.Y, button.Width, button.Height);
Ui.Box(val, Ui.Back, Ui.Border);
TextMeshProUGUI val2 = Ui.Label((Transform)(object)val, "", Math.Min(24f, button.Height * 0.45f), Ui.Dim, (TextAlignmentOptions)514);
((TMP_Text)val2).margin = new Vector4(3f, 0f, 3f, 0f);
string id = button.Id;
Ui.Button(val, delegate
{
Macro macro = Macros.OnButton(id);
if (macro != null)
{
Plugin.Run(macro);
}
});
_screen.Add((button, val, val2));
}
RefreshScreenButtons();
}
private static void RefreshScreenButtons()
{
//IL_0095: 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)
foreach (var item4 in _screen)
{
Settings.Place item = item4.place;
RectTransform item2 = item4.rt;
TextMeshProUGUI item3 = item4.label;
Macro macro = Macros.OnButton(item.Id);
((Component)item2).gameObject.SetActive(macro != null || !_cfg.HideEmptyButtons);
((TMP_Text)item3).text = macro?.Name ?? (string.IsNullOrEmpty(item.Text) ? item.Id : item.Text);
((Graphic)item3).color = ((macro != null) ? Ui.ParseColor(macro.Color) : Ui.Dim);
}
}
private static void LoadWindowPos()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
_winPos = new Vector2(_cfg.Window.X, _cfg.Window.Y);
try
{
if (_cfg.Window.RememberPosition && File.Exists(WindowFile))
{
string[] array = File.ReadAllText(WindowFile).Split(' ');
_winPos = new Vector2(float.Parse(array[0], CultureInfo.InvariantCulture), float.Parse(array[1], CultureInfo.InvariantCulture));
}
}
catch
{
}
}
private static void SaveWindowPos()
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
if (!_cfg.Window.RememberPosition)
{
return;
}
try
{
string windowFile = WindowFile;
IFormatProvider invariantCulture = CultureInfo.InvariantCulture;
DefaultInterpolatedStringHandler handler = new DefaultInterpolatedStringHandler(1, 2, invariantCulture);
handler.AppendFormatted(_winPos.x, "0");
handler.AppendLiteral(" ");
handler.AppendFormatted(_winPos.y, "0");
File.WriteAllText(windowFile, string.Create(invariantCulture, ref handler));
}
catch (Exception ex)
{
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("window position not saved: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
l.LogError(val);
}
}
private static void Place(RectTransform w)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0014: 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_0043: 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_0078: 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_0095: Unknown result type (might be due to invalid IL or missing references)
Rect rect = _canvas.rect;
Vector2 size = ((Rect)(ref rect)).size;
Vector2 val = w.sizeDelta * ((Transform)w).localScale.x;
_winPos.x = Mathf.Clamp(_winPos.x, 0f, Mathf.Max(0f, size.x - val.x));
_winPos.y = Mathf.Clamp(_winPos.y, 0f, Mathf.Max(0f, size.y - val.y));
w.anchoredPosition = _winPos;
}
private static RectTransform Window(string name, float w, float h)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = Ui.Rect((Transform)(object)_canvas, name).Anchored("BottomLeft", 0f, 0f, w, h);
((Transform)obj).localScale = Vector3.one * _cfg.Window.Scale;
Ui.Box(obj, Ui.Back, Ui.Border);
return obj;
}
private static string Title(string custom, string standard)
{
if (!string.IsNullOrWhiteSpace(custom))
{
return custom;
}
return standard;
}
private static void BuildMenu()
{
//IL_00aa: 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_010e: 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_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: 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_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
Settings.MenuLayout menu = _cfg.Menu;
float num = (float)menu.Columns * menu.TileSize + (float)(menu.Columns - 1) * menu.Gap;
float num2 = (float)menu.Rows * menu.TileSize + (float)(menu.Rows - 1) * menu.Gap;
float num3 = Math.Max(240f, 20f + num);
float h = 38f + num2 + 8f + 28f + 10f;
_menu = Window("MacroMenu", num3, h);
Ui.TextButton((Transform)(object)_menu, "X", num3 - 30f, 7f, 24f, 24f, Ui.Border, CloseAll, 16f);
_editBox = Ui.Rect((Transform)(object)_menu, "Edit").At(num3 - 58f, 7f, 24f, 24f);
Ui.Box(_editBox, Ui.Field, Ui.Border);
_editFill = Ui.Box(Ui.Rect((Transform)(object)_editBox, "Fill").Fill(6f), Ui.Purple);
((Graphic)_editFill).raycastTarget = false;
Ui.Button(_editBox, delegate
{
_editMode = !_editMode;
_selected = null;
RefreshMenu();
});
_pager = ((Component)Ui.Rect((Transform)(object)_menu, "Pager").At(num3 - 150f, 7f, 86f, 24f)).gameObject;
Ui.TextButton(_pager.transform, "<", 0f, 0f, 22f, 24f, Ui.Border, delegate
{
Page(-1);
}, 16f);
Ui.TextButton(_pager.transform, ">", 64f, 0f, 22f, 24f, Ui.Border, delegate
{
Page(1);
}, 16f);
_pageLabel = Ui.Label((Transform)(object)Ui.Rect(_pager.transform, "Page").At(22f, 0f, 42f, 24f), "", 14f, Ui.Dim, (TextAlignmentOptions)514);
_menuGrip = Ui.Rect((Transform)(object)_menu, "Title").At(10f, 7f, num3 - 160f - 10f, 24f);
Ui.Label((Transform)(object)_menuGrip, Title(_cfg.Window.MenuTitle, Text.T("Макросы", "Macros")), 17f, Ui.TextColor, (TextAlignmentOptions)513);
_editTip = Ui.Rect((Transform)(object)_menu, "EditTip").At(num3 - 34f - 130f, -30f, 130f, 24f);
((Graphic)Ui.Box(_editTip, Ui.Back, Ui.Border, 1f)).raycastTarget = false;
Ui.Label((Transform)(object)_editTip, Text.T("Редактирование", "Edit mode"), 14f, Ui.TextColor, (TextAlignmentOptions)514);
((Component)_editTip).gameObject.SetActive(false);
_grid = Ui.Rect((Transform)(object)_menu, "Grid").At((num3 - num) / 2f, 38f, num, num2);
float num4 = (num3 - 20f - 12f) / 3f;
_actions = Ui.Rect((Transform)(object)_menu, "Actions").At(10f, 38f + num2 + 8f, num3 - 20f, 28f);
Ui.TextButton((Transform)(object)_actions, Text.T("Изменить", "Edit"), 0f, 0f, num4, 28f, Ui.Purple, delegate
{
if (_selected != null)
{
OpenEditor(_selected);
}
}, 14f);
Ui.TextButton((Transform)(object)_actions, Text.T("Активировать", "Run"), num4 + 6f, 0f, num4, 28f, Ui.Purple, delegate
{
if (_selected != null)
{
Plugin.Run(_selected);
}
}, 14f);
_deleteLabel = Ui.TextButton((Transform)(object)_actions, "", (num4 + 6f) * 2f, 0f, num4, 28f, Ui.Purple, Delete, 14f).label;
((Component)_menu).gameObject.SetActive(false);
}
private static void ShowMenu()
{
((Component)_menu).gameObject.SetActive(true);
Place(_menu);
RefreshMenu();
}
private static void ToggleMenu()
{
if (((Component)_editor).gameObject.activeSelf)
{
CloseEditor();
}
else if (((Component)_menu).gameObject.activeSelf)
{
CloseAll();
}
else
{
ShowMenu();
}
}
public static void CloseAll()
{
KeyCombo.Cancel();
((Component)_editor).gameObject.SetActive(false);
((Component)_menu).gameObject.SetActive(false);
_editMode = false;
_selected = null;
}
private static void Page(int delta)
{
_page += delta;
RefreshMenu();
}
private static void Delete()
{
if (_selected != null)
{
if (!_confirmDelete)
{
_confirmDelete = true;
RefreshMenu();
return;
}
Macros.All.Remove(_selected);
Macros.Save();
_selected = null;
RefreshMenu();
RefreshScreenButtons();
}
}
private static void RefreshMenu()
{
//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_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: 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_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
if (_selected == null || !Macros.All.Contains(_selected))
{
_selected = null;
_confirmDelete = false;
}
int num = Macros.All.Count + 1;
int num2 = (num + PerPage - 1) / PerPage;
_page = Math.Clamp(_page, 0, num2 - 1);
_pager.SetActive(num2 > 1);
((TMP_Text)_pageLabel).text = $"{_page + 1}/{num2}";
((Behaviour)_editFill).enabled = _editMode;
((Component)_actions).gameObject.SetActive(_editMode && _selected != null);
((TMP_Text)_deleteLabel).text = (_confirmDelete ? Text.T("Точно?", "Sure?") : Text.T("Удалить", "Delete"));
for (int num3 = ((Transform)_grid).childCount - 1; num3 >= 0; num3--)
{
Object.Destroy((Object)(object)((Component)((Transform)_grid).GetChild(num3)).gameObject);
}
Settings.MenuLayout menu = _cfg.Menu;
for (int i = 0; i < PerPage; i++)
{
int num4 = _page * PerPage + i;
if (num4 >= num)
{
break;
}
float x = (float)(i % menu.Columns) * (menu.TileSize + menu.Gap);
float y = (float)(i / menu.Columns) * (menu.TileSize + menu.Gap);
RectTransform val = Ui.Rect((Transform)(object)_grid, "Tile").At(x, y, menu.TileSize, menu.TileSize);
if (num4 == Macros.All.Count)
{
Ui.Box(val, Ui.Field, Ui.Border);
Ui.Label((Transform)(object)val, "+", menu.TileSize * 0.5f, Ui.TextColor, (TextAlignmentOptions)514);
Ui.Button(val, delegate
{
OpenEditor(null);
});
continue;
}
Macro macro = Macros.All[num4];
bool flag = macro == _selected;
Ui.Box(val, flag ? Color.Lerp(Ui.Field, Ui.Purple, 0.35f) : Ui.Field, flag ? Ui.Purple : Ui.Border, flag ? 3 : 2);
((TMP_Text)Ui.Label((Transform)(object)val, macro.Name, menu.TileSize * 0.42f, Ui.ParseColor(macro.Color), (TextAlignmentOptions)514)).margin = new Vector4(3f, 0f, 3f, 0f);
Ui.Button(val, delegate
{
OnTile(macro);
});
}
}
private static void OnTile(Macro m)
{
if (!_editMode)
{
Plugin.Run(m);
return;
}
_selected = ((_selected == m) ? null : m);
_confirmDelete = false;
RefreshMenu();
}
private static void BuildEditor()
{
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0440: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
//IL_052c: Unknown result type (might be due to invalid IL or missing references)
//IL_0531: 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_05bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0611: Unknown result type (might be due to invalid IL or missing references)
//IL_0679: Unknown result type (might be due to invalid IL or missing references)
float num = EW - 126f - 12f;
float num2 = 112f;
float num3 = num2 + 204f + 4f;
float num4 = num3 + 38f;
float num5 = num4 + 36f;
float num6 = num5 + 36f + 4f + 30f + 10f;
_editor = Window("MacroEditor", EW, num6);
_editorGrip = Ui.Rect((Transform)(object)_editor, "Title").At(12f, 7f, EW - 80f, 24f);
Ui.Label((Transform)(object)_editorGrip, Title(_cfg.Window.EditorTitle, Text.T("Макрос", "Macro")), 17f, Ui.TextColor, (TextAlignmentOptions)513);
Ui.TextButton((Transform)(object)_editor, "<", EW - 58f, 7f, 24f, 24f, Ui.Border, CloseEditor, 16f);
Ui.TextButton((Transform)(object)_editor, "X", EW - 30f, 7f, 24f, 24f, Ui.Border, CloseAll, 16f);
RowLabel(Text.T("Имя", "Name"), 40f, 30f);
_name = Ui.Input((Transform)(object)_editor, 126f, 40f, 70f, 30f, 4, "M1");
Ui.Label((Transform)(object)Ui.Rect((Transform)(object)_editor, "NameHint").At(206f, 40f, num - 80f, 30f), Text.T($"до {4} символов", $"up to {4} characters"), 13f, Ui.Dim, (TextAlignmentOptions)513);
RowLabel(Text.T("Цвет имени", "Name color"), 78f, 24f);
for (int i = 0; i < Palette.Colors.Length; i++)
{
string c = Palette.Colors[i];
RectTransform val = Ui.Rect((Transform)(object)_editor, "Color").At(126f + (float)(i * 32), 78f, 24f, 24f);
Image item = Ui.Box(val, Ui.ParseColor(c), Ui.Back, 3f);
Ui.Button(val, delegate
{
_color = c;
RefreshEditor();
});
_swatches.Add((item, ((Component)val).GetComponent<Outline>(), c));
}
for (int num7 = 0; num7 < 6; num7++)
{
float y = num2 + (float)num7 * 34f;
RowLabel(Text.T($"Команда {num7 + 1}", $"Command {num7 + 1}"), y, 30f);
_commands.Add(Ui.Input((Transform)(object)_editor, 126f, y, num, 30f, 200, (num7 == 0) ? ".command" : ""));
}
RowLabel(Text.T("Клавиши", "Keys"), num3, 30f);
RectTransform obj = Ui.Rect((Transform)(object)_editor, "Keys").At(126f, num3, num - 38f, 30f);
Ui.Box(obj, Ui.Field, Ui.Border);
_keysLabel = Ui.Label((Transform)(object)obj, "", 15f, Ui.TextColor, (TextAlignmentOptions)514);
Ui.Button(obj, StartRecording);
Ui.TextButton((Transform)(object)_editor, "X", 126f + num - 30f, num3, 30f, 30f, Ui.Border, delegate
{
KeyCombo.Cancel();
_keys = new List<string>();
RefreshEditor();
}, 16f);
RowLabel(Text.T("Кнопка на экране", "Screen button"), num4, 30f);
RectTransform obj2 = Ui.Rect((Transform)(object)_editor, "ScreenButton").At(126f, num4, num - 38f, 30f);
Ui.Box(obj2, Ui.Field, Ui.Border);
_buttonLabel = Ui.Label((Transform)(object)obj2, "", 15f, Ui.TextColor, (TextAlignmentOptions)514);
Ui.Button(obj2, NextButton);
_status = Ui.Label((Transform)(object)Ui.Rect((Transform)(object)_editor, "Status").At(12f, num5, EW - 24f, 36f), "", 14f, Ui.Error, (TextAlignmentOptions)514);
((TMP_Text)_status).enableWordWrapping = true;
Ui.TextButton((Transform)(object)_editor, Text.T("Сохранить", "Save"), EW - 12f - 130f, num6 - 40f, 130f, 30f, Ui.Purple, SaveEditor);
Ui.TextButton((Transform)(object)_editor, Text.T("Отмена", "Cancel"), EW - 12f - 130f - 140f, num6 - 40f, 130f, 30f, Ui.Border, CloseEditor);
((Component)_editor).gameObject.SetActive(false);
}
private static void RowLabel(string text, float y, float h)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Ui.Label((Transform)(object)Ui.Rect((Transform)(object)_editor, "RowLabel").At(12f, y, 112f, h), text, 15f, Ui.TextColor, (TextAlignmentOptions)513);
}
private static void OpenEditor(Macro m)
{
_editing = m;
_name.text = m?.Name ?? "";
_color = m?.Color ?? "#e8d9c0";
for (int i = 0; i < _commands.Count; i++)
{
_commands[i].text = ((m != null && i < m.Commands.Count) ? m.Commands[i] : "");
}
_keys = ((m != null) ? new List<string>(m.Keys) : new List<string>());
_button = m?.Button ?? "";
((TMP_Text)_status).text = "";
((Component)_menu).gameObject.SetActive(false);
((Component)_editor).gameObject.SetActive(true);
Place(_editor);
RefreshEditor();
}
private static void CloseEditor()
{
KeyCombo.Cancel();
((Component)_editor).gameObject.SetActive(false);
ShowMenu();
}
private unsafe static void RefreshEditor()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: 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)
foreach (var swatch in _swatches)
{
Outline item = swatch.outline;
string item2 = swatch.color;
((Shadow)item).effectColor = ((item2 == _color) ? Ui.TextColor : Ui.Back);
}
((Graphic)_name.textComponent).color = Ui.ParseColor(_color);
if (KeyCombo.Recording)
{
string text = KeyCombo.Describe(KeyCombo.Recorded.Select((Key k) => ((object)(*(Key*)(&k))/*cast due to .constrained prefix*/).ToString()));
((TMP_Text)_keysLabel).text = ((text.Length > 0) ? (text + " ...") : Text.T("Нажмите клавиши... (Esc - отмена)", "Press keys... (Esc cancels)"));
((Graphic)_keysLabel).color = Ui.Purple;
}
else
{
((TMP_Text)_keysLabel).text = ((_keys.Count > 0) ? KeyCombo.Describe(_keys) : Text.T("не задано - нажмите", "none - click to set"));
((Graphic)_keysLabel).color = ((_keys.Count > 0) ? Ui.TextColor : Ui.Dim);
}
bool flag = _button.Length > 0 && _cfg.Buttons.Any((Settings.Place b) => b.Id == _button);
((TMP_Text)_buttonLabel).text = ((_button.Length == 0) ? Text.T("нет", "none") : (flag ? _button : (_button + Text.T(" (нет в конфиге)", " (not in config)"))));
((Graphic)_buttonLabel).color = ((_button.Length > 0) ? Ui.TextColor : Ui.Dim);
}
private unsafe static void StartRecording()
{
if (KeyCombo.Recording)
{
return;
}
KeyCombo.Record(delegate(List<Key> keys)
{
if (keys != null)
{
_keys = keys.Select((Key k) => ((object)(*(Key*)(&k))/*cast due to .constrained prefix*/).ToString()).ToList();
}
RefreshEditor();
});
RefreshEditor();
}
private static void NextButton()
{
List<string> list = new List<string> { "" };
list.AddRange(_cfg.Buttons.Select((Settings.Place b) => b.Id));
int num = list.IndexOf(_button);
_button = list[(num + 1) % list.Count];
RefreshEditor();
}
private static void SaveEditor()
{
Macro m = new Macro
{
Name = _name.text.Trim(),
Color = _color,
Commands = (from c in _commands
select c.text.Trim() into c
where c.Length > 0
select c).ToList(),
Keys = new List<string>(_keys),
Button = _button
};
string text = Macros.Check(m);
if (text != null)
{
((TMP_Text)_status).text = text;
return;
}
if (m.Button.Length > 0)
{
foreach (Macro item in Macros.All.Where((Macro o) => o != _editing && o.Button == m.Button))
{
item.Button = "";
}
}
if (_editing == null)
{
Macros.All.Add(m);
}
else
{
_editing.Name = m.Name;
_editing.Color = m.Color;
_editing.Commands = m.Commands;
_editing.Keys = m.Keys;
_editing.Button = m.Button;
_editing.KeysChanged();
}
Macros.Save();
RefreshScreenButtons();
_selected = null;
CloseEditor();
}
public static void Frame(Keyboard kb)
{
if (!Visible)
{
return;
}
if (KeyCombo.Recording)
{
KeyCombo.RecordFrame(kb);
if (((Component)_editor).gameObject.activeSelf)
{
RefreshEditor();
}
}
if (((Component)_menu).gameObject.activeSelf)
{
((Component)_editTip).gameObject.SetActive(Ui.MouseOver(_editBox));
}
Drag();
}
private static void Drag()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
Mouse current = Mouse.current;
RectTransform val = (((Component)_editor).gameObject.activeSelf ? _editor : (((Component)_menu).gameObject.activeSelf ? _menu : null));
if (current == null || (Object)(object)val == (Object)null)
{
_dragging = false;
return;
}
Vector2 val2 = ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue();
if (_dragging)
{
if (current.leftButton.isPressed)
{
_winPos = _dragPos + (val2 - _dragMouse) / Mathf.Max(0.01f, _canvasComp.scaleFactor);
Place(val);
}
else
{
_dragging = false;
SaveWindowPos();
}
}
else if (current.leftButton.wasPressedThisFrame && Ui.MouseOver(((Object)(object)val == (Object)(object)_menu) ? _menuGrip : _editorGrip))
{
_dragging = true;
_dragMouse = val2;
_dragPos = _winPos;
}
}
}
[BepInPlugin("vrisingmod.commandbinds", "CommandBinds", "1.0.1")]
public class Plugin : BasePlugin
{
public class Runner : MonoBehaviour
{
private float _nextSecond;
public Runner(IntPtr ptr)
: base(ptr)
{
}
private void Update()
{
try
{
float realtimeSinceStartup = Time.realtimeSinceStartup;
if (realtimeSinceStartup >= _nextSecond)
{
_nextSecond = realtimeSinceStartup + 1f;
Overlay.Second(Chat.InGame());
}
if (_queue.Count > 0 && realtimeSinceStartup >= _nextSend)
{
if (!Chat.Send(_queue.Dequeue()))
{
_queue.Clear();
}
_nextSend = realtimeSinceStartup + 0.2f;
}
Keyboard current = Keyboard.current;
Overlay.Frame(current);
if (current != null && !Busy && !KeyCombo.Recording && Macros.All.Count != 0 && Overlay.Visible && !Chat.IsTyping())
{
Macro macro = KeyCombo.Pressed(current, Macros.All);
if (macro != null)
{
Run(macro);
}
}
}
catch (Exception ex)
{
L.LogError((object)ex);
_queue.Clear();
}
}
}
public const string Guid = "vrisingmod.commandbinds";
public const string Name = "CommandBinds";
public const string Version = "1.0.1";
public const int MaxCommands = 6;
public const float CommandInterval = 0.2f;
internal static ManualLogSource L;
private static readonly Queue<string> _queue = new Queue<string>();
private static float _nextSend;
public static bool Busy => _queue.Count > 0;
public override void Load()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Expected O, but got Unknown
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Expected O, but got Unknown
//IL_0092: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Invalid comparison between Unknown and I4
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Invalid comparison between Unknown and I4
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Invalid comparison between Unknown and I4
L = ((BasePlugin)this).Log;
Settings settings;
bool flag = default(bool);
try
{
settings = Settings.Load();
}
catch (Exception ex)
{
ManualLogSource log = ((BasePlugin)this).Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(36, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Settings.FilePath);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" could not be read, using defaults: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogError(val);
settings = new Settings();
}
string text = settings.Language?.ToLowerInvariant();
if (!(text == "ru"))
{
if (text == "en")
{
flag = false;
}
else
{
SystemLanguage systemLanguage = Application.systemLanguage;
bool flag2 = (((int)systemLanguage == 3 || (int)systemLanguage == 30 || (int)systemLanguage == 38) ? true : false);
flag = flag2;
}
}
else
{
flag = true;
}
Text.Ru = flag;
try
{
Macros.Load();
}
catch (Exception ex2)
{
ManualLogSource log2 = ((BasePlugin)this).Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("macros could not be read: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex2.Message);
}
log2.LogError(val);
}
Ui.ApplyTheme(settings.Theme);
Overlay.Init(settings);
((BasePlugin)this).AddComponent<Runner>();
ManualLogSource log3 = ((BasePlugin)this).Log;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(38, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CommandBinds");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.0.1");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded, ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(Macros.All.Count);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" macro(s), ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(settings.Buttons.Count);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" screen button(s)");
}
log3.LogInfo(val2);
}
internal static bool IsCommand(string s)
{
if (s.Length > 1 && s[0] == '.')
{
return char.IsLetterOrDigit(s[1]);
}
return false;
}
public static void Run(Macro m)
{
if (Busy || m == null || !Chat.InGame())
{
return;
}
foreach (string command in m.Commands)
{
if (IsCommand(command))
{
_queue.Enqueue(command);
}
}
_nextSend = Time.realtimeSinceStartup;
}
}
internal static class Chat
{
private static World Client()
{
Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current != null && current.IsCreated && current.Name == "Client_0")
{
return current;
}
}
return null;
}
private static bool Has<T>(EntityManager em)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
EntityQuery val = ((EntityManager)(ref em)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<T>() });
return !((EntityQuery)(ref val)).IsEmpty;
}
public static bool InGame()
{
//IL_000a: 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)
World val = Client();
if (val != null && Has<LocalUser>(val.EntityManager))
{
return Has<LocalCharacter>(val.EntityManager);
}
return false;
}
public static bool IsTyping()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Invalid comparison between Unknown and I4
World obj = Client();
ClientChatSystem val = ((obj != null) ? obj.GetExistingSystemManaged<ClientChatSystem>() : null);
if (val != null && (int)val._CurrentState == 1)
{
return true;
}
EventSystem current = EventSystem.current;
GameObject val2 = ((current != null) ? current.currentSelectedGameObject : null);
if ((Object)(object)val2 != (Object)null)
{
if (!((Object)(object)val2.GetComponent<TMP_InputField>() != (Object)null))
{
return (Object)(object)val2.GetComponent<InputField>() != (Object)null;
}
return true;
}
return false;
}
public static bool Send(string text)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (!Plugin.IsCommand(text))
{
return true;
}
World val = Client();
if (val == null || !InGame())
{
return false;
}
ChatHelper.SendChatMessageOfType(val.EntityManager, text, (ChatMessageType)4, default(NetworkId));
return true;
}
}
public class Settings
{
public class Place
{
public string Id { get; set; }
public string Text { get; set; }
public string Anchor { get; set; } = "BottomRight";
public float X { get; set; }
public float Y { get; set; }
public float Width { get; set; } = 56f;
public float Height { get; set; } = 56f;
}
public class MenuLayout
{
public int Columns { get; set; } = 4;
public int Rows { get; set; } = 3;
public float TileSize { get; set; } = 52f;
public float Gap { get; set; } = 6f;
}
public class WindowLayout
{
public float X { get; set; } = 20f;
public float Y { get; set; } = 60f;
public bool RememberPosition { get; set; } = true;
public float Scale { get; set; } = 1f;
public float EditorWidth { get; set; } = 410f;
public string MenuTitle { get; set; } = "";
public string EditorTitle { get; set; } = "";
}
public class ThemeColors
{
public string Background { get; set; } = "#1f1a2e";
public int BackgroundOpacity { get; set; } = 45;
public string Field { get; set; } = "#2b243d";
public int FieldOpacity { get; set; } = 50;
public string Border { get; set; } = "#4d4261";
public int BorderOpacity { get; set; } = 60;
public string Accent { get; set; } = "#8c40f2";
public string Text { get; set; } = "#e8d9c0";
public string TextDim { get; set; } = "#998c80";
public string Error { get; set; } = "#f2665a";
}
private static readonly JsonSerializerOptions Options = new JsonSerializerOptions
{
ReadCommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true,
PropertyNameCaseInsensitive = true
};
private const string DefaultText = "// CommandBinds: read when the game starts. After editing, restart the game.\n// Читается при запуске игры. Изменили файл - перезапустите игру.\n//\n// Positions are pixels from the Anchor corner on a 1920x1080 screen (scaled for other sizes).\n// Anchor: TopLeft, Top, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomRight.\n// Позиции - пиксели от угла Anchor на экране 1920x1080 (на других размерах масштабируются).\n{\n // interface language: auto, ru, en\n \"Language\": \"auto\",\n\n // colors #RRGGBB, opacity 0..100 (0 = invisible)\n // цвета #RRGGBB, непрозрачность 0..100 (0 - невидимо)\n \"Theme\": {\n \"Background\": \"#1f1a2e\", \"BackgroundOpacity\": 45, // windows and buttons / окна и кнопки\n \"Field\": \"#2b243d\", \"FieldOpacity\": 50, // input fields and tiles / поля ввода и плитки\n \"Border\": \"#4d4261\", \"BorderOpacity\": 60, // frames / рамки\n \"Accent\": \"#8c40f2\", // edit mode, selection, main actions / редактирование, выбор, главные кнопки\n \"Text\": \"#e8d9c0\",\n \"TextDim\": \"#998c80\", // hints, empty buttons / подсказки, пустые кнопки\n \"Error\": \"#f2665a\"\n },\n\n // the button that opens the macro menu; \"Text\" replaces its caption\n // кнопка, открывающая меню макросов; \"Text\" - своя надпись\n \"MenuButton\": { \"Anchor\": \"BottomLeft\", \"X\": 20, \"Y\": 20, \"Width\": 150, \"Height\": 30, \"Text\": \"\" },\n\n // the menu and editor windows: where they first open (bottom-left corner), whether a dragged\n // window keeps its place, size multiplier, editor width, titles (empty = default)\n // окна меню и редактора: где открываются (левый нижний угол), запоминать ли место после\n // перетаскивания, множитель размера, ширина редактора, заголовки (пусто - по умолчанию)\n \"Window\": { \"X\": 20, \"Y\": 60, \"RememberPosition\": true, \"Scale\": 1.0, \"EditorWidth\": 410, \"MenuTitle\": \"\", \"EditorTitle\": \"\" },\n\n // the menu: macros per row and rows per page (more macros -> pages), tile size and gap\n // меню: макросов в строке, строк на странице (больше - листаются страницы), размер плитки и отступ\n \"Menu\": { \"Columns\": 4, \"Rows\": 3, \"TileSize\": 52, \"Gap\": 6 },\n\n // on-screen buttons: as many as you like. A macro is put on a button by its Id in the macro editor.\n // \"Text\" is shown while no macro is on the button (empty = the Id).\n // Anchor \"Bottom\": X is from the screen centre to the right (minus = left).\n // кнопки на экране: сколько угодно. Макрос ставится на кнопку по её Id в окне макроса.\n // \"Text\" - надпись, пока на кнопке нет макроса (пусто - Id).\n // Anchor \"Bottom\": X - от центра экрана вправо (минус - влево).\n \"Buttons\": [\n { \"Id\": \"B1\", \"Anchor\": \"Bottom\", \"X\": 236, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B2\", \"Anchor\": \"Bottom\", \"X\": 296, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B3\", \"Anchor\": \"Bottom\", \"X\": 356, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B4\", \"Anchor\": \"Bottom\", \"X\": 416, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B5\", \"Anchor\": \"Bottom\", \"X\": 476, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" }\n ],\n\n // hide buttons that have no macro / прятать кнопки без макроса\n \"HideEmptyButtons\": false\n}";
public string Language { get; set; } = "auto";
public ThemeColors Theme { get; set; } = new ThemeColors();
public Place MenuButton { get; set; } = new Place
{
Anchor = "BottomLeft",
X = 20f,
Y = 20f,
Width = 150f,
Height = 30f
};
public WindowLayout Window { get; set; } = new WindowLayout();
public MenuLayout Menu { get; set; } = new MenuLayout();
public bool HideEmptyButtons { get; set; }
public List<Place> Buttons { get; set; } = new List<Place>
{
new Place
{
Id = "B1",
Anchor = "Bottom",
X = 236f,
Y = 115f,
Width = 44f,
Height = 44f
},
new Place
{
Id = "B2",
Anchor = "Bottom",
X = 296f,
Y = 115f,
Width = 44f,
Height = 44f
},
new Place
{
Id = "B3",
Anchor = "Bottom",
X = 356f,
Y = 115f,
Width = 44f,
Height = 44f
},
new Place
{
Id = "B4",
Anchor = "Bottom",
X = 416f,
Y = 115f,
Width = 44f,
Height = 44f
},
new Place
{
Id = "B5",
Anchor = "Bottom",
X = 476f,
Y = 115f,
Width = 44f,
Height = 44f
}
};
public static string FilePath => Path.Combine(Paths.ConfigPath, "CommandBinds.json");
public static Settings Load()
{
if (!File.Exists(FilePath))
{
File.WriteAllText(FilePath, "// CommandBinds: read when the game starts. After editing, restart the game.\n// Читается при запуске игры. Изменили файл - перезапустите игру.\n//\n// Positions are pixels from the Anchor corner on a 1920x1080 screen (scaled for other sizes).\n// Anchor: TopLeft, Top, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomRight.\n// Позиции - пиксели от угла Anchor на экране 1920x1080 (на других размерах масштабируются).\n{\n // interface language: auto, ru, en\n \"Language\": \"auto\",\n\n // colors #RRGGBB, opacity 0..100 (0 = invisible)\n // цвета #RRGGBB, непрозрачность 0..100 (0 - невидимо)\n \"Theme\": {\n \"Background\": \"#1f1a2e\", \"BackgroundOpacity\": 45, // windows and buttons / окна и кнопки\n \"Field\": \"#2b243d\", \"FieldOpacity\": 50, // input fields and tiles / поля ввода и плитки\n \"Border\": \"#4d4261\", \"BorderOpacity\": 60, // frames / рамки\n \"Accent\": \"#8c40f2\", // edit mode, selection, main actions / редактирование, выбор, главные кнопки\n \"Text\": \"#e8d9c0\",\n \"TextDim\": \"#998c80\", // hints, empty buttons / подсказки, пустые кнопки\n \"Error\": \"#f2665a\"\n },\n\n // the button that opens the macro menu; \"Text\" replaces its caption\n // кнопка, открывающая меню макросов; \"Text\" - своя надпись\n \"MenuButton\": { \"Anchor\": \"BottomLeft\", \"X\": 20, \"Y\": 20, \"Width\": 150, \"Height\": 30, \"Text\": \"\" },\n\n // the menu and editor windows: where they first open (bottom-left corner), whether a dragged\n // window keeps its place, size multiplier, editor width, titles (empty = default)\n // окна меню и редактора: где открываются (левый нижний угол), запоминать ли место после\n // перетаскивания, множитель размера, ширина редактора, заголовки (пусто - по умолчанию)\n \"Window\": { \"X\": 20, \"Y\": 60, \"RememberPosition\": true, \"Scale\": 1.0, \"EditorWidth\": 410, \"MenuTitle\": \"\", \"EditorTitle\": \"\" },\n\n // the menu: macros per row and rows per page (more macros -> pages), tile size and gap\n // меню: макросов в строке, строк на странице (больше - листаются страницы), размер плитки и отступ\n \"Menu\": { \"Columns\": 4, \"Rows\": 3, \"TileSize\": 52, \"Gap\": 6 },\n\n // on-screen buttons: as many as you like. A macro is put on a button by its Id in the macro editor.\n // \"Text\" is shown while no macro is on the button (empty = the Id).\n // Anchor \"Bottom\": X is from the screen centre to the right (minus = left).\n // кнопки на экране: сколько угодно. Макрос ставится на кнопку по её Id в окне макроса.\n // \"Text\" - надпись, пока на кнопке нет макроса (пусто - Id).\n // Anchor \"Bottom\": X - от центра экрана вправо (минус - влево).\n \"Buttons\": [\n { \"Id\": \"B1\", \"Anchor\": \"Bottom\", \"X\": 236, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B2\", \"Anchor\": \"Bottom\", \"X\": 296, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B3\", \"Anchor\": \"Bottom\", \"X\": 356, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B4\", \"Anchor\": \"Bottom\", \"X\": 416, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" },\n { \"Id\": \"B5\", \"Anchor\": \"Bottom\", \"X\": 476, \"Y\": 115, \"Width\": 44, \"Height\": 44, \"Text\": \"\" }\n ],\n\n // hide buttons that have no macro / прятать кнопки без макроса\n \"HideEmptyButtons\": false\n}");
return new Settings();
}
Settings? obj = JsonSerializer.Deserialize<Settings>(File.ReadAllText(FilePath), Options) ?? new Settings();
obj.Fix();
return obj;
}
private void Fix()
{
if (Theme == null)
{
ThemeColors themeColors = (Theme = new ThemeColors());
}
if (MenuButton == null)
{
Place place = (MenuButton = new Settings().MenuButton);
}
WindowLayout windowLayout;
if (Window == null)
{
windowLayout = (Window = new WindowLayout());
}
Window.Scale = Math.Clamp(Window.Scale, 0.5f, 2f);
Window.EditorWidth = Math.Clamp(Window.EditorWidth, 360f, 900f);
windowLayout = Window;
if (windowLayout.MenuTitle == null)
{
string text = (windowLayout.MenuTitle = "");
}
windowLayout = Window;
if (windowLayout.EditorTitle == null)
{
string text = (windowLayout.EditorTitle = "");
}
if (Menu == null)
{
MenuLayout menuLayout = (Menu = new MenuLayout());
}
Menu.Columns = Math.Clamp(Menu.Columns, 1, 12);
Menu.Rows = Math.Clamp(Menu.Rows, 1, 12);
Menu.TileSize = Math.Clamp(Menu.TileSize, 24f, 200f);
Menu.Gap = Math.Clamp(Menu.Gap, 0f, 100f);
if (Buttons == null)
{
List<Place> list = (Buttons = new List<Place>());
}
Buttons.RemoveAll((Place b) => b == null || string.IsNullOrWhiteSpace(b.Id));
foreach (Place button in Buttons)
{
button.Width = Math.Max(16f, button.Width);
button.Height = Math.Max(16f, button.Height);
button.Id = button.Id.Trim();
}
}
}
public static class Text
{
public static bool Ru = true;
public static string T(string ru, string en)
{
if (!Ru)
{
return en;
}
return ru;
}
}
public static class Ui
{
public static Color Back;
public static Color Field;
public static Color Border;
public static Color Purple;
public static Color TextColor;
public static Color Dim;
public static Color Error;
public static TMP_FontAsset Font;
public static void ApplyTheme(Settings.ThemeColors t)
{
//IL_0018: 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_0034: 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_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_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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
Settings.ThemeColors themeColors = new Settings.ThemeColors();
Back = Of(t.Background, themeColors.Background, t.BackgroundOpacity);
Field = Of(t.Field, themeColors.Field, t.FieldOpacity);
Border = Of(t.Border, themeColors.Border, t.BorderOpacity);
Purple = Of(t.Accent, themeColors.Accent);
TextColor = Of(t.Text, themeColors.Text);
Dim = Of(t.TextDim, themeColors.TextDim);
Error = Of(t.Error, themeColors.Error);
static Color Of(string html, string fallback, int opacity = 100)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
Color result = default(Color);
if (!ColorUtility.TryParseHtmlString(html, ref result))
{
ColorUtility.TryParseHtmlString(fallback, ref result);
}
result.a = (float)Math.Clamp(opacity, 0, 100) / 100f;
return result;
}
}
public static bool FindFont()
{
if ((Object)(object)Font != (Object)null)
{
return true;
}
foreach (Object item in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<TextMeshProUGUI>()))
{
TextMeshProUGUI val = ((Il2CppObjectBase)item).TryCast<TextMeshProUGUI>();
if ((Object)(object)val != (Object)null && (Object)(object)((TMP_Text)val).font != (Object)null)
{
Font = ((TMP_Text)val).font;
return true;
}
}
return false;
}
public static Color ParseColor(string html)
{
//IL_0010: 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)
Color result = default(Color);
if (!ColorUtility.TryParseHtmlString(html, ref result))
{
return TextColor;
}
return result;
}
public static RectTransform Rect(Transform parent, string name)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = new GameObject(name).AddComponent<RectTransform>();
((Transform)obj).SetParent(parent, false);
return obj;
}
public static RectTransform At(this RectTransform rt, float x, float y, float w, float h)
{
//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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)
//IL_002c: 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)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0f, 1f);
rt.pivot = val;
Vector2 anchorMin = (rt.anchorMax = val);
rt.anchorMin = anchorMin;
rt.anchoredPosition = new Vector2(x, 0f - y);
rt.sizeDelta = new Vector2(w, h);
return rt;
}
public static RectTransform Anchored(this RectTransform rt, string anchor, float x, float y, float w, float h)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_0088: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
string text = (anchor ?? "").ToLowerInvariant();
float num = (text.Contains("left") ? 0f : (text.Contains("right") ? 1f : 0.5f));
float num2 = (text.Contains("top") ? 1f : (text.Contains("bottom") ? 0f : 0.5f));
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(num, num2);
rt.pivot = val;
Vector2 anchorMin = (rt.anchorMax = val);
rt.anchorMin = anchorMin;
rt.anchoredPosition = new Vector2((num == 1f) ? (0f - x) : x, (num2 == 1f) ? (0f - y) : y);
rt.sizeDelta = new Vector2(w, h);
return rt;
}
public static RectTransform Fill(this RectTransform rt, float pad = 0f)
{
//IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = new Vector2(pad, pad);
rt.offsetMax = new Vector2(0f - pad, 0f - pad);
return rt;
}
public static Image Box(RectTransform rt, Color fill, Color? border = null, float width = 2f)
{
//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)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
Image obj = ((Component)rt).gameObject.AddComponent<Image>();
((Graphic)obj).color = fill;
if (border.HasValue)
{
Color valueOrDefault = border.GetValueOrDefault();
Outline obj2 = ((Component)rt).gameObject.AddComponent<Outline>();
((Shadow)obj2).effectColor = valueOrDefault;
((Shadow)obj2).effectDistance = new Vector2(width, 0f - width);
}
return obj;
}
public static TextMeshProUGUI Label(Transform parent, string text, float size, Color color, TextAlignmentOptions align = (TextAlignmentOptions)514)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI obj = ((Component)Rect(parent, "Label").Fill()).gameObject.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj).font = Font;
((TMP_Text)obj).fontSize = size;
((TMP_Text)obj).enableAutoSizing = true;
((TMP_Text)obj).fontSizeMax = size;
((TMP_Text)obj).fontSizeMin = Math.Max(8f, size * 0.45f);
((Graphic)obj).color = color;
((TMP_Text)obj).alignment = align;
((TMP_Text)obj).enableWordWrapping = false;
((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
((Graphic)obj).raycastTarget = false;
((TMP_Text)obj).text = text;
return obj;
}
public static Button Button(RectTransform rt, Action onClick)
{
//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)
//IL_0047: 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_0072: Unknown result type (might be due to invalid IL or missing references)
Button val = ((Component)rt).gameObject.AddComponent<Button>();
Image component = ((Component)rt).GetComponent<Image>();
if (component != null)
{
((Selectable)val).targetGraphic = (Graphic)(object)component;
}
ColorBlock colors = ((Selectable)val).colors;
((ColorBlock)(ref colors)).highlightedColor = new Color(1.25f, 1.25f, 1.25f, 1f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.8f, 0.8f, 0.8f, 1f);
((Selectable)val).colors = colors;
((UnityEvent)val.onClick).AddListener(DelegateSupport.ConvertDelegate<UnityAction>((Delegate)(Action)delegate
{
try
{
onClick();
}
catch (Exception ex)
{
Plugin.L.LogError((object)ex);
}
}));
return val;
}
public static (Button button, TextMeshProUGUI label) TextButton(Transform parent, string text, float x, float y, float w, float h, Color border, Action onClick, float size = 15f)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
RectTransform obj = Rect(parent, "Button").At(x, y, w, h);
Box(obj, Field, border);
return new ValueTuple<Button, TextMeshProUGUI>(item2: Label((Transform)(object)obj, text, size, TextColor, (TextAlignmentOptions)514), item1: Button(obj, onClick));
}
public static TMP_InputField Input(Transform parent, float x, float y, float w, float h, int limit, string placeholder = "", float size = 15f)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = Rect(parent, "Input").At(x, y, w, h);
((Component)val).gameObject.SetActive(false);
Box(val, Field, Border);
RectTransform val2 = Rect((Transform)(object)val, "Text Area").Fill(4f);
((Component)val2).gameObject.AddComponent<RectMask2D>();
TextMeshProUGUI val3 = Label((Transform)(object)val2, placeholder, size, Dim, (TextAlignmentOptions)513);
((TMP_Text)val3).overflowMode = (TextOverflowModes)0;
((TMP_Text)val3).enableAutoSizing = false;
TextMeshProUGUI val4 = Label((Transform)(object)val2, "", size, TextColor, (TextAlignmentOptions)513);
((TMP_Text)val4).overflowMode = (TextOverflowModes)0;
((TMP_Text)val4).enableAutoSizing = false;
TMP_InputField obj = ((Component)val).gameObject.AddComponent<TMP_InputField>();
obj.textViewport = val2;
obj.textComponent = (TMP_Text)(object)val4;
obj.placeholder = (Graphic)(object)val3;
obj.fontAsset = Font;
obj.pointSize = size;
obj.characterLimit = limit;
obj.lineType = (LineType)0;
obj.caretColor = TextColor;
obj.customCaretColor = true;
((Component)val).gameObject.SetActive(true);
return obj;
}
public static bool MouseOver(RectTransform rt)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)rt != (Object)null && ((Component)rt).gameObject.activeInHierarchy && Mouse.current != null)
{
return RectTransformUtility.RectangleContainsScreenPoint(rt, ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(), (Camera)null);
}
return false;
}
}
}