using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using CWMapApi.Api;
using CWMapApi.Patches;
using HarmonyLib;
using Photon.Pun;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CWMapApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CWMapApi")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5E97F6B1-3A37-400B-841F-5C98A38FE4DD")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CWMapApi
{
internal class CWMapApiManager : MonoBehaviourPunCallbacks
{
private static GameObject hostObject;
private static CWMapApiManager hostComponent;
internal static PhotonView view;
internal static void Initialize()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
if (!((Object)(object)hostObject != (Object)null))
{
hostObject = new GameObject("Manager");
hostObject.transform.SetParent(MapApi.ParentGameObject.transform);
hostComponent = hostObject.AddComponent<CWMapApiManager>();
view = hostObject.AddComponent<PhotonView>();
view.ViewID = 225235411;
}
}
private static void StartCoroutine(IEnumerator coroutine)
{
Initialize();
((MonoBehaviour)hostComponent).StartCoroutine(coroutine);
}
[PunRPC]
private void RPC_LoadCustomMap(int index)
{
StartCoroutine(CustomMapInitializer.InitializeMap(MapApi.CustomMaps[index]));
}
private void Update()
{
MapApi.Loop();
}
}
internal class CustomMapInitializer : MonoBehaviour
{
internal static GameObject diveBellPrefab;
internal static Material worldMaterial;
internal static GameObject world;
private static CustomMap customMap;
internal static CustomMapInitializer instance;
internal MapStates States;
private void Awake()
{
((MonoBehaviour)this).StartCoroutine(Initialize());
}
internal static IEnumerator InitializeMap(CustomMap map)
{
customMap = map;
yield return (object)new WaitUntil((Func<bool>)delegate
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene2 = SceneManager.GetActiveScene();
return ((Scene)(ref activeScene2)).name == map.GetSceneName();
});
yield return (object)new WaitUntil((Func<bool>)delegate
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
return ((Scene)(ref activeScene)).IsValid();
});
GameObject initializer = new GameObject("MapInitializer");
SceneManager.MoveGameObjectToScene(initializer, SceneManager.GetActiveScene());
initializer.AddComponent<CustomMapInitializer>();
}
private IEnumerator Initialize()
{
instance = this;
yield return PluginTools.WaitForSceneIsLoaded(((Component)this).gameObject.scene);
yield return InitializeDiveBells();
yield return InitializePatrolPoints();
yield return InitializeNavMeshes();
yield return customMap.Prefix();
yield return SceneManager.LoadSceneAsync("FactoryScene", (LoadSceneMode)1);
yield return Postprocessing();
yield return customMap.Postfix();
Object.Destroy((Object)(object)((Component)this).gameObject);
}
private IEnumerator InitializeDiveBells()
{
GameObject diveBellParent = new GameObject("CustomDiveBells");
GameObject customDiveBellSpawns = customMap.GetDiveBells();
if (!Object.op_Implicit((Object)(object)customDiveBellSpawns))
{
MapApi.log.LogError((object)"Cannot find dive bell spawns in custom map");
}
for (int i = 0; i < customDiveBellSpawns.transform.childCount; i++)
{
GameObject customDiveBellSpawn = Object.Instantiate<GameObject>(diveBellPrefab, diveBellParent.transform);
((Object)customDiveBellSpawn).name = $"DiveBell ({i})";
PluginTools.CopyTransform(customDiveBellSpawns.transform.GetChild(i), customDiveBellSpawn.transform);
PhotonView photonView = customDiveBellSpawn.GetComponent<PhotonView>();
photonView.ViewID = 225235412 + i;
}
diveBellParent.AddComponent<DiveBellParent>();
Object.Destroy((Object)(object)customDiveBellSpawns);
yield return null;
}
private IEnumerator InitializePatrolPoints()
{
try
{
world = customMap.GetLevel();
world.AddComponent<Level>();
if ((Object)(object)PluginTools.FindObjectInScene(((Component)this).gameObject.scene, "CWMapApi_PatrolPoints") != (Object)null)
{
throw new Exception("Object CWMapApi_PatrolPoints is busy, please remove it from the scene, due to it needs for init custom map");
}
GameObject patrolPoints = new GameObject("CWMapApi_PatrolPoints");
patrolPoints.transform.SetParent(world.transform);
GameObject customPatrolPoints = customMap.GetPatrolPoints();
if (!Object.op_Implicit((Object)(object)customPatrolPoints))
{
MapApi.log.LogError((object)"Cannot find patrol points in custom map");
}
MapApi.log.LogInfo((object)"Initializing patrol points 6");
for (int i = 0; i < customPatrolPoints.transform.childCount; i++)
{
GameObject customPatrolPoint = new GameObject($"PatrolPoint ({i})");
customPatrolPoint.transform.SetParent(patrolPoints.transform);
PluginTools.CopyTransform(customPatrolPoints.transform.GetChild(i), customPatrolPoint.transform);
PatrolPoint point = customPatrolPoint.AddComponent<PatrolPoint>();
point.group = (PatrolGroup)4;
}
Object.Destroy((Object)(object)customPatrolPoints);
}
catch (Exception ex)
{
Exception e = ex;
MapApi.log.LogError((object)e.Message);
}
yield return null;
}
private IEnumerator InitializeNavMeshes()
{
try
{
NavMeshSurface navmeshWide = customMap.GetNavmeshWide().GetComponent<NavMeshSurface>();
if (!Object.op_Implicit((Object)(object)navmeshWide))
{
throw new Exception("Cannot find navmesh wide in custom map");
}
States.WideAgentTypeId = navmeshWide.agentTypeID;
NavMeshSurface navmesh = customMap.GetNavmesh().GetComponent<NavMeshSurface>();
if (!Object.op_Implicit((Object)(object)navmesh))
{
throw new Exception("Cannot find navmesh in custom map");
}
States.AgentTypeId = navmesh.agentTypeID;
}
catch (Exception ex)
{
Exception e = ex;
MapApi.log.LogError((object)e.Message);
}
yield return null;
}
private IEnumerator Postprocessing()
{
GameObject randomTraps = PluginTools.FindObjectInScene(SceneManager.GetSceneByName("FactoryScene"), "RandomTraps");
Object.Destroy((Object)(object)randomTraps);
yield return null;
}
}
internal struct MapStates
{
internal bool DiveBellLoaded;
internal bool LevelLoaded;
internal int WideAgentTypeId;
internal int AgentTypeId;
}
[BepInPlugin("com.merqury.cw.map_api", "CW Map API", "1.0.0")]
public class MapApi : BaseUnityPlugin
{
internal static ManualLogSource log;
internal static PluginInfo PInfo;
internal static bool ModInitialized;
internal static List<CustomMap> CustomMaps;
internal static bool EnableRandomMapPatch = true;
internal static GameObject ParentGameObject;
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
PInfo = ((BaseUnityPlugin)this).Info;
Harmony.CreateAndPatchAll(typeof(MainMenuHandlerPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(DiveBellParentPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(LevelPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(Bot_Nav_NavmeshPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(PatrolPointPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(DivingBellPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(RoomStatsHolderPatch), (string)null);
CustomMaps = new List<CustomMap>();
log.LogInfo((object)"CWMapApi Loaded!");
}
internal static void Loop()
{
foreach (NavMeshAgent agent in Bot_Nav_NavmeshPatch.Agents)
{
try
{
if (agent.agentTypeID != 0 || Object.op_Implicit((Object)(object)CustomMapInitializer.instance))
{
agent.agentTypeID = CustomMapInitializer.instance.States.WideAgentTypeId;
}
}
catch (Exception)
{
}
}
}
public static void RegisterCustomMap(CustomMap customMap)
{
List<CustomMap> list = CustomMaps.Where((CustomMap map) => map.GetMapName() == customMap.GetMapName()).ToList();
if (list.Count > 0)
{
throw new Exception("Custom map \"" + customMap.GetMapName() + "\" is already registered!");
}
CustomMaps.Add(customMap);
log.LogInfo((object)("Map \"" + customMap.GetMapName() + "\" has been registered!"));
}
public static void EnableMapPoolPatch(bool enable)
{
EnableRandomMapPatch = enable;
}
public static void UnregisterCustomMap(CustomMap customMap)
{
List<CustomMap> list = CustomMaps.Where((CustomMap map) => map.GetMapName() == customMap.GetMapName()).ToList();
if (list.Count > 0)
{
throw new Exception("Custom map \"" + customMap.GetMapName() + "\" doesn't exist!");
}
CustomMaps.RemoveAll((CustomMap map) => map.GetMapName() == customMap.GetMapName());
log.LogInfo((object)("Map \"" + customMap.GetMapName() + "\" has been unregistered!"));
}
public static IReadOnlyList<CustomMap> GetRegisteredCustomMaps()
{
return CustomMaps;
}
internal static IEnumerator InitializeMod()
{
yield return SceneManager.LoadSceneAsync("FactoryScene", (LoadSceneMode)1);
Scene sceneByName = SceneManager.GetSceneByName("FactoryScene");
GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects();
foreach (GameObject rootGameObject in rootGameObjects)
{
rootGameObject.SetActive(false);
}
ParentGameObject = new GameObject("CWMapApi");
Object.DontDestroyOnLoad((Object)(object)ParentGameObject);
CWMapApiManager.Initialize();
GameObject templates = new GameObject("Templates");
templates.transform.SetParent(ParentGameObject.transform);
GameObject spawns = PluginTools.FindObjectInScene(SceneManager.GetSceneByName("FactoryScene"), "Spawns");
GameObject divebell = ((Component)spawns.transform.GetChild(0)).gameObject;
divebell.SetActive(false);
GameObject prefab = Object.Instantiate<GameObject>(divebell, templates.transform, true);
((Object)prefab).name = "DiveBell_Template";
CustomMapInitializer.diveBellPrefab = prefab;
GameObject m1 = PluginTools.FindObjectInScene(SceneManager.GetSceneByName("FactoryScene"), "Factory Blockout");
GameObject m2 = PluginTools.FindChildInParent(m1, "Floor");
GameObject m3 = PluginTools.FindChildInParent(m2, "Roof (3)");
MeshRenderer renderer = m3.GetComponent<MeshRenderer>();
CustomMapInitializer.worldMaterial = ((Renderer)renderer).material;
yield return SceneManager.UnloadSceneAsync("FactoryScene");
ModInitialized = true;
}
}
internal class PluginTools
{
internal static void CopyTransform(Transform from, Transform to)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
to.position = from.position;
to.rotation = from.rotation;
to.localScale = from.localScale;
}
internal static GameObject FindObjectInSceneRecursive(string sceneName, string objName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return FindObjectInSceneRecursive(SceneManager.GetSceneByName(sceneName), objName);
}
internal static GameObject FindObjectInSceneRecursive(Scene scene, string objName)
{
if (!((Scene)(ref scene)).IsValid())
{
MapApi.log.LogError((object)"FindObjectInSceneRecursive failed");
return null;
}
GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
foreach (GameObject parent in rootGameObjects)
{
GameObject val = FindObjectRecursive(parent, objName);
if ((Object)(object)val != (Object)null)
{
return val;
}
}
return null;
}
private static GameObject FindObjectRecursive(GameObject parent, string objName)
{
if (((Object)parent).name == objName)
{
return parent;
}
for (int i = 0; i < parent.transform.childCount; i++)
{
GameObject gameObject = ((Component)parent.transform.GetChild(i)).gameObject;
GameObject val = FindObjectRecursive(gameObject, objName);
if ((Object)(object)val != (Object)null)
{
return val;
}
}
return null;
}
internal static void AddCubeToPoint(Transform point)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
((Object)val).name = "Visual";
val.transform.SetParent(point);
val.transform.localPosition = Vector3.zero;
val.transform.localScale = Vector3.one;
val.SetActive(false);
}
internal static GameObject FindChildInParent(GameObject parent, string childName)
{
GameObject result = null;
for (int i = 0; i < parent.transform.childCount; i++)
{
if (((Object)parent.transform.GetChild(i)).name == childName)
{
result = ((Component)parent.transform.GetChild(i)).gameObject;
}
}
return result;
}
internal static GameObject FindObjectInScene(string sceneName, string objName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return FindObjectInScene(SceneManager.GetSceneByName(sceneName), objName);
}
internal static GameObject FindObjectInScene(Scene scene, string objName)
{
GameObject result = null;
GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
foreach (GameObject val in rootGameObjects)
{
if (((Object)val).name == objName)
{
result = val;
}
}
return result;
}
internal static IEnumerator WaitForSceneIsLoaded(Scene scene)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
while (!((Scene)(ref scene)).isLoaded)
{
yield return null;
}
}
}
}
namespace CWMapApi.Patches
{
[HarmonyPatch(typeof(Bot_Nav_Navmesh))]
internal class Bot_Nav_NavmeshPatch
{
internal static List<NavMeshAgent> Agents = new List<NavMeshAgent>();
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void Postfix(Bot_Nav_Navmesh __instance)
{
MapApi.log.LogInfo((object)("Add agent from " + ((Object)((Component)((Component)__instance).gameObject.transform.parent).gameObject).name));
Agents.Add(((Component)__instance).GetComponent<NavMeshAgent>());
}
}
internal class Common
{
internal static object InvokeMethod<T>(T instance, string methodName, object[] args)
{
try
{
return typeof(T).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(instance, args);
}
catch (NullReferenceException)
{
LogNRE(typeof(T), methodName, "InvokeMethod");
throw;
}
}
internal static R GetField<T, R>(T instance, string fieldName)
{
try
{
return (R)(typeof(T).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(instance));
}
catch (NullReferenceException)
{
LogNRE(typeof(T), fieldName, "GetField");
throw;
}
}
internal static void SetField<T>(T instance, string fieldName, object value)
{
try
{
typeof(T).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(instance, value);
}
catch (NullReferenceException)
{
LogNRE(typeof(T), fieldName, "SetField");
throw;
}
}
internal static void SetStaticProperty(Type type, string fieldName, object value)
{
try
{
type.GetProperty(fieldName, BindingFlags.Static | BindingFlags.Public)?.SetValue(null, value);
}
catch (NullReferenceException)
{
LogNRE(type, fieldName, "SetField");
throw;
}
}
internal static void SetStaticField(Type type, string fieldName, object value)
{
try
{
type.GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic)?.SetValue(null, value);
}
catch (NullReferenceException)
{
LogNRE(type, fieldName, "SetField");
throw;
}
}
private static void LogNRE(Type type, string subjectName, string methodName)
{
MapApi.log.LogError((object)("NRE on " + type.Name + "." + subjectName + " in " + methodName));
}
}
[HarmonyPatch(typeof(DiveBellParent))]
internal class DiveBellParentPatch
{
[HarmonyPrefix]
[HarmonyPatch("Awake")]
internal static bool DiveBellParent_Awake(DiveBellParent __instance)
{
CustomMapInitializer instance = CustomMapInitializer.instance;
if (!MapApi.ModInitialized || (Object)(object)instance == (Object)null)
{
return true;
}
if (!instance.States.DiveBellLoaded)
{
instance.States.DiveBellLoaded = true;
return true;
}
Object.Destroy((Object)(object)((Component)__instance).gameObject);
return false;
}
[HarmonyPrefix]
[HarmonyPatch("GetSpawn")]
internal static bool DiveBellParent_GetSpawn(DiveBellParent __instance, ref SpawnPoint __result)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
State state = Random.state;
Random.InitState(GameAPI.seed);
List<Transform> list = new List<Transform>();
for (int i = 0; i < ((Component)__instance).transform.childCount; i++)
{
list.Add(((Component)__instance).transform.GetChild(i));
}
int index = Random.Range(0, list.Count);
Transform val = list[index];
for (int j = 0; j < ((Component)__instance).transform.childCount; j++)
{
if ((Object)(object)((Component)__instance).transform.GetChild(j) == (Object)(object)val)
{
((Component)((Component)__instance).transform.GetChild(j)).gameObject.SetActive(true);
}
else
{
((Component)((Component)__instance).transform.GetChild(j)).gameObject.SetActive(false);
}
}
Random.state = state;
__result = ((Component)val).GetComponentInChildren<SpawnPoint>();
return false;
}
}
[HarmonyPatch(typeof(DivingBell))]
internal class DivingBellPatch
{
[HarmonyPrefix]
[HarmonyPatch("RPC_GoToUnderground")]
private static bool RPC_GoToUnderground_Prefix(DivingBell __instance)
{
if (!PhotonNetwork.IsMasterClient)
{
return false;
}
SurfaceNetworkHandler instance = SurfaceNetworkHandler.Instance;
if ((Object)(object)instance == (Object)null)
{
return false;
}
if (!(((StateMachine<DivingBellState>)(object)__instance.StateMachine).CurrentState is DivingBellReadyState))
{
return false;
}
if (instance.PreCheckHeadToUnderWorld())
{
((MonoBehaviourPun)__instance).photonView.RPC("RPC_StartTransition", (RpcTarget)1, Array.Empty<object>());
PhotonGameLobbyHandler.Instance.CheckForIllegalItems();
Common.InvokeMethod<DivingBell>(__instance, "TransitionGameFeel", Array.Empty<object>());
RetrievableResourceSingleton<TransitionHandler>.Instance.TransitionToBlack(0.15f, (Action)delegate
{
List<string> list = new List<string> { "FactoryScene", "MinesScene", "HarbourScene" };
int levelToPlay = SurfaceNetworkHandler.RoomStats.LevelToPlay;
string text = ((levelToPlay >= list.Count) ? MapApi.CustomMaps[levelToPlay - 3].GetSceneName() : list[levelToPlay]);
RetrievableSingleton<PersistentObjectsHolder>.Instance.FindPersistantSurfaceObjects();
MapApi.log.LogInfo((object)$"Loading map with scene: {text} (level: {levelToPlay})");
PhotonNetwork.LoadLevel(text);
CWMapApiManager.view.RPC("RPC_LoadCustomMap", (RpcTarget)0, new object[1] { levelToPlay - 3 });
}, 3f);
}
return false;
}
}
[HarmonyPatch(typeof(Level))]
internal class LevelPatch
{
[HarmonyPrefix]
[HarmonyPatch("Awake")]
internal static bool Prefix(Level __instance)
{
CustomMapInitializer instance = CustomMapInitializer.instance;
if (!MapApi.ModInitialized || (Object)(object)instance == (Object)null)
{
return true;
}
if (!instance.States.LevelLoaded)
{
instance.States.LevelLoaded = true;
return true;
}
Object.DestroyImmediate((Object)(object)((Component)__instance).gameObject);
return false;
}
}
[HarmonyPatch(typeof(MainMenuHandler))]
internal class MainMenuHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
internal static void PostAwake(MainMenuHandler __instance)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
((MonoBehaviour)__instance).StartCoroutine(MapApiInit(((Component)__instance).gameObject.scene));
}
private static IEnumerator MapApiInit(Scene scene)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (!MapApi.ModInitialized)
{
MapApi.log.LogInfo((object)"Loading mod");
GameObject canvas = PluginTools.FindObjectInScene(scene, "Canvas");
GameObject mainPage = PluginTools.FindChildInParent(canvas, "MainPage");
GameObject loadingPage = PluginTools.FindChildInParent(canvas, "LoadingPage");
mainPage.SetActive(false);
loadingPage.GetComponent<MainMenuLoadingPage>().SetText("Map Api loading");
loadingPage.SetActive(true);
yield return MapApi.InitializeMod();
loadingPage.SetActive(false);
mainPage.SetActive(true);
}
}
}
[HarmonyPatch(typeof(PatrolPoint))]
internal class PatrolPointPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
internal static void Prefix(PatrolPoint __instance)
{
PluginTools.AddCubeToPoint(((Component)__instance).transform);
}
}
[HarmonyPatch(typeof(RoomStatsHolder))]
public class RoomStatsHolderPatch
{
[HarmonyPrefix]
[HarmonyPatch("NewMapToPlay")]
private static void NewMapToPlayPrefix()
{
CustomMapInitializer.instance = null;
}
[HarmonyPostfix]
[HarmonyPatch("NewMapToPlay")]
private static void NewMapToPlayPatch(RoomStatsHolder __instance)
{
if (MapApi.EnableRandomMapPatch)
{
__instance.LevelToPlay = new Random().Next(0, 3 + MapApi.CustomMaps.Count);
}
}
}
}
namespace CWMapApi.Api
{
public abstract class CustomMap
{
public abstract string GetMapName();
public abstract string GetSceneName();
public abstract GameObject GetPatrolPoints();
public abstract GameObject GetDiveBells();
public abstract GameObject GetNavmesh();
public abstract GameObject GetNavmeshWide();
public abstract GameObject GetLevel();
public virtual string GetMapIconPath()
{
return null;
}
protected GameObject GetGameObjectInMyMap(string path)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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)
string[] array = path.Split(new char[1] { '/' });
if (array.Length == 0)
{
return null;
}
try
{
Scene sceneByName = SceneManager.GetSceneByName(GetSceneName());
if (array.Length >= 1)
{
return PluginTools.FindObjectInSceneRecursive(sceneByName, array[0]);
}
}
catch (Exception)
{
return null;
}
return null;
}
protected void SetDefaultWorldMaterial(GameObject obj)
{
MeshRenderer component = obj.GetComponent<MeshRenderer>();
if (Object.op_Implicit((Object)(object)component))
{
((Renderer)component).material = CustomMapInitializer.worldMaterial;
}
}
protected void SetDefaultSkybox()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
RenderSettings.skybox = null;
RenderSettings.ambientMode = (AmbientMode)3;
RenderSettings.ambientLight = Color.black;
}
protected void SetDefaultWorldMaterialRecursive(GameObject obj)
{
MeshRenderer component = obj.GetComponent<MeshRenderer>();
if (Object.op_Implicit((Object)(object)component))
{
((Renderer)component).material = CustomMapInitializer.worldMaterial;
}
for (int i = 0; i < obj.transform.childCount; i++)
{
SetDefaultWorldMaterialRecursive(((Component)obj.transform.GetChild(i)).gameObject);
}
}
public virtual IEnumerator Prefix()
{
yield return null;
}
public virtual IEnumerator Postfix()
{
yield return null;
}
}
}