public ZenSettingsPage(Lifetime lifetime, OptionsSettingsSmartContext settings, IComponentContainer container) { settings.SetBinding(lifetime, (ZenSharpSettings s) => s.TreeFilename, this, PathProperty); InitializeComponent(); Id = pageId; _zenWatcher = Shell.Instance.GetComponent<LtgConfigWatcher>(); // show exception info if any OnOk(); }
object IComponentFactory.CreateInstance(Type componentType, IComponentContainer container, out bool isSingleInstance) { if (_componentType == null) { throw new InvalidOperationException("The ComponentType of a ComponentFactory must be set."); } Debug.Assert(_componentType == componentType); isSingleInstance = _singleton; return Activator.CreateInstance(_componentType); }
public static IDataContext CreateDataContext(IComponentContainer componentContainer, ISolution solution, ITextControl control) { var actionManager = componentContainer.GetComponent<IActionManager>(); var dataRules = DataRules .AddRule("Test", ProjectModelDataConstants.SOLUTION, x => solution) .AddRule("Test", TextControlDataConstants.TEXT_CONTROL, x => control) .AddRule("Test", DocumentModelDataConstants.DOCUMENT, x => control.Document) .AddRule("Test", DocumentModelDataConstants.EDITOR_CONTEXT, x => new DocumentEditorContext(new DocumentOffset(control.Document, control.Caret.Position.Value.ToDocOffset()))); return actionManager.DataContexts.CreateWithDataRules(control.Lifetime, dataRules); }
/// <summary> /// Initializes an instance of XApplication. /// </summary> public XApplication() { _current = this; _componentContainer = new ComponentContainer(this); _componentContainer.RegisterObject(this); Exit += OnApplicationExit; Startup += OnApplicationStartup; UnhandledException += OnApplicationUnhandledException; _uiContext = SynchronizationContext.Current; }
/// <summary> /// Initializes a new instance of the <see cref="KernelBase"/> class. /// </summary> /// <param name="components">The component container to use.</param> /// <param name="settings">The configuration to use.</param> /// <param name="modules">The modules to load into the kernel.</param> protected KernelBase(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules) { Ensure.ArgumentNotNull(components, "components"); Ensure.ArgumentNotNull(settings, "settings"); Ensure.ArgumentNotNull(modules, "modules"); Settings = settings; Components = components; components.Kernel = this; AddComponents(); #if !SILVERLIGHT if (Settings.LoadExtensions) Load(new[] { Settings.ExtensionSearchPattern }); #endif Load(modules); }
/// <summary> /// Initializes a new instance of the <see cref="KernelConfiguration"/> class. /// </summary> /// <param name="components">The component container to use.</param> /// <param name="settings">The configuration to use.</param> /// <param name="modules">The modules to load into the kernel.</param> public KernelConfiguration(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules) { Ensure.ArgumentNotNull(components, "components"); Ensure.ArgumentNotNull(settings, "settings"); Ensure.ArgumentNotNull(modules, "modules"); this.settings = settings; this.Components = components; components.KernelConfiguration = this; this.AddComponents(); #if !NO_ASSEMBLY_SCANNING if (this.settings.LoadExtensions) { this.Load(this.settings.ExtensionSearchPatterns); } #endif this.Load(modules); }
public ShadowMapFactory(GraphicsDevice device, IComponentContainer <ShadowMap> container) : base(device, container) { }
/// <summary> /// 子コンテナを追加する /// </summary> /// <param name="child">追加する子コンテナ</param> public void AddChild(IComponentContainer child) { children.Add(child); }
public Iterations(string name, IComponentContainer container) : base(name, container) { }
/// <summary> /// Instantiates the bootstrapper and wires all dependencies to the resolve method. /// </summary> public SusanooBootstrapper(IComponentContainer container) { Container = container; }
/// <summary> /// Initializes a new instance of the <see cref="KernelConfiguration"/> class. /// </summary> /// <param name="components">The component container to use.</param> /// <param name="settings">The configuration to use.</param> /// <param name="modules">The modules to load into the kernel.</param> public KernelConfiguration(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules) { Contract.Requires(components != null); Contract.Requires(settings != null); Contract.Requires(modules != null); this.settings = settings; this.Components = components; components.KernelConfiguration = this; this.AddComponents(); #if !NO_ASSEMBLY_SCANNING if (this.settings.LoadExtensions) { this.Load(this.settings.ExtensionSearchPatterns); } #endif this.Load(modules); }
/// <summary> /// Initializes a new instance of the <see cref="KernelBase"/> class. /// </summary> /// <param name="components">The component container to use.</param> /// <param name="settings">The configuration to use.</param> /// <param name="modules">The modules to load into the kernel.</param> protected KernelBase(IComponentContainer components, INinjectSettings settings, params INinjectModule[] modules) { this.kernelConfiguration = new KernelConfiguration(components, settings, modules); this.kernelConfiguration.Bind<IKernel>().ToMethod(ctx => this); this.kernelConfiguration.Bind<IResolutionRoot>().ToMethod(ctx => this).When(ctx => true); }
public ComponentContainerRegisterToSyntaxBuilder(IComponentContainer container) { this.Container = container ?? throw new ArgumentNullException(nameof(container)); }
public GeneratorComponentContainer(IComponentContainer container) : base(container) { BaseContainer = container; }
private void Remove(IComponentContainer container) { var drawable = container.GetComponent<Component<IDrawable>>(); if (null != drawable) { renderer.DeleteDrawable(drawable.Value); } registry.Unregister(container); }
public override async System.Threading.Tasks.Task <bool> SetInitializer(CRenderContext rc, IEntity host, IComponentContainer hostContainer, GComponentInitializer v) { await base.SetInitializer(rc, host, hostContainer, v); mPlacementData = v as GPlacementComponentInitializer; var iPlacement = mHostContainer as IPlaceable; if (iPlacement != null) { mPlaceableHost = iPlacement; iPlacement.Placement = this; } mOrientation = Rotation * -Vector3.UnitZ; mWorldOrientation = WorldRotation * -Vector3.UnitZ; UpdateData(); return(true); }
/*----------------------------------------------------------------------------------------*/ /// <summary> /// Initializes a new instance of the <see cref="StandardComponentContainer"/> class. /// </summary> /// <param name="kernel">The kernel whose components the container will manage.</param> /// <param name="parentContainer">The parent container.</param> public StandardComponentContainer(IKernel kernel, IComponentContainer parentContainer) : base(kernel, parentContainer) { }
public PointLightSystem(GraphicsDevice device, EffectFactory effectFactory, LightPrimitiveLoader lightPrimitiveLoader, IComponentContainer <PointLight> lights, IComponentContainer <Pose> poses) { this.Device = device; this.Effect = effectFactory.Construct <PointLightEffect>(); this.Sphere = lightPrimitiveLoader.UnitSphere(); this.Lights = lights; this.Poses = poses; }
public override async Task <bool> SetInitializer(CRenderContext rc, IEntity host, IComponentContainer hostContainer, GComponentInitializer v) { var result = await base.SetInitializer(rc, host, hostContainer, v); if (result == false) { return(false); } if (FCCInitializer != null) { UpLimitAngleInRad = FCCInitializer.UpLimitAngleInRad; DownLimitAngleInRad = FCCInitializer.DownLimitAngleInRad; } return(true); }
public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> components, IComponentContainer <Pose> poses, IconLibrary library) { this.Device = device; this.Components = components; this.Poses = poses; this.Effect = effectFactory.Construct <TextureEffect>(); this.Library = library; this.Quad = new UnitQuad(device); }
public AmbientLightSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <AmbientLight> lights) { this.Device = device; this.Effect = effectFactory.Construct <AmbientLightEffect>(); this.BlurEffect = effectFactory.Construct <BlurEffect>(); this.Lights = lights; this.FullScreenTriangle = new FullScreenTriangle(); this.Kernel = this.GenerateKernel(); var random = new Random(255); this.NoiseMap = new Texture2D(device, 64, 64, false, SurfaceFormat.Color); SimplexNoise.Seed = random.Next(); var noiseX = SimplexNoise.Calc2D(this.NoiseMap.Width, this.NoiseMap.Height, 1.0f); SimplexNoise.Seed = random.Next(); var noiseY = SimplexNoise.Calc2D(this.NoiseMap.Width, this.NoiseMap.Height, 1.0f); SimplexNoise.Seed = random.Next(); var noiseZ = SimplexNoise.Calc2D(this.NoiseMap.Width, this.NoiseMap.Height, 1.0f); var noise = new Color[this.NoiseMap.Width * this.NoiseMap.Height]; for (var y = 0; y < this.NoiseMap.Height; y++) { for (var x = 0; x < this.NoiseMap.Width; x++) { var r = (noiseX[x, y] / 128.0f) - 1.0f; var g = (noiseY[x, y] / 128.0f) - 1.0f; var b = (noiseZ[x, y] / 128.0f) - 1.0f; noise[x * y] = new Color(r, g, b); } } this.NoiseMap.SetData(noise); }
public AdditiveEmitterFactory(GraphicsDevice device, IComponentContainer <AdditiveEmitter> container) : base(device, container) { }
/// <summary> /// Constructor de la clase. /// </summary> public ComponentContainer() { _container = new UnityInjectorContainer(); }
private void HandleCollisions(float absoluteTime, IComponentContainer containerPlayer) { var player = containerPlayer.GetComponent<Component<Box2D>>().Value; foreach (IComponentContainer enemy in registry.GetAllContainerWithComponent<Enemy>().ToList()) { Box2D enemyFrame = enemy.GetComponent<Component<Box2D>>().Value; //intersections enemy <-> player if (player.Intersects(enemyFrame)) { //game lost Lost = true; //remove player Remove(containerPlayer); CreateExplosion(absoluteTime, player); //remove enemy Remove(enemy); CreateExplosion(absoluteTime, enemyFrame); return; } //intersections enemy <-> playerBullet foreach (IComponentContainer bullet in registry.GetAllContainerWithComponent<PlayerBullet>().ToList()) { Box2D bulletFrame = bullet.GetComponent<Component<Box2D>>().Value; if (bulletFrame.Intersects(enemyFrame)) { Points += 20; //delete bullet and enemy Remove(bullet); Remove(enemy); CreateExplosion(absoluteTime, enemyFrame); } } } //intersections enemyBullet <-> player foreach (IComponentContainer enemyBullet in registry.GetAllContainerWithComponent<EnemyBullet>().ToList()) { Box2D enemyFrame = enemyBullet.GetComponent<Component<Box2D>>().Value; if (player.Intersects(enemyFrame)) { //game lost Lost = true; //remove player Remove(containerPlayer); CreateExplosion(absoluteTime, player); //remove enemyBullet Remove(enemyBullet); return; } //bullet <-> bullet foreach (IComponentContainer bullet in registry.GetAllContainerWithComponent<PlayerBullet>().ToList()) { Box2D bulletFrame = bullet.GetComponent<Component<Box2D>>().Value; if (bulletFrame.Intersects(enemyFrame)) { Points += 2; Remove(bullet); Remove(enemyBullet); CreateExplosion(absoluteTime, bulletFrame); } } } }
public NetworkStartup() { _container = new ComponentContainer(); }
//public override void Tick(GPlacementComponent placement) //{ // base.Tick(placement); //} public override async Task <bool> SetInitializer(CRenderContext rc, GamePlay.IEntity host, IComponentContainer hostContainer, GComponentInitializer v) { var init = v as GMeshComponentInitializer; if (init == null) { return(false); } if (ParticleModifier != null) { if (ParticleModifier.ParticleSys.IsBillBoard && ParticleModifier.ParticleSys.BillBoardType != CGfxParticleSystem.BILLBOARDTYPE.BILLBOARD_DISABLE) { init.MeshName = RName.GetRName("@createplane"); } else { init.MeshName = ParticleModifier.ParticleSys.UseMeshRName; } } //设置默认值 if (init.MeshName == null) { init.MeshName = RName.GetRName("ParticleResource/models/sphere.gms"); } if (false == await base.SetInitializer(rc, host, hostContainer, v)) { return(false); } Host = host as GActor; if (ParticleModifier != null && ParticleModifier.ParticleSys.UseMaterialRName != null) { if (mSceneMesh != null && mSceneMesh.MtlMeshArray != null) { //await SetMaterialInstance(rc, 0, ParticleModifier.ParticleSys.UseMaterialRName, null); var mtl = await CEngine.Instance.MaterialInstanceManager.GetMaterialInstanceAsync(rc, ParticleModifier.ParticleSys.UseMaterialRName); base.SetMaterialInstance(rc, 0, mtl, null); } } if (ParticleModifier != null && this.SceneMesh != null) { this.SceneMesh.MdfQueue.AddModifier(ParticleModifier); this.AddDefaultColorBuff(rc, this.SceneMesh.MeshPrimitives); } return(true); }