RUMBLE does not support other mod managers. If you want to use a manager, you must use the RUMBLE Mod Manager, a manager specifically designed for this game.
Decompiled source of RumbleHud v1.8.1
Mods/RumbleHud.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Xml.Serialization; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppPhoton.Pun; using Il2CppRUMBLE.Managers; using Il2CppRUMBLE.Players; using Il2CppSystem.Collections.Generic; using Il2CppSystem.IO; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using RumbleHud; using UIFramework; using UIFramework.Models; 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: MelonInfo(typeof(Core), "RumbleHud", "1.8.1", "Kpaiy", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: MelonAdditionalDependencies(new string[] { "UIFramework" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("RumbleHud")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6c36d191c62b1b981264aa17900fddd16dfe7d64")] [assembly: AssemblyProduct("RumbleHud")] [assembly: AssemblyTitle("RumbleHud")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 RumbleHud { public class Core : MelonMod { private PlayerManager playerManager = null; private List<PlayerInfo> playerInfos = null; private string settingsFilePath = "UserData\\RumbleHud.xml"; private string currentScene = "Loader"; private bool roundInProgress = false; public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("RumbleHud: Initialized."); Preferences.InitPrefs(); ((ModModelBase)UI.RegisterMelon((MelonBase)(object)this, (MelonPreferences_Category[])(object)new MelonPreferences_Category[1] { Preferences.RumbleHudCategory })).OnModSaved += Preferences.ApplyPrefs; Preferences.CheckIfXmlMigrated(); } public override void OnApplicationQuit() { ((MelonBase)this).OnApplicationQuit(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { currentScene = sceneName; if (!(sceneName != "Gym")) { Hud.ClearPlayerUi(includeSelfPlayer: true); Hud.ResetRoundTracking(); } } private bool IsHost(int playerCount, string playFabId, PlayerController playerController) { switch (playerCount) { case 1: return false; case 2: { bool isMasterClient = PhotonNetwork.IsMasterClient; bool flag = playFabId == Hud.SelfPlayFabId; return (isMasterClient && flag) || (!isMasterClient && !flag); } default: { object obj; if (playerController == null) { obj = null; } else { GameObject gameObject = ((Component)playerController).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<PhotonView>() : null); } PhotonView val = (PhotonView)obj; if ((Object)(object)val == (Object)null) { return false; } return val.OwnerActorNr == 1; } } } private void CalculateRoundTracking(List<PlayerInfo> playerInfos) { foreach (PlayerInfo playerInfo in playerInfos) { if (playerInfo.HP != 0) { Hud.IncrementRound(playerInfo.PlayFabId); } } } public override void OnUpdate() { if ((Object)(object)playerManager == (Object)null) { GameObject obj = GameObject.Find("Game Instance/Initializable/PlayerManager"); playerManager = ((obj != null) ? obj.GetComponent<PlayerManager>() : null); if ((Object)(object)playerManager == (Object)null) { return; } } if (!Resources.Initialized) { Resources.LoadResources(); } if (!Hud.Initialized) { Hud.Initialize(); } if (!Preferences.LockControls) { if (Input.GetKeyDown((KeyCode)105)) { Hud.ToggleVisible(); } if (Input.GetKeyDown((KeyCode)111)) { switch (Preferences.HostIndicator) { case HostIndicatorOptions.None: Preferences.HostIndicator = HostIndicatorOptions.Text; break; case HostIndicatorOptions.Text: Preferences.HostIndicator = HostIndicatorOptions.Icon; break; case HostIndicatorOptions.Icon: Preferences.HostIndicator = HostIndicatorOptions.Both; break; case HostIndicatorOptions.Both: Preferences.HostIndicator = HostIndicatorOptions.None; break; } } if (Input.GetKeyDown((KeyCode)112)) { Hud.RegeneratePortraits(); } if (Input.GetKeyDown((KeyCode)61)) { Hud.SetScale(Preferences.HudScale += 0.1f); Preferences.HudScale = Preferences.HudScale; } if (Input.GetKeyDown((KeyCode)45)) { Hud.SetScale(Preferences.HudScale -= 0.1f); Preferences.HudScale = Preferences.HudScale; } } PlayerManager obj2 = playerManager; Hud.SetRoundsVisible(obj2 != null && obj2.AllPlayers?.Count == 2 && (currentScene == "Map0" || currentScene == "Map1")); try { List<PlayerInfo> list = new List<PlayerInfo>(); bool flag = true; bool flag2 = false; PlayerManager obj3 = playerManager; Enumerator<Player> val = ((obj3 == null) ? null : obj3.AllPlayers?.GetEnumerator()); if (val == null) { return; } while (val.MoveNext()) { Player current = val.Current; int healthPoints = current.Data.HealthPoints; if (healthPoints == 0) { flag2 = true; } if (healthPoints != 20) { flag = false; } string playFabMasterId = current.Data.GeneralData.PlayFabMasterId; if (playerManager.AllPlayers.Count == 1) { Hud.SelfPlayFabId = playFabMasterId; } bool isHost = IsHost(playerManager.AllPlayers.Count, playFabMasterId, current.Controller); PlayerInfo currentPlayerInfo = new PlayerInfo { PlayFabId = playFabMasterId, Name = current.Data.GeneralData.PublicUsername, BP = current.Data.GeneralData.BattlePoints, HP = current.Data.HealthPoints, ShiftStoneLeft = (ShiftStones)((Il2CppArrayBase<short>)(object)current.Data.EquipedShiftStones)[0], ShiftStoneRight = (ShiftStones)((Il2CppArrayBase<short>)(object)current.Data.EquipedShiftStones)[1], PlayerController = current.Controller, IsHost = isHost }; if (!list.Any((PlayerInfo p) => p.PlayFabId == currentPlayerInfo.PlayFabId)) { list.Add(currentPlayerInfo); } } if (flag) { roundInProgress = true; Hud.ResetRoundsIfWinnerPresent(); } if (flag2) { if (roundInProgress) { CalculateRoundTracking(list); } roundInProgress = false; } playerInfos = list; } catch (Exception) { } try { if (playerInfos.Count != Hud.PlayerUiElementsCount) { Hud.ClearPlayerUi(); if (Preferences.HideSolo) { Hud.SetVisible(playerInfos.Count != 1); } } foreach (PlayerInfo playerInfo in playerInfos) { if (!Hud.PlayerHudExists(playerInfo.PlayFabId)) { Hud.CreatePlayerUi(playerInfo, Hud.PlayerUiElementsCount); ((MelonBase)this).LoggerInstance.Msg("RumbleHud: Created Element for player " + playerInfo.Name + "."); continue; } try { Hud.UpdatePlayerUi(playerInfo); } catch (Exception ex2) { ((MelonBase)this).LoggerInstance.Error((object)ex2); } } } catch (Exception) { } } } internal class Hud { private static GameObject uiContainer = null; private static Canvas canvas = null; private static bool initialized = false; private static readonly int playerControllerLayerMask = LayerMask.NameToLayer("PlayerController"); private const int playerControllerLayer = 8388608; private static Dictionary<string, PlayerUiElements> uiElementsByPlayer = new Dictionary<string, PlayerUiElements>(); private static GameObject previewRenderer = null; private static GameObject previewHead = null; private static bool roundsVisible = false; private const int portraitGenerationTime = -30; public static bool Initialized => initialized; public static int PlayerUiElementsCount => uiElementsByPlayer.Count; public static string SelfPlayFabId { get; set; } public static void Initialize() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!initialized) { uiContainer = new GameObject(); ((Object)uiContainer).name = "RumbleHud_Canvas"; uiContainer.AddComponent<Canvas>(); canvas = uiContainer.GetComponent<Canvas>(); canvas.renderMode = (RenderMode)0; CanvasScaler val = uiContainer.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.referenceResolution = new Vector2(1920f, 1008f); uiContainer.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)uiContainer); Object.DontDestroyOnLoad((Object)(object)canvas); SetVisible(Preferences.IsVisible); initialized = true; } } public static void ToggleVisible() { if (!((Object)(object)uiContainer == (Object)null)) { uiContainer.SetActive(!uiContainer.activeSelf); } } public static void SetVisible(bool visible) { if (!((Object)(object)uiContainer == (Object)null)) { uiContainer.SetActive(visible); } } public static void SetRoundsVisible(bool visible) { roundsVisible = visible; } public static void SetScale(float newScale) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Preferences.HudScale = newScale; foreach (PlayerUiElements value in uiElementsByPlayer.Values) { value.Container.transform.localScale = new Vector3(newScale, newScale, newScale); int num = (int)((float)(value.Position / 2 * 150 * -1) * newScale); RectTransform component = ((Component)value.Background).GetComponent<RectTransform>(); if (value.IsRightAligned) { component.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, (float)(-50 + num), 0f)); } else { component.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, (float)(-50 + num), 0f)); } } } public static void LoadPreviewCharacter() { previewHead = GameObject.Find("--------------LOGIC--------------/Dressing Room/Preview Player Controller/Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Neck/Bone_Head"); previewRenderer = GameObject.Find("--------------LOGIC--------------/Dressing Room/Preview Player Controller/Visuals/Renderer"); if ((Object)(object)previewRenderer != (Object)null && previewRenderer.layer != playerControllerLayerMask) { previewRenderer.layer = playerControllerLayerMask; } } public static bool PlayerHudExists(string playFabId) { return uiElementsByPlayer.ContainsKey(playFabId); } public static void IncrementRound(string playFabId) { if (PlayerHudExists(playFabId)) { uiElementsByPlayer[playFabId].RoundsWon++; } } public static void ResetRoundTracking() { foreach (KeyValuePair<string, PlayerUiElements> item in uiElementsByPlayer) { item.Value.RoundsWon = 0; } } public static void ResetRoundsIfWinnerPresent() { bool flag = false; foreach (KeyValuePair<string, PlayerUiElements> item in uiElementsByPlayer) { if (item.Value.RoundsWon == 2) { flag = true; } } if (flag) { ResetRoundTracking(); } } public static void CreatePlayerUi(PlayerInfo playerInfo, int position) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Expected O, but got Unknown //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Expected O, but got Unknown //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Expected O, but got Unknown //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Expected O, but got Unknown //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_09a3: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_09c6: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Expected O, but got Unknown //IL_0a17: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0a7d: Unknown result type (might be due to invalid IL or missing references) //IL_0b0e: Unknown result type (might be due to invalid IL or missing references) //IL_0b25: Unknown result type (might be due to invalid IL or missing references) //IL_0b3c: Unknown result type (might be due to invalid IL or missing references) //IL_0b53: Unknown result type (might be due to invalid IL or missing references) //IL_0b58: Unknown result type (might be due to invalid IL or missing references) //IL_0a9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ab3: Unknown result type (might be due to invalid IL or missing references) //IL_0aca: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0b7a: Unknown result type (might be due to invalid IL or missing references) //IL_0b81: Expected O, but got Unknown //IL_0bdc: Unknown result type (might be due to invalid IL or missing references) //IL_0c5b: Unknown result type (might be due to invalid IL or missing references) //IL_0c72: Unknown result type (might be due to invalid IL or missing references) //IL_0c89: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Unknown result type (might be due to invalid IL or missing references) //IL_0c12: Unknown result type (might be due to invalid IL or missing references) //IL_0c29: Unknown result type (might be due to invalid IL or missing references) //IL_0c40: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) //IL_0cbc: Expected O, but got Unknown //IL_0d17: Unknown result type (might be due to invalid IL or missing references) //IL_0d96: Unknown result type (might be due to invalid IL or missing references) //IL_0dad: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_0d36: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) //IL_0d64: Unknown result type (might be due to invalid IL or missing references) //IL_0d7b: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0dee: Expected O, but got Unknown //IL_0e49: Unknown result type (might be due to invalid IL or missing references) //IL_0ec8: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Unknown result type (might be due to invalid IL or missing references) //IL_0ef6: Unknown result type (might be due to invalid IL or missing references) //IL_0f0d: Unknown result type (might be due to invalid IL or missing references) //IL_0e68: Unknown result type (might be due to invalid IL or missing references) //IL_0e7f: Unknown result type (might be due to invalid IL or missing references) //IL_0e96: Unknown result type (might be due to invalid IL or missing references) //IL_0ead: Unknown result type (might be due to invalid IL or missing references) //IL_0f1f: Unknown result type (might be due to invalid IL or missing references) //IL_0f26: Expected O, but got Unknown //IL_0f2e: Unknown result type (might be due to invalid IL or missing references) //IL_0f35: Expected O, but got Unknown //IL_0f90: Unknown result type (might be due to invalid IL or missing references) //IL_0f97: Expected O, but got Unknown //IL_0fef: Unknown result type (might be due to invalid IL or missing references) //IL_106e: Unknown result type (might be due to invalid IL or missing references) //IL_1085: Unknown result type (might be due to invalid IL or missing references) //IL_109c: Unknown result type (might be due to invalid IL or missing references) //IL_10b3: Unknown result type (might be due to invalid IL or missing references) //IL_100e: Unknown result type (might be due to invalid IL or missing references) //IL_1025: Unknown result type (might be due to invalid IL or missing references) //IL_103c: Unknown result type (might be due to invalid IL or missing references) //IL_1053: Unknown result type (might be due to invalid IL or missing references) //IL_10d2: Unknown result type (might be due to invalid IL or missing references) bool flag = position % 2 == 1; int num = (int)((float)(position / 2 * 150 * -1) * Preferences.HudScale); GameObject val = new GameObject(); val.transform.parent = uiContainer.transform; ((Object)val).name = "RumbleHud_" + playerInfo.PlayFabId + "_background"; RawImage val2 = val.AddComponent<RawImage>(); val2.texture = (Texture)(object)Resources.BackgroundTexture; ((Graphic)val2).SetNativeSize(); RectTransform component = ((Component)val2).GetComponent<RectTransform>(); if (flag) { component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(1f, 1f); component.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, (float)(-50 + num), 0f)); val2.uvRect = new Rect(0f, 0f, -1f, 1f); } else { component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 1f); component.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, (float)(-50 + num), 0f)); } GameObject val3 = new GameObject(); val3.transform.parent = val.transform; ((Object)val3).name = "RumbleHud_" + playerInfo.PlayFabId + "_name"; TextMeshProUGUI val4 = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val4).font = Resources.TmpFont; ((TMP_Text)val4).text = playerInfo.Name; RectTransform component2 = ((Component)val4).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(300f, 50f); ((TMP_Text)val4).enableAutoSizing = true; ((TMP_Text)val4).fontSizeMax = 42f; ((TMP_Text)val4).fontSizeMin = 16f; if (flag) { component2.anchorMin = new Vector2(1f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(1f, 1f); component2.anchoredPosition = Vector2.op_Implicit(new Vector3(-100f, -10f)); ((TMP_Text)val4).alignment = (TextAlignmentOptions)260; } else { component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(0f, 1f); component2.pivot = new Vector2(0f, 1f); component2.anchoredPosition = Vector2.op_Implicit(new Vector3(100f, -10f)); ((TMP_Text)val4).alignment = (TextAlignmentOptions)257; } GameObject val5 = new GameObject(); val5.transform.parent = val.transform; ((Object)val5).name = "RumbleHud_" + playerInfo.PlayFabId + "_bp"; TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>(); ((Graphic)val6).color = new Color(0.9843137f, 1f, 0.56078434f); ((TMP_Text)val6).font = Resources.TmpFont; ((TMP_Text)val6).text = $"{playerInfo.BP} BP"; ((TMP_Text)val6).enableAutoSizing = true; ((TMP_Text)val6).fontSizeMax = 36f; ((TMP_Text)val6).fontSizeMin = 16f; RectTransform component3 = ((Component)val6).GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(125f, 50f); if (flag) { component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(0f, 1f); component3.pivot = new Vector2(0f, 1f); component3.anchoredPosition = Vector2.op_Implicit(new Vector3(25f, -10f)); ((TMP_Text)val6).alignment = (TextAlignmentOptions)257; } else { component3.anchorMin = new Vector2(1f, 1f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(1f, 1f); component3.anchoredPosition = Vector2.op_Implicit(new Vector3(-25f, -10f)); ((TMP_Text)val6).alignment = (TextAlignmentOptions)260; } GameObject val7 = new GameObject(); val7.transform.parent = val.transform; ((Object)val7).name = "RumbleHud_" + playerInfo.PlayFabId + "_healthBackground"; Image val8 = val7.AddComponent<Image>(); ((Graphic)val8).color = Resources.HealthFull; RectTransform component4 = ((Component)val8).GetComponent<RectTransform>(); component4.sizeDelta = new Vector2(340f, 10f); if (flag) { component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = new Vector2(0f, 0f); component4.pivot = new Vector2(0f, 0f); component4.anchoredPosition = new Vector2(25f, 20f); } else { component4.anchorMin = new Vector2(1f, 0f); component4.anchorMax = new Vector2(1f, 0f); component4.pivot = new Vector2(1f, 0f); component4.anchoredPosition = new Vector2(-25f, 20f); } GameObject val9 = new GameObject(); val9.transform.parent = val7.transform; ((Object)val9).name = "RumbleHud_" + playerInfo.PlayFabId + "_healthPips"; RawImage val10 = val9.AddComponent<RawImage>(); val10.texture = (Texture)(object)Resources.HealthPipsTexture; val10.uvRect = new Rect(0f, 0f, 20f, 1f); RectTransform component5 = ((Component)val10).GetComponent<RectTransform>(); component5.sizeDelta = new Vector2((float)(((Texture)Resources.HealthPipsTexture).width * 20), (float)((Texture)Resources.HealthPipsTexture).height); if (flag) { component5.anchorMin = new Vector2(1f, 0.5f); component5.anchorMax = new Vector2(1f, 0.5f); component5.pivot = new Vector2(1f, 0.5f); component5.anchoredPosition = new Vector2(0f, 0f); } else { component5.anchorMin = new Vector2(0f, 0.5f); component5.anchorMax = new Vector2(0f, 0.5f); component5.pivot = new Vector2(0f, 0.5f); component5.anchoredPosition = new Vector2(0f, 0f); } GameObject val11 = new GameObject(); val11.transform.parent = val.transform; ((Object)val11).name = "RumbleHud_" + playerInfo.PlayFabId + "_leftShiftStone"; RawImage val12 = val11.AddComponent<RawImage>(); val12.texture = (Texture)(object)Resources.GetShiftStoneTexture(playerInfo.ShiftStoneLeft); RectTransform component6 = val11.GetComponent<RectTransform>(); component6.sizeDelta = new Vector2(35f, 35f); if (flag) { component6.anchorMin = new Vector2(1f, 0f); component6.anchorMax = new Vector2(1f, 0f); component6.pivot = new Vector2(1f, 0f); component6.anchoredPosition = new Vector2(-140f, 10f); } else { component6.anchorMin = new Vector2(0f, 0f); component6.anchorMax = new Vector2(0f, 0f); component6.pivot = new Vector2(0f, 0f); component6.anchoredPosition = new Vector2(95f, 10f); } GameObject val13 = new GameObject(); val13.transform.parent = val.transform; ((Object)val13).name = "RumbleHud_" + playerInfo.PlayFabId + "_rightShiftStone"; RawImage val14 = val13.AddComponent<RawImage>(); val14.texture = (Texture)(object)Resources.GetShiftStoneTexture(playerInfo.ShiftStoneRight); RectTransform component7 = val13.GetComponent<RectTransform>(); component7.sizeDelta = new Vector2(35f, 35f); if (flag) { component7.anchorMin = new Vector2(1f, 0f); component7.anchorMax = new Vector2(1f, 0f); component7.pivot = new Vector2(1f, 0f); component7.anchoredPosition = new Vector2(-95f, 10f); } else { component7.anchorMin = new Vector2(0f, 0f); component7.anchorMax = new Vector2(0f, 0f); component7.pivot = new Vector2(0f, 0f); component7.anchoredPosition = new Vector2(140f, 10f); } GameObject val15 = new GameObject(); val15.transform.parent = val.transform; ((Object)val15).name = "RumbleHud_" + playerInfo.PlayFabId + "_hostText"; TextMeshProUGUI val16 = val15.AddComponent<TextMeshProUGUI>(); ((Graphic)val16).color = new Color(0.9843137f, 1f, 0.56078434f); ((TMP_Text)val16).font = Resources.TmpFont; ((TMP_Text)val16).text = "Host"; ((TMP_Text)val16).SetOutlineColor(Color32.op_Implicit(Color.black)); ((TMP_Text)val16).SetOutlineThickness(0.2f); ((TMP_Text)val16).fontSize = 50f; RectTransform component8 = ((Component)val16).GetComponent<RectTransform>(); component8.sizeDelta = new Vector2(125f, 50f); if (flag) { component8.anchorMin = new Vector2(1f, 1f); component8.anchorMax = new Vector2(1f, 1f); component8.pivot = new Vector2(1f, 0f); component8.anchoredPosition = Vector2.op_Implicit(new Vector3(-10f, -10f)); ((TMP_Text)val16).alignment = (TextAlignmentOptions)1028; } else { component8.anchorMin = new Vector2(0f, 1f); component8.anchorMax = new Vector2(0f, 1f); component8.pivot = new Vector2(0f, 0f); component8.anchoredPosition = Vector2.op_Implicit(new Vector3(10f, -10f)); ((TMP_Text)val16).alignment = (TextAlignmentOptions)1025; } val15.SetActive(false); GameObject val17 = new GameObject(); val17.transform.parent = val.transform; ((Object)val17).name = "RumbleHud_" + playerInfo.PlayFabId + "_hostIcon"; RawImage val18 = val17.AddComponent<RawImage>(); val18.texture = (Texture)(object)Resources.HostIconTexture; RectTransform component9 = val17.GetComponent<RectTransform>(); component9.sizeDelta = new Vector2(50f, 50f); if (flag) { component9.anchorMin = new Vector2(0f, 1f); component9.anchorMax = new Vector2(0f, 1f); component9.pivot = new Vector2(1f, 1f); component9.anchoredPosition = new Vector2(0f, -15f); } else { component9.anchorMin = new Vector2(1f, 1f); component9.anchorMax = new Vector2(1f, 1f); component9.pivot = new Vector2(0f, 1f); component9.anchoredPosition = new Vector2(0f, -15f); } val17.active = false; GameObject val19 = new GameObject(); val19.transform.parent = val.transform; ((Object)val19).name = "RumbleHud_" + playerInfo.PlayFabId + "_firstRound"; RawImage val20 = val19.AddComponent<RawImage>(); val20.texture = (Texture)(object)Resources.RoundEmptyTexture; RectTransform component10 = val19.GetComponent<RectTransform>(); component10.sizeDelta = new Vector2(40f, 40f); if (flag) { component10.anchorMin = new Vector2(1f, 0f); component10.anchorMax = new Vector2(1f, 0f); component10.pivot = new Vector2(1f, 1f); component10.anchoredPosition = new Vector2(-100f, -3f); } else { component10.anchorMin = new Vector2(0f, 0f); component10.anchorMax = new Vector2(0f, 0f); component10.pivot = new Vector2(0f, 1f); component10.anchoredPosition = new Vector2(100f, -3f); } GameObject val21 = new GameObject(); val21.transform.parent = val.transform; ((Object)val21).name = "RumbleHud_" + playerInfo.PlayFabId + "_secondRound"; RawImage val22 = val21.AddComponent<RawImage>(); val22.texture = (Texture)(object)Resources.RoundEmptyTexture; RectTransform component11 = val21.GetComponent<RectTransform>(); component11.sizeDelta = new Vector2(40f, 40f); if (flag) { component11.anchorMin = new Vector2(1f, 0f); component11.anchorMax = new Vector2(1f, 0f); component11.pivot = new Vector2(1f, 1f); component11.anchoredPosition = new Vector2(-150f, -3f); } else { component11.anchorMin = new Vector2(0f, 0f); component11.anchorMax = new Vector2(0f, 0f); component11.pivot = new Vector2(0f, 1f); component11.anchoredPosition = new Vector2(150f, -3f); } RenderTexture val23 = new RenderTexture(100, 100, 16); val23.Create(); GameObject val24 = new GameObject(); ((Object)val24).name = "RumbleHud_" + playerInfo.PlayFabId + "_portraitCamera"; Camera val25 = val24.AddComponent<Camera>(); val25.targetTexture = val23; val25.fieldOfView = 50f; val25.cullingMask = 8388608; val25.clearFlags = (CameraClearFlags)3; Object.DontDestroyOnLoad((Object)(object)val24); GameObject val26 = new GameObject(); ((Object)val26).name = "RumbleHud_" + playerInfo.PlayFabId + "_portrait"; RawImage val27 = val26.AddComponent<RawImage>(); ((Component)val27).transform.parent = val.transform; val27.texture = (Texture)(object)val23; RectTransform component12 = ((Component)val27).GetComponent<RectTransform>(); component12.sizeDelta = new Vector2(100f, 100f); if (flag) { component12.anchorMin = new Vector2(1f, 1f); component12.anchorMax = new Vector2(1f, 1f); component12.pivot = new Vector2(1f, 1f); component12.anchoredPosition = new Vector2(0f, 0f); } else { component12.anchorMin = new Vector2(0f, 1f); component12.anchorMax = new Vector2(0f, 1f); component12.pivot = new Vector2(0f, 1f); component12.anchoredPosition = new Vector2(0f, 0f); } float hudScale = Preferences.HudScale; val.transform.localScale = new Vector3(hudScale, hudScale, hudScale); uiElementsByPlayer[playerInfo.PlayFabId] = new PlayerUiElements { Container = val, Background = val2, Name = val4, BP = val6, HealthBar = val8, HealthPips = val10, ShiftStoneLeft = val12, ShiftStoneRight = val14, HostText = val16, HostIcon = val18, HeadshotCamera = val25, RenderTexture = val23, Portrait = val27, PortraitGenerated = -30, IsRightAligned = flag, PlayFabId = playerInfo.PlayFabId, Position = position, FirstRoundObject = val19, SecondRoundObject = val21, FirstRound = val20, SecondRound = val22, RoundsWon = 0 }; } public static void UpdatePlayerUi(PlayerInfo playerInfo) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00a4: 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) PlayerUiElements playerUiElements = uiElementsByPlayer[playerInfo.PlayFabId]; if (playerUiElements == null) { return; } ((TMP_Text)playerUiElements.BP).text = $"{playerInfo.BP} BP"; Color color = Resources.HealthFull; if (playerInfo.HP < 20) { color = Resources.HealthHigh; } if (playerInfo.HP <= 10) { color = Resources.HealthMedium; } if (playerInfo.HP <= 5) { color = Resources.HealthLow; } ((Graphic)playerUiElements.HealthBar).color = color; RectTransform component = ((Component)playerUiElements.HealthPips).GetComponent<RectTransform>(); playerUiElements.HealthPips.uvRect = new Rect(0f, 0f, (float)playerInfo.HP, 1f); component.sizeDelta = new Vector2((float)(((Texture)Resources.HealthPipsTexture).width * playerInfo.HP), (float)((Texture)Resources.HealthPipsTexture).height); playerUiElements.FirstRoundObject.SetActive(roundsVisible); playerUiElements.SecondRoundObject.SetActive(roundsVisible); if (roundsVisible) { int roundsWon = playerUiElements.RoundsWon; playerUiElements.FirstRound.texture = (Texture)(object)Resources.GetRoundTexture(roundsWon >= 1); playerUiElements.SecondRound.texture = (Texture)(object)Resources.GetRoundTexture(roundsWon >= 2); } Texture2D shiftStoneTexture = Resources.GetShiftStoneTexture(playerInfo.ShiftStoneLeft); Texture2D shiftStoneTexture2 = Resources.GetShiftStoneTexture(playerInfo.ShiftStoneRight); playerUiElements.ShiftStoneLeft.texture = (Texture)(object)shiftStoneTexture; playerUiElements.ShiftStoneRight.texture = (Texture)(object)shiftStoneTexture2; ((Component)playerUiElements.HostText).gameObject.active = playerInfo.IsHost && (Preferences.HostIndicator == HostIndicatorOptions.Text || Preferences.HostIndicator == HostIndicatorOptions.Both); ((Component)playerUiElements.HostIcon).gameObject.active = playerInfo.IsHost && (Preferences.HostIndicator == HostIndicatorOptions.Icon || Preferences.HostIndicator == HostIndicatorOptions.Both); if (Preferences.LivePortraits && !((Component)playerUiElements.HeadshotCamera).gameObject.active) { ((Component)playerUiElements.HeadshotCamera).gameObject.SetActive(true); } else if (playerUiElements.PortraitGenerated > 0) { ((Component)playerUiElements.HeadshotCamera).gameObject.SetActive(false); } if (playerUiElements.PortraitGenerated > 0 && !Preferences.LivePortraits) { return; } GameObject playerHead = GetPlayerHead(playerInfo.PlayFabId, playerInfo.PlayerController); GameObject playerVisuals = GetPlayerVisuals(playerInfo.PlayFabId, playerInfo.PlayerController); if ((Object)(object)playerHead != (Object)null) { PointCamera(playerUiElements.HeadshotCamera, playerHead, playerVisuals, playerUiElements.IsRightAligned); if (!Preferences.LivePortraits) { playerUiElements.PortraitGenerated++; } } } private static GameObject GetPlayerHead(string playFabId, PlayerController playerController) { if ((Object)(object)playerController == (Object)null) { return null; } GameObject gameObject = ((Component)playerController).gameObject; if (!gameObject.active) { return null; } object obj; if (gameObject == null) { obj = null; } else { Transform transform = gameObject.transform; if (transform == null) { obj = null; } else { Transform child = transform.GetChild(1); if (child == null) { obj = null; } else { Transform child2 = child.GetChild(0); obj = ((child2 != null) ? ((Component)child2).GetComponent<SkinnedMeshRenderer>() : null); } } } SkinnedMeshRenderer val = (SkinnedMeshRenderer)obj; if ((Object)(object)val == (Object)null) { return null; } if (!((Renderer)val).isVisible || !((Renderer)val).enabled) { return null; } object obj2; if (gameObject == null) { obj2 = null; } else { Transform transform2 = gameObject.transform; if (transform2 == null) { obj2 = null; } else { Transform child3 = transform2.GetChild(1); if (child3 == null) { obj2 = null; } else { Transform child4 = child3.GetChild(1); if (child4 == null) { obj2 = null; } else { Transform child5 = child4.GetChild(0); if (child5 == null) { obj2 = null; } else { Transform child6 = child5.GetChild(4); if (child6 == null) { obj2 = null; } else { Transform child7 = child6.GetChild(0); if (child7 == null) { obj2 = null; } else { Transform child8 = child7.GetChild(0); obj2 = ((child8 != null) ? child8.GetChild(0) : null); } } } } } } } Transform val2 = (Transform)obj2; return (val2 != null) ? ((Component)val2).gameObject : null; } private static GameObject GetPlayerVisuals(string playFabId, PlayerController playerController) { if ((Object)(object)playerController == (Object)null) { return null; } GameObject gameObject = ((Component)playerController).gameObject; if (!gameObject.active) { return null; } object result; if (gameObject == null) { result = null; } else { Transform transform = gameObject.transform; result = ((transform != null) ? ((Component)transform.GetChild(1)).gameObject : null); } return (GameObject)result; } private static void PointCamera(Camera camera, GameObject head, GameObject visuals, bool facingLeft) { //IL_000d: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) ((Component)camera).transform.position = head.transform.position; Transform transform = ((Component)camera).transform; Quaternion rotation = visuals.transform.rotation; transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f); Transform transform2 = ((Component)camera).transform; transform2.position += ((Component)camera).transform.forward * 0.5f; ((Component)camera).transform.Rotate(0f, 180f, 0f); ((Component)camera).transform.RotateAround(head.transform.position, ((Component)camera).transform.up, (float)(facingLeft ? (-30) : 30)); } public static void RegeneratePortraits() { foreach (PlayerUiElements value in uiElementsByPlayer.Values) { value.PortraitGenerated = -30; ((Component)value.HeadshotCamera).gameObject.SetActive(true); } } public static void ClearPlayerUi(bool includeSelfPlayer = false) { foreach (PlayerUiElements value in uiElementsByPlayer.Values) { Object.Destroy((Object)(object)value.Container); value.HeadshotCamera.targetTexture = null; Object.Destroy((Object)(object)((Component)value.HeadshotCamera).gameObject); uiElementsByPlayer.Remove(value.PlayFabId); } } } internal class PlayerInfo { public string PlayFabId { get; set; } public string Name { get; set; } public int BP { get; set; } public int HP { get; set; } public ShiftStones ShiftStoneLeft { get; set; } public ShiftStones ShiftStoneRight { get; set; } public PlayerController PlayerController { get; set; } public bool IsHost { get; set; } } internal class PlayerUiElements { public GameObject Container { get; set; } public RawImage Background { get; set; } public TextMeshProUGUI Name { get; set; } public TextMeshProUGUI BP { get; set; } public Image HealthBar { get; set; } public RawImage HealthPips { get; set; } public RawImage ShiftStoneLeft { get; set; } public RawImage ShiftStoneRight { get; set; } public TextMeshProUGUI HostText { get; set; } public RawImage HostIcon { get; set; } public Camera HeadshotCamera { get; set; } public RenderTexture RenderTexture { get; set; } public RawImage Portrait { get; set; } public int PortraitGenerated { get; set; } public bool IsRightAligned { get; set; } public string PlayFabId { get; set; } public int Position { get; set; } public GameObject FirstRoundObject { get; set; } public GameObject SecondRoundObject { get; set; } public RawImage FirstRound { get; set; } public RawImage SecondRound { get; set; } public int RoundsWon { get; set; } } internal class Resources { private static AssetBundle bundle; private static TMP_FontAsset tmpFont; private static Texture2D backgroundTexture = null; private static Texture2D healthPipsTexture = null; private static Texture2D hostIconTexture = null; private static Texture2D roundWonTexture = null; private static Texture2D roundEmptyTexture = null; private static Dictionary<ShiftStones, Texture2D> shiftStoneTextures = new Dictionary<ShiftStones, Texture2D>(); private static Dictionary<ShiftStones, string> shiftStoneResourceNames = new Dictionary<ShiftStones, string> { { ShiftStones.Empty, "ss_empty" }, { ShiftStones.Adamant, "ss_adamant" }, { ShiftStones.Charge, "ss_charge" }, { ShiftStones.Flow, "ss_flow" }, { ShiftStones.Guard, "ss_guard" }, { ShiftStones.Stubborn, "ss_stubborn" }, { ShiftStones.Surge, "ss_surge" }, { ShiftStones.Vigor, "ss_vigor" }, { ShiftStones.Volatile, "ss_volatile" } }; private static bool initialized = false; public static readonly Color HealthLow = new Color(0.5921569f, 0.2901961f, 23f / 85f); public static readonly Color HealthMedium = new Color(0.54509807f, 44f / 85f, 22f / 85f); public static readonly Color HealthHigh = new Color(32f / 85f, 0.5568628f, 0.3254902f); public static readonly Color HealthFull = new Color(0.4862745f, 0.5882353f, 57f / 85f); public static bool Initialized => initialized; public static TMP_FontAsset TmpFont => tmpFont; public static Texture2D BackgroundTexture => backgroundTexture; public static Texture2D HealthPipsTexture => healthPipsTexture; public static Texture2D HostIconTexture => hostIconTexture; public static Texture2D RoundWonTexture => roundWonTexture; public static Texture2D RoundEmptyTexture => roundEmptyTexture; private static void LoadShiftStoneTexture(ShiftStones shiftStone) { string text = shiftStoneResourceNames[shiftStone]; Texture2D val = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>(text)); ((Object)val).name = $"RumbleHud_{shiftStone}"; shiftStoneTextures[shiftStone] = val; Object.DontDestroyOnLoad((Object)(object)val); } public static void LoadResources(bool reload = false) { if (!initialized || reload) { bundle = LoadBundleFromFile("UserData/rumblehud"); tmpFont = Object.Instantiate<TMP_FontAsset>(bundle.LoadAsset<TMP_FontAsset>("TMP_GoodDogPlain")); backgroundTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("PlayerBackground")); ((Object)backgroundTexture).name = "RumbleHud_BackgroundTexture"; healthPipsTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("HealthPip")); ((Object)healthPipsTexture).name = "RumbleHud_HealthPipTexture"; hostIconTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("HostIcon")); ((Object)hostIconTexture).name = "RumbleHud_HostIconTexture"; roundWonTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("RoundWon")); ((Object)roundWonTexture).name = "RumbleHud_RoundWonTexture"; roundEmptyTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("RoundEmpty")); ((Object)roundEmptyTexture).name = "RumbleHud_RoundEmptyTexture"; LoadShiftStoneTexture(ShiftStones.Empty); LoadShiftStoneTexture(ShiftStones.Adamant); LoadShiftStoneTexture(ShiftStones.Charge); LoadShiftStoneTexture(ShiftStones.Flow); LoadShiftStoneTexture(ShiftStones.Guard); LoadShiftStoneTexture(ShiftStones.Stubborn); LoadShiftStoneTexture(ShiftStones.Surge); LoadShiftStoneTexture(ShiftStones.Vigor); LoadShiftStoneTexture(ShiftStones.Volatile); Object.DontDestroyOnLoad((Object)(object)backgroundTexture); Object.DontDestroyOnLoad((Object)(object)healthPipsTexture); Object.DontDestroyOnLoad((Object)(object)hostIconTexture); Object.DontDestroyOnLoad((Object)(object)roundWonTexture); Object.DontDestroyOnLoad((Object)(object)roundEmptyTexture); initialized = true; } } public static Texture2D GetShiftStoneTexture(ShiftStones shiftStone) { if ((Object)(object)shiftStoneTextures[shiftStone] == (Object)null) { LoadShiftStoneTexture(shiftStone); } return shiftStoneTextures[shiftStone]; } public static Texture2D GetRoundTexture(bool won) { if (won) { if ((Object)(object)roundWonTexture == (Object)null) { roundWonTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("RoundWon")); ((Object)roundWonTexture).name = "RumbleHud_RoundWonTexture"; Object.DontDestroyOnLoad((Object)(object)roundWonTexture); } return roundWonTexture; } if ((Object)(object)roundEmptyTexture == (Object)null) { roundEmptyTexture = Object.Instantiate<Texture2D>(bundle.LoadAsset<Texture2D>("RoundEmpty")); ((Object)roundEmptyTexture).name = "RumbleHud_RoundEmptyTexture"; Object.DontDestroyOnLoad((Object)(object)roundWonTexture); } return roundEmptyTexture; } private static AssetBundle LoadBundleFromFile(string path) { Stream stream = StreamFromFile(path); Stream val = ConvertToIl2CppStream(stream); AssetBundle result = AssetBundle.LoadFromStream(val); stream.Close(); val.Close(); return result; } private static Stream ConvertToIl2CppStream(Stream stream) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown MemoryStream val = new MemoryStream(); byte[] array = new byte[4096]; Il2CppStructArray<byte> val2 = new Il2CppStructArray<byte>(array); int num; while ((num = stream.Read(array, 0, array.Length)) > 0) { val2 = Il2CppStructArray<byte>.op_Implicit(array); ((Stream)val).Write(val2, 0, num); } ((Stream)val).Flush(); return (Stream)(object)val; } private static MemoryStream StreamFromFile(string path) { byte[] buffer = File.ReadAllBytes(path); return new MemoryStream(buffer); } } public enum HostIndicatorOptions { [Display(Name = "No Host Indicator")] None, Text, Icon, [Display(Name = "Text and Icon")] Both } public class Settings { private static Settings Instance { get; set; } public float HudScale { get; set; } public HostIndicatorOptions HostIndicator { get; set; } public bool HideSolo { get; set; } public bool LockControls { get; set; } public static Settings FromJson(string jsonString) { return JsonUtility.FromJson<Settings>(jsonString); } public static Settings Initialize() { return Instance = new Settings { HudScale = 1f, HostIndicator = HostIndicatorOptions.Text, HideSolo = false, LockControls = false }; } public static Settings FromXmlFile(string filePath) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(Settings)); using FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); return Instance = (Settings)xmlSerializer.Deserialize(stream); } public void ToXmlFile(string filePath) { using StreamWriter streamWriter = new StreamWriter(filePath); XmlSerializer xmlSerializer = new XmlSerializer(GetType()); xmlSerializer.Serialize(streamWriter, this); streamWriter.Flush(); } } internal static class Preferences { private const string CONFIG_FILE = "config.cfg"; private const string USER_DATA = "UserData/RumbleHudData/"; internal static MelonPreferences_Category RumbleHudCategory; private static MelonPreferences_Entry<bool> PrefIsVisible; private static MelonPreferences_Entry<float> PrefHudScale; private static MelonPreferences_Entry<HostIndicatorOptions> PrefHostIndicator; private static MelonPreferences_Entry<bool> PrefHideSolo; private static MelonPreferences_Entry<bool> PrefLockControls; private static MelonPreferences_Entry<bool> PrefLivePortraits; private static MelonPreferences_Category HiddenCategory; private static MelonPreferences_Entry<bool> XmlMigrated; public static bool IsVisible { get { return PrefIsVisible.Value; } set { PrefIsVisible.Value = value; } } public static float HudScale { get { return PrefHudScale.Value; } set { PrefHudScale.Value = value; } } public static HostIndicatorOptions HostIndicator { get { return PrefHostIndicator.Value; } set { PrefHostIndicator.Value = value; } } public static bool HideSolo { get { return PrefHideSolo.Value; } set { PrefHideSolo.Value = value; } } public static bool LockControls { get { return PrefLockControls.Value; } set { PrefLockControls.Value = value; } } public static bool LivePortraits { get { return PrefLivePortraits.Value; } set { PrefLivePortraits.Value = value; } } internal static void InitPrefs() { if (!Directory.Exists("UserData/RumbleHudData/")) { Directory.CreateDirectory("UserData/RumbleHudData/"); } RumbleHudCategory = MelonPreferences.CreateCategory("RumbleHUD", "Rumble HUD"); RumbleHudCategory.SetFilePath(Path.Combine("UserData/RumbleHudData/", "config.cfg")); PrefIsVisible = RumbleHudCategory.CreateEntry<bool>("HudIsVisible", true, "Display Hud", "Display or hide HUD", false, false, (ValueValidator)null, (string)null); PrefHudScale = RumbleHudCategory.CreateEntry<float>("HudScale", 1f, "Hud Scale", "The size of the HUD. Keep it strictly positive. Control in-game using - and =.", false, false, (ValueValidator)null, (string)null); PrefHostIndicator = RumbleHudCategory.CreateEntry<HostIndicatorOptions>("HostIndicator", HostIndicatorOptions.Text, "Host Indicator", "How to indicate who is host on the HUD. Cycle in-game using O.", false, false, (ValueValidator)null, (string)null); PrefHideSolo = RumbleHudCategory.CreateEntry<bool>("HideSolo", false, "Hide Solo", "Whether to auto-hide the HUD when you are the only player.", false, false, (ValueValidator)null, (string)null); PrefLockControls = RumbleHudCategory.CreateEntry<bool>("LockControls", false, "Lock Controls", "When this is true, keyboard controls are disabled, preventing accidental changes.", false, false, (ValueValidator)null, (string)null); PrefLivePortraits = RumbleHudCategory.CreateEntry<bool>("LivePortraits", false, "Live Portraits", "[DEMANDING] When this is enabled, portraits are a live feed of the player. This may impact game performance.", false, false, (ValueValidator)null, (string)null); HiddenCategory = MelonPreferences.CreateCategory("HiddenCategory", "Hidden Category"); HiddenCategory.SetFilePath(Path.Combine("UserData/RumbleHudData/", "config.cfg")); XmlMigrated = HiddenCategory.CreateEntry<bool>("XmlMigrated", false, "XML Settings Migrated", "For initial migration into MelonPreferences. Setting to false would look for the XML file and apply the settings to the preferences", false, false, (ValueValidator)null, (string)null); ApplyPrefs(); } internal static void CheckIfXmlMigrated() { if (XmlMigrated.Value) { return; } if (!File.Exists("UserData\\RumbleHud.xml")) { XmlMigrated.Value = true; return; } try { Melon<Core>.Logger.Msg("Not previously migrated from XML. Attempting migration"); Settings settings = Settings.FromXmlFile("UserData\\RumbleHud.xml"); PrefHudScale.Value = settings.HudScale; PrefHostIndicator.Value = settings.HostIndicator; PrefHideSolo.Value = settings.HideSolo; PrefLockControls.Value = settings.LockControls; ApplyPrefs(); XmlMigrated.Value = true; File.Delete("UserData\\RumbleHud.xml"); } catch (Exception ex) { Melon<Core>.Logger.Msg("Error in XML to Melonpreferences migration attempt: " + ex.Message); } } internal static void ApplyPrefs() { Hud.SetVisible(PrefIsVisible.Value); Hud.SetScale(PrefHudScale.Value); Hud.ClearPlayerUi(); } } internal enum ShiftStones { Empty = -1, Adamant, Charge, Flow, Guard, Stubborn, Surge, Vigor, Volatile } }