mirror of
https://github.com/ppy/osu.git
synced 2025-03-01 18:52:55 +08:00
Merge pull request #31435 from peppy/star-range-display-quality
Fix star range display looking a bit bad when changing opacity
This commit is contained in:
commit
5431a08b35
@ -3,29 +3,71 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
using osu.Game.Tests.Visual.OnlinePlay;
|
using osu.Game.Tests.Resources;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
{
|
{
|
||||||
public partial class TestSceneStarRatingRangeDisplay : OnlinePlayTestScene
|
public partial class TestSceneStarRatingRangeDisplay : OsuTestScene
|
||||||
{
|
{
|
||||||
public override void SetUpSteps()
|
private readonly Room room = new Room();
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.LoadComplete();
|
||||||
|
|
||||||
AddStep("create display", () =>
|
Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
SelectedRoom.Value = new Room();
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
Child = new StarRatingRangeDisplay(SelectedRoom.Value)
|
Spacing = new Vector2(10),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
new StarRatingRangeDisplay(room)
|
||||||
Origin = Anchor.Centre
|
{
|
||||||
};
|
Anchor = Anchor.Centre,
|
||||||
});
|
Origin = Anchor.Centre,
|
||||||
|
Scale = new Vector2(5),
|
||||||
|
},
|
||||||
|
new StarRatingRangeDisplay(room)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Scale = new Vector2(2),
|
||||||
|
},
|
||||||
|
new StarRatingRangeDisplay(room)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Scale = new Vector2(1),
|
||||||
|
},
|
||||||
|
new StarRatingRangeDisplay(room)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Alpha = 0.2f,
|
||||||
|
Scale = new Vector2(5),
|
||||||
|
},
|
||||||
|
new StarRatingRangeDisplay(room)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Alpha = 0.2f,
|
||||||
|
Scale = new Vector2(2),
|
||||||
|
},
|
||||||
|
new StarRatingRangeDisplay(room)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Alpha = 0.2f,
|
||||||
|
Scale = new Vector2(1),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -33,10 +75,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
AddStep("set playlist", () =>
|
AddStep("set playlist", () =>
|
||||||
{
|
{
|
||||||
SelectedRoom.Value!.Playlist =
|
room.Playlist =
|
||||||
[
|
[
|
||||||
new PlaylistItem(new BeatmapInfo { StarRating = min }),
|
new PlaylistItem(new BeatmapInfo { StarRating = min }) { ID = TestResources.GetNextTestID() },
|
||||||
new PlaylistItem(new BeatmapInfo { StarRating = max }),
|
new PlaylistItem(new BeatmapInfo { StarRating = max }) { ID = TestResources.GetNextTestID() },
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ using osu.Game.Beatmaps.Drawables;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using Container = osu.Framework.Graphics.Containers.Container;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Components
|
namespace osu.Game.Screens.OnlinePlay.Components
|
||||||
{
|
{
|
||||||
@ -30,6 +29,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
private StarRatingDisplay maxDisplay = null!;
|
private StarRatingDisplay maxDisplay = null!;
|
||||||
private Drawable maxBackground = null!;
|
private Drawable maxBackground = null!;
|
||||||
|
|
||||||
|
private BufferedContainer bufferedContent = null!;
|
||||||
|
|
||||||
public StarRatingRangeDisplay(Room room)
|
public StarRatingRangeDisplay(Room room)
|
||||||
{
|
{
|
||||||
this.room = room;
|
this.room = room;
|
||||||
@ -41,38 +42,43 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new CircularContainer
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
CornerRadius = 1,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
minBackground = new Box
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Size = new Vector2(0.5f),
|
|
||||||
},
|
|
||||||
maxBackground = new Box
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Size = new Vector2(0.5f),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Masking = true,
|
||||||
|
// Stops artifacting from boxes drawn behind wrong colour boxes (and edge pixels adding up to higher opacity).
|
||||||
|
Padding = new MarginPadding(-0.1f),
|
||||||
|
Child = bufferedContent = new BufferedContainer(pixelSnapping: true, cachedFrameBuffer: true)
|
||||||
{
|
{
|
||||||
minDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range),
|
AutoSizeAxes = Axes.Both,
|
||||||
maxDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range)
|
Children = new[]
|
||||||
|
{
|
||||||
|
minBackground = new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(1, 0.5f),
|
||||||
|
},
|
||||||
|
maxBackground = new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(1, 0.5f),
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
minDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range),
|
||||||
|
maxDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +127,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
|
|
||||||
minBackground.Colour = colours.ForStarDifficulty(minDifficulty.Stars);
|
minBackground.Colour = colours.ForStarDifficulty(minDifficulty.Stars);
|
||||||
maxBackground.Colour = colours.ForStarDifficulty(maxDifficulty.Stars);
|
maxBackground.Colour = colours.ForStarDifficulty(maxDifficulty.Stars);
|
||||||
|
|
||||||
|
bufferedContent.ForceRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
Loading…
Reference in New Issue
Block a user