Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EmoteWheelReworked v1.0.0
EmoteWheelReworked.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("EmoteWheelReworked")] [assembly: AssemblyDescription("Rework of EmoteWheel by virtuacode for Valkream")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Dzk")] [assembly: AssemblyProduct("EmoteWheelReworked")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace EmoteWheelReworked; [BepInPlugin("dzk.valheim.emotewheelreworked", "Emote Wheel Reworked Mod", "1.0.0")] public class EmoteWheelReworked : BaseUnityPlugin { private static Harmony harmony; public static ConfigEntry<KeyboardShortcut> Hotkey; public static ConfigEntry<bool> TriggerOnRelease; public static ConfigEntry<bool> TriggerOnClick; public static ConfigEntry<Color> HighlightColor; public static ConfigEntry<float> GuiScale; public static ConfigEntry<int> IgnoreJoyStickDuration; public static ConfigEntry<bool> ToggleMenu; public static ConfigEntry<bool> ModEnabled; public static ConfigEntry<string> ProtectedBindings; public static ConfigEntry<KeyboardShortcut> HotkeyGamepad; public static KeyCode replacedKey = (KeyCode)0; public static List<string> replacedButtons = new List<string>(); public static ManualLogSource MyLogger = Logger.CreateLogSource(Assembly.GetExecutingAssembly().GetName().Name); public static float JoyStickIgnoreTime = 0f; public static bool inventoryVisible = false; public static Color GetHighlightColor => HighlightColor.Value; public static bool CanOpenMenu { get { Player localPlayer = Player.m_localPlayer; return !((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && !((Character)localPlayer).InCutscene() && !((Character)localPlayer).IsTeleporting() && !inventoryVisible && ((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible() && (Object)(object)TextViewer.instance != (Object)null && !TextViewer.instance.IsVisible() && !GameCamera.InFreeFly() && !Minimap.IsOpen(); } } public static bool IsShortcutDown { get { //IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) KeyboardShortcut val = (ZInput.IsGamepadActive() ? HotkeyGamepad.Value : Hotkey.Value); KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey; KeyCode[] source = ((KeyboardShortcut)(ref val)).Modifiers.ToArray(); return Input.GetKeyDown(mainKey) && ((IEnumerable<KeyCode>)source).All((Func<KeyCode, bool>)Input.GetKey); } } public static bool IsShortcutUp { get { //IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) KeyboardShortcut val = (ZInput.IsGamepadActive() ? HotkeyGamepad.Value : Hotkey.Value); KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey; KeyCode[] source = ((KeyboardShortcut)(ref val)).Modifiers.ToArray(); return Input.GetKeyUp(mainKey) || ((IEnumerable<KeyCode>)source).Any((Func<KeyCode, bool>)Input.GetKeyUp); } } public static bool IsShortcutPressed { get { //IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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) KeyboardShortcut val = (ZInput.IsGamepadActive() ? HotkeyGamepad.Value : Hotkey.Value); KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey; KeyCode[] source = ((KeyboardShortcut)(ref val)).Modifiers.ToArray(); return Input.GetKey(mainKey) && ((IEnumerable<KeyCode>)source).All((Func<KeyCode, bool>)Input.GetKey); } } public static void Log(string msg) { ManualLogSource myLogger = MyLogger; if (myLogger != null) { myLogger.LogInfo((object)msg); } } public static void LogErr(string msg) { ManualLogSource myLogger = MyLogger; if (myLogger != null) { myLogger.LogError((object)msg); } } public static void LogWarn(string msg) { ManualLogSource myLogger = MyLogger; if (myLogger != null) { myLogger.LogWarning((object)msg); } } public static bool IsDedicated() { MethodInfo method = typeof(ZNet).GetMethod("IsDedicated", BindingFlags.Instance | BindingFlags.Public); Func<ZNet, bool> func = (Func<ZNet, bool>)Delegate.CreateDelegate(typeof(Func<ZNet, bool>), method); return func(null); } public void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown MyLogger = ((BaseUnityPlugin)this).Logger; if (IsDedicated()) { LogWarn("Mod not loaded because game instance is a dedicated server."); return; } ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ModEnabled", true, "Enable mod when value is true"); Hotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Hotkey", KeyboardShortcut.Deserialize("T"), "Hotkey for opening emote wheel menu"); HotkeyGamepad = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Input", "HotkeyGamepad", KeyboardShortcut.Deserialize("JoystickButton2"), "Hotkey on gamepads for opening emote wheel menu"); ProtectedBindings = ((BaseUnityPlugin)this).Config.Bind<string>("Input", "ProtectedBindings", "JoyTabLeft JoyTabRight JoyButtonA JoyButtonB JoyButtonX JoyButtonY", "Button bindings that should never be overriden"); TriggerOnRelease = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriggerOnRelease", true, "Releasing the Hotkey will trigger the selected emote"); TriggerOnClick = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TriggerOnClick", false, "Click with left mouse button will trigger the selected emote"); ToggleMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Input", "ToggleMenu", false, "When enabled the emote wheel will toggle between hidden/visible when the hotkey was pressed"); HighlightColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Appereance", "HighlightColor", new Color(1f, 0.82f, 0f), "Color of the highlighted selection"); GuiScale = ((BaseUnityPlugin)this).Config.Bind<float>("Appereance", "GuiScale", 0.75f, "Scale factor of the user interface"); IgnoreJoyStickDuration = ((BaseUnityPlugin)this).Config.Bind<int>("Input", "IgnoreJoyStickDuration", 300, new ConfigDescription("Duration in milliseconds for ignoring left joystick input after button release", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>())); if (!ModEnabled.Value) { LogWarn("Mod not loaded because it was disabled via config."); return; } HotkeyGamepad.SettingChanged += delegate { RestoreGamepadButton(); ReplaceGamepadButton(); }; harmony = Harmony.CreateAndPatchAll(typeof(Patcher), (string)null); Log("EmoteWheelReworked Loaded!"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchAll((string)null); } } private static void SetButtonKey(string name, KeyCode keyCode) { Dictionary<string, ButtonDef> buttonsFromZInput = GetButtonsFromZInput(); string text = "<Keyboard>/" + ((object)(KeyCode)(ref keyCode)).ToString().ToLower(); buttonsFromZInput[name].Rebind(text); } private static Dictionary<string, ButtonDef> GetButtonsFromZInput() { return (Dictionary<string, ButtonDef>)typeof(ZInput).GetField("m_buttons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ZInput.instance); } public static void ReplaceGamepadButton() { //IL_006e: 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_00a7: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if (ZInput.instance == null) { return; } Dictionary<string, ButtonDef> dictionary = (Dictionary<string, ButtonDef>)typeof(ZInput).GetField("m_buttons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ZInput.instance); string[] array = ParseTokens(ProtectedBindings.Value); foreach (KeyValuePair<string, ButtonDef> item in dictionary) { string actionPath = item.Value.GetActionPath(true); KeyCode val = (KeyCode)0; if (actionPath.StartsWith("<Keyboard>/")) { string value = actionPath.Replace("<Keyboard>/", ""); if (Enum.TryParse<KeyCode>(value, ignoreCase: true, out KeyCode result)) { val = result; } } if (Array.IndexOf(array, item.Key) <= -1 && (int)val != 0) { KeyCode val2 = val; KeyboardShortcut value2 = HotkeyGamepad.Value; if (val2 == ((KeyboardShortcut)(ref value2)).MainKey) { replacedButtons.Add(item.Key); replacedKey = val; SetButtonKey(item.Key, (KeyCode)0); } } } } public static void RestoreGamepadButton() { //IL_0038: 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 (ZInput.instance == null || replacedButtons.Count <= 0) { return; } foreach (string replacedButton in replacedButtons) { SetButtonKey(replacedButton, replacedKey); } replacedButtons.Clear(); replacedKey = (KeyCode)0; } public static string[] ParseTokens(string value) { char[] separator = new char[5] { ' ', ',', '.', ':', '\t' }; return value.Split(separator, StringSplitOptions.RemoveEmptyEntries); } } public class EmoteGui : MonoBehaviour { private EmoteWheelUI ui; public static AssetBundle assets; public static bool visible; public int toggleVisible = 0; private void Awake() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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) LoadAssets(); GameObject val = GameObject.Find("EmoteWheelCanvas"); if ((Object)(object)val == (Object)null) { val = new GameObject("EmoteWheelCanvas", new Type[3] { typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); Canvas component = val.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; CanvasScaler component2 = val.GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); val.layer = LayerMask.NameToLayer("UI"); } GameObject val2 = assets.LoadAsset<GameObject>("selectionwheel"); GameObject val3 = Object.Instantiate<GameObject>(val2, val.transform); ui = val3.GetComponent<EmoteWheelUI>(); if ((Object)(object)ui == (Object)null) { ui = val3.AddComponent<EmoteWheelUI>(); } RectTransform component3 = val3.GetComponent<RectTransform>(); if ((Object)(object)component3 != (Object)null) { component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; } val3.SetActive(false); visible = false; assets.Unload(false); Debug.Log((object)"[EmoteGui] UI loaded into Canvas"); } private void Start() { if (!((Object)(object)Hud.instance == (Object)null)) { EmoteWheelReworked.RestoreGamepadButton(); EmoteWheelReworked.ReplaceGamepadButton(); } } private void LoadAssets() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("EmoteWheelReworked.res.selectionwheel"); using MemoryStream memoryStream = new MemoryStream(); manifestResourceStream.CopyTo(memoryStream); assets = AssetBundle.LoadFromMemory(memoryStream.ToArray()); } public void Hide() { ((Component)ui).gameObject.SetActive(false); visible = false; toggleVisible = 0; } private void Update() { if (EmoteWheelReworked.JoyStickIgnoreTime > 0f) { EmoteWheelReworked.JoyStickIgnoreTime -= Time.deltaTime; } if (!EmoteWheelReworked.CanOpenMenu) { Hide(); return; } if (EmoteWheelReworked.IsShortcutDown && EmoteWheelReworked.ToggleMenu.Value && toggleVisible < 2) { toggleVisible++; } bool flag = EmoteWheelReworked.IsShortcutDown && EmoteWheelReworked.ToggleMenu.Value && toggleVisible == 2; bool flag2 = EmoteWheelReworked.IsShortcutUp && !EmoteWheelReworked.ToggleMenu.Value; if ((EmoteWheelReworked.ToggleMenu.Value && toggleVisible > 0 && !flag) || (EmoteWheelReworked.IsShortcutPressed && !EmoteWheelReworked.ToggleMenu.Value)) { ((Component)ui).gameObject.SetActive(true); visible = true; if (EmoteWheelReworked.TriggerOnClick.Value && (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)330)) && ui.CurrentEmote != null) { PlayEmote(ui.CurrentEmote); } if (!flag) { return; } } if (EmoteWheelReworked.TriggerOnRelease.Value && (flag || flag2)) { if (ui.CurrentEmote != null) { PlayEmote(ui.CurrentEmote); } EmoteWheelReworked.JoyStickIgnoreTime = (float)EmoteWheelReworked.IgnoreJoyStickDuration.Value / 1000f; } Hide(); } private void PlayEmote(string emote) { Player localPlayer = Player.m_localPlayer; if (!((Character)localPlayer).IsSitting()) { StopEmote(localPlayer); } switch (emote) { case "blowkiss": case "challenge": case "bow": case "comehere": case "nonono": case "wave": case "thumbsup": case "point": localPlayer.FaceLookDirection(); localPlayer.StartEmote(emote, true); break; case "sit": if (((Character)localPlayer).IsSitting()) { StopEmote(localPlayer); } else { localPlayer.StartEmote(emote, false); } break; default: localPlayer.StartEmote(emote, true); break; } ui.Flash(); } private void StopEmote(Player player) { typeof(Player).GetMethod("StopEmote", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(player, new object[0]); } } public class EmoteWheelUI : MonoBehaviour { [Serializable] private class Emote { public string name; public string command; } [CompilerGenerated] private sealed class <FlashCoroutine>d__22 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float aTime; public EmoteWheelUI <>4__this; private Color <color>5__1; private float <t>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlashCoroutine>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0021: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <color>5__1 = EmoteWheelReworked.GetHighlightColor; <t>5__2 = 0f; break; case 1: <>1__state = -1; <t>5__2 += Time.deltaTime / aTime; break; } if (<t>5__2 < 1f) { ((Graphic)<>4__this.highlight.GetComponent<Image>()).color = Color.Lerp(Color.white, <color>5__1, <t>5__2); <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public readonly float INNER_DIAMETER = 340f; private readonly Emote[] EMOTES = new Emote[23] { new Emote { name = "Blow Kiss", command = "blowkiss" }, new Emote { name = "Bow", command = "bow" }, new Emote { name = "Challenge", command = "challenge" }, new Emote { name = "Cheer", command = "cheer" }, new Emote { name = "Come Here", command = "comehere" }, new Emote { name = "Cower", command = "cower" }, new Emote { name = "Cry", command = "cry" }, new Emote { name = "Dance", command = "dance" }, new Emote { name = "Despair", command = "despair" }, new Emote { name = "Flex", command = "flex" }, new Emote { name = "Headbang", command = "headbang" }, new Emote { name = "Kneel", command = "kneel" }, new Emote { name = "Laugh", command = "laugh" }, new Emote { name = "No No No", command = "nonono" }, new Emote { name = "Point", command = "point" }, new Emote { name = "Relax", command = "relax" }, new Emote { name = "Rest", command = "rest" }, new Emote { name = "Roar", command = "roar" }, new Emote { name = "Shrug", command = "shrug" }, new Emote { name = "Sit", command = "sit" }, new Emote { name = "Thumbs Up", command = "thumbsup" }, new Emote { name = "Toast", command = "toast" }, new Emote { name = "Wave", command = "wave" } }; private Font font; private GameObject cursor; private GameObject highlight; private GameObject textPrefab; private Transform itemsRoot; private Text[] itemTexts; private Color NormalColor = new Color(1f, 1f, 1f, 0.5f); private Color HighlightColor = Color.white; private int previous = -1; public int Current { get { if ((!ZInput.IsGamepadActive() && MouseInCenter) || JoyStickInCenter) { return -1; } int num = Mod((int)Mathf.Round(Angle / (360f / (float)EMOTES.Length)), EMOTES.Length); if (num >= EMOTES.Length) { return -1; } return num; } } public bool JoyStickInCenter { get { float joyLeftStickX = ZInput.GetJoyLeftStickX(false); float joyLeftStickY = ZInput.GetJoyLeftStickY(true); return ZInput.IsGamepadActive() && joyLeftStickX == 0f && joyLeftStickY == 0f; } } public string CurrentEmote { get { if (Current < 0) { return null; } return EMOTES[Current].command; } } public bool MouseInCenter { get { //IL_0018: 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_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_003e: Unknown result type (might be due to invalid IL or missing references) float num = INNER_DIAMETER / 2f * ((Component)this).gameObject.transform.lossyScale.x; Vector3 val = Input.mousePosition - cursor.transform.position; return ((Vector3)(ref val)).magnitude <= num; } } public float Angle { get { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (ZInput.IsGamepadActive()) { float joyLeftStickX = ZInput.GetJoyLeftStickX(false); float num = 0f - ZInput.GetJoyLeftStickY(true); if (joyLeftStickX != 0f || num != 0f) { return Mathf.Atan2(num, joyLeftStickX) * 57.29578f - 90f; } } Vector3 val = Input.mousePosition - cursor.transform.position; return Mathf.Atan2(val.y, val.x) * 57.29578f - 90f; } } [IteratorStateMachine(typeof(<FlashCoroutine>d__22))] public IEnumerator FlashCoroutine(float aTime) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlashCoroutine>d__22(0) { <>4__this = this, aTime = aTime }; } public GameObject BuildTextPrefab() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0020: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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) GameObject val = new GameObject(); RectTransform val2 = val.AddComponent<RectTransform>(); Text val3 = val.AddComponent<Text>(); val2.sizeDelta = new Vector2(200f, 100f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 300f, 0f)); val3.fontSize = 28; ((Graphic)val3).color = Color.white; val3.font = font; val3.fontStyle = (FontStyle)1; val3.alignByGeometry = true; val3.alignment = (TextAnchor)4; val.SetActive(false); return val; } private int Mod(int a, int b) { return (a % b + b) % b; } public void Flash() { ((MonoBehaviour)this).StartCoroutine(FlashCoroutine(0.4f)); } private void Awake() { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) Font[] array = Resources.FindObjectsOfTypeAll<Font>(); foreach (Font val in array) { if (((Object)val).name == "AveriaSerifLibre-Bold") { font = val; break; } } cursor = ((Component)((Component)this).transform.Find("Cursor")).gameObject; highlight = ((Component)((Component)this).transform.Find("Highlight")).gameObject; ((Graphic)highlight.GetComponent<Image>()).material.SetFloat("_Degree", 360f / (float)EMOTES.Length); textPrefab = BuildTextPrefab(); itemsRoot = ((Component)this).transform.Find("Items"); itemTexts = (Text[])(object)new Text[EMOTES.Length]; float iNNER_DIAMETER = INNER_DIAMETER; for (int j = 0; j < EMOTES.Length; j++) { GameObject val2 = Object.Instantiate<GameObject>(textPrefab); val2.transform.SetParent(itemsRoot, false); float num = (float)j * (360f / (float)EMOTES.Length) + 90f; float num2 = num * ((float)Math.PI / 180f); float num3 = Mathf.Cos(num2) * iNNER_DIAMETER; float num4 = Mathf.Sin(num2) * iNNER_DIAMETER; RectTransform component = val2.GetComponent<RectTransform>(); component.anchoredPosition = new Vector2(num3, num4); ((Transform)component).localRotation = Quaternion.identity; Text component2 = val2.GetComponent<Text>(); component2.text = EMOTES[j].name; val2.SetActive(true); itemTexts[j] = component2; ((Graphic)itemTexts[j]).color = NormalColor; } } private void OnEnable() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)highlight.GetComponent<Image>()).color = EmoteWheelReworked.GetHighlightColor; float value = EmoteWheelReworked.GuiScale.Value; ((Transform)((Component)this).GetComponent<RectTransform>()).localScale = new Vector3(value, value, value); Update(); } private void OnDisable() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) highlight.SetActive(false); Image[] componentsInChildren = cursor.GetComponentsInChildren<Image>(true); Image[] array = componentsInChildren; foreach (Image val in array) { ((Graphic)val).color = new Color(0f, 0f, 0f, 0.5f); if (((Object)((Component)val).gameObject).name == "Image") { ((Component)val).gameObject.SetActive(false); } } } private void Update() { //IL_0035: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (Current != previous) { if (previous > -1) { ((Graphic)itemTexts[previous]).color = NormalColor; } if (Current > -1) { ((Graphic)itemTexts[Current]).color = HighlightColor; InventoryGui.instance.m_moveItemEffects.Create(((Component)this).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } previous = Current; } highlight.SetActive(Current > -1); Image[] componentsInChildren = cursor.GetComponentsInChildren<Image>(true); Image[] array = componentsInChildren; foreach (Image val in array) { ((Graphic)val).color = (Color)((Current < 0) ? new Color(0f, 0f, 0f, 0.5f) : EmoteWheelReworked.GetHighlightColor); if (((Object)((Component)val).gameObject).name == "Image") { ((Component)val).gameObject.SetActive(Current > -1); } } cursor.transform.rotation = Quaternion.AngleAxis(Angle, Vector3.forward); float num = (float)Current * (360f / (float)EMOTES.Length); highlight.transform.rotation = Quaternion.AngleAxis(num, Vector3.forward); } } public class Patcher { public static readonly KeyCode[] NUMBERS; [HarmonyPatch(typeof(InventoryGui), "IsVisible")] [HarmonyPostfix] public static void IsVisible_Postfix(ref bool __result) { EmoteWheelReworked.inventoryVisible = __result; __result = __result || EmoteGui.visible; } [HarmonyPatch(typeof(ZInput), "GetJoyLeftStickX")] [HarmonyPostfix] public static void GetJoyLeftStickX_Postfix(ref float __result) { if (EmoteWheelReworked.JoyStickIgnoreTime > 0f) { __result = 0f; } } [HarmonyPatch(typeof(ZInput), "GetJoyLeftStickY")] [HarmonyPostfix] public static void GetJoyLeftStickY_Postfix(ref float __result) { if (EmoteWheelReworked.JoyStickIgnoreTime > 0f) { __result = 0f; } } [HarmonyPatch(typeof(Player), "Awake")] [HarmonyPostfix] public static void Awake_Postfix() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown string text = "EquipGui (" + Assembly.GetExecutingAssembly().GetName().Name + ")"; if (!((Object)(object)Menu.instance == (Object)null) && !Object.op_Implicit((Object)(object)GameObject.Find(text))) { GameObject val = new GameObject(text); EmoteGui emoteGui = val.AddComponent<EmoteGui>(); val.transform.SetParent(((Component)Menu.instance).transform.parent, false); EmoteWheelReworked.Log("Spawned EquipGui!"); } } [HarmonyPatch(typeof(Player), "UseHotbarItem")] [HarmonyPrefix] public static bool UseHotbarItem(int index) { //IL_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references) KeyCode[] nUMBERS = NUMBERS; KeyboardShortcut value = EmoteWheelReworked.Hotkey.Value; bool flag = Array.IndexOf(nUMBERS, ((KeyboardShortcut)(ref value)).MainKey) != index - 1; bool flag2 = !EmoteWheelReworked.IsShortcutDown; return flag || flag2 || !EmoteWheelReworked.CanOpenMenu || ZInput.IsGamepadActive(); } static Patcher() { KeyCode[] array = new KeyCode[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); NUMBERS = (KeyCode[])(object)array; } }