예제 #1
0
        public bool Has(Type type)
        {
            bool hasType = _instanceCache.ContainsKey(type) || _typeMap.ContainsKey(type);

            if (!hasType && _parent != null)
            {
                hasType = _parent.Has(type);
            }

            return(hasType);
        }
예제 #2
0
파일: Commands.cs 프로젝트: zOrder/ugui
        IBaseCommand GetCommand(Type type)
        {
            Queue <IBaseCommand> cachedCommands;
            bool hasCached = _cache.TryGetValue(type, out cachedCommands) && cachedCommands.Count > 0;

            IBaseCommand command;

            if (hasCached)
            {
                command = cachedCommands.Dequeue();
            }
            else
            {
                if (!injector.Has(type))
                {
                    injector.Register(type, type, true);
                }

                command           = injector.Get <IBaseCommand>(type);
                command.onFinish += OnFinish;
            }

            return(command);
        }