/// <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); }