using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using DooDesch.UI; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.UI.MainMenu; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Personify; using Personify.Editor; using Personify.Editor.Widgets; using S1API.Entities.Appearances.AccessoryFields; using S1API.Entities.Appearances.BodyLayerFields; using S1API.Entities.Appearances.CustomizationFields; using S1API.Entities.Appearances.FaceLayerFields; using S1API.Rendering; using S1API.UI; using SideHustle; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Core), "Personify", "1.0.0", "DooDesch", "https://github.com/DooDesch-Mods/ScheduleOne-Personify")] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: MelonOptionalDependencies(new string[] { "SideHustle" })] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Personify")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ee327a0afb36e6426dd5b66f26c80b8c034d4df1")] [assembly: AssemblyProduct("Personify")] [assembly: AssemblyTitle("Personify")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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 Personify { public sealed class Core : MelonMod { public static Core Instance { get; private set; } public static Instance Log { get; private set; } public override void OnInitializeMelon() { //IL_0011: 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) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_004b: 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) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown Instance = this; Log = ((MelonBase)this).LoggerInstance; try { API.Register(new GamemodeDescriptor { Id = "doodesch.personify", DisplayName = "Personify", Description = "Design and export custom NPC packs.", Author = "DooDesch", Support = (GamemodeSupport)0, Surface = (GamemodeSurface)0, OnLaunchSingleplayer = OnLaunch, OnExitToHub = OnExit }); Log.Msg("Personify " + ((MelonBase)this).Info.Version + " registered with Side Hustle."); } catch (Exception ex) { Log.Warning("Side Hustle not available, Personify cannot register: " + ex.Message); } } private static void OnLaunch(LaunchContext ctx) { EditorUI.Open(ctx); } private static void OnExit(LaunchContext ctx) { EditorUI.Close(); } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { if (sceneName == "Menu") { EditorUI.Close(); Preview.Forget(); } } public override void OnUpdate() { if (EditorUI.IsOpen) { EditorUI.Tick(); } } } } namespace Personify.Editor { public static class BackroomsPreset { public static readonly string[] Archetypes = new string[7] { "faceling", "wanderer_hollow", "smiler", "partygoer", "mimic_regular", "husk", "brute" }; public static readonly string[] Biomes = new string[7] { "L0", "L1", "L2", "L3", "L4", "L6", "Lm2" }; } public static class EditorUI { private enum FormMode { Basic, Advanced } private static LaunchContext _ctx; private static GameObject _canvasGO; private static GameObject _screen; private static NpcProject _project; private static NpcDraft _selected; private static Transform _railList; private static RectTransform _formContent; private static Text _titleText; private static bool _previewDirty; private static float _lastEdit; private const float RailW = 300f; private const float PanelW = 400f; private const float Gutter = 16f; private static FormMode _mode = FormMode.Basic; private static readonly Dictionary _modInstalled = new Dictionary(StringComparer.OrdinalIgnoreCase); private const float SliderLabelW = 84f; private const float SliderValueW = 38f; public static bool IsOpen => (Object)(object)_canvasGO != (Object)null; public static void Open(LaunchContext ctx) { _ctx = ctx; if ((Object)(object)_canvasGO == (Object)null) { BuildCanvas(); } Preview.EnsureAvatar(); ShowProjectSelect(); } public static void Close() { try { Preview.ExitEditor(); } catch { } try { Toast.Clear(); } catch { } if ((Object)(object)_canvasGO != (Object)null) { Object.Destroy((Object)(object)_canvasGO); _canvasGO = null; } _screen = null; _project = null; _selected = null; _railList = null; _formContent = null; _titleText = null; _previewDirty = false; } public static void Tick() { try { Toast.Tick(); } catch { } if (_previewDirty && Time.time - _lastEdit > 0.12f) { _previewDirty = false; if (_project != null && _selected != null) { Preview.Apply(_project, _selected); } } } private static void BuildCanvas() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _canvasGO = new GameObject("Personify_EditorCanvas"); Object.DontDestroyOnLoad((Object)(object)_canvasGO); Canvas obj = _canvasGO.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 30000; _canvasGO.AddComponent(); Toast.Init(_canvasGO.transform); } private static void ClearScreen() { if ((Object)(object)_screen != (Object)null) { Object.Destroy((Object)(object)_screen); _screen = null; } } private static void MarkDirty() { _previewDirty = true; _lastEdit = Time.time; } private static void ShowProjectSelect() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) ClearScreen(); _screen = UIFactory.Panel("ProjectSelect", _canvasGO.transform, Theme.BgBase, (Vector2?)null, (Vector2?)null, true); float num = Mathf.Min(720f, (float)Screen.height * 0.84f); GameObject val = UIFactory.Panel("Card", _screen.transform, Theme.BgPanel, (Vector2?)null, (Vector2?)null, false); Image component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.sprite = Theme.RoundedSprite(); component.type = (Type)1; } RectTransform component2 = val.GetComponent(); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); component2.anchorMax = val2; component2.anchorMin = val2; component2.pivot = new Vector2(0.5f, 0.5f); component2.sizeDelta = new Vector2(640f, num); Outline obj = val.AddComponent(); ((Shadow)obj).effectColor = Theme.HairlineStrong; ((Shadow)obj).effectDistance = new Vector2(1f, -1f); Text obj2 = UIFactory.Text("Title", "Personify", val.transform, 28, (TextAnchor)1, (FontStyle)1); ((Graphic)obj2).color = Theme.TextPrimary; ((Graphic)obj2).raycastTarget = false; RectTransform rectTransform = ((Graphic)obj2).rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.offsetMin = new Vector2(16f, -70f); rectTransform.offsetMax = new Vector2(-16f, -26f); Text obj3 = UIFactory.Text("Sub", "Design and export custom NPC packs.", val.transform, 14, (TextAnchor)1, (FontStyle)0); ((Graphic)obj3).color = Theme.TextMuted; ((Graphic)obj3).raycastTarget = false; RectTransform rectTransform2 = ((Graphic)obj3).rectTransform; rectTransform2.anchorMin = new Vector2(0f, 1f); rectTransform2.anchorMax = new Vector2(1f, 1f); rectTransform2.pivot = new Vector2(0.5f, 1f); rectTransform2.offsetMin = new Vector2(16f, -98f); rectTransform2.offsetMax = new Vector2(-16f, -74f); ValueTuple valueTuple = UIFactory.ButtonWithLabel("New", "New pack", val.transform, Theme.Accent, 210f, 48f); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; RectTransform component3 = item.GetComponent(); ((Vector2)(ref val2))..ctor(0.5f, 1f); component3.anchorMax = val2; component3.anchorMin = val2; component3.pivot = new Vector2(0.5f, 1f); component3.anchoredPosition = new Vector2(0f, -116f); component3.sizeDelta = new Vector2(210f, 48f); ((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { CreateProjectFlow(); })); ValueTuple valueTuple2 = UIFactory.ButtonWithLabel("Exit", "Exit to hub", val.transform, Theme.Button, 150f, 36f); GameObject item3 = valueTuple2.Item1; Button item4 = valueTuple2.Item2; RectTransform component4 = item3.GetComponent(); ((Vector2)(ref val2))..ctor(1f, 1f); component4.anchorMax = val2; component4.anchorMin = val2; component4.pivot = new Vector2(1f, 1f); component4.anchoredPosition = new Vector2(-16f, -20f); component4.sizeDelta = new Vector2(130f, 36f); ((UnityEvent)item4.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { ExitToHub(); })); RectTransform component5 = Components.Divider(val.transform).GetComponent(); component5.anchorMin = new Vector2(0f, 1f); component5.anchorMax = new Vector2(1f, 1f); component5.pivot = new Vector2(0.5f, 1f); component5.offsetMin = new Vector2(16f, -179f); component5.offsetMax = new Vector2(-16f, -178f); List list = ProjectStore.List(); Text obj4 = UIFactory.Text("YP", "Your packs (" + list.Count + ")", val.transform, 15, (TextAnchor)0, (FontStyle)1); ((Graphic)obj4).color = Theme.TextPrimary; ((Graphic)obj4).raycastTarget = false; RectTransform rectTransform3 = ((Graphic)obj4).rectTransform; rectTransform3.anchorMin = new Vector2(0f, 1f); rectTransform3.anchorMax = new Vector2(1f, 1f); rectTransform3.pivot = new Vector2(0.5f, 1f); rectTransform3.offsetMin = new Vector2(16f, -206f); rectTransform3.offsetMax = new Vector2(-16f, -186f); GameObject obj5 = UIFactory.Panel("List", val.transform, Theme.Clear, (Vector2?)null, (Vector2?)null, false); RectTransform component6 = obj5.GetComponent(); component6.anchorMin = new Vector2(0f, 0f); component6.anchorMax = new Vector2(1f, 1f); component6.pivot = new Vector2(0.5f, 1f); component6.offsetMin = new Vector2(16f, 20f); component6.offsetMax = new Vector2(-16f, -214f); ScrollRect val4 = default(ScrollRect); RectTransform val3 = Components.ScrollList(obj5.transform, ref val4, 8f); if (list.Count == 0) { Text obj6 = UIFactory.Text("empty", "No packs yet. Click \"New pack\" to start.", (Transform)(object)val3, 13, (TextAnchor)0, (FontStyle)0); ((Graphic)obj6).color = Theme.TextMuted; ((Component)obj6).gameObject.AddComponent().minHeight = 40f; } foreach (string item5 in list) { AddProjectRow((Transform)(object)val3, item5); } Interactions.PolishButtons(val.transform, true); } private static void AddProjectRow(Transform content, string folder) { //IL_003b: 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_00f1: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) string display = ProjectStore.DisplayName(folder); int num = ProjectStore.NpcCount(folder); GameObject val = UIFactory.Panel("row_" + folder, content, Theme.BgElevated, (Vector2?)null, (Vector2?)null, false); Image component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.sprite = Theme.RoundedSprite(); component.type = (Type)1; } val.AddComponent().minHeight = 54f; Button obj = val.AddComponent