Ejemplo n.º 1
0
        public AGSCheckBox(string id, Resolver resolver) : base(id, resolver)
        {            
            _uIEvents = AddComponent<IUIEvents>();            
            _skinComponent = AddComponent<ISkinComponent>();            
            _hasRoom = AddComponent<IHasRoom>();            
            _animationContainer = AddComponent<IAnimationContainer>();            
            _inObjectTree = AddComponent<IInObjectTree>();            
            _collider = AddComponent<ICollider>();            
            _visibleComponent = AddComponent<IVisibleComponent>();            
            _enabledComponent = AddComponent<IEnabledComponent>();            
            _customProperties = AddComponent<ICustomPropertiesComponent>();            
            _drawableInfo = AddComponent<IDrawableInfo>();            
            _hotspotComponent = AddComponent<IHotspotComponent>();            
            _shaderComponent = AddComponent<IShaderComponent>();            
            _translateComponent = AddComponent<ITranslateComponent>();            
            _imageComponent = AddComponent<IImageComponent>();            
            _scaleComponent = AddComponent<IScaleComponent>();            
            _rotateComponent = AddComponent<IRotateComponent>();            
            _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>();            
            _textComponent = AddComponent<ITextComponent>();            
            _checkboxComponent = AddComponent<ICheckboxComponent>();
			beforeInitComponents(resolver);            
			InitComponents();
            afterInitComponents(resolver);            
        }
Ejemplo n.º 2
0
 public AGSTextbox(string id, Resolver resolver) : base(id, resolver)
 {
     _uIEvents = AddComponent <IUIEvents>();
     Bind <IUIEvents>(c => _uIEvents = c, _ => {});
     _skinComponent = AddComponent <ISkinComponent>();
     Bind <ISkinComponent>(c => _skinComponent = c, _ => {});
     _hasRoomComponent = AddComponent <IHasRoomComponent>();
     Bind <IHasRoomComponent>(c => _hasRoomComponent = c, _ => {});
     _animationComponent = AddComponent <IAnimationComponent>();
     Bind <IAnimationComponent>(c => _animationComponent = c, _ => {});
     _inObjectTreeComponent = AddComponent <IInObjectTreeComponent>();
     Bind <IInObjectTreeComponent>(c => _inObjectTreeComponent = c, _ => {});
     _colliderComponent = AddComponent <IColliderComponent>();
     Bind <IColliderComponent>(c => _colliderComponent = c, _ => {});
     _visibleComponent = AddComponent <IVisibleComponent>();
     Bind <IVisibleComponent>(c => _visibleComponent = c, _ => {});
     _enabledComponent = AddComponent <IEnabledComponent>();
     Bind <IEnabledComponent>(c => _enabledComponent = c, _ => {});
     _customPropertiesComponent = AddComponent <ICustomPropertiesComponent>();
     Bind <ICustomPropertiesComponent>(c => _customPropertiesComponent = c, _ => {});
     _drawableInfoComponent = AddComponent <IDrawableInfoComponent>();
     Bind <IDrawableInfoComponent>(c => _drawableInfoComponent = c, _ => {});
     _shaderComponent = AddComponent <IShaderComponent>();
     Bind <IShaderComponent>(c => _shaderComponent = c, _ => {});
     _translateComponent = AddComponent <ITranslateComponent>();
     Bind <ITranslateComponent>(c => _translateComponent = c, _ => {});
     _imageComponent = AddComponent <IImageComponent>();
     Bind <IImageComponent>(c => _imageComponent = c, _ => {});
     _scaleComponent = AddComponent <IScaleComponent>();
     Bind <IScaleComponent>(c => _scaleComponent = c, _ => {});
     _rotateComponent = AddComponent <IRotateComponent>();
     Bind <IRotateComponent>(c => _rotateComponent = c, _ => {});
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     Bind <IPixelPerfectComponent>(c => _pixelPerfectComponent = c, _ => {});
     _modelMatrixComponent = AddComponent <IModelMatrixComponent>();
     Bind <IModelMatrixComponent>(c => _modelMatrixComponent = c, _ => {});
     _boundingBoxComponent = AddComponent <IBoundingBoxComponent>();
     Bind <IBoundingBoxComponent>(c => _boundingBoxComponent = c, _ => {});
     _textComponent = AddComponent <ITextComponent>();
     Bind <ITextComponent>(c => _textComponent = c, _ => {});
     _textBoxComponent = AddComponent <ITextBoxComponent>();
     Bind <ITextBoxComponent>(c => _textBoxComponent = c, _ => {});
     beforeInitComponents(resolver);
     InitComponents();
     afterInitComponents(resolver);
 }
