Exemple #1
0
        public Task Import(params string[] paths)
        {
            Schedule(() =>
            {
                var file = new FileInfo(paths.First());

                // import to skin
                currentSkin.Value.SkinInfo.PerformWrite(skinInfo =>
                {
                    using (var contents = file.OpenRead())
                        skins.AddFile(skinInfo, contents, file.Name);
                });

                // Even though we are 100% on an update thread, we need to wait for realm callbacks to fire (to correctly invalidate caches in RealmBackedResourceStore).
                // See https://github.com/realm/realm-dotnet/discussions/2634#discussioncomment-2483573 for further discussion.
                // This is the best we can do for now.
                realm.Run(r => r.Refresh());

                // place component
                var sprite = new SkinnableSprite
                {
                    SpriteName = { Value = file.Name },
                    Origin     = Anchor.Centre,
                    Position   = getFirstTarget().ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position),
                };

                placeComponent(sprite, false);

                SkinSelectionHandler.ApplyClosestAnchor(sprite);
            });

            return(Task.CompletedTask);
        }
Exemple #2
0
        public Drawable CreateSpriteFromResourcePath(string path, TextureStore textureStore)
        {
            Drawable drawable = null;

            string storyboardPath = BeatmapInfo.BeatmapSet?.Files.FirstOrDefault(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.File.GetStoragePath();

            if (!string.IsNullOrEmpty(storyboardPath))
            {
                drawable = new Sprite {
                    Texture = textureStore.Get(storyboardPath)
                }
            }
            ;
            // if the texture isn't available locally in the beatmap, some storyboards choose to source from the underlying skin lookup hierarchy.
            else if (UseSkinSprites)
            {
                drawable = new SkinnableSprite(path)
                {
                    RelativeSizeAxes = Axes.None,
                    AutoSizeAxes     = Axes.Both,
                };
            }

            return(drawable);
        }
Exemple #3
0
 private void load()
 {
     InternalChild = new SkinnableSprite(@"Play/Catch/fruit-catcher-idle")
     {
         RelativeSizeAxes = Axes.Both,
         Anchor           = Anchor.TopCentre,
         Origin           = Anchor.TopCentre,
     };
 }
Exemple #4
0
 private void load()
 {
     InternalChild = new SkinnableSprite(new CatchSkinComponent(CatchSkinComponents.Catcher))
     {
         RelativeSizeAxes = Axes.Both,
         Anchor           = Anchor.TopCentre,
         Origin           = Anchor.TopCentre,
     };
 }
Exemple #5
0
 private void load()
 {
     InternalChild = new SkinnableSprite("Gameplay/catch/fruit-catcher-idle", confineMode: ConfineMode.ScaleDownToFit)
     {
         RelativeSizeAxes = Axes.Both,
         Anchor           = Anchor.TopCentre,
         Origin           = Anchor.TopCentre,
     };
 }
Exemple #6
0
 private void load()
 {
     AddInternal(Lighting = new SkinnableSprite("lighting")
     {
         Anchor   = Anchor.Centre,
         Origin   = Anchor.Centre,
         Blending = BlendingParameters.Additive,
         Depth    = float.MaxValue,
         Alpha    = 0
     });
 }
Exemple #7
0
 private void load(OsuConfigManager config)
 {
     if (config.Get <bool>(OsuSetting.HitLighting))
     {
         AddInternal(lighting = new SkinnableSprite("lighting")
         {
             Anchor   = Anchor.Centre,
             Origin   = Anchor.Centre,
             Blending = BlendingParameters.Additive,
             Depth    = float.MaxValue
         });
     }
 }
Exemple #8
0
        public Drawable CreateSpriteFromResourcePath(string path, TextureStore textureStore)
        {
            Drawable drawable       = null;
            var      storyboardPath = BeatmapInfo.BeatmapSet?.Files?.Find(f => f.Filename.Equals(path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;

            if (storyboardPath != null)
            {
                drawable = new Sprite {
                    Texture = textureStore.Get(storyboardPath)
                }
            }
            ;
            // if the texture isn't available locally in the beatmap, some storyboards choose to source from the underlying skin lookup hierarchy.
            else if (UseSkinSprites)
            {
                drawable = new SkinnableSprite(path);
            }

            return(drawable);
        }
Exemple #9
0
        private void load(OsuConfigManager config)
        {
            if (config.Get <bool>(OsuSetting.HitLighting) && Result.Type != HitResult.Miss)
            {
                AddInternal(lighting = new SkinnableSprite("lighting")
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Blending = BlendingParameters.Additive,
                    Depth    = float.MaxValue
                });

                if (JudgedObject != null)
                {
                    lightingColour = JudgedObject.AccentColour.GetBoundCopy();
                    lightingColour.BindValueChanged(colour => lighting.Colour = colour.NewValue, true);
                }
                else
                {
                    lighting.Colour = Color4.White;
                }
            }
        }
 private void load(TextureStore textures)
 {
     Child = new SkinnableSprite("Play/osu/approachcircle");
 }