// ---- METHODS ------------------------------------------------------------------------------------------------ void IResData.Load(BfshaFileLoader loader) { long FrameArrayOffset = loader.ReadOffset(); long KeyArrayOffset = loader.ReadOffset(); _flags = loader.ReadUInt16(); ushort numKey = loader.ReadUInt16(); AnimDataOffset = loader.ReadUInt32(); StartFrame = loader.ReadSingle(); EndFrame = loader.ReadSingle(); Scale = loader.ReadSingle(); Offset = loader.ReadSingle(); Delta = loader.ReadSingle(); int padding = loader.ReadInt32(); Frames = loader.LoadCustom(() => { switch (FrameType) { case AnimCurveFrameType.Single: return(loader.ReadSingles(numKey)); case AnimCurveFrameType.Decimal10x5: float[] dec10x5Frames = new float[numKey]; for (int i = 0; i < numKey; i++) { dec10x5Frames[i] = (float)loader.ReadDecimal10x5(); } return(dec10x5Frames); case AnimCurveFrameType.Byte: float[] byteFrames = new float[numKey]; for (int i = 0; i < numKey; i++) { byteFrames[i] = loader.ReadByte(); } return(byteFrames); default: throw new ResException($"Invalid {nameof(FrameType)}."); } }, FrameArrayOffset); Keys = loader.LoadCustom(() => { int elementsPerKey = ElementsPerKey; float[,] keys = new float[numKey, elementsPerKey]; switch (KeyType) { case AnimCurveKeyType.Single: for (int i = 0; i < numKey; i++) { for (int j = 0; j < elementsPerKey; j++) { keys[i, j] = loader.ReadSingle(); } } break; case AnimCurveKeyType.Int16: for (int i = 0; i < numKey; i++) { for (int j = 0; j < elementsPerKey; j++) { keys[i, j] = loader.ReadInt16(); } } break; case AnimCurveKeyType.SByte: for (int i = 0; i < numKey; i++) { for (int j = 0; j < elementsPerKey; j++) { keys[i, j] = loader.ReadSByte(); } } break; default: throw new ResException($"Invalid {nameof(KeyType)}."); } return(keys); }, KeyArrayOffset); }