public override void Initialize(IComponentManager componentManager)
 {
     _editableMeshResolver = componentManager.GetComponent <IEditableMeshResolver>();
     _sceneManager         = componentManager.GetComponent <SceneManager>();
     _selectionManager     = componentManager.GetComponent <SelectionManager>();
     _resourceLib          = componentManager.GetComponent <ResourceLibary>();
 }
コード例 #2
0
 public EntityManager(IComponentManager componentManager)
 {
     entities            = new Dictionary <UniqueId, Entity>();
     filteredCollections = new Dictionary <int, FilteredCollection>();
     components          = componentManager;
     templateCollections = new TemplateCollections(this);
 }
コード例 #3
0
 public BmiViewModel(GameSkeleton skeleton, Rmv2MeshNode meshNode, IComponentManager componentManager)
 {
     _componentManager = componentManager;
     _meshNode         = meshNode;
     _skeleton         = skeleton;
     CreateBoneOverview(_skeleton);
 }
コード例 #4
0
        public IEnumerable <IOperationProvider> Process(IComponentManager componentManager, JObject rawConfiguration, IDirectory templateRoot, IVariableCollection variables, IParameterSet parameters)
        {
            IReadOnlyList <string> ifToken               = rawConfiguration.ArrayAsStrings("if");
            IReadOnlyList <string> elseToken             = rawConfiguration.ArrayAsStrings("else");
            IReadOnlyList <string> elseIfToken           = rawConfiguration.ArrayAsStrings("elseif");
            IReadOnlyList <string> actionableIfToken     = rawConfiguration.ArrayAsStrings("actionableIf");
            IReadOnlyList <string> actionableElseToken   = rawConfiguration.ArrayAsStrings("actionableElse");
            IReadOnlyList <string> actionableElseIfToken = rawConfiguration.ArrayAsStrings("actionableElseif");
            IReadOnlyList <string> actionsToken          = rawConfiguration.ArrayAsStrings("actions");
            IReadOnlyList <string> endIfToken            = rawConfiguration.ArrayAsStrings("endif");
            string id        = rawConfiguration.ToString("id");
            bool   trim      = rawConfiguration.ToBool("trim");
            bool   wholeLine = rawConfiguration.ToBool("wholeLine");

            string             evaluatorName = rawConfiguration.ToString("evaluator");
            ConditionEvaluator evaluator     = EvaluatorSelector.Select(evaluatorName);

            ConditionalTokens tokenVariants = new ConditionalTokens
            {
                IfTokens               = ifToken,
                ElseTokens             = elseToken,
                ElseIfTokens           = elseIfToken,
                EndIfTokens            = endIfToken,
                ActionableElseIfTokens = actionableElseIfToken,
                ActionableElseTokens   = actionableElseToken,
                ActionableIfTokens     = actionableIfToken,
                ActionableOperations   = actionsToken
            };

            yield return(new Conditional(tokenVariants, wholeLine, trim, evaluator, id));
        }
コード例 #5
0
ファイル: EntityInfo.cs プロジェクト: sbarski/cormo
 public AuditorSetter(IComponentManager manager, FieldInfo field)
 {
     _manager     = manager;
     _member      = field;
     _auditorFunc = GetAuditorFunc(field.FieldType);
     _setterFunc  = field.SetValue;
 }
コード例 #6
0
        internal GlobalRunSpec(
            IDirectory templateRoot,
            IComponentManager componentManager,
            IParameterSet parameters,
            IVariableCollection variables,
            IGlobalRunConfig globalConfig,
            IReadOnlyList <KeyValuePair <string, IGlobalRunConfig> > fileGlobConfigs,
            IReadOnlyList <string> ignoreFileNames)
        {
            EnsureOperationConfigs(componentManager);

            RootVariableCollection = variables;
            IgnoreFileNames        = ignoreFileNames;
            Operations             = ResolveOperations(globalConfig, templateRoot, variables, parameters);
            List <KeyValuePair <IPathMatcher, IRunSpec> > specials = new List <KeyValuePair <IPathMatcher, IRunSpec> >();

            if (fileGlobConfigs != null)
            {
                foreach (KeyValuePair <string, IGlobalRunConfig> specialEntry in fileGlobConfigs)
                {
                    IReadOnlyList <IOperationProvider> specialOps = null;

                    if (specialEntry.Value != null)
                    {
                        specialOps = ResolveOperations(specialEntry.Value, templateRoot, variables, parameters);
                    }

                    RunSpec spec = new RunSpec(specialOps, specialEntry.Value.VariableSetup.FallbackFormat);
                    specials.Add(new KeyValuePair <IPathMatcher, IRunSpec>(new GlobbingPatternMatcher(specialEntry.Key), spec));
                }
            }

            Special = specials;
        }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="componentManager">componentManager</param>
 /// <param name="consulSetting">服务发现配置</param>
 /// <param name="deregisterAction">取消注册委托,当程序关闭或服务下线时,该委托会取消服务注册</param>
 /// <returns></returns>
 public static IComponentManager UseConsul(this IComponentManager componentManager, ConsulSetting consulSetting)
 {
     _consulSetting = consulSetting;
     initConsul(componentManager);
     componentManager.RegisterAssembly(typeof(ComponentManagerExtend).Assembly);
     return(componentManager);
 }