Ejemplo n.º 3
0
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            switch (component)
            {
            case GameplaySkinComponent <HitResult> resultComponent:
                return(getResult(resultComponent));

            case ManiaSkinComponent maniaComponent:
                if (!isLegacySkin.Value || !hasKeyTexture.Value)
                {
                    return(null);
                }

                switch (maniaComponent.Component)
                {
                case ManiaSkinComponents.ColumnBackground:
                    return(new LegacyColumnBackground(maniaComponent.TargetColumn == beatmap.TotalColumns - 1));

                case ManiaSkinComponents.HitTarget:
                    return(new LegacyHitTarget());

                case ManiaSkinComponents.KeyArea:
                    return(new LegacyKeyArea());

                case ManiaSkinComponents.Note:
                    return(new LegacyNotePiece());

                case ManiaSkinComponents.HoldNoteHead:
                    return(new LegacyHoldNoteHeadPiece());

                case ManiaSkinComponents.HoldNoteTail:
                    return(new LegacyHoldNoteTailPiece());

                case ManiaSkinComponents.HoldNoteBody:
                    return(new LegacyBodyPiece());

                case ManiaSkinComponents.HitExplosion:
                    return(new LegacyHitExplosion());
                }

                break;
            }

            return(null);
        }
Ejemplo n.º 4
0
            public Drawable GetDrawableComponent(ISkinComponent component)
            {
                if (!enabled)
                {
                    return(null);
                }

                if (component is OsuSkinComponent osuComponent && osuComponent.Component == OsuSkinComponents.SliderBody)
                {
                    return(null);
                }

                return(new OsuSpriteText
                {
                    Text = identifier,
                    Font = OsuFont.Default.With(size: 30),
                });
            }
Ejemplo n.º 5
0
Archivo: Skin.cs Proyecto: shadiwolf/e
        public virtual Drawable GetDrawableComponent(ISkinComponent component)
        {
            switch (component)
            {
            case SkinnableTargetComponent target:
                if (!DrawableComponentInfo.TryGetValue(target.Target, out var skinnableInfo))
                {
                    return(null);
                }

                return(new SkinnableTargetComponentsContainer
                {
                    ChildrenEnumerable = skinnableInfo.Select(i => i.CreateInstance())
                });
            }

            return(null);
        }
Ejemplo n.º 6
0
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (!(component is TaikoSkinComponent taikoComponent))
            {
                return(null);
            }

            switch (taikoComponent.Component)
            {
            case TaikoSkinComponents.InputDrum:
                if (GetTexture("taiko-bar-left") != null)
                {
                    return(new LegacyInputDrum());
                }

                return(null);
            }

            return(source.GetDrawableComponent(component));
        }
Ejemplo n.º 7
0
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (component is SkinnableTargetComponent targetComponent)
            {
                switch (targetComponent.Target)
                {
                case SkinnableTarget.MainHUDComponents:
                    // this should exist in LegacySkin instead, but there isn't a fallback skin for LegacySkins yet.
                    // therefore keep the check here until fallback default legacy skin is supported.
                    if (!this.HasFont(LegacyFont.Score))
                    {
                        return(null);
                    }

                    break;
                }
            }

            return(base.GetDrawableComponent(component));
        }
Ejemplo n.º 8
0
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (!(component is TaikoSkinComponent taikoComponent))
            {
                return(null);
            }

            switch (taikoComponent.Component)
            {
            case TaikoSkinComponents.DrumRollBody:
                if (GetTexture("taiko-roll-middle") != null)
                {
                    return(new LegacyDrumRoll());
                }

                return(null);

            case TaikoSkinComponents.InputDrum:
                if (GetTexture("taiko-bar-left") != null)
                {
                    return(new LegacyInputDrum());
                }

                return(null);

            case TaikoSkinComponents.CentreHit:
            case TaikoSkinComponents.RimHit:

                if (GetTexture("taikohitcircle") != null)
                {
                    return(new LegacyHit(taikoComponent.Component));
                }

                return(null);

            case TaikoSkinComponents.DrumRollTick:
                return(this.GetAnimation("sliderscorepoint", false, false));
            }

            return(source.GetDrawableComponent(component));
        }
