internal override Region ReadEntry(BinaryReaderEx br)
            {
                RegionType type = br.GetEnum8 <RegionType>(br.Position + br.VarintSize + 2);

                switch (type)
                {
                case RegionType.Region0:
                    return(Region0s.EchoAdd(new Region.Region0(br)));

                case RegionType.Light:
                    return(Lights.EchoAdd(new Region.Light(br)));

                case RegionType.StartPoint:
                    return(StartPoints.EchoAdd(new Region.StartPoint(br)));

                case RegionType.Sound:
                    return(Sounds.EchoAdd(new Region.Sound(br)));

                case RegionType.SFX:
                    return(SFXs.EchoAdd(new Region.SFX(br)));

                case RegionType.Wind:
                    return(Winds.EchoAdd(new Region.Wind(br)));

                case RegionType.EnvLight:
                    return(EnvLights.EchoAdd(new Region.EnvLight(br)));

                case RegionType.Fog:
                    return(Fogs.EchoAdd(new Region.Fog(br)));

                default:
                    throw new NotImplementedException($"Unimplemented region type: {type}");
                }
            }
            /// <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);
            }
Exemple #3
0
            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}");
                }
            }
Exemple #4
0
            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));
                }
            }