using Nullframes.Intrigues.Graph; using Nullframes.Intrigues.Utils; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; namespace Nullframes.Intrigues { public class IWelcomeWindow : EditorWindow { [MenuItem("Tools/Nullframes/Intrigues/Welcome Window", false, 0)] public static void OpenWindow() { var wnd = GetWindow(); wnd.titleContent = new GUIContent("Intrigues"); wnd.maxSize = new Vector2(600f, 920f); wnd.minSize = new Vector2(600f, 920f); } [MenuItem("Tools/Nullframes/Intrigues/Video Tutorials")] public static void GoVideos() { Application.OpenURL("https://www.youtube.com/playlist?list=PLIwYhgYrkPtL5hAOSu-Mj-TUxEUF0--3J"); } [MenuItem("Tools/Nullframes/Intrigues/Wiki")] public static void Wiki() { Application.OpenURL("https://wlabsocks.com/wiki"); } [MenuItem("Tools/Nullframes/Intrigues/Forum")] public static void PHPBB() { Application.OpenURL("https://wlabsocks.com/forum"); } [MenuItem("Tools/Nullframes/Intrigues/Support")] public static void Contact() { Application.OpenURL("https://wlabsocks.com/contact.html"); } public void CreateGUI() { // Each editor window contains a root VisualElement object VisualElement root = rootVisualElement; // Import UXML var visualTree = (VisualTreeAsset)EditorGUIUtility.Load("Nullframes/WelcomeWindow.uxml"); visualTree.CloneTree(root); // Import USS var styleSheet = (StyleSheet)EditorGUIUtility.Load(EditorGUIUtility.isProSkin ? "Nullframes/WelcomeWindow_Dark.uss" : "Nullframes/WelcomeWindow_Light.uss"); root.styleSheets.Add(styleSheet); var debugMode = root.Q("debug_mode"); var startup = root.Q("startup"); var debugKey = PlayerPrefs.HasKey("IntriguesDebugMode") && bool.Parse(PlayerPrefs.GetString("IntriguesDebugMode")); debugMode.value = debugKey; var startupKey = PlayerPrefs.HasKey("Intrigues_Startup_V4c") && bool.Parse(PlayerPrefs.GetString("Intrigues_Startup_V4c")); startup.value = startupKey; debugMode.RegisterCallback>(evt => { PlayerPrefs.SetString("IntriguesDebugMode", evt.newValue.ToString()); PlayerPrefs.Save(); }); startup.RegisterCallback>(evt => { PlayerPrefs.SetString("Intrigues_Startup_V4c", evt.newValue.ToString()); PlayerPrefs.Save(); }); var pdfButton = root.Q("pdf"); var phpbb = root.Q("phpbb"); var mailButton = root.Q("mail"); pdfButton.RegisterCallback(_ => Wiki()); phpbb.RegisterCallback(_ => PHPBB()); mailButton.RegisterCallback(_ => Contact()); var version = root.Q