Ejemplo n.º 9
0
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            switch (component)
            {
            case GameplaySkinComponent <HitResult> resultComponent:
                return(getResult(resultComponent));

            case ManiaSkinComponent maniaComponent:
                if (!isLegacySkin.Value)
                {
                    return(null);
                }

                switch (maniaComponent.Component)
                {
                case ManiaSkinComponents.ColumnBackground:
                    return(new LegacyColumnBackground());

                case ManiaSkinComponents.HitTarget:
                    return(new LegacyHitTarget());

                case ManiaSkinComponents.KeyArea:
                    return(new LegacyKeyArea());

                case ManiaSkinComponents.Note:
                    return(new LegacyNotePiece());

                case ManiaSkinComponents.HoldNoteHead:
                    return(new LegacyHoldNoteHeadPiece());

                case ManiaSkinComponents.HoldNoteTail:
                    return(new LegacyHoldNoteTailPiece());
                }

                break;
            }

            return(null);
        }
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (!(component is CatchSkinComponent catchSkinComponent))
            {
                return(null);
            }

            switch (catchSkinComponent.Component)
            {
            case CatchSkinComponents.FruitApple:
            case CatchSkinComponents.FruitBananas:
            case CatchSkinComponents.FruitOrange:
            case CatchSkinComponents.FruitGrapes:
            case CatchSkinComponents.FruitPear:
                var lookupName = catchSkinComponent.Component.ToString().Kebaberize();
                if (GetTexture(lookupName) != null)
                {
                    return(new LegacyFruitPiece(lookupName));
                }

                break;

            case CatchSkinComponents.Droplet:
                if (GetTexture("fruit-drop") != null)
                {
                    return new LegacyFruitPiece("fruit-drop")
                           {
                               Scale = new Vector2(0.8f)
                           }
                }
                ;

                break;
            }

            return(null);
        }
Ejemplo n.º 11
0
 public AGSPanel(string id, Resolver resolver, IImage image) : base(id, resolver)
 {
     _uIEvents              = AddComponent <IUIEvents>();
     _skinComponent         = AddComponent <ISkinComponent>();
     _hasRoom               = AddComponent <IHasRoom>();
     _animationContainer    = AddComponent <IAnimationContainer>();
     _inObjectTree          = AddComponent <IInObjectTree>();
     _collider              = AddComponent <ICollider>();
     _visibleComponent      = AddComponent <IVisibleComponent>();
     _enabledComponent      = AddComponent <IEnabledComponent>();
     _customProperties      = AddComponent <ICustomPropertiesComponent>();
     _drawableInfo          = AddComponent <IDrawableInfo>();
     _hotspotComponent      = AddComponent <IHotspotComponent>();
     _shaderComponent       = AddComponent <IShaderComponent>();
     _translateComponent    = AddComponent <ITranslateComponent>();
     _imageComponent        = AddComponent <IImageComponent>();
     _scaleComponent        = AddComponent <IScaleComponent>();
     _rotateComponent       = AddComponent <IRotateComponent>();
     _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>();
     _modelMatrixComponent  = AddComponent <IModelMatrixComponent>();
     beforeInitComponents(resolver, image);
     InitComponents();
     afterInitComponents(resolver, image);
 }
Ejemplo n.º 12
0
 public Drawable GetDrawableComponent(ISkinComponent component) => CurrentSkin.Value.GetDrawableComponent(component);
