internal ActivitySound(STFReader stf) { stf.MustMatchBlockStart(); stf.ParseBlock(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("ortsactsoundfile", () => { stf.MustMatchBlockStart(); string soundFile = stf.ReadString(); SoundFile = Path.Combine(FolderStructure.RouteFromActivity(stf.FileName).SoundFile(soundFile)); if (!EnumExtension.GetValue(stf.ReadString(), out OrtsActivitySoundFileType soundFileType)) { stf.StepBackOneItem(); STFException.TraceInformation(stf, "Skipped unknown activity sound file type " + stf.ReadString()); SoundFileType = OrtsActivitySoundFileType.None; } else { SoundFileType = soundFileType; } stf.MustMatchBlockEnd(); }), new STFReader.TokenProcessor("ortssoundlocation", () => { stf.MustMatchBlockStart(); location = new WorldLocation(stf.ReadInt(null), stf.ReadInt(null), stf.ReadFloat(STFReader.Units.None, null), stf.ReadFloat(STFReader.Units.None, null), stf.ReadFloat(STFReader.Units.None, null)); stf.MustMatchBlockEnd(); }), });
internal Traffic(STFReader stf) { stf.MustMatchBlockStart(); Name = stf.ReadString(); stf.ParseBlock(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("service_definition", () => { Services.Add(new Services(stf)); }), }); // TrafficFile = new TrafficFile(FolderStructure.TrafficFile(Name)); TrafficFile = new TrafficFile(FolderStructure.RouteFromActivity(stf.FileName).TrafficFile(Name)); }
private protected void OrtsActivitySoundProcessor(STFReader stf) { stf.MustMatchBlockStart(); string soundFile = stf.ReadString(); SoundFile = FolderStructure.RouteFromActivity(stf.FileName).SoundFile(soundFile); if (!EnumExtension.GetValue(stf.ReadString(), out OrtsActivitySoundFileType soundFileType)) { stf.StepBackOneItem(); STFException.TraceInformation(stf, "Skipped unknown activity sound file type " + stf.ReadString()); SoundFileType = OrtsActivitySoundFileType.None; } else { SoundFileType = soundFileType; } stf.MustMatchBlockEnd(); }