Merge branch 'master' into url-parsing-support

This commit is contained in:
FreezyLemon
2017-12-25 19:07:01 +01:00
141 changed files with 10547 additions and 700 deletions

View File

@ -104,7 +104,7 @@ namespace osu.Game.Overlays
scores.IsLoading = true;
getScoresRequest = new GetScoresRequest(beatmap);
getScoresRequest = new GetScoresRequest(beatmap, beatmap.Ruleset);
getScoresRequest.Success += r =>
{
scores.Scores = r.Scores;

View File

@ -17,22 +17,23 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Mods
{
public class ModSelectOverlay : WaveOverlayContainer
{
private const int button_duration = 700;
private const int ranked_multiplier_duration = 700;
private const float content_width = 0.8f;
private Color4 lowMultiplierColour, highMultiplierColour;
protected Color4 LowMultiplierColour, HighMultiplierColour;
private readonly OsuSpriteText rankedLabel;
private readonly OsuSpriteText multiplierLabel;
private readonly FillFlowContainer rankedMultiplerContainer;
protected readonly TriangleButton DeselectAllButton;
protected readonly OsuSpriteText MultiplierLabel;
private readonly FillFlowContainer footerContainer;
private readonly FillFlowContainer<ModSection> modSectionsContainer;
protected override bool BlockPassThroughKeyboard => false;
protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>();
@ -42,7 +43,7 @@ namespace osu.Game.Overlays.Mods
{
var instance = newRuleset.CreateInstance();
foreach (ModSection section in modSectionsContainer.Children)
foreach (ModSection section in ModSectionsContainer.Children)
section.Mods = instance.GetModsFor(section.ModType);
refreshSelectedMods();
}
@ -50,8 +51,8 @@ namespace osu.Game.Overlays.Mods
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets)
{
lowMultiplierColour = colours.Red;
highMultiplierColour = colours.Green;
LowMultiplierColour = colours.Red;
HighMultiplierColour = colours.Green;
if (osu != null)
Ruleset.BindTo(osu.Ruleset);
@ -66,14 +67,14 @@ namespace osu.Game.Overlays.Mods
{
base.PopOut();
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, Easing.InSine);
rankedMultiplerContainer.FadeOut(APPEAR_DURATION, Easing.InSine);
footerContainer.MoveToX(footerContainer.DrawSize.X, DISAPPEAR_DURATION, Easing.InSine);
footerContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
foreach (ModSection section in modSectionsContainer.Children)
foreach (ModSection section in ModSectionsContainer.Children)
{
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.FadeOut(APPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), DISAPPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.MoveToX(100f, DISAPPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
}
}
@ -81,27 +82,28 @@ namespace osu.Game.Overlays.Mods
{
base.PopIn();
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, Easing.OutQuint);
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, Easing.OutQuint);
footerContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
footerContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
foreach (ModSection section in modSectionsContainer.Children)
foreach (ModSection section in ModSectionsContainer.Children)
{
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, Easing.OutQuint);
section.ButtonsContainer.MoveToX(0, button_duration, Easing.OutQuint);
section.ButtonsContainer.FadeIn(button_duration, Easing.OutQuint);
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), APPEAR_DURATION, Easing.OutQuint);
section.ButtonsContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
section.ButtonsContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
}
}
public void DeselectAll()
{
foreach (ModSection section in modSectionsContainer.Children)
foreach (ModSection section in ModSectionsContainer.Children)
section.DeselectAll();
refreshSelectedMods();
}
public void DeselectTypes(Type[] modTypes)
{
if (modTypes.Length == 0) return;
foreach (ModSection section in modSectionsContainer.Children)
foreach (ModSection section in ModSectionsContainer.Children)
section.DeselectTypes(modTypes);
}
@ -114,7 +116,7 @@ namespace osu.Game.Overlays.Mods
private void refreshSelectedMods()
{
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
double multiplier = 1.0;
bool ranked = true;
@ -129,16 +131,16 @@ namespace osu.Game.Overlays.Mods
// 1.05x
// 1.20x
multiplierLabel.Text = $"{multiplier:N2}x";
string rankedString = ranked ? "Ranked" : "Unranked";
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
MultiplierLabel.Text = $"{multiplier:N2}x";
if (!ranked)
MultiplierLabel.Text += " (Unranked)";
if (multiplier > 1.0)
multiplierLabel.FadeColour(highMultiplierColour, 200);
MultiplierLabel.FadeColour(HighMultiplierColour, 200);
else if (multiplier < 1.0)
multiplierLabel.FadeColour(lowMultiplierColour, 200);
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
else
multiplierLabel.FadeColour(Color4.White, 200);
MultiplierLabel.FadeColour(Color4.White, 200);
}
public ModSelectOverlay()
@ -232,7 +234,7 @@ namespace osu.Game.Overlays.Mods
},
new OsuSpriteText
{
Text = @"Others are just for fun",
Text = @"Others are just for fun.",
TextSize = 18,
Shadow = true,
},
@ -241,7 +243,7 @@ namespace osu.Game.Overlays.Mods
},
},
// Body
modSectionsContainer = new FillFlowContainer<ModSection>
ModSectionsContainer = new FillFlowContainer<ModSection>
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
@ -289,7 +291,7 @@ namespace osu.Game.Overlays.Mods
Colour = new Color4(172, 20, 116, 255),
Alpha = 0.5f,
},
rankedMultiplerContainer = new FillFlowContainer
footerContainer = new FillFlowContainer
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
@ -299,26 +301,42 @@ namespace osu.Game.Overlays.Mods
Direction = FillDirection.Horizontal,
Padding = new MarginPadding
{
Top = 20,
Bottom = 20,
Vertical = 15
},
Children = new Drawable[]
{
rankedLabel = new OsuSpriteText
DeselectAllButton = new TriangleButton
{
Text = @"Ranked, Score Multiplier: ",
Width = 180,
Text = "Deselect All",
Action = DeselectAll,
Margin = new MarginPadding
{
Right = 20
}
},
new OsuSpriteText
{
Text = @"Score Multiplier: ",
TextSize = 30,
Shadow = true,
Margin = new MarginPadding
{
Top = 5
}
},
multiplierLabel = new OsuSpriteText
MultiplierLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"1.00x",
TextSize = 30,
Shadow = true,
},
},
},
Margin = new MarginPadding
{
Top = 5
}
}
}
}
},
},
},