Ejemplo n.º 13
0
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (component is OsuSkinComponent osuComponent)
            {
                switch (osuComponent.Component)
                {
                case OsuSkinComponents.FollowPoint:
                    return(this.GetAnimation(component.LookupName, true, false, true, startAtCurrentTime: false));

                case OsuSkinComponents.SliderFollowCircle:
                    var followCircle = this.GetAnimation("sliderfollowcircle", true, true, true);
                    if (followCircle != null)
                    {
                        // follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x
                        followCircle.Scale *= 0.5f;
                    }
                    return(followCircle);

                case OsuSkinComponents.SliderBall:
                    var sliderBallContent = this.GetAnimation("sliderb", true, true, animationSeparator: "");

                    // todo: slider ball has a custom frame delay based on velocity
                    // Math.Max((150 / Velocity) * GameBase.SIXTY_FRAME_TIME, GameBase.SIXTY_FRAME_TIME);

                    if (sliderBallContent != null)
                    {
                        return(new LegacySliderBall(sliderBallContent, this));
                    }

                    return(null);

                case OsuSkinComponents.SliderBody:
                    if (hasHitCircle.Value)
                    {
                        return(new LegacySliderBody());
                    }

                    return(null);

                case OsuSkinComponents.SliderTailHitCircle:
                    if (hasHitCircle.Value)
                    {
                        return(new LegacyMainCirclePiece("sliderendcircle", false));
                    }

                    return(null);

                case OsuSkinComponents.SliderHeadHitCircle:
                    if (hasHitCircle.Value)
                    {
                        return(new LegacySliderHeadHitCircle());
                    }

                    return(null);

                case OsuSkinComponents.ReverseArrow:
                    if (hasHitCircle.Value)
                    {
                        return(new LegacyReverseArrow());
                    }

                    return(null);

                case OsuSkinComponents.HitCircle:
                    if (hasHitCircle.Value)
                    {
                        return(new LegacyMainCirclePiece());
                    }

                    return(null);

                case OsuSkinComponents.Cursor:
                    if (GetTexture("cursor") != null)
                    {
                        return(new LegacyCursor(this));
                    }

                    return(null);

                case OsuSkinComponents.CursorTrail:
                    if (GetTexture("cursortrail") != null)
                    {
                        return(new LegacyCursorTrail(this));
                    }

                    return(null);

                case OsuSkinComponents.CursorParticles:
                    if (GetTexture("star2") != null)
                    {
                        return(new LegacyCursorParticles());
                    }

                    return(null);

                case OsuSkinComponents.HitCircleText:
                    if (!this.HasFont(LegacyFont.HitCircle))
                    {
                        return(null);
                    }

                    return(new LegacySpriteText(LegacyFont.HitCircle)
                    {
                        // stable applies a blanket 0.8x scale to hitcircle fonts
                        Scale = new Vector2(0.8f),
                    });

                case OsuSkinComponents.SpinnerBody:
                    bool hasBackground = GetTexture("spinner-background") != null;

                    if (GetTexture("spinner-top") != null && !hasBackground)
                    {
                        return(new LegacyNewStyleSpinner());
                    }
                    else if (hasBackground)
                    {
                        return(new LegacyOldStyleSpinner());
                    }

                    return(null);

                case OsuSkinComponents.ApproachCircle:
                    return(new LegacyApproachCircle());
                }
            }

            return(base.GetDrawableComponent(component));
        }
Ejemplo n.º 14
0
 public Drawable GetDrawableComponent(ISkinComponent component) => throw new NotSupportedException();
