Exemplo n.º 1
0
        PrefabResourceSingletonLazyCreator AddCreator(PrefabResourceSingletonId id)
        {
            PrefabResourceSingletonLazyCreator creator;

            if (!_creators.TryGetValue(id, out creator))
            {
                creator = new PrefabResourceSingletonLazyCreator(_container, this, id);
                _creators.Add(id, creator);
            }

            return(creator);
        }
        public PrefabResourceSingletonProvider(
            PrefabResourceSingletonId resourceId, Type componentType,
            PrefabResourceSingletonLazyCreator lazyCreator,
            SingletonRegistry singletonRegistry,
            PrefabResourceSingletonProviderCreator owner)
        {
            _owner = owner;
            Assert.That(componentType.DerivesFromOrEqual <Component>());

            _singletonRegistry = singletonRegistry;
            _lazyCreator       = lazyCreator;
            _componentType     = componentType;
            _resourceId        = resourceId;
            _singletonId       = new SingletonId(componentType, resourceId.ConcreteIdentifier);

            Init();
        }
        public PrefabResourceSingletonProvider(
            PrefabResourceSingletonId resourceId, Type componentType,
            PrefabResourceSingletonLazyCreator lazyCreator,
            SingletonRegistry singletonRegistry,
            PrefabResourceSingletonProviderCreator owner)
        {
            _owner = owner;
            Assert.That(componentType.DerivesFromOrEqual<Component>());

            _singletonRegistry = singletonRegistry;
            _lazyCreator = lazyCreator;
            _componentType = componentType;
            _resourceId = resourceId;
            _singletonId = new SingletonId(componentType, resourceId.ConcreteIdentifier);

            Init();
        }
        PrefabResourceSingletonLazyCreator AddCreator(PrefabResourceSingletonId id)
        {
            PrefabResourceSingletonLazyCreator creator;

            if (!_creators.TryGetValue(id, out creator))
            {
                creator = new PrefabResourceSingletonLazyCreator(_container, this, id);
                _creators.Add(id, creator);
            }

            return creator;
        }