예제 #1
0
 public SerializableTypeInfo(Type type, byte id, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
 {
     this.Type = type;
     this.Id   = id;
     this.SerializeStreamFunction   = serializeFunction;
     this.DeserializeStreamFunction = deserializeFunction;
 }
예제 #2
0
 public CustomType(Type type, byte code, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
 {
     this.Type = type;
     this.Code = code;
     this.SerializeStreamFunction   = serializeFunction;
     this.DeserializeStreamFunction = deserializeFunction;
 }
예제 #3
0
        /// <summary>
        /// Register serialization & deserialization mechanisms for transmitting the given class by ID.
        /// The given class does not need to implements its own serialization logic.
        /// </summary>
        public static void RegisterSerializerAndDeserializer(Type type)
        {
            int id = NetworkableId <Type> .ToId(type);

            Debug.Log("Using id " + id + " for tagging of class " + type.Name + " in network messages when sending/receiving NetworkableById types");

            // Construct SerializerAndDeserializer<type>

            Type serializerAndDeserializerType            = typeof(SerializerAndDeserializer <>);
            Type serializerAndDeserializerTypeSpecialized = serializerAndDeserializerType.MakeGenericType(type);

            // Find a method Serialize(StreamBuffer, object) in SerializerAndDeserializer<type>

            MethodInfo serializeMethodInfo = serializerAndDeserializerTypeSpecialized.GetMethod("Serialize", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, null, new Type[] { typeof(StreamBuffer), typeof(object) }, null);

            Assert.IsNotNull(serializeMethodInfo, "Unable to find virtual Serialize(StreamBuffer, object) method in " + serializerAndDeserializerTypeSpecialized.Name);
            SerializeStreamMethod serializer = (SerializeStreamMethod)Delegate.CreateDelegate(typeof(SerializeStreamMethod), serializeMethodInfo);

            // Find a method Deserialize(StreamBuffer, short) in SerializerAndDeserializer<type>

            MethodInfo deserializeMethodInfo = serializerAndDeserializerTypeSpecialized.GetMethod("Deserialize", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, null, new Type[] { typeof(StreamBuffer), typeof(short) }, null);

            Assert.IsNotNull(serializeMethodInfo, "Unable to find static Deserialize(StreamBuffer, short) method in " + serializerAndDeserializerTypeSpecialized.Name);
            DeserializeStreamMethod deserializer = (DeserializeStreamMethod)Delegate.CreateDelegate(typeof(DeserializeStreamMethod), deserializeMethodInfo);

            // Register serializer and deserializer methods for class

            bool success = PhotonPeer.RegisterType(type, (byte)id, serializer, deserializer);

            Assert.IsTrue(success, "Failed registering new serialization type for " + type.Name + " with code " + id);
        }
    // Token: 0x0600AC81 RID: 44161 RVA: 0x003FAE4C File Offset: 0x003F904C
    internal static void FJPBNMBIOHG()
    {
        Type typeFromHandle = typeof(Vector2);
        byte code           = 87;

        if (GOLJCGMCKMG.BOGJGOAMCHK == null)
        {
            GOLJCGMCKMG.BOGJGOAMCHK = new SerializeStreamMethod(GOLJCGMCKMG.LCNMHEMBEFI);
        }
        SerializeStreamMethod bogjgoamchk = GOLJCGMCKMG.BOGJGOAMCHK;

        if (GOLJCGMCKMG.BDPNFNJNEFM == null)
        {
            GOLJCGMCKMG.BDPNFNJNEFM = new DeserializeStreamMethod(GOLJCGMCKMG.HANJLNGFAKP);
        }
        PhotonPeer.RegisterType(typeFromHandle, code, bogjgoamchk, GOLJCGMCKMG.BDPNFNJNEFM);
        Type typeFromHandle2 = typeof(Vector3);
        byte code2           = 86;

        if (GOLJCGMCKMG.MJKNAFJKDMG == null)
        {
            GOLJCGMCKMG.MJKNAFJKDMG = new SerializeStreamMethod(GOLJCGMCKMG.ANBBLBLNDBH);
        }
        SerializeStreamMethod mjknafjkdmg = GOLJCGMCKMG.MJKNAFJKDMG;

        if (GOLJCGMCKMG.JENGHDFDLII == null)
        {
            GOLJCGMCKMG.JENGHDFDLII = new DeserializeStreamMethod(GOLJCGMCKMG.BFLLDNIBMHP);
        }
        PhotonPeer.RegisterType(typeFromHandle2, code2, mjknafjkdmg, GOLJCGMCKMG.JENGHDFDLII);
        Type typeFromHandle3 = typeof(Quaternion);
        byte code3           = 81;

        if (GOLJCGMCKMG.BMJHMBNEACI == null)
        {
            GOLJCGMCKMG.BMJHMBNEACI = new SerializeStreamMethod(GOLJCGMCKMG.PKPCNJJBOJB);
        }
        SerializeStreamMethod bmjhmbneaci = GOLJCGMCKMG.BMJHMBNEACI;

        if (GOLJCGMCKMG.EPENHHMDDMB == null)
        {
            GOLJCGMCKMG.EPENHHMDDMB = new DeserializeStreamMethod(GOLJCGMCKMG.BNPJAGNEBPN);
        }
        PhotonPeer.RegisterType(typeFromHandle3, code3, bmjhmbneaci, GOLJCGMCKMG.EPENHHMDDMB);
        Type typeFromHandle4 = typeof(PhotonPlayer);
        byte code4           = 80;

        if (GOLJCGMCKMG.DNLDPCIINIC == null)
        {
            GOLJCGMCKMG.DNLDPCIINIC = new SerializeStreamMethod(GOLJCGMCKMG.AJKFOONFMDK);
        }
        SerializeStreamMethod dnldpciinic = GOLJCGMCKMG.DNLDPCIINIC;

        if (GOLJCGMCKMG.ILAKDECCIME == null)
        {
            GOLJCGMCKMG.ILAKDECCIME = new DeserializeStreamMethod(GOLJCGMCKMG.AEKFJLLFGFB);
        }
        PhotonPeer.RegisterType(typeFromHandle4, code4, dnldpciinic, GOLJCGMCKMG.ILAKDECCIME);
    }
예제 #5
0
    // Token: 0x06003B8E RID: 15246 RVA: 0x0012B9A0 File Offset: 0x00129DA0
    internal static void Register()
    {
        Type typeFromHandle = typeof(Vector2);
        byte code           = 87;

        if (CustomTypes.f__mg == null)
        {
            CustomTypes.f__mg = new SerializeStreamMethod(CustomTypes.SerializeVector2);
        }
        SerializeStreamMethod serializeMethod = CustomTypes.f__mg;

        if (CustomTypes.f__mg1 == null)
        {
            CustomTypes.f__mg1 = new DeserializeStreamMethod(CustomTypes.DeserializeVector2);
        }
        PhotonPeer.RegisterType(typeFromHandle, code, serializeMethod, CustomTypes.f__mg1);
        Type typeFromHandle2 = typeof(Vector3);
        byte code2           = 86;

        if (CustomTypes.f__mg2 == null)
        {
            CustomTypes.f__mg2 = new SerializeStreamMethod(CustomTypes.SerializeVector3);
        }
        SerializeStreamMethod serializeMethod2 = CustomTypes.f__mg2;

        if (CustomTypes.f__mg3 == null)
        {
            CustomTypes.f__mg3 = new DeserializeStreamMethod(CustomTypes.DeserializeVector3);
        }
        PhotonPeer.RegisterType(typeFromHandle2, code2, serializeMethod2, CustomTypes.f__mg3);
        Type typeFromHandle3 = typeof(Quaternion);
        byte code3           = 81;

        if (CustomTypes.f__mg4 == null)
        {
            CustomTypes.f__mg4 = new SerializeStreamMethod(CustomTypes.SerializeQuaternion);
        }
        SerializeStreamMethod serializeMethod3 = CustomTypes.f__mg4;

        if (CustomTypes.f__mg5 == null)
        {
            CustomTypes.f__mg5 = new DeserializeStreamMethod(CustomTypes.DeserializeQuaternion);
        }
        PhotonPeer.RegisterType(typeFromHandle3, code3, serializeMethod3, CustomTypes.f__mg5);
        Type typeFromHandle4 = typeof(PhotonPlayer);
        byte code4           = 80;

        if (CustomTypes.f__mg6 == null)
        {
            CustomTypes.f__mg6 = new SerializeStreamMethod(CustomTypes.SerializePhotonPlayer);
        }
        SerializeStreamMethod serializeMethod4 = CustomTypes.f__mg6;

        if (CustomTypes.f__mg7 == null)
        {
            CustomTypes.f__mg7 = new DeserializeStreamMethod(CustomTypes.DeserializePhotonPlayer);
        }
        PhotonPeer.RegisterType(typeFromHandle4, code4, serializeMethod4, CustomTypes.f__mg7);
    }
예제 #6
0
        public static void RegisterType(Type type, byte id, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
        {
            if (TypeDict.ContainsKey(type) || IdDict.ContainsKey(id))
            {
                throw new Exception("Type Already Registed :" + type + "/" + id);
            }
            SerializableTypeInfo customType = new SerializableTypeInfo(type, id, serializeFunction, deserializeFunction);

            TypeDict.Add(type, customType);
            IdDict.Add(id, customType);
        }
예제 #7
0
        public static bool TryRegisterType(Type type, byte typeCode, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
        {
            if (CodeDict.ContainsKey(typeCode) || TypeDict.ContainsKey(type))
            {
                return(false);
            }
            CustomType value = new CustomType(type, typeCode, serializeFunction, deserializeFunction);

            CodeDict.Add(typeCode, value);
            TypeDict.Add(type, value);
            return(true);
        }
예제 #8
0
        public static bool TryRegisterType(Type type, byte typeCode, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
        {
            bool flag = Protocol.CodeDict.ContainsKey(typeCode) || Protocol.TypeDict.ContainsKey(type);
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                CustomType value = new CustomType(type, typeCode, serializeFunction, deserializeFunction);
                Protocol.CodeDict.Add(typeCode, value);
                Protocol.TypeDict.Add(type, value);
                result = true;
            }
            return(result);
        }
예제 #9
0
 public static bool RegisterType(Type customType, byte code, SerializeStreamMethod serializeMethod, DeserializeStreamMethod constructor)
 {
     return(Protocol.TryRegisterType(customType, code, serializeMethod, constructor));
 }
예제 #10
0
 public static bool TryRegisterType(Type type, byte typeCode, SerializeMethod serializeFunction, DeserializeMethod deserializeFunction) => default;             // 0x00000001806C6660-0x00000001806C6830
 public static bool TryRegisterType(Type type, byte typeCode, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction) => default; // 0x00000001806C6490-0x00000001806C6660
예제 #11
0
        }                                                                                                                            // 0x00000001806ACFB0-0x00000001806AD020

        public CustomType(Type type, byte code, SerializeStreamMethod serializeFunction, DeserializeStreamMethod deserializeFunction)
        {
        }                                                                                                                                        // 0x00000001806AD020-0x00000001806AD090