public void Setup() { processor = Substitute.For <IOutgoingRequestProcessor>(); factory = Substitute.For <IProxyFactory>(); factory.CreateProxy <IMyService>().Returns((p, s, t) => new MyServiceProxy(p, s, t)); container = new ProxyContainer(processor, factory); }
private void _proxies_OnProxyFreed(ProxyContainer proxy) { DevourTarget target; if (_targets.TryDequeue(out target)) { DevourOne(proxy, target); } }
public Task AcceptGenericProxyContainerAsync(ProxyContainer <IGenericMarshalable <int> > marshalableContainer, bool dispose = true) { this.ReceivedProxy = marshalableContainer.Marshalable; if (dispose) { marshalableContainer.Marshalable?.Dispose(); } return(Task.CompletedTask); }
public Task AcceptMarshalableAndSerializableProxyContainerAsync(ProxyContainer <IMarshalableAndSerializable> marshalableContainer, bool dispose = true) { this.ReceivedProxy = marshalableContainer.Marshalable; if (dispose) { marshalableContainer.Marshalable?.Dispose(); } return(Task.CompletedTask); }
private void DevourOne(ProxyContainer proxyCont, DevourTarget target) { DownloaderObj obj = new DownloaderObj(target.Uri, DevourCallback, true, proxyCont, this.CookieOptions, target.Attempts, target, null, false, 1000, this.TimingParams, this.RequestParams); Downloader.Queue(obj); #if DEBUG Interlocked.Increment(ref __queuedObjects); GlobalLog.Write("__queuedObjects: {0}", __queuedObjects); #endif MoveObjQueued(); }
public OsuPlayfield() { InternalChildren = new Drawable[] { playfieldBorder = new PlayfieldBorder { RelativeSizeAxes = Axes.Both, Depth = 3 }, spinnerProxies = new ProxyContainer { RelativeSizeAxes = Axes.Both }, followPoints = new FollowPointRenderer { RelativeSizeAxes = Axes.Both, Depth = 2, }, judgementLayer = new JudgementContainer <DrawableOsuJudgement> { RelativeSizeAxes = Axes.Both, Depth = 1, }, // Todo: This should not exist, but currently helps to reduce LOH allocations due to unbinding skin source events on judgement disposal // Todo: Remove when hitobjects are properly pooled new SkinProvidingContainer(null) { Child = HitObjectContainer, }, approachCircles = new ProxyContainer { RelativeSizeAxes = Axes.Both, Depth = -1, }, }; hitPolicy = new OrderedHitPolicy(HitObjectContainer); CheckHittable = hitPolicy.IsHittable; var hitWindows = new OsuHitWindows(); foreach (var result in Enum.GetValues(typeof(HitResult)).OfType <HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r))) { poolDictionary.Add(result, new DrawableJudgementPool(result)); } AddRangeInternal(poolDictionary.Values); NewResult += onNewResult; }
public OsuPlayfield() { Anchor = Anchor.Centre; Origin = Anchor.Centre; InternalChildren = new Drawable[] { playfieldBorder = new PlayfieldBorder { RelativeSizeAxes = Axes.Both }, spinnerProxies = new ProxyContainer { RelativeSizeAxes = Axes.Both }, FollowPoints = new FollowPointRenderer { RelativeSizeAxes = Axes.Both }, judgementLayer = new JudgementContainer <DrawableOsuJudgement> { RelativeSizeAxes = Axes.Both }, HitObjectContainer, judgementAboveHitObjectLayer = new Container { RelativeSizeAxes = Axes.Both }, approachCircles = new ProxyContainer { RelativeSizeAxes = Axes.Both }, }; HitPolicy = new StartTimeOrderedHitPolicy(); var hitWindows = new OsuHitWindows(); foreach (var result in Enum.GetValues(typeof(HitResult)).OfType <HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r))) { poolDictionary.Add(result, new DrawableJudgementPool(result, onJudgementLoaded)); } AddRangeInternal(poolDictionary.Values); NewResult += onNewResult; }
private void load(OsuColour colours) { InternalChildren = new[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()), rightArea = new Container { Name = "Right area", RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Children = new Drawable[] { new Container { Name = "Masked elements before hit objects", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Children = new[] { hitExplosionContainer = new Container <HitExplosion> { RelativeSizeAxes = Axes.Both, }, HitTarget = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget()) { RelativeSizeAxes = Axes.Both, } } }, hitTargetOffsetContent = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { barLinePlayfield = new BarLinePlayfield(), new Container { Name = "Hit objects", RelativeSizeAxes = Axes.Both, Children = new Drawable[] { HitObjectContainer, drumRollHitContainer = new DrumRollHitContainer() } }, kiaiExplosionContainer = new Container <KiaiHitExplosion> { Name = "Kiai hit explosions", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }, judgementContainer = new JudgementContainer <DrawableTaikoJudgement> { Name = "Judgements", RelativeSizeAxes = Axes.Y, }, } }, } }, leftArea = new Container { Name = "Left overlay", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, BorderColour = colours.Gray0, Children = new Drawable[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()), new InputDrum(HitObjectContainer) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, } }, mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty()) { Origin = Anchor.BottomLeft, Anchor = Anchor.TopLeft, RelativePositionAxes = Axes.Y, RelativeSizeAxes = Axes.None, Y = 0.2f }, topLevelHitContainer = new ProxyContainer { Name = "Top level hit objects", RelativeSizeAxes = Axes.Both, }, drumRollHitContainer.CreateProxy(), }; RegisterPool <Hit, DrawableHit>(50); RegisterPool <Hit.StrongNestedHit, DrawableHit.StrongNestedHit>(50); RegisterPool <DrumRoll, DrawableDrumRoll>(5); RegisterPool <DrumRoll.StrongNestedHit, DrawableDrumRoll.StrongNestedHit>(5); RegisterPool <DrumRollTick, DrawableDrumRollTick>(100); RegisterPool <DrumRollTick.StrongNestedHit, DrawableDrumRollTick.StrongNestedHit>(100); RegisterPool <Swell, DrawableSwell>(5); RegisterPool <SwellTick, DrawableSwellTick>(100); var hitWindows = new TaikoHitWindows(); foreach (var result in Enum.GetValues(typeof(HitResult)).OfType <HitResult>().Where(r => hitWindows.IsHitResultAllowed(r))) { judgementPools.Add(result, new DrawablePool <DrawableTaikoJudgement>(15)); explosionPools.Add(result, new HitExplosionPool(result)); } AddRangeInternal(judgementPools.Values); AddRangeInternal(explosionPools.Values); }
private void load(OsuColour colours) { InternalChildren = new Drawable[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()), rightArea = new Container { Name = "Right area", RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Children = new Drawable[] { new Container { Name = "Masked elements before hit objects", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Children = new[] { hitExplosionContainer = new Container<HitExplosion> { RelativeSizeAxes = Axes.Both, Blending = BlendingParameters.Additive, }, HitTarget = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget()) { RelativeSizeAxes = Axes.Both, } } }, hitTargetOffsetContent = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { barlineContainer = new ProxyContainer { RelativeSizeAxes = Axes.Both, }, new Container { Name = "Hit objects", RelativeSizeAxes = Axes.Both, Child = HitObjectContainer }, kiaiExplosionContainer = new Container<KiaiHitExplosion> { Name = "Kiai hit explosions", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Blending = BlendingParameters.Additive }, judgementContainer = new JudgementContainer<DrawableTaikoJudgement> { Name = "Judgements", RelativeSizeAxes = Axes.Y, Blending = BlendingParameters.Additive }, } }, } }, leftArea = new Container { Name = "Left overlay", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, BorderColour = colours.Gray0, Children = new Drawable[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()), new InputDrum(controlPoints) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, } }, topLevelHitContainer = new ProxyContainer { Name = "Top level hit objects", RelativeSizeAxes = Axes.Both, } }; }
public void Setup() { processor = Substitute.For<IOutgoingRequestProcessor>(); factory = Substitute.For<IProxyFactory>(); factory.CreateProxy<IMyService>().Returns((p, s, t) => new MyServiceProxy(p, s, t)); container = new ProxyContainer(processor, factory); }
public Task AcceptProxyContainerAsync(ProxyContainer disposableContainer) { this.ReceivedProxy = disposableContainer.Disposable; disposableContainer.Disposable?.Dispose(); return(Task.CompletedTask); }
public TaikoPlayfield(ControlPointInfo controlPoints) { InternalChildren = new Drawable[] { backgroundContainer = new Container { Name = "Transparent playfield background", RelativeSizeAxes = Axes.Both, Masking = true, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.2f), Radius = 5, }, Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.6f }, } }, new Container { Name = "Right area", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = left_area_size }, Children = new Drawable[] { new Container { Name = "Masked elements before hit objects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Masking = true, Children = new Drawable[] { hitExplosionContainer = new Container <HitExplosion> { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Blending = BlendingParameters.Additive, }, HitTarget = new HitTarget { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit } } }, barlineContainer = new ProxyContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } }, new Container { Name = "Hit objects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Masking = true, Child = HitObjectContainer }, kiaiExplosionContainer = new Container <KiaiHitExplosion> { Name = "Kiai hit explosions", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, Blending = BlendingParameters.Additive }, judgementContainer = new JudgementContainer <DrawableTaikoJudgement> { Name = "Judgements", RelativeSizeAxes = Axes.Y, Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, Blending = BlendingParameters.Additive }, } }, overlayBackgroundContainer = new Container { Name = "Left overlay", RelativeSizeAxes = Axes.Y, Size = new Vector2(left_area_size, 1), Children = new Drawable[] { overlayBackground = new Box { RelativeSizeAxes = Axes.Both, }, new InputDrum(controlPoints) { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Scale = new Vector2(0.9f), Margin = new MarginPadding { Right = 20 } }, new Box { Anchor = Anchor.TopRight, RelativeSizeAxes = Axes.Y, Width = 10, Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), }, } }, new Container { Name = "Border", RelativeSizeAxes = Axes.Both, Masking = true, MaskingSmoothness = 0, BorderThickness = 2, AlwaysPresent = true, Children = new[] { new Box { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true } } }, topLevelHitContainer = new ProxyContainer { Name = "Top level hit objects", RelativeSizeAxes = Axes.Both, } }; }
private void load(OsuColour colours) { InternalChildren = new[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()), rightArea = new Container { Name = "Right area", RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Children = new Drawable[] { new Container { Name = "Masked elements before hit objects", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, Children = new[] { hitExplosionContainer = new Container <HitExplosion> { RelativeSizeAxes = Axes.Both, }, HitTarget = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.HitTarget), _ => new TaikoHitTarget()) { RelativeSizeAxes = Axes.Both, } } }, hitTargetOffsetContent = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { barLinePlayfield = new BarLinePlayfield(), new Container { Name = "Hit objects", RelativeSizeAxes = Axes.Both, Children = new Drawable[] { HitObjectContainer, drumRollHitContainer = new DrumRollHitContainer() } }, kiaiExplosionContainer = new Container <KiaiHitExplosion> { Name = "Kiai hit explosions", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }, judgementContainer = new JudgementContainer <DrawableTaikoJudgement> { Name = "Judgements", RelativeSizeAxes = Axes.Y, }, } }, } }, leftArea = new Container { Name = "Left overlay", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, BorderColour = colours.Gray0, Children = new Drawable[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()), new InputDrum(controlPoints) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, } }, mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty()) { Origin = Anchor.BottomLeft, Anchor = Anchor.TopLeft, RelativePositionAxes = Axes.Y, RelativeSizeAxes = Axes.None, Y = 0.2f }, topLevelHitContainer = new ProxyContainer { Name = "Top level hit objects", RelativeSizeAxes = Axes.Both, }, drumRollHitContainer.CreateProxy(), }; RegisterPool <Hit, DrawableHit>(50); RegisterPool <Hit.StrongNestedHit, DrawableHit.StrongNestedHit>(50); RegisterPool <DrumRoll, DrawableDrumRoll>(5); RegisterPool <DrumRoll.StrongNestedHit, DrawableDrumRoll.StrongNestedHit>(5); RegisterPool <DrumRollTick, DrawableDrumRollTick>(100); RegisterPool <DrumRollTick.StrongNestedHit, DrawableDrumRollTick.StrongNestedHit>(100); RegisterPool <Swell, DrawableSwell>(5); RegisterPool <SwellTick, DrawableSwellTick>(100); }
public RushPlayfield() { InternalChildren = new Drawable[] { new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(GridSizeMode.Distributed), // Top empty area new Dimension(GridSizeMode.Absolute, DEFAULT_HEIGHT), // Playfield area new Dimension(GridSizeMode.Distributed), // Ground area, extends to overall height }, Content = new[] { new[] { Empty() }, new Drawable[] { new Container { Name = "Playfield area", RelativeSizeAxes = Axes.Both, Children = new[] { new Container { Name = "Left area", Width = HIT_TARGET_OFFSET, RelativeSizeAxes = Axes.Y, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Depth = -1, Child = new Container { Name = "Left Play Zone", RelativeSizeAxes = Axes.Both, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Children = new Drawable[] { PlayerSprite = new RushPlayerSprite(DEFAULT_HEIGHT, 0) { Origin = Anchor.Centre, Position = new Vector2(PLAYER_OFFSET, DEFAULT_HEIGHT), Scale = new Vector2(0.75f), }, overPlayerEffectsContainer = new Container { Origin = Anchor.Centre, Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both, } } }, }, new Container { Name = "Right area", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Children = new Drawable[] { new Container { Name = "Hit target indicators", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Children = new Drawable[] { new HitTarget { Anchor = Anchor.TopLeft, Origin = Anchor.Centre, Size = new Vector2(HIT_TARGET_SIZE), FillMode = FillMode.Fit }, new HitTarget { Anchor = Anchor.BottomLeft, Origin = Anchor.Centre, Size = new Vector2(HIT_TARGET_SIZE), FillMode = FillMode.Fit }, } }, underEffectContainer = new Container { Name = "Under Effects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } }, judgementContainer = new JudgementContainer <DrawableRushJudgement> { Name = "Judgement", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } }, new Container { Name = "Hit Objects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Child = HitObjectContainer }, proxiedHitObjects = new ProxyContainer { Name = "Proxied Hit Objects", RelativeSizeAxes = Axes.Both, }, overEffectContainer = new Container { Name = "Over Effects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET } }, halfPaddingOverEffectContainer = new Container { Name = "Over Effects (Half Padding)", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET / 2f } } } } } }, }, new Drawable[] { new Container { Name = "Ground area", RelativeSizeAxes = Axes.Both, // Due to the size of the player sprite, we have to push the ground even more to the bottom. Padding = new MarginPadding { Top = 50f }, Depth = float.MaxValue, Child = new GroundDisplay(), } } } } }; }