Пример #1
0
            /// <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);
            }
Пример #2
0
            internal override Region ReadEntry(BinaryReaderEx br)
            {
                RegionType type = br.GetEnum32 <RegionType>(br.Position + 8);

                switch (type)
                {
                case RegionType.Region0:
                    var region0 = new Region.Region0(br);
                    Region0s.Add(region0);
                    return(region0);

                case RegionType.InvasionPoint:
                    var invasionPoint = new Region.InvasionPoint(br);
                    InvasionPoints.Add(invasionPoint);
                    return(invasionPoint);

                case RegionType.EnvironmentMapPoint:
                    var environmentMapPoint = new Region.EnvironmentMapPoint(br);
                    EnvironmentMapPoints.Add(environmentMapPoint);
                    return(environmentMapPoint);

                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.WindSFX:
                    var windSFX = new Region.WindSFX(br);
                    WindSFXs.Add(windSFX);
                    return(windSFX);

                case RegionType.SpawnPoint:
                    var spawnPoint = new Region.SpawnPoint(br);
                    SpawnPoints.Add(spawnPoint);
                    return(spawnPoint);

                case RegionType.WalkRoute:
                    var walkRoute = new Region.WalkRoute(br);
                    WalkRoutes.Add(walkRoute);
                    return(walkRoute);

                case RegionType.WarpPoint:
                    var warpPoint = new Region.WarpPoint(br);
                    WarpPoints.Add(warpPoint);
                    return(warpPoint);

                case RegionType.ActivationArea:
                    var activationArea = new Region.ActivationArea(br);
                    ActivationAreas.Add(activationArea);
                    return(activationArea);

                case RegionType.Event:
                    var evt = new Region.Event(br);
                    Events.Add(evt);
                    return(evt);

                case RegionType.EnvironmentMapEffectBox:
                    var environmentMapEffectBox = new Region.EnvironmentMapEffectBox(br);
                    EnvironmentMapEffectBoxes.Add(environmentMapEffectBox);
                    return(environmentMapEffectBox);

                case RegionType.WindArea:
                    var windArea = new Region.WindArea(br);
                    WindAreas.Add(windArea);
                    return(windArea);

                case RegionType.MufflingBox:
                    var mufflingBox = new Region.MufflingBox(br);
                    MufflingBoxes.Add(mufflingBox);
                    return(mufflingBox);

                case RegionType.MufflingPortal:
                    var mufflingPortal = new Region.MufflingPortal(br);
                    MufflingPortals.Add(mufflingPortal);
                    return(mufflingPortal);

                case RegionType.Region23:
                    var region23 = new Region.Region23(br);
                    Region23s.Add(region23);
                    return(region23);

                case RegionType.Region24:
                    var region24 = new Region.Region24(br);
                    Region24s.Add(region24);
                    return(region24);

                case RegionType.PartsGroup:
                    var partsGroup = new Region.PartsGroup(br);
                    PartsGroups.Add(partsGroup);
                    return(partsGroup);

                case RegionType.AutoDrawGroup:
                    var autoDrawGroup = new Region.AutoDrawGroup(br);
                    AutoDrawGroups.Add(autoDrawGroup);
                    return(autoDrawGroup);

                case RegionType.Other:
                    var other = new Region.Other(br);
                    Others.Add(other);
                    return(other);

                default:
                    throw new NotImplementedException($"Unimplemented region type: {type}");
                }
            }