示例#1
0
 private static void Serialize(this SerializingContainer2 sc, LightMap_3 lmap)
 {
     sc.Serialize(ref lmap.LightGuids, Serialize);
     sc.Serialize(ref lmap.unkInt);
     sc.SerializeBulkData(ref lmap.DirectionalSamples, Serialize);
     sc.Serialize(ref lmap.unkVector1);
     sc.Serialize(ref lmap.unkVector2);
 }
示例#2
0
        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
            {
                sc.ms.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();
            }
        }