View File

@ -13,7 +13,6 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using System.Threading;
namespace osu.Game.Overlays.Music
{
@ -153,11 +152,6 @@ namespace osu.Game.Overlays.Music
var track = beatmapBacking.Value.Track;
track.Restart();
// this is temporary until we have blocking (async.Wait()) audio component methods.
// then we can call RestartAsync().Wait() or the blocking version above.
while (!track.IsRunning)
Thread.Sleep(1);
}
}

View File

@ -10,6 +10,7 @@ using osu.Game.Overlays.Notifications;
using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using System;
namespace osu.Game.Overlays
{
@ -19,9 +20,13 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600;
private ScrollContainer scrollContainer;
private FlowContainer<NotificationSection> sections;
/// <summary>
/// Provide a source for the toolbar height.
/// </summary>
public Func<float> GetToolbarHeight;
[BackgroundDependencyLoader]
private void load()
{
@ -36,12 +41,12 @@ namespace osu.Game.Overlays
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.6f,
Alpha = 0.6f
},
scrollContainer = new OsuScrollContainer
new OsuScrollContainer
{
Masking = true,
RelativeSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT },
Children = new[]
{
sections = new FillFlowContainer<NotificationSection>
@ -55,14 +60,14 @@ namespace osu.Game.Overlays
{
Title = @"Notifications",
ClearText = @"Clear All",
AcceptTypes = new[] { typeof(SimpleNotification) },
AcceptTypes = new[] { typeof(SimpleNotification) }
},
new NotificationSection
{
Title = @"Running Tasks",
ClearText = @"Cancel All",
AcceptTypes = new[] { typeof(ProgressNotification) },
},
AcceptTypes = new[] { typeof(ProgressNotification) }
}
}
}
}
@ -103,14 +108,8 @@ namespace osu.Game.Overlays
{
base.PopIn();
scrollContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(1, TRANSITION_LENGTH / 2);
}
private void markAllRead()
{
sections.Children.ForEach(s => s.MarkAllRead());
this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
}
protected override void PopOut()
@ -120,7 +119,19 @@ namespace osu.Game.Overlays
markAllRead();
this.MoveToX(width, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH / 2);
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
}
private void markAllRead()
{
sections.Children.ForEach(s => s.MarkAllRead());
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
}
}
}

