public static TransparentHook ReadHookType(DatReader datReader) { TransparentHook tp = new TransparentHook(); tp.Start = datReader.ReadSingle(); tp.End = datReader.ReadSingle(); tp.Time = datReader.ReadSingle(); return(tp); }
public static AnimationHook Read(DatReader datReader) { AnimationHook h = new AnimationHook(); h.HookType = (AnimationHookType)datReader.ReadUInt32(); h.Direction = datReader.ReadUInt32(); // The following HookTypes have no additional properties: // AnimationHookType.AnimationDone // AnimationHookType.DefaultScript // CreateBlockingParticle switch (h.HookType) { case AnimationHookType.Sound: h._hook = SoundHook.ReadHookType(datReader); break; case AnimationHookType.SoundTable: h._hook = SoundTableHook.ReadHookType(datReader); break; case AnimationHookType.Attack: h._hook = AttackHook.ReadHookType(datReader); break; case AnimationHookType.ReplaceObject: h._hook = ReplaceObjectHook.ReadHookType(datReader); break; case AnimationHookType.Ethereal: h._hook = EtherealHook.ReadHookType(datReader); break; case AnimationHookType.TransparentPart: h._hook = TransparentPartHook.ReadHookType(datReader); break; case AnimationHookType.Luminous: h._hook = LuminousHook.ReadHookType(datReader); break; case AnimationHookType.LuminousPart: h._hook = LuminousPartHook.ReadHookType(datReader); break; case AnimationHookType.Diffuse: h._hook = DiffuseHook.ReadHookType(datReader); break; case AnimationHookType.DiffusePart: h._hook = DiffusePartHook.ReadHookType(datReader); break; case AnimationHookType.Scale: h._hook = ScaleHook.ReadHookType(datReader); break; case AnimationHookType.CreateParticle: h._hook = CreateParticleHook.ReadHookType(datReader); break; case AnimationHookType.DestroyParticle: h._hook = DestroyParticleHook.ReadHookType(datReader); break; case AnimationHookType.StopParticle: h._hook = StopParticleHook.ReadHookType(datReader); break; case AnimationHookType.NoDraw: h._hook = NoDrawHook.ReadHookType(datReader); break; case AnimationHookType.DefaultScriptPart: h._hook = DefaultScriptPartHook.ReadHookType(datReader); break; case AnimationHookType.CallPES: h._hook = CallPESHook.ReadHookType(datReader); break; case AnimationHookType.Transparent: h._hook = TransparentHook.ReadHookType(datReader); break; case AnimationHookType.SoundTweaked: h._hook = SoundTweakedHook.ReadHookType(datReader); break; case AnimationHookType.SetOmega: h._hook = SetOmegaHook.ReadHookType(datReader); break; case AnimationHookType.TextureVelocity: h._hook = TextureVelocityHook.ReadHookType(datReader); break; case AnimationHookType.TextureVelocityPart: h._hook = TextureVelocityPartHook.ReadHookType(datReader); break; case AnimationHookType.SetLight: h._hook = SetLightHook.ReadHookType(datReader); break; } return(h); }
public static AnimationHook ReadHook(BinaryReader reader) { // We peek forward to get the hook type, then revert our position. var hookType = (AnimationHookType)reader.ReadUInt32(); reader.BaseStream.Position -= 4; AnimationHook hook; switch (hookType) { case AnimationHookType.Sound: hook = new SoundHook(); break; case AnimationHookType.SoundTable: hook = new SoundTableHook(); break; case AnimationHookType.Attack: hook = new AttackHook(); break; case AnimationHookType.ReplaceObject: hook = new ReplaceObjectHook(); break; case AnimationHookType.Ethereal: hook = new EtherealHook(); break; case AnimationHookType.TransparentPart: hook = new TransparentPartHook(); break; case AnimationHookType.Luminous: hook = new LuminousHook(); break; case AnimationHookType.LuminousPart: hook = new LuminousPartHook(); break; case AnimationHookType.Diffuse: hook = new DiffuseHook(); break; case AnimationHookType.DiffusePart: hook = new DiffusePartHook(); break; case AnimationHookType.Scale: hook = new ScaleHook(); break; case AnimationHookType.CreateParticle: hook = new CreateParticleHook(); break; case AnimationHookType.DestroyParticle: hook = new DestroyParticleHook(); break; case AnimationHookType.StopParticle: hook = new StopParticleHook(); break; case AnimationHookType.NoDraw: hook = new NoDrawHook(); break; case AnimationHookType.DefaultScriptPart: hook = new DefaultScriptPartHook(); break; case AnimationHookType.CallPES: hook = new CallPESHook(); break; case AnimationHookType.Transparent: hook = new TransparentHook(); break; case AnimationHookType.SoundTweaked: hook = new SoundTweakedHook(); break; case AnimationHookType.SetOmega: hook = new SetOmegaHook(); break; case AnimationHookType.TextureVelocity: hook = new TextureVelocityHook(); break; case AnimationHookType.TextureVelocityPart: hook = new TextureVelocityPartHook(); break; case AnimationHookType.SetLight: hook = new SetLightHook(); break; case AnimationHookType.CreateBlockingParticle: hook = new CreateBlockingParticle(); break; // The following HookTypes have no additional properties: // AnimationHookType.AnimationDone // AnimationHookType.DefaultScript case AnimationHookType.AnimationDone: case AnimationHookType.DefaultScript: hook = new AnimationHook(); break; default: log.Warn($"Not Implemented Hook type encountered: {hookType}"); hook = null; break; } if (hook != null) { hook.Unpack(reader); } return(hook); }