예제 #1
0
        public Interface(QuickGameScene scene)
        {
            Scene = scene;

            var screen = Engine.GetScreenBoundary().Position;

            var tileset = GameTiles.Border();

            border = new BorderedRectangle(tileset, new Rectangle(0, 0, screen.Width.SnapTo(tileset.Texture.CellSize.X), 30.SnapTo(tileset.Texture.CellSize.Y)),
                                           scene.InterfaceLayer);

            hearts = new IconCounter(scene.Player.DamageHandler.Hitpoints.GetMax(), Textures.HeartTexture, 0, 1, 2, scene.InterfaceLayer);
            hearts.Position.SetCorner(8, 4);


            ScoreLabel = new DynamicText <King>(scene.Player, p => "SCORE: " + p.Score.ToString("000000"), Fonts.SmallFont, scene.InterfaceLayer);

            ScoreLabel.DockInside(border, BorderSide.Right).Nudge(-4, 0);

            scene.AddObject(this);
        }
예제 #2
0
        public PauseHandler()
        {
            var scene = QuickGameScene.Current;

            scene.AddObject(this);

            pauseInputCondition = new InputCondition(GameKeys.Start, Input.GetInput(scene));

            foreach (var group in scene.UpdateGroups)
            {
                if (group.Priority != UpdatePriority.ModalMenu && group.Priority != UpdatePriority.Input)
                {
                    group.AddPauseCondition(IsPaused);
                }
            }

            pauseMenu = new LayoutPanel(GameTiles.Border(), scene.InterfaceLayer);
            pauseMenu.AddItem(new GameText(Fonts.BigFont, "PAUSED", scene.InterfaceLayer));
            pauseMenu.AddItem(new DynamicText <King>(scene.Player, p => "COINS: " + p.Coins, Fonts.BigFont, scene.InterfaceLayer));

            pauseMenu.Position.Center = Engine.GetScreenSize().Center;
            pauseMenu.Visible         = false;
        }
예제 #3
0
파일: Shop.cs 프로젝트: mp1011/Simple2DGame
        public ShopMenu(QuickGameScene scene) : base(scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(scene),
                                                     new MenuKeys {
            Select = GameKeys.MenuOK, Cancel = GameKeys.Start
        })
        {
            MenuPanel.AddItem(new GameText(Fonts.SmallFont, "WELCOME!", scene.InterfaceLayer));
            MenuPanel.AddItem(new DynamicText <King>(scene.Player, p => "COINS: " + p.Coins, Fonts.SmallFont, scene.InterfaceLayer));

            AddOption(new ExtraHeartShopItem()
            {
                Player = scene.Player, MenuPanel = MenuPanel
            });
            AddOption(new BetterAttackShopItem()
            {
                Player = scene.Player, MenuPanel = MenuPanel
            });
            AddOption(new ExitShopOption()
            {
                Player = scene.Player, MenuPanel = MenuPanel
            });
        }
예제 #4
0
 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
         });
     }
 }
예제 #5
0
 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
     });
 }