コード例 #8
0
        private Action GetCommandAction(List <string> args)
        {
            UInt32 id;

            if (args.Count < 1)
            {
                _logger.LogError($"Get command requires >= 1 args: either an Entity id or a manager name and Entity id;");
            }
            else if (args.Count == 1)
            {
                if (!ValidateId(args[0], out id))
                {
                    return(null);
                }
                var living = _manager.Alive(id) ? "alive" : "not alive";
                _logger.LogInformation($"Entity {args[0]} is {living}");
            }
            else if (args.Count > 1)
            {
                IComponentManager manager = _collection.GetManagerByName(args[0]);
                if (manager == null)
                {
                    return(null);
                }
                if (!ValidateId(args[1], out id))
                {
                    return(null);
                }
                _logger.LogInformation($"{manager.GetInstance(id)}");
            }
            return(null);
        }
コード例 #9
0
ファイル: MacrosConfig.cs プロジェクト: livarcocc/templating
        public IEnumerable <IOperationProvider> Process(IComponentManager componentManager, JObject rawConfiguration, IDirectory templateRoot, IVariableCollection variables, IParameterSet parameters)
        {
            EnsureMacros(componentManager);

            ParameterSetter setter = (p, value) =>
            {
                ((RunnableProjectGenerator.ParameterSet)parameters).AddParameter(p);
                parameters.ResolvedValues[p] = value;
            };

            foreach (JProperty property in rawConfiguration.Properties())
            {
                string  variableName = property.Name;
                JObject def          = (JObject)property.Value;
                string  macroType    = def["type"].ToString();

                IMacro macroObject;
                if (_macros.TryGetValue(macroType, out macroObject))
                {
                    macroObject.Evaluate(variableName, variables, def, parameters, setter);
                }
            }

            return(Empty <IOperationProvider> .List.Value);
        }
コード例 #10
0
        public static IComponentManager UseExceptionless(this IComponentManager componentManager, ExceptionlessSetting exceptionlessSetting)
        {
            initExceptionless(exceptionlessSetting);

            componentManager.RegisterAssembly(typeof(ComponentManagerExtend).Assembly);
            return(componentManager);
        }
コード例 #11
0
        public InjectParameterBinding(IComponentManager manager, HttpParameterDescriptor descriptor)
            : base(descriptor)
        {
            var reflectedDescriptor = descriptor as ReflectedHttpParameterDescriptor;

            if (reflectedDescriptor != null)
            {
                try
                {
                    var param          = reflectedDescriptor.ParameterInfo;
                    var controllerType = param.Member.ReflectedType;

                    var declaringComponent = manager.GetComponent(controllerType);
                    var binders            = descriptor.GetCustomAttributes <Attribute>().GetAttributesRecursive <IBinderAttribute>()
                                             .Union(new [] { UnwrapAttributeInstance })
                                             .ToArray();

                    var injectionPoint = new MethodParameterInjectionPoint(declaringComponent, param, binders);
                    var component      = injectionPoint.Component;
                    _injectionPoint = injectionPoint;
                }
                catch (UnsatisfiedDependencyException)
                {
                    // Not managed by cormo. Nothing here
                }
            }
        }
コード例 #12
0
ファイル: Bootstrapper.cs プロジェクト: LaosanShang/LsAdmin
        /// <summary>
        /// 初始化 Ls 框架。
        /// </summary>
        public virtual void Initialize()
        {
            IocManager.IocContainer.Install(new LsInstaller());

            _componentManager = IocManager.Resolve <IComponentManager>();
            _componentManager.InitializeComponents();
        }
コード例 #13
0
 /// <summary>
 /// 指定したコンポーネント管理クラスのシーンがプリロードしたシーンの使用をやめる
 /// </summary>
 /// <param name="releasePreloader"></param>
 private void UnsetPreloader(IComponentManager releasePreloader)
 {
     foreach (KeyValuePair <SceneCondition, HashSet <IComponentManager> > preloader in _preloaders)
     {
         preloader.Value.Remove(releasePreloader);
     }
 }
