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; }
public GamesViewModel() { LoginViewModel = new LoginViewModel(); ScoreboardViewModel = new ScoreboardViewModel(); TicTacToeViewModel = new TicTacToeViewModel(); PairGameViewModel = new PairGameViewModel(); RatingViewModel = new RatingViewModel(); SnakeViewModel = new SnakeViewModel(); DoorsGameViewModel = new DoorsGameViewModel(); MoneyViewModel = new MoneyViewModel(); _playerManager = new PlayerManager(); NewGameCommand = new RelayCommand(param => StartGame((string)param)); ShopCommand = new RelayCommand(param => { ShopWindow shopWindow = new ShopWindow(); shopWindow.ShowDialog(); }); ScoreboardCommand = new RelayCommand(param => { ScoreboardViewModel.Refresh(); ScoreboardView scoreboardView = new ScoreboardView(); scoreboardView.ShowDialog(); }); RatingCommand = new RelayCommand(param => { RatingView ratingView = new RatingView(); ratingView.ShowDialog(); }); PlayerEditCommand = new RelayCommand(param => { EditView editView = new EditView(); editView.ShowDialog(); }); AddMoneyCommand = new RelayCommand(param => { MoneyView moneyView = new MoneyView(); moneyView.ShowDialog(); }); StartGameTestingCommand = new RelayCommand(param => { StartGameTesting((string)param); }); BuyItemCommand = new RelayCommand(param => { if (int.Parse(param.ToString()) > Money) { MessageBox.Show("You do not have enough to buy this game.\n Consider adding money to your balance.", "Message", MessageBoxButton.OK); } else { _playerManager.AddMoney(LoginViewModel.Player.Id, -int.Parse(param.ToString())); Money = Money; } }); }
public ScoreboardController() { view = new ScoreboardView(this); model = new ScoreboardModel(); }