using System;
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 GlobalEnums;
using Microsoft.CodeAnalysis;
using TimerMod.Triggers;
using UnityEngine;
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("TimerMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0+31d70ee07b16d8ba2e53d70ac430fa7e8b64c074")]
[assembly: AssemblyProduct("TimerMod")]
[assembly: AssemblyTitle("TimerMod")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/hk-speedrunning/Silksong.TimerMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace TimerMod
{
public class TimerDisplay
{
private GameObject canvas;
private Text text;
private Text pbText;
private Font theFont;
private bool timerVisible = true;
private ConfigEntry<int> timerTextSize;
private ConfigEntry<int> pbTextSize;
private ConfigEntry<Vector2> timerTextPos;
private ConfigEntry<Vector2> pbTextPos;
public TimerDisplay()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
setupConfig();
Font[] source = Resources.FindObjectsOfTypeAll<Font>();
theFont = ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)((Font x) => ((Object)x).name == "TrajanPro-Regular"));
setupCanvas();
text = createText("TimerText", "0:00.00", timerTextSize.Value, timerTextPos.Value, new Vector2(0f, 0f));
pbText = createText("TimerPBText", "PB: 0:00.00", pbTextSize.Value, pbTextPos.Value, new Vector2(0f, 0f));
}
private void setAllConfigs()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
text.fontSize = timerTextSize.Value;
pbText.fontSize = pbTextSize.Value;
updateTextAnchorMin(text, timerTextPos.Value);
updateTextAnchorMin(pbText, pbTextPos.Value);
}
private void setupConfig()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
ConfigFile config = TimerMod.config;
timerTextSize = config.Bind<int>("UI", "Timer Text Size", 50, "");
pbTextSize = config.Bind<int>("UI", "Pb Text Size", 25, "");
timerTextPos = config.Bind<Vector2>("UI", "Timer Text Position", new Vector2(0.07f, 0f), "");
pbTextPos = config.Bind<Vector2>("UI", "Pb Text Position", new Vector2(0.05f, 0.04f), "");
timerTextSize.SettingChanged += delegate
{
setAllConfigs();
};
pbTextSize.SettingChanged += delegate
{
setAllConfigs();
};
timerTextPos.SettingChanged += delegate
{
setAllConfigs();
};
pbTextPos.SettingChanged += delegate
{
setAllConfigs();
};
}
private void setupCanvas()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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)
canvas = new GameObject("TimerModCanvas");
Canvas obj = canvas.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.planeDistance = 20f;
canvas.layer = LayerMask.NameToLayer("UI");
CanvasScaler obj2 = canvas.AddComponent<CanvasScaler>();
obj2.uiScaleMode = (ScaleMode)1;
obj2.referenceResolution = new Vector2(1920f, 1080f);
canvas.AddComponent<GraphicRaycaster>();
RectTransform component = canvas.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 1f);
component.sizeDelta = new Vector2(0f, 0f);
Object.DontDestroyOnLoad((Object)(object)canvas);
}
public Text createText(string name, string defaultText, int fontSize, Vector2 anchorMax, Vector2 anchorMin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.layer = LayerMask.NameToLayer("UI");
val.AddComponent<CanvasRenderer>();
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).localPosition = Vector3.zero;
CanvasGroup obj = val.AddComponent<CanvasGroup>();
obj.interactable = false;
obj.blocksRaycasts = false;
Text obj2 = val.AddComponent<Text>();
obj2.text = defaultText;
obj2.font = theFont;
obj2.fontSize = fontSize;
obj2.fontStyle = (FontStyle)0;
obj2.alignment = (TextAnchor)2;
val.transform.SetParent(canvas.transform, false);
val2.anchorMax = anchorMax;
val2.anchorMin = anchorMin;
return obj2;
}
private void updateTextAnchorMin(Text t, Vector2 anchorMax)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
((Component)t).gameObject.GetComponent<RectTransform>().anchorMax = anchorMax;
}
public void toggleVisibility()
{
canvas.SetActive(timerVisible);
timerVisible = !timerVisible;
}
public void setTime(string time)
{
text.text = time;
}
public void setPbTime(string time)
{
pbText.text = "PB: " + time;
}
}
public class Keybinds
{
public ConfigEntry<KeyboardShortcut> SetStart;
public ConfigEntry<KeyboardShortcut> SetEnd;
public ConfigEntry<KeyboardShortcut> ToggleTriggerMethod;
public ConfigEntry<KeyboardShortcut> CancelTimer;
public ConfigEntry<KeyboardShortcut> StartTimer;
public ConfigEntry<KeyboardShortcut> EndTimer;
public ConfigEntry<KeyboardShortcut> ResetPb;
public ConfigEntry<KeyboardShortcut> ToggleTimerVisibility;
public Keybinds(ConfigFile Config)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
SetStart = Config.Bind<KeyboardShortcut>("Shortcuts", "SetStart", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "");
SetEnd = Config.Bind<KeyboardShortcut>("Shortcuts", "SetEnd", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "");
ToggleTriggerMethod = Config.Bind<KeyboardShortcut>("Shortcuts", "ToggleTriggerMethod", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), "");
CancelTimer = Config.Bind<KeyboardShortcut>("Shortcuts", "CancelTimer", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Cancel the timer (does not affect pb)");
StartTimer = Config.Bind<KeyboardShortcut>("Shortcuts", "StartTimer", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "");
EndTimer = Config.Bind<KeyboardShortcut>("Shortcuts", "EndTimer", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "");
ResetPb = Config.Bind<KeyboardShortcut>("Shortcuts", "ResetPb", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "");
ToggleTimerVisibility = Config.Bind<KeyboardShortcut>("Shortcuts", "ToggleTimerVisibility", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "");
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("io.github.hk-speedrunning.timermod", "TimerMod", "0.4.0")]
public class TimerMod : BaseUnityPlugin
{
public static ConfigFile config;
private TimerDisplay timerDisplay;
private const string MENU_TITLE = "Menu_Title";
private const string QUIT_TO_MENU = "Quit_To_Menu";
private Trigger startTrigger = new SceneTrigger("");
private Trigger endTrigger = new SceneTrigger("");
private Keybinds keybinds;
private bool usingSceneTriggers;
private double time;
private bool timerPaused = true;
private GameState prevGameState = (GameState)4;
private bool lookForTele;
private double[] history = new double[5];
private int history_num;
private double pb;
private int funSceneCount;
private ConfigEntry<bool> showSpeed;
private Vector2 startPos;
public const string Id = "io.github.hk-speedrunning.timermod";
public static string Name => "TimerMod";
public static string Version => "0.4.0";
private bool ShouldTickTimer()
{
//IL_00d6: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Invalid comparison between Unknown and I4
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Invalid comparison between Unknown and I4
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Invalid comparison between Unknown and I4
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Invalid comparison between Unknown and I4
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Invalid comparison between Unknown and I4
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Invalid comparison between Unknown and I4
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Invalid comparison between Unknown and I4
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Invalid comparison between Unknown and I4
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Invalid comparison between Unknown and I4
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Invalid comparison between Unknown and I4
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Invalid comparison between Unknown and I4
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Invalid comparison between Unknown and I4
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Invalid comparison between Unknown and I4
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Invalid comparison between Unknown and I4
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Invalid comparison between Unknown and I4
if (timerPaused)
{
return false;
}
UIState uiState = GameManager.instance.ui.uiState;
string sceneNameString = GameManager.instance.GetSceneNameString();
string nextSceneName = GameManager.instance.nextSceneName;
bool flag = (sceneNameString != "Menu_Title" && nextSceneName == "") || (sceneNameString != "Menu_Title" && nextSceneName == "Menu_Title") || sceneNameString == "Quit_To_Menu";
GameState gameState = GameManager.instance.GameState;
if ((int)gameState == 4 && (int)prevGameState == 1)
{
lookForTele = true;
}
if (lookForTele && (int)gameState != 4 && (int)gameState != 3)
{
lookForTele = false;
}
bool acceptingInput = GameManager.instance.inputHandler.acceptingInput;
HeroTransitionState val;
try
{
val = GameManager.instance.hero_ctrl.transitionState;
}
catch (Exception)
{
val = (HeroTransitionState)0;
}
bool flag2 = false;
if (GameManager.instance.sceneLoad != null)
{
flag2 = GameManager.instance.sceneLoad.IsActivationAllowed;
}
bool num = lookForTele;
bool flag3 = ((int)gameState == 4 || (int)gameState == 3) && (int)uiState != 4;
bool flag4 = (int)gameState != 4 && (int)gameState != 7 && !acceptingInput;
bool flag5 = ((int)gameState == 6 && flag2) || (int)gameState == 2;
bool flag6 = (int)val == 2;
bool flag7 = (int)uiState != 4 && (flag || ((int)uiState != 5 && (int)uiState != 3 && !(nextSceneName == ""))) && nextSceneName != sceneNameString;
bool num2 = num || flag3 || flag4 || flag5 || flag6 || flag7;
prevGameState = gameState;
return !num2;
}
private void resetPb()
{
pb = 0.0;
timerDisplay.setPbTime(getTimeText(pb));
}
private void endTimer()
{
//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_0019: 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_0045: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Vector2.op_Implicit(((Component)HeroController.instance).gameObject.transform.position);
double num = (double)Math.Abs(startPos.x - val.x) / time;
double num2 = (double)Math.Abs(startPos.y - val.y) / time;
history[history_num] = time;
history_num++;
history_num %= 5;
if (pb == 0.0 || time < pb)
{
pb = time;
timerDisplay.setPbTime(getTimeText(pb));
if (showSpeed.Value)
{
timerDisplay.setPbTime($"{getTimeText(pb)}\n{num:0.00} u/s, {num2:0.00} u/s");
}
}
timerPaused = true;
}
private void startTimer()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
time = 0.0;
timerPaused = false;
startPos = Vector2.op_Implicit(((Component)HeroController.instance).gameObject.transform.position);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Started timer");
}
private void LateUpdate()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: 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_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
if (startTrigger.active() && timerPaused)
{
startTimer();
}
if (endTrigger.active() && !timerPaused)
{
endTimer();
}
KeyboardShortcut value = keybinds.SetStart.Value;
Scene activeScene;
if (((KeyboardShortcut)(ref value)).IsDown())
{
startTrigger.destroy();
resetPb();
if (usingSceneTriggers)
{
activeScene = SceneManager.GetActiveScene();
startTrigger = new SceneTrigger(((Scene)(ref activeScene)).name);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Set start scene");
}
else
{
startTrigger = new CollisionTrigger(Vector2.op_Implicit(GameManager.instance.hero_ctrl.transform.position), new Vector2(0.35f, 0.35f), new Color(0.1f, 0.4f, 0.1f));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Set start pos");
}
}
value = keybinds.SetEnd.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
endTrigger.destroy();
resetPb();
if (usingSceneTriggers)
{
activeScene = SceneManager.GetActiveScene();
endTrigger = new SceneTrigger(((Scene)(ref activeScene)).name);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Set end scene");
}
else
{
endTrigger = new CollisionTrigger(Vector2.op_Implicit(GameManager.instance.hero_ctrl.transform.position), new Vector2(0.35f, 0.35f), new Color(0.4f, 0.1f, 0.1f));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Set end pos");
}
}
value = keybinds.ToggleTriggerMethod.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
usingSceneTriggers = !usingSceneTriggers;
}
value = keybinds.CancelTimer.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Canceled");
time = 0.0;
timerPaused = true;
}
value = keybinds.ResetPb.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
resetPb();
}
value = keybinds.StartTimer.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
startTimer();
}
value = keybinds.EndTimer.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
endTimer();
}
value = keybinds.ToggleTimerVisibility.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
timerDisplay.toggleVisibility();
}
if (ShouldTickTimer())
{
time += Time.unscaledDeltaTime;
timerDisplay.setTime(getTimeText(time));
}
}
public void onActiveSceneChanged(Scene from, Scene to)
{
if (funSceneCount == 3)
{
timerDisplay = new TimerDisplay();
}
funSceneCount++;
}
private string getTimeText(double t)
{
int num = (int)(t * 100.0) % 100;
int num2 = (int)t % 60;
int num3 = (int)t / 60;
return $"{num3}:{num2:00}.{num:00}";
}
private void Awake()
{
SceneManager.activeSceneChanged += onActiveSceneChanged;
keybinds = new Keybinds(((BaseUnityPlugin)this).Config);
config = ((BaseUnityPlugin)this).Config;
showSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Show Speed", false, "");
((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.hk-speedrunning.timermod) has loaded!"));
}
}
}
namespace TimerMod.Triggers
{
public class CollisionTrigger : Trigger
{
private bool shouldActivate;
private string scene;
private GameObject? triggerObject;
private Vector2 pos;
private Vector2 size;
private Color colour;
public CollisionTrigger(Vector2 pos, Vector2 size, Color colour)
{
//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)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
this.pos = pos;
this.size = size;
this.colour = colour;
scene = GameManager.instance.GetSceneNameString();
createSelf();
}
private void onActiveSceneChanged(Scene from, Scene to)
{
if (((Scene)(ref to)).name == scene)
{
destroy();
createSelf();
}
}
private void createSelf()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0062: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Expected O, but got Unknown
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Expected O, but got Unknown
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
SceneManager.activeSceneChanged += onActiveSceneChanged;
Vector3[] vertices = (Vector3[])(object)new Vector3[4]
{
new Vector3(pos.x, pos.y),
new Vector3(pos.x, pos.y + size.y),
new Vector3(pos.x + size.x, pos.y),
new Vector3(pos.x + size.x, pos.y + size.y)
};
Mesh val = new Mesh();
val.vertices = vertices;
val.uv = (Vector2[])(object)new Vector2[4]
{
new Vector2(0f, 0f),
new Vector2(0f, 1f),
new Vector2(1f, 1f),
new Vector2(1f, 0f)
};
val.triangles = new int[6] { 0, 1, 2, 2, 1, 3 };
val.RecalculateNormals();
triggerObject = new GameObject("TimerModTrigger");
triggerObject.AddComponent<MeshFilter>().mesh = val;
Texture2D val2 = new Texture2D(1, 1);
val2.SetPixel(0, 0, colour);
val2.Apply();
MeshRenderer obj = triggerObject.AddComponent<MeshRenderer>();
Console.WriteLine(Object.op_Implicit((Object)(object)((Renderer)obj).material.shader));
((Renderer)obj).material.mainTexture = (Texture)(object)val2;
((Renderer)obj).material.color = colour;
triggerObject.AddComponent<TriggerCollider>().callback = setPlayerIn;
((Collider2D)triggerObject.AddComponent<BoxCollider2D>()).isTrigger = true;
triggerObject.SetActive(true);
}
public void setPlayerIn()
{
shouldActivate = true;
}
public bool active()
{
if (shouldActivate)
{
shouldActivate = false;
return true;
}
return false;
}
public void destroy()
{
Object.Destroy((Object)(object)triggerObject);
SceneManager.activeSceneChanged -= onActiveSceneChanged;
}
}
internal class TriggerCollider : MonoBehaviour
{
public Action? callback;
private void OnTriggerEnter2D(Collider2D other)
{
if ((Object)(object)((Component)other).gameObject == (Object)(object)((Component)HeroController.instance).gameObject && callback != null)
{
callback();
}
}
}
public class SceneTrigger : Trigger
{
private string targetSceneName;
private string prevSceneName;
public SceneTrigger(string scene)
{
targetSceneName = scene;
}
public bool active()
{
if (!Object.op_Implicit((Object)(object)GameManager.instance))
{
return false;
}
if (GameManager.instance.GetSceneNameString() == targetSceneName && targetSceneName != prevSceneName)
{
return true;
}
prevSceneName = GameManager.instance.GetSceneNameString();
return false;
}
public void destroy()
{
}
}
public interface Trigger
{
bool active();
void destroy();
}
}