コード例 #1
0
ファイル: KS_SaveLoad.cs プロジェクト: luodongfu/ks-framework
        private static void AddSurrogates(ref SurrogateSelector ss)
        {
            Vector3Surrogate vector = new Vector3Surrogate();

            ss.AddSurrogate(typeof(Vector3),
                            new StreamingContext(StreamingContextStates.All),
                            vector);
            QuaternionSurrogate quaternion = new QuaternionSurrogate();

            ss.AddSurrogate(typeof(Quaternion),
                            new StreamingContext(StreamingContextStates.All),
                            quaternion);
            TransformSurrogate transform = new TransformSurrogate();

            ss.AddSurrogate(typeof(Transform),
                            new StreamingContext(StreamingContextStates.All),
                            transform);
            ColourSurrogate colour = new ColourSurrogate();

            ss.AddSurrogate(typeof(Color),
                            new StreamingContext(StreamingContextStates.All),
                            colour);
            CameraSurrogate camera = new CameraSurrogate();

            ss.AddSurrogate(typeof(Camera),
                            new StreamingContext(StreamingContextStates.All),
                            camera);

            foreach (KeyValuePair <ISerializationSurrogate, Type> kv in surrogateList)
            {
                ss.AddSurrogate(kv.Value,
                                new StreamingContext(StreamingContextStates.All),
                                kv.Key);
            }
        }
コード例 #2
0
    public static void AddSurrogates(ref SurrogateSelector surrogateSelector)
    {
        Vector3Surrogate Vector3_SS = new Vector3Surrogate();

        surrogateSelector.AddSurrogate(typeof(Vector3), new StreamingContext(StreamingContextStates.All), Vector3_SS);

        Texture2DSurrogate Texture2D_SS = new Texture2DSurrogate();

        surrogateSelector.AddSurrogate(typeof(Texture2D), new StreamingContext(StreamingContextStates.All), Texture2D_SS);

        ColourSurrogate Color_SS = new ColourSurrogate();

        surrogateSelector.AddSurrogate(typeof(Color), new StreamingContext(StreamingContextStates.All), Color_SS);

        GameObjectSurrogate GameObject_SS = new GameObjectSurrogate();

        surrogateSelector.AddSurrogate(typeof(GameObject), new StreamingContext(StreamingContextStates.All), GameObject_SS);

        TransformSurrogate Transform_SS = new TransformSurrogate();

        surrogateSelector.AddSurrogate(typeof(Transform), new StreamingContext(StreamingContextStates.All), Transform_SS);

        QuaternionSurrogate Quaternion_SS = new QuaternionSurrogate();

        surrogateSelector.AddSurrogate(typeof(Quaternion), new StreamingContext(StreamingContextStates.All), Quaternion_SS);
    }