private void AddNewDoor() { var curSelectWindow = new SelectWindow(); var typeToAdd = curSelectWindow.SelectProductType(); BaseClasses.Door doorToAdd = null; switch (typeToAdd) { case Helpers.AllNames.ProductClasses.k1MDType: doorToAdd = new ViewModels.MDDoors.MDDoor(); break; case Helpers.AllNames.ProductClasses.k4RDType: doorToAdd = new ViewModels.RDDoors.RDDoor(); break; default: break; } if (doorToAdd != null) { doorToAdd.Edit(); Doors.Add(doorToAdd); } }
internal void AddDoor(Door door) { Rectangle coordinates = GetCoordinates(door.Orientation, door.Alignment, 5, 20); door.Coordinates = coordinates; Doors.Add(door.Id, door); }
public HallsSouth(Game game, Torch.Object parent, byte[] data) : base(game, data) { Name = "Coliseum Halls South"; SandbagImage = "Zones/Coliseum/Halls/south-sb"; Sandbag = Grid.FromBitmap(Game.Services, SandbagImage); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Halls/south")); Doors.Add(new Door { Location = new Rectangle(345, 550, 50, 35), Name = "cell", Orientation = Direction.Up }); Doors.Add(new Door { Location = new Rectangle(100, 100, 50, 35), Name = "halls-north", Orientation = Direction.Down }); Doors.Add(new Door { Location = new Rectangle(660, 300, 35, 50), Name = "halls-east", Orientation = Direction.Left }); Objects.Add(new InteractiveObject { Interact = SimpleDoor("coliseum/cell", "halls"), Location = new Rectangle(345, 585, 50, 25) }); Objects.Add(new InteractiveObject { Interact = SimpleDoor("coliseum/halls-north", "halls-south"), Location = new Rectangle(100, 90, 50, 15) }); Objects.Add(new InteractiveObject { Interact = SimpleDoor("coliseum/halls-east", "halls-south"), Location = new Rectangle(700, 300, 15, 50) }); }
private bool TryAddNormalDoor(MapTile tile, Point location) { BlockType blockType; Direction direction; // ReSharper disable once SwitchStatementMissingSomeCases switch (tile) { case MapTile.DoorUp: blockType = BlockType.DoorUp; direction = Direction.Up; break; case MapTile.DoorDown: blockType = BlockType.DoorDown; direction = Direction.Down; break; default: return(false); } var door = new NormalDoor(_survivalManager, location, blockType); Doors.Add(direction, door); Drawables.Add(door); Collidables.Add(door); return(true); }
/// <summary> /// Attempt to build a room off a random point on a corridor. /// </summary> /// <returns> /// True if the a room is built on the corridor. Otherwise, false. /// </returns> private bool BuildRoomOnCorridor() { //// the offest of start is to move one point in the direction //// the room is being built, to ensure it has a discrete entry point for (int attempt = 0; attempt < MaximumAttempts; attempt++) { int directionAwayFromCorridor; Vector2 corridorPoint = GetCorridorPoint(out directionAwayFromCorridor); Vector2 door; Rect room = GetRoom(corridorPoint, directionAwayFromCorridor, out door); if (RectangleFits(room)) { BuildRectangle(room); Rooms.Add(room); Doors.Add(door); Map[(int)door.x, (int)door.y] = (int)MapElements.Door; _currentRoomCount++; return(true); } } return(false); }
public virtual InteractiveTile CreateDoor(Tile original) { if (generationInfo != null) { if (generationInfo.ChildIsland) { Debug.Assert(generationInfo.EntrancesCount > 0); } else { Debug.Assert(generationInfo.EntrancesCount == 0); } } var door = CreateDoorInstance(); Debug.Assert(door != null); bool doorSet = SetTile(door, original.point); Debug.Assert(doorSet); door.DungeonNodeIndex = original.DungeonNodeIndex; var doorInterface = door as IDoor; Debug.Assert(doorInterface != null); Doors.Add(doorInterface); return(door); }
public RDRG2(Vector2 position) : base(position) { Height = 20; Width = 40; Door door5 = new Door(); door5.location = new Vector2(0, 14); door5.direc = Door.direction.right; Doors.Add(door5); }
public Village(Game game, Torch.Object parent, byte[] data) : base(game, data) { Name = "Desert Village"; SandbagImage = "Zones/Village/Village/sandbag"; Sandbag = Grid.FromBitmap(Game.Services, SandbagImage); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/village")); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/inn") { X = 840, Y = 1372, DrawOrder = 1752 }); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/warehouse") { X = 155, Y = 1300, DrawOrder = 1918 }); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/well") { X = 1400, Y = 863, DrawOrder = 977 }); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/Posts1") { X = 70, Y = 1940, DrawOrder = 2100 }); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Village/house") { X = 754, Y = 701, DrawOrder = 1094 }); Objects.Add(new InteractiveObject { Interact = SimpleDoor("village/shop", "village"), Location = new Rectangle(164 * 6, 192 * 6, 80, 40) }); Doors.Add(new Door { Location = new Rectangle(1442, 2057, 171, 37), Name = "coliseum", Orientation = Direction.Up, Zone = "coliseum/halls-north", ZoneDoor = "village" }); Doors.Add(new Door { Location = new Rectangle(69 * 6, 315 * 6, 9 * 6, 2), Name = "warehouse", Orientation = Direction.Down, Zone = "village/warehouse", ZoneDoor = "entrance" }); Doors.Add(new Door { Location = new Rectangle(69 * 6, 320 * 6, 9 * 6, 2), Name = "warehouse exit", Orientation = Direction.Down }); Doors.Add(new Door { Location = new Rectangle(177 * 6, 288 * 6, 12 * 6, 2), Name = "inn", Orientation = Direction.Down, Zone = "village/inn", ZoneDoor = "entrance" }); Doors.Add(new Door { Location = new Rectangle(177 * 6, 295 * 6, 12 * 6, 2), Name = "inn exit", Orientation = Direction.Down }); Doors.Add(new Door { Location = new Rectangle(164 * 6, 200 * 6, 80, 40), Name = "shop", Orientation = Direction.Down }); }
public override ValueTask OnSpawnAsync() { for (var i = 0; i < Doors.Count; i++) { Doors.Add(i, false); } AddSystems(_systems); _systems.Add(SystemTypes.Sabotage, new SabotageSystemType(_systems.Values.OfType <IActivatable>().ToArray())); return(base.OnSpawnAsync()); }
public HallsEast(Game game, Torch.Object parent, byte[] data) : base(game, data) { Name = "Coliseum Halls East"; SandbagImage = "Zones/Coliseum/Halls/east-sb"; Sandbag = Grid.FromBitmap(Game.Services, SandbagImage); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Coliseum/Halls/east")); Doors.Add(new Door {Location = new Rectangle(60, 450, 35, 50), Name = "halls-south", Orientation = Direction.Right }); Objects.Add(new InteractiveObject { Interact = SimpleDoor("coliseum/halls-south", "halls-east"), Location = new Rectangle(50, 450, 15, 50) }); }
public Warehouse(Game game, Torch.Object parent, byte[] data) : base(game, data) { Name = "Village Warehouse"; SandbagImage = "Zones/Village/Warehouse/sandbag"; Sandbag = Grid.FromBitmap(Game.Services, SandbagImage); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Warehouse/warehouse")); Doors.Add(new Door { Location = new Rectangle(56 * 6, 130 * 6, 10 * 6, 1), Name = "entrance", Orientation = Direction.Up, Zone = "village/village", ZoneDoor = "warehouse exit" }); }
public void CreateEastWestDoorway(Room east, Room west, bool isLocked = false) { var door = new Door(); door.DoorId = lastDoorId++; door.IsLocked = isLocked; door.Room1 = east; door.Room2 = west; east.WestDoor = door; west.EastDoor = door; Doors.Add(door.DoorId, door); }
public RDRG5(Vector2 position) : base(position) { Height = 20; Width = 60; Door door11 = new Door(), door12 = new Door(); door11.location = new Vector2(58, 13); door11.direc = Door.direction.left; door12.location = new Vector2(0, 13); door12.direc = Door.direction.right; Doors.Add(door11); Doors.Add(door12); }
// A doorway is created using a convention. // We can only create a door using 2 methods, North-South and East-West // This is to keep things simple public void CreateNorthSouthDoorway(Room north, Room south, bool isLocked = false) { var door = new Door(); door.DoorId = lastDoorId++; door.IsLocked = isLocked; door.Room1 = north; door.Room2 = south; north.SouthDoor = door; south.NorthDoor = door; Doors.Add(door.DoorId, door); }
public RDRG4(Vector2 position) : base(position) { Height = 30; Width = 60; Door door9 = new Door(), door10 = new Door(); door9.location = new Vector2(58, 24); door9.direc = Door.direction.left; door10.location = new Vector2(0, 24); door10.direc = Door.direction.right; Doors.Add(door9); Doors.Add(door10); }
public bool AddDoor(Door door) { if (!Field[door.Loc].IsWalkable) { return(false); } Doors.Add(ToIndex(door.Loc), door); Tile tile = Field[door.Loc]; tile.IsOccupied = true; tile.BlocksLight = door.BlocksLight; return(true); }
private async void FetchDoorsAsync() { var doors = await Task.Run(() => DoorManagementServiceAccess.FetchDoorsAsync()); var doorsBOList = doors.Select(d => new DoorBusinessObject(d.Id, d.Name, d.LockStatus == 1 ? LockStatus.Locked : LockStatus.UnLocked, d.OpenStatus == 1 ? OpenStatus.Opened : OpenStatus.Closed)) .ToList(); Doors.Clear(); foreach (var door in doorsBOList) { Doors.Add(door); } }
public Inn(Game game, Torch.Object parent, byte[] data) : base(game, data) { Name = "Village Inn"; SandbagImage = "Zones/Village/Inn/sandbag"; Sandbag = Grid.FromBitmap(Game.Services, SandbagImage); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Inn/inn")); Doors.Add(new Door { Location = new Rectangle(63 * 6, 93 * 6, 13 * 6, 2), Zone = "village/village", ZoneDoor = "inn exit", Name = "entrance", Orientation = Direction.Up }); Doors.Add(new Door { Location = new Rectangle(215, 265, 75, 75), Name = "save", Orientation = Direction.Down }); AddSavepoint(215, 265); }
public RDRG3(Vector2 position) : base(position) { Height = 30; Width = 60; Door door6 = new Door(), door7 = new Door(), door8 = new Door(); door6.location = new Vector2(58, 23); door6.direc = Door.direction.left; door7.location = new Vector2(0, 23); door7.direc = Door.direction.right; door8.location = new Vector2(0, 3); door8.direc = Door.direction.right; Doors.Add(door6); Doors.Add(door7); Doors.Add(door8); }
internal override void SetDoor(int x, int y) { if (_dungeonHelper.GetRandomInt(0, 101) < 40) { DungeonTiles[x][y].Texture = Textures.NO_CORRIDOR_DOOR_TRAPPED; } else if (_dungeonHelper.GetRandomInt(0, 101) < 50) { DungeonTiles[x][y].Texture = Textures.NO_CORRIDOR_DOOR_LOCKED; } else { DungeonTiles[x][y].Texture = Textures.NO_CORRIDOR_DOOR; } OpenDoorList.Add(DungeonTiles[x][y]); Doors.Add(DungeonTiles[x][y]); }
public Shop(Game game, Torch.Object parent, byte[] data) : base(game, data) { Name = "Village Shop"; SandbagImage = "Zones/Village/Shop/sandbag"; Sandbag = Grid.FromBitmap(Game.Services, SandbagImage); ImageLayers.Add(new ImageObject(Game, parent, "Zones/Village/Shop/shop")); Objects.Add(new InteractiveObject { Interact = Merchant, Location = new Rectangle(47 * 6, 44 * 6, 8 * 6, 6) }); Doors.Add(new Door { Location = new Rectangle(33 * 6, 67 * 6, 8 * 6, 6), Name = "village", Orientation = Direction.Up, Zone = "village/village", ZoneDoor = "shop" }); }
public void Read(Stream stream) { BinaryReader br = new BinaryReader(stream); long lastOffset; while (stream.Position < stream.Length) { byte type = br.ReadByte(); lastOffset = stream.Position; int chunkLen = br.ReadInt32(); switch (type) { case 5: Doors.Add(PageIO.ReadDoor(br)); break; case 7: Sounds.Add(PageIO.ReadSound(br)); break; case 9: Gamefiles.Add(PageIO.ReadGamefile(br)); break; case 1: case 2: case 6: case 8: case 10: case 0: stream.Seek(chunkLen - 4, SeekOrigin.Current); break; default: throw new InvalidDataException(string.Format("Chunk at offset {0} specified unknown type {1}", lastOffset - 1, type)); } //Diagnostics if (stream.Position - lastOffset != chunkLen) { throw new InvalidDataException(string.Format("Chunk type {3} at offset {0} specified {1} bytes, but read {2}", lastOffset - 1, chunkLen, stream.Position - lastOffset, type)); } } }
private void LoadDoors(XDocument doc) { var elemList = doc.Descendants("Door"); int x, y, sx, sy, id, Keyid; foreach (var item in elemList) { int.TryParse(item.Attribute("X").Value, out x); int.TryParse(item.Attribute("Y").Value, out y); int.TryParse(item.Attribute("SizeX").Value, out sx); int.TryParse(item.Attribute("SizeY").Value, out sy); int.TryParse(item.Attribute("Id").Value, out id); int.TryParse(item.Attribute("KeyId").Value, out Keyid); Doors.Add(new Door { X = x, Y = y, SizeX = sx, SizeY = sy, ID = id, KeyId = Keyid }); } }
public RDRG1(Vector2 position) : base(position) { Height = 20; Width = 60; Door door1 = new Door(), door2 = new Door(), door3 = new Door(), door4 = new Door(); door1.location = new Vector2(0, 14); door1.direc = Door.direction.right; door2.location = new Vector2(58, 13); door2.direc = Door.direction.left; door3.location = new Vector2(28, 0); door3.direc = Door.direction.up; door4.location = new Vector2(48, 19); door4.direc = Door.direction.down; Doors.Add(door1); Doors.Add(door2); Doors.Add(door3); Doors.Add(door4); }
/// <summary> /// Attempt to build a corridor on the side of a room. /// </summary> /// <returns> /// True if a corridor was built. Otherwise, false. /// </returns> private bool BuildCorridorOnRoomEdge() { for (int attempt = 0; attempt < MaximumAttempts; attempt++) { int direction; Vector2 door = GetRoomEdge(out direction); Rect corridor = GetCorridor(door, direction); if (RectangleFits(corridor)) { Corridors.Add(corridor); BuildRectangle(corridor); Map[(int)door.x, (int)door.y] = (int)MapElements.Door; Doors.Add(door); return(true); } } return(false); }
// Read all doors from ROM. private void ReadDoors(Rom rom) { List <int> addressesPC = new List <int> (); foreach (DoorSet d in DoorSets) { for (int i = 0; i < d.DoorCount; i++) { int ad_PC = Tools.LRtoPC(d.DoorPtrs [i]); addressesPC.Add(ad_PC); } } Tools.RemoveDuplicates(addressesPC); Doors.Clear(); for (int n = 0; n < addressesPC.Count; n++) { Doors.Add(new Door()); Doors [n].ReadFromROM(rom, addressesPC [n]); } }
/// <summary> /// Attempt to build a room at the end of a corridor. /// </summary> /// <returns>True if room built at the end of a corridor.</returns> private bool BuildRoomOnCorridorEnd() { for (int attempt = 0; attempt < MaximumAttempts; attempt++) { int directionAwayFromCorridor; Vector2 corridorEndpoint = GetEndOfCorridor(out directionAwayFromCorridor); Vector2 door; Rect room = GetRoom(corridorEndpoint, directionAwayFromCorridor, out door); if (RectangleFits(room)) { BuildRectangle(room); Rooms.Add(room); Doors.Add(door); Map[(int)door.x, (int)door.y] = (int)MapElements.Door; _currentRoomCount++; return(true); } } return(false); }
public DoorListViewModel(IDoorService doorService, HubConnection connection) { _doorService = doorService; AddDoorCommand = new DelegateCommand <DoorModel>(OnAddDoor); RemoveDoorCommand = new DelegateCommand <DoorModel>(OnDeleteDoor); EditDoorCommand = new DelegateCommand <DoorModel>(OnEditDoor); _connection = connection; connection.On <DoorModel>("DeleteMessageReceived", obj => { var doorItem = Doors.FirstOrDefault(x => x.Id == obj.Id); Doors.Remove(doorItem); }); connection.On <DoorModel>("AddMessageReceived", obj => { var doorItem = Doors.FirstOrDefault(x => x.Id == obj.Id); if (doorItem == null) { Doors.Add(obj); } }); connection.On <DoorModel>("EditMessageReceived", obj => { var doorItem = Doors.FirstOrDefault(x => x.Id == obj.Id); if (doorItem != null) { doorItem.IsLocked = obj.IsLocked; doorItem.IsOpen = obj.IsOpen; doorItem.Label = obj.Label; } }); }
private void AddDoor(Door d) { Doors.Add(d); }
private void HandleMapComplementaryInformationsDataMessage(IAccount account, MapComplementaryInformationsDataMessage message) { lock (CheckLock) { SubAreaId = message.SubAreaId; Data = MapsManager.FromId(message.MapId); var subArea = ObjectDataManager.Instance.Get <SubArea>(SubAreaId); var mapName = FastD2IReader.Instance.GetText(ObjectDataManager.Instance.Get <Area>(subArea.AreaId).NameId); var subAreaName = FastD2IReader.Instance.GetText(subArea.NameId); Position = $"[{X}, {Y}]"; Zone = $"{mapName} ({subAreaName})"; Entities.Clear(); Monsters.Clear(); Npcs.Clear(); Players.Clear(); AddActors(message.Actors); StatedElements.Clear(); foreach (var statedElementDofus in message.StatedElements) { if (!StatedElements.ContainsKey(statedElementDofus.ElementId) && statedElementDofus.OnCurrentMap) { StatedElements.Add(statedElementDofus.ElementId, new StatedElement(statedElementDofus.ElementCellId, (uint)statedElementDofus.ElementId, statedElementDofus.ElementState)); } } InteractiveElements.Clear(); Doors.Clear(); foreach (var element in message.InteractiveElements) { if (!element.OnCurrentMap) { continue; } InteractiveElements.Add(element.ElementId, new InteractiveElement((uint)element.ElementId, element.ElementTypeId, element.EnabledSkills.ToList(), element.DisabledSkills.ToList())); var interactiveElement = element; var listDoorSkillId = new List <int>(new[] { 184, 183, 187, 198, 114 }); var listDoorTypeId = new List <int>(new[] { -1, 128, 168, 16 }); if (!listDoorTypeId.Contains(interactiveElement.ElementTypeId) || interactiveElement.EnabledSkills.Count <= 0 || !listDoorSkillId.Contains((int)interactiveElement.EnabledSkills[0].SkillId)) { continue; } foreach (var layer in ((API.Gamedata.D2p.Map)Data).Layers) { foreach (var cell in layer.Cells) { foreach (var layerElement in cell.Elements) { if (layerElement is GraphicalElement graphicalElement) { if (graphicalElement.Identifier == interactiveElement.ElementId && !Doors.ContainsKey(cell.CellId)) { Doors.Add(cell.CellId, new InteractiveElement((uint)element.ElementId, element.ElementTypeId, element.EnabledSkills.ToList(), element.DisabledSkills.ToList())); } } } } } } } UpdateMapControl(); OnMapChanged(); }