public EditorMenu(QuickGameScene Scene, LiveEditor editor) : base(Scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(Scene), new MenuKeys { Select = GameKeys.MenuOK, Cancel = GameKeys.EditorMenu }) { AddOption(new ItemsOption() { Editor = editor }); AddOption(new FreezeItemsOption(Scene) { Editor = editor }); AddOption(new ReloadOption(Scene) { Editor = editor }); AddOption(new SaveLevelOption() { Editor = editor }); AddOption(new CancelOption() { Editor = editor }); }
protected override void OnOptionSelected(LiveEditor editor) { if (Editor.IsFrozen(Scene)) { editor.UnfreezeScene(Scene); } else { editor.FreezeScene(Scene); } editor.Menu.Visible = false; }
public ItemSelector(QuickGameScene Scene, LiveEditor editor) : base(Scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(Scene), new MenuKeys { Select = GameKeys.MenuOK, Cancel = GameKeys.EditorMenu }) { foreach (var cellType in EnumHelper.GetValues <CellType>().Where(p => p != CellType.Empty)) { AddOption(new EditorItem() { ItemType = cellType, Editor = editor }); } }
protected override void LoadSceneContent() { ParallaxLayer.FixedDisplayable = new IDisplayable[] { new SimpleGraphic(new Vector2(150, 0), new Sprite(Textures.TreeTexture), ParallaxLayer), new SimpleGraphic(new Vector2(150, 64), new Sprite(Textures.TreeTexture), ParallaxLayer) }; MapFromImage.Create(this); CollisionManager = new QuickGameCollisionManager(this); SolidLayer.CollidableObjects.Add(TileMap); Player = new King(); new Fairy(Player); CameraCenter = Player; new Interface(this); NeededSounds.AddRange(Sounds.GetAllSounds()); new Spike(this); new Spring(this); new WaterMover(WaterLayer); WaterHelper.AddWaterOverlays(WaterLayer, SolidLayer); new LadderCollisionDetector(TileMap); var editor = new LiveEditor(this); new PauseHandler(); // var sh = new ShopHandler(Input.GetInput(this),this); //new Sign().SetShopHandler(sh).MoveTo(200, 50); //new Chest().SetShopHandler(sh).MoveTo(216, 50); //new Elf().SetShopHandler(sh).MoveTo(180, 50).Direction = Direction.Left; new MapSaver().LoadFromDisk(this); //DebugText.DebugWatch(this, Fonts.SmallFont, InterfaceLayer, s => "O=" + s.SolidLayer.CollidableObjects.Count().ToString()); //DebugText.DebugWatch(this, Fonts.SmallFont, InterfaceLayer, s => "F=" + s.SolidLayer.CollidableObjects.OfType<FrozenObject>().Count().ToString()); //DebugText.DebugWatch(this, Fonts.SmallFont, InterfaceLayer, s => "C=" + s.SolidLayer.CollidableObjects.OfType<Coin>().Count().ToString()); }
protected override void OnOptionSelected(LiveEditor editor) { var playerPos = Scene.Player.Position.Center; foreach (var objectInThisScene in Scene.SolidLayer.CollidableObjects.OfType <IEditorPlaceable>()) { objectInThisScene.Remove(); } Scene.SolidLayer.Cleanup(); var reloadedScene = Engine.Instance.SceneLoader.LoadScene(Scene.ID, forceReload: true) as QuickGameScene; var newObjects = reloadedScene.SolidLayer.CollidableObjects.OfType <IEditorPlaceable>().ToArray().Select(p => FrozenObject.Create(p, Scene)).ToArray(); Engine.Instance.Scene = Scene; QuickGameScene.Current = Scene; editor.Menu.Visible = false; }
protected override void OnOptionSelected(LiveEditor editor) { editor.SaveLevel(); editor.Menu.Visible = false; }
protected override void OnOptionSelected(LiveEditor editor) { editor.Menu.Visible = false; editor.ItemSelector.Visible = true; }
protected abstract void OnOptionSelected(LiveEditor editor);