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 BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CustomEnemyInCyberGrind")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomEnemyInCyberGrind")]
[assembly: AssemblyTitle("CustomEnemyInCyberGrind")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[Serializable]
public class ConfigEntries
{
public ConfigEntry<int> SpawnWave;
public ConfigEntry<int> SpawnCost;
public ConfigEntry<int> CostIncreasePerSpaw;
}
namespace CustomEnemyInCyberGrind;
public class ControllerPointerCustom : MonoBehaviour
{
private static RaycastResult? bestResult;
private PointerEventData eventData;
private static int ignoreFrame;
[SerializeField]
private UnityEvent onPressed;
[SerializeField]
private UnityEvent onReleased;
[SerializeField]
private UnityEvent onEnter;
[SerializeField]
private UnityEvent onExit;
[SerializeField]
private float dragThreshold;
private bool entered;
private bool pointerDown;
private bool scrollState;
public static GraphicRaycaster raycaster;
private List<RaycastResult> results;
private Vector2? dragPoint;
private bool dragging;
public UnityEvent OnPressed => onPressed;
public UnityEvent OnReleased => onReleased;
public UnityEvent OnEnter => onEnter;
public UnityEvent OnExit => onExit;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
if (onPressed == null)
{
onPressed = new UnityEvent();
}
if (onReleased == null)
{
onReleased = new UnityEvent();
}
if (onEnter == null)
{
onEnter = new UnityEvent();
}
if (onExit == null)
{
onExit = new UnityEvent();
}
results = new List<RaycastResult>();
}
private void UpdateSlider()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
Slider val = default(Slider);
if (!((Component)this).TryGetComponent<Slider>(ref val))
{
return;
}
if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed)
{
RectTransform component = ((Component)val).GetComponent<RectTransform>();
Vector2 val2 = new Vector2((float)Screen.width, (float)Screen.height) / 2f;
Rect rect = component.rect;
Vector2 val3 = default(Vector2);
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(component, val2, ((BaseRaycaster)raycaster).eventCamera, ref val3))
{
if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame && ((Rect)(ref rect)).Contains(val3))
{
scrollState = true;
}
else if (!scrollState)
{
return;
}
float num = Mathf.InverseLerp(((Rect)(ref rect)).x, ((Rect)(ref rect)).x + ((Rect)(ref rect)).width, val3.x);
val.value = val.minValue + num * (val.maxValue - val.minValue);
}
}
else
{
scrollState = false;
}
}
private void UpdateScrollbars()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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)
//IL_00b6: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: 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)
ScrollRect val = default(ScrollRect);
if (!((Component)this).TryGetComponent<ScrollRect>(ref val))
{
return;
}
if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed)
{
if (val.horizontal)
{
UpdateScrollbar(val.horizontalScrollbar);
}
if (val.vertical)
{
UpdateScrollbar(val.verticalScrollbar);
}
}
else
{
scrollState = false;
}
RectTransform content = val.content;
Vector2 val2 = new Vector2((float)Screen.width, (float)Screen.height) / 2f;
Vector2 val3 = default(Vector2);
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(content, val2, ((BaseRaycaster)raycaster).eventCamera, ref val3))
{
return;
}
Rect rect = content.rect;
if (((Rect)(ref rect)).Contains(val3))
{
if (val.horizontal)
{
Scrollbar horizontalScrollbar = val.horizontalScrollbar;
float value = horizontalScrollbar.value;
float num = ((InputControl<float>)(object)Mouse.current.scroll.x).ReadValue() / 2f;
rect = content.rect;
horizontalScrollbar.value = value + num / ((Rect)(ref rect)).height;
}
if (val.vertical)
{
Scrollbar verticalScrollbar = val.verticalScrollbar;
float value2 = verticalScrollbar.value;
float num2 = ((InputControl<float>)(object)Mouse.current.scroll.y).ReadValue() / 2f;
rect = content.rect;
verticalScrollbar.value = value2 + num2 / ((Rect)(ref rect)).height;
}
}
}
private void UpdateScrollbar(Scrollbar scroll)
{
//IL_0014: 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_0023: 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_002c: 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_009c: 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)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected I4, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: 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)
RectTransform component = ((Component)scroll).GetComponent<RectTransform>();
Vector2 val = new Vector2((float)Screen.width, (float)Screen.height) / 2f;
Rect rect = component.rect;
Vector2 val2 = default(Vector2);
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(component, val, ((BaseRaycaster)raycaster).eventCamera, ref val2))
{
if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame && ((Rect)(ref rect)).Contains(val2))
{
scrollState = true;
}
else if (!scrollState)
{
return;
}
Direction direction = scroll.direction;
Direction val3 = direction;
switch ((int)val3)
{
case 0:
scroll.value = Mathf.InverseLerp(((Rect)(ref rect)).x, ((Rect)(ref rect)).x + ((Rect)(ref rect)).width, val2.x);
break;
case 1:
scroll.value = Mathf.InverseLerp(((Rect)(ref rect)).x + ((Rect)(ref rect)).width, ((Rect)(ref rect)).x, val2.x);
break;
case 2:
scroll.value = Mathf.InverseLerp(((Rect)(ref rect)).y, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height, val2.y);
break;
case 3:
scroll.value = Mathf.InverseLerp(((Rect)(ref rect)).y + ((Rect)(ref rect)).height, ((Rect)(ref rect)).y, val2.y);
break;
}
}
}
private void Update()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)EventSystem.current) || !Object.op_Implicit((Object)(object)raycaster) || !Object.op_Implicit((Object)(object)((BaseRaycaster)raycaster).eventCamera) || (Object.op_Implicit((Object)(object)MonoSingleton<OptionsManager>.Instance) && MonoSingleton<OptionsManager>.Instance.paused))
{
return;
}
eventData = new PointerEventData(EventSystem.current)
{
button = (InputButton)0,
position = new Vector2((float)(Object.op_Implicit((Object)(object)raycaster) ? ((BaseRaycaster)raycaster).eventCamera.pixelWidth : Screen.width) / 2f, (float)(Object.op_Implicit((Object)(object)raycaster) ? ((BaseRaycaster)raycaster).eventCamera.pixelHeight : Screen.height) / 2f)
};
if (Object.op_Implicit((Object)(object)raycaster) && ignoreFrame != Time.frameCount)
{
ignoreFrame = Time.frameCount;
bestResult = null;
results.Clear();
((BaseRaycaster)raycaster).Raycast(eventData, results);
Text val = default(Text);
foreach (RaycastResult result in results)
{
RaycastResult current = result;
if (!((RaycastResult)(ref current)).gameObject.TryGetComponent<Text>(ref val) && (!bestResult.HasValue || bestResult.Value.depth <= current.depth))
{
bestResult = current;
}
}
}
UpdateEvents();
UpdateSlider();
UpdateScrollbars();
}
private void UpdateEvents()
{
//IL_0020: 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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Expected O, but got Unknown
if (!bestResult.HasValue)
{
return;
}
bool flag = entered;
RaycastResult value = bestResult.Value;
entered = (Object)(object)((RaycastResult)(ref value)).gameObject == (Object)(object)((Component)this).gameObject;
if (entered && !flag)
{
ExecuteEvents.Execute<IPointerEnterHandler>(((Component)this).gameObject, (BaseEventData)(object)eventData, ExecuteEvents.pointerEnterHandler);
UnityEvent val = onEnter;
if (val != null)
{
val.Invoke();
}
}
if (entered && !MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame)
{
pointerDown = true;
ExecuteEvents.Execute<IPointerDownHandler>(((Component)this).gameObject, (BaseEventData)(object)eventData, ExecuteEvents.pointerDownHandler);
ExecuteEvents.Execute<IPointerClickHandler>(((Component)this).gameObject, (BaseEventData)(object)eventData, ExecuteEvents.pointerClickHandler);
UnityEvent val2 = onPressed;
if (val2 != null)
{
val2.Invoke();
}
dragPoint = eventData.position;
}
if (pointerDown && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasCanceledThisFrame)
{
pointerDown = false;
ExecuteEvents.Execute<IPointerUpHandler>(((Component)this).gameObject, (BaseEventData)(object)eventData, ExecuteEvents.pointerUpHandler);
UnityEvent val3 = onReleased;
if (val3 != null)
{
val3.Invoke();
}
}
if (flag && !entered)
{
ExecuteEvents.Execute<IPointerExitHandler>(((Component)this).gameObject, (BaseEventData)(object)eventData, ExecuteEvents.pointerExitHandler);
UnityEvent val4 = onExit;
if (val4 != null)
{
val4.Invoke();
}
}
if (dragPoint.HasValue)
{
Vector2 delta = eventData.position - dragPoint.Value;
PointerEventData val5 = new PointerEventData(EventSystem.current)
{
button = (InputButton)0,
position = eventData.position,
pressPosition = dragPoint.Value,
delta = delta
};
if (pointerDown && entered && ((Vector2)(ref delta)).sqrMagnitude >= dragThreshold * dragThreshold)
{
ExecuteEvents.Execute<IBeginDragHandler>(((Component)this).gameObject, (BaseEventData)(object)val5, ExecuteEvents.beginDragHandler);
dragging = true;
}
if (dragging)
{
ExecuteEvents.Execute<IDragHandler>(((Component)this).gameObject, (BaseEventData)(object)val5, ExecuteEvents.dragHandler);
}
if (!pointerDown | !entered)
{
dragging = false;
dragPoint = null;
ExecuteEvents.Execute<IEndDragHandler>(((Component)this).gameObject, (BaseEventData)(object)val5, ExecuteEvents.endDragHandler);
}
}
}
}
[HarmonyPatch(typeof(EndlessGrid), "Start")]
public class ChangeEnemies
{
public static void Postfix(ref PrefabDatabase ___prefabs)
{
PrefabDatabase val = ___prefabs;
Plugin.prefabs = ___prefabs;
}
}
[HarmonyPatch(typeof(Wicked), "Start")]
public class SetWickedPartolPoint
{
public static bool Prefix(Wicked __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (SceneHelper.CurrentScene == "Level 0-S")
{
return true;
}
Transform[] array = (Transform[])(object)new Transform[1];
GameObject val = new GameObject("point");
val.transform.position = ((Component)__instance).transform.position;
array[0] = val.transform;
__instance.patrolPoints = array;
return true;
}
}
[HarmonyPatch(typeof(Machine), "Start")]
public class plsDie
{
public static bool Prefix(Machine __instance)
{
if (SceneHelper.CurrentScene != "Endless")
{
return true;
}
__instance.dontDie = false;
return true;
}
}
[BepInPlugin("CEICG", "CustomEnemyInCyberGrind", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
public enum TypeOfInput
{
SpawnCost,
SpawnWave,
CostIncrease
}
public enum TypeOfCyber
{
Proj,
Special,
Melee,
Uncommon
}
public Harmony Harmony;
public string ShopKey = "Assets/Prefabs/Levels/Testament Shop.prefab";
public string ButtonKey = "Assets/Prefabs/UI/Reset Button.prefab";
public string[] Keys = new string[41]
{
"Assets/Data/Sandbox/Enemies/CentaurTower.asset", "Assets/Data/Sandbox/Enemies/Sisyphus Prime.asset", "Assets/Data/Sandbox/Enemies/Guttertank.asset", "Assets/Data/Sandbox/Enemies/Something Wicked.asset", "Assets/Data/Sandbox/Enemies/Flesh Panopticon.asset", "Assets/Data/Sandbox/Enemies/Idol.asset", "Assets/Data/Sandbox/Enemies/V2 2nd.asset", "Assets/Data/Sandbox/Enemies/Gabriel 2nd.asset", "Assets/Data/Sandbox/Enemies/Big Johnator.asset", "Assets/Data/Sandbox/Enemies/Minotaur.asset",
"Assets/Data/Sandbox/Enemies/Mass.asset", "Assets/Data/Sandbox/Enemies/Projectile Husk.asset", "Assets/Data/Sandbox/Enemies/Super Projectile Husk.asset", "Assets/Data/Sandbox/Enemies/Drone.asset", "Assets/Data/Sandbox/Enemies/Flesh Prison.asset", "Assets/Data/Sandbox/Enemies/Stalker.asset", "Assets/Data/Sandbox/Enemies/Minos Prime.asset", "Assets/Data/Sandbox/Enemies/Husk.asset", "Assets/Data/Sandbox/Enemies/CentaurRocketLauncher.asset", "Assets/Data/Sandbox/Enemies/Centaur.asset",
"Assets/Data/Sandbox/Enemies/Turret.asset", "Assets/Data/Sandbox/Enemies/Ferryman.asset", "Assets/Data/Sandbox/Enemies/Shotgun Husk.asset", "Assets/Data/Sandbox/Enemies/Mandalore.asset", "Assets/Data/Sandbox/Enemies/Sisyphus.asset", "Assets/Data/Sandbox/Enemies/Cancerous Rodent.asset", "Assets/Data/Sandbox/Enemies/Malicious Face.asset", "Assets/Data/Sandbox/Enemies/Gutterman.asset", "Assets/Data/Sandbox/Enemies/Street Cleaner.asset", "Assets/Data/Sandbox/Enemies/CentaurMortar.asset",
"Assets/Data/Sandbox/Enemies/Leviathan.asset", "Assets/Data/Sandbox/Enemies/Very Cancerous Rodent.asset", "Assets/Data/Sandbox/Enemies/Gabriel.asset", "Assets/Data/Sandbox/Enemies/Puppet.asset", "Assets/Data/Sandbox/Enemies/Mindflayer.asset", "Assets/Data/Sandbox/Enemies/Cerberus.asset", "Assets/Data/Sandbox/Enemies/Virtue.asset", "Assets/Data/Sandbox/Enemies/Minos.asset", "Assets/Data/Sandbox/Enemies/Mannequin.asset", "Assets/Data/Sandbox/Enemies/V2.asset",
"Assets/Data/Sandbox/Enemies/Swordmachine.asset"
};
public GameObject ShopPrefab;
public GameObject ButtonPrefab;
public GameObject SelectedEnemy;
private GameObject PreviousPreview;
public static List<SpawnableObject> objects = new List<SpawnableObject>();
public static PrefabDatabase prefabs;
private List<EndlessEnemy> endlessEnemies = new List<EndlessEnemy>();
private GameObject leThingy;
private Dictionary<EndlessEnemy, ConfigEntries> ConfigEntriesDic = new Dictionary<EndlessEnemy, ConfigEntries>();
public TypeOfCyber SelectedCyberType;
private GameObject Template;
private void MakeConfigs(SpawnableObject theObject, EndlessEnemy endlessEnemy)
{
ConfigEntries configEntries = new ConfigEntries();
configEntries.SpawnCost = ((BaseUnityPlugin)this).Config.Bind<int>(theObject.objectName, theObject.objectName + " spawn cost", endlessEnemy.spawnCost, (ConfigDescription)null);
configEntries.SpawnWave = ((BaseUnityPlugin)this).Config.Bind<int>(theObject.objectName, theObject.objectName + " spawn wave", endlessEnemy.spawnWave, (ConfigDescription)null);
configEntries.CostIncreasePerSpaw = ((BaseUnityPlugin)this).Config.Bind<int>(theObject.objectName, theObject.objectName + " cost increase per spawn", endlessEnemy.costIncreasePerSpawn, (ConfigDescription)null);
endlessEnemy.spawnWave = configEntries.SpawnWave.Value;
endlessEnemy.spawnCost = configEntries.SpawnCost.Value;
endlessEnemy.costIncreasePerSpawn = configEntries.CostIncreasePerSpaw.Value;
ConfigEntriesDic.Add(endlessEnemy, configEntries);
}
private void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
Harmony = new Harmony("CEICG");
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin CEICG is loaded!");
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
Assembly executingAssembly = Assembly.GetExecutingAssembly();
ref GameObject reference = ref leThingy;
Object obj = AssetBundle.LoadFromStream(executingAssembly.GetManifestResourceStream("CustomEnemyInCyberGrind.enemyselectionterminal.bundle")).LoadAllAssets()[0];
reference = (GameObject)(object)((obj is GameObject) ? obj : null);
}
public IEnumerator GetShop()
{
AsyncOperationHandle<GameObject> objectHandle = Addressables.LoadAssetAsync<GameObject>((object)ShopKey);
yield return (object)new WaitUntil((Func<bool>)(() => objectHandle.IsDone));
((BaseUnityPlugin)this).Logger.LogInfo((object)("loaded " + ((Object)objectHandle.Result).name + " with key " + ShopKey));
ShopPrefab = objectHandle.Result;
}
public IEnumerator GetButton()
{
AsyncOperationHandle<GameObject> objectHandle = Addressables.LoadAssetAsync<GameObject>((object)ButtonKey);
yield return (object)new WaitUntil((Func<bool>)(() => objectHandle.IsDone));
((BaseUnityPlugin)this).Logger.LogInfo((object)("loaded " + ((Object)objectHandle.Result).name + " with key " + ButtonKey));
ButtonPrefab = objectHandle.Result;
}
public IEnumerator GetEnemies()
{
objects.Clear();
string[] keys = Keys;
foreach (string key in keys)
{
AsyncOperationHandle<SpawnableObject> objectHandle = Addressables.LoadAssetAsync<SpawnableObject>((object)key);
yield return (object)new WaitUntil((Func<bool>)(() => objectHandle.IsDone));
((BaseUnityPlugin)this).Logger.LogInfo((object)("loaded " + objectHandle.Result.objectName + " with key " + key));
objects.Add(objectHandle.Result);
}
}
public static bool IsChildOf(GameObject childObject, GameObject parentObject)
{
Transform parent = childObject.transform.parent;
while ((Object)(object)parent != (Object)null)
{
if ((Object)(object)((Component)parent).gameObject == (Object)(object)parentObject)
{
return true;
}
parent = parent.parent;
}
return false;
}
private EndlessEnemy isEndlessEnemy(SpawnableObject Enemy)
{
List<EndlessEnemy> list = prefabs.meleeEnemies.ToList();
list.AddRange(prefabs.projectileEnemies.ToList());
list.AddRange(prefabs.specialEnemies.ToList());
list.AddRange(prefabs.uncommonEnemies.ToList());
return list.Find((EndlessEnemy x) => (Object)(object)x.prefab == (Object)(object)Enemy.gameObject || ((Object)x.prefab).name.ToLower().Contains(Enemy.objectName.ToLower()));
}
private void removeEnemy(EndlessEnemy theEnemy, TypeOfCyber typeOfCyber)
{
switch (typeOfCyber)
{
case TypeOfCyber.Melee:
{
List<EndlessEnemy> list4 = prefabs.meleeEnemies.ToList();
list4.Remove(theEnemy);
prefabs.meleeEnemies = list4.ToArray();
break;
}
case TypeOfCyber.Proj:
{
List<EndlessEnemy> list3 = prefabs.projectileEnemies.ToList();
list3.Remove(theEnemy);
prefabs.projectileEnemies = list3.ToArray();
break;
}
case TypeOfCyber.Uncommon:
{
List<EndlessEnemy> list2 = prefabs.uncommonEnemies.ToList();
list2.Remove(theEnemy);
prefabs.uncommonEnemies = list2.ToArray();
break;
}
case TypeOfCyber.Special:
{
List<EndlessEnemy> list = prefabs.specialEnemies.ToList();
list.Remove(theEnemy);
prefabs.specialEnemies = list.ToArray();
break;
}
}
}
private void AddEnemy(EndlessEnemy theEnemy, TypeOfCyber typeOfCyber)
{
switch (typeOfCyber)
{
case TypeOfCyber.Melee:
{
List<EndlessEnemy> list4 = prefabs.meleeEnemies.ToList();
list4.Add(theEnemy);
prefabs.meleeEnemies = list4.ToArray();
break;
}
case TypeOfCyber.Proj:
{
List<EndlessEnemy> list3 = prefabs.projectileEnemies.ToList();
list3.Add(theEnemy);
prefabs.projectileEnemies = list3.ToArray();
break;
}
case TypeOfCyber.Uncommon:
{
List<EndlessEnemy> list2 = prefabs.uncommonEnemies.ToList();
list2.Add(theEnemy);
prefabs.uncommonEnemies = list2.ToArray();
break;
}
case TypeOfCyber.Special:
{
List<EndlessEnemy> list = prefabs.specialEnemies.ToList();
list.Add(theEnemy);
prefabs.specialEnemies = list.ToArray();
break;
}
}
}
public void ActivateOrDeactivateEnemy(Toggle leenemy, bool activateorno, TypeOfCyber typeOfCyber, EndlessEnemy theEnemy)
{
leenemy.isOn = activateorno;
if (activateorno)
{
AddEnemy(theEnemy, typeOfCyber);
}
else
{
removeEnemy(theEnemy, typeOfCyber);
}
}
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
{
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: 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_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Expected O, but got Unknown
if (objects.Count <= 0)
{
((MonoBehaviour)this).StartCoroutine(GetEnemies());
}
if (SceneHelper.CurrentScene != "Endless")
{
return;
}
if ((Object)(object)leThingy != (Object)null)
{
MonoSingleton<AssistController>.Instance.cheatsEnabled = true;
if ((Object)(object)prefabs == (Object)null)
{
prefabs = Resources.FindObjectsOfTypeAll<PrefabDatabase>()[0];
}
objects.Distinct();
GameObject val = Object.Instantiate<GameObject>(leThingy, new Vector3(-11.2018f, 98.0161f, -31.946f), Quaternion.Euler(0f, 180f, 180f));
val.transform.parent = ((Component)Object.FindObjectOfType<FirstRoomPrefab>()).transform.Find("Room");
Template = ((Component)val.transform.Find("Canvas/Border/TipBox/Panel/Scroll View (1)/Viewport/Content/Item")).gameObject;
foreach (SpawnableObject item in objects)
{
GameObject clonedTemp = Object.Instantiate<GameObject>(Template, Template.transform.parent);
Button componentInChildren = clonedTemp.GetComponentInChildren<Button>();
ShopButton shopButton = ((Component)componentInChildren).GetComponent<ShopButton>();
EndlessEnemy scriptable;
if (Object.op_Implicit((Object)(object)isEndlessEnemy(item)))
{
scriptable = isEndlessEnemy(item);
clonedTemp.GetComponentInChildren<Toggle>().isOn = true;
}
else
{
scriptable = ScriptableObject.CreateInstance<EndlessEnemy>();
scriptable.spawnCost = 1;
scriptable.spawnWave = 0;
scriptable.costIncreasePerSpawn = 0;
scriptable.enemyType = item.enemyType;
scriptable.prefab = item.gameObject;
Vector3 position = scriptable.prefab.transform.position;
position.y = item.spawnOffset;
scriptable.prefab.transform.position = position;
((Object)scriptable).name = item.objectName;
if (Object.op_Implicit((Object)(object)scriptable.prefab.GetComponent<Machine>()))
{
scriptable.prefab.GetComponent<Machine>().dontDie = false;
}
}
endlessEnemies.Add(scriptable);
MakeConfigs(item, scriptable);
((UnityEvent)componentInChildren.onClick).AddListener((UnityAction)delegate
{
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Expected O, but got Unknown
//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Expected O, but got Unknown
//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
//IL_05e3: Expected O, but got Unknown
if ((Object)(object)PreviousPreview != (Object)null)
{
Object.Destroy((Object)(object)PreviousPreview);
}
Debug.Log((object)("showing options for " + item.objectName));
GameObject val2 = shopButton.toActivate[0];
if ((Object)(object)item.preview != (Object)null)
{
PreviousPreview = Object.Instantiate<GameObject>(item.preview, shopButton.toActivate[0].transform.Find("EnemyInfo/IconBG/3D Wrapper"));
}
((TMP_Text)((Component)shopButton.toActivate[0].transform.Find("EnemyInfo/Name")).GetComponent<TextMeshProUGUI>()).text = item.objectName;
TMP_InputField[] componentsInChildren = ((Component)shopButton.toActivate[0].transform).GetComponentsInChildren<TMP_InputField>();
TMP_InputField[] array = componentsInChildren;
foreach (TMP_InputField input in array)
{
TypeOfInput TypaInput = TypeOfInput.SpawnCost;
switch (((Object)((Component)input).gameObject).name)
{
case "Spawncost":
input.text = scriptable.spawnCost.ToString();
TypaInput = TypeOfInput.SpawnCost;
break;
case "SpawnWave":
input.text = scriptable.spawnWave.ToString();
TypaInput = TypeOfInput.SpawnWave;
break;
case "CostIncrease":
input.text = scriptable.costIncreasePerSpawn.ToString();
TypaInput = TypeOfInput.CostIncrease;
break;
}
Button[] componentsInChildren2 = ((Component)input).GetComponentsInChildren<Button>();
Button[] array2 = componentsInChildren2;
foreach (Button button in array2)
{
((UnityEvent)button.onClick).AddListener((UnityAction)delegate
{
string name = ((Object)((Component)button).gameObject).name;
string text = name;
if (!(text == "+"))
{
if (text == "-")
{
switch (TypaInput)
{
case TypeOfInput.SpawnCost:
{
EndlessEnemy obj3 = scriptable;
obj3.spawnCost--;
input.text = scriptable.spawnCost.ToString();
break;
}
case TypeOfInput.SpawnWave:
{
EndlessEnemy obj2 = scriptable;
obj2.spawnWave--;
input.text = scriptable.spawnWave.ToString();
break;
}
case TypeOfInput.CostIncrease:
{
EndlessEnemy obj = scriptable;
obj.costIncreasePerSpawn--;
input.text = scriptable.costIncreasePerSpawn.ToString();
break;
}
}
}
}
else
{
switch (TypaInput)
{
case TypeOfInput.SpawnCost:
{
EndlessEnemy obj6 = scriptable;
obj6.spawnCost++;
ConfigEntriesDic[scriptable].SpawnCost.Value = scriptable.spawnCost;
input.text = scriptable.spawnCost.ToString();
break;
}
case TypeOfInput.SpawnWave:
{
EndlessEnemy obj5 = scriptable;
obj5.spawnWave++;
ConfigEntriesDic[scriptable].SpawnWave.Value = scriptable.spawnWave;
input.text = scriptable.spawnWave.ToString();
break;
}
case TypeOfInput.CostIncrease:
{
EndlessEnemy obj4 = scriptable;
obj4.costIncreasePerSpawn++;
ConfigEntriesDic[scriptable].CostIncreasePerSpaw.Value = scriptable.costIncreasePerSpawn;
input.text = scriptable.costIncreasePerSpawn.ToString();
break;
}
}
}
});
}
}
foreach (GameObject item2 in new List<GameObject>
{
((Component)val2.transform.Find("EnemyInfo/Melee")).gameObject,
((Component)val2.transform.Find("EnemyInfo/Projectile")).gameObject,
((Component)val2.transform.Find("EnemyInfo/Uncommon")).gameObject,
((Component)val2.transform.Find("EnemyInfo/Special")).gameObject
})
{
Debug.Log((object)((Object)item2).name);
if (((Object)item2).name == "Melee" && prefabs.meleeEnemies.Contains(scriptable))
{
Debug.Log((object)"ye mele");
((Component)item2.transform.Find("EnemySelection")).gameObject.SetActive(false);
((Component)item2.transform.Find("EnemySelectionSelected")).gameObject.SetActive(true);
}
else if (((Object)item2).name == "Projectile" && prefabs.projectileEnemies.Contains(scriptable))
{
Debug.Log((object)"ye proj");
((Component)item2.transform.Find("EnemySelection")).gameObject.SetActive(false);
((Component)item2.transform.Find("EnemySelectionSelected")).gameObject.SetActive(true);
}
else if (((Object)item2).name == "Uncommon" && prefabs.uncommonEnemies.Contains(scriptable))
{
Debug.Log((object)"ye uncom");
((Component)item2.transform.Find("EnemySelection")).gameObject.SetActive(false);
((Component)item2.transform.Find("EnemySelectionSelected")).gameObject.SetActive(true);
}
else if (((Object)item2).name == "Special" && prefabs.specialEnemies.Contains(scriptable))
{
Debug.Log((object)"ye speci");
((Component)item2.transform.Find("EnemySelection")).gameObject.SetActive(false);
((Component)item2.transform.Find("EnemySelectionSelected")).gameObject.SetActive(true);
}
else
{
((Component)item2.transform.Find("EnemySelection")).gameObject.SetActive(true);
((Component)item2.transform.Find("EnemySelectionSelected")).gameObject.SetActive(false);
}
TypeOfCyber cyber = GetCategory(item2);
((UnityEvent)((Component)item2.transform.Find("EnemySelection")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
Debug.Log((object)cyber.ToString());
ActivateOrDeactivateEnemy(clonedTemp.GetComponentInChildren<Toggle>(), activateorno: true, cyber, scriptable);
});
((UnityEvent)((Component)item2.transform.Find("EnemySelectionSelected")).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
{
Debug.Log((object)cyber.ToString());
ActivateOrDeactivateEnemy(clonedTemp.GetComponentInChildren<Toggle>(), activateorno: false, cyber, scriptable);
});
}
});
((TMP_Text)((Component)componentInChildren).GetComponentInChildren<TextMeshProUGUI>()).text = item.objectName;
((Component)clonedTemp.transform.Find("Image")).GetComponent<Image>().sprite = item.gridIcon;
}
Object.Destroy((Object)(object)Template);
AddOnClickEvents();
}
else
{
Debug.LogError((object)"it DOESNT EXIST WAAAAAAAAAAAAAAA");
}
}
private TypeOfCyber GetCategory(GameObject button)
{
return ((Object)button).name switch
{
"Melee" => TypeOfCyber.Melee,
"Projectile" => TypeOfCyber.Proj,
"Uncommon" => TypeOfCyber.Uncommon,
"Special" => TypeOfCyber.Special,
_ => TypeOfCyber.Melee,
};
}
private void AddOnClickEvents()
{
}
}