private void Awake() { if (StudioAPI.InsideStudio) { throw new NotImplementedException("Shouldn't load in studio"); } Instance = this; Logger = base.Logger; var windDescr = new ConfigDescription("Drag bottom right corner of the window to change these.", null, new ConfigurationManagerAttributes { IsAdvanced = true }); AddWinRect = Config.Bind("Windows", "Editor window rect", new Rect(10, 10, 500, 350), windDescr); ListWinRect = Config.Bind("Windows", "List window rect", new Rect(510, 10, 700, 350), windDescr); VarWinRect = Config.Bind("Windows", "Inspect window rect", new Rect(1220, 10, 370, 350), windDescr); SolidBackground = Config.Bind("Windows", "Solid window background", true, "Make window background solid for easier reading. If false, windows are transparent."); OpenShortcut = Config.Bind("General", "Open ADV editor", new KeyboardShortcut(KeyCode.Pause, KeyCode.LeftShift)); _hi = Harmony.CreateAndPatchAll(typeof(PreventAdvCrashHooks), GUID); #if DEBUG #if KK if (Manager.Game.Instance?.actScene?.isEventNow == true) { _advEditor.Enabled = true; } #elif KKS if (ActionScene.initialized && ActionScene.instance.isEventNow) { _advEditor.Enabled = true; } #endif #endif }
private void Awake() { if (StudioAPI.InsideStudio) { throw new NotImplementedException("Shouldn't load in studio"); } Instance = this; Logger = base.Logger; //if (!TomlTypeConverter.CanConvert(typeof(Rect))) //todo remove and use one in kkapi //{ // TomlTypeConverter.AddConverter(typeof(Rect), new TypeConverter // { // ConvertToObject = (s, type) => // { // var result = new Rect(); // if (s != null) // { // var cleaned = s.Trim('{', '}').Replace(" ", ""); // foreach (var part in cleaned.Split(',')) // { // var parts = part.Split(':'); // if (parts.Length == 2 && float.TryParse(parts[1], out var value)) // { // var id = parts[0].Trim('"'); // if (id == "x") result.x = value; // else if (id == "y") result.y = value; // // Check z and w in case something was using Vector4 to serialize a Rect before // else if (id == "width" || id == "z") result.width = value; // else if (id == "height" || id == "w") result.height = value; // } // } // } // return result; // }, // ConvertToString = (o, type) => // { // var rect = (Rect)o; // return string.Format(CultureInfo.InvariantCulture, // "{{ \"x\":{0}, \"y\":{1}, \"width\":{2}, \"height\":{3} }}", // rect.x, rect.y, rect.width, rect.height); // } // }); //} var windDescr = new ConfigDescription("Drag the window's bottom right corner to change these.", null, new ConfigurationManagerAttributes { IsAdvanced = true }); AddWinRect = Config.Bind("Windows", "Editor window rect", new Rect(10, 10, 500, 350), windDescr); ListWinRect = Config.Bind("Windows", "List window rect", new Rect(510, 10, 700, 350), windDescr); VarWinRect = Config.Bind("Windows", "Inspect window rect", new Rect(1220, 10, 370, 350), windDescr); OpenShortcut = Config.Bind("General", "Open ADV editor", new KeyboardShortcut(KeyCode.Pause, KeyCode.LeftShift)); _hi = Harmony.CreateAndPatchAll(typeof(PreventAdvCrashHooks), GUID); #if DEBUG if (Game.Instance?.actScene?.isEventNow == true) { _advEditor.Enabled = true; } #endif }