Ejemplo n.º 15
0
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (component is SkinnableTargetComponent targetComponent)
            {
                switch (targetComponent.Target)
                {
                case SkinnableTarget.MainHUDComponents:
                    var components = base.GetDrawableComponent(component) as SkinnableTargetComponentsContainer;

                    if (providesComboCounter && components != null)
                    {
                        // catch may provide its own combo counter; hide the default.
                        // todo: this should be done in an elegant way per ruleset, defining which HUD skin components should be displayed.
                        foreach (var legacyComboCounter in components.OfType <LegacyComboCounter>())
                        {
                            legacyComboCounter.HiddenByRulesetImplementation = false;
                        }
                    }

                    return(components);
                }
            }

            if (component is CatchSkinComponent catchSkinComponent)
            {
                switch (catchSkinComponent.Component)
                {
                case CatchSkinComponents.Fruit:
                    if (GetTexture("fruit-pear") != null)
                    {
                        return(new LegacyFruitPiece());
                    }

                    return(null);

                case CatchSkinComponents.Banana:
                    if (GetTexture("fruit-bananas") != null)
                    {
                        return(new LegacyBananaPiece());
                    }

                    return(null);

                case CatchSkinComponents.Droplet:
                    if (GetTexture("fruit-drop") != null)
                    {
                        return(new LegacyDropletPiece());
                    }

                    return(null);

                case CatchSkinComponents.Catcher:
                    decimal version = GetConfig <SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value ?? 1;

                    if (version < 2.3m)
                    {
                        if (hasOldStyleCatcherSprite())
                        {
                            return(new LegacyCatcherOld());
                        }
                    }

                    if (hasNewStyleCatcherSprite())
                    {
                        return(new LegacyCatcherNew());
                    }

                    return(null);

                case CatchSkinComponents.CatchComboCounter:
                    if (providesComboCounter)
                    {
                        return(new LegacyCatchComboCounter());
                    }

                    return(null);

                case CatchSkinComponents.HitExplosion:
                    if (hasOldStyleCatcherSprite() || hasNewStyleCatcherSprite())
                    {
                        return(new LegacyHitExplosion());
                    }

                    return(null);

                default:
                    throw new UnsupportedSkinComponentException(component);
                }
            }

            return(base.GetDrawableComponent(component));
        }
Ejemplo n.º 16
0
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (component is GameplaySkinComponent <HitResult> )
            {
                // if a taiko skin is providing explosion sprites, hide the judgements completely
                if (hasExplosion.Value)
                {
                    return(Drawable.Empty().With(d => d.Expire()));
                }
            }

            if (component is TaikoSkinComponent taikoComponent)
            {
                switch (taikoComponent.Component)
                {
                case TaikoSkinComponents.DrumRollBody:
                    if (GetTexture("taiko-roll-middle") != null)
                    {
                        return(new LegacyDrumRoll());
                    }

                    return(null);

                case TaikoSkinComponents.InputDrum:
                    if (GetTexture("taiko-bar-left") != null)
                    {
                        return(new LegacyInputDrum());
                    }

                    return(null);

                case TaikoSkinComponents.CentreHit:
                case TaikoSkinComponents.RimHit:

                    if (GetTexture("taikohitcircle") != null)
                    {
                        return(new LegacyHit(taikoComponent.Component));
                    }

                    return(null);

                case TaikoSkinComponents.DrumRollTick:
                    return(this.GetAnimation("sliderscorepoint", false, false));

                case TaikoSkinComponents.HitTarget:
                    if (GetTexture("taikobigcircle") != null)
                    {
                        return(new TaikoLegacyHitTarget());
                    }

                    return(null);

                case TaikoSkinComponents.PlayfieldBackgroundRight:
                    if (GetTexture("taiko-bar-right") != null)
                    {
                        return(new TaikoLegacyPlayfieldBackgroundRight());
                    }

                    return(null);

                case TaikoSkinComponents.PlayfieldBackgroundLeft:
                    // This is displayed inside LegacyInputDrum. It is required to be there for layout purposes (can be seen on legacy skins).
                    if (GetTexture("taiko-bar-right") != null)
                    {
                        return(Drawable.Empty());
                    }

                    return(null);

                case TaikoSkinComponents.BarLine:
                    if (GetTexture("taiko-barline") != null)
                    {
                        return(new LegacyBarLine());
                    }

                    return(null);

                case TaikoSkinComponents.TaikoExplosionMiss:

                    var missSprite = this.GetAnimation(getHitName(taikoComponent.Component), true, false);
                    if (missSprite != null)
                    {
                        return(new LegacyHitExplosion(missSprite));
                    }

                    return(null);

                case TaikoSkinComponents.TaikoExplosionOk:
                case TaikoSkinComponents.TaikoExplosionGreat:

                    var hitName   = getHitName(taikoComponent.Component);
                    var hitSprite = this.GetAnimation(hitName, true, false);

                    if (hitSprite != null)
                    {
                        var strongHitSprite = this.GetAnimation($"{hitName}k", true, false);

                        return(new LegacyHitExplosion(hitSprite, strongHitSprite));
                    }

                    return(null);

                case TaikoSkinComponents.TaikoExplosionKiai:
                    // suppress the default kiai explosion if the skin brings its own sprites.
                    // the drawable needs to expire as soon as possible to avoid accumulating empty drawables on the playfield.
                    if (hasExplosion.Value)
                    {
                        return(Drawable.Empty().With(d => d.Expire()));
                    }

                    return(null);

                case TaikoSkinComponents.Scroller:
                    if (GetTexture("taiko-slider") != null)
                    {
                        return(new LegacyTaikoScroller());
                    }

                    return(null);

                case TaikoSkinComponents.Mascot:
                    return(new DrawableTaikoMascot());
                }
            }

            return(Source.GetDrawableComponent(component));
        }
