示例#1
0
        public PlayingHud(Alex game, Player player, TitleComponent titleComponent) : base()
        {
            Title = titleComponent;

            Alex   = game;
            Player = player;

            Player.OnInventoryChanged += OnInventoryChanged;

            Anchor  = Alignment.Fill;
            Padding = Thickness.One;

            _playerController = player.Controller;
            InputManager.AddListener(new MouseInputListener(InputManager.PlayerIndex));

            _healthAndHotbar = new GuiStackContainer()
            {
                Orientation = Orientation.Vertical,
                ChildAnchor = Alignment.Fill
            };

            _bottomContainer              = new GuiMultiStackContainer();
            _bottomContainer.ChildAnchor  = Alignment.BottomFill;
            _bottomContainer.Anchor       = Alignment.BottomCenter;
            _bottomContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            _bottomContainer.Orientation  = Orientation.Vertical;

            //BottomContainer.

            _hotbar         = new GuiItemHotbar(player.Inventory);
            _hotbar.Anchor  = Alignment.BottomCenter;
            _hotbar.Padding = Thickness.Zero;

            Chat         = new ChatComponent();
            Chat.Enabled = false;
            Chat.Anchor  = Alignment.BottomLeft;

            _healthContainer        = new GuiContainer();
            _healthContainer.Anchor = Alignment.Fill;

            _healthContainer.Margin = new Thickness(0, 0, 0, 1);

            _healthComponent        = new HealthComponent(player);
            _healthComponent.Anchor = Alignment.TopLeft;

            _hungerComponent        = new HungerComponent(player);
            _hungerComponent.Anchor = Alignment.TopRight;

            _tipPopupComponent              = new TipPopupComponent();
            _tipPopupComponent.Anchor       = Alignment.BottomCenter;
            _tipPopupComponent.AutoSizeMode = AutoSizeMode.GrowAndShrink;

            Scoreboard        = new ScoreboardView();
            Scoreboard.Anchor = Alignment.MiddleRight;
        }
示例#2
0
        public PlayingHud(Alex game, Player player, ChatComponent chat, TitleComponent titleComponent) : base()
        {
            Title = titleComponent;

            Alex   = game;
            Player = player;

            _playerController = player.Controller;
            InputManager.AddListener(new MouseInputListener(InputManager.PlayerIndex));

            _hotbar         = new GuiItemHotbar(player.Inventory);
            _hotbar.Anchor  = Alignment.BottomCenter;
            _hotbar.Padding = Thickness.Zero;

            Chat         = chat;
            Chat.Enabled = false;
            Chat.Anchor  = Alignment.BottomLeft;
        }