예제 #1
0
        public void TearDown()
        {
            // Unregister Photon serializer/deserializer callbacks for the types

            PhotonRegisterSerializers registerSerializers = new PhotonRegisterSerializers();

            registerSerializers.DeregisterSerializer(typeof(NullMembers));
            registerSerializers.DeregisterSerializer(typeof(ConcreteChildById));
            registerSerializers.DeregisterSerializer(typeof(AbstractBaseById));
            registerSerializers.DeregisterSerializer(typeof(ConcreteChildByValue));
            registerSerializers.DeregisterSerializer(typeof(AbstractBaseByValue));

            // Deregister types & destroy type registries

            NetworkableId <Type> .Remove(typeof(NullMembers));

            NetworkableId <Type> .Remove(typeof(AbstractBaseById));

            NetworkableId <Type> .Remove(typeof(ConcreteChildById));

            NetworkableId <AbstractBaseById> .Destroy();

            NetworkableId <ConcreteChildById> .Destroy();

            NetworkableIdRegistry.DestroyRootRegistry(typeof(AbstractBaseById));

            NetworkableId <Type> .Remove(typeof(AbstractBaseByValue));

            NetworkableId <Type> .Remove(typeof(ConcreteChildByValue));

            NetworkableId <Type> .Destroy();

            NetworkableIdRegistry.DestroyRootRegistry(typeof(Type));
        }
예제 #2
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));
        }