Ejemplo n.º 17
0
 public Drawable GetDrawableComponent(ISkinComponent component) => skin.GetDrawableComponent(component);
Ejemplo n.º 18
0
 public Drawable GetDrawableComponent(ISkinComponent component)
 => provider.GetDrawableComponent(component, false);
Ejemplo n.º 19
0
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (base.GetDrawableComponent(component) is Drawable c)
            {
                return(c);
            }

            switch (component)
            {
            case SkinnableTargetComponent target:
                switch (target.Target)
                {
                case SkinnableTarget.MainHUDComponents:
                    var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
                    {
                        var score     = container.OfType <DefaultScoreCounter>().FirstOrDefault();
                        var accuracy  = container.OfType <DefaultAccuracyCounter>().FirstOrDefault();
                        var combo     = container.OfType <DefaultComboCounter>().FirstOrDefault();
                        var ppCounter = container.OfType <PerformancePointsCounter>().FirstOrDefault();

                        if (score != null)
                        {
                            score.Anchor = Anchor.TopCentre;
                            score.Origin = Anchor.TopCentre;

                            // elements default to beneath the health bar
                            const float vertical_offset = 30;

                            const float horizontal_padding = 20;

                            score.Position = new Vector2(0, vertical_offset);

                            if (ppCounter != null)
                            {
                                ppCounter.Y      = score.Position.Y + ppCounter.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).Y - 4;
                                ppCounter.Origin = Anchor.TopCentre;
                                ppCounter.Anchor = Anchor.TopCentre;
                            }

                            if (accuracy != null)
                            {
                                accuracy.Position = new Vector2(-accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 - horizontal_padding, vertical_offset + 5);
                                accuracy.Origin   = Anchor.TopRight;
                                accuracy.Anchor   = Anchor.TopCentre;
                            }

                            if (combo != null)
                            {
                                combo.Position = new Vector2(accuracy.ScreenSpaceDeltaToParentSpace(score.ScreenSpaceDrawQuad.Size).X / 2 + horizontal_padding, vertical_offset + 5);
                                combo.Anchor   = Anchor.TopCentre;
                            }

                            var hitError = container.OfType <HitErrorMeter>().FirstOrDefault();

                            if (hitError != null)
                            {
                                hitError.Anchor = Anchor.CentreLeft;
                                hitError.Origin = Anchor.CentreLeft;
                            }

                            var hitError2 = container.OfType <HitErrorMeter>().LastOrDefault();

                            if (hitError2 != null)
                            {
                                hitError2.Anchor = Anchor.CentreRight;
                                hitError2.Scale  = new Vector2(-1, 1);
                                // origin flipped to match scale above.
                                hitError2.Origin = Anchor.CentreLeft;
                            }
                        }
                    })
                    {
                        Children = new Drawable[]
                        {
                            new DefaultComboCounter(),
                            new DefaultScoreCounter(),
                            new DefaultAccuracyCounter(),
                            new DefaultHealthDisplay(),
                            new SongProgress(),
                            new BarHitErrorMeter(),
                            new BarHitErrorMeter(),
                            new PerformancePointsCounter()
                        }
                    };

                    return(skinnableTargetWrapper);
                }

                break;
            }

            return(null);
        }
Ejemplo n.º 20
0
 public Drawable GetDrawableComponent(ISkinComponent component) => source?.GetDrawableComponent(component);
Ejemplo n.º 21
0
 protected override Drawable CreateDefault(ISkinComponent component) => new Sprite
 {
     Texture = textures.Get(component.LookupName)
 };