コード例 #14
0
ファイル: GraphicEntity.cs プロジェクト: GreyArmor/d3dlab
 internal GraphicEntity(ElementTag tag, IComponentManager manager, IEntityManager emanager, EntityOrderContainer order)
 {
     this.order    = order;
     this.manager  = manager;
     this.emanager = emanager;
     Tag           = tag;
 }
コード例 #15
0
        public Task Create(ITemplate templateData, IParameterSet parameters, IComponentManager componentManager, out ICreationResult creationResult)
        {
            RunnableProjectTemplate template = (RunnableProjectTemplate)templateData;

            ProcessMacros(componentManager, template.Config.OperationConfig, parameters);

            IVariableCollection variables = VariableCollection.SetupVariables(parameters, template.Config.OperationConfig.VariableSetup);

            template.Config.Evaluate(parameters, variables, template.ConfigFile);

            IOrchestrator basicOrchestrator          = new Core.Util.Orchestrator();
            RunnableProjectOrchestrator orchestrator = new RunnableProjectOrchestrator(basicOrchestrator);

            GlobalRunSpec runSpec = new GlobalRunSpec(template.ConfigFile.Parent, componentManager, parameters, variables, template.Config.OperationConfig, template.Config.SpecialOperationConfig, template.Config.LocalizationOperations, template.Config.PlaceholderFilename);

            foreach (FileSource source in template.Config.Sources)
            {
                runSpec.SetupFileSource(source);
                string target = Path.Combine(Directory.GetCurrentDirectory(), source.Target);
                orchestrator.Run(runSpec, template.ConfigFile.Parent.DirectoryInfo(source.Source), target);
            }

            // todo: add anything else we'd want to report to the broker
            creationResult = new CreationResult()
            {
                PostActions    = PostAction.ListFromModel(template.Config.PostActionModel, variables),
                PrimaryOutputs = CreationPath.ListFromModel(template.Config.PrimaryOutputs, variables)
            };

            return(Task.FromResult(true));
        }
コード例 #16
0
 /// <summary>
 /// 指定したコンポーネント管理クラスのコンポーネントが使用している
 /// コンテントマネージャーの使用をやめる
 /// </summary>
 /// <param name="releaseUser"></param>
 private void UnsetContentManagerUser(IComponentManager releaseUser)
 {
     foreach (KeyValuePair <string, HashSet <IComponentManager> > user in _contentManagerUsers)
     {
         user.Value.Remove(releaseUser);
     }
 }
コード例 #17
0
        internal virtual IComponentManager CreateIComponentManager()
        {
            // TODO: 实例化相应的具体类。
            IComponentManager target = null;

            return(target);
        }
コード例 #18
0
ファイル: IncludeConfig.cs プロジェクト: livarcocc/templating
        public IEnumerable <IOperationProvider> Process(IComponentManager componentManager, JObject rawConfiguration, IDirectory templateRoot, IVariableCollection variables, IParameterSet parameters)
        {
            string startToken = rawConfiguration.ToString("start");
            string endToken   = rawConfiguration.ToString("end");
            string id         = rawConfiguration.ToString("id");

            yield return(new Include(startToken, endToken, x => templateRoot.FileInfo(x).OpenRead(), id));
        }
コード例 #19
0
 internal void Register(IComponentManager componentManager)
 {
     if (componentManager.Initialized)
     {
         return;
     }
     components.Add(componentManager);
 }
