Пример #1
0
        public void SetUp()
        {
            NetworkableId <Type> .Create(null);

            // Assign IDs for all networkable types

            NetworkableId <Type> .AddWithId(typeof(AbstractBaseByValue), 128);

            NetworkableId <Type> .AddWithId(typeof(ConcreteChildByValue), 129);

            NetworkableId <Type> .AddWithId(typeof(AbstractBaseById), 130);

            NetworkableId <Type> .AddWithId(typeof(ConcreteChildById), 131);

            NetworkableId <Type> .AddWithId(typeof(NullMembers), 132);

            // Items that get networked by ID need to have an ID hierarchy setup

            NetworkableId <AbstractBaseById> .Create(null);

            NetworkableId <ConcreteChildById> .Create(typeof(AbstractBaseById));

            // Register Photon serializer/deserializer callbacks for the types

            PhotonRegisterSerializers registerSerializers = new PhotonRegisterSerializers();

            registerSerializers.RegisterSerializersForDefaultObjectType(typeof(AbstractBaseByValue));
            registerSerializers.RegisterSerializersForValueType(typeof(ConcreteChildByValue));
            registerSerializers.RegisterSerializersForDefaultObjectType(typeof(AbstractBaseById));
            registerSerializers.RegisterSerializersForIdType(typeof(ConcreteChildById));
            registerSerializers.RegisterSerializersForValueType(typeof(NullMembers));
        }
Пример #2
0
 static void RegisterNetworkableId(Type type, int id)
 {
     NetworkableId <Type> .AddWithId(type, id);
 }