Ejemplo n.º 22
0
 public Drawable GetDrawableComponent(ISkinComponent component) => lookupWithFallback(s => s.GetDrawableComponent(component));
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (!(component is KaraokeSkinComponent karaokeComponent))
            {
                return(null);
            }

            if (!isLegacySkin.Value)
            {
                return(null);
            }

            switch (karaokeComponent.Component)
            {
            case KaraokeSkinComponents.ColumnBackground:
                if (textureExist(LegacyColumnBackground.GetTextureName()))
                {
                    return(new LegacyColumnBackground());
                }

                return(null);

            case KaraokeSkinComponents.StageBackground:
                if (textureExist(LegacyStageBackground.GetTextureName()))
                {
                    return(new LegacyStageBackground());
                }

                return(null);

            case KaraokeSkinComponents.JudgementLine:
                var judgementLine = LegacyJudgementLine.GetTextureNameFromLookup(LegacyKaraokeSkinConfigurationLookups.JudgementLineBodyImage);
                if (textureExist(judgementLine))
                {
                    return(new LegacyJudgementLine());
                }

                return(null);

            case KaraokeSkinComponents.Note:
                var foregroundBody = LegacyNotePiece.GetTextureNameFromLookup(LegacyKaraokeSkinConfigurationLookups.NoteBodyImage, LegacyKaraokeSkinNoteLayer.Foreground);
                var backgroundBody = LegacyNotePiece.GetTextureNameFromLookup(LegacyKaraokeSkinConfigurationLookups.NoteBodyImage, LegacyKaraokeSkinNoteLayer.Background);
                if (textureExist(foregroundBody, backgroundBody))
                {
                    return(new LegacyNotePiece());
                }

                return(null);

            case KaraokeSkinComponents.HitExplosion:
                if (animationExist(LegacyHitExplosion.GetTextureName()))
                {
                    return(new LegacyHitExplosion());
                }

                return(null);

            default:
                throw new ArgumentOutOfRangeException(nameof(karaokeComponent.Component));
            }
        }
Ejemplo n.º 24
0
 public Drawable GetDrawableComponent(ISkinComponent component)
 => GetDrawableComponent(component, true);
Ejemplo n.º 25
0
 protected virtual bool AllowDrawableLookup(ISkinComponent component) => true;
Ejemplo n.º 26
0
 public override Drawable GetDrawableComponent(ISkinComponent component) => null;
Ejemplo n.º 27
0
 public abstract Drawable GetDrawableComponent(ISkinComponent componentName);
Ejemplo n.º 28
0
 public Drawable GetDrawableComponent(ISkinComponent component) => throw new System.NotImplementedException();
        public override Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (!(component is TaikoSkinComponent taikoComponent))
            {
                return(null);
            }

            switch (taikoComponent.Component)
            {
            case TaikoSkinComponents.DrumRollBody:
                if (GetTexture("taiko-roll-middle") != null)
                {
                    return(new LegacyDrumRoll());
                }

                return(null);

            case TaikoSkinComponents.InputDrum:
                if (GetTexture("taiko-bar-left") != null)
                {
                    return(new LegacyInputDrum());
                }

                return(null);

            case TaikoSkinComponents.CentreHit:
            case TaikoSkinComponents.RimHit:

                if (GetTexture("taikohitcircle") != null)
                {
                    return(new LegacyHit(taikoComponent.Component));
                }

                return(null);

            case TaikoSkinComponents.DrumRollTick:
                return(this.GetAnimation("sliderscorepoint", false, false));

            case TaikoSkinComponents.HitTarget:
                if (GetTexture("taikobigcircle") != null)
                {
                    return(new TaikoLegacyHitTarget());
                }

                return(null);

            case TaikoSkinComponents.PlayfieldBackgroundRight:
                if (GetTexture("taiko-bar-right") != null)
                {
                    return(new TaikoLegacyPlayfieldBackgroundRight());
                }

                return(null);

            case TaikoSkinComponents.PlayfieldBackgroundLeft:
                // This is displayed inside LegacyInputDrum. It is required to be there for layout purposes (can be seen on legacy skins).
                if (GetTexture("taiko-bar-right") != null)
                {
                    return(Drawable.Empty());
                }

                return(null);

            case TaikoSkinComponents.BarLine:
                if (GetTexture("taiko-barline") != null)
                {
                    return(new LegacyBarLine());
                }

                return(null);

            case TaikoSkinComponents.TaikoExplosionMiss:

                var missSprite = this.GetAnimation(getHitName(taikoComponent.Component), true, false);
                if (missSprite != null)
                {
                    return(new LegacyHitExplosion(missSprite));
                }

                return(null);

            case TaikoSkinComponents.TaikoExplosionOk:
            case TaikoSkinComponents.TaikoExplosionGreat:

                var hitName         = getHitName(taikoComponent.Component);
                var hitSprite       = this.GetAnimation(hitName, true, false);
                var strongHitSprite = this.GetAnimation($"{hitName}k", true, false);

                if (hitSprite != null)
                {
                    return(new LegacyHitExplosion(hitSprite, strongHitSprite));
                }

                return(null);

            case TaikoSkinComponents.Scroller:
                if (GetTexture("taiko-slider") != null)
                {
                    return(new LegacyTaikoScroller());
                }

                return(null);

            case TaikoSkinComponents.Mascot:
                return(new DrawableTaikoMascot());
            }

            return(Source.GetDrawableComponent(component));
        }
