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.Versioning;
using System.Security;
using System.Security.Permissions;
using Battle;
using BepInEx;
using BepInEx.Configuration;
using Data;
using I2.Loc;
using Loading;
using Map;
using Microsoft.CodeAnalysis;
using On;
using On.Battle;
using On.PeglinUI.LoadoutManager;
using On.PeglinUI.MainMenu;
using PeglinUI.LoadoutManager;
using PeglinUI.MainMenu;
using Relics;
using TMPro;
using ToolBox.Serialization;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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("TestingFloor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Debug menu for loading battles and testing experimental features")]
[assembly: AssemblyFileVersion("0.0.3.0")]
[assembly: AssemblyInformationalVersion("0.0.3+d242f447852158516b96630484c3fa5ccc64070a")]
[assembly: AssemblyProduct("TestingFloor")]
[assembly: AssemblyTitle("TestingFloor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.3.0")]
[module: UnverifiableCode]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace TestingFloor
{
public class AimBehaviour : MonoBehaviour
{
private const string AngleSnapping = "Angle Snapping";
private const string QuantizeAimVector = "Quantize Aim Vector";
private bool _angleSnapping;
private bool _quantizeAimVector;
public void Init(ConfigFile config)
{
ConfigEntry<bool> angleSnappingEntry = config.Bind<bool>("Options", "Angle Snapping", _angleSnapping, (ConfigDescription)null);
ConfigEntry<bool> quantizeAimVectorEntry = config.Bind<bool>("Options", "Quantize Aim Vector", _angleSnapping, (ConfigDescription)null);
_angleSnapping = angleSnappingEntry.Value;
_quantizeAimVector = quantizeAimVectorEntry.Value;
TestingFloorGui.AddToggleOption("Angle Snapping", _angleSnapping, delegate(bool b)
{
_angleSnapping = b;
angleSnappingEntry.Value = b;
});
TestingFloorGui.AddToggleOption("Quantize Aim Vector", _quantizeAimVector, delegate(bool b)
{
_quantizeAimVector = b;
quantizeAimVectorEntry.Value = b;
});
}
public void OnEnable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
PachinkoBall.ApplyRotationToAimer += new hook_ApplyRotationToAimer(PachinkoBallOnApplyRotationToAimer);
}
public void OnDisable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
PachinkoBall.ApplyRotationToAimer -= new hook_ApplyRotationToAimer(PachinkoBallOnApplyRotationToAimer);
}
private void PachinkoBallOnApplyRotationToAimer(orig_ApplyRotationToAimer orig, PachinkoBall self, float zRotate, bool keepAccel)
{
//IL_0030: 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)
//IL_0039: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
float num = self._player.GetAxis("VerticalSlow");
bool flag = num != 0f;
if (_angleSnapping && flag)
{
Quaternion rotation = ((Component)self).transform.rotation;
float z = ((Quaternion)(ref rotation)).eulerAngles.z;
if (z > 90f && z < 270f)
{
num *= -1f;
}
float num2 = z + Mathf.Sign(num) * 0.05f;
num2 = Mathf.Round(num2 / 0.05f) * 0.05f;
((Component)self).transform.rotation = Quaternion.Euler(0f, 0f, num2);
self._currentControllerRotateSpeed = 0f;
rotation = ((Component)self).transform.rotation;
self._aimVector = Vector2.op_Implicit(((Quaternion)(ref rotation)).normalized * Vector3.right);
((Behaviour)self._trajectorySimulation).enabled = true;
}
else
{
orig.Invoke(self, zRotate, keepAccel);
}
if (_quantizeAimVector)
{
self._aimVector = Vector2.op_Implicit(new Vector3((Mathf.Abs(self._aimVector.x) < 1E-06f) ? 0f : self._aimVector.x, (Mathf.Abs(self._aimVector.y) < 1E-06f) ? 0f : self._aimVector.y));
}
}
}
public class DeterministicLongPegBehavior : MonoBehaviour
{
private class ExtraCollider : MonoBehaviour
{
public LongPeg reference;
private void FixedUpdate()
{
if (reference._beingHit)
{
LongPeg obj = reference;
obj._timeHit += Time.deltaTime;
float num = reference.TimeToDisappear;
if ((((Peg)reference).relicManager.RelicEffectActive((RelicEffect)10) || ((Peg)reference)._blockPoppingFromThisHit) && ((Peg)reference)._numBounces < ((Peg)reference).BouncesToPop)
{
num += 0.5f;
}
if (reference._timeHit >= num)
{
reference.SetActiveStatus(false);
reference._beingHit = false;
reference._timeHit = 0f;
}
}
}
}
private bool _useDeterministicLongPegRemoval;
private const string DeterministicLongPegRemoval = "Deterministic Long Peg Removal";
public void Init(ConfigFile config)
{
ConfigEntry<bool> entry = config.Bind<bool>("Options", "Deterministic Long Peg Removal", _useDeterministicLongPegRemoval, (ConfigDescription)null);
_useDeterministicLongPegRemoval = entry.Value;
TestingFloorGui.AddToggleOption("Deterministic Long Peg Removal", _useDeterministicLongPegRemoval, delegate(bool b)
{
_useDeterministicLongPegRemoval = b;
entry.Value = b;
});
}
public void OnEnable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
LongPeg.OnEnable += new hook_OnEnable(LongPegOnOnEnable);
LongPeg.OnDisable += new hook_OnDisable(LongPegOnOnDisable);
LongPeg.Update += new hook_Update(LongPegOnUpdate);
}
private void OnDisable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
LongPeg.OnEnable -= new hook_OnEnable(LongPegOnOnEnable);
LongPeg.OnDisable -= new hook_OnDisable(LongPegOnOnDisable);
LongPeg.Update -= new hook_Update(LongPegOnUpdate);
}
private void LongPegOnOnEnable(orig_OnEnable orig, LongPeg self)
{
orig.Invoke(self);
if (_useDeterministicLongPegRemoval)
{
((Component)self).gameObject.AddComponent<ExtraCollider>().reference = self;
}
}
private void LongPegOnOnDisable(orig_OnDisable orig, LongPeg self)
{
orig.Invoke(self);
ExtraCollider extraCollider = default(ExtraCollider);
if (((Component)self).gameObject.TryGetComponent<ExtraCollider>(ref extraCollider))
{
Object.Destroy((Object)(object)extraCollider);
}
}
private void LongPegOnUpdate(orig_Update orig, LongPeg self)
{
if (!_useDeterministicLongPegRemoval)
{
orig.Invoke(self);
}
}
}
[BepInPlugin("TestingFloor", "TestingFloor", "0.0.3")]
public class Plugin : BaseUnityPlugin
{
private LoadoutManager _loadoutManager;
private GameObject _testingFloorButton;
private TestingFloorGui _gui;
private PlayButton _playButton;
private ConfigEntry<KeyboardShortcut> _guiToggleKey;
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TestingFloor is loaded!");
_guiToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Key Bindings", "Toggle GUI Key", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Key to toggle the Testing Floor GUI visibility");
_gui = ((Component)this).gameObject.AddComponent<TestingFloorGui>();
((Behaviour)_gui).enabled = false;
((Component)this).gameObject.AddComponent<AimBehaviour>().Init(((BaseUnityPlugin)this).Config);
((Component)this).gameObject.AddComponent<DeterministicLongPegBehavior>().Init(((BaseUnityPlugin)this).Config);
PlayButton.Awake += new hook_Awake(PlayButtonOnAwake);
LoadoutManager.OnEnable += new hook_OnEnable(LoadoutManagerOnOnEnable);
BattleController.Start += new hook_Start(OnBattleControllerOnStart);
PauseMenu.QuitToMenu += new hook_QuitToMenu(OnPauseMenuOnQuitToMenu);
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = _guiToggleKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
((Behaviour)_gui).enabled = !((Behaviour)_gui).enabled;
if (((Behaviour)_gui).enabled)
{
_gui.Initialize();
}
}
}
private void OnDestroy()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
PlayButton.Awake -= new hook_Awake(PlayButtonOnAwake);
LoadoutManager.OnEnable -= new hook_OnEnable(LoadoutManagerOnOnEnable);
BattleController.Start -= new hook_Start(OnBattleControllerOnStart);
PauseMenu.QuitToMenu -= new hook_QuitToMenu(OnPauseMenuOnQuitToMenu);
Object.Destroy((Object)(object)_testingFloorButton);
}
private void PlayButtonOnAwake(orig_Awake orig, PlayButton self)
{
_playButton = self;
orig.Invoke(self);
}
private void OnPauseMenuOnQuitToMenu(orig_QuitToMenu orig, PauseMenu self)
{
if (Object.op_Implicit((Object)(object)_gui) && ((Behaviour)_gui).enabled)
{
StaticGameData.CurrentRunStats = null;
SaveObjectData[] array = DataSerializer.FetchAllData<SaveObjectData>((SaveType)1);
foreach (SaveObjectData obj in array)
{
if (obj != null)
{
obj.Delete();
}
}
((Behaviour)_gui).enabled = false;
}
orig.Invoke(self);
}
private void LoadoutManagerOnOnEnable(orig_OnEnable orig, LoadoutManager self)
{
orig.Invoke(self);
_loadoutManager = self;
InitializeUIButtons();
}
private void InitializeUIButtons()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
GameObject val = GameObject.Find("/Main Camera/LoadoutSelectCanvasGroup/Base Panel/LoadoutBasePanel/SeedHorizonalGroupPanel");
if (!Object.op_Implicit((Object)(object)val))
{
Debug.LogWarning((object)"Failed to find horizontal seed group");
return;
}
HorizontalLayoutGroup val2 = default(HorizontalLayoutGroup);
if (val.TryGetComponent<HorizontalLayoutGroup>(ref val2))
{
((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true;
}
else
{
Debug.LogWarning((object)"Failed to find/configure horizontal layout group");
}
Transform val3 = val.transform.Find("MainSeedRow");
if (!Object.op_Implicit((Object)(object)val3))
{
Debug.LogWarning((object)"Failed to find main seed row");
return;
}
_testingFloorButton = Object.Instantiate<GameObject>(((Component)val3).gameObject, val3.parent);
InitSceneButton(_testingFloorButton, "Testing Floor", new UnityAction(LoadForest));
static void InitSceneButton(GameObject o, string buttonLabel, UnityAction call)
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
Transform obj = o.transform.Find("SeedDisplayPanel");
Object.Destroy((Object)(object)((obj != null) ? ((Component)obj).gameObject : null));
Transform val4 = o.transform.Find("seedText");
if (!Object.op_Implicit((Object)(object)val4))
{
Debug.LogWarning((object)$"Failed to find text game object for {o}");
}
else
{
Localize val5 = default(Localize);
if (((Component)val4).TryGetComponent<Localize>(ref val5))
{
Debug.Log((object)"Destroying localization");
Object.Destroy((Object)(object)val5);
}
else
{
Debug.Log((object)"No localization found");
}
TextMeshProUGUI component = ((Component)val4).GetComponent<TextMeshProUGUI>();
if (component == null)
{
Debug.LogWarning((object)$"Failed to find seed text tmpro for {o}");
}
else
{
((TMP_Text)component).text = buttonLabel;
Button componentInChildren = o.GetComponentInChildren<Button>();
if (!Object.op_Implicit((Object)(object)componentInChildren))
{
Debug.LogWarning((object)$"Failed to find button game object for {o}");
}
else
{
componentInChildren.onClick = new ButtonClickedEvent();
((UnityEvent)componentInChildren.onClick).AddListener(call);
}
}
}
}
}
public void ListBattles()
{
Debug.Log((object)"All Loaded Battles");
MapDataBattle[] source = Resources.FindObjectsOfTypeAll<MapDataBattle>();
Debug.Log((object)string.Join('\n', source.ToList()));
Debug.Log((object)"Map Controller Battles");
Debug.Log((object)string.Join('\n', MapController.instance._allRandomBattles));
}
public void LoadBattle(string battleName = null)
{
MapController instance = MapController.instance;
MapDataBattle[] array = Resources.FindObjectsOfTypeAll<MapDataBattle>();
if (string.IsNullOrEmpty(battleName))
{
int index = Random.Range(0, array.Length);
instance.LoadSceneFromMapData((MapData)(object)array.ElementAt(index));
return;
}
MapDataBattle val = array.First((MapDataBattle b) => ((Object)b).name == battleName);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("Failed to find battle with name: " + battleName));
}
instance.LoadSceneFromMapData((MapData)(object)val);
}
public void ListResources()
{
foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
{
Debug.Log((object)("Checking asset bundle " + ((Object)allLoadedAssetBundle).name));
Debug.Log((object)string.Join('\n', allLoadedAssetBundle.GetAllAssetNames()));
}
}
public void LoadForest()
{
LoadScene((Scene)2);
}
public void LoadCastle()
{
LoadScene((Scene)5);
}
public void LoadMines()
{
LoadScene((Scene)7);
}
private void LoadScene(Scene scene)
{
_playButton.ConfirmRunConfigAndStartGame();
StaticGameData.CurrentRunStats.isCustomRun = true;
_loadoutManager.SetupDataForNewGame();
((Behaviour)_gui).enabled = true;
}
private IEnumerator OnBattleControllerOnStart(orig_Start orig, BattleController self)
{
IEnumerator result = orig.Invoke(self);
if (((Behaviour)_gui).enabled)
{
_gui.Initialize(self);
}
return result;
}
}
public class TestingFloorGui : MonoBehaviour
{
private class ToggleOption
{
public string Label { get; }
public bool Enabled { get; private set; }
public event Action<bool> OnToggle;
public ToggleOption(string label, bool enabled)
{
Label = label;
Enabled = enabled;
base..ctor();
}
public void Toggle()
{
Action<bool> onToggle = this.OnToggle;
if (onToggle != null)
{
bool obj = (Enabled = !Enabled);
onToggle(obj);
}
}
}
private bool _battleListOpen = true;
private bool _relicListOpen = true;
private Vector2 _battleScrollPosition;
private Vector2 _relicScrollPosition;
private HashSet<MapDataBattle> _battles = new HashSet<MapDataBattle>();
private bool _allowAllMapData;
private Rect _sceneSelectRect = new Rect(20f, 20f, 300f, 0f);
private Rect _statsRect = new Rect(340f, 20f, 350f, 0f);
private BattleController _battleController;
private Texture2D _blackBackground;
private GameObject _screenOverlay;
private Image _statsImageBackground;
private Image _sceneSelectImageBackground;
private Texture2D _buttonHighlightTexture;
private float _previousShotRotation = -1f;
private static Dictionary<string, ToggleOption> _toggleOptions = new Dictionary<string, ToggleOption>();
private List<Relic> _relics = new List<Relic>();
public void Awake()
{
//IL_0016: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_0103: Expected O, but got Unknown
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
_blackBackground = CreateColorTexture(new Color(0f, 0f, 0f, 0.62f));
_buttonHighlightTexture = CreateColorTexture(new Color(0.13f, 0.27f, 0.53f));
_screenOverlay = new GameObject("ScreenOverlay");
_screenOverlay.transform.SetParent(((Component)this).transform);
_screenOverlay.AddComponent<Canvas>().renderMode = (RenderMode)0;
_screenOverlay.AddComponent<GraphicRaycaster>();
GameObject val = new GameObject("StatsGuiWindowBackground");
val.transform.SetParent(_screenOverlay.transform);
_statsImageBackground = val.AddComponent<Image>();
((Graphic)_statsImageBackground).color = new Color(1f, 0.3f, 1f, 0f);
((Graphic)_statsImageBackground).rectTransform.pivot = new Vector2(0f, 1f);
GameObject val2 = new GameObject("SceneSelectGuiWindowBackground");
val2.transform.SetParent(_screenOverlay.transform);
_sceneSelectImageBackground = val2.AddComponent<Image>();
((Graphic)_sceneSelectImageBackground).color = new Color(1f, 0.3f, 1f, 0f);
((Graphic)_sceneSelectImageBackground).rectTransform.pivot = new Vector2(0f, 1f);
PachinkoBall.Fire += new hook_Fire(PachinkoBallOnFire);
}
public void OnEnable()
{
_screenOverlay.SetActive(true);
}
public void OnDisable()
{
_screenOverlay.SetActive(false);
}
public void Update()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)_statsImageBackground))
{
((Graphic)_statsImageBackground).rectTransform.sizeDelta = new Vector2(((Rect)(ref _statsRect)).width, ((Rect)(ref _statsRect)).height);
((Transform)((Graphic)_statsImageBackground).rectTransform).position = Vector2.op_Implicit(new Vector2(((Rect)(ref _statsRect)).x, (float)Screen.height - ((Rect)(ref _statsRect)).y));
}
if (Object.op_Implicit((Object)(object)_sceneSelectImageBackground))
{
((Graphic)_sceneSelectImageBackground).rectTransform.sizeDelta = new Vector2(((Rect)(ref _sceneSelectRect)).width, ((Rect)(ref _sceneSelectRect)).height);
((Transform)((Graphic)_sceneSelectImageBackground).rectTransform).position = Vector2.op_Implicit(new Vector2(((Rect)(ref _sceneSelectRect)).x, (float)Screen.height - ((Rect)(ref _sceneSelectRect)).y));
}
}
public void OnDestroy()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
Object.Destroy((Object)(object)_blackBackground);
Object.Destroy((Object)(object)_buttonHighlightTexture);
Object.Destroy((Object)(object)_screenOverlay);
PachinkoBall.Fire -= new hook_Fire(PachinkoBallOnFire);
}
private void PachinkoBallOnFire(orig_Fire orig, PachinkoBall self, bool notifyFire)
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, notifyFire);
Quaternion rotation = ((Component)self).transform.rotation;
_previousShotRotation = ((Quaternion)(ref rotation)).eulerAngles.z;
}
public static void AddToggleOption(string label, bool initialState, Action<bool> changed)
{
if (_toggleOptions.ContainsKey(label))
{
Debug.LogWarning((object)("Option " + label + " already exists"));
return;
}
ToggleOption toggleOption = new ToggleOption(label, initialState);
toggleOption.OnToggle += changed;
_toggleOptions[label] = toggleOption;
}
public static bool RemoveToggleOption(string label)
{
return _toggleOptions.Remove(label);
}
public void Initialize(BattleController battleController = null)
{
Debug.Log((object)$"Initialize GUI with battlecontroller: {battleController}");
_battleController = ((!Object.op_Implicit((Object)(object)battleController)) ? Object.FindObjectOfType<BattleController>() : battleController);
MapController instance = MapController.instance;
if (Object.op_Implicit((Object)(object)instance))
{
Initialize(instance);
}
else
{
Debug.LogWarning((object)"Failed to initialize Testing Floor GUI, MapController instance not found");
}
}
private void Initialize(MapController mapController)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
_battles = new HashSet<MapDataBattle>(mapController._allEasyBattles);
_battles.UnionWith(mapController._allRandomBattles);
_battles.UnionWith(mapController._potentialEliteBattles);
MapDataBattle[] array = Resources.FindObjectsOfTypeAll<MapDataBattle>();
foreach (MapDataBattle val in array)
{
if (_allowAllMapData || (int)val.bossType > 0)
{
_battles.Add(val);
}
}
if (Object.op_Implicit((Object)(object)_battleController?._relicManager))
{
_relics = _battleController._relicManager.globalRelics.relics.OrderBy((Relic r) => r.globalRarity).ThenBy<Relic, string>((Relic r) => r.englishDisplayName, StringComparer.Ordinal).ToList();
}
}
private void OnGUI()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0051: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_0061: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
//IL_0085: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
//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)
if (Object.op_Implicit((Object)(object)MapController.instance))
{
GUILayoutOption val = GUILayout.Height((float)((_battleListOpen && _battles.Count > 0) ? 400 : 0));
GUIStyle val2 = new GUIStyle(GUI.skin.window)
{
padding = new RectOffset(0, 0, 18, 0),
margin = new RectOffset(0, 0, 0, 0)
};
_sceneSelectRect = GUILayout.Window(0, _sceneSelectRect, new WindowFunction(SceneSelectGui), "Select Scene", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { val });
if (Object.op_Implicit((Object)(object)_battleController))
{
GUILayoutOption val3 = GUILayout.Height((float)(_relicListOpen ? 400 : 0));
_statsRect = GUILayout.Window(1, _statsRect, new WindowFunction(StatsGui), "Stats & Options", val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { val3 });
}
}
}
private void StatsGui(int windowId)
{
//IL_0015: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0045: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Expected O, but got Unknown
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Expected O, but got Unknown
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
GUI.DragWindow(new Rect(0f, 0f, (float)Screen.width, 18f));
GUILayout.BeginVertical(new GUIStyle
{
normal = new GUIStyleState
{
background = _blackBackground
}
}, Array.Empty<GUILayoutOption>());
GameObject activePachinkoBall = _battleController.activePachinkoBall;
if (Object.op_Implicit((Object)(object)activePachinkoBall))
{
Quaternion rotation = activePachinkoBall.transform.rotation;
GUILayout.Label("Orb Rotation: <b>" + ((Quaternion)(ref rotation)).eulerAngles.z.ToString("G") + "</b>", Array.Empty<GUILayoutOption>());
}
if (_previousShotRotation >= 0f)
{
GUILayout.Label("Last shot aim rotation: <b>" + _previousShotRotation + "</b>", Array.Empty<GUILayoutOption>());
}
PachinkoBall val = default(PachinkoBall);
if (Object.op_Implicit((Object)(object)activePachinkoBall) && activePachinkoBall.TryGetComponent<PachinkoBall>(ref val))
{
Vector2 normalized = ((Vector2)(ref val._aimVector)).normalized;
GUILayout.Label("Normalized Aim Vector: <b>" + ((Vector2)(ref normalized)).ToString("G") + "</b>", Array.Empty<GUILayoutOption>());
}
GUIStyle val2 = new GUIStyle(GUI.skin.toggle)
{
contentOffset = new Vector2(6f, 0f)
};
foreach (ToggleOption value in _toggleOptions.Values)
{
if (GUILayout.Toggle(value.Enabled, value.Label + ": <b>" + (value.Enabled ? "On" : "Off") + "</b>", val2, Array.Empty<GUILayoutOption>()) != value.Enabled)
{
value.Toggle();
}
}
if (GUILayout.Button("Heal to Full", Array.Empty<GUILayoutOption>()))
{
_battleController._playerHealthController.HealToFull();
}
if (GUILayout.Button("Shuffle Deck", Array.Empty<GUILayoutOption>()))
{
_battleController.DestroyCurrentBall();
_battleController.ShuffleDeck();
}
if (GUILayout.Button("Refresh Board", Array.Empty<GUILayoutOption>()))
{
_battleController.pegManager.ResetPegs(false);
}
if (_relics.Count > 0)
{
GUIStyle val3 = new GUIStyle(GUI.skin.button)
{
alignment = (TextAnchor)3,
fontSize = 14,
fontStyle = (FontStyle)1
};
_relicListOpen = GUILayout.Toggle(_relicListOpen, (_relicListOpen ? "▼" : "▶") + " Relics", val3, Array.Empty<GUILayoutOption>());
RelicManager relicManager = _battleController._relicManager;
if (_relicListOpen && Object.op_Implicit((Object)(object)relicManager))
{
_relicScrollPosition = GUILayout.BeginScrollView(_relicScrollPosition, Array.Empty<GUILayoutOption>());
foreach (Relic relic in _relics)
{
GUIStyle val4 = new GUIStyle(GUI.skin.button);
bool flag = relicManager.RelicEffectActive(relic.effect);
if (Object.op_Implicit((Object)(object)_buttonHighlightTexture) && flag)
{
val4.normal.background = _buttonHighlightTexture;
val4.active.background = _buttonHighlightTexture;
val4.hover.background = _buttonHighlightTexture;
}
if (GUILayout.Button(relic.englishDisplayName, val4, Array.Empty<GUILayoutOption>()))
{
if (flag)
{
relicManager.RemoveRelic(relic);
}
else
{
relicManager.AddRelic(relic);
}
}
}
GUILayout.EndScrollView();
}
}
GUILayout.EndVertical();
}
private void SceneSelectGui(int windowId)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_007e: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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_00c5: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Expected O, but got Unknown
//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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_0151: 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_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Expected O, but got Unknown
GUI.DragWindow(new Rect(0f, 0f, (float)Screen.width, 18f));
if (_battles.Count == 0)
{
if (GUILayout.Button("Waiting for battles to load", GUI.skin.button, Array.Empty<GUILayoutOption>()))
{
try
{
Initialize();
return;
}
catch (Exception ex)
{
Debug.LogWarning((object)ex);
return;
}
}
return;
}
GUILayout.BeginVertical(new GUIStyle
{
normal = new GUIStyleState
{
background = _blackBackground
}
}, Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
Scene[] array = new Scene[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
List<Scene> list = new List<Scene>(new <>z__ReadOnlyArray<Scene>((Scene[])(object)array));
GUIStyle val = new GUIStyle(GUI.skin.button)
{
padding = new RectOffset(10, 10, 10, 10),
fontStyle = (FontStyle)1
};
foreach (Scene item in list)
{
if (GUILayout.Button(PeglinSceneLoader.SceneToString(item), val, Array.Empty<GUILayoutOption>()))
{
_battles.Clear();
MapController instance = MapController.instance;
PeglinSceneLoader.Instance.LoadScene(item, (LoadSceneMode)0, false);
Object.Destroy((Object)(object)((instance != null) ? ((Component)instance).gameObject : null));
}
}
GUILayout.EndHorizontal();
GUIStyle val2 = new GUIStyle(GUI.skin.button);
val2.normal.textColor = Color.white;
val2.alignment = (TextAnchor)3;
val2.fontSize = 14;
val2.fontStyle = (FontStyle)1;
GUIStyle val3 = val2;
_battleListOpen = GUILayout.Toggle(_battleListOpen, (_battleListOpen ? "▼" : "▶") + " Battles", val3, Array.Empty<GUILayoutOption>());
if (_battleListOpen)
{
_battleScrollPosition = GUILayout.BeginScrollView(_battleScrollPosition, Array.Empty<GUILayoutOption>());
foreach (MapDataBattle battle in _battles)
{
GUIStyle val4 = new GUIStyle(GUI.skin.button);
PegLayout pegLayout = battle.pegLayout;
BattleController battleController = _battleController;
if ((Object)(object)pegLayout == (Object)(object)((battleController != null) ? battleController.pegLayout : null) && Object.op_Implicit((Object)(object)_buttonHighlightTexture))
{
val4.normal.background = _buttonHighlightTexture;
val4.active.background = _buttonHighlightTexture;
val4.hover.background = _buttonHighlightTexture;
}
if (GUILayout.Button(((Object)battle).name, val4, Array.Empty<GUILayoutOption>()))
{
MapController.instance.LoadSceneFromMapData((MapData)(object)battle);
}
}
GUILayout.EndScrollView();
}
GUILayout.EndVertical();
}
private Texture2D CreateColorTexture(Color color)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(128, 128);
for (int i = 0; i < ((Texture)val).height; i++)
{
for (int j = 0; j < ((Texture)val).width; j++)
{
val.SetPixel(j, i, color);
}
}
val.Apply();
return val;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TestingFloor";
public const string PLUGIN_NAME = "TestingFloor";
public const string PLUGIN_VERSION = "0.0.3";
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
int ICollection.Count => _items.Length;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => _items.Length;
T IReadOnlyList<T>.this[int index] => _items[index];
int ICollection<T>.Count => _items.Length;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlyArray(T[] items)
{
_items = items;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_items).GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
((ICollection)_items).CopyTo(array, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return ((IList)_items).Contains(value);
}
int IList.IndexOf(object value)
{
return ((IList)_items).IndexOf(value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return ((IEnumerable<T>)_items).GetEnumerator();
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return ((ICollection<T>)_items).Contains(item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
((ICollection<T>)_items).CopyTo(array, arrayIndex);
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return ((IList<T>)_items).IndexOf(item);
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}