View File

@ -22,6 +22,8 @@ namespace osu.Game.Overlays.Notifications
}
}
public string CompletionText { get; set; } = "Task has completed!";
public float Progress
{
get { return progressBar.Progress; }
@ -87,7 +89,7 @@ namespace osu.Game.Overlays.Notifications
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification
{
Activated = CompletionClickAction,
Text = "Task has completed!"
Text = CompletionText
};
protected virtual void Completed()

View File

@ -25,8 +25,10 @@ namespace osu.Game.Overlays.Profile
private readonly OsuTextFlowContainer infoTextLeft;
private readonly OsuLinkTextFlowContainer infoTextRight;
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
private readonly RankGraph rankGraph;
private readonly Container coverContainer, chartContainer, supporterTag;
public readonly SupporterIcon SupporterTag;
private readonly Container coverContainer;
private readonly Sprite levelBadge;
private readonly SpriteText levelText;
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
@ -91,32 +93,13 @@ namespace osu.Game.Overlays.Profile
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
supporterTag = new CircularContainer
SupporterTag = new SupporterIcon
{
Alpha = 0,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Y = -75,
Size = new Vector2(25, 25),
Masking = true,
BorderThickness = 3,
BorderColour = Color4.White,
Alpha = 0,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
},
new SpriteIcon
{
Icon = FontAwesome.fa_heart,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(12),
}
}
Size = new Vector2(25, 25)
},
new ProfileLink(user)
{
@ -271,7 +254,7 @@ namespace osu.Game.Overlays.Profile
}
}
},
chartContainer = new Container
new Container
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomCentre,
@ -283,6 +266,10 @@ namespace osu.Game.Overlays.Profile
{
Colour = Color4.Black.Opacity(0.25f),
RelativeSizeAxes = Axes.Both
},
rankGraph = new RankGraph
{
RelativeSizeAxes = Axes.Both
}
}
}
@ -302,7 +289,6 @@ namespace osu.Game.Overlays.Profile
public User User
{
get { return user; }
set
{
user = value;
@ -322,7 +308,8 @@ namespace osu.Game.Overlays.Profile
Depth = float.MaxValue,
}, coverContainer.Add);
if (user.IsSupporter) supporterTag.Show();
if (user.IsSupporter)
SupporterTag.Show();
if (!string.IsNullOrEmpty(user.Colour))
{
@ -418,7 +405,7 @@ namespace osu.Game.Overlays.Profile
gradeSPlus.DisplayCount = 0;
gradeSSPlus.DisplayCount = 0;
chartContainer.Add(new RankChart(user) { RelativeSizeAxes = Axes.Both });
rankGraph.User.Value = user;
}
}

View File

