using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 RoundsFixFallThruMap
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.github.nickmartin1ee7.roundsfixfallthrumap", "Rounds Fix Fall Thru Map", "1.0.7")]
[BepInProcess("Rounds.exe")]
public class RoundsFixFallThruMap : BaseUnityPlugin
{
private const string ModId = "com.github.nickmartin1ee7.roundsfixfallthrumap";
private const string ModName = "Rounds Fix Fall Thru Map";
private const string Version = "1.0.7";
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(MapSyncPatch), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Rounds Fix Fall Thru Map is loaded.");
}
}
[HarmonyPatch(typeof(LevelManager), "RPC_HostMapHandshakeResponse")]
internal static class MapSyncPatch
{
[HarmonyPostfix]
private static void ReEnableMapsAllowedByHost(string[] levels)
{
if (levels == null || PhotonNetwork.IsMasterClient || LevelManager.levels == null)
{
return;
}
string[] array = LevelManager.levels.Keys.ToArray();
foreach (string map in array)
{
if (levels.Contains<string>(map, StringComparer.Ordinal))
{
LevelManager.EnableLevel(map, false);
}
else
{
LevelManager.DisableLevel(map, false);
}
if (!((Object)(object)ToggleLevelMenuHandler.instance != (Object)null))
{
continue;
}
foreach (GameObject item in ToggleLevelMenuHandler.instance.lvlObjs.Where((GameObject t) => ((Object)t).name == map))
{
ToggleLevelMenuHandler.UpdateVisualsLevelObj(item);
}
}
if ((Object)(object)MapManager.instance != (Object)null)
{
MapManager.instance.levels = GetActiveLevels().ToArray();
}
}
private static ICollection<string> GetActiveLevels()
{
FieldInfo field = typeof(LevelManager).GetField("activeLevels", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (field == null)
{
return Array.Empty<string>();
}
return (field.GetValue(null) as ICollection<string>) ?? Array.Empty<string>();
}
}
}