1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-24 23:42:01 +08:00

Compare commits

...

7 Commits

5 changed files with 67 additions and 49 deletions
+4 -3
View File
@@ -396,16 +396,17 @@ namespace osu.Game.Overlays.Profile
scoreText.Add(createScoreText("Replays Watched by Others"));
scoreNumberText.Add(createScoreNumberText(user.Statistics.ReplaysWatched.ToString(@"#,0")));
gradeSSPlus.DisplayCount = user.Statistics.GradesCount.SSPlus;
gradeSSPlus.Show();
gradeSS.DisplayCount = user.Statistics.GradesCount.SS;
gradeSS.Show();
gradeSPlus.DisplayCount = user.Statistics.GradesCount.SPlus;
gradeSPlus.Show();
gradeS.DisplayCount = user.Statistics.GradesCount.S;
gradeS.Show();
gradeA.DisplayCount = user.Statistics.GradesCount.A;
gradeA.Show();
gradeSPlus.DisplayCount = 0;
gradeSSPlus.DisplayCount = 0;
rankGraph.User.Value = user;
}
}
+53 -45
View File
@@ -7,7 +7,6 @@ using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
@@ -16,6 +15,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
namespace osu.Game.Overlays.Settings
{
@@ -33,22 +33,10 @@ namespace osu.Game.Overlays.Settings
private SpriteText text;
private readonly RestoreDefaultValueButton restoreDefaultValueButton = new RestoreDefaultValueButton();
private readonly RestoreDefaultValueButton restoreDefaultButton;
public bool ShowsDefaultIndicator = true;
private Color4? restoreDefaultValueColour;
public Color4 RestoreDefaultValueColour
{
get { return restoreDefaultValueColour ?? Color4.White; }
set
{
restoreDefaultValueColour = value;
restoreDefaultValueButton?.SetButtonColour(RestoreDefaultValueColour);
}
}
public virtual string LabelText
{
get { return text?.Text ?? string.Empty; }
@@ -69,10 +57,7 @@ namespace osu.Game.Overlays.Settings
public virtual Bindable<T> Bindable
{
get
{
return bindable;
}
get { return bindable; }
set
{
@@ -80,8 +65,8 @@ namespace osu.Game.Overlays.Settings
controlWithCurrent?.Current.BindTo(bindable);
if (ShowsDefaultIndicator)
{
restoreDefaultValueButton.Bindable = bindable.GetBoundCopy();
restoreDefaultValueButton.Bindable.TriggerChange();
restoreDefaultButton.Bindable = bindable.GetBoundCopy();
restoreDefaultButton.Bindable.TriggerChange();
}
}
}
@@ -103,38 +88,30 @@ namespace osu.Game.Overlays.Settings
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = SettingsOverlay.CONTENT_MARGINS };
FlowContent = new FillFlowContainer
InternalChildren = new Drawable[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = 5 },
restoreDefaultButton = new RestoreDefaultValueButton(),
FlowContent = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS },
Child = Control = CreateControl()
},
};
if ((Control = CreateControl()) != null)
{
if (controlWithCurrent != null)
controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; };
FlowContent.Add(Control);
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
AddInternal(FlowContent);
if (restoreDefaultValueButton != null)
{
if (!restoreDefaultValueColour.HasValue)
restoreDefaultValueColour = colours.Yellow;
restoreDefaultValueButton.SetButtonColour(RestoreDefaultValueColour);
AddInternal(restoreDefaultValueButton);
}
if (controlWithCurrent != null)
controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; };
}
private class RestoreDefaultValueButton : Box, IHasTooltip
private class RestoreDefaultValueButton : Container, IHasTooltip
{
private Bindable<T> bindable;
public Bindable<T> Bindable
{
get { return bindable; }
@@ -157,6 +134,36 @@ namespace osu.Game.Overlays.Settings
Alpha = 0f;
}
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
buttonColour = colour.Yellow;
Child = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
CornerRadius = 3,
Masking = true,
Colour = buttonColour,
EdgeEffect = new EdgeEffectParameters
{
Colour = buttonColour.Opacity(0.1f),
Type = EdgeEffectType.Glow,
Radius = 2,
},
Size = new Vector2(0.33f, 0.8f),
Child = new Box { RelativeSizeAxes = Axes.Both },
};
}
protected override void LoadComplete()
{
base.LoadComplete();
UpdateState();
}
public string TooltipText => "Revert to default";
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
@@ -193,9 +200,10 @@ namespace osu.Game.Overlays.Settings
{
if (bindable == null)
return;
var colour = bindable.Disabled ? Color4.Gray : buttonColour;
this.FadeTo(bindable.IsDefault ? 0f : hovering && !bindable.Disabled ? 1f : 0.5f, 200, Easing.OutQuint);
this.FadeColour(ColourInfo.GradientHorizontal(colour.Opacity(0.8f), colour.Opacity(0)), 200, Easing.OutQuint);
this.FadeTo(bindable.IsDefault ? 0f :
hovering && !bindable.Disabled ? 1f : 0.65f, 200, Easing.OutQuint);
this.FadeColour(bindable.Disabled ? Color4.Gray : buttonColour, 200, Easing.OutQuint);
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ namespace osu.Game.Overlays
{
public abstract class SettingsOverlay : OsuFocusedOverlayContainer
{
public const float CONTENT_MARGINS = 10;
public const float CONTENT_MARGINS = 15;
public const float TRANSITION_LENGTH = 600;
@@ -49,6 +49,9 @@ namespace osu.Game.Screens.Play.HUD
protected override void PopIn() => this.FadeIn(fade_duration);
protected override void PopOut() => this.FadeOut(fade_duration);
//We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
public override bool HandleKeyboardInput => true;
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;
+6
View File
@@ -51,9 +51,15 @@ namespace osu.Game.Users
public struct Grades
{
[JsonProperty(@"ssh")]
public int SSPlus;
[JsonProperty(@"ss")]
public int SS;
[JsonProperty(@"sh")]
public int SPlus;
[JsonProperty(@"s")]
public int S;