@ -14,30 +14,39 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Users;
using System.Collections.Generic;
using osu.Framework.Configuration;
namespace osu.Game.Overlays.Profile
{
public class RankChart : Container
public class RankGraph : Container
{
private const float primary_textsize = 25;
private const float secondary_textsize = 13;
private const float padding = 10;
private const float fade_duration = 150;
private const int ranked_days = 88;
private readonly SpriteText rankText, performanceText, relativeText;
private readonly RankChartLineGraph graph;
private readonly OsuSpriteText placeholder;
private readonly int[] ranks;
private KeyValuePair<int, int>[] ranks;
public Bindable<User> User = new Bindable<User>();
private const float primary_textsize = 25, secondary_textsize = 13, padding = 10;
private readonly User user;
public RankChart(User user)
public RankGraph()
{
this.user = user;
int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank };
ranks = userRanks.SkipWhile(x => x == 0).ToArray();
Padding = new MarginPadding { Vertical = padding };
Children = new Drawable[]
{
placeholder = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "No recent plays",
TextSize = 14,
Font = @"Exo2.0-RegularItalic",
},
rankText = new OsuSpriteText
{
Anchor = Anchor.TopCentre,
@ -60,89 +69,103 @@ namespace osu.Game.Overlays.Profile
Font = @"Exo2.0-RegularItalic",
TextSize = secondary_textsize
},
};
if (ranks.Length > 0)
{
Add(graph = new RankChartLineGraph
graph = new RankChartLineGraph
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Height = 75,
Y = -secondary_textsize,
DefaultValueCount = ranks.Length,
});
Alpha = 0,
}
};
graph.OnBallMove += showHistoryRankTexts;
}
}
graph.OnBallMove += showHistoryRankTexts;
private void updateRankTexts()
{
rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank";
performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty;
relativeText.Text = user.CountryRank > 0 ? $"{user.Country?.FullName} #{user.CountryRank:#,0}" : $"{user.Country?.FullName}";
}
private void showHistoryRankTexts(int dayIndex)
{
rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank";
dayIndex++;
relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago";
//plural should be handled in a general way
User.ValueChanged += userChanged;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (graph != null)
graph.Colour = colours.Yellow;
}
private void userChanged(User user)
{
placeholder.FadeIn(fade_duration, Easing.Out);
if (user == null)
{
graph.Colour = colours.Yellow;
// use logarithmic coordinates
graph.Values = ranks.Select(x => x == 0 ? float.MinValue : -(float)Math.Log(x));
rankText.Text = string.Empty;
performanceText.Text = string.Empty;
relativeText.Text = string.Empty;
graph.FadeOut(fade_duration, Easing.Out);
ranks = null;
return;
}
int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Rank };
ranks = userRanks.Select((x, index) => new KeyValuePair<int, int>(index, x)).Where(x => x.Value != 0).ToArray();
if (ranks.Length > 1)
{
placeholder.FadeOut(fade_duration, Easing.Out);
graph.DefaultValueCount = ranks.Length;
graph.Values = ranks.Select(x => -(float)Math.Log(x.Value));
graph.SetStaticBallPosition();
}
graph.FadeTo(ranks.Length > 1 ? 1 : 0, fade_duration, Easing.Out);
updateRankTexts();
}
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
private void updateRankTexts()
{
if ((invalidation & Invalidation.DrawSize) != 0)
{
graph.Height = DrawHeight - padding * 2 - primary_textsize - secondary_textsize * 2;
}
rankText.Text = User.Value.Statistics.Rank > 0 ? $"#{User.Value.Statistics.Rank:#,0}" : "no rank";
performanceText.Text = User.Value.Statistics.PP != null ? $"{User.Value.Statistics.PP:#,0}pp" : string.Empty;
relativeText.Text = $"{User.Value.Country?.FullName} #{User.Value.CountryRank:#,0}";
}
return base.Invalidate(invalidation, source, shallPropagate);
private void showHistoryRankTexts(int dayIndex)
{
rankText.Text = $"#{ranks[dayIndex].Value:#,0}";
relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago";
}
protected override bool OnHover(InputState state)
{
graph?.UpdateBallPosition(state.Mouse.Position.X);
graph?.ShowBall();
if (ranks?.Length > 1)
{
graph.UpdateBallPosition(state.Mouse.Position.X);
graph.ShowBall();
}
return base.OnHover(state);
}
protected override bool OnMouseMove(InputState state)
{
graph?.UpdateBallPosition(state.Mouse.Position.X);
if (ranks?.Length > 1)
graph.UpdateBallPosition(state.Mouse.Position.X);
return base.OnMouseMove(state);
}
protected override void OnHoverLost(InputState state)
{
if (graph != null)
if (ranks?.Length > 1)
{
graph.HideBall();
updateRankTexts();
}
base.OnHoverLost(state);
}
private class RankChartLineGraph : LineGraph
{
private const double fade_duration = 200;
private readonly CircularContainer staticBall;
private readonly CircularContainer movingBall;

View File

@ -0,0 +1,61 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Overlays.Profile
{
public class SupporterIcon : CircularContainer
{
private readonly Box background;
public SupporterIcon()
{
Masking = true;
Children = new Drawable[]
{
new Box { RelativeSizeAxes = Axes.Both },
new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.8f),
Masking = true,
Children = new Drawable[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
new Triangles
{
TriangleScale = 0.2f,
ColourLight = OsuColour.FromHex(@"ff7db7"),
ColourDark = OsuColour.FromHex(@"de5b95"),
RelativeSizeAxes = Axes.Both,
Velocity = 0.3f,
},
}
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_heart,
Scale = new Vector2(0.45f),
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Pink;
}
}
}

View File

@ -0,0 +1,23 @@
// Copyright (c) 2007-2017 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.Game.Graphics;
namespace osu.Game.Overlays.Settings
{
/// <summary>
/// A <see cref="SettingsButton"/> with pink colours to mark dangerous/destructive actions.
/// </summary>
public class DangerousSettingsButton : SettingsButton
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.Pink;
Triangles.ColourDark = colours.PinkDark;
Triangles.ColourLight = colours.PinkLight;
}
}
}

