using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Logging;
using ChapterSelect.Code;
using HarmonyLib;
using Koop;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.Localization.Tables;
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.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ChapterSelect")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Scene Select for Goodbye Volcano High")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("ChapterSelect")]
[assembly: AssemblyTitle("ChapterSelect")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace ChapterSelect
{
public static class ReflectionExtensions
{
public static T GetFieldValue<T>(this object obj, string name)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
return (T)(obj.GetType().GetField(name, bindingAttr)?.GetValue(obj));
}
public static object CallPrivate(this object o, string methodName, params object[] args)
{
MethodInfo method = o.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic);
return (method != null) ? method.Invoke(o, args) : null;
}
}
[BepInPlugin("ChapterSelect", "ChapterSelect", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource LOG;
private static Harmony _harmony;
public static AssetBundle Assets;
public static readonly Dictionary<string, Texture2D> Textures = new Dictionary<string, Texture2D>();
private void Awake()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ChapterSelect is loaded!");
LOG = Logger.CreateLogSource("ChapterSelect");
Logger.Sources.Add((ILogSource)(object)LOG);
GameObject val = GameObject.Find("MANAGER_MASTER");
GameObject val2 = new GameObject("MOD_ChapterSelect");
val2.transform.SetParent(val.transform);
GameObject val3 = new GameObject("CS_GameAssetLoader");
Object.DontDestroyOnLoad((Object)(object)val3);
val3.transform.SetParent(val2.transform);
((Behaviour)val3.AddComponent<Mgr_CS_GameAssetLoader>()).enabled = true;
GameObject val4 = new GameObject("ChapterSelectManager");
Object.DontDestroyOnLoad((Object)(object)val4);
val4.transform.SetParent(val2.transform);
((Behaviour)val4.AddComponent<Mgr_ChapterSelect>()).enabled = true;
GameObject val5 = new GameObject("CS_UIInjection");
Object.DontDestroyOnLoad((Object)(object)val5);
val5.transform.SetParent(val2.transform);
((Behaviour)val5.AddComponent<Mgr_CS_UIInjection>()).enabled = true;
GameObject val6 = new GameObject("CS_SaveManagement");
Object.DontDestroyOnLoad((Object)(object)val6);
val6.transform.SetParent(val2.transform);
((Behaviour)val6.AddComponent<Mgr_CS_SaveManagement>()).enabled = true;
StringTable table = ((LocalizedDatabase<StringTable, StringTableEntry>)(object)LocalizationSettings.StringDatabase).GetTable(TableReference.op_Implicit("MISC"), LocalizationSettings.AvailableLocales.GetLocale(LocaleIdentifier.op_Implicit("en")));
foreach (Localization.LocalizationElement englishLocalization in Localization.GetEnglishLocalizations())
{
((DetailedLocalizationTable<StringTableEntry>)(object)table).AddEntry(englishLocalization.Key, englishLocalization.Value);
}
_harmony = new Harmony("ChapterSelect");
_harmony.PatchAll();
Assets = OnyxUtils.LoadEmbeddedAssetBundle("ChapterSelect.Assets.chaptermod.assets");
foreach (SelectableScene allScene in SelectableScene.AllScenes)
{
Textures[allScene.SceneName] = Assets.LoadAsset<Texture2D>("CH_I_" + allScene.SceneName);
Textures["locked"] = Assets.LoadAsset<Texture2D>("locked");
}
}
}
[HarmonyPatch(typeof(Mgr_LevelFlow))]
[HarmonyPatch("ReadyToRevealNewScene")]
public class RevealNewScenePatch
{
private static void Postfix()
{
Mgr_ChapterSelect.Instance.CallPrivate("_SceneLoadedInternal");
}
}
[HarmonyPatch(typeof(Mgr_LevelFlow))]
[HarmonyPatch("OnSceneLoaded")]
public class OnSceneLoadedPatch
{
private static void Postfix(Mgr_LevelFlow __instance, Scene scene)
{
Mgr_ChapterSelect.Instance.CurrentScene = ((Scene)(ref scene)).name;
}
}
[HarmonyPatch(typeof(Mgr_Achievements))]
[HarmonyPatch("AwardAchievement")]
[HarmonyPatch(new Type[] { typeof(SO_Achievement) })]
public class AwardAchievementPatch
{
private static bool Prefix(SO_Achievement ach)
{
return !Mgr_ChapterSelect.Instance.IsInThrowback;
}
}
[HarmonyPatch(typeof(TitleScreen))]
[HarmonyPatch("Awake")]
public class TitleScreenAwakePatch
{
private static void Prefix(TitleScreen __instance)
{
if (Mgr_ChapterSelect.Instance.IsInThrowback)
{
Mgr_ChapterSelect.Instance.EndThrowback();
}
}
}
[HarmonyPatch(typeof(Helper_Ink))]
[HarmonyPatch("ContainsSpecialCall")]
public class ContainsSpecialCallPatch
{
private static bool Prefix(string speak, bool doAction, ref bool __result)
{
if (!Mgr_ChapterSelect.Instance.IsInThrowback)
{
return true;
}
if (speak.Contains("NEXT:"))
{
if (doAction)
{
Mgr_LevelFlow.Instance.nextSceneFromInk = "Title";
InkMaster.ActiveInstance.Continue(false);
}
__result = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Mgr_Saves))]
[HarmonyPatch("SaveGameplay")]
public class SaveGameplayPatch
{
private static IEnumerator PostSavedNotif()
{
Notify gameDataSavedToDisk = Mgr_Saves.GameDataSavedToDisk;
if (gameDataSavedToDisk != null)
{
gameDataSavedToDisk.Invoke();
}
yield break;
}
private static bool Prefix()
{
if ((Object)(object)Mgr_CS_SaveManagement.Instance == (Object)null)
{
return true;
}
if (Mgr_CS_SaveManagement.Instance.SavesEnabled)
{
return true;
}
((MonoBehaviour)Mgr_ChapterSelect.Instance).StartCoroutine(PostSavedNotif());
return false;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ChapterSelect";
public const string PLUGIN_NAME = "ChapterSelect";
public const string PLUGIN_VERSION = "0.1.0";
}
}
namespace ChapterSelect.Code
{
public class Mgr_ChapterSelect : MonoBehaviour
{
private static Mgr_ChapterSelect _instance;
public bool IsInThrowback = false;
public static Mgr_ChapterSelect Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.FindObjectOfType<Mgr_ChapterSelect>();
}
return _instance;
}
}
public string CurrentScene { get; set; } = null;
public List<Notify> SceneReadyCallbacks { get; } = new List<Notify>();
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
if ((Object)(object)_instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void StartThrowbackForScene(string sceneName)
{
((TabbedMenu)GameObject.Find("ChaptersMenu").GetComponent<ChaptersMenu>()).Close(true);
Mgr_CS_SaveManagement.Instance.AddSaveDisableReason("Throwback");
IsInThrowback = true;
Mgr_LevelFlow.Instance.LoadScene(sceneName);
}
public void EndThrowback()
{
IsInThrowback = false;
Mgr_CS_SaveManagement.Instance.RemoveSaveDisableReason("Throwback");
}
private void _SceneLoadedInternal()
{
foreach (Notify sceneReadyCallback in SceneReadyCallbacks)
{
sceneReadyCallback.Invoke();
}
}
}
public class Mgr_CS_GameAssetLoader : MonoBehaviour
{
public GameObject mainMenuButtonPrefab;
public GameObject tabPrefab;
public GameObject tabLeft;
public GameObject tabRight;
public GameObject controlPrefab;
public GameObject settingsPageContentCanvasGroup;
public TMP_FontAsset standardFontAsset;
private static Mgr_CS_GameAssetLoader _instance;
public static Mgr_CS_GameAssetLoader Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.FindObjectOfType<Mgr_CS_GameAssetLoader>();
}
return _instance;
}
}
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
if ((Object)(object)_instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void RunFullObjectSweep()
{
GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
switch (((Object)val).name)
{
case "TabLeft":
tabLeft = val;
break;
case "TabRight":
tabRight = val;
break;
case "SettingsMenu":
controlPrefab = val.GetComponent<SettingsMenu>().GetFieldValue<GameObject>("controlPrefab");
tabPrefab = val.GetComponent<SettingsMenu>().GetFieldValue<GameObject>("tabPrefab");
settingsPageContentCanvasGroup = ((Component)((TabbedMenu)val.GetComponent<SettingsMenu>()).pages[0].canvasGroup).gameObject;
break;
case "ButtonContainer":
if (!(((Object)val.transform.parent).name != "Screen1"))
{
mainMenuButtonPrefab = ((Component)val.transform.GetChild(1)).gameObject;
standardFontAsset = ((TMP_Text)mainMenuButtonPrefab.GetComponent<UiSelectable4WayButton>().label).font;
}
break;
}
}
}
}
public class Mgr_CS_SaveManagement : MonoBehaviour
{
private readonly HashSet<string> _saveDisableReasons = new HashSet<string>();
private bool _lastSaveState = true;
private readonly GameplaySaveData _backupSaveData = new GameplaySaveData();
private static Mgr_CS_SaveManagement _instance;
public bool SavesEnabled => _saveDisableReasons.Count == 0;
public static Mgr_CS_SaveManagement Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.FindObjectOfType<Mgr_CS_SaveManagement>();
}
return _instance;
}
}
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
if ((Object)(object)_instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private void SaveDisableReasonsUpdated()
{
if (!SavesEnabled)
{
if (_lastSaveState)
{
_backupSaveData.lastSavedDateTime = Mgr_Saves.saveData.lastSavedDateTime;
_backupSaveData.sceneName = Mgr_Saves.saveData.sceneName;
_backupSaveData.socialMediaData = Mgr_Saves.saveData.socialMediaData;
_backupSaveData.globalVariables = Mgr_Saves.saveData.globalVariables;
_backupSaveData.collectedPhotos = Mgr_Saves.saveData.collectedPhotos;
_backupSaveData.unviewedPhotos = Mgr_Saves.saveData.unviewedPhotos;
_backupSaveData.collectedFlashbacks = Mgr_Saves.saveData.collectedFlashbacks;
_backupSaveData.unviewedFlashbacks = Mgr_Saves.saveData.unviewedFlashbacks;
_backupSaveData.previousSceneHistory = Mgr_Saves.saveData.previousSceneHistory;
_backupSaveData.socialMediaNotif = Mgr_Saves.saveData.socialMediaNotif;
}
}
else if (!_lastSaveState)
{
Mgr_Saves.saveData.lastSavedDateTime = _backupSaveData.lastSavedDateTime;
Mgr_Saves.saveData.sceneName = _backupSaveData.sceneName;
Mgr_Saves.saveData.socialMediaData = _backupSaveData.socialMediaData;
Mgr_Saves.saveData.globalVariables = _backupSaveData.globalVariables;
Mgr_Saves.saveData.collectedPhotos = _backupSaveData.collectedPhotos;
Mgr_Saves.saveData.unviewedPhotos = _backupSaveData.unviewedPhotos;
Mgr_Saves.saveData.collectedFlashbacks = _backupSaveData.collectedFlashbacks;
Mgr_Saves.saveData.unviewedFlashbacks = _backupSaveData.unviewedFlashbacks;
Mgr_Saves.saveData.previousSceneHistory = _backupSaveData.previousSceneHistory;
Mgr_Saves.saveData.socialMediaNotif = _backupSaveData.socialMediaNotif;
}
_lastSaveState = SavesEnabled;
}
public void AddSaveDisableReason(string reason)
{
if (_saveDisableReasons.Contains(reason))
{
Plugin.LOG.LogWarning((object)("Save disable reason " + reason + " already exists!!"));
}
_saveDisableReasons.Add(reason);
SaveDisableReasonsUpdated();
}
public void RemoveSaveDisableReason(string reason)
{
if (!_saveDisableReasons.Contains(reason))
{
Plugin.LOG.LogWarning((object)("Save disable reason " + reason + " does not exist!!"));
}
_saveDisableReasons.Remove(reason);
SaveDisableReasonsUpdated();
}
}
public class Mgr_CS_UIInjection : MonoBehaviour
{
private static Mgr_CS_UIInjection _instance;
public static Mgr_CS_UIInjection Instance
{
get
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.FindObjectOfType<Mgr_CS_UIInjection>();
}
return _instance;
}
}
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
if ((Object)(object)_instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private IEnumerator Start()
{
if ((Object)(object)Mgr_ChapterSelect.Instance == (Object)null)
{
yield return null;
}
if ((Object)(object)Mgr_CS_GameAssetLoader.Instance == (Object)null)
{
yield return null;
}
Mgr_ChapterSelect.Instance.SceneReadyCallbacks.Add(new Notify(TitleScreenReady));
}
public void TitleScreenReady()
{
Plugin.LOG.LogInfo((object)("Title screen ready called with " + Mgr_ChapterSelect.Instance.CurrentScene));
if (Mgr_ChapterSelect.Instance.CurrentScene != "Title")
{
return;
}
Mgr_CS_GameAssetLoader.Instance.RunFullObjectSweep();
Plugin.LOG.LogInfo((object)"Game assets loaded");
try
{
UiSelectable4WayButton val = InjectChaptersButton();
if ((Object)(object)val == (Object)null)
{
Plugin.LOG.LogError((object)"Failed to inject button! This is bad! Did the game get updated?");
return;
}
InjectChaptersMenu(val);
}
catch (Exception ex)
{
Plugin.LOG.LogError((object)$"Failed to inject chapters menu: {ex}");
Plugin.LOG.LogError((object)ex.StackTrace);
}
Plugin.LOG.LogInfo((object)"Injection Complete");
}
private UiSelectable4WayButton InjectChaptersButton()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: 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_0171: Expected O, but got Unknown
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("Screen1/ButtonContainer");
if ((Object)(object)val != (Object)null)
{
Transform val2 = Object.Instantiate<Transform>(val.transform.GetChild(0), val.transform, true);
foreach (Transform item in ((Component)val2).transform)
{
Transform val3 = item;
Object.Destroy((Object)(object)((Component)val3).gameObject);
}
Transform child = val.transform.GetChild(1);
child.SetParent(((Component)val2).transform);
child.localScale = new Vector3(1f, 1f, 1f);
GameObject val4 = Object.Instantiate<GameObject>(Mgr_CS_GameAssetLoader.Instance.mainMenuButtonPrefab, val2);
((Object)val4).name = "Chapters";
TextMeshProUGUI componentInChildren = val4.GetComponentInChildren<TextMeshProUGUI>();
((TMP_Text)componentInChildren).text = "Chapters";
val4.transform.localScale = new Vector3(1f, 1f, 1f);
val4.GetComponentInChildren<StaticStringLocaliser>().BaseText = "Chapters";
typeof(UiSelectable4WayButton).GetField("_textOverflowResponse", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(val4.GetComponent<UiSelectable4WayButton>(), 0);
EventTrigger component = val4.GetComponent<EventTrigger>();
component.triggers.Clear();
Entry val5 = new Entry
{
eventID = (EventTriggerType)2
};
((UnityEvent<BaseEventData>)(object)val5.callback).AddListener((UnityAction<BaseEventData>)delegate
{
Plugin.LOG.LogInfo((object)"Chapters button clicked!");
});
component.triggers.Add(val5);
((Component)val2).transform.SetSiblingIndex(1);
((Component)val2).transform.localScale = new Vector3(1f, 1f, 1f);
UiSelectable4WayButton component2 = GameObject.Find("New Game").GetComponent<UiSelectable4WayButton>();
UiSelectable4WayButton component3 = GameObject.Find("Continue").GetComponent<UiSelectable4WayButton>();
UiSelectable4WayButton component4 = GameObject.Find("Settings").GetComponent<UiSelectable4WayButton>();
UiSelectable4WayButton component5 = GameObject.Find("Chapters").GetComponent<UiSelectable4WayButton>();
UiSelectable4WayButton component6 = GameObject.Find("Quit").GetComponent<UiSelectable4WayButton>();
component3.downSelection = val4.GetComponent<UiSelectable4WayButton>();
component3.rightSelection = component2;
component3.leftSelection = component2;
component3.upSelection = component6;
component4.rightSelection = val4.GetComponent<UiSelectable4WayButton>();
component4.leftSelection = val4.GetComponent<UiSelectable4WayButton>();
component4.upSelection = component2;
component5.downSelection = component6;
component5.leftSelection = component4;
component5.rightSelection = component4;
component5.upSelection = component3;
return component5;
}
return null;
}
public void InjectChaptersMenu(UiSelectable4WayButton chaptersButton)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_009e: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: 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_0176: Expected O, but got Unknown
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
Plugin.LOG.LogInfo((object)"Injecting chapters menu");
GameObject val = new GameObject("ChaptersMenu", new Type[5]
{
typeof(RectTransform),
typeof(CanvasGroup),
typeof(Canvas),
typeof(GraphicRaycaster),
typeof(SelectableGroupController)
});
val.SetActive(false);
val.transform.SetParent(GameObject.Find("Screen1").transform);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 1f);
component.offsetMin = new Vector2(0f, 0f);
component.offsetMax = new Vector2(0f, 0f);
val.transform.localScale = new Vector3(1f, 1f, 1f);
ChaptersMenu menu = val.AddComponent<ChaptersMenu>();
((Behaviour)menu).enabled = true;
menu.BuildUI();
GameObject buttonContainer = GameObject.Find("ButtonContainer");
GameObject logo = GameObject.Find("Logo");
EventTrigger component2 = ((Component)chaptersButton).gameObject.GetComponent<EventTrigger>();
component2.triggers.Clear();
Entry val2 = new Entry
{
eventID = (EventTriggerType)2
};
((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate
{
buttonContainer.SetActive(false);
logo.SetActive(false);
((TabbedMenu)menu).Open();
((Behaviour)menu).enabled = true;
});
((TabbedMenu)menu).onClosed = (CloseMenuCallback)delegate(bool all)
{
if (!all)
{
buttonContainer.SetActive(true);
logo.SetActive(true);
}
};
component2.triggers.Add(val2);
}
}
public abstract class Localization
{
public class LocalizationElement
{
public string Key;
public string Value;
}
public static List<LocalizationElement> GetEnglishLocalizations()
{
return new List<LocalizationElement>
{
new LocalizationElement
{
Key = "Chapters",
Value = "Chapters"
},
new LocalizationElement
{
Key = "Chapter",
Value = "Chapter"
},
new LocalizationElement
{
Key = "Ep. 1",
Value = "Ep. 1"
},
new LocalizationElement
{
Key = "Ep. 2",
Value = "Ep. 2"
},
new LocalizationElement
{
Key = "Ep. 3",
Value = "Ep. 3"
},
new LocalizationElement
{
Key = "Ep. 4",
Value = "Ep. 4"
},
new LocalizationElement
{
Key = "Ep. 5",
Value = "Ep. 5"
},
new LocalizationElement
{
Key = "Ep. 6",
Value = "Ep. 6"
},
new LocalizationElement
{
Key = "Ep. 7",
Value = "Ep. 7"
},
new LocalizationElement
{
Key = "Ep. 8",
Value = "Ep. 8"
},
new LocalizationElement
{
Key = "???",
Value = "???"
},
new LocalizationElement
{
Key = "The Beach",
Value = "The Beach"
},
new LocalizationElement
{
Key = "Morning",
Value = "Morning"
},
new LocalizationElement
{
Key = "Meet Trish",
Value = "Meet Trish"
},
new LocalizationElement
{
Key = "Homeroom",
Value = "Homeroom"
},
new LocalizationElement
{
Key = "Music Room",
Value = "Music Room"
},
new LocalizationElement
{
Key = "Reed",
Value = "Reed"
},
new LocalizationElement
{
Key = "Trish",
Value = "Trish"
},
new LocalizationElement
{
Key = "Bus Home",
Value = "Bus Home"
},
new LocalizationElement
{
Key = "Naser and Naomi",
Value = "Naser and Naomi"
},
new LocalizationElement
{
Key = "Group Chat",
Value = "Group Chat"
},
new LocalizationElement
{
Key = "Kitchen",
Value = "Kitchen"
},
new LocalizationElement
{
Key = "The Meteor",
Value = "The Meteor"
},
new LocalizationElement
{
Key = "Secret Admirer",
Value = "Secret Admirer"
},
new LocalizationElement
{
Key = "Naser Drive",
Value = "Naser Drive"
},
new LocalizationElement
{
Key = "Pre Assembly",
Value = "Pre Assembly"
},
new LocalizationElement
{
Key = "Emergency Meeting",
Value = "Emergency Meeting"
},
new LocalizationElement
{
Key = "Carpe Diem",
Value = "Carpe Diem"
},
new LocalizationElement
{
Key = "Your Diems",
Value = "Your Diems"
},
new LocalizationElement
{
Key = "Naomi",
Value = "Naomi"
},
new LocalizationElement
{
Key = "Rosa",
Value = "Rosa"
},
new LocalizationElement
{
Key = "Memory Box",
Value = "Memory Box"
},
new LocalizationElement
{
Key = "Fang Searches",
Value = "Fang Searches"
},
new LocalizationElement
{
Key = "Midi Music",
Value = "Midi Music"
},
new LocalizationElement
{
Key = "Photo Day AM",
Value = "Photo Day AM"
},
new LocalizationElement
{
Key = "Kill Me Now",
Value = "Kill Me Now"
},
new LocalizationElement
{
Key = "Rooftop Reed",
Value = "Rooftop Reed"
},
new LocalizationElement
{
Key = "Naomi The Genius",
Value = "Naomi The Genius"
},
new LocalizationElement
{
Key = "The Walk Home",
Value = "The Walk Home"
},
new LocalizationElement
{
Key = "Audition Day A",
Value = "Audition Day A"
},
new LocalizationElement
{
Key = "Audition Day B",
Value = "Audition Day B"
},
new LocalizationElement
{
Key = "Audition Performance",
Value = "Audition Performance"
},
new LocalizationElement
{
Key = "Audition Day D",
Value = "Audition Day D"
},
new LocalizationElement
{
Key = "Caldera Dreams",
Value = "Caldera Dreams"
},
new LocalizationElement
{
Key = "Back to Reality",
Value = "Back to Reality"
},
new LocalizationElement
{
Key = "Meteor Class",
Value = "Meteor Class"
},
new LocalizationElement
{
Key = "Stella Wedge",
Value = "Stella Wedge"
},
new LocalizationElement
{
Key = "BOTB Ramp Up",
Value = "BOTB Ramp Up"
},
new LocalizationElement
{
Key = "Hunt For Mango",
Value = "Hunt For Mango"
},
new LocalizationElement
{
Key = "Busted For Posters",
Value = "Busted For Posters"
},
new LocalizationElement
{
Key = "LnL Intro",
Value = "LnL Intro"
},
new LocalizationElement
{
Key = "LnL",
Value = "LnL"
},
new LocalizationElement
{
Key = "Back To The Garage",
Value = "Back To The Garage"
},
new LocalizationElement
{
Key = "College Apps",
Value = "College Apps"
},
new LocalizationElement
{
Key = "Future Is Soon",
Value = "Future Is Soon"
},
new LocalizationElement
{
Key = "Sage Wedge",
Value = "Sage Wedge"
},
new LocalizationElement
{
Key = "Time To Try",
Value = "Time To Try"
},
new LocalizationElement
{
Key = "The Tri Force",
Value = "The Tri Force"
},
new LocalizationElement
{
Key = "Rosa Roof",
Value = "Rosa Roof"
},
new LocalizationElement
{
Key = "The Other Shoe",
Value = "The Other Shoe"
},
new LocalizationElement
{
Key = "LnL 2",
Value = "LnL 2"
},
new LocalizationElement
{
Key = "The Short Goodbye",
Value = "The Short Goodbye"
},
new LocalizationElement
{
Key = "Back Home",
Value = "Back Home"
},
new LocalizationElement
{
Key = "Breakfast Time",
Value = "Breakfast Time"
},
new LocalizationElement
{
Key = "Trish Walk",
Value = "Trish Walk"
},
new LocalizationElement
{
Key = "The Night Before",
Value = "The Night Before"
},
new LocalizationElement
{
Key = "The Parent Call",
Value = "The Parent Call"
},
new LocalizationElement
{
Key = "Ride Along",
Value = "Ride Along"
},
new LocalizationElement
{
Key = "Setup Time",
Value = "Setup Time"
},
new LocalizationElement
{
Key = "Green Room",
Value = "Green Room"
},
new LocalizationElement
{
Key = "Naser",
Value = "Naser"
},
new LocalizationElement
{
Key = "Bad Vibes",
Value = "Bad Vibes"
},
new LocalizationElement
{
Key = "Fuck It",
Value = "\"Fuck It\""
},
new LocalizationElement
{
Key = "Battle of the Bands",
Value = "Battle of the Bands"
},
new LocalizationElement
{
Key = "The Fight",
Value = "The Fight"
},
new LocalizationElement
{
Key = "The Aftermath",
Value = "The Aftermath"
},
new LocalizationElement
{
Key = "The Aurora",
Value = "The Aurora"
},
new LocalizationElement
{
Key = "Going Away",
Value = "Going Away"
},
new LocalizationElement
{
Key = "Before LnL",
Value = "Before LnL"
},
new LocalizationElement
{
Key = "After LnL",
Value = "After LnL"
},
new LocalizationElement
{
Key = "Beach Alone",
Value = "Beach Alone"
},
new LocalizationElement
{
Key = "Friends Arrive",
Value = "Friends Arrive"
},
new LocalizationElement
{
Key = "Turn For the Worse",
Value = "Turn For the Worse"
},
new LocalizationElement
{
Key = "The Ritual",
Value = "The Ritual"
},
new LocalizationElement
{
Key = "Be Not Alarmed",
Value = "Be Not Alarmed"
},
new LocalizationElement
{
Key = "Farewell Lava Java",
Value = "Farewell Lava Java"
},
new LocalizationElement
{
Key = "Worm Drama Check In",
Value = "Worm Drama Check In"
},
new LocalizationElement
{
Key = "Naomi Date",
Value = "Naomi Date"
},
new LocalizationElement
{
Key = "Naomi Hang",
Value = "Naomi Hang"
},
new LocalizationElement
{
Key = "Bad News",
Value = "Bad News"
},
new LocalizationElement
{
Key = "Trish And Fang",
Value = "Trish And Fang"
},
new LocalizationElement
{
Key = "Beach Day",
Value = "Beach Day"
},
new LocalizationElement
{
Key = "The Last Day",
Value = "The Last Day"
},
new LocalizationElement
{
Key = "On Arrival",
Value = "On Arrival"
},
new LocalizationElement
{
Key = "Final Prep",
Value = "Final Prep"
},
new LocalizationElement
{
Key = "Caldera Fest",
Value = "Caldera Fest"
}
};
}
}
public class SelectableScene
{
public enum Visibility
{
Visible,
Hidden,
Locked
}
public enum MinigameType
{
None,
Music,
Worm
}
public readonly string SceneName;
public readonly string DisplayName;
public string Description;
public readonly MinigameType Minigame;
private readonly int _chapter;
private readonly Visibility? _overridenVisibility;
public static readonly List<SelectableScene> AllScenes = _GenerateAllScenes();
private static readonly Dictionary<string, SelectableScene> SceneNameToSceneMap = _GenerateSceneNameToSceneMap();
private SelectableScene(string sceneName, string displayName, string description, int chapter, Visibility? overridenVisibility = null, MinigameType minigameType = MinigameType.None)
{
SceneName = sceneName;
DisplayName = displayName;
Description = description;
_chapter = chapter;
Minigame = minigameType;
_overridenVisibility = overridenVisibility;
}
public static bool IsSceneSelectable(GameplaySaveData data, Dictionary<string, object> saveVariables, string name)
{
return SceneNameToSceneMap[name].SceneVisibility(data, saveVariables) == Visibility.Visible;
}
public Visibility SceneVisibility(GameplaySaveData data, Dictionary<string, object> saveVariables)
{
if (_overridenVisibility.HasValue)
{
return _overridenVisibility.Value;
}
if (data?.sceneName == null)
{
return (!(SceneName == "E1_00_Beach")) ? Visibility.Locked : Visibility.Visible;
}
string savedSceneName = data.sceneName;
if (savedSceneName == SceneName)
{
return Visibility.Visible;
}
if (!SceneNameToSceneMap.TryGetValue(savedSceneName, out var value))
{
Plugin.LOG.LogWarning((object)("Scene " + savedSceneName + " not found in scene map"));
return Visibility.Hidden;
}
if (_chapter > value._chapter)
{
return Visibility.Locked;
}
object obj = Mgr_LevelFlow.Instance.CallPrivate("getSceneAlternate", SceneName);
SceneAlternate val = (SceneAlternate)((obj is SceneAlternate) ? obj : null);
if (val != null)
{
if (saveVariables.ContainsKey(val.boolName) && saveVariables[val.boolName] is bool && (bool)saveVariables[val.boolName] == val.boolConditionForAltScene)
{
return Visibility.Visible;
}
return Visibility.Hidden;
}
if (SceneName == "E1_04A_ReedWedge")
{
if (saveVariables.ContainsKey("reedWedge") && saveVariables["reedWedge"] is bool && (bool)saveVariables["reedWedge"])
{
return Visibility.Visible;
}
return Visibility.Hidden;
}
if (SceneName == "E1_04B_TrishWedge")
{
if (saveVariables.ContainsKey("trishWedge") && saveVariables["trishWedge"] is bool && (bool)saveVariables["trishWedge"])
{
return Visibility.Visible;
}
return Visibility.Hidden;
}
if (SceneName == "E2_06B_NaomiWedge")
{
if (saveVariables.ContainsKey("naomiWedge") && saveVariables["naomiWedge"] is bool && (bool)saveVariables["naomiWedge"])
{
return Visibility.Visible;
}
return Visibility.Hidden;
}
if (SceneName == "E2_06C_RosaWedge")
{
if (saveVariables.ContainsKey("rosaWedge") && saveVariables["rosaWedge"] is bool && (bool)saveVariables["rosaWedge"])
{
return Visibility.Visible;
}
return Visibility.Hidden;
}
if (value._chapter == _chapter)
{
string thisSceneName = SceneName;
List<SelectableScene> list = ScenesInChapter(_chapter);
int num = list.FindIndex((SelectableScene scene) => scene.SceneName == savedSceneName);
int num2 = list.FindIndex((SelectableScene scene) => scene.SceneName == thisSceneName);
return (num2 >= num) ? Visibility.Locked : Visibility.Visible;
}
return Visibility.Visible;
}
public static List<SelectableScene> ScenesInChapter(int chapter)
{
return AllScenes.Where((SelectableScene scene) => scene._chapter == chapter).ToList();
}
private static Dictionary<string, SelectableScene> _GenerateSceneNameToSceneMap()
{
Dictionary<string, SelectableScene> dictionary = new Dictionary<string, SelectableScene>();
foreach (SelectableScene allScene in AllScenes)
{
dictionary[allScene.SceneName] = allScene;
}
return dictionary;
}
public static IEnumerator TestAndLogSceneVisibility()
{
if ((int)Mgr_Saves.LoadState != 2)
{
yield return (object)new WaitForSeconds(1f);
}
ActuallyTestAndLogSceneVisibility();
}
private static void ActuallyTestAndLogSceneVisibility()
{
Plugin.LOG.LogInfo((object)("Scene Count: " + AllScenes.Count));
try
{
GameplaySaveData val = Mgr_Saves.saveData;
Dictionary<string, object> saveVariables;
if (val == null || val.sceneName == null)
{
val = null;
saveVariables = new Dictionary<string, object>();
}
else
{
saveVariables = OnyxUtils.ParseSaveDataString(val.globalVariables);
}
foreach (SelectableScene allScene in AllScenes)
{
Visibility visibility = allScene.SceneVisibility(val, saveVariables);
Plugin.LOG.LogInfo((object)("Scene " + allScene.SceneName + " is " + visibility));
}
}
catch (Exception ex)
{
Plugin.LOG.LogError((object)("Failed to test scene visibility: " + ex));
Plugin.LOG.LogError((object)ex.StackTrace);
}
}
private static List<SelectableScene> _GenerateAllScenes()
{
return new List<SelectableScene>
{
new SelectableScene("E1_00_Beach", "The Beach", "", 1),
new SelectableScene("E1_01_Morning", "Morning", "", 1),
new SelectableScene("E1_MorningMusic_MG", "Morning Music", "", 1, Visibility.Hidden),
new SelectableScene("E1_02_MeetTrish", "Meet Trish", "", 1),
new SelectableScene("E1_03_Homeroom", "Homeroom", "", 1),
new SelectableScene("E1_PhoneStaredown_MG", "Phone Staredown", "", 1, Visibility.Hidden),
new SelectableScene("E1_FangsLogoDesign_MG", "Fangs Logo Design", "", 1, Visibility.Hidden),
new SelectableScene("E1_04_MusicRoom", "Music Room", "", 1, null, MinigameType.Music),
new SelectableScene("E1_PerformingNewSong_MG", "Performing New Song", "", 1, Visibility.Hidden),
new SelectableScene("E1_04A_ReedWedge", "Reed", "", 1),
new SelectableScene("E1_04B_TrishWedge", "Trish", "", 1),
new SelectableScene("E1_05_BusHome", "Bus Home", "", 1),
new SelectableScene("E1_06_NaserandNaomi", "Naser and Naomi", "", 1, null, MinigameType.Music),
new SelectableScene("E1_PlayForNaomi_MG", "Play For Naomi", "", 1, Visibility.Hidden),
new SelectableScene("E1_07_GroupChat", "Group Chat", "", 1),
new SelectableScene("E1_08_Kitchen", "Kitchen", "", 1),
new SelectableScene("E1_Spices_MG", "Spices", "", 1, Visibility.Hidden),
new SelectableScene("E1_09_MeteorIntro", "The Meteor", "", 1),
new SelectableScene("E2_01_MeteorAftermath", "Secret Admirer", "", 2),
new SelectableScene("E2_Doomscroll_MG", "Doomscroll", "", 2, Visibility.Hidden),
new SelectableScene("E2_02_NaserDrive", "Naser Drive", "", 2),
new SelectableScene("E2_03_PreAssembly", "Pre Assembly", "", 2),
new SelectableScene("E2_04_EmergencyMtg", "Emergency Meeting", "", 2),
new SelectableScene("E2_05_CarpeDiem", "Carpe Diem", "", 2),
new SelectableScene("E2_AuditoriumPeopleWatching_MG", "Auditorium People Watching", "", 2, Visibility.Hidden),
new SelectableScene("E2_06_YourDiems", "Your Diems", "", 2),
new SelectableScene("E2_06B_NaomiWedge", "Naomi", "", 2),
new SelectableScene("E2_06C_RosaWedge", "Rosa", "", 2),
new SelectableScene("E2_07_MemoryBox", "Memory Box", "", 2),
new SelectableScene("E2_08_FangSearches", "Fang Searches", "", 2),
new SelectableScene("E2_ControllerHunt_MG", "Controller Hunt", "", 2, Visibility.Hidden),
new SelectableScene("E2_09A_MidiMusic", "Midi Music", "", 2, null, MinigameType.Music),
new SelectableScene("E2_MidiMusicPerf_MG", "Midi Music Performance", "", 2, Visibility.Hidden),
new SelectableScene("E2_10_PhotoDayAM", "Photo Day AM", "", 2),
new SelectableScene("E2_11_KillMeNow", "Kill Me Now", "", 2),
new SelectableScene("E2_PhotoDay_MG", "Photo Day", "", 2, Visibility.Hidden),
new SelectableScene("E2_FindReed_MG", "Find Reed", "", 2, Visibility.Hidden),
new SelectableScene("E2_12_RooftopReed", "Rooftop Reed", "", 2),
new SelectableScene("E2_13_NaomiTheGenius", "Naomi The Genius", "", 2),
new SelectableScene("E2_14_TheWalkHome", "The Walk Home", "", 2),
new SelectableScene("E2_15_AuditionDay_A", "Audition Day A", "", 2),
new SelectableScene("E2_15_AuditionDay_B", "Audition Day B", "", 2),
new SelectableScene("E2_15_AuditionDay_C", "Audition Performance", "", 2, null, MinigameType.Music),
new SelectableScene("E2_AuditionPerf_MG", "Audition Performance", "", 2, Visibility.Hidden),
new SelectableScene("E2_15_AuditionDay_D", "Audition Day D", "", 2),
new SelectableScene("E3_01_CalderaDreams", "Caldera Dreams", "", 3),
new SelectableScene("E3_PosterDesign_MG", "Poster Design", "", 3, Visibility.Hidden),
new SelectableScene("E3_02_BacktoReality", "Back to Reality", "", 3),
new SelectableScene("E3_04_MeteorClass", "Meteor Class", "", 3),
new SelectableScene("E3_04B_StellaWedge", "Stella Wedge", "", 3),
new SelectableScene("E3_05_BOTBRampUp", "BOTB Ramp Up", "", 3),
new SelectableScene("E3_06_HuntForMango", "Hunt For Mango", "", 3, null, MinigameType.Worm),
new SelectableScene("E3_HuntForMango_MG", "Hunt For Mango", "", 3, Visibility.Hidden),
new SelectableScene("E3_07_BustedForPosters", "Busted For Posters", "", 3),
new SelectableScene("E3_SecretAdmirerLyrics_MG", "Secret Admirer Lyrics", "", 3, Visibility.Hidden),
new SelectableScene("E3_08_LnLIntro", "LnL Intro", "", 3),
new SelectableScene("E3_09_LnL", "LnL", "", 3),
new SelectableScene("E3_Books_MG", "Books", "", 3, Visibility.Hidden),
new SelectableScene("E3_CrystalDoor_MG", "Crystal Door", "", 3, Visibility.Hidden),
new SelectableScene("E3_10_BackToTheGarage", "Back To The Garage", "", 3),
new SelectableScene("E4_01_CollegeApps", "College Apps", "", 4),
new SelectableScene("E4_02_FutureIsSoon", "Future Is Soon", "", 4),
new SelectableScene("E4_02B_SageWedge", "Sage Wedge", "", 4),
new SelectableScene("E4_04_TimeToTry", "Time To Try", "", 4),
new SelectableScene("E4_05_TheTriForce", "The Tri Force", "", 4),
new SelectableScene("E4_06_RosaRoof", "Rosa Roof", "", 4),
new SelectableScene("E4_07_TheOtherShoe", "The Other Shoe", "", 4),
new SelectableScene("E4_08_LnL2", "LnL 2", "", 4),
new SelectableScene("E4_09_TheShortGoodbye", "The Short Goodbye", "", 4),
new SelectableScene("E4_10_BackHome", "Back Home", "", 4),
new SelectableScene("E5_01_BreakfastTime", "Breakfast Time", "", 5),
new SelectableScene("E5_NaserPose_MG", "Naser Pose", "", 5, Visibility.Hidden),
new SelectableScene("E5_02_TrishWalk", "Trish Walk", "", 5),
new SelectableScene("E5_SongwritingConvo_MG", "Songwriting Convo", "", 5, Visibility.Hidden),
new SelectableScene("E5_03_TheNightBefore", "The Night Before", "", 5),
new SelectableScene("E5_04_TheParentCall", "The Parent Call", "", 5),
new SelectableScene("E5_05_RideAlong", "Ride Along", "", 5),
new SelectableScene("E5_06_SetupTime", "Setup Time", "", 5),
new SelectableScene("E5_07_GreenRoom", "Green Room", "", 5),
new SelectableScene("E5_07C_NaserWedge", "Naser", "", 5),
new SelectableScene("E5_08_BadVibesA", "Bad Vibes", "", 5),
new SelectableScene("E5_08B_BadVibesB", "Fuck It", "", 5, null, MinigameType.Music),
new SelectableScene("E5_BotBPerformance_MG", "BOTB Performance", "", 5, Visibility.Hidden),
new SelectableScene("E5_08C_BadVibesC", "Battle of the Bands", "", 5, null, MinigameType.Music),
new SelectableScene("E5_BotBPerformanceB_MG", "BOTB Performance B", "", 5, Visibility.Hidden),
new SelectableScene("E5_09_TheFight", "The Fight", "", 5),
new SelectableScene("E5_10_TheAftermath", "The Aftermath", "", 5),
new SelectableScene("E5_11_TheAurora", "The Aurora", "", 5),
new SelectableScene("E6_01_ReedRooftop", "Going Away", "", 6),
new SelectableScene("E6_AftermathPerformance_MG", "Aftermath Performance", "", 6, Visibility.Hidden),
new SelectableScene("E6_03_BeforeLnL", "LnL 3", "", 6),
new SelectableScene("E6_04_LnL", "LnL", "", 6, Visibility.Hidden),
new SelectableScene("E6_05_AfterLnL", "After LnL", "", 6),
new SelectableScene("E7_01_BeachAlone", "Beach Alone", "", 7),
new SelectableScene("E7_02_FriendsArrive", "Friends Arrive", "", 7),
new SelectableScene("E7_03_TurnForWorse", "Turn For the Worse", "", 7),
new SelectableScene("E7_04_Rosa", "Rosa", "", 7, Visibility.Hidden),
new SelectableScene("E7_05_Stella", "Stella", "", 7, Visibility.Hidden),
new SelectableScene("E7_06_Sage", "Sage", "", 7, Visibility.Hidden),
new SelectableScene("E7_07_Intermission", "Intermission", "", 7, Visibility.Hidden),
new SelectableScene("E7_08_Naser", "Naser", "", 7, Visibility.Hidden),
new SelectableScene("E7_09_Reed", "Reed", "", 7, Visibility.Hidden),
new SelectableScene("E7_10_Trish", "Trish", "", 7, Visibility.Hidden),
new SelectableScene("E7_11_Naomi", "Naomi", "", 7, Visibility.Hidden),
new SelectableScene("E7_12_TheRitual", "The Ritual", "", 7),
new SelectableScene("E8_02_BeNotAlarmed", "Be Not Alarmed", "", 8),
new SelectableScene("E8_04_FarewellLavaJava", "Farewell Lava Java", "", 8),
new SelectableScene("E8_05_WormDramaCheckIn", "Worm Drama Check In", "", 8),
new SelectableScene("E8_06_NaomiDate", "Naomi Date", "", 8),
new SelectableScene("E8_NaomiSongwriting_MG", "Naomi Songwriting", "", 8, Visibility.Hidden),
new SelectableScene("E8_07_NaomiHang", "Naomi Hang", "", 8),
new SelectableScene("E8_08_BadNews", "Bad News", "", 8),
new SelectableScene("E8_10_TrishAndFang", "Trish And Fang", "", 8),
new SelectableScene("E8_11_BeachDay", "Beach Day", "", 8),
new SelectableScene("E8_12_TheLastDay", "The Last Day", "", 8),
new SelectableScene("E8_13_OnArrival", "On Arrival", "", 8),
new SelectableScene("E8_13_OnArrival_Alt", "On Arrival Alt", "", 8),
new SelectableScene("E8_14_FinalPrep", "Final Prep", "", 8),
new SelectableScene("E8_14_FinalPrep_Alt", "Final Prep Alt", "", 8),
new SelectableScene("E8_15A_CalderaFest", "Caldera Fest", "", 8),
new SelectableScene("E8_15A_CalderaFest_Alt", "Caldera Fest Alt", "", 8),
new SelectableScene("E8_15B_CalderaFest", "Caldera Fest", "", 8, Visibility.Hidden),
new SelectableScene("E8_15B_CalderaFest_Alt", "Caldera Fest Alt", "", 8, Visibility.Hidden),
new SelectableScene("E8_15C_CalderaFest", "Caldera Fest", "", 8, Visibility.Hidden),
new SelectableScene("E8_15C_CalderaFest_Alt", "Caldera Fest Alt", "", 8, Visibility.Hidden),
new SelectableScene("E8_Crowd_MG", "Crowd", "", 8, Visibility.Hidden),
new SelectableScene("E8_FinalPerformance_MG", "Final Performance", "", 8, Visibility.Hidden),
new SelectableScene("E8_FinalPerformance_Alt_MG", "Final Performance Alt", "", 8, Visibility.Hidden),
new SelectableScene("Credits", "Credits", "", 8, Visibility.Visible)
};
}
}
internal class OnyxUtils
{
public static Dictionary<string, object> ParseSaveDataString(string data)
{
Dictionary<string, object> dictionary = new Dictionary<string, object>();
string[] array = data.Split(',');
string[] array2 = array;
foreach (string text in array2)
{
if (text == "")
{
continue;
}
if (!text.Contains('='))
{
Plugin.LOG.LogWarning((object)("OnyxUtils.ParseSaveDataString: Invalid pair: " + text));
continue;
}
string[] array3 = text.Split('=');
string key = array3[0];
string[] array4 = array3[1].Split('|');
int num = int.Parse(array4[0]);
object obj = array4[1];
switch (num)
{
case 0:
dictionary[key] = bool.Parse(obj.ToString());
break;
case 1:
dictionary[key] = float.Parse(obj.ToString());
break;
case 2:
dictionary[key] = int.Parse(obj.ToString());
break;
case 3:
dictionary[key] = obj;
break;
}
}
return dictionary;
}
public static bool IsClassLoaded(string className)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
Assembly[] array = assemblies;
foreach (Assembly assembly in array)
{
Type[] types = assembly.GetTypes();
if (types.Any((Type type) => type.Name == className))
{
return true;
}
}
return false;
}
public static AssetBundle LoadEmbeddedAssetBundle(string resourceName)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
foreach (string text in manifestResourceNames)
{
Plugin.LOG.LogInfo((object)("Resource: " + text));
}
using Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
if (stream == null)
{
Debug.LogError((object)("Could not find resource: " + resourceName));
return null;
}
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
Plugin.LOG.LogInfo((object)("SZ: " + array.Length));
return AssetBundle.LoadFromMemory(array);
}
}
public class ChaptersMenu : TabbedMenu
{
protected override void OnEnable()
{
((TabbedMenu)this).OnEnable();
Transform child = ((Component)this).transform.GetChild(1).GetChild(0).GetChild(1)
.GetChild(1);
BasicMenuTab[] componentsInChildren = ((Component)child).GetComponentsInChildren<BasicMenuTab>();
foreach (BasicMenuTab val in componentsInChildren)
{
((TMP_Text)val.text).enableWordWrapping = false;
((TMP_Text)val.text).enableAutoSizing = true;
}
}
public void BuildUI()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0050: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00fb: Expected O, but got Unknown
//IL_011b: 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_0147: 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_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Expected O, but got Unknown
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Expected O, but got Unknown
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Expected O, but got Unknown
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Expected O, but got Unknown
//IL_044a: Unknown result type (might be due to invalid IL or missing references)
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_0478: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
//IL_0561: Unknown result type (might be due to invalid IL or missing references)
//IL_0568: Expected O, but got Unknown
//IL_057e: Unknown result type (might be due to invalid IL or missing references)
//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
//IL_060d: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Expected O, but got Unknown
//IL_0629: Unknown result type (might be due to invalid IL or missing references)
//IL_0640: Unknown result type (might be due to invalid IL or missing references)
//IL_0657: Unknown result type (might be due to invalid IL or missing references)
//IL_066e: Unknown result type (might be due to invalid IL or missing references)
//IL_0685: Unknown result type (might be due to invalid IL or missing references)
//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Expected O, but got Unknown
//IL_071f: Unknown result type (might be due to invalid IL or missing references)
//IL_0736: Unknown result type (might be due to invalid IL or missing references)
//IL_074d: Unknown result type (might be due to invalid IL or missing references)
//IL_0764: Unknown result type (might be due to invalid IL or missing references)
//IL_077b: Unknown result type (might be due to invalid IL or missing references)
//IL_0792: Unknown result type (might be due to invalid IL or missing references)
//IL_07df: Unknown result type (might be due to invalid IL or missing references)
//IL_07e9: Expected O, but got Unknown
//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0805: Unknown result type (might be due to invalid IL or missing references)
//IL_080b: Unknown result type (might be due to invalid IL or missing references)
//IL_080c: Unknown result type (might be due to invalid IL or missing references)
//IL_0845: Unknown result type (might be due to invalid IL or missing references)
//IL_084c: Expected O, but got Unknown
//IL_0875: Unknown result type (might be due to invalid IL or missing references)
//IL_088c: Unknown result type (might be due to invalid IL or missing references)
//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
//IL_08d1: Unknown result type (might be due to invalid IL or missing references)
//IL_08e8: Unknown result type (might be due to invalid IL or missing references)
//IL_08ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0991: Unknown result type (might be due to invalid IL or missing references)
//IL_09bc: Unknown result type (might be due to invalid IL or missing references)
//IL_09df: Unknown result type (might be due to invalid IL or missing references)
//IL_09e6: Expected O, but got Unknown
//IL_0a5e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
//IL_0aab: Unknown result type (might be due to invalid IL or missing references)
//IL_0ab2: Expected O, but got Unknown
GameObject val = new GameObject("Background", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val.transform.SetParent(((Component)this).transform);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 1f);
component.offsetMin = new Vector2(0f, 0f);
component.offsetMax = new Vector2(0f, 0f);
((Transform)component).localScale = new Vector3(1f, 1f, 1f);
((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.5f);
GameObject val2 = new GameObject("MainRegion", new Type[1] { typeof(RectTransform) });
RectTransform component2 = val2.GetComponent<RectTransform>();
((Transform)component2).SetParent(((Component)this).transform, false);
component2.anchorMin = new Vector2(0f, 0f);
component2.anchorMax = new Vector2(1f, 1f);
component2.pivot = new Vector2(0.5f, 0.5f);
component2.offsetMin = new Vector2(0f, 0f);
component2.offsetMax = new Vector2(0f, 0f);
((Transform)component2).localScale = new Vector3(1f, 1f, 1f);
GameObject val3 = new GameObject("TitleAndTabs", new Type[3]
{
typeof(RectTransform),
typeof(HorizontalLayoutGroup),
typeof(ContentSizeFitterIgnoreIfLayoutChild)
});
HorizontalLayoutGroup component3 = val3.GetComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)component3).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)component3).spacing = 50f;
RectTransform component4 = val3.GetComponent<RectTransform>();
((Transform)component4).SetParent(val2.transform, false);
((Transform)component4).localScale = new Vector3(1f, 1f, 1f);
component4.anchorMin = new Vector2(0f, 1f);
component4.anchorMax = new Vector2(1f, 1f);
component4.pivot = new Vector2(0.5f, 1f);
component4.sizeDelta = new Vector2(0f, 400f);
component4.offsetMin = new Vector2(160f, -360f);
component4.offsetMax = new Vector2(-160f, 40f);
GameObject val4 = new GameObject("Title", new Type[1] { typeof(TextMeshProUGUI) });
TextMeshProUGUI component5 = val4.GetComponent<TextMeshProUGUI>();
((TMP_Text)component5).text = "Chapters";
((TMP_Text)component5).fontSize = 86f;
((TMP_Text)component5).alignment = (TextAlignmentOptions)513;
((TMP_Text)component5).enableWordWrapping = false;
((TMP_Text)component5).enableAutoSizing = true;
RectTransform component6 = val4.GetComponent<RectTransform>();
((Transform)component6).SetParent(val3.transform);
component6.anchorMin = new Vector2(0f, 0.5f);
component6.anchorMax = new Vector2(0f, 0.5f);
component6.pivot = new Vector2(0f, 0.5f);
component6.offsetMax = new Vector2(1765f, 100f);
component6.offsetMin = new Vector2(165f, -100f);
((Transform)component6).localScale = new Vector3(1f, 1f, 1f);
GameObject val5 = new GameObject("TitleSpacer");
RectTransform val6 = val5.AddComponent<RectTransform>();
((Transform)val6).SetParent(val3.transform);
val5.AddComponent<LayoutElement>().flexibleWidth = 1f;
GameObject val7 = new GameObject("TabContainer", new Type[3]
{
typeof(RectTransform),
typeof(HorizontalLayoutGroup),
typeof(ContentSizeFitterIgnoreIfLayoutChild)
});
RectTransform component7 = val7.GetComponent<RectTransform>();
((Transform)component7).SetParent(val3.transform);
component7.anchorMin = new Vector2(0f, 0f);
component7.anchorMax = new Vector2(1f, 0f);
component7.pivot = new Vector2(0f, 0f);
component7.offsetMin = new Vector2(165f, -100f);
component7.offsetMax = new Vector2(1930f, 100f);
((Transform)component7).localScale = new Vector3(1f, 1f, 1f);
((HorizontalOrVerticalLayoutGroup)val7.GetComponent<HorizontalLayoutGroup>()).childControlWidth = true;
val7.GetComponent<ContentSizeFitterIgnoreIfLayoutChild>().horizontalFit = (FitMode)2;
GameObject val8 = Object.Instantiate<GameObject>(Mgr_CS_GameAssetLoader.Instance.tabLeft, val7.transform);
((Object)val8).name = "TabLeftClone";
val8.transform.localScale = new Vector3(1f, 1f, 1f);
GameObject val9 = new GameObject("Tabs", new Type[3]
{
typeof(RectTransform),
typeof(HorizontalLayoutGroup),
typeof(ContentSizeFitterIgnoreIfLayoutChild)
});
((Transform)val9.GetComponent<RectTransform>()).localScale = new Vector3(0.425f, 0.425f, 0.425f);
((HorizontalOrVerticalLayoutGroup)val9.GetComponent<HorizontalLayoutGroup>()).spacing = 80f;
val9.transform.SetParent(val7.transform);
GameObject val10 = Object.Instantiate<GameObject>(Mgr_CS_GameAssetLoader.Instance.tabRight, val7.transform);
((Object)val10).name = "TabRightClone";
val10.transform.localScale = new Vector3(1f, 1f, 1f);
GameObject val11 = new GameObject("ChapterContentRegion", new Type[1] { typeof(RectTransform) });
RectTransform component8 = val11.GetComponent<RectTransform>();
component8.offsetMin = new Vector2(0f, -200f);
component8.offsetMax = new Vector2(0f, -200f);
component8.anchorMin = new Vector2(0f, 0f);
component8.anchorMax = new Vector2(1f, 1f);
component8.pivot = new Vector2(0.5f, 0.5f);
((Transform)component8).SetParent(val2.transform, false);
MenuPage[] array = (MenuPage[])(object)new MenuPage[8];
for (int i = 1; i <= 8; i++)
{
GameObject val12 = new GameObject("Chapter " + i, new Type[3]
{
typeof(RectTransform),
typeof(SelectableGroupController),
typeof(ChaptersPage)
});
RectTransform component9 = val12.GetComponent<RectTransform>();
((Transform)component9).SetParent(val11.transform, false);
((Transform)component9).localScale = new Vector3(1f, 1f, 1f);
component9.anchorMax = new Vector2(1f, 1f);
component9.anchorMin = new Vector2(0f, 0f);
component9.pivot = new Vector2(0.5f, 0.5f);
component9.offsetMin = new Vector2(0f, 0f);
component9.offsetMax = new Vector2(0f, 0f);
((Behaviour)val12.GetComponent<SelectableGroupController>()).enabled = true;
ChaptersPage component10 = val12.GetComponent<ChaptersPage>();
component10.columnCount = 4;
((MenuPage)component10).tabName = "Ep. " + i;
component10.chapter = i;
((MenuPage)component10).enabledOnThisPlatform = new PlatformFlags();
PlatformFlags enabledOnThisPlatform = ((MenuPage)component10).enabledOnThisPlatform;
enabledOnThisPlatform.platformFlags = (Platform)(enabledOnThisPlatform.platformFlags | 1);
PlatformFlags enabledOnThisPlatform2 = ((MenuPage)component10).enabledOnThisPlatform;
enabledOnThisPlatform2.platformFlags = (Platform)(enabledOnThisPlatform2.platformFlags | 5);
((Behaviour)component10).enabled = true;
array[i - 1] = (MenuPage)(object)val12.GetComponent<ChaptersPage>();
}
GameObject val13 = new GameObject("HorizontalPromptButtonSet");
RectTransform val14 = val13.AddComponent<RectTransform>();
((Transform)val14).SetParent(val2.transform, false);
((Transform)val14).localScale = new Vector3(1f, 1f, 1f);
val14.anchorMin = new Vector2(1f, 0f);
val14.anchorMax = new Vector2(1f, 1f);
val14.pivot = new Vector2(1f, 1f);
val14.sizeDelta = new Vector2(0f, 0f);
val14.offsetMin = new Vector2(-1000f, 150f);
val14.offsetMax = new Vector2(-160f, 150f);
HorizontalLayoutGroup val15 = val13.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val15).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)val15).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)val15).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)val15).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val15).spacing = 78f;
((HorizontalOrVerticalLayoutGroup)val15).reverseArrangement = true;
((LayoutGroup)val15).childAlignment = (TextAnchor)8;
GameObject val16 = Object.Instantiate<GameObject>(Mgr_CS_GameAssetLoader.Instance.tabLeft, val13.transform);
((Object)val16).name = "BackButton";
val16.transform.localScale = new Vector3(1f, 1f, 1f);
((RewiredActionElement)val16.GetComponent<RewiredActionButtonDownListener>()).RewiredAction = 76;
val16.GetComponent<RectTransform>().sizeDelta = new Vector2(120f, 100f);
GameObject val17 = new GameObject("BackButtonLabel", new Type[1] { typeof(TextMeshProUGUI) });
val17.transform.SetParent(val16.transform);
((TMP_Text)val17.GetComponent<TextMeshProUGUI>()).text = "Back";
((TMP_Text)val17.GetComponent<TextMeshProUGUI>()).font = Mgr_CS_GameAssetLoader.Instance.standardFontAsset;
GameObject val18 = Object.Instantiate<GameObject>(Mgr_CS_GameAssetLoader.Instance.tabLeft, val13.transform);
((Object)val18).name = "SelectButton";
val18.transform.localScale = new Vector3(1f, 1f, 1f);
((RewiredActionElement)val18.GetComponent<RewiredActionButtonDownListener>()).RewiredAction = 0;
val18.GetComponent<RectTransform>().sizeDelta = new Vector2(120f, 100f);
GameObject val19 = new GameObject("SelectButtonLabel", new Type[1] { typeof(TextMeshProUGUI) });
val19.transform.SetParent(val18.transform);
((TMP_Text)val19.GetComponent<TextMeshProUGUI>()).text = "Select";
((TMP_Text)val19.GetComponent<TextMeshProUGUI>()).font = Mgr_CS_GameAssetLoader.Instance.standardFontAsset;
base.pages = array;
base.MainCanvasGroup = ((Component)this).GetComponent<CanvasGroup>();
base.TabContainer = val9.transform;
base.TabRow = component4;
base.tabNameField = null;
base.tabController = ((Component)this).GetComponent<SelectableGroupController>();
base.controlsLayout = null;
base.controlPrefab = Mgr_CS_GameAssetLoader.Instance.controlPrefab;
base.tabPrefab = Mgr_CS_GameAssetLoader.Instance.tabPrefab;
base.ruleset_whileOpen = "MenuUI";
base.input_back = 76;
base.input_nextTab = 52;
base.input_previousTab = 51;
}
}
public class ChaptersPage : TwoAxisElementListPage
{
private List<SelectableScene> _scenes;
public int chapter = 1;
protected override void Awake()
{
Plugin.LOG.LogInfo((object)"Awake ChaptersPage");
((ElementListPage)this).elementController = ((Component)this).GetComponent<SelectableGroupController>();
base.Awake();
}
public override void GetControlsToAdd(List<LabelledRewiredAction> actions)
{
}
protected override void OnEnable()
{
((ElementListPage)this).OnEnable();
((MonoBehaviour)this).StartCoroutine(SelectFirstWhenReady());
}
private IEnumerator SelectFirstWhenReady()
{
if (!((Behaviour)((Component)this).GetComponent<SelectableGroupController>().GetElement(0)).isActiveAndEnabled)
{
yield return null;
}
((Component)this).GetComponentInChildren<ScrollRect>().verticalNormalizedPosition = 1f;
}
protected override void InitializePage()
{
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Expected O, but got Unknown
//IL_014b: 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_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0338: Expected O, but got Unknown
//IL_0422: Unknown result type (might be due to invalid IL or missing references)
//IL_042c: Expected O, but got Unknown
Plugin.LOG.LogInfo((object)"Initializing ChaptersPage");
try
{
((ElementListPage)this).InitializePage();
GameplaySaveData gsd = Mgr_Saves.saveData;
Dictionary<string, object> variables = OnyxUtils.ParseSaveDataString(gsd.globalVariables);
_scenes = (from scene in SelectableScene.ScenesInChapter(chapter)
where scene.SceneVisibility(gsd, variables) != SelectableScene.Visibility.Hidden
select scene).ToList();
GameObject val = Object.Instantiate<GameObject>(Mgr_CS_GameAssetLoader.Instance.settingsPageContentCanvasGroup, ((Component)this).transform);
GameObject gameObject = ((Component)val.transform.GetChild(0).GetChild(0).GetChild(0)).gameObject;
GameObject gameObject2 = ((Component)val.transform.GetChild(0)).gameObject;
Transform content = gameObject2.transform.GetChild(0);
Transform child = ((Component)content).transform.GetChild(1);
Object.Destroy((Object)(object)((Component)gameObject.transform.GetChild(0)).gameObject);
GameObject val2 = new GameObject("Items", new Type[3]
{
typeof(RectTransform),
typeof(GridLayoutGroup),
typeof(ContentSizeFitterIgnoreIfLayoutChild)
});
val2.transform.SetParent(gameObject.transform);
val2.transform.localScale = new Vector3(1f, 1f, 1f);
val2.GetComponent<RectTransform>().anchorMin = new Vector2(0f, 0f);
val2.GetComponent<RectTransform>().anchorMax = new Vector2(1f, 1f);
val2.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
val2.GetComponent<RectTransform>().offsetMin = new Vector2(0f, 0f);
val2.GetComponent<RectTransform>().offsetMax = new Vector2(0f, 0f);
((Component)content).GetComponent<ScrollRect>().content = val2.GetComponent<RectTransform>();
GridLayoutGroup component = val2.GetComponent<GridLayoutGroup>();
component.constraint = (Constraint)1;
component.constraintCount = 4;
RectOffset padding = ((LayoutGroup)component).padding;
padding.bottom += 500;
component.cellSize = new Vector2(768f, 432f);
component.spacing = new Vector2(150f, 75f);
component.startAxis = (Axis)0;
ContentSizeFitterIgnoreIfLayoutChild val3 = val2.AddComponent<ContentSizeFitterIgnoreIfLayoutChild>();
val3.horizontalFit = (FitMode)2;
val3.verticalFit = (FitMode)2;
RectTransform component2 = gameObject2.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 0f);
component2.anchorMax = new Vector2(1f, 1f);
component2.pivot = new Vector2(0.5f, 0.5f);
component2.offsetMin = new Vector2(0f, 0f);
component2.offsetMax = new Vector2(0f, -100f);
((Transform)component2).localScale = new Vector3(1f, 1f, 1f);
ContentSizeFitterIgnoreIfLayoutChild val4 = gameObject2.AddComponent<ContentSizeFitterIgnoreIfLayoutChild>();
val4.horizontalFit = (FitMode)0;
val4.verticalFit = (FitMode)0;
ScrollEvent val5 = new ScrollEvent();
((UnityEvent<float>)(object)val5).AddListener((UnityAction<float>)delegate(float value)
{
((Component)content).GetComponent<ScrollRect>().verticalNormalizedPosition = value;
});
((Component)child).GetComponent<Scrollbar>().onValueChanged = val5;
OurScrollRect = ((Component)content).GetComponent<ScrollRect>();
((MenuPage)this).canvasGroup = val.GetComponent<CanvasGroup>();
FieldInfo fieldInfo = ((object)this).GetType().BaseType?.BaseType?.GetField("scrollRect", BindingFlags.Instance | BindingFlags.NonPublic);
if (fieldInfo != null)
{
fieldInfo.SetValue(this, ((Component)content).GetComponent<ScrollRect>());
}
GameObject val6 = Object.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("SceneCardPrefab"));
((TMP_Text)val6.GetComponentInChildren<TextMeshProUGUI>()).font = Mgr_CS_GameAssetLoader.Instance.standardFontAsset;
SceneElement sceneElement = val6.AddComponent<SceneElement>();
sceneElement.parentPage = this;
((SelectableElement)sceneElement).onSelected = (SelectedCallback)Delegate.CreateDelegate(typeof(SelectedCallback), ((Component)this).GetComponent<SelectableGroupController>(), "OnSelected");
val6.AddComponent<StaticStringLocaliser>();
Texture2D texture = Plugin.Assets.LoadAsset<Texture2D>("guitar");
Texture2D texture2 = Plugin.Assets.LoadAsset<Texture2D>("ilovethiswormsofreakingmuch");
for (int i = 0; i < _scenes.Count; i++)
{
GameObject val7 = Object.Instantiate<GameObject>(val6, val2.transform);
((Object)val7).name = _scenes[i].SceneName;
((SelectableElement)val7.GetComponent<SceneElement>()).onSelected = ((SelectableElement)sceneElement).onSelected;
SelectableScene.Visibility visibility = _scenes[i].SceneVisibility(gsd, variables);
((TMP_Text)val7.GetComponentInChildren<TextMeshProUGUI>()).text = "<b> " + (i + 1) + "</b> " + ((visibility == SelectableScene.Visibility.Visible) ? _scenes[i].DisplayName : "???");
switch (_scenes[i].Minigame)
{
case SelectableScene.MinigameType.None:
((Component)val7.transform.GetChild(3)).gameObject.SetActive(false);
break;
case SelectableScene.MinigameType.Music:
((Component)val7.transform.GetChild(3)).GetComponent<RawImage>().texture = (Texture)(object)texture;
break;
case SelectableScene.MinigameType.Worm:
((Component)val7.transform.GetChild(3)).GetComponent<RawImage>().texture = (Texture)(object)texture2;
break;
default:
throw new ArgumentOutOfRangeException();
}
if (visibility == SelectableScene.Visibility.Visible)
{
((Component)val7.transform.GetChild(0)).GetComponent<RawImage>().texture = (Texture)(object)Plugin.Textures[_scenes[i].SceneName];
val7.GetComponent<StaticStringLocaliser>().BaseText = _scenes[i].DisplayName;
}
else
{
((Component)val7.transform.GetChild(0)).GetComponent<RawImage>().texture = (Texture)(object)Plugin.Textures["locked"];
val7.GetComponent<StaticStringLocaliser>().BaseText = "???";
}
((Component)this).GetComponent<SelectableGroupController>().elements.Add(val7.GetComponent<SelectableElement>());
val7.GetComponent<StaticStringLocaliser>().textObj = val7.GetComponent<TextMeshProUGUI>();
((Behaviour)val7.GetComponent<StaticStringLocaliser>()).enabled = true;
val7.GetComponent<SceneElement>().index = i;
((MenuPage)this).instantlySwapInAndOut.Add(val7);
}
((Component)this).GetComponent<SelectableGroupController>().SelectElementNoNotify(0);
((Component)this).GetComponent<SelectableGroupController>().SelectElement(0);
}
catch (Exception ex)
{
Plugin.LOG.LogError((object)("Failed to initialize ChaptersPage: " + ex));
Plugin.LOG.LogError((object)ex.StackTrace);
}
}
}
public class SceneElement : SelectableElement
{
public int index;
public ChaptersPage parentPage;
public override void OnSelected()
{
((SelectableElement)this).OnSelected();
((MonoBehaviour)this).StartCoroutine(AnimateAlpha(((Component)((Component)this).transform.GetChild(1)).GetComponent<RawImage>(), (Direction)30));
}
public override void OnDeselected()
{
((SelectableElement)this).OnDeselected();
((MonoBehaviour)this).StartCoroutine(AnimateAlpha(((Component)((Component)this).transform.GetChild(1)).GetComponent<RawImage>(), (Direction)20));
}
public override void OnSubmit()
{
((SelectableElement)this).OnSubmit();
Plugin.LOG.LogInfo((object)("Scene clicked: " + ((Object)this).name));
GameplaySaveData saveData = Mgr_Saves.saveData;
Dictionary<string, object> saveVariables = OnyxUtils.ParseSaveDataString(saveData.globalVariables);
if (SelectableScene.IsSceneSelectable(saveData, saveVariables, ((Object)this).name))
{
Mgr_ChapterSelect.Instance.StartThrowbackForScene(((Object)this).name);
}
}
private IEnumerator AnimateAlpha(RawImage image, Direction direction)
{
//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)
float startTime = Time.time;
float startAlpha;
float endAlpha;
if ((int)direction == 30)
{
startAlpha = Math.Min(0.75f, ((Graphic)image).color.a);
endAlpha = 0.25f;
}
else
{
startAlpha = Math.Max(0.25f, ((Graphic)image).color.a);
endAlpha = 0.75f;
}
Color startColor = new Color(((Graphic)image).color.r, ((Graphic)image).color.g, ((Graphic)image).color.b, startAlpha);
Color endColor = new Color(startColor.r, startColor.g, startColor.b, endAlpha);
while (Time.time < startTime + 0.2f)
{
float t = (Time.time - startTime) / 0.2f;
((Graphic)image).color = Color.Lerp(startColor, endColor, t);
yield return null;
}
((Graphic)image).color = endColor;
}
}
public class TwoAxisElementListPage : ElementListPage
{
private enum LastInputDirection
{
Left = -2,
Down,
None,
Up,
Right
}
private RewiredAxisAction _uiHorizontal;
private RewiredAxisAction _uiVertical;
private int _lastInput;
private float _holdTime;
private Coroutine _scrollCoroutine;
protected ScrollRect OurScrollRect;
public int columnCount = 1;
protected override void Awake()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
_uiVertical = new RewiredAxisAction
{
action = "UIVertical",
threshold = 0.8f
};
_uiHorizontal = new RewiredAxisAction
{
action = "UIHorizontal",
threshold = 0.8f
};
((UIBehaviour)this).Awake();
}
public override void Initialize()
{
((MenuPage)this).Initialize();
((ElementListPage)this).InitializePage();
}
private IEnumerator SmoothScrollAnimate(float target)
{
float time = 0f;
float start = OurScrollRect.verticalNormalizedPosition;
while (time < 0.2f)
{
time += Time.deltaTime;
OurScrollRect.verticalNormalizedPosition = Mathf.SmoothStep(start, target, time / 0.2f);
yield return null;
}
}
private void CenterOnScrollRect()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0034: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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)
SelectableElement element = base.elementController.GetElement(base.elementController.selectedElementIndex);
RectTransform val = (RectTransform)OurScrollRect.CallPrivate("get_rectTransform");
Rect rect = val.rect;
float height = ((Rect)(ref rect)).height;
rect = ((Interactable)element).rectTransform.rect;
float height2 = ((Rect)(ref rect)).height;
float num = ((Interactable)element).rectTransform.anchoredPosition.y + height2 / 2f;
float num2 = Math.Clamp(Math.Abs(num / height), 0f, 1f);
if (_scrollCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(_scrollCoroutine);
}
_scrollCoroutine = ((MonoBehaviour)this).StartCoroutine(SmoothScrollAnimate(1f - num2));
}
protected override void Update()
{
if (!((MenuPage)this).isActive || !((Interactable)this).IsInteractable())
{
return;
}
if (base.player == null)
{
base.player = Scr_InputMaster.Instance.Player;
}
bool buttonDown = RewiredExtensions.GetButtonDown(base.player, _uiVertical, (Dir)0);
bool buttonDown2 = RewiredExtensions.GetButtonDown(base.player, _uiVertical, (Dir)1);
bool buttonDown3 = RewiredExtensions.GetButtonDown(base.player, _uiHorizontal, (Dir)1);
bool buttonDown4 = RewiredExtensions.GetButtonDown(base.player, _uiHorizontal, (Dir)0);
if (buttonDown)
{
_lastInput = 1;
Plugin.LOG.LogInfo((object)"Up pressed");
_holdTime = 0f;
}
else if (buttonDown2)
{
_lastInput = -1;
Plugin.LOG.LogInfo((object)"Down pressed");
_holdTime = 0f;
}
else if (buttonDown3)
{
_lastInput = -2;
Plugin.LOG.LogInfo((object)"Left pressed");
_holdTime = 0f;
}
else if (buttonDown4)
{
_lastInput = 2;
Plugin.LOG.LogInfo((object)"Right pressed");
_holdTime = 0f;
}
if (buttonDown)
{
int num = Math.Max(0, base.elementController.selectedElementIndex - columnCount);
base.elementController.SelectElement(num);
CenterOnScrollRect();
}
else if (buttonDown2)
{
int num2 = Math.Min(base.elementController.elements.Count - 1, base.elementController.selectedElementIndex + columnCount);
base.elementController.SelectElement(num2);
CenterOnScrollRect();
}
else if (buttonDown3)
{
if (base.elementController.SelectPreviousElement(true, false))
{
CenterOnScrollRect();
}
}
else if (buttonDown4 && base.elementController.SelectNextElement(true, false))
{
CenterOnScrollRect();
}
if (base.player.GetButtonDown(0))
{
SelectableElement selectedElement = base.elementController.GetSelectedElement();
if (selectedElement != null)
{
selectedElement.OnSubmit();
}
}
this.CallPrivate("UpdateScrollAxis");
}
}
}