コード例 #1
0
        MonoBehaviourSingletonLazyCreator AddCreator(MonoBehaviourSingletonId id)
        {
            MonoBehaviourSingletonLazyCreator creator;

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

            return(creator);
        }
コード例 #2
0
        MonoBehaviourSingletonLazyCreator AddCreator(MonoBehaviourSingletonId id)
        {
            MonoBehaviourSingletonLazyCreator creator;

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

            return creator;
        }
コード例 #3
0
        public MonoBehaviourSingletonProvider(
            MonoBehaviourSingletonId monoBehaviourId,
            Type componentType,
            MonoBehaviourSingletonLazyCreator lazyCreator,
            SingletonRegistry singletonRegistry,
            MonoBehaviourSingletonProviderCreator owner)
        {
            _owner = owner;
            Assert.That(componentType.DerivesFromOrEqual <Component>());

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

            Init();
        }
コード例 #4
0
        public MonoBehaviourSingletonProvider(
            MonoBehaviourSingletonId monoBehaviourId,
            Type componentType,
            MonoBehaviourSingletonLazyCreator lazyCreator,
            SingletonRegistry singletonRegistry,
            MonoBehaviourSingletonProviderCreator owner)
        {
            _owner = owner;
            Assert.That(componentType.DerivesFromOrEqual<Component>());

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

            Init();
        }