1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Merge branch 'master' into test-beatmap

This commit is contained in:
Dean Herbert 2018-03-13 15:42:30 +09:00 committed by GitHub
commit e9cd97c43a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 51 deletions

@ -1 +1 @@
Subproject commit 59004b46f2c96ac02fec712e66f9f96fe252f2fa
Subproject commit d29c8365ba3cf7924b57cf22341f4af55658764c

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
@ -12,6 +13,12 @@ namespace osu.Game.Rulesets.Mania.UI
public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject)
: base(judgement, judgedObject)
{
}
[BackgroundDependencyLoader]
private void load()
{
if (JudgementText != null)
JudgementText.TextSize = 25;
}

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Edit.Layers.Selection;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using OpenTK;
@ -14,12 +15,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays
public class SliderCircleOverlay : HitObjectOverlay
{
public SliderCircleOverlay(DrawableHitCircle sliderHead, DrawableSlider slider)
: this(sliderHead, sliderHead.Position, slider)
: this(sliderHead, Vector2.Zero, slider)
{
}
public SliderCircleOverlay(DrawableSliderTail sliderTail, DrawableSlider slider)
: this(sliderTail, sliderTail.Position, slider)
: this(sliderTail, ((Slider)slider.HitObject).Curve.PositionAt(1), slider)
{
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void LoadComplete()
{
if (Judgement.Result != HitResult.Miss)
JudgementText.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
base.LoadComplete();
}

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Skinning;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
@ -19,15 +20,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Blending = BlendingMode.Additive;
Alpha = 0;
Children = new Drawable[]
{
new TrianglesPiece
Child = new SkinnableDrawable("Play/osu/hitcircle-explode", _ => new TrianglesPiece
{
Blending = BlendingMode.Additive,
RelativeSizeAxes = Axes.Both,
Alpha = 0.2f,
}
};
}, false);
}
}
}

View File

@ -5,6 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;
using osu.Framework.Graphics.Shapes;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
@ -14,22 +15,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
Size = new Vector2(128);
Masking = true;
CornerRadius = Size.X / 2;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Blending = BlendingMode.Additive;
Alpha = 0;
Children = new Drawable[]
Child = new SkinnableDrawable("Play/osu/hitcircle-flash", name => new CircularContainer
{
new Box
Masking = true,
RelativeSizeAxes = Axes.Both,
Child = new Box
{
RelativeSizeAxes = Axes.Both
}
};
}, false);
}
}
}

View File

@ -11,6 +11,8 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Judgements
{
@ -19,11 +21,13 @@ namespace osu.Game.Rulesets.Judgements
/// </summary>
public class DrawableJudgement : Container
{
private const float judgement_size = 80;
protected readonly Judgement Judgement;
public readonly DrawableHitObject JudgedObject;
protected readonly SpriteText JudgementText;
protected SpriteText JudgementText;
/// <summary>
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
@ -34,31 +38,20 @@ namespace osu.Game.Rulesets.Judgements
Judgement = judgement;
JudgedObject = judgedObject;
AutoSizeAxes = Axes.Both;
Children = new[]
{
JudgementText = new OsuSpriteText
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Text = judgement.Result.GetDescription().ToUpper(),
Font = @"Venera",
Scale = new Vector2(0.85f, 1),
TextSize = 12
}
};
Size = new Vector2(judgement_size);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
switch (Judgement.Result)
Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText
{
case HitResult.Miss:
Colour = colours.Red;
break;
}
Text = Judgement.Result.GetDescription().ToUpper(),
Font = @"Venera",
Colour = Judgement.Result == HitResult.Miss ? colours.Red : Color4.White,
Scale = new Vector2(0.85f, 1),
TextSize = 12
}, restrictSize: false);
}
protected override void LoadComplete()

View File

@ -29,15 +29,26 @@ namespace osu.Game.Skinning
public override Drawable GetDrawableComponent(string componentName)
{
switch (componentName)
{
case "Play/Miss":
componentName = "hit0";
break;
case "Play/Meh":
componentName = "hit50";
break;
case "Play/Good":
componentName = "hit100";
break;
case "Play/Great":
componentName = "hit300";
break;
}
var texture = textures.Get(componentName);
if (texture == null) return null;
return new Sprite
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Texture = texture,
};
return new Sprite { Texture = texture };
}
public override SampleChannel GetSample(string sampleName) => samples.Get(sampleName);
@ -47,8 +58,14 @@ namespace osu.Game.Skinning
private readonly SkinInfo skin;
private readonly IResourceStore<byte[]> underlyingStore;
private string getPathForFile(string filename) =>
skin.Files.FirstOrDefault(f => string.Equals(Path.GetFileNameWithoutExtension(f.Filename), filename.Split('/').Last(), StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
private string getPathForFile(string filename)
{
string lastPiece = filename.Split('/').Last();
var file = skin.Files.FirstOrDefault(f =>
string.Equals(Path.GetFileNameWithoutExtension(f.Filename), lastPiece, StringComparison.InvariantCultureIgnoreCase));
return file?.FileInfo.StoragePath;
}
public LegacySkinResourceStore(SkinInfo skin, IResourceStore<byte[]> underlyingStore)
{

View File

@ -3,13 +3,14 @@
using System;
using osu.Framework.Graphics;
using OpenTK;
namespace osu.Game.Skinning
{
public class SkinnableDrawable : SkinnableDrawable<Drawable>
{
public SkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, bool fallback = true)
: base(name, defaultImplementation, fallback)
public SkinnableDrawable(string name, Func<string, Drawable> defaultImplementation, bool fallback = true, bool restrictSize = true)
: base(name, defaultImplementation, fallback, restrictSize)
{
}
}
@ -21,10 +22,20 @@ namespace osu.Game.Skinning
private readonly string componentName;
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, bool fallback = true) : base(fallback)
private readonly bool restrictSize;
/// <summary>
///
/// </summary>
/// <param name="name">The namespace-complete resource name for this skinnable element.</param>
/// <param name="defaultImplementation">A function to create the default skin implementation of this element.</param>
/// <param name="fallback">Whther to fallback to the default implementation when a custom skin is specified but not implementation is present.</param>
/// <param name="restrictSize">Whether a user-skin drawable should be limited to the size of our parent.</param>
public SkinnableDrawable(string name, Func<string, T> defaultImplementation, bool fallback = true, bool restrictSize = true) : base(fallback)
{
componentName = name;
createDefault = defaultImplementation;
this.restrictSize = restrictSize;
RelativeSizeAxes = Axes.Both;
}
@ -32,11 +43,25 @@ namespace osu.Game.Skinning
protected override void SkinChanged(Skin skin, bool allowFallback)
{
var drawable = skin.GetDrawableComponent(componentName);
if (drawable == null && allowFallback)
if (drawable != null)
{
if (restrictSize)
{
drawable.RelativeSizeAxes = Axes.Both;
drawable.Size = Vector2.One;
drawable.FillMode = FillMode.Fit;
}
}
else if (allowFallback)
drawable = createDefault(componentName);
if (drawable != null)
{
drawable.Origin = Anchor.Centre;
drawable.Anchor = Anchor.Centre;
InternalChild = drawable;
}
else
ClearInternal();
}