public void OpenStreetBuyingWindow(PlayerViewModel player, GameCardViewModel gameCard) { SetStreetBuyingGameCard(gameCard); SetEnableBuying(player.PlayerCheckBalance(gameCard.StreetPrice)); SetCashAfterBuying(player.PlayerCashAfterBuying(gameCard)); WindowContent.GetWindowContent().GetAdditionalViewModel <DoneButtonViewModel>().SetDoneButton(false); WindowContent.GetWindowContent().SetDetailsViewModelActive <StreetBuyingViewModel>(); }
/// <summary> /// Sets the initial position of all Players /// </summary> /// <param name="positionID">The position ID</param> public void SetAllPlayerInitialPosition(int positionID) { foreach (PlayerViewModel player in AllPlayers) { player.CurrentPosition = 0; WindowContent.GetWindowContent().GetViewModel <GameBoardViewModel>().GamePool.GetGameCard(positionID).AddPlayerOnCard(player); } }
public CommunityChestTests() { contentTest = WindowContent.GetWindowContent(); communityChestRef = WindowContent.GetWindowContent().CommunityChest; testPlayer = new PlayerViewModel(new PlayerModel() { CurrentPosition = 0, AmountHotels = 0, AmountHouses = 0, FirstThrow = 0, PlayerCash = 2000, PlayerID = 0, PlayerName = "Test", PrisonRoll = 7 }); WindowContent.GetWindowContent().ManagingPlayer.AddPlayer(testPlayer); WindowContent.GetWindowContent().ManagingPlayer.SetAllPlayerCollection(); }
/// <summary> /// Returns a HouseViewModel reference of a house that is not yet in use. /// If no house is available it returns nothing and shows a MessageBox with information regarding this case. /// Sets all neccessary fields in the HouseViewModel. /// </summary> /// <param name="street"></param> /// <returns></returns> public HouseViewModel BuildHouse(GameCardViewModel street) { foreach (HouseViewModel house in Houses) { if (house.IsHouseNotNull() && house.IsHouseNotInUse()) { UnavailableHouses[house.GetUniqueID()] = house; Houses[house.GetUniqueID()] = null; house.SetBuiltStreet(street); house.SetHouseInUse(true); UpdateAvailableHouses(); street.AddHouseToStreet(house); WindowContent.GetWindowContent().OpenMessageBox(String.Format("{0} Häuser übrig", AvailableHouses)); return(house); } } WindowContent.GetWindowContent().OpenMessageBox("Keine Häuser mehr verfügbar!"); return(null); }
public HouseViewModel BuildHotel(GameCardViewModel street) { AddHousesToPool(street); street.Houses.Clear(); foreach (HouseViewModel hotel in Hotels) { if (hotel.IsHouseNotNull() && hotel.IsHouseNotInUse()) { UnavailableHotels[hotel.GetUniqueHotelID()] = hotel; Hotels[hotel.GetUniqueHotelID()] = null; hotel.SetBuiltStreet(street); hotel.SetHouseInUse(true); UpdateAvailableHouses(); street.AddHouseToStreet(hotel); return(hotel); } } WindowContent.GetWindowContent().OpenMessageBox("Keine Hotels mehr verfügbar!"); return(null); }
/// <summary> /// The player buys a hotel. /// </summary> /// <param name="gameCard"></param> public void BuyHotel(GameCardViewModel gameCard) { if (gameCard.IsActivePlayerOwningPlayer()) { if (WindowContent.GetWindowContent().GetManagingPlayer().GetActivePlayer().IsMonopolyComplete(gameCard)) { gameCard.SetMaxMonopolyHouses(gameCard); if (gameCard.NrOfHousesLessThanMonopolyMax()) { gameCard.DecreaseHouseAmount(); gameCard.GetOwningPlayer().PlayerRemoveMoney(gameCard.GetHousePrice()); gamePool.BuildHotel(gameCard); gameCard.SetMinMonopolyHouses(gameCard); } else { WindowContent.GetWindowContent().OpenMessageBox("Bauen nicht möglich! Bauen Sie zunächst gleichmäßig viele Häuser auf diesem Monopol!"); } } } }
/// <summary> /// The player buys a hotel. /// </summary> /// <param name="gameCard"></param> public void SellHotel(GameCardViewModel gameCard) { if (gameCard.IsActivePlayerOwningPlayer()) { if (WindowContent.GetWindowContent().GetManagingPlayer().GetActivePlayer().IsMonopolyComplete(gameCard)) { gameCard.SetMinMonopolyHouses(gameCard); if (gameCard.NrOfHousesGreaterThanMonopolyMin()) { gameCard.SetMaxMonopolyHouses(gameCard); gameCard.DecreaseHouseAmount(); gameCard.GetOwningPlayer().PlayerAddMoney(gameCard.GetSellPrice()); gamePool.SellHotel(gameCard); } else { WindowContent.GetWindowContent().OpenMessageBox("Verkaufen nicht möglich! Um auf dieser Straße ein weiteres Haus verkaufen zu können müssen zunächst auf allen Straßen des Monopols gleich viele Häuser stehen!"); } } } }
public bool CheckSellHotel() { int amount = 0; foreach (HouseViewModel house in Houses) { if (house != null) { amount++; } } if (amount >= 4) { return(true); } else { WindowContent.GetWindowContent().OpenMessageBox("Das Hotel kann nicht verkauft werden, da nicht genügend Häuser zur verfügung stehen."); return(false); } }
/// <summary> /// Sets the revert target for the Closing window "cancel" button. /// </summary> /// <param name="passedRevert">The Window to revert to.</param> public void SetClosingWindowRevert(Windows passedRevert) { CloseGameViewModel vm = WindowContent.GetWindowContent().GetViewModel <CloseGameViewModel>(); vm.CalledWindow = passedRevert; }
/// <summary> /// Review Refactor closing window revert. /// </summary> public void Revert() { CloseGameViewModel closeGameViewModel = WindowContent.GetWindowContent().GetViewModel <CloseGameViewModel>(); WindowContent.GetWindowContent().SetViewModelActive(closeGameViewModel.CalledWindow); }
/// <summary> /// REVIEW Make this function ubiquitous. Every window should call the same function for this. /// </summary> /// <param name="callingWindow"></param> public void CloseGame(Windows callingWindow) { SetClosingWindowRevert(callingWindow); WindowContent.GetWindowContent().SetViewModelActive(Windows.ClosingScreen); }
/// <summary> /// Opens the creation view window. /// </summary> public void GoToCreationWindow() { WindowContent.GetWindowContent().SetViewModelActive(Windows.PlayerCreation); }