using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.Marrow.Zones;
using Il2CppSLZ.Utilities;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Il2CppUltEvents;
using MelonLoader;
using ShowHolodecks;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShowHolodecks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("ShowHolodecks")]
[assembly: AssemblyCopyright("Created by yellowyears")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(global::ShowHolodecks.ShowHolodecks), "ShowHolodecks", "1.2.0", "yellowyears", "https://bonelab.thunderstore.io/package/yellowyears/ShowHolodecks/")]
[assembly: MelonGame(null, null)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.2.0.0")]
namespace ShowHolodecks;
[RegisterTypeInIl2Cpp]
internal class Holodeck : MonoBehaviour
{
public List<TweenBlendshape> tweenBlendshapes = new List<TweenBlendshape>();
public Holodeck(IntPtr intPtr)
: base(intPtr)
{
}
public void Setup(ZoneEvents zoneEvents)
{
UltEvent<MarrowEntity> val = ((Il2CppObjectBase)zoneEvents.onZoneEnter).Cast<UltEvent<MarrowEntity>>();
Action<MarrowEntity> action = delegate
{
Activate();
};
UltEvent<MarrowEntity>.AddDynamicCall(ref val, Action<MarrowEntity>.op_Implicit(action));
UltEvent<MarrowEntity> val2 = ((Il2CppObjectBase)zoneEvents.onZoneExit).Cast<UltEvent<MarrowEntity>>();
Action<MarrowEntity> action2 = delegate
{
Deactivate();
};
UltEvent<MarrowEntity>.AddDynamicCall(ref val2, Action<MarrowEntity>.op_Implicit(action2));
}
public void Activate()
{
Enumerator<TweenBlendshape> enumerator = tweenBlendshapes.GetEnumerator();
while (enumerator.MoveNext())
{
TweenBlendshape current = enumerator.Current;
current.TweenOn(0.5f);
}
}
public void Deactivate()
{
Enumerator<TweenBlendshape> enumerator = tweenBlendshapes.GetEnumerator();
while (enumerator.MoveNext())
{
TweenBlendshape current = enumerator.Current;
current.TweenOff(0.5f);
}
}
}
public static class BuildInfo
{
public const string Name = "ShowHolodecks";
public const string Author = "yellowyears";
public const string Company = null;
public const string Version = "1.2.0";
public const string DownloadLink = "https://bonelab.thunderstore.io/package/yellowyears/ShowHolodecks/";
}
internal class ShowHolodecks : MelonMod
{
private const string TargetSceneName = "scene_BoneLab_Hub_Lab_Floor";
private const string TargetRootName = "//-----ENVIRONMENT";
private const string TargetObjectName = "HOLODECKS";
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
if (!(sceneName != "scene_BoneLab_Hub_Lab_Floor"))
{
MelonLogger.Msg("BONELAB Hub loaded: Activating HoloDecks");
FixHolodecks();
}
}
private void FixHolodecks()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
Il2CppReferenceArray<GameObject> sceneRootGameObjects = GetSceneRootGameObjects("scene_BoneLab_Hub_Lab_Floor");
GameObject val = new GameObject();
foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)sceneRootGameObjects)
{
((Il2CppObjectBase)item).Cast<GameObject>();
if (((Object)item).name != "//-----ENVIRONMENT")
{
continue;
}
val = GetObjectInChildren("HOLODECKS", item);
break;
}
IEnumerator enumerator2 = val.transform.GetEnumerator();
try
{
while (enumerator2.MoveNext())
{
Object current2 = enumerator2.Current;
Transform val2 = ((Il2CppObjectBase)current2).Cast<Transform>();
FixHolodeck(((Component)val2).gameObject);
}
}
finally
{
if (enumerator2 is IDisposable disposable)
{
disposable.Dispose();
}
}
val.SetActive(true);
}
private void FixHolodeck(GameObject holodeckObj)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
List<TweenBlendshape> val = new List<TweenBlendshape>();
Il2CppArrayBase<SkinnedMeshRenderer> componentsInChildren = holodeckObj.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer item in componentsInChildren)
{
TweenBlendshape component = ((Component)item).gameObject.GetComponent<TweenBlendshape>();
if ((Object)(object)component != (Object)null)
{
val.Add(component);
}
GameObject gameObject = ((Component)holodeckObj.transform.FindChild("holodeck")).gameObject;
GameObject gameObject2 = ((Component)holodeckObj.transform.FindChild("Holofloor")).gameObject;
gameObject2.transform.localPosition = new Vector3(0f, 0.004f, 0f);
if (((Object)holodeckObj).name == "Holodeck_walls_05")
{
holodeckObj.transform.localPosition = new Vector3(-25.52f, -3f, 3.94f);
}
}
Holodeck holodeck = holodeckObj.AddComponent<Holodeck>();
holodeck.tweenBlendshapes = val;
GenericTrigger componentInChildren = ((Component)holodeck).GetComponentInChildren<GenericTrigger>();
Zone val2 = ((Component)componentInChildren).gameObject.AddComponent<Zone>();
((Component)val2).gameObject.layer = LayerMask.NameToLayer("EntityTrigger");
ZoneEvents val3 = ((Component)componentInChildren).gameObject.AddComponent<ZoneEvents>();
((ZoneItem)val3)._zone = val2;
TagQuery val4 = new TagQuery();
BoneTagReference boneTag = new BoneTagReference(((ScannableReference)MarrowSettings.RuntimeInstance.PlayerTag).Barcode);
val4.BoneTag = boneTag;
((ZoneItem)val3).activatorTags.Tags.Add(val4);
Object.Destroy((Object)(object)componentInChildren);
holodeck.Setup(val3);
holodeck.Deactivate();
}
private static Il2CppReferenceArray<GameObject> GetSceneRootGameObjects(string sceneName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
Scene sceneByName = SceneManager.GetSceneByName(sceneName);
return ((Scene)(ref sceneByName)).GetRootGameObjects();
}
private static GameObject GetObjectInChildren(string targetObjectName, GameObject parentGameObject)
{
for (int i = 0; i < parentGameObject.transform.GetChildCount(); i++)
{
Transform child = parentGameObject.transform.GetChild(i);
if (((Object)child).name == targetObjectName)
{
return ((Component)child).gameObject;
}
}
return null;
}
}