/// <summary> /// Adds a region to the appropriate list for its type; returns the region. /// </summary> public Region Add(Region region) { switch (region) { case Region.Region0 r: Region0s.Add(r); break; case Region.Light r: Lights.Add(r); break; case Region.StartPoint r: StartPoints.Add(r); break; case Region.Sound r: Sounds.Add(r); break; case Region.SFX r: SFXs.Add(r); break; case Region.Wind r: Winds.Add(r); break; case Region.EnvLight r: EnvLights.Add(r); break; case Region.Fog r: Fogs.Add(r); break; default: throw new ArgumentException($"Unrecognized type {region.GetType()}.", nameof(region)); } return(region); }
internal override Region ReadEntry(BinaryReaderEx br) { RegionType type = br.GetEnum8 <RegionType>(br.Position + 0xA); switch (type) { case RegionType.Region0: var region0 = new Region.Region0(br); Region0s.Add(region0); return(region0); case RegionType.Light: var light = new Region.Light(br); Lights.Add(light); return(light); case RegionType.StartPoint: var startPoint = new Region.StartPoint(br); StartPoints.Add(startPoint); return(startPoint); case RegionType.Sound: var sound = new Region.Sound(br); Sounds.Add(sound); return(sound); case RegionType.SFX: var sfx = new Region.SFX(br); SFXs.Add(sfx); return(sfx); case RegionType.Wind: var wind = new Region.Wind(br); Winds.Add(wind); return(wind); case RegionType.EnvLight: var envLight = new Region.EnvLight(br); EnvLights.Add(envLight); return(envLight); case RegionType.Fog: var fog = new Region.Fog(br); Fogs.Add(fog); return(fog); default: throw new NotImplementedException($"Unimplemented region type: {type}"); } }
public void Add(IMsbRegion item) { switch (item) { case Region.Region0 r: Region0s.Add(r); break; case Region.Light r: Lights.Add(r); break; case Region.StartPoint r: StartPoints.Add(r); break; case Region.Sound r: Sounds.Add(r); break; case Region.SFX r: SFXs.Add(r); break; case Region.Wind r: Winds.Add(r); break; case Region.EnvLight r: EnvLights.Add(r); break; case Region.Fog r: Fogs.Add(r); break; default: throw new ArgumentException( message: "Item is not recognized", paramName: nameof(item)); } }