// Use this for initialization void Start() { controller = GameObject.Find("GameController"); controllerScript = controller.GetComponent <ControllerScript>(); PropertyTycoon game = controllerScript.game; PropertySpace space = (PropertySpace)game.GetBoardSpace(spaceID); IProperty property = space.GetProperty(); this.GetComponent <UnityEngine.UI.Text>().text = property.GetPropertyName(); }
public void CreatePropertySpace() { Utility waters = new Utility("Edison Waters", 5); PropertySpace boardSpace = new PropertySpace(waters); // correct property stored Assert.AreEqual(waters, boardSpace.GetProperty()); // implements IBoardSpace interface Assert.IsTrue(boardSpace is IBoardSpace); }
private void SteppedOnPropertySpace(Player[] players, IList <Space> listOfSpaces, int currentPlayerCounter, Player player, Space currentSpace) { PropertySpace currentPropertySpace = (PropertySpace)currentSpace; if (currentPropertySpace.Owned == false) { FreeSpace(players, listOfSpaces, currentPlayerCounter, player, currentPropertySpace); } else if (currentPropertySpace.Owned == true && !player.ListOfProperties.Contains(listOfSpaces[player.Position])) { OtherPlayerOwn(players, listOfSpaces, player, currentPropertySpace); } }
int spaceID = 1; //change this and the script name I suppose... // Use this for initialization void Start() { controller = GameObject.Find("GameController"); controllerScript = controller.GetComponent <ControllerScript>(); // don't check what space the current player is on because they don't need to be on the space to view the property info // instead we will hard code the board space number to each script and copy and paste... PropertyTycoon game = controllerScript.game; PropertySpace space = ((PropertySpace)game.GetBoardSpace(spaceID)); IProperty property = space.GetProperty(); if (property.IsDevelopable()) { DevelopableLand devLand = (DevelopableLand)property; if (devLand.GetColourGroup() == Colour.Blue) { this.GetComponent <UnityEngine.UI.Image>().color = Color.cyan; } else if (devLand.GetColourGroup() == Colour.Brown) { this.GetComponent <UnityEngine.UI.Image>().color = new Color(165, 42, 42); } else if (devLand.GetColourGroup() == Colour.DeepBlue) { this.GetComponent <UnityEngine.UI.Image>().color = Color.blue; } else if (devLand.GetColourGroup() == Colour.Green) { this.GetComponent <UnityEngine.UI.Image>().color = Color.green; } else if (devLand.GetColourGroup() == Colour.Orange) { this.GetComponent <UnityEngine.UI.Image>().color = new Color(255, 165, 0); } else if (devLand.GetColourGroup() == Colour.Purple) { this.GetComponent <UnityEngine.UI.Image>().color = new Color(160, 32, 240); } else if (devLand.GetColourGroup() == Colour.Red) { this.GetComponent <UnityEngine.UI.Image>().color = Color.red; } else if (devLand.GetColourGroup() == Colour.Yellow) { this.GetComponent <UnityEngine.UI.Image>().color = Color.yellow; } } }
// Use this for initialization void Start() { GameObject controller = GameObject.Find("GameController"); ControllerScript controllerScript = controller.GetComponent <ControllerScript>(); PropertyTycoon game = controllerScript.game; space = game.GetBoardSpace(spaceID); Debug.Log(space.GetType()); // dynamic text based on type of board space // assumes you're using Text Mesh Pro UGUI component if (space.GetType() == typeof(GoSpace)) { GetComponent <TextMeshProUGUI>().text = spaceID + "\n\nGo!"; Debug.Log("Found a go space"); } else if (space.GetType() == typeof(JailSpace)) { GetComponent <TextMeshProUGUI>().text = "Just Visiting / Jail Space"; } else if (space.GetType() == typeof(FreeParkingSpace)) { GetComponent <TextMeshProUGUI>().text = "Free Parking"; } else if (space.GetType() == typeof(PropertySpace)) { // cast and get property object and display name PropertySpace propertySpace = (PropertySpace)space; IProperty property = propertySpace.GetProperty(); GetComponent <TextMeshProUGUI>().text = spaceID + "\n\n\n" + property.GetPropertyName(); } else if (space.GetType() == typeof(InstructionSpace)) { // cast and get instruction object and display description InstructionSpace instructionSpace = (InstructionSpace)space; string description = instructionSpace.GetDescription(); GetComponent <TextMeshProUGUI>().text = spaceID + "\n\n" + description; } }
public IActionResult Edit(ListingViewModel listingViewModel, int Id) { var minNights = 0; var maxNights = 0; if (listingViewModel.MinNights != null) { minNights = int.Parse(listingViewModel.MinNights.Split(' ')[0]); } else { minNights = 0; } if (listingViewModel.MaxNights != null) { maxNights = int.Parse(listingViewModel.MaxNights.Split(' ')[0]); } else { maxNights = 0; } var name = _db.Categories.FirstOrDefault(x => x.Name == listingViewModel.Categoryname); var id = name.Id; var guestPlaceType = _db.GuestPlaceTypes.FirstOrDefault(x => x.Name == listingViewModel.GuestPlaceTypeName); var PlaceTypeId = guestPlaceType.Id; var NewProperty = _db.Properties.FirstOrDefault(x => x.Id == Id); NewProperty.CategoryId = id; NewProperty.GuestPlaceTypeId = PlaceTypeId; NewProperty.NumberOfBedRooms = int.Parse(listingViewModel.NumOfBedrooms); NewProperty.NumberOfBeds = listingViewModel.NumOfBeds; NewProperty.Zipcode = listingViewModel.ZipCode; NewProperty.BuildingNo = listingViewModel.Apt_Suite; NewProperty.Street = listingViewModel.Street; NewProperty.Title = listingViewModel.Title; NewProperty.Description = listingViewModel.Description; NewProperty.NumberOfBathrooms = listingViewModel.NumberOfBathRooms; NewProperty.MinStay = minNights; NewProperty.MaxStay = maxNights; NewProperty.Price = listingViewModel.Price; NewProperty.Capacity = listingViewModel.NumOfGuests; NewProperty.CityId = listingViewModel.CityId; NewProperty.Coordinates = new NetTopologySuite.Geometries.Point(listingViewModel.Lon, listingViewModel.Lat) { SRID = 4326 }; NewProperty.UserId = _manager.GetUserId(User); _db.SaveChanges(); string UniqueFileName = null; if (listingViewModel.Images != null) { for (var i = 0; i < listingViewModel.Images.Count; i++) { string uploadsFolder = Path.Combine(_hostingEnvironment.WebRootPath, "Images"); UniqueFileName = Guid.NewGuid().ToString() + "_" + listingViewModel.Images[i].FileName; string FilePath = Path.Combine(uploadsFolder, UniqueFileName); listingViewModel.Images[i].CopyTo(new FileStream(FilePath, FileMode.Create)); PropertyPhoto photo = new PropertyPhoto(); photo.PropertyId = NewProperty.Id; photo.Url = UniqueFileName; //_db.Ed(photo); _db.SaveChanges(); } } //amenty if (listingViewModel.IsChecked != null) { foreach (var item in listingViewModel.IsChecked) { PropertyAmenity amenity = new PropertyAmenity(); amenity.AmenityId = item; amenity.PropertyId = NewProperty.Id; //_db.Add(amenity); _db.SaveChanges(); } } //SpacesCanGuestUse if (listingViewModel.IsSpacesChecked != null) { foreach (var item in listingViewModel.IsSpacesChecked) { PropertySpace propertySpace = new PropertySpace(); propertySpace.PropertyId = NewProperty.Id; propertySpace.SpaceId = item; //_db.Add(propertySpace); _db.SaveChanges(); } } //HouseRoles if (listingViewModel.IsHouseRoleChecked != null) { foreach (var item in listingViewModel.IsHouseRoleChecked) { PropertyHouseRule propertyHouseRule = new PropertyHouseRule(); propertyHouseRule.PropertyId = NewProperty.Id; propertyHouseRule.HouseRuleId = item; //_db.Add(propertyHouseRule); _db.SaveChanges(); } } return(RedirectToAction("Listing", "Hosting")); }
public void UpdatePropertySpace(PropertySpace propertySpace) { propertySpaceRepository.Update(propertySpace); SavePropertySpace(); }
public void CreatePropertySpace(PropertySpace propertySpace) { propertySpaceRepository.Add(propertySpace); SavePropertySpace(); }
//Form method that activates when a key is press. Used to perfrom key relate actions in the game, such //as rolling the dice, moving the camera, etc. private void GameForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Close(); } if (e.KeyCode == Keys.Up) { camera.move(0, -Camera.CAMERA_SPEED); } if (e.KeyCode == Keys.Down) { camera.move(0, Camera.CAMERA_SPEED); } if (e.KeyCode == Keys.Left) { camera.move(-Camera.CAMERA_SPEED, 0); } if (e.KeyCode == Keys.Right) { camera.move(Camera.CAMERA_SPEED, 0); } if (e.KeyCode == Keys.R) { if (!players[currentPlayer].IsPlayerBankrupt()) { MoveCurrentPlayer(); } clickedObject = null; this.Refresh(); if (CheckIfPlayerWon()) { MessageBox.Show("Player " + currentPlayer + " has won"); Close(); } } //Debug command if (e.KeyCode == Keys.U) { foreach (GameObject g in gameObjects) { if (g is PropertySpace p) { if (p.GetOwner() != null) { p.GetProperty().IncreaseNumOfHouses(); } } } } //Debug command if (e.KeyCode == Keys.L) { players[currentPlayer].RemoveMoney(100); } //Used to sell properties if (e.KeyCode == Keys.B && players[currentPlayer].GetSpaceOccupied() is PropertySpace) { Player player = players[currentPlayer]; PropertySpace property = (PropertySpace)player.GetSpaceOccupied(); if (property.GetProperty().GetOwner() == player) { using (SellProperty sellProperty = new SellProperty(property.GetProperty(), players, player)) { sellProperty.ShowDialog(); } } this.Refresh(); } this.Refresh(); }
//IF someone else OWNS THE SPACE - player has to PAY private void OtherPlayerOwn(Player[] players, IList <Space> listOfSpaces, Player player, PropertySpace currentPropertySpace) { for (int i = 0; i < players.Length; i++) { var otherPlayer = players[i]; if (otherPlayer.ListOfProperties.Contains(listOfSpaces[player.Position])) { if (currentPropertySpace.NumberOfhouses == 0 && currentPropertySpace.Hotel == 0) { PayingMoney(player, (int)currentPropertySpace.Rent, otherPlayer); } else if (currentPropertySpace.NumberOfhouses == 1 && currentPropertySpace.Hotel == 0) { PayingMoney(player, (int)currentPropertySpace.RentWithOneHouse, otherPlayer); } else if (currentPropertySpace.NumberOfhouses == 2 && currentPropertySpace.Hotel == 0) { PayingMoney(player, (int)currentPropertySpace.RentWithTwoHouses, otherPlayer); } else if (currentPropertySpace.NumberOfhouses == 3 && currentPropertySpace.Hotel == 0) { PayingMoney(player, (int)currentPropertySpace.RentWithThreeHouses, otherPlayer); } else if (currentPropertySpace.NumberOfhouses == 4 && currentPropertySpace.Hotel == 0) { PayingMoney(player, (int)currentPropertySpace.RentWithFourHouses, otherPlayer); } else if (currentPropertySpace.NumberOfhouses == 0 && currentPropertySpace.Hotel == 1) { PayingMoney(player, (int)currentPropertySpace.RentWithHotel, otherPlayer); } } } }