private static void Serialize(this SerializingContainer2 sc, LightMap_5 lmap) { sc.Serialize(ref lmap.LightGuids, SCExt.Serialize); sc.Serialize(ref lmap.unkInt); sc.SerializeBulkData(ref lmap.SimpleSamples, Serialize); sc.Serialize(ref lmap.unkVector); }
public static void Serialize(this SerializingContainer2 sc, ref LightMap lmap) { if (sc.IsLoading) { var type = (ELightMapType)sc.ms.ReadInt32(); switch (type) { case ELightMapType.LMT_None: lmap = new LightMap(); break; case ELightMapType.LMT_1D: lmap = new LightMap_1D(); break; case ELightMapType.LMT_2D: lmap = new LightMap_2D(); break; case ELightMapType.LMT_3: lmap = new LightMap_3(); break; case ELightMapType.LMT_4: case ELightMapType.LMT_6: lmap = new LightMap_4or6(); break; case ELightMapType.LMT_5: lmap = new LightMap_5(); break; default: throw new ArgumentOutOfRangeException(); } lmap.LightMapType = type; } else { if (sc.Game != MEGame.ME3 && lmap.LightMapType > ELightMapType.LMT_2D) { lmap = new LightMap(); } sc.ms.Writer.WriteInt32((int)lmap.LightMapType); } switch (lmap.LightMapType) { case ELightMapType.LMT_None: break; case ELightMapType.LMT_1D: sc.Serialize((LightMap_1D)lmap); break; case ELightMapType.LMT_2D: sc.Serialize((LightMap_2D)lmap); break; case ELightMapType.LMT_3: sc.Serialize((LightMap_3)lmap); break; case ELightMapType.LMT_4: case ELightMapType.LMT_6: sc.Serialize((LightMap_4or6)lmap); break; case ELightMapType.LMT_5: sc.Serialize((LightMap_5)lmap); break; default: throw new ArgumentOutOfRangeException(); } }