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 Mita Menu v1.0.3
BepInEx\plugins\Empress-MiSideMenuScene\EmpressMiSideMenuScene.dll
Decompiled 2 days 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.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+5f1b735e473ca4ccf3b383128fbebd889cb564da")] [assembly: AssemblyProduct("EmpressMiSideMenuScene")] [assembly: AssemblyTitle("EmpressMiSideMenuScene")] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EmpressMiSideMenuScene { [BepInPlugin("empress.repo.misidemenuscene", "Empress MiSide Menu Scene", "1.0.2")] public sealed class EmpressMiSideMenuScenePlugin : BaseUnityPlugin { internal const string EmpressPluginGuid = "empress.repo.misidemenuscene"; internal const string EmpressPluginName = "Empress MiSide Menu Scene"; internal const string EmpressPluginVersion = "1.0.2"; internal ConfigEntry<bool> EmpressEnabled; internal ConfigEntry<int> EmpressMusicVolume; private Harmony? _empressHarmony; private EmpressMiSideMenuRuntime? _empressRuntime; internal static EmpressMiSideMenuScenePlugin? Instance { get; private set; } internal static ManualLogSource? EmpressLog { get; private set; } internal string EmpressAssetRoot => Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty, "miside_menu_scene"); private void Awake() { //IL_0013: 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_0027: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown Instance = this; EmpressLog = ((BaseUnityPlugin)this).Logger; ((Object)this).hideFlags = (HideFlags)(((Object)this).hideFlags | 0x3D); GameObject gameObject = ((Component)this).gameObject; ((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x3D); EmpressEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Places the MiSide menu scene into the REPO main menu."); EmpressMusicVolume = ((BaseUnityPlugin)this).Config.Bind<int>("Audio", "MusicVolume", 75, new ConfigDescription("Volume for the transplanted MiSide menu music.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); _empressHarmony = new Harmony("empress.repo.misidemenuscene"); _empressHarmony.PatchAll(); EmpressEnsureRuntime(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Empress MiSide Menu Scene 1.0.2 loaded. Empress menu transplant armed."); } internal EmpressMiSideMenuRuntime EmpressEnsureRuntime() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if ((Object)(object)_empressRuntime != (Object)null) { return _empressRuntime; } GameObject val = new GameObject("EmpressMiSideMenuScene.Runtime") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)val); _empressRuntime = val.AddComponent<EmpressMiSideMenuRuntime>(); return _empressRuntime; } } [HarmonyPatch(typeof(MainMenuOpen), "Start")] internal static class EmpressMiSideMenuSceneMainMenuOpenStartPatch { private static void Postfix() { EmpressMiSideMenuScenePlugin.Instance?.EmpressEnsureRuntime().EmpressRequestRefresh(); } } [HarmonyPatch(typeof(MenuPageMain), "Start")] internal static class EmpressMiSideMenuSceneMenuPageMainStartPatch { private static void Postfix() { EmpressMiSideMenuScenePlugin.Instance?.EmpressEnsureRuntime().EmpressRequestRefresh(); } } [HarmonyPatch(typeof(TruckMenuAnimated), "Start")] internal static class EmpressMiSideMenuSceneTruckMenuAnimatedStartPatch { private static void Postfix() { EmpressMiSideMenuScenePlugin.Instance?.EmpressEnsureRuntime().EmpressRequestRefresh(); } } [HarmonyPatch(typeof(CameraNoPlayerTarget), "Update")] internal static class EmpressMiSideMenuSceneCameraNoPlayerTargetUpdatePatch { private static void Postfix(CameraNoPlayerTarget __instance) { EmpressMiSideMenuScenePlugin.Instance?.EmpressEnsureRuntime().EmpressApplyMenuCameraRig(__instance, null, null); } } [HarmonyPatch(typeof(CameraPosition), "Update")] internal static class EmpressMiSideMenuSceneCameraPositionUpdatePatch { private static void Postfix(CameraPosition __instance) { EmpressMiSideMenuScenePlugin.Instance?.EmpressEnsureRuntime().EmpressApplyMenuCameraRig(null, __instance, null); } } [HarmonyPatch(typeof(CameraAim), "Update")] internal static class EmpressMiSideMenuSceneCameraAimUpdatePatch { private static void Postfix(CameraAim __instance) { EmpressMiSideMenuScenePlugin.Instance?.EmpressEnsureRuntime().EmpressApplyMenuCameraRig(null, null, __instance); } } [HarmonyPatch(typeof(LevelMusic), "Update")] internal static class EmpressMiSideMenuSceneLevelMusicUpdatePatch { private static bool Prefix(LevelMusic __instance) { return !EmpressMiSideMenuRuntime.EmpressShouldSuppressLevelMusic(__instance); } } [HarmonyPatch(typeof(ConstantMusic), "Update")] internal static class EmpressMiSideMenuSceneConstantMusicUpdatePatch { private static bool Prefix(ConstantMusic __instance) { return !EmpressMiSideMenuRuntime.EmpressShouldSuppressConstantMusic(__instance); } } internal sealed class EmpressMiSideMenuRuntime : MonoBehaviour { private static readonly FieldRef<LevelMusic, AudioSource?> EmpressLevelMusicAudioSourceRef = AccessTools.FieldRefAccess<LevelMusic, AudioSource>("audioSource"); private static readonly FieldRef<LevelMusic, bool> EmpressLevelMusicActiveRef = AccessTools.FieldRefAccess<LevelMusic, bool>("active"); private static readonly FieldRef<LevelMusic, bool> EmpressLevelMusicActivePlayedRef = AccessTools.FieldRefAccess<LevelMusic, bool>("activePlayed"); private static readonly FieldRef<LevelMusic, bool> EmpressLevelMusicInterruptRef = AccessTools.FieldRefAccess<LevelMusic, bool>("interrupt"); private static readonly FieldRef<LevelMusic, float> EmpressLevelMusicInterruptVolumeRef = AccessTools.FieldRefAccess<LevelMusic, float>("interruptVolume"); private static readonly FieldRef<LevelMusic, float> EmpressLevelMusicInterruptVolumeLerpRef = AccessTools.FieldRefAccess<LevelMusic, float>("interruptVolumeLerp"); private static readonly FieldRef<LevelMusic, float> EmpressLevelMusicCooldownTimeRef = AccessTools.FieldRefAccess<LevelMusic, float>("cooldownTime"); private static readonly FieldRef<LevelMusic, float> EmpressLevelMusicCooldownTimeMinRef = AccessTools.FieldRefAccess<LevelMusic, float>("cooldownTimeMin"); private static readonly FieldRef<ConstantMusic, AudioSource?> EmpressConstantMusicAudioSourceRef = AccessTools.FieldRefAccess<ConstantMusic, AudioSource>("audioSource"); private static readonly FieldRef<ConstantMusic, bool> EmpressConstantMusicSetupRef = AccessTools.FieldRefAccess<ConstantMusic, bool>("setup"); private readonly Dictionary<string, GameObject> _empressNodeObjects = new Dictionary<string, GameObject>(StringComparer.Ordinal); private readonly Dictionary<string, Transform> _empressNodeTransforms = new Dictionary<string, Transform>(StringComparer.Ordinal); private readonly Dictionary<string, Mesh> _empressMeshes = new Dictionary<string, Mesh>(StringComparer.Ordinal); private readonly Dictionary<int, Material> _empressMaterials = new Dictionary<int, Material>(); private readonly Dictionary<string, Texture2D> _empressTextures = new Dictionary<string, Texture2D>(StringComparer.Ordinal); private readonly Dictionary<string, EmpressMitaBonePose> _empressMitaBonePoses = new Dictionary<string, EmpressMitaBonePose>(StringComparer.Ordinal); private readonly Dictionary<AudioSource, EmpressAudioSourceState> _empressSuppressedMenuAudioStates = new Dictionary<AudioSource, EmpressAudioSourceState>(); private readonly Dictionary<Camera, EmpressCameraState> _empressMenuCameraStates = new Dictionary<Camera, EmpressCameraState>(); private readonly List<Renderer> _empressSuppressedTruckRenderers = new List<Renderer>(); private readonly List<Behaviour> _empressSuppressedTruckBehaviours = new List<Behaviour>(); private readonly List<ParticleSystem> _empressSuppressedTruckParticles = new List<ParticleSystem>(); private EmpressMiSideMenuPackage? _empressPackage; private GameObject? _empressSceneRoot; private Transform? _empressCameraAnchor; private AudioSource? _empressMusicSource; private AudioClip? _empressMusicClip; private bool _empressSceneBuilt; private bool _empressSceneBuildFailed; private bool _empressMenuActive; private bool _empressRefreshRequested = true; private bool _empressLoggedSceneBuild; private Coroutine? _empressMusicLoadCoroutine; private float _empressMitaBlinkUntilTime; private float _empressMitaNextBlinkTime; private void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ((Object)this).hideFlags = (HideFlags)(((Object)this).hideFlags | 0x3D); GameObject gameObject = ((Component)this).gameObject; ((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x3D); _empressMusicSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _empressMusicSource.playOnAwake = false; _empressMusicSource.loop = true; _empressMusicSource.spatialBlend = 0f; _empressMusicSource.priority = 32; } internal void EmpressRequestRefresh() { _empressRefreshRequested = true; } private void Update() { bool flag = EmpressMenuContextActive(); if (flag != _empressMenuActive) { _empressMenuActive = flag; _empressRefreshRequested = true; } if (_empressRefreshRequested) { EmpressRefreshMenuPresentation(); _empressRefreshRequested = false; } if (_empressMenuActive && _empressSceneBuilt) { EmpressSuppressVanillaMenuPresentation(suppress: true); EmpressApplyMenuCameraRig(null, null, null); EmpressAnimateMita(); EmpressUpdateMusic(); } } private void LateUpdate() { if (_empressMenuActive && _empressSceneBuilt) { EmpressApplyMenuCameraRig(null, null, null); } } private bool EmpressMenuContextActive() { EmpressMiSideMenuScenePlugin? instance = EmpressMiSideMenuScenePlugin.Instance; if (instance == null || !instance.EmpressEnabled.Value) { return false; } if ((Object)(object)RunManager.instance == (Object)null || (Object)(object)RunManager.instance.levelCurrent == (Object)null || (Object)(object)RunManager.instance.levelMainMenu == (Object)null) { return false; } return RunManager.instance.levelCurrent == RunManager.instance.levelMainMenu; } private void EmpressRefreshMenuPresentation() { if (!_empressMenuActive) { if ((Object)(object)_empressSceneRoot != (Object)null) { _empressSceneRoot.SetActive(false); } EmpressSuppressVanillaMenuPresentation(suppress: false); if ((Object)(object)_empressMusicSource != (Object)null) { _empressMusicSource.Stop(); } if ((Object)(object)CameraNoPlayerTarget.instance != (Object)null) { ((Behaviour)CameraNoPlayerTarget.instance).enabled = true; } if ((Object)(object)CameraNoPlayerTarget.instance != (Object)null) { ((Behaviour)CameraNoPlayerTarget.instance).enabled = true; } } else if (_empressSceneBuildFailed) { EmpressSuppressVanillaMenuPresentation(suppress: false); } else { EmpressEnsureSceneBuilt(); if ((Object)(object)_empressSceneRoot != (Object)null) { _empressSceneRoot.SetActive(true); } } } private void EmpressEnsureSceneBuilt() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (_empressSceneBuilt || _empressSceneBuildFailed) { return; } try { _empressPackage = EmpressLoadPackage(); if (_empressPackage == null) { _empressSceneBuildFailed = true; return; } _empressSceneRoot = new GameObject("EmpressMiSideMenuScene.Root") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)_empressSceneRoot); _empressSceneRoot.transform.SetParent(((Component)this).transform, false); _empressSceneRoot.transform.localPosition = Vector3.zero; _empressSceneRoot.transform.localRotation = Quaternion.identity; _empressSceneRoot.transform.localScale = Vector3.one; _empressNodeObjects.Clear(); _empressNodeTransforms.Clear(); _empressNodeObjects[string.Empty] = _empressSceneRoot; _empressNodeTransforms[string.Empty] = _empressSceneRoot.transform; EmpressMiSideMenuNodeData[] array = _empressPackage.nodes ?? Array.Empty<EmpressMiSideMenuNodeData>(); foreach (EmpressMiSideMenuNodeData item in array.OrderBy((EmpressMiSideMenuNodeData item) => item.path.Count((char character) => character == '/'))) { EmpressCreateNode(item); } EmpressMiSideMenuNodeData[] array2 = array; foreach (EmpressMiSideMenuNodeData node in array2) { EmpressApplyNodeComponents(node); } if (_empressNodeTransforms.TryGetValue("Camera", out Transform value)) { _empressCameraAnchor = value; } EmpressBindMitaAnimationRig(); _empressSceneBuilt = true; if (!_empressLoggedSceneBuild) { int num = _empressSceneRoot.GetComponentsInChildren<Renderer>(true).Length; int num2 = _empressSceneRoot.GetComponentsInChildren<Light>(true).Length; int valueOrDefault = (_empressPackage?.nodes?.Length).GetValueOrDefault(); ManualLogSource? empressLog = EmpressMiSideMenuScenePlugin.EmpressLog; if (empressLog != null) { empressLog.LogInfo((object)$"Empress MiSide scene built with {valueOrDefault} nodes, {num} renderers, {num2} lights."); } _empressLoggedSceneBuild = true; } } catch (Exception arg) { _empressSceneBuildFailed = true; ManualLogSource? empressLog2 = EmpressMiSideMenuScenePlugin.EmpressLog; if (empressLog2 != null) { empressLog2.LogError((object)$"Empress MiSide scene build failed: {arg}"); } EmpressSuppressVanillaMenuPresentation(suppress: false); } } private void EmpressCreateNode(EmpressMiSideMenuNodeData node) { //IL_0031: 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_003f: Expected O, but got Unknown //IL_0064: 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_0088: Unknown result type (might be due to invalid IL or missing references) string key = EmpressParentPath(node.path); Transform value; Transform val = (_empressNodeTransforms.TryGetValue(key, out value) ? value : _empressSceneRoot.transform); GameObject val2 = new GameObject(node.name) { hideFlags = (HideFlags)61 }; val2.SetActive(node.active); Transform transform = val2.transform; transform.SetParent(val, false); transform.localPosition = node.localPosition.EmpressToVector3(); transform.localRotation = node.localRotation.EmpressToQuaternion(); transform.localScale = node.localScale.EmpressToVector3(); _empressNodeObjects[node.path] = val2; _empressNodeTransforms[node.path] = transform; } private void EmpressApplyNodeComponents(EmpressMiSideMenuNodeData node) { //IL_015e: Unknown result type (might be due to invalid IL or missing references) GameObject val = _empressNodeObjects[node.path]; if (node.meshRenderer != null) { val.AddComponent<MeshFilter>().sharedMesh = EmpressLoadMesh(node.meshRenderer.meshFile); ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterials = node.meshRenderer.materials.Select(EmpressLoadMaterial).ToArray(); } if (node.skinnedRenderer != null) { SkinnedMeshRenderer obj = val.AddComponent<SkinnedMeshRenderer>(); obj.sharedMesh = EmpressLoadMesh(node.skinnedRenderer.meshFile); ((Renderer)obj).sharedMaterials = node.skinnedRenderer.materials.Select(EmpressLoadMaterial).ToArray(); obj.rootBone = EmpressResolveTransform(node.skinnedRenderer.rootBone); obj.bones = node.skinnedRenderer.bones.Select(EmpressResolveTransform).OfType<Transform>().ToArray(); obj.updateWhenOffscreen = true; } if (node.light != null) { Light obj2 = val.AddComponent<Light>(); obj2.type = (LightType)Mathf.Clamp(node.light.type, 0, 4); obj2.range = node.light.range; obj2.spotAngle = node.light.spotAngle; obj2.intensity = node.light.intensity; obj2.color = node.light.color.EmpressToColor(); } } private Mesh EmpressLoadMesh(string meshFile) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) if (_empressMeshes.TryGetValue(meshFile, out Mesh value)) { return value; } using FileStream input = File.OpenRead(Path.Combine(EmpressMiSideMenuScenePlugin.Instance.EmpressAssetRoot, "meshes", meshFile)); using BinaryReader binaryReader = new BinaryReader(input); if (new string(binaryReader.ReadChars(7)) != "EMMESH1") { throw new InvalidDataException("Invalid Empress mesh header in '" + meshFile + "'."); } int num = binaryReader.ReadInt32(); int num2 = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); int num4 = binaryReader.ReadInt32(); bool flag = (num & 1) != 0; bool flag2 = (num & 2) != 0; bool flag3 = (num & 4) != 0; Vector3[] array = (Vector3[])(object)new Vector3[num2]; for (int i = 0; i < num2; i++) { array[i] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } Vector3[] array2 = null; if (flag) { array2 = (Vector3[])(object)new Vector3[num2]; for (int j = 0; j < num2; j++) { array2[j] = new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()); } } Vector2[] array3 = null; if (flag2) { array3 = (Vector2[])(object)new Vector2[num2]; for (int k = 0; k < num2; k++) { array3[k] = new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle()); } } Mesh val = new Mesh { name = Path.GetFileNameWithoutExtension(meshFile), indexFormat = (IndexFormat)(num2 > 65535), subMeshCount = num3 }; val.vertices = array; if (array2 != null) { val.normals = array2; } if (array3 != null) { val.uv = array3; } for (int l = 0; l < num3; l++) { int num5 = binaryReader.ReadInt32(); int[] array4 = new int[num5]; for (int m = 0; m < num5; m++) { array4[m] = binaryReader.ReadInt32(); } val.SetTriangles(array4, l, false); } if (flag3) { Matrix4x4[] array5 = (Matrix4x4[])(object)new Matrix4x4[num4]; for (int n = 0; n < num4; n++) { array5[n] = new Matrix4x4(new Vector4(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()), new Vector4(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()), new Vector4(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()), new Vector4(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle())); } BoneWeight[] array6 = (BoneWeight[])(object)new BoneWeight[num2]; for (int num6 = 0; num6 < num2; num6++) { int num7 = num6; BoneWeight val2 = default(BoneWeight); ((BoneWeight)(ref val2)).boneIndex0 = (int)binaryReader.ReadUInt32(); ((BoneWeight)(ref val2)).boneIndex1 = (int)binaryReader.ReadUInt32(); ((BoneWeight)(ref val2)).boneIndex2 = (int)binaryReader.ReadUInt32(); ((BoneWeight)(ref val2)).boneIndex3 = (int)binaryReader.ReadUInt32(); ((BoneWeight)(ref val2)).weight0 = binaryReader.ReadSingle(); ((BoneWeight)(ref val2)).weight1 = binaryReader.ReadSingle(); ((BoneWeight)(ref val2)).weight2 = binaryReader.ReadSingle(); ((BoneWeight)(ref val2)).weight3 = binaryReader.ReadSingle(); array6[num7] = val2; } val.bindposes = array5; val.boneWeights = array6; } if (array2 == null || array2.Length == 0) { val.RecalculateNormals(); } val.RecalculateBounds(); _empressMeshes[meshFile] = val; return val; } private Material EmpressLoadMaterial(int materialIndex) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if (_empressMaterials.TryGetValue(materialIndex, out Material value)) { return value; } EmpressMiSideMenuMaterialData empressMiSideMenuMaterialData = (_empressPackage?.materials ?? Array.Empty<EmpressMiSideMenuMaterialData>())[materialIndex]; Material val = new Material(EmpressResolveShader(empressMiSideMenuMaterialData)) { name = empressMiSideMenuMaterialData.name, color = empressMiSideMenuMaterialData.color.EmpressToColor() }; if (!string.IsNullOrWhiteSpace(empressMiSideMenuMaterialData.mainTexture)) { Texture2D mainTexture = EmpressLoadTexture(empressMiSideMenuMaterialData.mainTexture); val.mainTexture = (Texture)(object)mainTexture; } if (empressMiSideMenuMaterialData.transparent || empressMiSideMenuMaterialData.cutout) { EmpressConfigureMaterialTransparency(val, empressMiSideMenuMaterialData.cutout); } _empressMaterials[materialIndex] = val; return val; } private Texture2D EmpressLoadTexture(string textureFile) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (_empressTextures.TryGetValue(textureFile, out Texture2D value)) { return value; } byte[] array = File.ReadAllBytes(Path.Combine(EmpressMiSideMenuScenePlugin.Instance.EmpressAssetRoot, "textures", textureFile)); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ImageConversion.LoadImage(val, array, false); ((Object)val).name = Path.GetFileNameWithoutExtension(textureFile); ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).filterMode = (FilterMode)1; _empressTextures[textureFile] = val; return val; } private static Shader EmpressResolveShader(EmpressMiSideMenuMaterialData data) { if (data.transparent) { return Shader.Find("Legacy Shaders/Transparent/Diffuse") ?? Shader.Find("Unlit/Transparent") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Standard"); } return Shader.Find("Standard") ?? Shader.Find("Legacy Shaders/Diffuse") ?? Shader.Find("Sprites/Default"); } private static void EmpressConfigureMaterialTransparency(Material material, bool cutout) { if (((Object)material.shader).name.Contains("Standard", StringComparison.OrdinalIgnoreCase)) { material.SetFloat("_Mode", cutout ? 1f : 3f); material.SetInt("_SrcBlend", 5); material.SetInt("_DstBlend", 10); material.SetInt("_ZWrite", cutout ? 1 : 0); material.DisableKeyword("_ALPHATEST_ON"); material.EnableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.renderQueue = (cutout ? 2450 : 3000); } } private Transform? EmpressResolveTransform(string path) { if (string.IsNullOrWhiteSpace(path)) { return null; } if (!_empressNodeTransforms.TryGetValue(path, out Transform value)) { return null; } return value; } internal void EmpressApplyMenuCameraRig(CameraNoPlayerTarget? menuCameraTarget, CameraPosition? cameraPosition, CameraAim? cameraAim) { //IL_006e: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) if (!_empressMenuActive || !_empressSceneBuilt || (Object)(object)_empressCameraAnchor == (Object)null) { return; } if ((Object)(object)CameraNoPlayerTarget.instance != (Object)null) { ((Behaviour)CameraNoPlayerTarget.instance).enabled = false; } if ((Object)(object)CameraNoPlayerTarget.instance != (Object)null) { ((Behaviour)CameraNoPlayerTarget.instance).enabled = false; } if (menuCameraTarget == null) { menuCameraTarget = EmpressResolveMenuCameraTarget(); } if ((Object)(object)menuCameraTarget != (Object)null) { ((Component)menuCameraTarget).transform.position = _empressCameraAnchor.position; ((Component)menuCameraTarget).transform.rotation = _empressCameraAnchor.rotation; } if (cameraPosition == null) { cameraPosition = CameraPosition.instance; } if ((Object)(object)cameraPosition != (Object)null) { ((Component)cameraPosition).transform.position = _empressCameraAnchor.position; ((Component)cameraPosition).transform.localPosition = _empressCameraAnchor.position; } if (cameraAim == null) { cameraAim = CameraAim.Instance; } if ((Object)(object)cameraAim != (Object)null) { ((Component)cameraAim).transform.rotation = _empressCameraAnchor.rotation; ((Component)cameraAim).transform.localRotation = _empressCameraAnchor.rotation; cameraAim.SetPlayerAim(_empressCameraAnchor.rotation, true); } Camera val = EmpressResolveLiveMenuCamera(); if ((Object)(object)val == (Object)null) { return; } if (!_empressMenuCameraStates.ContainsKey(val)) { _empressMenuCameraStates[val] = new EmpressCameraState(val); } ((Component)val).transform.position = _empressCameraAnchor.position; ((Component)val).transform.rotation = _empressCameraAnchor.rotation; if (_empressPackage != null) { EmpressMiSideMenuNodeData empressMiSideMenuNodeData = _empressPackage.nodes.FirstOrDefault((EmpressMiSideMenuNodeData node) => node.path == "Camera"); if (empressMiSideMenuNodeData?.cameraAnchor != null) { val.fieldOfView = empressMiSideMenuNodeData.cameraAnchor.fieldOfView; val.nearClipPlane = Mathf.Max(0.01f, empressMiSideMenuNodeData.cameraAnchor.nearClip); val.farClipPlane = Mathf.Max(empressMiSideMenuNodeData.cameraAnchor.farClip, 100f); val.backgroundColor = empressMiSideMenuNodeData.cameraAnchor.backgroundColor.EmpressToColor(); val.clearFlags = (CameraClearFlags)2; } } } private static CameraNoPlayerTarget? EmpressResolveMenuCameraTarget() { CameraNoPlayerTarget instance = CameraNoPlayerTarget.instance; if ((Object)(object)instance != (Object)null) { return instance; } instance = ((IEnumerable<CameraNoPlayerTarget>)Object.FindObjectsOfType<CameraNoPlayerTarget>(true)).FirstOrDefault((Func<CameraNoPlayerTarget, bool>)((CameraNoPlayerTarget target) => (Object)(object)target != (Object)null)); if ((Object)(object)instance != (Object)null) { CameraNoPlayerTarget.instance = instance; } return instance; } private static Camera? EmpressResolveLiveMenuCamera() { if ((Object)(object)GameDirector.instance?.MainCamera != (Object)null) { return GameDirector.instance.MainCamera; } if ((Object)(object)Camera.main != (Object)null) { return Camera.main; } return ((IEnumerable<Camera>)Object.FindObjectsOfType<Camera>(true)).FirstOrDefault((Func<Camera, bool>)((Camera camera) => (Object)(object)camera != (Object)null && ((Component)camera).CompareTag("MainCamera"))); } private void EmpressSuppressVanillaMenuPresentation(bool suppress) { if (!suppress) { foreach (Behaviour item in _empressSuppressedTruckBehaviours.Where((Behaviour item) => (Object)(object)item != (Object)null)) { item.enabled = true; } foreach (Renderer item2 in _empressSuppressedTruckRenderers.Where((Renderer item) => (Object)(object)item != (Object)null)) { item2.enabled = true; } foreach (ParticleSystem item3 in _empressSuppressedTruckParticles.Where((ParticleSystem item) => (Object)(object)item != (Object)null)) { item3.Play(true); } KeyValuePair<AudioSource, EmpressAudioSourceState>[] array = _empressSuppressedMenuAudioStates.Where<KeyValuePair<AudioSource, EmpressAudioSourceState>>((KeyValuePair<AudioSource, EmpressAudioSourceState> item) => (Object)(object)item.Key != (Object)null).ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<AudioSource, EmpressAudioSourceState> keyValuePair = array[i]; keyValuePair.Value.Restore(keyValuePair.Key); } KeyValuePair<Camera, EmpressCameraState>[] array2 = _empressMenuCameraStates.Where<KeyValuePair<Camera, EmpressCameraState>>((KeyValuePair<Camera, EmpressCameraState> item) => (Object)(object)item.Key != (Object)null).ToArray(); for (int i = 0; i < array2.Length; i++) { KeyValuePair<Camera, EmpressCameraState> keyValuePair2 = array2[i]; keyValuePair2.Value.Restore(keyValuePair2.Key); } _empressSuppressedTruckBehaviours.Clear(); _empressSuppressedTruckRenderers.Clear(); _empressSuppressedTruckParticles.Clear(); _empressSuppressedMenuAudioStates.Clear(); _empressMenuCameraStates.Clear(); return; } TruckMenuAnimated[] array3 = Object.FindObjectsOfType<TruckMenuAnimated>(true); foreach (TruckMenuAnimated val in array3) { if ((Object)(object)val != (Object)null && ((Behaviour)val).enabled) { _empressSuppressedTruckBehaviours.Add((Behaviour)(object)val); ((Behaviour)val).enabled = false; } } Renderer[] array4 = Object.FindObjectsOfType<Renderer>(true); foreach (Renderer val2 in array4) { if (!((Object)(object)val2 == (Object)null) && val2.enabled && EmpressShouldSuppressMenuVisual(((Component)val2).transform)) { _empressSuppressedTruckRenderers.Add(val2); val2.enabled = false; } } ParticleSystem[] array5 = Object.FindObjectsOfType<ParticleSystem>(true); foreach (ParticleSystem val3 in array5) { if (!((Object)(object)val3 == (Object)null) && val3.isPlaying && EmpressShouldSuppressMenuVisual(((Component)val3).transform)) { _empressSuppressedTruckParticles.Add(val3); val3.Stop(true, (ParticleSystemStopBehavior)0); } } AudioSource[] array6 = Object.FindObjectsOfType<AudioSource>(true); foreach (AudioSource val4 in array6) { if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val4 == (Object)(object)_empressMusicSource) && EmpressShouldSuppressMenuAudio(val4)) { if (!_empressSuppressedMenuAudioStates.ContainsKey(val4)) { _empressSuppressedMenuAudioStates[val4] = new EmpressAudioSourceState(val4); } val4.Pause(); val4.mute = true; } } } private bool EmpressShouldSuppressMenuVisual(Transform candidate) { if ((Object)(object)candidate == (Object)null) { return false; } if ((Object)(object)_empressSceneRoot != (Object)null && candidate.IsChildOf(_empressSceneRoot.transform)) { return false; } if ((Object)(object)((Component)candidate).GetComponentInParent<Canvas>(true) != (Object)null || (Object)(object)((Component)candidate).GetComponentInParent<MenuPage>(true) != (Object)null || (Object)(object)((Component)candidate).GetComponentInParent<MenuButton>(true) != (Object)null) { return false; } return true; } private bool EmpressShouldSuppressMenuAudio(AudioSource source) { if ((Object)(object)_empressSceneRoot != (Object)null && ((Component)source).transform.IsChildOf(_empressSceneRoot.transform)) { return false; } if ((Object)(object)((Component)source).GetComponentInParent<MenuPage>(true) != (Object)null || (Object)(object)((Component)source).GetComponentInParent<MenuButton>(true) != (Object)null) { return false; } if (!source.loop) { return EmpressLooksLikeBackgroundAudio(source); } return true; } private static bool EmpressLooksLikeBackgroundAudio(AudioSource source) { string text = EmpressTransformPath(((Component)source).transform).ToLowerInvariant(); if (!text.Contains("music") && !text.Contains("ambience") && !text.Contains("ambient") && !text.Contains("truck") && !text.Contains("mainmenu")) { return text.Contains("main menu"); } return true; } private static string EmpressTransformPath(Transform transformNode) { List<string> list = new List<string>(); while ((Object)(object)transformNode != (Object)null) { list.Add(((Object)transformNode).name); transformNode = transformNode.parent; } list.Reverse(); return string.Join("/", list); } private void EmpressUpdateMusic() { if ((Object)(object)_empressMusicSource == (Object)null || _empressPackage == null) { return; } _empressMusicSource.volume = Mathf.Clamp01((float)(EmpressMiSideMenuScenePlugin.Instance?.EmpressMusicVolume.Value ?? 75) / 100f); if (string.IsNullOrWhiteSpace(_empressPackage.musicFile)) { return; } if ((Object)(object)_empressMusicClip == (Object)null) { if (_empressMusicLoadCoroutine == null) { _empressMusicLoadCoroutine = ((MonoBehaviour)this).StartCoroutine(EmpressLoadMusicCoroutine(_empressPackage.musicFile)); } return; } if (_empressMusicSource.clip != _empressMusicClip) { _empressMusicSource.clip = _empressMusicClip; } if (!_empressMusicSource.isPlaying) { _empressMusicSource.Play(); } } private IEnumerator EmpressLoadMusicCoroutine(string musicFile) { string uriString = Path.Combine(EmpressMiSideMenuScenePlugin.Instance.EmpressAssetRoot, "audio", musicFile); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(uriString).AbsoluteUri, (AudioType)20); try { yield return request.SendWebRequest(); if ((int)request.result == 1) { _empressMusicClip = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)_empressMusicClip != (Object)null) { ((Object)_empressMusicClip).name = "EmpressMiSideMenuMusic"; } } else { ManualLogSource? empressLog = EmpressMiSideMenuScenePlugin.EmpressLog; if (empressLog != null) { empressLog.LogWarning((object)("Empress MiSide menu music failed to load: " + request.error)); } } _empressMusicLoadCoroutine = null; } finally { ((IDisposable)request)?.Dispose(); } } private void EmpressBindMitaAnimationRig() { _empressMitaBonePoses.Clear(); _empressMitaBlinkUntilTime = 0f; _empressMitaNextBlinkTime = Time.unscaledTime + 1.75f; EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Left shoulder"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Left shoulder/Left arm"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Right shoulder"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Right shoulder/Right arm"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Left Eye"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Right Eye"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/HairSide1 L"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/HairSide1 R"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 1 L"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 2 L"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 1 R"); EmpressRememberMitaBone("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 2 R"); } private void EmpressRememberMitaBone(string path) { Transform val = EmpressResolveTransform(path); if (!((Object)(object)val == (Object)null) && !_empressMitaBonePoses.ContainsKey(path)) { _empressMitaBonePoses[path] = new EmpressMitaBonePose(val); } } private void EmpressAnimateMita() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: 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) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) if (_empressMitaBonePoses.Count != 0) { float unscaledTime = Time.unscaledTime; if (unscaledTime >= _empressMitaNextBlinkTime) { _empressMitaBlinkUntilTime = unscaledTime + 0.12f; _empressMitaNextBlinkTime = unscaledTime + Random.Range(2.4f, 5.4f); } bool num = unscaledTime < _empressMitaBlinkUntilTime; float num2 = Mathf.Sin(unscaledTime * 0.31f) * 3.5f; float num3 = Mathf.Sin(unscaledTime * 0.47f + 0.8f) * 2f; float num4 = Mathf.Sin(unscaledTime * 0.62f) * 1.4f; float num5 = Mathf.Sin(unscaledTime * 1.24f) * 0.0065f; EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips", new Vector3(0f, num5, 0f), Quaternion.Euler(0f, 0f, num4)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 0.78f + 0.25f) * 0.9f, 0f, num4 * 0.45f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 0.9f + 1.1f) * 1.4f, num2 * 0.18f, num4 * 0.65f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2", Vector3.zero, Quaternion.Euler(num3 * 0.45f, num2 * 0.28f, 0f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1", Vector3.zero, Quaternion.Euler(num3 * 0.55f, num2 * 0.42f, Mathf.Sin(unscaledTime * 0.44f) * 0.5f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head", Vector3.zero, Quaternion.Euler(num3 * 0.75f, num2, Mathf.Sin(unscaledTime * 0.57f + 0.9f) * 0.85f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Left shoulder", Vector3.zero, Quaternion.Euler(0f, 0f, Mathf.Sin(unscaledTime * 0.72f + 1f) * 1.1f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Left shoulder/Left arm", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 0.83f + 1.4f) * 1.5f, 0f, Mathf.Sin(unscaledTime * 0.68f + 0.3f) * 1f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Right shoulder", Vector3.zero, Quaternion.Euler(0f, 0f, Mathf.Sin(unscaledTime * 0.72f + 2.3f) * -1.1f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Right shoulder/Right arm", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 0.83f + 2.1f) * 1.5f, 0f, Mathf.Sin(unscaledTime * 0.68f + 1.1f) * -1f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/HairSide1 L", Vector3.zero, Quaternion.Euler(0f, Mathf.Sin(unscaledTime * 1.1f + 0.7f) * 2.3f, Mathf.Sin(unscaledTime * 1.35f + 0.2f) * 3.2f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/HairSide1 R", Vector3.zero, Quaternion.Euler(0f, Mathf.Sin(unscaledTime * 1.1f + 1.9f) * -2.3f, Mathf.Sin(unscaledTime * 1.35f + 1.1f) * -3.2f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 1 L", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 0.86f + 0.5f) * 2.2f, Mathf.Sin(unscaledTime * 0.74f + 0.2f) * 4.2f, Mathf.Sin(unscaledTime * 1.18f + 0.3f) * 2.4f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 2 L", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 1.02f + 0.9f) * 2.6f, Mathf.Sin(unscaledTime * 0.92f + 0.6f) * 5f, Mathf.Sin(unscaledTime * 1.42f + 0.8f) * 3.2f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 1 R", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 0.86f + 1.6f) * 2.2f, Mathf.Sin(unscaledTime * 0.74f + 1.1f) * -4.2f, Mathf.Sin(unscaledTime * 1.18f + 1.4f) * -2.4f)); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Tail 2 R", Vector3.zero, Quaternion.Euler(Mathf.Sin(unscaledTime * 1.02f + 2f) * 2.6f, Mathf.Sin(unscaledTime * 0.92f + 1.8f) * -5f, Mathf.Sin(unscaledTime * 1.42f + 1.9f) * -3.2f)); Quaternion rotationOffset = Quaternion.Euler(num ? 9f : (num3 * 0.35f), num2 * 0.35f, 0f); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Left Eye", Vector3.zero, rotationOffset); EmpressApplyMitaPoseOffset("Scene/Mita/MitaPerson Mita/Armature/Hips/Spine/Chest/Neck2/Neck1/Head/Right Eye", Vector3.zero, rotationOffset); } } private void EmpressApplyMitaPoseOffset(string path, Vector3 positionOffset, Quaternion rotationOffset) { //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_001e: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (_empressMitaBonePoses.TryGetValue(path, out EmpressMitaBonePose value)) { value.Transform.localPosition = value.LocalPosition + positionOffset; value.Transform.localRotation = value.LocalRotation * rotationOffset; } } private static string EmpressParentPath(string path) { int num = path.LastIndexOf('/'); if (num < 0) { return string.Empty; } return path.Substring(0, num); } private EmpressMiSideMenuPackage? EmpressLoadPackage() { string text = Path.Combine(EmpressMiSideMenuScenePlugin.Instance.EmpressAssetRoot, "miside_menu_scene.json"); if (!File.Exists(text)) { ManualLogSource? empressLog = EmpressMiSideMenuScenePlugin.EmpressLog; if (empressLog != null) { empressLog.LogWarning((object)("Empress MiSide menu scene package is missing: " + text)); } return null; } EmpressMiSideMenuPackage empressMiSideMenuPackage = JsonConvert.DeserializeObject<EmpressMiSideMenuPackage>(File.ReadAllText(text)); if (empressMiSideMenuPackage == null) { ManualLogSource? empressLog2 = EmpressMiSideMenuScenePlugin.EmpressLog; if (empressLog2 != null) { empressLog2.LogWarning((object)"Empress MiSide menu scene package deserialized to null."); } return null; } EmpressMiSideMenuPackage empressMiSideMenuPackage2 = empressMiSideMenuPackage; if (empressMiSideMenuPackage2.nodes == null) { empressMiSideMenuPackage2.nodes = Array.Empty<EmpressMiSideMenuNodeData>(); } empressMiSideMenuPackage2 = empressMiSideMenuPackage; if (empressMiSideMenuPackage2.materials == null) { empressMiSideMenuPackage2.materials = Array.Empty<EmpressMiSideMenuMaterialData>(); } return empressMiSideMenuPackage; } internal static bool EmpressShouldSuppressLevelMusic(LevelMusic? levelMusic) { if (!((Object)(object)levelMusic == (Object)null)) { EmpressMiSideMenuScenePlugin? instance = EmpressMiSideMenuScenePlugin.Instance; if (instance != null && instance.EmpressEnsureRuntime()._empressMenuActive) { EmpressResetLevelMusic(levelMusic); return true; } } return false; } internal static bool EmpressShouldSuppressConstantMusic(ConstantMusic? constantMusic) { if (!((Object)(object)constantMusic == (Object)null)) { EmpressMiSideMenuScenePlugin? instance = EmpressMiSideMenuScenePlugin.Instance; if (instance != null && instance.EmpressEnsureRuntime()._empressMenuActive) { ref AudioSource reference = ref EmpressConstantMusicAudioSourceRef.Invoke(constantMusic); if ((Object)(object)reference == (Object)null) { reference = ((Component)constantMusic).GetComponent<AudioSource>(); } if ((Object)(object)reference != (Object)null && reference.isPlaying) { reference.Stop(); reference.clip = null; } EmpressConstantMusicSetupRef.Invoke(constantMusic) = false; return true; } } return false; } private static void EmpressResetLevelMusic(LevelMusic levelMusic) { ref AudioSource reference = ref EmpressLevelMusicAudioSourceRef.Invoke(levelMusic); if ((Object)(object)reference == (Object)null) { reference = ((Component)levelMusic).GetComponent<AudioSource>(); } ref bool reference2 = ref EmpressLevelMusicActiveRef.Invoke(levelMusic); ref bool reference3 = ref EmpressLevelMusicActivePlayedRef.Invoke(levelMusic); ref bool reference4 = ref EmpressLevelMusicInterruptRef.Invoke(levelMusic); ref float reference5 = ref EmpressLevelMusicInterruptVolumeRef.Invoke(levelMusic); ref float reference6 = ref EmpressLevelMusicInterruptVolumeLerpRef.Invoke(levelMusic); ref float reference7 = ref EmpressLevelMusicCooldownTimeRef.Invoke(levelMusic); ref float reference8 = ref EmpressLevelMusicCooldownTimeMinRef.Invoke(levelMusic); reference2 = false; reference3 = false; reference4 = false; reference5 = 0f; reference6 = 0f; reference7 = Mathf.Max(reference7, reference8); if ((Object)(object)reference != (Object)null) { reference.Stop(); reference.clip = null; } } } internal sealed class EmpressAudioSourceState { private readonly bool _enabled; private readonly bool _mute; private readonly bool _wasPlaying; public EmpressAudioSourceState(AudioSource source) { _enabled = ((Behaviour)source).enabled; _mute = source.mute; _wasPlaying = source.isPlaying; } public void Restore(AudioSource source) { ((Behaviour)source).enabled = _enabled; source.mute = _mute; if (_wasPlaying && ((Behaviour)source).enabled && (Object)(object)source.clip != (Object)null) { source.UnPause(); } } } internal sealed class EmpressCameraState { private readonly CameraClearFlags _clearFlags; private readonly Color _backgroundColor; private readonly float _fieldOfView; private readonly float _nearClipPlane; private readonly float _farClipPlane; public EmpressCameraState(Camera camera) { //IL_0008: 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_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) _clearFlags = camera.clearFlags; _backgroundColor = camera.backgroundColor; _fieldOfView = camera.fieldOfView; _nearClipPlane = camera.nearClipPlane; _farClipPlane = camera.farClipPlane; } public void Restore(Camera camera) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) camera.clearFlags = _clearFlags; camera.backgroundColor = _backgroundColor; camera.fieldOfView = _fieldOfView; camera.nearClipPlane = _nearClipPlane; camera.farClipPlane = _farClipPlane; } } internal sealed class EmpressMitaBonePose { public Transform Transform { get; } public Vector3 LocalPosition { get; } public Quaternion LocalRotation { get; } public EmpressMitaBonePose(Transform transformNode) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Transform = transformNode; LocalPosition = transformNode.localPosition; LocalRotation = transformNode.localRotation; } } [Serializable] internal sealed class EmpressMiSideMenuPackage { public string rootName = string.Empty; public string musicFile = string.Empty; public EmpressMiSideMenuNodeData[]? nodes = Array.Empty<EmpressMiSideMenuNodeData>(); public EmpressMiSideMenuMaterialData[]? materials = Array.Empty<EmpressMiSideMenuMaterialData>(); } [Serializable] internal sealed class EmpressMiSideMenuNodeData { public string name = string.Empty; public string path = string.Empty; public bool active = true; public EmpressVector3Data localPosition = new EmpressVector3Data(); public EmpressQuaternionData localRotation = new EmpressQuaternionData(); public EmpressVector3Data localScale = new EmpressVector3Data { x = 1f, y = 1f, z = 1f }; public EmpressMiSideMenuMeshRendererData? meshRenderer; public EmpressMiSideMenuSkinnedRendererData? skinnedRenderer; public EmpressMiSideMenuLightData? light; public EmpressMiSideMenuCameraData? cameraAnchor; } [Serializable] internal sealed class EmpressMiSideMenuMeshRendererData { public string meshFile = string.Empty; public int[] materials = Array.Empty<int>(); } [Serializable] internal sealed class EmpressMiSideMenuSkinnedRendererData { public string meshFile = string.Empty; public int[] materials = Array.Empty<int>(); public string rootBone = string.Empty; public string[] bones = Array.Empty<string>(); } [Serializable] internal sealed class EmpressMiSideMenuMaterialData { public string name = string.Empty; public string mainTexture = string.Empty; public string emissionTexture = string.Empty; public EmpressColorData color = new EmpressColorData(); public bool transparent; public bool cutout; } [Serializable] internal sealed class EmpressMiSideMenuLightData { public int type; public float range; public float spotAngle; public float intensity; public EmpressColorData color = new EmpressColorData(); } [Serializable] internal sealed class EmpressMiSideMenuCameraData { public float fieldOfView = 60f; public EmpressColorData backgroundColor = new EmpressColorData(); public float nearClip = 0.01f; public float farClip = 1000f; } [Serializable] internal sealed class EmpressVector3Data { public float x; public float y; public float z; public Vector3 EmpressToVector3() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(x, y, z); } } [Serializable] internal sealed class EmpressQuaternionData { public float x; public float y; public float z; public float w = 1f; public Quaternion EmpressToQuaternion() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(x, y, z, w); } } [Serializable] internal sealed class EmpressColorData { public float r = 1f; public float g = 1f; public float b = 1f; public float a = 1f; public Color EmpressToColor() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Color(r, g, b, a); } } }