public Room(Ship ship, Grid grid, Point p1, Point p2, Room_Type roomType) { var minX = Math.Min(p1.X, p2.X); var minY = Math.Min(p1.Y, p2.Y); var maxX = Math.Max(p1.X, p2.X); var maxY = Math.Max(p1.Y, p2.Y); p1 = new Point(minX, minY); p2 = new Point(maxX, maxY); this.GridLocation = new Rectangle(p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y); this.RoomType = roomType; this.RoomID = GetNextRoomID(); Components = new List <Component>(); Ship = ship; Grid = grid; for (int x = p1.X; x <= p2.X; x++) { Components.Add(new StructureComponent(x, p1.Y, ComponentConstants.COMPONENT_STRUCTURE_COLOR)); Components.Add(new StructureComponent(x, p2.Y, ComponentConstants.COMPONENT_STRUCTURE_COLOR)); } for (int y = p1.Y + 1; y < p2.Y; y++) { Components.Add(new StructureComponent(p1.X, y, ComponentConstants.COMPONENT_STRUCTURE_COLOR)); Components.Add(new StructureComponent(p2.X, y, ComponentConstants.COMPONENT_STRUCTURE_COLOR)); } }
public List <Room_Type> select_All() { List <Room_Type> Land_list = new List <Room_Type>(); SqlConnection con = new SqlConnection(" Data Source=MOHAMED-PC;Initial Catalog=Real_Estate_Management;Integrated Security=True"); SqlCommand cmd = new SqlCommand("Select_All_Land", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader rdr; con.Open(); rdr = cmd.ExecuteReader(); while (rdr.Read()) { Room_Type Land = new Room_Type(); Land.Area = Convert.ToDouble(rdr["Area"]); Land.Avalable = Convert.ToByte(rdr["Avalable"]); Land.Descriptions = rdr["Descriptions"].ToString(); Land.Design_Image = rdr["Design_Image"].ToString(); Land.FK_Users = (int)rdr["FK_Users"]; Land.ID = (int)rdr["ID"];; Land.Images = rdr["Images"].ToString(); Land.FK_Purpoes_Land = (int)rdr["FK_Purpose_Land"]; Land_list.Add(Land); } con.Close(); return(Land_list); }
public Room_Type select_Item(int ID) { Room_Type Land = new Room_Type(); SqlConnection con = new SqlConnection(" Data Source=MOHAMED-PC;Initial Catalog=Real_Estate_Management;Integrated Security=True"); SqlCommand cmd = new SqlCommand("Select_Item_Land", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ID", ID); SqlDataReader rdr; con.Open(); rdr = cmd.ExecuteReader(); if (rdr.Read()) { Land.ID = (int)rdr["ID"]; Land.Area = (int)rdr["Apartment_Number"]; Land.Avalable = Convert.ToByte(rdr["Area"]); Land.Descriptions = rdr["Descriptions"].ToString(); Land.Design_Image = rdr["Desgin_Image"].ToString(); Land.FK_Users = (int)rdr["FK_Uers"]; Land.Images = rdr["Images"].ToString(); Land.FK_Purpoes_Land = (int)rdr["FK_Purpoes_Land"]; } con.Close(); return(Land); }
/// <param name="gridLocation">Location is in grid coordinates, not pixel coordinates</param> public Room(Ship ship, Rectangle gridLocation, Room_Type roomType) { this.GridLocation = gridLocation; this.RoomType = roomType; this.RoomID = GetNextRoomID(); Components = new List <Component>(); Ship = ship; }
public void set_to_room_type(Room_Type next_type) { c_room_type = next_type; if (c_room_type == Room_Type.GenericCircular) { calculate_circular_matrix(roomWidth); } }
public ActionResult DeleteConfirmed(int id) { Room_Type room_Type = db.Room_Type.Find(id); db.Room_Type.Remove(room_Type); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] Room_Type room_Type) { if (ModelState.IsValid) { db.Entry(room_Type).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(room_Type)); }
public ActionResult Create([Bind(Include = "Id,Name")] Room_Type room_Type) { if (ModelState.IsValid) { db.Room_Type.Add(room_Type); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(room_Type)); }
public void delete(Room_Type Land) { SqlConnection con = new SqlConnection(" Data Source=MOHAMED-PC;Initial Catalog=Real_Estate_Management;Integrated Security=True"); SqlCommand cmd = new SqlCommand("Delete_Land", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("ID", Land.ID); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
public Form1() { InitializeComponent(); guest = new Guest(); employee = new Employee(); room = new Room(); reservation = new Reservation(); reservationStatus = new Reservation_Status(); roomStatus = new Room_Status(); roomType = new Room_Type(); }
public void AddComponent(Component component) { if (RoomType == Room_Type.None) { RoomType = GetRoomType(component); } if (component.Texture == null) { Ship.LoadComponentTexture(component); } Components.Add(component); }
// Room get public ActionResult Room(int?ro, int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } model.RRoom_Type = db.Room_Type.ToList(); model.TheSticker = db.Stickers.Find(id); Room_Type roomType = db.Room_Type.Find(ro); return(View(model)); }
public void Reset() { DoorLeft = null; DoorRight = null; DoorUp = null; DoorDown = null; thingsInstanciated = new List <ThingType>(); thingPositionsLeft = null; selectedRoom = null; currentRoomType = Room_Type.NORMAL; }
public ActionResult Edit(int?id) { if (id != null) { Room_Type room_Type = db.Room_Type.Find(id); if (room_Type != null) { return(View("CreateEditRoomType", room_Type)); } } return(RedirectToAction("Index")); }
// GET: Room_Type/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Room_Type room_Type = db.Room_Type.Find(id); if (room_Type == null) { return(HttpNotFound()); } return(View(room_Type)); }
public void insert(Room_Type Land) { SqlConnection con = new SqlConnection(" Data Source=MOHAMED-PC;Initial Catalog=Real_Estate_Management;Integrated Security=True"); SqlCommand cmd = new SqlCommand("Insert_Land", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("Area", Land.Area); cmd.Parameters.AddWithValue("Avalable", Land.Avalable); cmd.Parameters.AddWithValue("Descriptions", Land.Descriptions); cmd.Parameters.AddWithValue("Design_Image", Land.Design_Image); cmd.Parameters.AddWithValue("FK_Uers", Land.FK_Users); cmd.Parameters.AddWithValue("Images", Land.Images); cmd.Parameters.AddWithValue("FK_Purpoes_Land", Land.FK_Purpoes_Land); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
public ActionResult DeleteRoomType(int?id) { if (id != null) { Room_Type roomType = db.Room_Type.Find(id); if (roomType != null) { try { db.Room_Type.Remove(roomType); db.SaveChanges(); } catch (Exception) { return(RedirectToAction("Index")); } } } return(RedirectToAction("Index")); }
public Room(int srH, int srW, int srX, int srY, Room_Type rType, Tile.Tile_Type fType, bool doors, bool columns) { roomHeight = srH; roomWidth = srW; startXPos = srX; startYPos = srY; has_doors = doors; doors_always_locked = false; c_room_type = rType; if (c_room_type == Room_Type.GenericCircular) calculate_circular_matrix(roomWidth); c_floor_type = fType; rGen = new Random(); c_column_type = Column_Pattern.None; allow_random_spawns = true; if (columns) { //These are always present List<Column_Pattern> col_patterns = new List<Column_Pattern> { Column_Pattern.Four_Corners, Column_Pattern.Center_Pillar }; //If the room is big enough, we add a couple more. if (roomHeight >= 7) col_patterns.Add(Column_Pattern.Vertical_Rows); if (roomWidth >= 7) col_patterns.Add(Column_Pattern.Horizontal_Rows); //Then we pick a random one. c_column_type = col_patterns[rGen.Next(col_patterns.Count)]; } room_tiles = new List<string>(); hallway_anchors = new List<gridCoordinate>(); doodad_list = new List<KeyValuePair<Doodad.Doodad_Type, gridCoordinate>>(); monster_list = new List<KeyValuePair<string, gridCoordinate>>(); monster_family_list = new List<KeyValuePair<string, gridCoordinate>>(); bonus_gold = 0; hallway_anchors.Add(new gridCoordinate(roomWidth / 2, roomHeight / 2)); boss_spawn_coordinates = new List<gridCoordinate>(); }
public Room(int srH, int srW, int srX, int srY, Room_Type rType, Tile.Tile_Type fType, bool doors) { roomHeight = srH; roomWidth = srW; startXPos = srX; startYPos = srY; has_doors = doors; c_room_type = rType; if (c_room_type == Room_Type.GenericCircular) { calculate_circular_matrix(roomWidth); } c_floor_type = fType; rGen = new Random(); room_tiles = new List <string>(); doodad_list = new List <KeyValuePair <Doodad.Doodad_Type, gridCoordinate> >(); monster_list = new List <KeyValuePair <string, gridCoordinate> >(); gold_list = new List <KeyValuePair <Goldpile, gridCoordinate> >(); }
public ActionResult Room(string roomName, int?ro, int?id) { if (ModelState.IsValid) { Sticker roomSticker = db.Stickers.Find(id); Room_Type roomType = db.Room_Type.Find(ro); var rm = new Room { Area = roomName, Stick_İD = roomSticker.İD, Type_İD = roomType.İD }; db.Rooms.Add(rm); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult CreateEditRoomType(Room_Type room_type) { if (room_type.İD == 0) { db.Room_Type.Add(room_type); db.SaveChanges(); } else { Room_Type rt = db.Room_Type.Find(room_type.İD); if (rt == null) { return(RedirectToAction("Index")); } db.Entry(room_type).State = EntityState.Modified; db.SaveChanges(); //return RedirectToAction("Index", "Stickers"); } return(RedirectToAction("Index", "Room")); //return View("CreateEditRoomType", room_type); }
public Room(RoomDC base_room, SpawnTable sTable) { roomHeight = base_room.RoomHeight; roomWidth = base_room.RoomWidth; startXPos = 0; startYPos = 0; has_doors = false; rGen = new Random(); //Necropolis only. corpses_in_corner = false; corners_that_have_corpses = 0; //More general purpose stuff c_room_type = Room_Type.Generic; c_floor_type = Tile.Tile_Type.StoneFloor; room_tiles = base_room.Room_Matrix; doodad_list = new List <KeyValuePair <Doodad.Doodad_Type, gridCoordinate> >(); monster_list = new List <KeyValuePair <string, gridCoordinate> >(); gold_list = new List <KeyValuePair <Goldpile, gridCoordinate> >(); switch (base_room.RoomType) { case "Gorehound Kennels": c_room_type = Room.Room_Type.GHound_Kennel; break; case "Library": c_room_type = Room.Room_Type.Library; break; case "Darkroom": c_room_type = Room.Room_Type.DarkRoom; break; case "Corpse Storage": c_room_type = Room.Room_Type.CorpseStorage; break; case "Sewer": c_room_type = Room.Room_Type.SewerRoom; break; case "Rubble Room": c_room_type = Room.Room_Type.Destroyed; break; case "Knight Armory": c_room_type = Room.Room_Type.KnightArmory; break; case "Sewer Shaft": c_room_type = Room.Room_Type.SewerShaft; break; case "Jail": c_room_type = Room.Room_Type.Jail; break; case "Mine Shaft": c_room_type = Room.Room_Type.MineShaft; break; } //Now to add the appropriate list of monsters & doodads //Doodads first. for (int i = 0; i < base_room.Room_Doodads.Count; i++) { Doodad.Doodad_Type c_doodad_type = 0; //Altar by default - not a problem. switch (base_room.Room_Doodads[i]) { case "Altar": c_doodad_type = Doodad.Doodad_Type.Altar; break; case "ArmorSuit": c_doodad_type = Doodad.Doodad_Type.ArmorSuit; break; case "BloodSplatter": c_doodad_type = Doodad.Doodad_Type.Blood_Splatter; break; case "Cage": c_doodad_type = Doodad.Doodad_Type.Cage; break; case "CorpsePile": c_doodad_type = Doodad.Doodad_Type.CorpsePile; break; case "DestroyedArmorSuit": c_doodad_type = Doodad.Doodad_Type.Destroyed_ArmorSuit; break; case "Bookshelf": c_doodad_type = Doodad.Doodad_Type.Bookshelf; break; case "DestroyedBookshelf": c_doodad_type = Doodad.Doodad_Type.Destroyed_Bookshelf; break; } gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Doodad_Coordinates[i]); c_grid_coord.x += startXPos; c_grid_coord.y += startYPos; int doodad_chance = 0; Int32.TryParse(base_room.Room_Doodad_Chances[i], out doodad_chance); if (rGen.Next(100) < doodad_chance) { doodad_list.Add(new KeyValuePair <Doodad.Doodad_Type, gridCoordinate>(c_doodad_type, c_grid_coord)); } } //Then monsters. for (int i = 0; i < base_room.Room_Monsters.Count; i++) { if (sTable.monster_in_table(base_room.Room_Monsters[i])) { int monster_chance = 0; Int32.TryParse(base_room.Room_Monster_Chances[i], out monster_chance); gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Monster_Coordinates[i]); if (rGen.Next(100) < monster_chance) { monster_list.Add(new KeyValuePair <string, gridCoordinate>(base_room.Room_Monsters[i], c_grid_coord)); } } } }
public Room(RoomDC base_room, Spawn_Table_Manager sManager) { roomHeight = base_room.RoomHeight; roomWidth = base_room.RoomWidth; gridCoordinate room_coord = grid_c_from_matrix_c(base_room.Coordinate); startXPos = room_coord.x; startYPos = room_coord.y; has_doors = base_room.RoomDoors; doors_always_locked = base_room.DoorsLocked; rGen = new Random(); allow_random_spawns = base_room.AllowRandomSpawn; //Necropolis only. corpses_in_corner = false; corners_that_have_corpses = 0; //More general purpose stuff c_room_type = Room_Type.Generic; c_floor_type = Tile.Tile_Type.StoneFloor; c_column_type = Column_Pattern.None; room_tiles = base_room.Room_Matrix; hallway_anchors = new List<gridCoordinate>(); boss_spawn_coordinates = new List<gridCoordinate>(); doodad_list = new List<KeyValuePair<Doodad.Doodad_Type, gridCoordinate>>(); monster_list = new List<KeyValuePair<string, gridCoordinate>>(); monster_family_list = new List<KeyValuePair<string, gridCoordinate>>(); bonus_gold = base_room.RoomGold; allow_overlap = base_room.AllowOverlap; switch (base_room.RoomType) { case "Specific": c_room_type = Room_Type.Specific; break; case "Gorehound Kennels": c_room_type = Room.Room_Type.GHound_Kennel; break; case "Library": c_room_type = Room.Room_Type.Library; break; case "Darkroom": c_room_type = Room.Room_Type.DarkRoom; break; case "Corpse Storage": c_room_type = Room.Room_Type.CorpseStorage; break; case "Sewer": c_room_type = Room.Room_Type.SewerRoom; break; case "Rubble Room": c_room_type = Room.Room_Type.Destroyed; break; case "Knight Armory": c_room_type = Room.Room_Type.KnightArmory; break; case "Sewer Shaft": c_room_type = Room.Room_Type.SewerShaft; break; case "Jail": c_room_type = Room.Room_Type.Jail; break; case "Mine Shaft": c_room_type = Room.Room_Type.MineShaft; break; } //Add hallway anchors List<string> raw_anchors = base_room.Room_Hallway_Anchors; if (raw_anchors.Count == 0) hallway_anchors.Add(new gridCoordinate(roomWidth / 2, roomHeight / 2)); else for (int i = 0; i < raw_anchors.Count; i++) if(raw_anchors[i].Length > 0) //prevent from passing "" hallway_anchors.Add(grid_c_from_matrix_c(raw_anchors[i])); //Now to add the appropriate list of monsters & doodads //Doodads first. for (int i = 0; i < base_room.Room_Doodads.Count; i++) { Doodad.Doodad_Type c_doodad_type = 0; //Altar by default - not a problem. switch (base_room.Room_Doodads[i]) { case "Altar": c_doodad_type = Doodad.Doodad_Type.Altar; break; case "ArmorSuit": c_doodad_type = Doodad.Doodad_Type.ArmorSuit; break; case "BloodSplatter": c_doodad_type = Doodad.Doodad_Type.Blood_Splatter; break; case "Cage": c_doodad_type = Doodad.Doodad_Type.Cage; break; case "CorpsePile": c_doodad_type = Doodad.Doodad_Type.CorpsePile; break; case "DestroyedArmorSuit": c_doodad_type = Doodad.Doodad_Type.Destroyed_ArmorSuit; break; case "Bookshelf": c_doodad_type = Doodad.Doodad_Type.Bookshelf; break; case "DestroyedBookshelf": c_doodad_type = Doodad.Doodad_Type.Destroyed_Bookshelf; break; case "Ironbar_Door": c_doodad_type = Doodad.Doodad_Type.Iron_Door; break; case "Ironbar_Wall": c_doodad_type = Doodad.Doodad_Type.Ironbar_Wall; break; case "NadirBed": c_doodad_type = Doodad.Doodad_Type.NadirBed; break; case "NadirColumn": c_doodad_type = Doodad.Doodad_Type.NadirColumn; break; case "ArcheryTarget": c_doodad_type = Doodad.Doodad_Type.ArcheryTarget; break; case "Desk": c_doodad_type = Doodad.Doodad_Type.Desk; break; case "Hedgehog": c_doodad_type = Doodad.Doodad_Type.Hedgehog; break; case "NadirDoor": c_doodad_type = Doodad.Doodad_Type.NadirDoor; break; } gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Doodad_Coordinates[i]); int doodad_chance = 0; Int32.TryParse(base_room.Room_Doodad_Chances[i], out doodad_chance); if(rGen.Next(100) < doodad_chance) doodad_list.Add(new KeyValuePair<Doodad.Doodad_Type,gridCoordinate>(c_doodad_type, c_grid_coord)); } //Then monsters by family. for (int i = 0; i < base_room.Monster_Families.Count; i++) { int monster_family_chance = 0; Int32.TryParse(base_room.Monster_Family_Chances[i], out monster_family_chance); gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Monster_Family_Coordinates[i]); if (rGen.Next(100) < monster_family_chance) monster_family_list.Add(new KeyValuePair<string, gridCoordinate>(base_room.Monster_Families[i], c_grid_coord)); } //Then monsters by themselves. for (int i = 0; i < base_room.Room_Monsters.Count; i++) { int monster_chance = 0; Int32.TryParse(base_room.Room_Monster_Chances[i], out monster_chance); gridCoordinate c_grid_coord = grid_c_from_matrix_c(base_room.Room_Monster_Coordinates[i]); if (rGen.Next(100) < monster_chance) monster_list.Add(new KeyValuePair<string, gridCoordinate>(base_room.Room_Monsters[i], c_grid_coord)); } boss_spawn_coordinates = new List<gridCoordinate>(); for (int i = 0; i < base_room.Boss_Spawn_Coordinates.Count; i++) boss_spawn_coordinates.Add(grid_c_from_matrix_c(base_room.Boss_Spawn_Coordinates[i])); }
public void set_to_room_type(Room_Type next_type) { c_room_type = next_type; if (c_room_type == Room_Type.GenericCircular) calculate_circular_matrix(roomWidth); }
/// <param name="gridLocation">Location is in grid coordinates, not pixel coordinates</param> public Room(Rectangle gridLocation, Room_Type roomType) { this.GridLocation = gridLocation; this.RoomType = roomType; this.RoomID = GetNextRoomID(); }
public void SetRoomType(Room_Type type) { RoomType = type; }