mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 03:07:19 +08:00
Merge branch 'master' into lounge-redesign
This commit is contained in:
commit
0b76460043
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
# osu!
|
# osu!
|
||||||
|
|
||||||
[](https://ci.appveyor.com/project/peppy/osu)
|
[](https://github.com/ppy/osu/actions/workflows/ci.yml)
|
||||||
[](https://github.com/ppy/osu/releases/latest)
|
[](https://github.com/ppy/osu/releases/latest)
|
||||||
[](https://www.codefactor.io/repository/github/ppy/osu)
|
[](https://www.codefactor.io/repository/github/ppy/osu)
|
||||||
[](https://discord.gg/ppy)
|
[](https://discord.gg/ppy)
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.808.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.805.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.807.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||||
|
@ -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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Colours
|
||||||
|
{
|
||||||
|
public class TestSceneStarDifficultyColours : OsuTestScene
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestColours()
|
||||||
|
{
|
||||||
|
AddStep("load colour displays", () =>
|
||||||
|
{
|
||||||
|
Child = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5f),
|
||||||
|
ChildrenEnumerable = Enumerable.Range(0, 10).Select(i => new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(10f),
|
||||||
|
ChildrenEnumerable = Enumerable.Range(0, 10).Select(j =>
|
||||||
|
{
|
||||||
|
var colour = colours.ForStarDifficulty(1f * i + 0.1f * j);
|
||||||
|
|
||||||
|
return new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0f, 10f),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new CircularContainer
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Size = new Vector2(75f, 25f),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colour,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Colour = OsuColour.ForegroundTextColourFor(colour),
|
||||||
|
Text = colour.ToHex(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Text = $"*{(1f * i + 0.1f * j):0.00}",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
})
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -93,20 +93,20 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
new CircularContainer
|
new CircularContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Scale = new Vector2(0.84f),
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Colour = Color4.Black.Opacity(0.08f),
|
Colour = Color4.Black.Opacity(0.06f),
|
||||||
|
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Radius = 5,
|
Radius = 3,
|
||||||
},
|
},
|
||||||
Child = background = new Box
|
Child = background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.ForDifficultyRating(beatmap.DifficultyRating) // Default value that will be re-populated once difficulty calculation completes
|
Colour = colours.ForStarDifficulty(beatmap.StarDifficulty) // Default value that will be re-populated once difficulty calculation completes
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new ConstrainedIconContainer
|
new ConstrainedIconContainer
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
else
|
else
|
||||||
difficultyBindable.Value = new StarDifficulty(beatmap.StarDifficulty, 0);
|
difficultyBindable.Value = new StarDifficulty(beatmap.StarDifficulty, 0);
|
||||||
|
|
||||||
difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForDifficultyRating(difficulty.NewValue.DifficultyRating));
|
difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITooltip GetCustomTooltip() => new DifficultyIconTooltip();
|
public ITooltip GetCustomTooltip() => new DifficultyIconTooltip();
|
||||||
@ -271,7 +271,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
starDifficulty.BindValueChanged(difficulty =>
|
starDifficulty.BindValueChanged(difficulty =>
|
||||||
{
|
{
|
||||||
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
|
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
|
||||||
difficultyFlow.Colour = colours.ForDifficultyRating(difficulty.NewValue.DifficultyRating, true);
|
difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Utils;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics
|
namespace osu.Game.Graphics
|
||||||
@ -15,31 +17,52 @@ namespace osu.Game.Graphics
|
|||||||
public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f);
|
public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f);
|
||||||
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255);
|
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the colour for a <see cref="DifficultyRating"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Sourced from the @diff-{rating} variables in https://github.com/ppy/osu-web/blob/71fbab8936d79a7929d13854f5e854b4f383b236/resources/assets/less/variables.less.
|
||||||
|
/// </remarks>
|
||||||
public Color4 ForDifficultyRating(DifficultyRating difficulty, bool useLighterColour = false)
|
public Color4 ForDifficultyRating(DifficultyRating difficulty, bool useLighterColour = false)
|
||||||
{
|
{
|
||||||
switch (difficulty)
|
switch (difficulty)
|
||||||
{
|
{
|
||||||
case DifficultyRating.Easy:
|
case DifficultyRating.Easy:
|
||||||
return Green;
|
return Color4Extensions.FromHex("4ebfff");
|
||||||
|
|
||||||
default:
|
|
||||||
case DifficultyRating.Normal:
|
case DifficultyRating.Normal:
|
||||||
return Blue;
|
return Color4Extensions.FromHex("66ff91");
|
||||||
|
|
||||||
case DifficultyRating.Hard:
|
case DifficultyRating.Hard:
|
||||||
return Yellow;
|
return Color4Extensions.FromHex("f7e85d");
|
||||||
|
|
||||||
case DifficultyRating.Insane:
|
case DifficultyRating.Insane:
|
||||||
return Pink;
|
return Color4Extensions.FromHex("ff7e68");
|
||||||
|
|
||||||
case DifficultyRating.Expert:
|
case DifficultyRating.Expert:
|
||||||
return PurpleLight;
|
return Color4Extensions.FromHex("fe3c71");
|
||||||
|
|
||||||
case DifficultyRating.ExpertPlus:
|
case DifficultyRating.ExpertPlus:
|
||||||
return useLighterColour ? Gray9 : Color4Extensions.FromHex("#121415");
|
return Color4Extensions.FromHex("6662dd");
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(difficulty));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color4 ForStarDifficulty(double starDifficulty) => ColourUtils.SampleFromLinearGradient(new[]
|
||||||
|
{
|
||||||
|
(1.5f, Color4Extensions.FromHex("4fc0ff")),
|
||||||
|
(2.0f, Color4Extensions.FromHex("4fffd5")),
|
||||||
|
(2.5f, Color4Extensions.FromHex("7cff4f")),
|
||||||
|
(3.25f, Color4Extensions.FromHex("f6f05c")),
|
||||||
|
(4.5f, Color4Extensions.FromHex("ff8068")),
|
||||||
|
(6.0f, Color4Extensions.FromHex("ff3c71")),
|
||||||
|
(7.0f, Color4Extensions.FromHex("6563de")),
|
||||||
|
(8.0f, Color4Extensions.FromHex("18158e")),
|
||||||
|
(8.0f, Color4.Black),
|
||||||
|
}, (float)Math.Round(starDifficulty, 2, MidpointRounding.AwayFromZero));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the colour for a <see cref="ScoreRank"/>.
|
/// Retrieves the colour for a <see cref="ScoreRank"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -288,7 +288,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
AddInternal(new HoverSounds());
|
AddInternal(new HoverClickSounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -13,6 +16,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class OsuMenu : Menu
|
public class OsuMenu : Menu
|
||||||
{
|
{
|
||||||
|
private Sample sampleOpen;
|
||||||
|
private Sample sampleClose;
|
||||||
|
|
||||||
|
// todo: this shouldn't be required after https://github.com/ppy/osu-framework/issues/4519 is fixed.
|
||||||
|
private bool wasOpened;
|
||||||
|
|
||||||
public OsuMenu(Direction direction, bool topLevelMenu = false)
|
public OsuMenu(Direction direction, bool topLevelMenu = false)
|
||||||
: base(direction, topLevelMenu)
|
: base(direction, topLevelMenu)
|
||||||
{
|
{
|
||||||
@ -22,8 +31,30 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
ItemsContainer.Padding = new MarginPadding(5);
|
ItemsContainer.Padding = new MarginPadding(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
|
[BackgroundDependencyLoader]
|
||||||
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
sampleOpen = audio.Samples.Get(@"UI/dropdown-open");
|
||||||
|
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void AnimateOpen()
|
||||||
|
{
|
||||||
|
if (!TopLevelMenu && !wasOpened)
|
||||||
|
sampleOpen?.Play();
|
||||||
|
|
||||||
|
this.FadeIn(300, Easing.OutQuint);
|
||||||
|
wasOpened = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void AnimateClose()
|
||||||
|
{
|
||||||
|
if (!TopLevelMenu && wasOpened)
|
||||||
|
sampleClose?.Play();
|
||||||
|
|
||||||
|
this.FadeOut(300, Easing.OutQuint);
|
||||||
|
wasOpened = false;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateSize(Vector2 newSize)
|
protected override void UpdateSize(Vector2 newSize)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Key(8)]
|
[Key(8)]
|
||||||
public MatchType MatchType { get; set; }
|
public MatchType MatchType { get; set; } = MatchType.HeadToHead;
|
||||||
|
|
||||||
public bool Equals(MultiplayerRoomSettings other)
|
public bool Equals(MultiplayerRoomSettings other)
|
||||||
=> BeatmapID == other.BeatmapID
|
=> BeatmapID == other.BeatmapID
|
||||||
|
@ -79,8 +79,6 @@ namespace osu.Game.Overlays.News.Sidebar
|
|||||||
|
|
||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
|
|
||||||
|
|
||||||
public DropdownHeader(int month, int year)
|
public DropdownHeader(int month, int year)
|
||||||
{
|
{
|
||||||
var date = new DateTime(year, month, 1);
|
var date = new DateTime(year, month, 1);
|
||||||
|
@ -91,8 +91,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
maxDisplay.Current.Value = maxDifficulty;
|
maxDisplay.Current.Value = maxDifficulty;
|
||||||
maxDisplay.Alpha = Precision.AlmostEquals(minDifficulty.Stars, maxDifficulty.Stars) ? 0 : 1;
|
maxDisplay.Alpha = Precision.AlmostEquals(minDifficulty.Stars, maxDifficulty.Stars) ? 0 : 1;
|
||||||
|
|
||||||
minBackground.Colour = colours.ForDifficultyRating(minDifficulty.DifficultyRating, true);
|
minBackground.Colour = colours.ForStarDifficulty(minDifficulty.Stars);
|
||||||
maxBackground.Colour = colours.ForDifficultyRating(maxDifficulty.DifficultyRating, true);
|
maxBackground.Colour = colours.ForStarDifficulty(maxDifficulty.Stars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -43,6 +45,8 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
|
|
||||||
public event Action<SelectionState> StateChanged;
|
public event Action<SelectionState> StateChanged;
|
||||||
|
|
||||||
|
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
|
||||||
|
|
||||||
private Drawable selectionBox;
|
private Drawable selectionBox;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
@ -61,6 +65,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
|
|
||||||
private SelectionState state;
|
private SelectionState state;
|
||||||
|
|
||||||
|
private Sample sampleSelect;
|
||||||
|
private Sample sampleJoin;
|
||||||
|
|
||||||
public SelectionState State
|
public SelectionState State
|
||||||
{
|
{
|
||||||
get => state;
|
get => state;
|
||||||
@ -147,7 +154,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, AudioManager audio)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -337,6 +344,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sampleSelect = audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select");
|
||||||
|
sampleJoin = audio.Samples.Get($@"UI/{HoverSampleSet.Submit.GetDescription()}-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
@ -398,22 +408,25 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ShouldBeConsideredForInput(Drawable child) => state == SelectionState.Selected;
|
protected override bool ShouldBeConsideredForInput(Drawable child) => state == SelectionState.Selected || child is HoverSounds;
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (Room != selectedRoom.Value)
|
if (Room != selectedRoom.Value)
|
||||||
{
|
{
|
||||||
|
sampleSelect?.Play();
|
||||||
selectedRoom.Value = Room;
|
selectedRoom.Value = Room;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Room.HasPassword.Value)
|
if (Room.HasPassword.Value)
|
||||||
{
|
{
|
||||||
|
sampleJoin?.Play();
|
||||||
this.ShowPopover();
|
this.ShowPopover();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sampleJoin?.Play();
|
||||||
lounge?.Join(Room, null);
|
lounge?.Join(Room, null);
|
||||||
|
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
|
@ -30,8 +30,6 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
|||||||
|
|
||||||
AddItem(MatchType.HeadToHead);
|
AddItem(MatchType.HeadToHead);
|
||||||
AddItem(MatchType.TeamVersus);
|
AddItem(MatchType.TeamVersus);
|
||||||
// TODO: remove after osu-web is updated to set the correct default type.
|
|
||||||
AddItem(MatchType.Playlists);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GameTypePickerItem : DisableableTabItem
|
private class GameTypePickerItem : DisableableTabItem
|
||||||
|
@ -96,7 +96,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
((IBindable<bool>)leaderboard.Expanded).BindTo(IsBreakTime);
|
((IBindable<bool>)leaderboard.Expanded).BindTo(HUDOverlay.ShowHud);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void StartGameplay()
|
protected override void StartGameplay()
|
||||||
|
@ -23,6 +23,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
public class StarRatingDisplay : CompositeDrawable, IHasCurrentValue<StarDifficulty>
|
public class StarRatingDisplay : CompositeDrawable, IHasCurrentValue<StarDifficulty>
|
||||||
{
|
{
|
||||||
private Box background;
|
private Box background;
|
||||||
|
private FillFlowContainer content;
|
||||||
private OsuTextFlowContainer textFlow;
|
private OsuTextFlowContainer textFlow;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
content = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Horizontal = 8, Vertical = 4 },
|
Padding = new MarginPadding { Horizontal = 8, Vertical = 4 },
|
||||||
@ -78,7 +79,6 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Size = new Vector2(7),
|
Size = new Vector2(7),
|
||||||
Icon = FontAwesome.Solid.Star,
|
Icon = FontAwesome.Solid.Star,
|
||||||
Colour = Color4.Black
|
|
||||||
},
|
},
|
||||||
textFlow = new OsuTextFlowContainer(s => s.Font = OsuFont.Numeric.With(weight: FontWeight.Black))
|
textFlow = new OsuTextFlowContainer(s => s.Font = OsuFont.Numeric.With(weight: FontWeight.Black))
|
||||||
{
|
{
|
||||||
@ -107,21 +107,20 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
string fractionPart = starRatingParts[1];
|
string fractionPart = starRatingParts[1];
|
||||||
string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||||
|
|
||||||
var rating = Current.Value.DifficultyRating;
|
var stars = Current.Value.Stars;
|
||||||
|
|
||||||
background.Colour = colours.ForDifficultyRating(rating, true);
|
background.Colour = colours.ForStarDifficulty(stars);
|
||||||
|
content.Colour = stars >= 6.5 ? colours.Orange1 : Color4.Black;
|
||||||
|
|
||||||
textFlow.Clear();
|
textFlow.Clear();
|
||||||
textFlow.AddText($"{wholePart}", s =>
|
textFlow.AddText($"{wholePart}", s =>
|
||||||
{
|
{
|
||||||
s.Colour = Color4.Black;
|
|
||||||
s.Font = s.Font.With(size: 14);
|
s.Font = s.Font.With(size: 14);
|
||||||
s.UseFullGlyphHeight = false;
|
s.UseFullGlyphHeight = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
textFlow.AddText($"{separator}{fractionPart}", s =>
|
textFlow.AddText($"{separator}{fractionPart}", s =>
|
||||||
{
|
{
|
||||||
s.Colour = Color4.Black;
|
|
||||||
s.Font = s.Font.With(size: 7);
|
s.Font = s.Font.With(size: 7);
|
||||||
s.UseFullGlyphHeight = false;
|
s.UseFullGlyphHeight = false;
|
||||||
});
|
});
|
||||||
|
@ -503,7 +503,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
const float full_opacity_ratio = 0.7f;
|
const float full_opacity_ratio = 0.7f;
|
||||||
|
|
||||||
var difficultyColour = colours.ForDifficultyRating(difficulty.DifficultyRating);
|
var difficultyColour = colours.ForStarDifficulty(difficulty.Stars);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
37
osu.Game/Utils/ColourUtils.cs
Normal file
37
osu.Game/Utils/ColourUtils.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Utils
|
||||||
|
{
|
||||||
|
public static class ColourUtils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Samples from a given linear gradient at a certain specified point.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gradient">The gradient, defining the colour stops and their positions (in [0-1] range) in the gradient.</param>
|
||||||
|
/// <param name="point">The point to sample the colour at.</param>
|
||||||
|
/// <returns>A <see cref="Color4"/> sampled from the linear gradient.</returns>
|
||||||
|
public static Color4 SampleFromLinearGradient(IReadOnlyList<(float position, Color4 colour)> gradient, float point)
|
||||||
|
{
|
||||||
|
if (point < gradient[0].position)
|
||||||
|
return gradient[0].colour;
|
||||||
|
|
||||||
|
for (int i = 0; i < gradient.Count - 1; i++)
|
||||||
|
{
|
||||||
|
var startStop = gradient[i];
|
||||||
|
var endStop = gradient[i + 1];
|
||||||
|
|
||||||
|
if (point >= endStop.position)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return Interpolation.ValueAt(point, startStop.colour, endStop.colour, startStop.position, endStop.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gradient[^1].colour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -36,8 +36,8 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="10.3.0" />
|
<PackageReference Include="Realm" Version="10.3.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.805.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.807.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.808.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.8.3" />
|
<PackageReference Include="Sentry" Version="3.8.3" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
|
@ -70,8 +70,8 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.805.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.807.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.803.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.808.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2021.805.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2021.807.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user