コード例 #20
0
        public void PostComponentMessageTest()
        {
            IComponentManager target           = CreateIComponentManager(); // TODO: 初始化为适当的值
            ComponentMessage  componentMessage = new ComponentMessage();    // TODO: 初始化为适当的值

            target.PostComponentMessage(componentMessage);
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
コード例 #21
0
        /// <summary>
        /// Constructor for SystemManager
        /// </summary>
        public SystemManager(IComponentManager pComponentManager)
        {
            // INSTANTIATE _systems
            _systems = new List <ISystem>();

            // INSTANTIATE _componentManager
            _componentManager = pComponentManager;
        }
コード例 #22
0
        public TransformToolViewModel(IComponentManager componentManager)
        {
            ApplyCommand      = new RelayCommand(ApplyTransform);
            _selectionManager = componentManager.GetComponent <SelectionManager>();
            _commandExecutor  = componentManager.GetComponent <CommandExecutor>();

            _selectionManager.SelectionChanged += SelectionChanged;
        }
コード例 #23
0
        public void Initialize (ScriptEngine module)
        {
            m_module = module;

            m_manager = module.Worlds[0].RequestModuleInterface<IComponentManager> ();
            DefaultComponents com = new DefaultComponents (m_componentName);
            m_manager.RegisterComponent (com);
        }
コード例 #24
0
        private void EnsureLoaded()
        {
            if (_isLoaded)
            {
                return;
            }

            string userSettings = null;

            using (Timing.Over("Read settings"))
                for (int i = 0; i < MaxLoadAttempts; ++i)
                {
                    try
                    {
                        userSettings = _paths.ReadAllText(_paths.User.SettingsFile, "{}");
                        break;
                    }
                    catch (IOException)
                    {
                        if (i == MaxLoadAttempts - 1)
                        {
                            throw;
                        }

                        Task.Delay(2).Wait();
                    }
                }
            JObject parsed;

            using (Timing.Over("Parse settings"))
                parsed = JObject.Parse(userSettings);
            using (Timing.Over("Deserialize user settings"))
                _userSettings = new SettingsStore(parsed);

            using (Timing.Over("Init probing paths"))
                if (_userSettings.ProbingPaths.Count == 0)
                {
                    _userSettings.ProbingPaths.Add(_paths.User.Content);
                }

            using (Timing.Over("Init Component manager"))
                _componentManager = new ComponentManager(this, _userSettings);
            using (Timing.Over("Init Mount Point manager"))
                _mountPointManager = new MountPointManager(_environmentSettings, _componentManager);

            using (Timing.Over("Demand template load"))
                EnsureTemplatesLoaded();

            _mountPoints = new Dictionary <Guid, MountPointInfo>();

            using (Timing.Over("Load mount points"))
                foreach (MountPointInfo info in _userSettings.MountPoints)
                {
                    _mountPoints[info.MountPointId] = info;
                }

            _isLoaded = true;
        }
コード例 #25
0
        /// <summary>
        /// シーンをプリロードしたシーンのコンポーネント管理クラスを登録する
        /// </summary>
        /// <param name="preloadSceneCondition"></param>
        /// <param name="preloader"></param>
        private void SetPreloader(SceneCondition preloadSceneCondition, IComponentManager preloader)
        {
            if (!_preloaders.ContainsKey(preloadSceneCondition))
            {
                _preloaders[preloadSceneCondition] = new HashSet <IComponentManager>();
            }

            _preloaders[preloadSceneCondition].Add(preloader);
        }
コード例 #26
0
 public FriendshipPunter(IScorer scorer)
 {
     this.scorer      = scorer;
     graphVisitor     = new GraphVisitor();
     componentManager = new ComponentManager(scorer);
     state            = new PunterState
     {
     };
 }
コード例 #27
0
        public void Initialize(ScriptEngine module)
        {
            m_module = module;

            m_manager = module.Worlds[0].RequestModuleInterface <IComponentManager> ();
            DefaultComponents com = new DefaultComponents(m_componentName);

            m_manager.RegisterComponent(com);
        }
コード例 #28
0
        /// <summary>
        /// あるコンテントマネージャーを使用するコンポーネントが所属するコンポーネントマネージャーを登録する
        /// </summary>
        /// <param name="contentManager"></param>
        /// <param name="user"></param>
        private void SetContentManagerUser(string contentManager, IComponentManager user)
        {
            if (!_contentManagerUsers.ContainsKey(contentManager))
            {
                _contentManagerUsers[contentManager] = new HashSet <IComponentManager>();
            }

            _contentManagerUsers[contentManager].Add(user);
        }
コード例 #29
0
ファイル: GameObject.cs プロジェクト: 1dxrpz/Planetarium
 public bool RemoveComponent(IComponentManager c)
 {
     if (!HasComponent(c))
     {
         return(false);
     }
     Components.Remove(c);
     return(true);
 }
コード例 #30
0
ファイル: GameObject.cs プロジェクト: 1dxrpz/Planetarium
 public bool AddComponent(IComponentManager c)
 {
     if (this.HasComponent(c))
     {
         return(false);
     }
     Components.Add(c);
     return(true);
 }
コード例 #31
0
        public void SubScribeComponentMessageTest()
        {
            IComponentManager target           = CreateIComponentManager(); // TODO: 初始化为适当的值
            ComponentId       componentId      = new ComponentId();         // TODO: 初始化为适当的值
            ComponentMessage  componentMessage = new ComponentMessage();    // TODO: 初始化为适当的值

            target.SubScribeComponentMessage(componentId, componentMessage);
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
コード例 #32
0
 public DefaultService()
 {
     manager = new ComponentsManager();
 }
コード例 #33
0
 public ControlWrapper()
 {
     _componentManager = ServiceLocator.Current.GetInstance<ComponentManager>();
 }
コード例 #34
0
 public ComponentService()
 {
     manager = new ComponentsManager();
 }
コード例 #35
0
 /// <summary>
 /// 指定したコンポーネント管理クラスのコンポーネントが使用している
 /// コンテントマネージャーの使用をやめる
 /// </summary>
 /// <param name="releaseUser"></param>
 private void UnsetContentManagerUser(IComponentManager releaseUser)
 {
     foreach (KeyValuePair<string, HashSet<IComponentManager>> user in _contentManagerUsers)
     {
         user.Value.Remove(releaseUser);
     }
 }
コード例 #36
0
        /// <summary>
        /// あるコンテントマネージャーを使用するコンポーネントが所属するコンポーネントマネージャーを登録する
        /// </summary>
        /// <param name="contentManager"></param>
        /// <param name="user"></param>
        private void SetContentManagerUser(string contentManager, IComponentManager user)
        {
            if (!_contentManagerUsers.ContainsKey(contentManager))
            {
                _contentManagerUsers[contentManager] = new HashSet<IComponentManager>();
            }

            _contentManagerUsers[contentManager].Add(user);
        }
コード例 #37
0
ファイル: GameClass.cs プロジェクト: Towanime/FeInwork
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            componentManager = BasicComponentManager.Instance;
            worldManager = WorldManager.Instance;
            collisionManager = CollisionManager.Instance;
            entityManager = EntityManager.Instance;
            // batch manager
            SpriteBatchManager.Instance.initialize(GraphicsDevice);

            if (isDebugMode)
            {
                gameDebug = GameDebug.Instance;
                gameConsole = XNAConsole.Instance;
            }

            base.Initialize();
        }
コード例 #38
0
 /// <summary>
 /// 指定したコンポーネント管理クラスのシーンがプリロードしたシーンの使用をやめる
 /// </summary>
 /// <param name="releasePreloader"></param>
 private void UnsetPreloader(IComponentManager releasePreloader)
 {
     foreach (KeyValuePair<SceneCondition, HashSet<IComponentManager>> preloader in _preloaders)
     {
         preloader.Value.Remove(releasePreloader);
     }
 }
コード例 #39
0
ファイル: SceneData.cs プロジェクト: deltan/XNATetris
 /// <summary>
 /// シーン情報を作成する
 /// </summary>
 /// <param name="sceneCondition"></param>
 /// <param name="componentManager"></param>
 public SceneData(SceneCondition sceneCondition, IComponentManager componentManager)
 {
     SceneCondition = sceneCondition;
     ComponentManager = componentManager;
 }
コード例 #40
0
ファイル: ComponentManager.cs プロジェクト: deltan/XNATetris
        /// <summary>
        /// 所属するコンポーネントの描画順位に加算する
        /// </summary>
        public void AddDrawOrder(IComponentManager beforeScene)
        {
            int baseDrawOrder;
            if (beforeScene == null)
            {
                baseDrawOrder = 0;
            }
            else
            {
                baseDrawOrder = beforeScene.MaxDrawOrder + 1;
            }

            AddDrawOrder(baseDrawOrder);
        }
コード例 #41
0
ファイル: ComponentManager.cs プロジェクト: deltan/XNATetris
        /// <summary>
        /// 所属するコンポーネントの更新順位を追加した順にインクリメントで設定する
        /// </summary>
        /// <param name="beforeScene"></param>
        public void IncUpdateOrder(IComponentManager beforeScene)
        {
            int baseUpdateOrder;
            if (beforeScene == null)
            {
                baseUpdateOrder = 0;
            }
            else
            {
                baseUpdateOrder = beforeScene.MaxUpdateOrder + 1;
            }

            IncUpdateOrder(baseUpdateOrder);
        }
コード例 #42
0
        public void Initialize(ScriptEngine module)
        {
            m_module = module;

            m_manager = module.Worlds[0].RequestModuleInterface<IComponentManager>();
        }
コード例 #43
0
        /// <summary>
        /// シーンをプリロードしたシーンのコンポーネント管理クラスを登録する
        /// </summary>
        /// <param name="preloadSceneCondition"></param>
        /// <param name="preloader"></param>
        private void SetPreloader(SceneCondition preloadSceneCondition, IComponentManager preloader)
        {
            if (!_preloaders.ContainsKey(preloadSceneCondition))
            {
                _preloaders[preloadSceneCondition] = new HashSet<IComponentManager>();
            }

            _preloaders[preloadSceneCondition].Add(preloader);
        }