mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Merge branch 'master' into mania-stage-background-skinning
This commit is contained in:
commit
cb6372acac
@ -28,7 +28,9 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
{
|
||||
typeof(Column),
|
||||
typeof(ColumnBackground),
|
||||
typeof(ColumnHitObjectArea)
|
||||
typeof(ColumnHitObjectArea),
|
||||
typeof(DefaultKeyArea),
|
||||
typeof(DefaultHitTarget)
|
||||
};
|
||||
|
||||
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||
|
@ -42,6 +42,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
Index = index;
|
||||
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Width = COLUMN_WIDTH;
|
||||
|
||||
Drawable background = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.ColumnBackground, Index), _ => new DefaultColumnBackground())
|
||||
{
|
||||
|
@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Blending = BlendingParameters.Additive;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
InternalChild = scaleContainer = new ReverseArrowPiece();
|
||||
|
@ -8,11 +8,16 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class ReverseArrowPiece : BeatSyncedContainer
|
||||
{
|
||||
[Resolved]
|
||||
private DrawableHitObject drawableRepeat { get; set; }
|
||||
|
||||
public ReverseArrowPiece()
|
||||
{
|
||||
Divisor = 2;
|
||||
@ -21,13 +26,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Blending = BlendingParameters.Additive;
|
||||
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.ReverseArrow), _ => new SpriteIcon
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Icon = FontAwesome.Solid.ChevronRight,
|
||||
Size = new Vector2(0.35f)
|
||||
})
|
||||
@ -37,7 +41,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) =>
|
||||
Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out);
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||
{
|
||||
if (!drawableRepeat.IsHit)
|
||||
Child.ScaleTo(1.3f).ScaleTo(1f, timingPoint.BeatLength, Easing.Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
this.drawableSlider = drawableSlider;
|
||||
this.slider = slider;
|
||||
|
||||
Blending = BlendingParameters.Additive;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
@ -241,6 +240,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
Scale = new Vector2(radius / OsuHitObject.OBJECT_RADIUS),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Blending = BlendingParameters.Additive,
|
||||
BorderThickness = 10,
|
||||
BorderColour = Color4.White,
|
||||
Alpha = 1,
|
||||
|
@ -0,0 +1,5 @@
|
||||
[General]
|
||||
Name: an old skin
|
||||
Author: an old guy
|
||||
|
||||
// no version specified means v1
|
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
@ -18,9 +18,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
/// </summary>
|
||||
internal class LegacyInputDrum : Container
|
||||
{
|
||||
private LegacyHalfDrum left;
|
||||
private LegacyHalfDrum right;
|
||||
|
||||
public LegacyInputDrum()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Size = new Vector2(180, 200);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -32,25 +35,47 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
{
|
||||
Texture = skin.GetTexture("taiko-bar-left")
|
||||
},
|
||||
new LegacyHalfDrum(false)
|
||||
left = new LegacyHalfDrum(false)
|
||||
{
|
||||
Name = "Left Half",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
RimAction = TaikoAction.LeftRim,
|
||||
CentreAction = TaikoAction.LeftCentre
|
||||
},
|
||||
new LegacyHalfDrum(true)
|
||||
right = new LegacyHalfDrum(true)
|
||||
{
|
||||
Name = "Right Half",
|
||||
Anchor = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
Origin = Anchor.TopRight,
|
||||
Scale = new Vector2(-1, 1),
|
||||
RimAction = TaikoAction.RightRim,
|
||||
CentreAction = TaikoAction.RightCentre
|
||||
}
|
||||
};
|
||||
|
||||
// this will be used in the future for stable skin alignment. keeping here for reference.
|
||||
const float taiko_bar_y = 0;
|
||||
|
||||
// stable things
|
||||
const float ratio = 1.6f;
|
||||
|
||||
// because the right half is flipped, we need to position using width - position to get the true "topleft" origin position
|
||||
float negativeScaleAdjust = Width / ratio;
|
||||
|
||||
if (skin.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.1m)
|
||||
{
|
||||
left.Centre.Position = new Vector2(0, taiko_bar_y) * ratio;
|
||||
right.Centre.Position = new Vector2(negativeScaleAdjust - 56, taiko_bar_y) * ratio;
|
||||
left.Rim.Position = new Vector2(0, taiko_bar_y) * ratio;
|
||||
right.Rim.Position = new Vector2(negativeScaleAdjust - 56, taiko_bar_y) * ratio;
|
||||
}
|
||||
else
|
||||
{
|
||||
left.Centre.Position = new Vector2(18, taiko_bar_y + 31) * ratio;
|
||||
right.Centre.Position = new Vector2(negativeScaleAdjust - 54, taiko_bar_y + 31) * ratio;
|
||||
left.Rim.Position = new Vector2(8, taiko_bar_y + 23) * ratio;
|
||||
right.Rim.Position = new Vector2(negativeScaleAdjust - 53, taiko_bar_y + 23) * ratio;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,8 +93,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
/// </summary>
|
||||
public TaikoAction CentreAction;
|
||||
|
||||
private readonly Sprite rimHit;
|
||||
private readonly Sprite centreHit;
|
||||
public readonly Sprite Rim;
|
||||
public readonly Sprite Centre;
|
||||
|
||||
[Resolved]
|
||||
private DrumSampleMapping sampleMappings { get; set; }
|
||||
@ -80,18 +105,16 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rimHit = new Sprite
|
||||
Rim = new Sprite
|
||||
{
|
||||
Anchor = flipped ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||
Origin = flipped ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||
Scale = new Vector2(-1, 1),
|
||||
Origin = flipped ? Anchor.TopLeft : Anchor.TopRight,
|
||||
Alpha = 0,
|
||||
},
|
||||
centreHit = new Sprite
|
||||
Centre = new Sprite
|
||||
{
|
||||
Anchor = flipped ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||
Origin = flipped ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||
Alpha = 0,
|
||||
Origin = flipped ? Anchor.TopRight : Anchor.TopLeft,
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -99,8 +122,8 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource skin)
|
||||
{
|
||||
rimHit.Texture = skin.GetTexture(@"taiko-drum-outer");
|
||||
centreHit.Texture = skin.GetTexture(@"taiko-drum-inner");
|
||||
Rim.Texture = skin.GetTexture(@"taiko-drum-outer");
|
||||
Centre.Texture = skin.GetTexture(@"taiko-drum-inner");
|
||||
}
|
||||
|
||||
public bool OnPressed(TaikoAction action)
|
||||
@ -110,12 +133,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning
|
||||
|
||||
if (action == CentreAction)
|
||||
{
|
||||
target = centreHit;
|
||||
target = Centre;
|
||||
drumSample.Centre?.Play();
|
||||
}
|
||||
else if (action == RimAction)
|
||||
{
|
||||
target = rimHit;
|
||||
target = Rim;
|
||||
drumSample.Rim?.Play();
|
||||
}
|
||||
|
||||
|
4
osu.Game.Tests/Resources/mania-skin-zero-minwidth.ini
Normal file
4
osu.Game.Tests/Resources/mania-skin-zero-minwidth.ini
Normal file
@ -0,0 +1,4 @@
|
||||
[Mania]
|
||||
Keys: 4
|
||||
ColumnWidth: 10,10,10,10
|
||||
WidthForNoteHeightScale: 0
|
@ -99,5 +99,20 @@ namespace osu.Game.Tests.Skins
|
||||
Assert.That(configs[0].CustomColours, Contains.Key("ColourBarline").And.ContainValue(new Color4(50, 50, 50, 50)));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMinimumColumnWidthFallsBackWhenZeroIsProvided()
|
||||
{
|
||||
var decoder = new LegacyManiaSkinDecoder();
|
||||
|
||||
using (var resStream = TestResources.OpenResource("mania-skin-zero-minwidth.ini"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var configs = decoder.Decode(stream);
|
||||
|
||||
Assert.That(configs.Count, Is.EqualTo(1));
|
||||
Assert.That(configs[0].MinimumColumnWidth, Is.EqualTo(16));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
|
||||
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
|
||||
|
||||
public override bool UpdateSubTreeMasking(Drawable source, RectangleF maskingBounds) => false;
|
||||
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
this.MoveTo(target += e.Delta, 1000, Easing.OutQuint);
|
||||
|
@ -7,23 +7,31 @@ using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Online.Leaderboards
|
||||
{
|
||||
public class UpdateableRank : ModelBackedDrawable<ScoreRank>
|
||||
public class UpdateableRank : ModelBackedDrawable<ScoreRank?>
|
||||
{
|
||||
public ScoreRank Rank
|
||||
public ScoreRank? Rank
|
||||
{
|
||||
get => Model;
|
||||
set => Model = value;
|
||||
}
|
||||
|
||||
public UpdateableRank(ScoreRank rank)
|
||||
public UpdateableRank(ScoreRank? rank)
|
||||
{
|
||||
Rank = rank;
|
||||
}
|
||||
|
||||
protected override Drawable CreateDrawable(ScoreRank rank) => new DrawableRank(rank)
|
||||
protected override Drawable CreateDrawable(ScoreRank? rank)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
if (rank.HasValue)
|
||||
{
|
||||
return new DrawableRank(rank.Value)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ namespace osu.Game.Screens.Menu
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new Video(videoStream, false)
|
||||
InternalChild = new Video(videoStream)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
|
@ -122,10 +122,24 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
},
|
||||
}
|
||||
},
|
||||
starCounter = new StarCounter
|
||||
new FillFlowContainer
|
||||
{
|
||||
Current = (float)beatmap.StarDifficulty,
|
||||
Scale = new Vector2(0.8f),
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(4, 0),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new TopLocalRank(beatmap)
|
||||
{
|
||||
Scale = new Vector2(0.8f),
|
||||
Size = new Vector2(40, 20)
|
||||
},
|
||||
starCounter = new StarCounter
|
||||
{
|
||||
Current = (float)beatmap.StarDifficulty,
|
||||
Scale = new Vector2(0.8f),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
90
osu.Game/Screens/Select/Carousel/TopLocalRank.cs
Normal file
90
osu.Game/Screens/Select/Carousel/TopLocalRank.cs
Normal file
@ -0,0 +1,90 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
public class TopLocalRank : UpdateableRank
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
|
||||
[Resolved]
|
||||
private ScoreManager scores { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
public TopLocalRank(BeatmapInfo beatmap)
|
||||
: base(null)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
scores.ItemAdded += scoreChanged;
|
||||
scores.ItemRemoved += scoreChanged;
|
||||
ruleset.ValueChanged += _ => fetchAndLoadTopScore();
|
||||
|
||||
fetchAndLoadTopScore();
|
||||
}
|
||||
|
||||
private void scoreChanged(ScoreInfo score)
|
||||
{
|
||||
if (score.BeatmapInfoID == beatmap.ID)
|
||||
fetchAndLoadTopScore();
|
||||
}
|
||||
|
||||
private ScheduledDelegate scheduledRankUpdate;
|
||||
|
||||
private void fetchAndLoadTopScore()
|
||||
{
|
||||
var rank = fetchTopScore()?.Rank;
|
||||
scheduledRankUpdate = Schedule(() =>
|
||||
{
|
||||
Rank = rank;
|
||||
|
||||
// Required since presence is changed via IsPresent override
|
||||
Invalidate(Invalidation.Presence);
|
||||
});
|
||||
}
|
||||
|
||||
// We're present if a rank is set, or if there is a pending rank update (IsPresent = true is required for the scheduler to run).
|
||||
public override bool IsPresent => base.IsPresent && (Rank != null || scheduledRankUpdate?.Completed == false);
|
||||
|
||||
private ScoreInfo fetchTopScore()
|
||||
{
|
||||
if (scores == null || beatmap == null || ruleset?.Value == null || api?.LocalUser.Value == null)
|
||||
return null;
|
||||
|
||||
return scores.QueryScores(s => s.UserID == api.LocalUser.Value.Id && s.BeatmapInfoID == beatmap.ID && s.RulesetID == ruleset.Value.ID && !s.DeletePending)
|
||||
.OrderByDescending(s => s.TotalScore)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (scores != null)
|
||||
{
|
||||
scores.ItemAdded -= scoreChanged;
|
||||
scores.ItemRemoved -= scoreChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ namespace osu.Game.Skinning
|
||||
new Color4(242, 24, 57, 255)
|
||||
);
|
||||
|
||||
Configuration.LegacyVersion = 2.0m;
|
||||
Configuration.LegacyVersion = 2.7m;
|
||||
}
|
||||
|
||||
public static SkinInfo Info { get; } = new SkinInfo
|
||||
|
@ -102,7 +102,9 @@ namespace osu.Game.Skinning
|
||||
break;
|
||||
|
||||
case "WidthForNoteHeightScale":
|
||||
currentConfig.MinimumColumnWidth = float.Parse(pair.Value, CultureInfo.InvariantCulture) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
||||
float minWidth = float.Parse(pair.Value, CultureInfo.InvariantCulture) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
||||
if (minWidth > 0)
|
||||
currentConfig.MinimumColumnWidth = minWidth;
|
||||
break;
|
||||
|
||||
case string _ when pair.Key.StartsWith("Colour"):
|
||||
|
Loading…
Reference in New Issue
Block a user