public EditorWindow(Editor e) { Editor = e; EntityEditor.Editor = e; TileEditor.Window = this; TileEditor.Editor = e; Commands = new CommandQueue { Editor = e }; if (!Engine.EditingLevel) { TileEditor.ReloadBiome(); return; } var locales = FileHandle.FromRoot("Prefabs/"); if (!locales.Exists()) { levels = new[] { "test" }; return; } var names = new List <string>(); foreach (var f in locales.ListFileHandles()) { if (f.Extension == ".lvl") { names.Add(f.NameWithoutExtension); } } levels = names.ToArray(); Load(); }
private void Load() { Editor.Area.Destroy(); Editor.Area = new Area(); Engine.Instance.State.Area = Editor.Area; Run.Level = null; if (levels.Length == 0) { var level = new RegularLevel { Width = levelWidth, Height = levelHeight, NoLightNoRender = false, DrawLight = false }; Editor.Level = level; Editor.Area.Add(level); level.SetBiome(BiomeRegistry.Get(Biome.Castle)); level.Setup(); level.Fill(Tile.FloorA); level.TileUp(); Editor.Camera.Position = Vector2.Zero; } else { SaveManager.Load(Editor.Area, SaveType.Level, $"Content/Prefabs/{levels[currentLevel]}.lvl"); Editor.Level = Run.Level; } for (var i = 0; i < Editor.Level.Size; i++) { Editor.Level.Explored[i] = true; } TileEditor.ReloadBiome(); }