/// <summary> /// Initializes a new instance of the <see cref="MapSelectionViewModel" /> class. /// </summary> /// <param name="gameType">Type of the game.</param> public MapSelectionViewModel(GameConfiguration.GameType gameType) { this.WindowHeight = 410; this.WindowWidth = 700; this.BackButtonContent = Resources.BackToMenu; this.gameType = gameType; this.Maps = new ObservableCollection <Map>(); this.LoadMaps(); }
/// <summary> /// Initializes a new instance of the <see cref="LoadingScreenViewModel" /> class. /// </summary> /// <param name="loadingMessage">The loading message.</param> /// <param name="gameType">Type of the game.</param> /// <param name="isGameOwner">if set to <c>true</c> the current user is the game owner.</param> public LoadingScreenViewModel(string loadingMessage, GameConfiguration.GameType gameType, bool isGameOwner = false) { this.WindowWidth = 200; this.WindowHeight = 200; this.LoadingMessage = loadingMessage; this.BackButtonContent = Resources.Cancel; this.gameType = gameType; this.isGameOwner = isGameOwner; Application.Current.MainWindow.Closing += this.OnWindowClosing; }
/// <summary> /// Initializes the specified game identifier. /// </summary> /// <param name="gameId">The game identifier.</param> /// <param name="map">The map.</param> /// <param name="opponentName">Name of the opponent.</param> /// <param name="startGame">if set to <c>true</c> the current player starts the game.</param> /// <param name="isGameOwner">if set to <c>true</c> the current player owns the game.</param> /// <param name="gameType">Type of the game.</param> public void Init(Guid gameId, Map map, string opponentName, bool startGame, bool isGameOwner, GameConfiguration.GameType gameType) { this.GameId = gameId; this.Map = map; this.GameType = gameType; var localPlayer = new Player(Properties.Settings.Default.PlayerName, isGameOwner, true, startGame); this.LocalPlayer = localPlayer; if (!string.IsNullOrWhiteSpace(opponentName)) { var opponent = new Player(opponentName, !isGameOwner, false, !startGame); this.Opponent = opponent; this.CurrentPlayer = startGame ? this.LocalPlayer : this.Opponent; } else { this.CurrentPlayer = this.LocalPlayer; } }