Example #1
0
            internal override Event ReadEntry(BinaryReaderEx br)
            {
                EventType type = br.GetEnum32 <EventType>(br.Position + 8);

                switch (type)
                {
                case EventType.Light:
                    var light = new Event.Light(br);
                    Lights.Add(light);
                    return(light);

                case EventType.Sound:
                    var sound = new Event.Sound(br);
                    Sounds.Add(sound);
                    return(sound);

                case EventType.SFX:
                    var sfx = new Event.SFX(br);
                    SFXs.Add(sfx);
                    return(sfx);

                case EventType.WindSFX:
                    var windSFX = new Event.WindSFX(br);
                    WindSFXs.Add(windSFX);
                    return(windSFX);

                case EventType.Treasure:
                    var treasure = new Event.Treasure(br);
                    Treasures.Add(treasure);
                    return(treasure);

                case EventType.Generator:
                    var generator = new Event.Generator(br);
                    Generators.Add(generator);
                    return(generator);

                case EventType.Message:
                    var message = new Event.Message(br);
                    Messages.Add(message);
                    return(message);

                case EventType.ObjAct:
                    var objAct = new Event.ObjAct(br);
                    ObjActs.Add(objAct);
                    return(objAct);

                case EventType.SpawnPoint:
                    var spawnPoint = new Event.SpawnPoint(br);
                    SpawnPoints.Add(spawnPoint);
                    return(spawnPoint);

                case EventType.MapOffset:
                    var mapOffset = new Event.MapOffset(br);
                    MapOffsets.Add(mapOffset);
                    return(mapOffset);

                case EventType.Navmesh:
                    var navmesh = new Event.Navmesh(br);
                    Navmeshes.Add(navmesh);
                    return(navmesh);

                case EventType.Environment:
                    var environment = new Event.Environment(br);
                    Environments.Add(environment);
                    return(environment);

                case EventType.PseudoMultiplayer:
                    var pseudoMultiplayer = new Event.PseudoMultiplayer(br);
                    PseudoMultiplayers.Add(pseudoMultiplayer);
                    return(pseudoMultiplayer);

                default:
                    throw new NotImplementedException($"Unsupported event type: {type}");
                }
            }
Example #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}");
                }
            }
            public void Add(IMsbEvent item)
            {
                switch (item)
                {
                case Event.Light e:
                    Lights.Add(e);
                    break;

                case Event.Sound e:
                    Sounds.Add(e);
                    break;

                case Event.SFX e:
                    SFXs.Add(e);
                    break;

                case Event.WindSFX e:
                    WindSFXs.Add(e);
                    break;

                case Event.Treasure e:
                    Treasures.Add(e);
                    break;

                case Event.Generator e:
                    Generators.Add(e);
                    break;

                case Event.Message e:
                    Messages.Add(e);
                    break;

                case Event.ObjAct e:
                    ObjActs.Add(e);
                    break;

                case Event.SpawnPoint e:
                    SpawnPoints.Add(e);
                    break;

                case Event.MapOffset e:
                    MapOffsets.Add(e);
                    break;

                case Event.Navmesh e:
                    Navmeshes.Add(e);
                    break;

                case Event.Environment e:
                    Environments.Add(e);
                    break;

                case Event.PseudoMultiplayer e:
                    PseudoMultiplayers.Add(e);
                    break;

                default:
                    throw new ArgumentException(
                              message: "Item is not recognized",
                              paramName: nameof(item));
                }
            }