/// <summary> /// Adds a region to the appropriate list for its type; returns the region. /// </summary> public Region Add(Region region) { switch (region) { case Region.InvasionPoint r: InvasionPoints.Add(r); break; case Region.EnvironmentMapPoint r: EnvironmentMapPoints.Add(r); break; case Region.Sound r: Sounds.Add(r); break; case Region.SFX r: SFX.Add(r); break; case Region.WindSFX r: WindSFX.Add(r); break; case Region.SpawnPoint r: SpawnPoints.Add(r); break; case Region.Message r: Messages.Add(r); break; case Region.PatrolRoute r: PatrolRoutes.Add(r); break; case Region.MovementPoint r: MovementPoints.Add(r); break; case Region.WarpPoint r: WarpPoints.Add(r); break; case Region.ActivationArea r: ActivationAreas.Add(r); break; case Region.Event r: Events.Add(r); break; case Region.Logic r: Logic.Add(r); break; case Region.EnvironmentMapEffectBox r: EnvironmentMapEffectBoxes.Add(r); break; case Region.WindArea r: WindAreas.Add(r); break; case Region.MufflingBox r: MufflingBoxes.Add(r); break; case Region.MufflingPortal r: MufflingPortals.Add(r); break; case Region.Other r: Others.Add(r); break; default: throw new ArgumentException($"Unrecognized type {region.GetType()}.", nameof(region)); } return(region); }
internal override Region ReadEntry(BinaryReaderEx br) { RegionType type = br.GetEnum32 <RegionType>(br.Position + 8); switch (type) { case RegionType.InvasionPoint: return(InvasionPoints.EchoAdd(new Region.InvasionPoint(br))); case RegionType.EnvironmentMapPoint: return(EnvironmentMapPoints.EchoAdd(new Region.EnvironmentMapPoint(br))); case RegionType.Sound: return(Sounds.EchoAdd(new Region.Sound(br))); case RegionType.SFX: return(SFX.EchoAdd(new Region.SFX(br))); case RegionType.WindSFX: return(WindSFX.EchoAdd(new Region.WindSFX(br))); case RegionType.SpawnPoint: return(SpawnPoints.EchoAdd(new Region.SpawnPoint(br))); case RegionType.Message: return(Messages.EchoAdd(new Region.Message(br))); case RegionType.PatrolRoute: return(PatrolRoutes.EchoAdd(new Region.PatrolRoute(br))); case RegionType.MovementPoint: return(MovementPoints.EchoAdd(new Region.MovementPoint(br))); case RegionType.WarpPoint: return(WarpPoints.EchoAdd(new Region.WarpPoint(br))); case RegionType.ActivationArea: return(ActivationAreas.EchoAdd(new Region.ActivationArea(br))); case RegionType.Event: return(Events.EchoAdd(new Region.Event(br))); case RegionType.Logic: return(Logic.EchoAdd(new Region.Logic(br))); case RegionType.EnvironmentMapEffectBox: return(EnvironmentMapEffectBoxes.EchoAdd(new Region.EnvironmentMapEffectBox(br))); case RegionType.WindArea: return(WindAreas.EchoAdd(new Region.WindArea(br))); case RegionType.MufflingBox: return(MufflingBoxes.EchoAdd(new Region.MufflingBox(br))); case RegionType.MufflingPortal: return(MufflingPortals.EchoAdd(new Region.MufflingPortal(br))); case RegionType.Other: return(Others.EchoAdd(new Region.Other(br))); default: throw new NotImplementedException($"Unsupported region type: {type}"); } }