public void GenerateInternals(RoomTypes roomType) { switch ((int)roomType) { case (int)RoomTypes.Left: spawnSpecItem(0, LeftRoomLimits[(int)RoomLimits.Min_X], LeftRoomLimits[(int)RoomLimits.Max_X], LeftRoomLimits[(int)RoomLimits.Min_Y], LeftRoomLimits[(int)RoomLimits.Max_Y]); spawnFurniture(LeftBaseRoomPiece, LeftRoomLimits[(int)RoomLimits.Min_X], LeftRoomLimits[(int)RoomLimits.Max_X], LeftRoomLimits[(int)RoomLimits.Min_Y], LeftRoomLimits[(int)RoomLimits.Max_Y], roomType); break; case (int)RoomTypes.Right: spawnSpecItem(1, RightRoomLimits[(int)RoomLimits.Min_X], RightRoomLimits[(int)RoomLimits.Max_X], RightRoomLimits[(int)RoomLimits.Min_Y], RightRoomLimits[(int)RoomLimits.Max_Y]); spawnFurniture(RightBaseRoomPiece, RightRoomLimits[(int)RoomLimits.Min_X], RightRoomLimits[(int)RoomLimits.Max_X], RightRoomLimits[(int)RoomLimits.Min_Y], RightRoomLimits[(int)RoomLimits.Max_Y], roomType); break; case (int)RoomTypes.Bottom: spawnSpecItem(2, BottomRoomLimits[(int)RoomLimits.Min_X], BottomRoomLimits[(int)RoomLimits.Max_X], BottomRoomLimits[(int)RoomLimits.Min_Y], BottomRoomLimits[(int)RoomLimits.Max_Y]); spawnFurniture(BottomBaseRoomPiece, BottomRoomLimits[(int)RoomLimits.Min_X], BottomRoomLimits[(int)RoomLimits.Max_X], BottomRoomLimits[(int)RoomLimits.Min_Y], BottomRoomLimits[(int)RoomLimits.Max_Y], roomType); break; case (int)RoomTypes.Center: spawnSpecItem(3, CenterRoomLimits[(int)RoomLimits.Min_X], CenterRoomLimits[(int)RoomLimits.Max_X], CenterRoomLimits[(int)RoomLimits.Min_Y], CenterRoomLimits[(int)RoomLimits.Max_Y]); spawnFurniture(MainBaseRoomPiece, CenterRoomLimits[(int)RoomLimits.Min_X], CenterRoomLimits[(int)RoomLimits.Max_X], CenterRoomLimits[(int)RoomLimits.Min_Y], CenterRoomLimits[(int)RoomLimits.Max_Y], roomType); break; } }
public RoomType(string roomName, RoomTypes type) { this.Tilemap = new Tilemap(); this.Tilemap.LoadMap(@"Content/rooms/" + roomName + ".tmx", 32, 32); this.Sides = new Sides(); this.Type = type; this.CheckSides(); }
private void BindRoomTypes() { DataTable table = new RoomTypes().SelectAll(); drpRoomTypes.DataSource = table; drpRoomTypes.DataTextField = table.Columns["RoomType_EN"].ToString(); drpRoomTypes.DataValueField = table.Columns["RoomType_ID"].ToString(); drpRoomTypes.DataBind(); drpRoomTypes.Items.Insert(0, new ListItem("Select a Room Type...", "-1")); }
public void EditRoomType(int id, string typeName) { RoomTypes roomType = _context.RoomTypes.Find(id); if (roomType != null) { roomType.TypeName = typeName; _context.SaveChanges(); } }
public void AddRoomType(string typeName) { RoomTypes roomType = new RoomTypes() { TypeName = typeName }; _context.RoomTypes.Add(roomType); _context.SaveChanges(); }
// // GET: /RoomType/Details/5 public ActionResult Details(long id = 0) { RoomTypes roomtypes = db.RoomTypes.Find(id); if (roomtypes == null) { return(HttpNotFound()); } return(View(roomtypes)); }
public static void Initializate(Examen3CollectionContext context) { context.Database.EnsureCreated(); // crea bd si no existe if (context.PaymentMethods.Any()) { return; // la bd ya tiene datos } // arreglo del tipo FilmGeneres var PaymentMethods = new PaymentMethods[] { new PaymentMethods { PaymentMethod = "Efectivo" }, new PaymentMethods { PaymentMethod = "Debito" }, new PaymentMethods { PaymentMethod = "Credito" }, }; // pasar el arreglo a la tabla de FilmGeneres en el modelo foreach (PaymentMethods g in PaymentMethods) { context.PaymentMethods.Add(g); } //grabar los datos en la bd fisica context.SaveChanges(); // FilmCertificates var RoomTypes = new RoomTypes[] { new RoomTypes { RoomType = "Para 2" }, new RoomTypes { RoomType = "Para 3" }, new RoomTypes { RoomType = "Para 4" }, new RoomTypes { RoomType = "Swit" }, new RoomTypes { RoomType = "Lujo" }, }; foreach (RoomTypes f in RoomTypes) { context.RoomTypes.Add(f); } context.SaveChanges(); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { RoomTypes ds = new RoomTypes(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
// Обновляем списко доступных комнат public void updateDataGridRooms() { db = new ApplicationContext(); roomTypesList = RoomTypes.init_RoomTypes(db); roomsList = Entity.Rooms.init_Rooms(db); DataGrid_rooms.ItemsSource = roomsList; findRoomsByFilter(); }
public ActionResult Edit([Bind(Include = "Id,SchoolsId,Name")] RoomTypes roomTypes) { if (ModelState.IsValid) { db.Entry(roomTypes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SchoolsId = new SelectList(db.Schools, "Id", "AspNetUsersId", roomTypes.SchoolsId); return(View(roomTypes)); }
public async Task <IActionResult> Create([Bind("ActorID,ActorFullName,ActorNotes")] RoomTypes roomsTypes) { if (ModelState.IsValid) { _context.Add(roomsTypes); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(roomsTypes)); }
public InternalSlimRateDetails(int roomId, int accommodationId, MoneyAmount totalAmount, double discount, BoardBasisTypes boardBasis, List <InternalSlimCancellationPolicies> cancellationPolicies, RoomTypes roomType, RoomOccupationRequest occupationRequest) { RoomId = roomId; AccommodationId = accommodationId; TotalAmount = totalAmount; Discount = discount; BoardBasis = boardBasis; CancellationPolicies = cancellationPolicies; RoomType = roomType; OccupationRequest = occupationRequest; }
/// <summary> /// Creates a room in the photon network with the given roomtype (private/public). /// Also generates a room specific token that is used by other players to join your room. /// </summary> public void CreateRoom(RoomTypes roomType) { RoomOptions roomOptions = new RoomOptions(); roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable(); roomOptions.CustomRoomProperties.Add(RoomProperties.TOKEN, GenerateRoomToken()); roomOptions.CustomRoomProperties.Add(RoomProperties.ROOM_TYTPE, (int)roomType); roomOptions.CustomRoomPropertiesForLobby = new string[] { RoomProperties.TOKEN, RoomProperties.ROOM_TYTPE }; roomOptions.MaxPlayers = 4; PhotonNetwork.CreateRoom("", roomOptions, TypedLobby.Default); }
private void UpdateRoomPrivacy(bool isPrivate) { if (isPrivate) { m_RoomType = RoomTypes.Private; } else { m_RoomType = RoomTypes.Public; } }
public RoomListConfig(RoomTypes roomType, long blind, long minCoins, long maxCoins, int tipsPersent, long minCarry, long maxCarry) { Blind = blind; MinCoins = minCoins; MaxCoins = maxCoins; TipsPersent = tipsPersent; MinCarry = minCarry; MaxCarry = maxCarry; RoomType = roomType; }
public bool CanBuild(RoomTypes type, Vector2Int position) { var room = Rooms[position]; if (room != null && room.Type == RoomTypes.BuildingSpot) { return(true); } return(false); }
// // GET: /RoomType/Edit/5 public ActionResult Edit(long id = 0) { RoomTypes roomtypes = db.RoomTypes.Find(id); if (roomtypes == null) { return(HttpNotFound()); } ViewBag.HotelID = new SelectList(db.Hotels, "HotelID", "HotelName", roomtypes.HotelID); return(View(roomtypes)); }
public ActionResult Edit(RoomTypes roomtypes) { if (ModelState.IsValid) { db.Entry(roomtypes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.HotelID = new SelectList(db.Hotels, "HotelID", "HotelName", roomtypes.HotelID); return(View(roomtypes)); }
public Rate(int id, int roomId, int seasonId, decimal price, Currencies currency, BoardBasisTypes boardBasisType, string mealPlan, RoomTypes roomType, MultiLanguage <string> description) { Id = id; RoomId = roomId; SeasonId = seasonId; Price = price; Currency = currency; BoardBasisType = boardBasisType; MealPlan = mealPlan; RoomType = roomType; Description = description; }
public static RoomTypesViewModel Map(RoomTypes roomTypes, IEnumerable <RoomType> dbRoomTypes) { var result = new RoomTypesViewModel(); if (roomTypes == null) { return(result); } if (roomTypes.RoomTypeDescriptions != null && roomTypes.RoomTypeDescriptions.Any()) { result.RoomTypes = roomTypes.RoomTypeDescriptions.Select(c => new RoomTypeViewModel { Description = c.Description, PeopleNum = c.PeopleNum, LowerBound = c.LowerBound, MarketBasePrice = c.MarketBasePrice, Number = c.Number, OperationalCost = c.OperationalCost, Quantity = c.Quantity, UpperBound = c.UpperBound }).ToList(); } var dict = dbRoomTypes.ToDictionary(c => c.Id, c => c.RoomTypeCode); if (roomTypes.RoomTypeCoefs != null && roomTypes.RoomTypeCoefs.Any()) { result.RoomTypeCoefs.AddRange(roomTypes.RoomTypeCoefs.Where(c => dbRoomTypes.Any(s => s.Id == c.Number)).Select(c => new RoomTypeCoefViewModel { RoomTypeCode = dict[c.Number], Coef = c.Coef, PeopleNum = c.PeopleNum }).ToList()); } if (roomTypes.ChildRooms != null && roomTypes.ChildRooms.Any()) { result.ChildRoomTypes = roomTypes.ChildRooms.Where(c => dbRoomTypes.Any(s => s.Id == c.Child) && dbRoomTypes.Any(s => s.Id == c.Parent)).Select(c => new ChildRoomTypeViewModel { Child = dict[c.Child], Quantity = c.Quantity, Parent = dict[c.Parent] }).ToList(); } if (roomTypes.PriceConstraints != null && roomTypes.PriceConstraints.Any()) { result.PriceConstraints = roomTypes.PriceConstraints.Where(c => dbRoomTypes.Any(s => s.Id == c.Less) && dbRoomTypes.Any(s => s.Id == c.More)).Select(c => new PriceConstraint { Less = dict[c.Less], More = dict[c.More] }).ToList(); } foreach (var roomtype in dbRoomTypes) { var index = result.RoomTypes.FindIndex(c => c.Number == roomtype.Id); if (index >= 0) { result.RoomTypes[index].Name = roomtype.Name; result.RoomTypes[index].RoomTypeCode = roomtype.RoomTypeCode; } else { result.RoomTypes.Add(new RoomTypeViewModel { Number = roomtype.Id, Name = roomtype.Name, RoomTypeCode = roomtype.RoomTypeCode }); } } return(result); }
public void AddToOpenings(RoomTypes type, GameObject room) { if (!openings.ContainsKey(type)) { openings.Add(type, new List <GameObject>()); openings[type].Add(room); } else { openings[type].Add(room); } }
private void Start() { dungeon = GenerateDungeon(Random.Range(0, 1000)); //initialize the dungeon //spawn prefabs for each room for (int i = 0; i < dungeonWidth; i++) { for (int j = 0; j < dungeonHeight; j++) { RoomTypes room = dungeon[i, j]; GameObject roomToSpawn; switch (room) //choose the room to spawn here { case RoomTypes.Solid: roomToSpawn = solidRoom; break; case RoomTypes.FourWay: roomToSpawn = fourWayRooms[Random.Range(0, fourWayRooms.Length)]; break; case RoomTypes.Horizontal: roomToSpawn = horizontalRooms[Random.Range(0, horizontalRooms.Length)]; break; case RoomTypes.Vertical: roomToSpawn = verticalRooms[Random.Range(0, verticalRooms.Length)]; break; case RoomTypes.Shop: roomToSpawn = shops[Random.Range(0, shops.Length)]; break; case RoomTypes.Bonus: roomToSpawn = bonusRooms[Random.Range(0, bonusRooms.Length)]; break; case RoomTypes.Start: roomToSpawn = startRoom; player.transform.position = new Vector3(i * roomWidth + 5.5f, 1f, j * roomHeight + 5.5f); player.GetComponent <PlayerMovement>().movePoint.transform.position = player.transform.position; break; default: roomToSpawn = solidRoom; break; } Instantiate(roomToSpawn, new Vector3(i * roomWidth, 0, j * roomHeight), Quaternion.identity); } } }
public RateDetails(RoomOccupationRequest occupationRequest, Room room, RoomTypes roomType, PaymentDetails paymentDetails, List <CancellationPolicyDetails> cancellationPolicies, string mealPlan, BoardBasisTypes boardBasis, List <TaxDetails> taxes, string description) { Room = room; RoomType = roomType; PaymentDetails = paymentDetails; MealPlan = mealPlan; BoardBasis = boardBasis; CancellationPolicies = cancellationPolicies; Taxes = taxes ?? new List <TaxDetails>(); Description = description; OccupationRequest = occupationRequest; }
//POST Edit public async Task <IActionResult> Edit(int id, RoomTypes roomTypes) { if (id != roomTypes.ID) { return(NotFound()); } if (ModelState.IsValid) { roomTypesRep.Update(roomTypes); return(RedirectToAction(nameof(Index))); } return(View(roomTypes)); }
public Room(Levels level, int id, RoomTypes type, Items item, int upRoomIndex, int straightRoomIndex, int downRoomIndex) { Level = level; Id = id; RoomType = type; Item = item; IsItemCollected = false; RoomUpIndex = upRoomIndex; RoomStraightIndex = straightRoomIndex; RoomDownIndex = downRoomIndex; _enemies = new List<IEnemy>(); }
public BookedRoom(RoomTypes type, MoneyAmount price, BoardBasisTypes boardBasis, string mealPlan, string contractDescription, List <KeyValuePair <string, string> > remarks, Deadline deadline, List <Passenger> passengers) { Type = type; Passengers = passengers; Price = price; BoardBasis = boardBasis; MealPlan = mealPlan; ContractDescription = contractDescription; Remarks = remarks; Deadline = deadline; Passengers = passengers; }
public static void ModifyRoom(ref RoomTypes __instance) { if (Settings.Instance.Agricultural.IncludeRoom) { for (int i = 0; i < __instance.CreaturePen.additional_constraints.Length; i++) { if (__instance.CreaturePen.additional_constraints[i].name.Contains("Maximum size:")) { __instance.CreaturePen.additional_constraints[i] = RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Agricultural.MaxSize); } } } }
public Room(Levels level, int id, RoomTypes type, Items item, int upRoomIndex, int straightRoomIndex, int downRoomIndex) { Level = level; Id = id; RoomType = type; Item = item; IsItemCollected = false; RoomUpIndex = upRoomIndex; RoomStraightIndex = straightRoomIndex; RoomDownIndex = downRoomIndex; _enemies = new List <IEnemy>(); }
public BuildRoomPlan(PlayerManager player, RoomTypes type, Vector2Int pos) { this.Player = player; this.PlanType = PlanTypes.CreateUnit; this.TargetType = type; this.TargetPosition = pos; this.Config = GameplayHolderManager.Instance.Configs.BuildingConfigs.Find((x) => x.Type == type); this.Delay = 2; }
public void GivenRoomCreated_WhenLessThanZeroUnits_ThenInvalidOperationException() { //Given var rooms = new RoomTypes(); //When object[] events = null; TestDelegate when = () => events = rooms.Create(Guid.NewGuid(), Guid.NewGuid(), "Single", -1).ToArray(); //Then var ex = Assert.Throws <InvalidOperationException>(when); Assert.That(events, Is.Null); Assert.That(ex.Message, Is.EqualTo("Must have zero or more rooms in inventory.")); }
// GET: RoomTypes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RoomTypes roomTypes = db.RoomTypes.Find(id); if (roomTypes == null) { return(HttpNotFound()); } return(View(roomTypes)); }
public void RefillEverything() { CurrentRoomType = RoomTypes.Find(i => i.TypeId == completeCheckIn.RoomType.TypeId); Roominess = AvailableRoominess.Find(i => i.Number == completeCheckIn.Roominess); StartDate = completeCheckIn.CheckIn.StartDate; EndDate = completeCheckIn.CheckIn.EndDate; GetFreeRooms(); CurrentRoom = FreeRooms.Find(i => i.RoomId == completeCheckIn.CheckIn.RoomId); Services = dbCrud.GetAllServices().Select(i => new ServiceData(i)).ToList(); foreach (ServiceData service in completeCheckIn.Services) { Services.Find(i => i.ServiceId == service.ServiceId).NumberOfProvision = service.NumberOfProvision; } }
public string GetRoomType(int person_id) { try { return(RoomTypes.GetAll().Join( Agreements.GetAll(), r => r.id_type, a => a.room_id, (r, a) => new KeyValuePair <RoomType, Agreement>(r, a)) .Where(res => res.Value.person_id == person_id) .Select(res => res.Key.name).ToList().Last()); } catch { return("..."); } }
public static RoomTypes ModelToEnity(this RoomTypesModel model, bool virtualActive = false) { RoomTypes entity = new RoomTypes() { Amount=model.Amount, Name=model.Name, Quota=model.Quota, Id = model.Id, IsActive = model.IsActive }; if (virtualActive) { entity.RoomFeaturesRoomTypes = model.RoomFeaturesRoomTypes; entity.Rooms = model.Rooms; } return entity; }
public static RoomType Get(RoomTypes type) { switch (type){ case RoomTypes.Single: return new RoomType("Single", 30, new[]{ RoomFeature.Get(RoomFeatures.Internet), RoomFeature.Get(RoomFeatures.Minibar) }); case RoomTypes.Double: return new RoomType("Double", 40, new[]{ RoomFeature.Get(RoomFeatures.Minibar), RoomFeature.Get(RoomFeatures.TV) }); case RoomTypes.Family: return new RoomType("Family", 50, new[]{ RoomFeature.Get(RoomFeatures.Internet), RoomFeature.Get(RoomFeatures.TV) }); default: return Get(RoomTypes.Single); } }
public int NumberOfRooms(RoomTypes roomType) { return Rooms.Where(a => a.Type == roomType).Count(); }
private void spawnFurniture(GameObject roomObject, float min_x, float max_x, float min_y, float max_y, RoomTypes roomType) { Vector2 newPos = Vector2.zero; int numberOfFurniture = 15; switch((int)roomType) { case (int)RoomTypes.Center: numberOfFurniture = numberOfFurnitureForCenter; break; case (int)RoomTypes.Left: numberOfFurniture = numberOfFurnitureForLeft; break; case (int)RoomTypes.Right: numberOfFurniture = numberOfFurnitureForRight; break; case (int)RoomTypes.Bottom: numberOfFurniture = numberOfFurnitureForBottom; break; } for (int i = 0; i < numberOfFurniture; i++) { GameObject FurnitureToSpawn = furnitureOptions[Random.Range(0, furnitureOptions.Length)]; newPos = getFurniturePos(min_x, max_x, min_y, max_y); switch ((int)roomType) { case (int)RoomTypes.Left: FurnitureToSpawn = bedroomFurnitureOptions[Random.Range(0, bedroomFurnitureOptions.Length)]; break; case (int)RoomTypes.Right: FurnitureToSpawn = kitchenFurnitureOptions[Random.Range(0, kitchenFurnitureOptions.Length)]; break; case (int)RoomTypes.Bottom: FurnitureToSpawn = bathroomFurnitureOptions[Random.Range(0, bathroomFurnitureOptions.Length)]; break; } GameObject newFurniture = (GameObject)Instantiate(FurnitureToSpawn, newPos, Quaternion.identity); switch ((int)roomType) { case (int)RoomTypes.Left: leftFurniture.Add(newFurniture); break; case (int)RoomTypes.Right: rightFurniture.Add(newFurniture); break; case (int)RoomTypes.Bottom: bottomFurniture.Add(newFurniture); break; } #region if (newFurniture.tag == "Furniture") { newFurniture.GetComponent<SpriteRenderer>().sortingOrder = (int)(-newFurniture.transform.localPosition.y); if (_SpriteSorter != null) { switch ((int)roomType) { case (int)RoomTypes.Left: _SpriteSorter.LeftRoom_SpriteRendererList.Add(newFurniture.GetComponent<SpriteRenderer>()); break; case (int)RoomTypes.Right: _SpriteSorter.RightRoom_SpriteRendererList.Add(newFurniture.GetComponent<SpriteRenderer>()); break; case (int)RoomTypes.Bottom: _SpriteSorter.BottomRoom_SpriteRendererList.Add(newFurniture.GetComponent<SpriteRenderer>()); break; case (int)RoomTypes.Center: _SpriteSorter.CenterRoom_SpriteRendererList.Add(newFurniture.GetComponent<SpriteRenderer>()); break; } } } else if (IsRugsEnabledInCenterRoom || roomType != RoomTypes.Center) { newFurniture.GetComponent<SpriteRenderer>().sortingOrder = -20; } else { foreach(Transform child in newFurniture.transform) { child.GetComponent<SpriteRenderer>().sortingOrder = (int)(-child.transform.localPosition.y); if (_SpriteSorter != null) { switch ((int)roomType) { case (int)RoomTypes.Left: _SpriteSorter.LeftRoom_SpriteRendererList.Add(child.GetComponent<SpriteRenderer>()); break; case (int)RoomTypes.Right: _SpriteSorter.RightRoom_SpriteRendererList.Add(child.GetComponent<SpriteRenderer>()); break; case (int)RoomTypes.Bottom: _SpriteSorter.BottomRoom_SpriteRendererList.Add(child.GetComponent<SpriteRenderer>()); break; case (int)RoomTypes.Center: _SpriteSorter.CenterRoom_SpriteRendererList.Add(child.GetComponent<SpriteRenderer>()); break; } } } } #endregion //currentFurniture.Add(newFurniture); newFurniture.transform.SetParent(roomObject.transform); } }
/// <summary> /// Calculate a Room, Check if its free, /// </summary> /// <param name="x"> start X position</param> /// <param name="y"> start Y position</param> /// <param name="dir"> direction of the room</param> /// <param name="hight">hight of the Room</param> /// <param name="with">with of the Room</param> /// <param name="aktualArrayUsage">Fields in field</param> /// <param name="maxArrayUsage">Max Fields in field</param> /// <param name="type">Type of the Room</param> /// <returns>A List withe Fields for the Room, empty if imposible</returns> private List<Field> createRoom(int x, int y, int dir, int hight, int with, int aktualArrayUsage, int maxArrayUsage, RoomTypes type) { return createRoom(x, y, dir, hight, with, aktualArrayUsage, maxArrayUsage, type, new RoomFlags[] { RoomFlags.None }); }
/// <summary> /// Calculate a Room, Check if its free, /// </summary> /// <param name="x"> start X position</param> /// <param name="y"> start Y position</param> /// <param name="dir"> direction of the room</param> /// <param name="hight">hight of the Room</param> /// <param name="with">with of the Room</param> /// <param name="aktualArrayUsage">Fields in field</param> /// <param name="maxArrayUsage">Max Fields in field</param> /// <param name="type">Type of the Room</param> /// <param name="flags">Extraflaggs of the room</param> /// <returns>A List withe Fields for the Room, empty if imposible</returns> private List<Field> createRoom(int x, int y, int dir, int hight, int with, int aktualArrayUsage, int maxArrayUsage, RoomTypes type, RoomFlags[] flags) { List<Field> value = new List<Field>(); if (maxArrayUsage - aktualArrayUsage < hight * with) return value; if (hight <= 2 || with <= 2) return value; #region example /* * New Room; * UL UR * h|FFFFFFFFF * i|FFFFFFFFF * g|FFFFFFFFF * h|FFFFFFFFF * t|FFFFFFFFF * X--------Y * DL DR * with */ /* * Dir 3 * x y x y x y * -1 -1 UpLeft +0 -1 Up +1 -1 UpRight * Dir 2 -1 +0 Left +0 +0 Center +1 +0 Right Dir 4 * -1 +1 DownLeft +0 +1 Down +1 +1 DownRight * Dir 1 */ #endregion Point UpRight, DownRight, UpLelft, DownLeft; Point Center; #region Set Basics #region All = 0 UpLelft = new Point(x, y); UpRight = new Point(x, y); DownRight = new Point(x, y); DownLeft = new Point(x, y); #endregion switch (dir) { case 1: DownLeft = new Point(x - (with / 2), y); DownRight = new Point(DownLeft.X + with, DownLeft.Y); UpLelft = new Point(DownLeft.X, DownLeft.Y - hight); UpRight = new Point(DownLeft.X + with, DownLeft.Y - hight); break; case 2: DownLeft = new Point(x, y - (with / 2)); DownRight = new Point(DownLeft.X + hight, DownLeft.Y); UpLelft = new Point(DownLeft.X, DownLeft.Y - with); UpRight = new Point(DownLeft.X + with, DownLeft.Y - with); break; case 3: DownLeft = new Point(x - (with / 2), y + hight); DownRight = new Point(DownLeft.X + with, DownLeft.Y); UpLelft = new Point(DownLeft.X, DownLeft.Y - hight); UpRight = new Point(DownLeft.X + with, DownLeft.Y - hight); break; case 4: DownLeft = new Point(x - hight, y + (with / 2)); DownRight = new Point(DownLeft.X + hight, DownLeft.Y); UpLelft = new Point(DownLeft.X, DownLeft.Y - with); UpRight = new Point(DownLeft.X + with, DownLeft.Y - with); break; default: DownLeft = new Point(x - (with / 2), y); DownRight = new Point(DownLeft.X + with, DownLeft.Y); UpLelft = new Point(DownLeft.X, DownLeft.Y - hight); UpRight = new Point(DownLeft.X + with, DownLeft.Y - hight); break; } int XMax = DownRight.X - DownLeft.X; int YMax = DownLeft.Y - UpLelft.Y; #region Check Region if (surroundingPathDedect(UpRight.X, UpRight.Y) >= 10) return value; if (surroundingPathDedect(DownRight.X, DownRight.Y) >= 10) return value; if (surroundingPathDedect(UpLelft.X, UpLelft.Y) >= 10) return value; if (surroundingPathDedect(DownLeft.X, DownLeft.Y) >= 10) return value; #endregion #endregion #region Set Fields & Center Point for (int X = 0; X < XMax; ++X) { for (int Y = 0; Y < YMax; ++Y) { value.Add(new Field(UpLelft.X + X, UpLelft.Y + Y)); } } int centerPos = (value.Count / 2) - ((value.Count + 1) % 2); Center = new Point(value[centerPos].X, value[centerPos].Y); #endregion #region Check Space for Room foreach (Field f in value) { if (surrounding(f.X, f.Y) >= 10) { value.Clear(); return value; } } #endregion #region RoomTypes switch (type) { case RoomTypes.SaveRoom: break; case RoomTypes.NormalRoom: break; case RoomTypes.MSpawnerRoom: break; case RoomTypes.BossRoom: break; } #endregion #region Room Flags foreach (RoomFlags rf in flags) { switch (rf) { case RoomFlags.ConectingEdges: #region ConnectiongEdges value.Add(new Field(UpLelft.X - 1, UpLelft.Y)); value.Add(new Field(UpLelft.X, UpLelft.Y - 1)); value.Add(new Field(DownRight.X - 1, DownRight.Y)); value.Add(new Field(DownRight.X, DownRight.Y + 1)); value.Add(new Field(UpRight.X + 1, UpRight.Y)); value.Add(new Field(UpRight.X, UpRight.Y - 1)); value.Add(new Field(DownLeft.X + 1, DownLeft.Y)); value.Add(new Field(DownLeft.X, DownLeft.Y + 1)); break; #endregion case RoomFlags.CrossRoadsBig: #region CrossRoadsBig for (int i = 0; i < 4; ++i) //dir 3 { Field temp = new Field(Center.X, Center.Y - i - (with / 2)); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } for (int i = 0; i < 4; ++i) //dir 4 { Field temp = new Field(Center.X + i + (hight / 2), Center.Y); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } for (int i = 0; i < 4; ++i) //dir 1 { Field temp = new Field(Center.X, Center.Y + i + (with / 2)); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } for (int i = 0; i < 4; ++i) //dir 2 { Field temp = new Field(Center.X - i - (hight / 2), Center.Y); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } break; #endregion case RoomFlags.CrossRoadsSmall: #region CrossRoadsSmall for (int i = 0; i < 2; ++i) //dir 3 { Field temp = new Field(Center.X, Center.Y - i - (with / 2)); if(surrounding(temp.X,temp.Y) < 10) value.Add(temp); else break; } for (int i = 0; i < 2; ++i) //dir 4 { Field temp = new Field(Center.X + i + (hight / 2), Center.Y); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } for (int i = 0; i < 2; ++i) //dir 1 { Field temp = new Field(Center.X, Center.Y + i + (with / 2)); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } for (int i = 0; i < 2; ++i) //dir 2 { Field temp = new Field(Center.X - i - (hight / 2), Center.Y); if (surrounding(temp.X, temp.Y) < 10) value.Add(temp); else break; } break; #endregion case RoomFlags.HasCoins: #region HasCoins break; #endregion case RoomFlags.HasEnergy: #region HasEnergy break; #endregion case RoomFlags.HasHelper: #region HasHelper break; #endregion case RoomFlags.HasMSpawner: #region HasMSpawner break; #endregion case RoomFlags.Traped: #region Traped break; #endregion } } #endregion return value; }
private void calculateRoomLimits(RoomTypes roomType) { Vector2 roomSize = Vector2.zero; Vector2 roomCenterPoint = Vector2.zero; switch (roomType) { case RoomTypes.Center: CenterRoomLimits = new float[(int)RoomLimits.Total]; roomSize = MainBaseRoomPiece.GetComponent<SpriteRenderer>().sprite.bounds.size; roomCenterPoint = MainBaseRoomPiece.transform.position; CenterRoomLimits[(int)RoomLimits.Min_X] = roomCenterPoint.x - (roomSize.x - 2); CenterRoomLimits[(int)RoomLimits.Max_X] = roomCenterPoint.x + (roomSize.x - 2); CenterRoomLimits[(int)RoomLimits.Min_Y] = roomCenterPoint.y - (roomSize.y - 2); CenterRoomLimits[(int)RoomLimits.Max_Y] = roomCenterPoint.y + (roomSize.y - 6); break; case RoomTypes.Left: LeftRoomLimits = new float[(int)RoomLimits.Total]; roomSize = LeftBaseRoomPiece.GetComponent<SpriteRenderer>().sprite.bounds.size; roomCenterPoint = LeftBaseRoomPiece.transform.position; LeftRoomLimits[(int)RoomLimits.Min_X] = roomCenterPoint.x - (roomSize.x - 5); LeftRoomLimits[(int)RoomLimits.Max_X] = roomCenterPoint.x + (roomSize.x - 5); LeftRoomLimits[(int)RoomLimits.Min_Y] = roomCenterPoint.y - (roomSize.y - 5); LeftRoomLimits[(int)RoomLimits.Max_Y] = roomCenterPoint.y + (roomSize.y - 7); break; case RoomTypes.Right: RightRoomLimits = new float[(int)RoomLimits.Total]; roomSize = RightBaseRoomPiece.GetComponent<SpriteRenderer>().sprite.bounds.size; roomCenterPoint = RightBaseRoomPiece.transform.position; RightRoomLimits[(int)RoomLimits.Min_X] = roomCenterPoint.x - (roomSize.x - 5); RightRoomLimits[(int)RoomLimits.Max_X] = roomCenterPoint.x + (roomSize.x - 5); RightRoomLimits[(int)RoomLimits.Min_Y] = roomCenterPoint.y - (roomSize.y - 4); RightRoomLimits[(int)RoomLimits.Max_Y] = roomCenterPoint.y + (roomSize.y - 9); break; case RoomTypes.Bottom: BottomRoomLimits = new float[(int)RoomLimits.Total]; roomSize = BottomBaseRoomPiece.GetComponent<SpriteRenderer>().sprite.bounds.size; roomCenterPoint = BottomBaseRoomPiece.transform.position; BottomRoomLimits[(int)RoomLimits.Min_X] = roomCenterPoint.x - (roomSize.x - 8); BottomRoomLimits[(int)RoomLimits.Max_X] = roomCenterPoint.x + (roomSize.x - 8); BottomRoomLimits[(int)RoomLimits.Min_Y] = roomCenterPoint.y - (roomSize.y - 8); BottomRoomLimits[(int)RoomLimits.Max_Y] = roomCenterPoint.y + (roomSize.y - 8); break; } }
void Start() { //Rooms all start off as void rooms and are changed later when //they are given their purpose during generation of the dungeon layout RoomType = RoomTypes.VoidRoom; }
public static IMapList GetTree( Guid selectedId, UrlProvider roomUrlProvider, UrlProvider mapUrlProvider, UrlProvider buildingUrlProvider, UrlProvider campusUrlProvider, UrlProvider equipmentUrlProvider, UrlProvider roomTypesUrlProvider) { var parentIds = new Stack<Guid>(); FindParentIds(parentIds, selectedId); var tuples = parentIds .Select(id => Data.GetChildren(id)); var levels = new Dictionary<Level, IEnumerable<Tuple<Guid, string, bool>>>(); var currentLevel = Level.Campus; foreach (var tuplesForLevel in tuples) { levels.Add(currentLevel, tuplesForLevel); currentLevel += 1; } var emptyTuples = new Tuple<Guid, string, bool>[0]; var roomTuples = levels.ContainsKey(Level.Room) ? levels[Level.Room] : emptyTuples; var mapTuples = levels.ContainsKey(Level.Map) ? levels[Level.Map] : emptyTuples; var buildingTuples = levels.ContainsKey(Level.Building) ? levels[Level.Building] : emptyTuples; var campusTuples = levels.ContainsKey(Level.Campus) ? levels[Level.Campus] : emptyTuples; var rooms = roomTuples .Select(i => new Room(i.Item1, i.Item2, roomUrlProvider.GetDetailsUrl(i.Item1))) .ToArray(); var maps = mapTuples .Select(i => parentIds.Contains(i.Item1) ? new Map(i.Item1, i.Item2, mapUrlProvider.GetDetailsUrl(i.Item1), rooms) : new Map(i.Item1, i.Item2, mapUrlProvider.GetDetailsUrl(i.Item1), i.Item3, mapUrlProvider.GetChildrenUrl(i.Item1))) .ToArray(); var buildings = buildingTuples .Select(i => parentIds.Contains(i.Item1) ? new Building(i.Item1, i.Item2, buildingUrlProvider.GetDetailsUrl(i.Item1), maps) : new Building(i.Item1, i.Item2, buildingUrlProvider.GetDetailsUrl(i.Item1), i.Item3, buildingUrlProvider.GetChildrenUrl(i.Item1))) .ToArray(); var campuses = campusTuples .Select(i => parentIds.Contains(i.Item1) ? new Campus(i.Item1, i.Item2, campusUrlProvider.GetDetailsUrl(i.Item1), buildings) : new Campus(i.Item1, i.Item2, campusUrlProvider.GetDetailsUrl(i.Item1), i.Item3, campusUrlProvider.GetChildrenUrl(i.Item1))) .Cast<ITreeItem>() .ToArray(); var equipment = new Equipment(equipmentUrlProvider.GetDetailsUrl(Guid.Empty)); var roomTypes = new RoomTypes(roomTypesUrlProvider.GetDetailsUrl(Guid.Empty)); var rootItems = new ITreeItem[] {equipment, roomTypes} .Union(campuses); return new MapList(rootItems, selectedId); }