Ejemplo n.º 1
0
        protected bool AssertComponentsFromExpectedSource(SkinnableTarget target, ISkin expectedSource)
        {
            var actualComponentsContainer = Player.ChildrenOfType <SkinnableTargetContainer>().First(s => s.Target == target)
                                            .ChildrenOfType <SkinnableTargetComponentsContainer>().SingleOrDefault();

            if (actualComponentsContainer == null)
            {
                return(false);
            }

            var actualInfo = actualComponentsContainer.CreateSkinnableInfo();

            var expectedComponentsContainer = (SkinnableTargetComponentsContainer)expectedSource.GetDrawableComponent(new SkinnableTargetComponent(target));

            if (expectedComponentsContainer == null)
            {
                return(false);
            }

            var expectedComponentsAdjustmentContainer = new Container
            {
                Position = actualComponentsContainer.Parent.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content),
                Size     = actualComponentsContainer.DrawSize,
                Child    = expectedComponentsContainer,
            };

            Add(expectedComponentsAdjustmentContainer);
            expectedComponentsAdjustmentContainer.UpdateSubTree();
            var expectedInfo = expectedComponentsContainer.CreateSkinnableInfo();

            Remove(expectedComponentsAdjustmentContainer);

            return(almostEqual(actualInfo, expectedInfo));
        }
        protected bool AssertComponentsFromExpectedSource(SkinnableTarget target, ISkin expectedSource)
        {
            var actualComponentsContainer = Player.ChildrenOfType <SkinnableTargetContainer>().First(s => s.Target == target)
                                            .ChildrenOfType <SkinnableTargetComponentsContainer>().SingleOrDefault();

            if (actualComponentsContainer == null)
            {
                return(false);
            }

            var actualInfo = actualComponentsContainer.CreateSkinnableInfo();

            var expectedComponentsContainer = (SkinnableTargetComponentsContainer)expectedSource.GetDrawableComponent(new SkinnableTargetComponent(target));

            if (expectedComponentsContainer == null)
            {
                return(false);
            }

            var expectedComponentsAdjustmentContainer = new DependencyProvidingContainer
            {
                Position = actualComponentsContainer.Parent.ToSpaceOfOtherDrawable(actualComponentsContainer.DrawPosition, Content),
                Size     = actualComponentsContainer.DrawSize,
                Child    = expectedComponentsContainer,
                // proxy the same required dependencies that `actualComponentsContainer` is using.
                CachedDependencies = new (Type, object)[]
Ejemplo n.º 3
0
            public Drawable GetDrawableComponent(ISkinComponent component)
            {
                if (provider.AllowDrawableLookup(component))
                {
                    return(skin.GetDrawableComponent(component));
                }

                return(null);
            }
Ejemplo n.º 4
0
        public Drawable GetDrawableComponent(string componentName)
        {
            Drawable sourceDrawable;

            if (beatmapSkins.Value && (sourceDrawable = skin.GetDrawableComponent(componentName)) != null)
            {
                return(sourceDrawable);
            }

            return(fallbackSource?.GetDrawableComponent(componentName));
        }
        public Drawable GetDrawableComponent(ISkinComponent component)
        {
            Drawable sourceDrawable;

            if (AllowDrawableLookup(component) && (sourceDrawable = skin?.GetDrawableComponent(component)) != null)
            {
                return(sourceDrawable);
            }

            return(fallbackSource?.GetDrawableComponent(component));
        }
Ejemplo n.º 6
0
        public Drawable GetDrawableComponent(string componentName)
        {
            Drawable sourceDrawable;

            if (AllowDrawableLookup(componentName) && (sourceDrawable = skin?.GetDrawableComponent(componentName)) != null)
            {
                return(sourceDrawable);
            }

            return(fallbackSource?.GetDrawableComponent(componentName));
        }
Ejemplo n.º 7
0
 protected sealed override OsuSpriteText CreateSpriteText() => (OsuSpriteText)skin?.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText));
 protected sealed override OsuSpriteText CreateSpriteText()
 => (OsuSpriteText)skin?.GetDrawableComponent(new HUDSkinComponent(HUDSkinComponents.ScoreText))
 ?.With(s => s.Anchor = s.Origin = Anchor.TopRight);