Ejemplo n.º 30
0
 public Drawable GetDrawableComponent(ISkinComponent component) => null;
Ejemplo n.º 31
0
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            if (!(component is OsuSkinComponent osuComponent))
            {
                return(null);
            }

            switch (osuComponent.Component)
            {
            case OsuSkinComponents.FollowPoint:
                return(this.GetAnimation(component.LookupName, true, false, true));

            case OsuSkinComponents.SliderFollowCircle:
                var followCircle = this.GetAnimation("sliderfollowcircle", true, true, true);
                if (followCircle != null)
                {
                    // follow circles are 2x the hitcircle resolution in legacy skins (since they are scaled down from >1x
                    followCircle.Scale *= 0.5f;
                }
                return(followCircle);

            case OsuSkinComponents.SliderBall:
                var sliderBallContent = this.GetAnimation("sliderb", true, true, animationSeparator: "");

                // todo: slider ball has a custom frame delay based on velocity
                // Math.Max((150 / Velocity) * GameBase.SIXTY_FRAME_TIME, GameBase.SIXTY_FRAME_TIME);

                if (sliderBallContent != null)
                {
                    var size = sliderBallContent.Size;

                    sliderBallContent.RelativeSizeAxes = Axes.Both;
                    sliderBallContent.Size             = Vector2.One;

                    return(new LegacySliderBall(sliderBallContent)
                    {
                        Size = size
                    });
                }

                return(null);

            case OsuSkinComponents.SliderBody:
                if (hasHitCircle.Value)
                {
                    return(new LegacySliderBody());
                }

                return(null);

            case OsuSkinComponents.SliderHeadHitCircle:
                if (hasHitCircle.Value)
                {
                    return(new LegacyMainCirclePiece("sliderstartcircle"));
                }

                return(null);

            case OsuSkinComponents.HitCircle:
                if (hasHitCircle.Value)
                {
                    return(new LegacyMainCirclePiece());
                }

                return(null);

            case OsuSkinComponents.Cursor:
                if (source.GetTexture("cursor") != null)
                {
                    return(new LegacyCursor());
                }

                return(null);

            case OsuSkinComponents.CursorTrail:
                if (source.GetTexture("cursortrail") != null)
                {
                    return(new LegacyCursorTrail());
                }

                return(null);

            case OsuSkinComponents.HitCircleText:
                var font    = GetConfig <OsuSkinConfiguration, string>(OsuSkinConfiguration.HitCirclePrefix)?.Value ?? "default";
                var overlap = GetConfig <OsuSkinConfiguration, float>(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? 0;

                return(!hasFont(font)
                        ? null
                        : new LegacySpriteText(source, font)
                {
                    // stable applies a blanket 0.8x scale to hitcircle fonts
                    Scale = new Vector2(0.8f),
                    Spacing = new Vector2(-overlap, 0)
                });
            }

            return(null);
        }