View File

@ -0,0 +1,32 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Graphics;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public class DeleteAllBeatmapsDialog : PopupDialog
{
public DeleteAllBeatmapsDialog(Action deleteAction)
{
BodyText = "Everything?";
Icon = FontAwesome.fa_trash_o;
HeaderText = @"Confirm deletion of";
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Yes. Go for it.",
Action = deleteAction
},
new PopupDialogCancelButton
{
Text = @"No! Abort mission!",
},
};
}
}
}

View File

@ -15,11 +15,12 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
private TriangleButton importButton;
private TriangleButton deleteButton;
private TriangleButton restoreButton;
private TriangleButton undeleteButton;
protected override string Header => "General";
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps)
private void load(BeatmapManager beatmaps, DialogOverlay dialogOverlay)
{
Children = new Drawable[]
{
@ -33,13 +34,16 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
.ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning);
}
},
deleteButton = new SettingsButton
deleteButton = new DangerousSettingsButton
{
Text = "Delete ALL beatmaps",
Action = () =>
{
deleteButton.Enabled.Value = false;
Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() =>
{
deleteButton.Enabled.Value = false;
Task.Run(() => beatmaps.DeleteAll()).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true));
}));
}
},
restoreButton = new SettingsButton
@ -55,6 +59,15 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
}).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
}
},
undeleteButton = new SettingsButton
{
Text = "Restore all recently deleted beatmaps",
Action = () =>
{
undeleteButton.Enabled.Value = false;
Task.Run(() => beatmaps.UndeleteAll()).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true));
}
},
};
}
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600;
public const float SIDEBAR_WIDTH = Sidebar.DEFAULT_WIDTH;
private const float sidebar_width = Sidebar.DEFAULT_WIDTH;
protected const float WIDTH = 400;
@ -102,7 +102,7 @@ namespace osu.Game.Overlays
if (showSidebar)
{
AddInternal(Sidebar = new Sidebar { Width = SIDEBAR_WIDTH });
AddInternal(Sidebar = new Sidebar { Width = sidebar_width });
SectionsContainer.SelectedSection.ValueChanged += section =>
{
@ -167,7 +167,7 @@ namespace osu.Game.Overlays
ContentContainer.MoveToX(-WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
Sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
searchTextBox.HoldFocus = false;

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays
private ProfileSection[] sections;
private GetUserRequest userReq;
private APIAccess api;
private ProfileHeader header;
protected ProfileHeader Header;
private SectionsContainer<ProfileSection> sectionsContainer;
private ProfileTabControl tabs;
@ -113,12 +113,12 @@ namespace osu.Game.Overlays
Colour = OsuColour.Gray(0.2f)
});
header = new ProfileHeader(user);
Header = new ProfileHeader(user);
Add(sectionsContainer = new SectionsContainer<ProfileSection>
{
RelativeSizeAxes = Axes.Both,
ExpandableHeader = header,
ExpandableHeader = Header,
FixedHeader = tabs,
HeaderBackground = new Box
{
@ -169,7 +169,7 @@ namespace osu.Game.Overlays
private void userLoadComplete(User user)
{
header.User = user;
Header.User = user;
foreach (string id in user.ProfileOrder)
{

View File

@ -28,6 +28,8 @@ namespace osu.Game.Overlays
private readonly Container contentContainer;
protected override bool BlockPassThroughKeyboard => true;
protected override Container<Drawable> Content => contentContainer;
protected Color4 FirstWaveColour