public Column(int index) { Index = index; RelativeSizeAxes = Axes.Y; Width = COLUMN_WIDTH; Drawable background = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground, Index), _ => new DefaultColumnBackground()) { RelativeSizeAxes = Axes.Both }; InternalChildren = new[] { hitExplosionPool = new DrawablePool <PoolableHitExplosion>(5), // For input purposes, the background is added at the highest depth, but is then proxied back below all other elements background.CreateProxy(), HitObjectArea = new ColumnHitObjectArea(Index, HitObjectContainer) { RelativeSizeAxes = Axes.Both }, new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea, Index), _ => new DefaultKeyArea()) { RelativeSizeAxes = Axes.Both }, background, TopLevelContainer = new Container { RelativeSizeAxes = Axes.Both } }; hitPolicy = new OrderedHitPolicy(HitObjectContainer); TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy()); }
/// <summary> /// Registers a custom <see cref="DrawableHitObject"/> pool with this <see cref="DrawableRuleset"/> which is to be used whenever /// <see cref="DrawableHitObject"/> representations are requested for the given <typeparamref name="TObject"/> type. /// </summary> /// <param name="pool">The <see cref="DrawablePool{T}"/> to register.</param> /// <typeparam name="TObject">The <see cref="HitObject"/> type.</typeparam> /// <typeparam name="TDrawable">The <see cref="DrawableHitObject"/> receiver for <typeparamref name="TObject"/>s.</typeparam> protected void RegisterPool <TObject, TDrawable>([NotNull] DrawablePool <TDrawable> pool) where TObject : HitObject where TDrawable : DrawableHitObject, new() { pools[typeof(TObject)] = pool; AddInternal(pool); }
public SentakkiPlayfield() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.None; Rotation = 0; Size = new Vector2(600); AddRangeInternal(new Drawable[] { judgementPool = new DrawablePool <DrawableSentakkiJudgement>(8), AccentContainer = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new PlayfieldVisualisation(), ring = new SentakkiRing(), } }, lanedPlayfield = new LanedPlayfield(), HitObjectContainer, // This only contains TouchHolds, which needs to be above others types touchPlayfield = new TouchPlayfield(), // This only contains Touch, which needs a custom playfield to handle their input judgementLayer = new Container <DrawableSentakkiJudgement> { RelativeSizeAxes = Axes.Both, } }); AddNested(lanedPlayfield); AddNested(touchPlayfield); NewResult += onNewResult; }
public TestSceneSlide() { Add(chevronPool = new DrawablePool <SlideVisual.SlideChevron>(62)); Add(new SentakkiRing()); Add(slide = new SlideVisual()); AddSliderStep("Path offset", 0, 7, 0, p => { slide.Rotation = 45 * p; }); AddSliderStep("End Path", 0, 7, 4, p => { EndPath = p; RefreshSlide(); }); AddSliderStep("Progress", 0.0f, 1.0f, 0.0f, p => { slide.Progress = p; }); Add(nodes = new Container() { Anchor = Anchor.Centre, Origin = Anchor.Centre, }); }
public EffectContainer() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.None; Rotation = 45; AddInternal(effectPool = new DrawablePool <Effect>(5)); }
public TestSceneSlideNote() { base.Content.Add(content = new SentakkiInputManager(new SentakkiRuleset().RulesetInfo)); Add(chevronPool = new DrawablePool <SlideVisual.SlideChevron>(62)); AddStep("Miss Single", () => testSingle(2000)); AddStep("Hit Single", () => testSingle(2000, true)); AddUntilStep("Wait for object despawn", () => !Children.Any(h => (h is DrawableSentakkiHitObject) && (h as DrawableSentakkiHitObject).AllJudged == false)); }
public Lane() { Anchor = Anchor.Centre; Origin = Anchor.Centre; AddRangeInternal(new Drawable[] { hitExplosionPool = new DrawablePool <PoolableHitExplosion>(3), hitExplosionContainer = new Container(), HitObjectContainer, }); NewResult += onNewResult; }
public TestSceneDrawableJudgement() { var pools = new List <DrawablePool <DrawableOsuJudgement> >(); foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType <HitResult>().Skip(1)) { AddStep("Show " + result.GetDescription(), () => { int poolIndex = 0; SetContents(() => { DrawablePool <DrawableOsuJudgement> pool; if (poolIndex >= pools.Count) { pools.Add(pool = new DrawablePool <DrawableOsuJudgement>(1)); } else { pool = pools[poolIndex]; // We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent. ((Container)pool.Parent).Clear(false); } var container = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { pool, pool.Get(j => j.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)).With(j => { j.Anchor = Anchor.Centre; j.Origin = Anchor.Centre; }) } }; poolIndex++; return(container); }); }); } }
private void showResult(HitResult result) { AddStep("Show " + result.GetDescription(), () => { int poolIndex = 0; SetContents(_ => { DrawablePool <TestDrawableTauJudgement> pool; if (poolIndex >= pools.Count) { pools.Add(pool = new DrawablePool <TestDrawableTauJudgement>(1)); } else { pool = pools[poolIndex]; ((Container)pool.Parent).Clear(false); } var container = new Container { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Y, Y = Extensions.GetCircularPosition(-.6f, 0).Y, Children = new Drawable[] { pool, pool.Get(j => j.Apply(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement()) { Type = result }, null)).With(j => { j.Anchor = Anchor.Centre; j.Origin = Anchor.Centre; }) } }; poolIndex++; return(container); }); }); }
private void resetWithNewPool(Func <DrawablePool <TestDrawable> > createPool) { AddStep("reset stats", () => consumed.Clear()); AddStep("create pool", () => { pool = createPool(); Children = new Drawable[] { pool, count = new SpriteText(), }; }); }
public Column(int index) { Index = index; RelativeSizeAxes = Axes.Y; Width = COLUMN_WIDTH; Drawable background = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground()) { RelativeSizeAxes = Axes.Both }; InternalChildren = new[] { hitExplosionPool = new DrawablePool <PoolableHitExplosion>(5), // For input purposes, the background is added at the highest depth, but is then proxied back below all other elements background.CreateProxy(), HitObjectArea = new ColumnHitObjectArea(Index, HitObjectContainer) { RelativeSizeAxes = Axes.Both }, new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea()) { RelativeSizeAxes = Axes.Both }, background, hitSounds = new Container <SkinnableSound> { Name = "Column samples pool", RelativeSizeAxes = Axes.Both, Children = Enumerable.Range(0, max_concurrent_hitsounds).Select(_ => new SkinnableSound()).ToArray() }, TopLevelContainer = new Container { RelativeSizeAxes = Axes.Both } }; hitPolicy = new OrderedHitPolicy(HitObjectContainer); TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy()); RegisterPool <Note, DrawableNote>(10, 50); RegisterPool <HoldNote, DrawableHoldNote>(10, 50); RegisterPool <HeadNote, DrawableHoldNoteHead>(10, 50); RegisterPool <TailNote, DrawableHoldNoteTail>(10, 50); RegisterPool <HoldNoteTick, DrawableHoldNoteTick>(50, 250); }
private void showResult(HitResult result) { AddStep("Show " + result.GetDescription(), () => { int poolIndex = 0; SetContents(() => { DrawablePool <TestDrawableOsuJudgement> pool; if (poolIndex >= pools.Count) { pools.Add(pool = new DrawablePool <TestDrawableOsuJudgement>(1)); } else { pool = pools[poolIndex]; // We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent. ((Container)pool.Parent).Clear(false); } var container = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { pool, pool.Get(j => j.Apply(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement()) { Type = result, }, null)).With(j => { j.Anchor = Anchor.Centre; j.Origin = Anchor.Centre; }) } }; poolIndex++; return(container); }); }); }
private void load() { SetContents(() => { var pool = new DrawablePool <PoolableHitExplosion>(5); hitExplosionPools.Add(pool); return(new ColumnTestContainer(0, ManiaAction.Key1) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Y, Y = -0.25f, Size = new Vector2(Column.COLUMN_WIDTH, DefaultNotePiece.NOTE_HEIGHT), Child = pool }); }); }
public Column(int index) { Index = index; RelativeSizeAxes = Axes.Y; Width = COLUMN_WIDTH; Drawable background = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground), _ => new DefaultColumnBackground()) { RelativeSizeAxes = Axes.Both }; InternalChildren = new[] { hitExplosionPool = new DrawablePool <PoolableHitExplosion>(5), sampleTriggerSource = new GameplaySampleTriggerSource(HitObjectContainer), // For input purposes, the background is added at the highest depth, but is then proxied back below all other elements background.CreateProxy(), HitObjectArea = new ColumnHitObjectArea(HitObjectContainer) { RelativeSizeAxes = Axes.Both }, new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.KeyArea), _ => new DefaultKeyArea()) { RelativeSizeAxes = Axes.Both }, background, TopLevelContainer = new Container { RelativeSizeAxes = Axes.Both }, new ColumnTouchInputArea(this) }; hitPolicy = new OrderedHitPolicy(HitObjectContainer); TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy()); RegisterPool <Note, DrawableNote>(10, 50); RegisterPool <HoldNote, DrawableHoldNote>(10, 50); RegisterPool <HeadNote, DrawableHoldNoteHead>(10, 50); RegisterPool <TailNote, DrawableHoldNoteTail>(10, 50); RegisterPool <HoldNoteTick, DrawableHoldNoteTick>(50, 250); }
public SentakkiPlayfield() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.None; Rotation = 0; Size = new Vector2(600); AddRangeInternal(new Drawable[] { judgementPool = new DrawablePool <DrawableSentakkiJudgement>(8), new PlayfieldVisualisation(), ring = new SentakkiRing(), lanedPlayfield = new LanedPlayfield(), HitObjectContainer, // This only contains Touch and TouchHolds, which should appear above others note types. Might consider separating to another playfield. judgementLayer = new Container <DrawableSentakkiJudgement> { RelativeSizeAxes = Axes.Both, } }); AddNested(lanedPlayfield); NewResult += onNewResult; }
public TestSceneAllSlides() { Add(chevronPool = new DrawablePool <SlideVisual.SlideChevron>(62)); Add(new SentakkiRing()); Add(slide = new SlideVisual()); AddSliderStep("Path ID", 0, SlidePaths.VALIDPATHS.Count - 1, 0, p => { id = p; RefreshSlide(); }); AddToggleStep("Mirrored", b => { mirrored = b; RefreshSlide(); }); Add(nodes = new Container() { Anchor = Anchor.Centre, Origin = Anchor.Centre, }); }
public HitExplosionContainer() { RelativeSizeAxes = Axes.Both; AddInternal(pool = new DrawablePool <HitExplosion>(10)); }
public Stage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) { this.firstColumnIndex = firstColumnIndex; Name = "Stage"; Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; Container topLevelContainer; InternalChildren = new Drawable[] { judgementPool = new DrawablePool <DrawableManiaJudgement>(2), new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageBackground, stageDefinition: definition), _ => new DefaultStageBackground()) { RelativeSizeAxes = Axes.Both }, columnFlow = new ColumnFlow <Column>(definition) { RelativeSizeAxes = Axes.Y, }, new Container { Name = "Barlines mask", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, Width = 1366, // Bar lines should only be masked on the vertical axis BypassAutoSizeAxes = Axes.Both, Masking = true, Child = barLineContainer = new HitObjectArea(HitObjectContainer) { Name = "Bar lines", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, } }, new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageForeground, stageDefinition: definition), _ => null) { RelativeSizeAxes = Axes.Both }, judgements = new JudgementContainer <DrawableManiaJudgement> { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Y = HIT_TARGET_POSITION + 150 }, topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } } }; for (int i = 0; i < definition.Columns; i++) { var columnType = definition.GetTypeOfColumn(i); var column = new Column(firstColumnIndex + i) { RelativeSizeAxes = Axes.Both, Width = 1, ColumnType = columnType, AccentColour = columnColours[columnType], Action = { Value = columnType == ColumnType.Special ? specialColumnStartAction++ : normalColumnStartAction++ } }; topLevelContainer.Add(column.TopLevelContainer.CreateProxy()); columnFlow.SetContentForColumn(i, column); AddNested(column); } }
public ParticleEmitter() { Anchor = Anchor.Centre; Origin = Anchor.Centre; InternalChild = particlePool = new DrawablePool <Particle>(200); }
public HitExplosionContainer() { AddInternal(pool = new DrawablePool <HitExplosion>(10)); }