public static RoomData GetRoomFromID(SecretBaseRoomTypes type, SecretBaseRoomLayouts layout) { SecretBaseRoomID id = new SecretBaseRoomID { Type = type, Layout = layout }; if (roomMap.ContainsKey(id)) return roomMap[id]; return null; }
public static RoomData GetRoomFromID(SecretBaseRoomTypes type, SecretBaseRoomLayouts layout) { SecretBaseRoomID id = new SecretBaseRoomID { Type = type, Layout = layout }; if (roomMap.ContainsKey(id)) { return(roomMap[id]); } return(null); }
public LocationData(DataRow row) { this.id = (byte)(long)row["ID"]; this.order = (int)(long)row["Order"]; this.route = (byte)(long)row["Route"]; this.mapX = (byte)((long)row["MapX"] + 1); // At first I made the map position 1 off to center on the location but I'm thinking I'll just highlight the grid location this.mapY = (byte)((long)row["MapY"] + 1); this.side = GetSideFromString(row["Side"] as string); this.type = GetTypeFromString(row["Type"] as string); this.layout = GetLayoutFromString(row["Layout"] as string); this.requirements = row["Requirements"] as string; this.image = LoadImage((byte[])row["Image"]); }
public RoomData(DataRow row) { this.id = (byte)(long)row["ID"]; this.type = GetTypeFromString(row["Type"] as string); this.layout = GetLayoutFromString(row["Layout"] as string); this.width = (byte)(long)row["Width"]; this.height = (byte)(long)row["Height"]; this.trainerX = (byte)(long)row["TrainerX"]; this.trainerY = (byte)(long)row["TrainerY"]; this.image = LoadImage(row["Image"] as byte[]); this.backgroundImage = LoadImage(row["BackgroundImage"] as byte[]); CompilePlacementGrid(row["PlacementGrid"] as string); }
private void CompilePlacementGrid(string grid) { placementGrid = new SecretBasePlacementTypes[width, height]; grid = grid.Replace("\n", "").Replace("\r", ""); if (grid.Length != width * height) { throw new Exception("Secret Base Room placement grid incorrect length"); } for (int i = 0; i < grid.Length; i++) { SecretBasePlacementTypes type = SecretBasePlacementTypes.Blocked; if (grid[i] == 'B') { type = SecretBasePlacementTypes.Blocked; } else if (grid[i] == 'F') { type = SecretBasePlacementTypes.Floor; } else if (grid[i] == 'W') { type = SecretBasePlacementTypes.Wall; } else if (grid[i] == 'R') { type = SecretBasePlacementTypes.Rock; } else if (grid[i] == 'H') { type = SecretBasePlacementTypes.Hole; } else if (grid[i] == 'S') { type = SecretBasePlacementTypes.Reserved; } else { throw new Exception("Invalid placement grid letter"); } placementGrid[i % width, i / width] = type; } }
private void CompilePlacementGrid(string grid) { placementGrid = new SecretBasePlacementTypes[width, height]; grid = grid.Replace("\n", "").Replace("\r", ""); if (grid.Length != width * height) throw new Exception("Secret Base Room placement grid incorrect length"); for (int i = 0; i < grid.Length; i++) { SecretBasePlacementTypes type = SecretBasePlacementTypes.Blocked; if (grid[i] == 'B') type = SecretBasePlacementTypes.Blocked; else if (grid[i] == 'F') type = SecretBasePlacementTypes.Floor; else if (grid[i] == 'W') type = SecretBasePlacementTypes.Wall; else if (grid[i] == 'R') type = SecretBasePlacementTypes.Rock; else if (grid[i] == 'H') type = SecretBasePlacementTypes.Hole; else if (grid[i] == 'S') type = SecretBasePlacementTypes.Reserved; else throw new Exception("Invalid placement grid letter"); placementGrid[i % width, i / width] = type; } }