mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Merge branch 'master' into argon-spinner-every-frame-wtf
This commit is contained in:
commit
50a40f4b45
@ -51,7 +51,7 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1021.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1103.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1101.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
|
@ -59,8 +59,9 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(25f, 50f),
|
||||
Scale = new Vector2(2f),
|
||||
State = { Value = DownloadState.NotDownloaded },
|
||||
Scale = new Vector2(2)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -37,7 +37,11 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
beatmapSetInfo = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
beatmapSetInfo.HasFavourited = favourited;
|
||||
});
|
||||
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo) { Scale = new Vector2(2) });
|
||||
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo)
|
||||
{
|
||||
Size = new Vector2(25f, 50f),
|
||||
Scale = new Vector2(2f),
|
||||
});
|
||||
|
||||
assertCorrectIcon(favourited);
|
||||
AddAssert("correct tooltip text", () => button.TooltipText == (favourited ? BeatmapsetsStrings.ShowDetailsUnfavourite : BeatmapsetsStrings.ShowDetailsFavourite));
|
||||
@ -51,7 +55,11 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
BeatmapFavouriteAction? lastRequestAction = null;
|
||||
|
||||
AddStep("create beatmap set", () => beatmapSetInfo = CreateAPIBeatmapSet(Ruleset.Value));
|
||||
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo) { Scale = new Vector2(2) });
|
||||
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo)
|
||||
{
|
||||
Size = new Vector2(25f, 50f),
|
||||
Scale = new Vector2(2f),
|
||||
});
|
||||
|
||||
assertCorrectIcon(false);
|
||||
|
||||
|
@ -93,6 +93,15 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
checkRequestCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAutomaticSkipActuatesOnce()
|
||||
{
|
||||
createTest();
|
||||
AddStep("start automated skip", () => skip.SkipWhenReady());
|
||||
AddUntilStep("wait for button disabled", () => !skip.IsButtonVisible);
|
||||
checkRequestCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClickOnlyActuatesOnce()
|
||||
{
|
||||
@ -110,6 +119,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
checkRequestCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAutomaticSkipActuatesMultipleTimes()
|
||||
{
|
||||
createTest();
|
||||
AddStep("set increment lower", () => increment = 3000);
|
||||
AddStep("start automated skip", () => skip.SkipWhenReady());
|
||||
AddUntilStep("wait for button disabled", () => !skip.IsButtonVisible);
|
||||
checkRequestCount(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClickOnlyActuatesMultipleTimes()
|
||||
{
|
||||
@ -137,8 +156,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
checkRequestCount(0);
|
||||
}
|
||||
|
||||
private void checkRequestCount(int expected) =>
|
||||
AddAssert($"request count is {expected}", () => requestCount == expected);
|
||||
private void checkRequestCount(int expected)
|
||||
{
|
||||
AddAssert($"skip count is {expected}", () => skip.SkipCount, () => Is.EqualTo(expected));
|
||||
AddAssert($"request count is {expected}", () => requestCount, () => Is.EqualTo(expected));
|
||||
}
|
||||
|
||||
private class TestSkipOverlay : SkipOverlay
|
||||
{
|
||||
|
@ -10,10 +10,12 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
@ -37,14 +39,20 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
private CommentsContainer commentsContainer = null!;
|
||||
|
||||
private readonly ManualResetEventSlim requestLock = new ManualResetEventSlim();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
base.Content.AddRange(new Drawable[]
|
||||
{
|
||||
content = new OsuScrollContainer
|
||||
new PopoverContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = content = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}
|
||||
},
|
||||
dialogOverlay
|
||||
});
|
||||
@ -80,8 +88,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
}
|
||||
|
||||
private readonly ManualResetEventSlim deletionPerformed = new ManualResetEventSlim();
|
||||
|
||||
[Test]
|
||||
public void TestDeletion()
|
||||
{
|
||||
@ -105,7 +111,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
AddStep("Setup request handling", () =>
|
||||
{
|
||||
deletionPerformed.Reset();
|
||||
requestLock.Reset();
|
||||
|
||||
dummyAPI.HandleRequest = request =>
|
||||
{
|
||||
@ -138,7 +144,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
deletionPerformed.Wait(10000);
|
||||
requestLock.Wait(10000);
|
||||
req.TriggerSuccess(cb);
|
||||
});
|
||||
|
||||
@ -149,7 +155,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
AddAssert("Loading spinner shown", () => commentsContainer.ChildrenOfType<LoadingSpinner>().Any(d => d.IsPresent));
|
||||
|
||||
AddStep("Complete request", () => deletionPerformed.Set());
|
||||
AddStep("Complete request", () => requestLock.Set());
|
||||
|
||||
AddUntilStep("Comment is deleted locally", () => this.ChildrenOfType<DrawableComment>().Single(x => x.Comment.Id == 1).WasDeleted);
|
||||
}
|
||||
@ -204,6 +210,74 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReport()
|
||||
{
|
||||
const string report_text = "I don't like this comment";
|
||||
DrawableComment? targetComment = null;
|
||||
CommentReportRequest? request = null;
|
||||
|
||||
addTestComments();
|
||||
AddUntilStep("Comment exists", () =>
|
||||
{
|
||||
var comments = this.ChildrenOfType<DrawableComment>();
|
||||
targetComment = comments.SingleOrDefault(x => x.Comment.Id == 2);
|
||||
return targetComment != null;
|
||||
});
|
||||
AddStep("Setup request handling", () =>
|
||||
{
|
||||
requestLock.Reset();
|
||||
|
||||
dummyAPI.HandleRequest = r =>
|
||||
{
|
||||
if (!(r is CommentReportRequest req))
|
||||
return false;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
request = req;
|
||||
requestLock.Wait(10000);
|
||||
req.TriggerSuccess();
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
});
|
||||
AddStep("Click the button", () =>
|
||||
{
|
||||
var btn = targetComment.ChildrenOfType<OsuSpriteText>().Single(x => x.Text == "Report");
|
||||
InputManager.MoveMouseTo(btn);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddStep("Try to report", () =>
|
||||
{
|
||||
var btn = this.ChildrenOfType<ReportCommentPopover>().Single().ChildrenOfType<RoundedButton>().Single();
|
||||
InputManager.MoveMouseTo(btn);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddWaitStep("Wait", 3);
|
||||
AddAssert("Nothing happened", () => this.ChildrenOfType<ReportCommentPopover>().Any());
|
||||
AddStep("Set report data", () =>
|
||||
{
|
||||
var field = this.ChildrenOfType<OsuTextBox>().Single();
|
||||
field.Current.Value = report_text;
|
||||
var reason = this.ChildrenOfType<OsuEnumDropdown<CommentReportReason>>().Single();
|
||||
reason.Current.Value = CommentReportReason.Other;
|
||||
});
|
||||
AddStep("Try to report", () =>
|
||||
{
|
||||
var btn = this.ChildrenOfType<ReportCommentPopover>().Single().ChildrenOfType<RoundedButton>().Single();
|
||||
InputManager.MoveMouseTo(btn);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddWaitStep("Wait", 3);
|
||||
AddAssert("Overlay closed", () => !this.ChildrenOfType<ReportCommentPopover>().Any());
|
||||
AddAssert("Loading spinner shown", () => targetComment.ChildrenOfType<LoadingSpinner>().Any(d => d.IsPresent));
|
||||
AddStep("Complete request", () => requestLock.Set());
|
||||
AddUntilStep("Request sent", () => request != null);
|
||||
AddAssert("Request is correct", () => request != null && request.CommentID == 2 && request.Comment == report_text && request.Reason == CommentReportReason.Other);
|
||||
}
|
||||
|
||||
private void addTestComments()
|
||||
{
|
||||
AddStep("set up response", () =>
|
||||
|
46
osu.Game.Tests/Visual/Online/TestSceneCommentReportButton.cs
Normal file
46
osu.Game.Tests/Visual/Online/TestSceneCommentReportButton.cs
Normal file
@ -0,0 +1,46 @@
|
||||
// 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 osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Comments;
|
||||
using osu.Game.Tests.Visual.UserInterface;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneCommentReportButton : ThemeComparisonTestScene
|
||||
{
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("setup API", () => ((DummyAPIAccess)API).HandleRequest += req =>
|
||||
{
|
||||
switch (req)
|
||||
{
|
||||
case CommentReportRequest report:
|
||||
Scheduler.AddDelayed(report.TriggerSuccess, 1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => new PopoverContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new CommentReportButton(new Comment { User = new APIUser { Username = "Someone" } })
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(2f),
|
||||
}.With(b => Schedule(b.ShowPopover)),
|
||||
};
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -32,7 +31,6 @@ using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Select;
|
||||
@ -538,36 +536,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddUntilStep("selection shown on wedge", () => songSelect!.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRulesetChangeResetsMods()
|
||||
{
|
||||
createSongSelect();
|
||||
changeRuleset(0);
|
||||
|
||||
changeMods(new OsuModHardRock());
|
||||
|
||||
int actionIndex = 0;
|
||||
int modChangeIndex = 0;
|
||||
int rulesetChangeIndex = 0;
|
||||
|
||||
AddStep("change ruleset", () =>
|
||||
{
|
||||
SelectedMods.ValueChanged += onModChange;
|
||||
songSelect!.Ruleset.ValueChanged += onRulesetChange;
|
||||
|
||||
Ruleset.Value = new TaikoRuleset().RulesetInfo;
|
||||
|
||||
SelectedMods.ValueChanged -= onModChange;
|
||||
songSelect!.Ruleset.ValueChanged -= onRulesetChange;
|
||||
});
|
||||
|
||||
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
|
||||
AddAssert("empty mods", () => !SelectedMods.Value.Any());
|
||||
|
||||
void onModChange(ValueChangedEvent<IReadOnlyList<Mod>> e) => modChangeIndex = actionIndex++;
|
||||
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex++;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestModsRetainedBetweenSongSelect()
|
||||
{
|
||||
|
@ -38,6 +38,14 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddStep("revert back", () => this.ChildrenOfType<LabelledSliderBar<double>>().ForEach(l => l.ResizeWidthTo(1, 200, Easing.OutQuint)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDisable()
|
||||
{
|
||||
createSliderBar();
|
||||
AddStep("set disabled", () => this.ChildrenOfType<LabelledSliderBar<double>>().ForEach(l => l.Current.Disabled = true));
|
||||
AddStep("unset disabled", () => this.ChildrenOfType<LabelledSliderBar<double>>().ForEach(l => l.Current.Disabled = false));
|
||||
}
|
||||
|
||||
private void createSliderBar()
|
||||
{
|
||||
AddStep("create component", () =>
|
||||
|
@ -17,6 +17,7 @@ using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Catch.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
@ -338,26 +339,36 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRulesetChanges()
|
||||
public void TestCommonModsMaintainedOnRulesetChange()
|
||||
{
|
||||
createScreen();
|
||||
changeRuleset(0);
|
||||
|
||||
var noFailMod = new OsuRuleset().GetModsFor(ModType.DifficultyReduction).FirstOrDefault(m => m is OsuModNoFail);
|
||||
|
||||
AddStep("set mods externally", () => { SelectedMods.Value = new[] { noFailMod }; });
|
||||
AddStep("select relax mod", () => SelectedMods.Value = new[] { Ruleset.Value.CreateInstance().CreateMod<ModRelax>() });
|
||||
|
||||
changeRuleset(0);
|
||||
AddAssert("ensure mod still selected", () => SelectedMods.Value.SingleOrDefault() is OsuModRelax);
|
||||
|
||||
AddAssert("ensure mods still selected", () => SelectedMods.Value.SingleOrDefault(m => m is OsuModNoFail) != null);
|
||||
changeRuleset(2);
|
||||
AddAssert("catch variant selected", () => SelectedMods.Value.SingleOrDefault() is CatchModRelax);
|
||||
|
||||
changeRuleset(3);
|
||||
AddAssert("no mod selected", () => SelectedMods.Value.Count == 0);
|
||||
}
|
||||
|
||||
AddAssert("ensure mods not selected", () => SelectedMods.Value.Count == 0);
|
||||
|
||||
[Test]
|
||||
public void TestUncommonModsDiscardedOnRulesetChange()
|
||||
{
|
||||
createScreen();
|
||||
changeRuleset(0);
|
||||
|
||||
AddAssert("ensure mods not selected", () => SelectedMods.Value.Count == 0);
|
||||
AddStep("select single tap mod", () => SelectedMods.Value = new[] { new OsuModSingleTap() });
|
||||
|
||||
changeRuleset(0);
|
||||
AddAssert("ensure mod still selected", () => SelectedMods.Value.SingleOrDefault() is OsuModSingleTap);
|
||||
|
||||
changeRuleset(3);
|
||||
AddAssert("no mod selected", () => SelectedMods.Value.Count == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Tournament.Models
|
||||
public Bindable<int> Seed = new BindableInt
|
||||
{
|
||||
MinValue = 1,
|
||||
MaxValue = 64
|
||||
MaxValue = 256
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Tournament.Models
|
||||
public Bindable<int> Seed = new BindableInt
|
||||
{
|
||||
MinValue = 1,
|
||||
MaxValue = 64
|
||||
MaxValue = 256
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Tournament.Models
|
||||
public Bindable<int> LastYearPlacing = new BindableInt
|
||||
{
|
||||
MinValue = 1,
|
||||
MaxValue = 64
|
||||
MaxValue = 256
|
||||
};
|
||||
|
||||
[JsonProperty]
|
||||
|
@ -81,7 +81,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
FavouriteState = { BindTarget = FavouriteState },
|
||||
ButtonsCollapsedWidth = CORNER_RADIUS,
|
||||
ButtonsExpandedWidth = 30,
|
||||
ButtonsPadding = new MarginPadding { Vertical = 35 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
|
@ -82,7 +82,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
FavouriteState = { BindTarget = FavouriteState },
|
||||
ButtonsCollapsedWidth = CORNER_RADIUS,
|
||||
ButtonsExpandedWidth = 30,
|
||||
ButtonsPadding = new MarginPadding { Vertical = 17.5f },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
|
@ -4,13 +4,16 @@
|
||||
#nullable disable
|
||||
|
||||
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.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
@ -59,6 +62,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Container content;
|
||||
private readonly Box hover;
|
||||
|
||||
protected BeatmapCardIconButton()
|
||||
{
|
||||
@ -69,19 +73,27 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = BeatmapCard.CORNER_RADIUS,
|
||||
Scale = new Vector2(0.8f),
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hover = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White.Opacity(0.1f),
|
||||
Blending = BlendingParameters.Additive,
|
||||
},
|
||||
Icon = new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre
|
||||
}
|
||||
Anchor = Anchor.Centre,
|
||||
Scale = new Vector2(1.2f),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
Size = new Vector2(24);
|
||||
IconSize = 12;
|
||||
}
|
||||
|
||||
@ -116,8 +128,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
bool isHovered = IsHovered && Enabled.Value;
|
||||
|
||||
content.ScaleTo(isHovered ? 1.2f : 1, 500, Easing.OutQuint);
|
||||
content.FadeColour(isHovered ? HoverColour : IdleColour, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
hover.FadeTo(isHovered ? 1f : 0f, 500, Easing.OutQuint);
|
||||
content.ScaleTo(isHovered ? 1 : 0.8f, 500, Easing.OutQuint);
|
||||
Icon.FadeColour(isHovered ? HoverColour : IdleColour, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,12 +48,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
}
|
||||
}
|
||||
|
||||
public MarginPadding ButtonsPadding
|
||||
{
|
||||
get => buttons.Padding;
|
||||
set => buttons.Padding = value;
|
||||
}
|
||||
|
||||
protected override Container<Drawable> Content => mainContent;
|
||||
|
||||
private readonly Container background;
|
||||
@ -86,9 +80,6 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
// workaround for masking artifacts at the top & bottom of card,
|
||||
// which become especially visible on downloaded beatmaps (when the icon area has a lime background).
|
||||
Padding = new MarginPadding { Vertical = 1 },
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -104,25 +95,34 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
Child = buttons = new Container<BeatmapCardIconButton>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
// Padding of 4 avoids touching the card borders when in the expanded (ie. showing difficulties) state.
|
||||
// Left override allows the buttons to visually be wider and look better.
|
||||
Padding = new MarginPadding(4) { Left = 2 },
|
||||
Children = new BeatmapCardIconButton[]
|
||||
{
|
||||
new FavouriteButton(beatmapSet)
|
||||
{
|
||||
Current = FavouriteState,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.48f,
|
||||
},
|
||||
new DownloadButton(beatmapSet)
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
State = { BindTarget = downloadTracker.State }
|
||||
State = { BindTarget = downloadTracker.State },
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.48f,
|
||||
},
|
||||
new GoToBeatmapButton(beatmapSet)
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
State = { BindTarget = downloadTracker.State }
|
||||
State = { BindTarget = downloadTracker.State },
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.48f,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
protected virtual HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
||||
protected virtual HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet) { Enabled = { BindTarget = Enabled } };
|
||||
|
||||
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Default)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private const int transition_length = 80;
|
||||
|
||||
private TextContainer text;
|
||||
private HoverClickSounds hoverClickSounds;
|
||||
|
||||
public DrawableOsuMenuItem(MenuItem item)
|
||||
: base(item)
|
||||
@ -36,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
BackgroundColour = Color4.Transparent;
|
||||
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
||||
|
||||
AddInternal(new HoverClickSounds());
|
||||
AddInternal(hoverClickSounds = new HoverClickSounds());
|
||||
|
||||
updateTextColour();
|
||||
|
||||
@ -76,6 +77,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
hoverClickSounds.Enabled.Value = !Item.Action.Disabled;
|
||||
Alpha = Item.Action.Disabled ? 0.2f : 1;
|
||||
|
||||
if (IsHovered && !Item.Action.Disabled)
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Utils;
|
||||
@ -20,7 +21,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public class HoverClickSounds : HoverSounds
|
||||
{
|
||||
public Bindable<bool> Enabled = new Bindable<bool>(true);
|
||||
|
||||
private Sample sampleClick;
|
||||
private Sample sampleClickDisabled;
|
||||
|
||||
private readonly MouseButton[] buttons;
|
||||
|
||||
/// <summary>
|
||||
@ -41,8 +46,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition))
|
||||
{
|
||||
sampleClick.Frequency.Value = 0.99 + RNG.NextDouble(0.02);
|
||||
sampleClick.Play();
|
||||
var channel = Enabled.Value ? sampleClick?.GetChannel() : sampleClickDisabled?.GetChannel();
|
||||
|
||||
if (channel != null)
|
||||
{
|
||||
channel.Frequency.Value = 0.99 + RNG.NextDouble(0.02);
|
||||
channel.Play();
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnClick(e);
|
||||
@ -53,6 +63,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
sampleClick = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-select")
|
||||
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select");
|
||||
|
||||
sampleClickDisabled = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-select-disabled")
|
||||
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-select-disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private readonly LoadingSpinner loading;
|
||||
|
||||
protected LoadingButton()
|
||||
: base(HoverSampleSet.Button)
|
||||
{
|
||||
Add(loading = new LoadingSpinner
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
});
|
||||
|
||||
if (hoverSounds.HasValue)
|
||||
AddInternal(new HoverClickSounds(hoverSounds.Value));
|
||||
AddInternal(new HoverClickSounds(hoverSounds.Value) { Enabled = { BindTarget = Enabled } });
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -46,6 +46,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public bool PlaySamplesOnAdjust { get; set; } = true;
|
||||
|
||||
private readonly HoverClickSounds hoverClickSounds;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to format the tooltip as a percentage or the actual value.
|
||||
/// </summary>
|
||||
@ -127,7 +129,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Current = { Value = true }
|
||||
},
|
||||
},
|
||||
new HoverClickSounds()
|
||||
hoverClickSounds = new HoverClickSounds()
|
||||
};
|
||||
|
||||
Current.DisabledChanged += disabled => { Alpha = disabled ? 0.3f : 1; };
|
||||
@ -152,6 +154,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.LoadComplete();
|
||||
CurrentNumber.BindValueChanged(current => TooltipText = getTooltipText(current.NewValue), true);
|
||||
Current.DisabledChanged += disabled => hoverClickSounds.Enabled.Value = !disabled;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -138,7 +138,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet) { Enabled = { BindTarget = Enabled } };
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
|
38
osu.Game/Online/API/Requests/CommentReportRequest.cs
Normal file
38
osu.Game/Online/API/Requests/CommentReportRequest.cs
Normal file
@ -0,0 +1,38 @@
|
||||
// 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.Net.Http;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Overlays.Comments;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class CommentReportRequest : APIRequest
|
||||
{
|
||||
public readonly long CommentID;
|
||||
public readonly CommentReportReason Reason;
|
||||
public readonly string Comment;
|
||||
|
||||
public CommentReportRequest(long commentID, CommentReportReason reason, string comment)
|
||||
{
|
||||
CommentID = commentID;
|
||||
Reason = reason;
|
||||
Comment = comment;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
req.Method = HttpMethod.Post;
|
||||
|
||||
req.AddParameter(@"reportable_type", @"comment");
|
||||
req.AddParameter(@"reportable_id", $"{CommentID}");
|
||||
req.AddParameter(@"reason", Reason.ToString());
|
||||
req.AddParameter(@"comments", Comment);
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => @"reports";
|
||||
}
|
||||
}
|
@ -616,11 +616,16 @@ namespace osu.Game
|
||||
return;
|
||||
}
|
||||
|
||||
var previouslySelectedMods = SelectedMods.Value.ToArray();
|
||||
|
||||
if (!SelectedMods.Disabled)
|
||||
SelectedMods.Value = Array.Empty<Mod>();
|
||||
|
||||
AvailableMods.Value = dict;
|
||||
|
||||
if (!SelectedMods.Disabled)
|
||||
SelectedMods.Value = previouslySelectedMods.Select(m => instance.CreateModFromAcronym(m.Acronym)).Where(m => m != null).ToArray();
|
||||
|
||||
void revertRulesetChange() => Ruleset.Value = r.OldValue?.Available == true ? r.OldValue : RulesetStore.AvailableRulesets.First();
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
@ -12,7 +10,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
public class ChangelogContent : FillFlowContainer
|
||||
{
|
||||
public Action<APIChangelogBuild> BuildSelected;
|
||||
public Action<APIChangelogBuild>? BuildSelected;
|
||||
|
||||
public void SelectBuild(APIChangelogBuild build) => BuildSelected?.Invoke(build);
|
||||
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
@ -38,6 +39,7 @@ namespace osu.Game.Overlays.Comments
|
||||
private readonly Box background;
|
||||
|
||||
public CancelButton()
|
||||
: base(HoverSampleSet.Button)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Child = new CircularContainer
|
||||
|
91
osu.Game/Overlays/Comments/CommentReportButton.cs
Normal file
91
osu.Game/Overlays/Comments/CommentReportButton.cs
Normal file
@ -0,0 +1,91 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class CommentReportButton : CompositeDrawable, IHasPopover
|
||||
{
|
||||
private readonly Comment comment;
|
||||
|
||||
private LinkFlowContainer link = null!;
|
||||
private LoadingSpinner loading = null!;
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider? colourProvider { get; set; }
|
||||
|
||||
public CommentReportButton(Comment comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
link = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold))
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
loading = new LoadingSpinner
|
||||
{
|
||||
Size = new Vector2(12f),
|
||||
}
|
||||
};
|
||||
|
||||
link.AddLink(UsersStrings.ReportButtonText, this.ShowPopover);
|
||||
}
|
||||
|
||||
private void report(CommentReportReason reason, string comments)
|
||||
{
|
||||
var request = new CommentReportRequest(comment.Id, reason, comments);
|
||||
|
||||
link.Hide();
|
||||
loading.Show();
|
||||
|
||||
request.Success += () => Schedule(() =>
|
||||
{
|
||||
loading.Hide();
|
||||
|
||||
link.Clear(true);
|
||||
link.AddText(UsersStrings.ReportThanks, s => s.Colour = colourProvider?.Content2 ?? Colour4.White);
|
||||
link.Show();
|
||||
|
||||
this.FadeOut(2000, Easing.InQuint).Expire();
|
||||
});
|
||||
|
||||
request.Failure += _ => Schedule(() =>
|
||||
{
|
||||
loading.Hide();
|
||||
link.Show();
|
||||
});
|
||||
|
||||
api.Queue(request);
|
||||
}
|
||||
|
||||
public Popover GetPopover() => new ReportCommentPopover(comment)
|
||||
{
|
||||
Action = report
|
||||
};
|
||||
}
|
||||
}
|
26
osu.Game/Overlays/Comments/CommentReportReason.cs
Normal file
26
osu.Game/Overlays/Comments/CommentReportReason.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 osu.Framework.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public enum CommentReportReason
|
||||
{
|
||||
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsInsults))]
|
||||
Insults,
|
||||
|
||||
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsSpam))]
|
||||
Spam,
|
||||
|
||||
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsUnwantedContent))]
|
||||
UnwantedContent,
|
||||
|
||||
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsNonsense))]
|
||||
Nonsense,
|
||||
|
||||
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.ReportOptionsOther))]
|
||||
Other
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
[Cached]
|
||||
public class DrawableComment : CompositeDrawable
|
||||
{
|
||||
private const int avatar_size = 40;
|
||||
@ -331,12 +332,12 @@ namespace osu.Game.Overlays.Comments
|
||||
makeDeleted();
|
||||
|
||||
actionsContainer.AddLink("Copy link", copyUrl);
|
||||
actionsContainer.AddArbitraryDrawable(new Container { Width = 10 });
|
||||
actionsContainer.AddArbitraryDrawable(Empty().With(d => d.Width = 10));
|
||||
|
||||
if (Comment.UserId.HasValue && Comment.UserId.Value == api.LocalUser.Value.Id)
|
||||
{
|
||||
actionsContainer.AddLink("Delete", deleteComment);
|
||||
}
|
||||
else
|
||||
actionsContainer.AddArbitraryDrawable(new CommentReportButton(Comment));
|
||||
|
||||
if (Comment.IsTopLevel)
|
||||
{
|
||||
|
111
osu.Game/Overlays/Comments/ReportCommentPopover.cs
Normal file
111
osu.Game/Overlays/Comments/ReportCommentPopover.cs
Normal file
@ -0,0 +1,111 @@
|
||||
// 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;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public class ReportCommentPopover : OsuPopover
|
||||
{
|
||||
public Action<CommentReportReason, string>? Action;
|
||||
|
||||
private readonly Comment? comment;
|
||||
|
||||
private OsuEnumDropdown<CommentReportReason> reasonDropdown = null!;
|
||||
private OsuTextBox commentsTextBox = null!;
|
||||
private RoundedButton submitButton = null!;
|
||||
|
||||
public ReportCommentPopover(Comment? comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Child = new ReverseChildIDFillFlowContainer<Drawable>
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
Width = 500,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(7),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle,
|
||||
Size = new Vector2(36),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Text = ReportStrings.CommentTitle(comment?.User?.Username ?? comment?.LegacyName ?? @"Someone"),
|
||||
Font = OsuFont.Torus.With(size: 25),
|
||||
Margin = new MarginPadding { Bottom = 10 }
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Text = UsersStrings.ReportReason,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 40,
|
||||
Child = reasonDropdown = new OsuEnumDropdown<CommentReportReason>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X
|
||||
}
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Text = UsersStrings.ReportComments,
|
||||
},
|
||||
commentsTextBox = new OsuTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
PlaceholderText = UsersStrings.ReportPlaceholder,
|
||||
},
|
||||
submitButton = new RoundedButton
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Width = 200,
|
||||
BackgroundColour = colours.Red3,
|
||||
Text = UsersStrings.ReportActionsSend,
|
||||
Action = () =>
|
||||
{
|
||||
Action?.Invoke(reasonDropdown.Current.Value, commentsTextBox.Text);
|
||||
this.HidePopover();
|
||||
},
|
||||
Margin = new MarginPadding { Bottom = 5, Top = 10 },
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
commentsTextBox.Current.BindValueChanged(e =>
|
||||
{
|
||||
submitButton.Enabled.Value = !string.IsNullOrWhiteSpace(e.NewValue);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
|
||||
@ -45,7 +46,7 @@ namespace osu.Game.Overlays
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Header.With(h => h.Depth = float.MinValue),
|
||||
content = new Container
|
||||
content = new PopoverContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -123,6 +124,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
||||
|
||||
private void cycleDisplayMode()
|
||||
{
|
||||
switch (clockDisplayMode.Value)
|
||||
|
@ -57,15 +57,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
|
||||
private void updateRelativeChildSize()
|
||||
{
|
||||
// the track may not be loaded completely (only has a length once it is).
|
||||
if (!beatmap.Value.Track.IsLoaded)
|
||||
{
|
||||
content.RelativeChildSize = Vector2.One;
|
||||
Schedule(updateRelativeChildSize);
|
||||
return;
|
||||
}
|
||||
// If the track is not loaded, assign a default sane length otherwise relative positioning becomes meaningless.
|
||||
double trackLength = beatmap.Value.Track.IsLoaded ? beatmap.Value.Track.Length : 60000;
|
||||
content.RelativeChildSize = new Vector2((float)Math.Max(1, trackLength), 1);
|
||||
|
||||
content.RelativeChildSize = new Vector2((float)Math.Max(1, beatmap.Value.Track.Length), 1);
|
||||
// The track may not be loaded completely (only has a length once it is).
|
||||
if (!beatmap.Value.Track.IsLoaded)
|
||||
Schedule(updateRelativeChildSize);
|
||||
}
|
||||
|
||||
protected virtual void LoadBeatmap(EditorBeatmap beatmap)
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private readonly Bindable<Track> track = new Bindable<Track>();
|
||||
|
||||
public double TrackLength => track.Value?.Length ?? 60000;
|
||||
public double TrackLength => track.Value?.IsLoaded == true ? track.Value.Length : 60000;
|
||||
|
||||
public ControlPointInfo ControlPointInfo => Beatmap.ControlPointInfo;
|
||||
|
||||
|
@ -27,6 +27,11 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SkipOverlay : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
/// <summary>
|
||||
/// The total number of successful skips performed by this overlay.
|
||||
/// </summary>
|
||||
public int SkipCount { get; private set; }
|
||||
|
||||
private readonly double startTime;
|
||||
|
||||
public Action RequestSkip;
|
||||
@ -124,23 +129,36 @@ namespace osu.Game.Screens.Play
|
||||
return;
|
||||
}
|
||||
|
||||
button.Action = () => RequestSkip?.Invoke();
|
||||
button.Action = () =>
|
||||
{
|
||||
SkipCount++;
|
||||
RequestSkip?.Invoke();
|
||||
};
|
||||
|
||||
fadeContainer.TriggerShow();
|
||||
|
||||
if (skipQueued)
|
||||
{
|
||||
Scheduler.AddDelayed(() => button.TriggerClick(), 200);
|
||||
skipQueued = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggers an "automated" skip to happen as soon as available.
|
||||
/// </summary>
|
||||
public void SkipWhenReady()
|
||||
{
|
||||
if (IsLoaded)
|
||||
if (skipQueued) return;
|
||||
|
||||
skipQueued = true;
|
||||
attemptNextSkip();
|
||||
|
||||
void attemptNextSkip() => Scheduler.AddDelayed(() =>
|
||||
{
|
||||
if (!button.Enabled.Value)
|
||||
{
|
||||
skipQueued = false;
|
||||
return;
|
||||
}
|
||||
|
||||
button.TriggerClick();
|
||||
else
|
||||
skipQueued = true;
|
||||
attemptNextSkip();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -502,8 +502,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (transferRulesetValue())
|
||||
{
|
||||
Mods.Value = Array.Empty<Mod>();
|
||||
|
||||
// transferRulesetValue() may trigger a re-filter. If the current selection does not match the new ruleset, we want to switch away from it.
|
||||
// The default logic on WorkingBeatmap change is to switch to a matching ruleset (see workingBeatmapChanged()), but we don't want that here.
|
||||
// We perform an early selection attempt and clear out the beatmap selection to avoid a second ruleset change (revert).
|
||||
|
@ -36,7 +36,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.17.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2022.1101.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1021.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1103.0" />
|
||||
<PackageReference Include="Sentry" Version="3.22.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
|
@ -61,7 +61,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1021.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1103.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.1101.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
|
||||
|
Loading…
Reference in New Issue
Block a user