mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +08:00
Merge branch 'master' into fix-duplicate-judgements
This commit is contained in:
commit
8ba87dfdbd
@ -1 +1 @@
|
|||||||
Subproject commit 6372fb22c1c85f600921a139849b8dedf71026d5
|
Subproject commit 6915954abdba64e72f698aa58698b00159f3678d
|
@ -12,7 +12,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
@ -55,8 +54,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
},
|
},
|
||||||
HeadCircle = new DrawableHitCircle(s.HeadCircle) { Position = s.TailCircle.Position - s.Position },
|
HeadCircle = new DrawableSliderHead(s, s.HeadCircle),
|
||||||
TailCircle = new DrawableSliderTail(s.TailCircle) { Position = s.TailCircle.Position - s.Position }
|
TailCircle = new DrawableSliderTail(s, s.TailCircle)
|
||||||
};
|
};
|
||||||
|
|
||||||
components.Add(Body);
|
components.Add(Body);
|
||||||
@ -103,10 +102,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
|
double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
|
||||||
|
|
||||||
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
|
||||||
if (!HeadCircle.IsHit)
|
|
||||||
HeadCircle.Position = slider.CurvePositionAt(completionProgress);
|
|
||||||
|
|
||||||
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(completionProgress);
|
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(completionProgress);
|
||||||
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0));
|
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0));
|
||||||
foreach (var t in components.OfType<IRequireTracking>()) t.Tracking = Ball.Tracking;
|
foreach (var t in components.OfType<IRequireTracking>()) t.Tracking = Ball.Tracking;
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
|
{
|
||||||
|
public class DrawableSliderHead : DrawableHitCircle
|
||||||
|
{
|
||||||
|
private readonly Slider slider;
|
||||||
|
|
||||||
|
public DrawableSliderHead(Slider slider, HitCircle h)
|
||||||
|
: base(h)
|
||||||
|
{
|
||||||
|
this.slider = slider;
|
||||||
|
|
||||||
|
Position = HitObject.Position - slider.Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
|
||||||
|
|
||||||
|
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
||||||
|
if (!IsHit)
|
||||||
|
Position = slider.CurvePositionAt(completionProgress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
public bool Tracking { get; set; }
|
public bool Tracking { get; set; }
|
||||||
|
|
||||||
public DrawableSliderTail(HitCircle hitCircle)
|
public DrawableSliderTail(Slider slider, HitCircle hitCircle)
|
||||||
: base(hitCircle)
|
: base(hitCircle)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
FillMode = FillMode.Fit;
|
FillMode = FillMode.Fit;
|
||||||
|
|
||||||
AlwaysPresent = true;
|
AlwaysPresent = true;
|
||||||
|
|
||||||
|
Position = HitObject.Position - slider.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
||||||
|
@ -68,6 +68,8 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
score.Statistics[HitResult.Miss] = scoreResultCounts.GetOrDefault(HitResult.Miss);
|
score.Statistics[HitResult.Miss] = scoreResultCounts.GetOrDefault(HitResult.Miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const double harshness = 0.01;
|
||||||
|
|
||||||
protected override void OnNewJudgement(Judgement judgement)
|
protected override void OnNewJudgement(Judgement judgement)
|
||||||
{
|
{
|
||||||
base.OnNewJudgement(judgement);
|
base.OnNewJudgement(judgement);
|
||||||
@ -83,15 +85,15 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
switch (judgement.Result)
|
switch (judgement.Result)
|
||||||
{
|
{
|
||||||
case HitResult.Great:
|
case HitResult.Great:
|
||||||
Health.Value += (10.2 - hpDrainRate) * 0.02;
|
Health.Value += (10.2 - hpDrainRate) * harshness;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HitResult.Good:
|
case HitResult.Good:
|
||||||
Health.Value += (8 - hpDrainRate) * 0.02;
|
Health.Value += (8 - hpDrainRate) * harshness;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HitResult.Meh:
|
case HitResult.Meh:
|
||||||
Health.Value += (4 - hpDrainRate) * 0.02;
|
Health.Value += (4 - hpDrainRate) * harshness;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*case HitResult.SliderTick:
|
/*case HitResult.SliderTick:
|
||||||
@ -99,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
break;*/
|
break;*/
|
||||||
|
|
||||||
case HitResult.Miss:
|
case HitResult.Miss:
|
||||||
Health.Value -= hpDrainRate * 0.04;
|
Health.Value -= hpDrainRate * (harshness * 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
<Compile Include="Mods\OsuModSpunOut.cs" />
|
<Compile Include="Mods\OsuModSpunOut.cs" />
|
||||||
<Compile Include="Mods\OsuModSuddenDeath.cs" />
|
<Compile Include="Mods\OsuModSuddenDeath.cs" />
|
||||||
<Compile Include="Mods\OsuModTarget.cs" />
|
<Compile Include="Mods\OsuModTarget.cs" />
|
||||||
|
<Compile Include="Objects\Drawables\DrawableSliderHead.cs" />
|
||||||
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
|
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
|
||||||
<Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" />
|
<Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" />
|
||||||
<Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" />
|
<Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" />
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Carousel;
|
using osu.Game.Screens.Select.Carousel;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
@ -22,6 +23,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
public class TestCaseBeatmapCarousel : OsuTestCase
|
public class TestCaseBeatmapCarousel : OsuTestCase
|
||||||
{
|
{
|
||||||
private TestBeatmapCarousel carousel;
|
private TestBeatmapCarousel carousel;
|
||||||
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -46,8 +48,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
private const int set_count = 5;
|
private const int set_count = 5;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
|
this.rulesets = rulesets;
|
||||||
|
|
||||||
Add(carousel = new TestBeatmapCarousel
|
Add(carousel = new TestBeatmapCarousel
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -75,6 +79,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
testRemoveAll();
|
testRemoveAll();
|
||||||
testEmptyTraversal();
|
testEmptyTraversal();
|
||||||
testHiding();
|
testHiding();
|
||||||
|
testSelectingFilteredRuleset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureRandomFetchSuccess() =>
|
private void ensureRandomFetchSuccess() =>
|
||||||
@ -363,6 +368,41 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void testSelectingFilteredRuleset()
|
||||||
|
{
|
||||||
|
var testMixed = createTestBeatmapSet(set_count + 1);
|
||||||
|
AddStep("add mixed ruleset beatmapset", () =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 2; i++)
|
||||||
|
{
|
||||||
|
testMixed.Beatmaps[i].Ruleset = rulesets.AvailableRulesets.ElementAt(i);
|
||||||
|
testMixed.Beatmaps[i].RulesetID = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
carousel.UpdateBeatmapSet(testMixed);
|
||||||
|
});
|
||||||
|
AddStep("filter to ruleset 0", () =>
|
||||||
|
carousel.Filter(new FilterCriteria { Ruleset = rulesets.AvailableRulesets.ElementAt(0) }, false));
|
||||||
|
AddStep("select filtered map skipping filtered", () => carousel.SelectBeatmap(testMixed.Beatmaps[1], false));
|
||||||
|
AddAssert("unfiltered beatmap selected", () => carousel.SelectedBeatmap.Equals(testMixed.Beatmaps[0]));
|
||||||
|
|
||||||
|
AddStep("remove mixed set", () =>
|
||||||
|
{
|
||||||
|
carousel.RemoveBeatmapSet(testMixed);
|
||||||
|
testMixed = null;
|
||||||
|
});
|
||||||
|
var testSingle = createTestBeatmapSet(set_count + 2);
|
||||||
|
testSingle.Beatmaps.ForEach(b =>
|
||||||
|
{
|
||||||
|
b.Ruleset = rulesets.AvailableRulesets.ElementAt(1);
|
||||||
|
b.RulesetID = b.Ruleset.ID ?? 1;
|
||||||
|
});
|
||||||
|
AddStep("add single ruleset beatmapset", () => carousel.UpdateBeatmapSet(testSingle));
|
||||||
|
AddStep("select filtered map skipping filtered", () => carousel.SelectBeatmap(testSingle.Beatmaps[0], false));
|
||||||
|
checkNoSelection();
|
||||||
|
AddStep("remove single ruleset set", () => carousel.RemoveBeatmapSet(testSingle));
|
||||||
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo createTestBeatmapSet(int id)
|
private BeatmapSetInfo createTestBeatmapSet(int id)
|
||||||
{
|
{
|
||||||
return new BeatmapSetInfo
|
return new BeatmapSetInfo
|
||||||
|
161
osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs
Normal file
161
osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
|
using osu.Game.Overlays.Profile.Sections.Recent;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestCaseUserProfileRecentSection : OsuTestCase
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(RecentSection),
|
||||||
|
typeof(DrawableRecentActivity),
|
||||||
|
typeof(PaginatedRecentActivityContainer),
|
||||||
|
typeof(MedalIcon)
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestCaseUserProfileRecentSection()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.Gray(0.2f)
|
||||||
|
},
|
||||||
|
new ScrollContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = new FillFlowContainer<DrawableRecentActivity>
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
ChildrenEnumerable = createDummyActivities().Select(a => new DrawableRecentActivity(a))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<RecentActivity> createDummyActivities()
|
||||||
|
{
|
||||||
|
var dummyBeatmap = new RecentActivity.RecentActivityBeatmap
|
||||||
|
{
|
||||||
|
Title = @"Dummy beatmap",
|
||||||
|
Url = "/b/1337",
|
||||||
|
};
|
||||||
|
|
||||||
|
var dummyUser = new RecentActivity.RecentActivityUser
|
||||||
|
{
|
||||||
|
Username = "DummyReborn",
|
||||||
|
Url = "/u/666",
|
||||||
|
PreviousUsername = "Dummy",
|
||||||
|
};
|
||||||
|
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.Achievement,
|
||||||
|
Achievement = new RecentActivity.RecentActivityAchievement
|
||||||
|
{
|
||||||
|
Name = @"Feelin' It",
|
||||||
|
Slug = @"all-secret-feelinit",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapPlaycount,
|
||||||
|
Count = 1337,
|
||||||
|
Beatmap = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetApprove,
|
||||||
|
Approval = BeatmapApproval.Qualified,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetDelete,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetRevive,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetRevive,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetUpdate,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.BeatmapsetUpload,
|
||||||
|
Beatmapset = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.Rank,
|
||||||
|
Rank = 1,
|
||||||
|
Mode = "osu!",
|
||||||
|
Beatmap = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.RankLost,
|
||||||
|
Mode = "osu!",
|
||||||
|
Beatmap = dummyBeatmap,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UsernameChange,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UserSupportAgain,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UserSupportFirst,
|
||||||
|
},
|
||||||
|
new RecentActivity
|
||||||
|
{
|
||||||
|
User = dummyUser,
|
||||||
|
Type = RecentActivityType.UserSupportGift,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -173,6 +173,7 @@
|
|||||||
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseUserProfileRecentSection.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserRanks.cs" />
|
<Compile Include="Visual\TestCaseUserRanks.cs" />
|
||||||
<Compile Include="Visual\TestCaseVolumePieces.cs" />
|
<Compile Include="Visual\TestCaseVolumePieces.cs" />
|
||||||
<Compile Include="Visual\TestCaseWaveform.cs" />
|
<Compile Include="Visual\TestCaseWaveform.cs" />
|
||||||
|
@ -41,12 +41,12 @@ namespace osu.Game.Beatmaps
|
|||||||
foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
|
foreach (var mod in Mods.OfType<IApplicableToDifficulty>())
|
||||||
mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BaseDifficulty);
|
mod.ApplyToDifficulty(Beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
|
|
||||||
|
foreach (var h in Beatmap.HitObjects)
|
||||||
|
h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IApplicableToHitObject<T>>())
|
foreach (var mod in mods.OfType<IApplicableToHitObject<T>>())
|
||||||
foreach (var obj in Beatmap.HitObjects)
|
foreach (var obj in Beatmap.HitObjects)
|
||||||
mod.ApplyToHitObject(obj);
|
mod.ApplyToHitObject(obj);
|
||||||
|
|
||||||
foreach (var h in Beatmap.HitObjects)
|
|
||||||
h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BaseDifficulty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void PreprocessHitObjects()
|
protected virtual void PreprocessHitObjects()
|
||||||
|
@ -90,6 +90,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
case LinkAction.External:
|
case LinkAction.External:
|
||||||
Process.Start(url);
|
Process.Start(url);
|
||||||
break;
|
break;
|
||||||
|
case LinkAction.OpenUserProfile:
|
||||||
|
if (long.TryParse(linkArgument, out long userId))
|
||||||
|
game?.ShowUser(userId);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action.");
|
throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action.");
|
||||||
}
|
}
|
||||||
|
130
osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs
Normal file
130
osu.Game/Online/API/Requests/GetUserRecentActivitiesRequest.cs
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using Humanizer;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API.Requests
|
||||||
|
{
|
||||||
|
public class GetUserRecentActivitiesRequest : APIRequest<List<RecentActivity>>
|
||||||
|
{
|
||||||
|
private readonly long userId;
|
||||||
|
private readonly int offset;
|
||||||
|
|
||||||
|
public GetUserRecentActivitiesRequest(long userId, int offset = 0)
|
||||||
|
{
|
||||||
|
this.userId = userId;
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string Target => $"users/{userId}/recent_activity?offset={offset}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RecentActivity
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public int ID;
|
||||||
|
|
||||||
|
[JsonProperty("createdAt")]
|
||||||
|
public DateTimeOffset CreatedAt;
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
private string type
|
||||||
|
{
|
||||||
|
set => Type = (RecentActivityType)Enum.Parse(typeof(RecentActivityType), value.Pascalize());
|
||||||
|
}
|
||||||
|
|
||||||
|
public RecentActivityType Type;
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
private string scoreRank
|
||||||
|
{
|
||||||
|
set => ScoreRank = (ScoreRank)Enum.Parse(typeof(ScoreRank), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoreRank ScoreRank;
|
||||||
|
|
||||||
|
[JsonProperty("rank")]
|
||||||
|
public int Rank;
|
||||||
|
|
||||||
|
[JsonProperty("approval")]
|
||||||
|
public BeatmapApproval Approval;
|
||||||
|
|
||||||
|
[JsonProperty("count")]
|
||||||
|
public int Count;
|
||||||
|
|
||||||
|
[JsonProperty("mode")]
|
||||||
|
public string Mode;
|
||||||
|
|
||||||
|
[JsonProperty("beatmap")]
|
||||||
|
public RecentActivityBeatmap Beatmap;
|
||||||
|
|
||||||
|
[JsonProperty("beatmapset")]
|
||||||
|
public RecentActivityBeatmap Beatmapset;
|
||||||
|
|
||||||
|
[JsonProperty("user")]
|
||||||
|
public RecentActivityUser User;
|
||||||
|
|
||||||
|
[JsonProperty("achievement")]
|
||||||
|
public RecentActivityAchievement Achievement;
|
||||||
|
|
||||||
|
public class RecentActivityBeatmap
|
||||||
|
{
|
||||||
|
[JsonProperty("title")]
|
||||||
|
public string Title;
|
||||||
|
|
||||||
|
[JsonProperty("url")]
|
||||||
|
public string Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RecentActivityUser
|
||||||
|
{
|
||||||
|
[JsonProperty("username")]
|
||||||
|
public string Username;
|
||||||
|
|
||||||
|
[JsonProperty("url")]
|
||||||
|
public string Url;
|
||||||
|
|
||||||
|
[JsonProperty("previousUsername")]
|
||||||
|
public string PreviousUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RecentActivityAchievement
|
||||||
|
{
|
||||||
|
[JsonProperty("slug")]
|
||||||
|
public string Slug;
|
||||||
|
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RecentActivityType
|
||||||
|
{
|
||||||
|
Achievement,
|
||||||
|
BeatmapPlaycount,
|
||||||
|
BeatmapsetApprove,
|
||||||
|
BeatmapsetDelete,
|
||||||
|
BeatmapsetRevive,
|
||||||
|
BeatmapsetUpdate,
|
||||||
|
BeatmapsetUpload,
|
||||||
|
Medal,
|
||||||
|
Rank,
|
||||||
|
RankLost,
|
||||||
|
UserSupportAgain,
|
||||||
|
UserSupportFirst,
|
||||||
|
UserSupportGift,
|
||||||
|
UsernameChange,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BeatmapApproval
|
||||||
|
{
|
||||||
|
Ranked,
|
||||||
|
Approved,
|
||||||
|
Qualified,
|
||||||
|
}
|
||||||
|
}
|
@ -118,6 +118,8 @@ namespace osu.Game.Online.Chat
|
|||||||
case "beatmapsets":
|
case "beatmapsets":
|
||||||
case "d":
|
case "d":
|
||||||
return new LinkDetails(LinkAction.OpenBeatmapSet, args[3]);
|
return new LinkDetails(LinkAction.OpenBeatmapSet, args[3]);
|
||||||
|
case "u":
|
||||||
|
return new LinkDetails(LinkAction.OpenUserProfile, args[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +148,9 @@ namespace osu.Game.Online.Chat
|
|||||||
case "spectate":
|
case "spectate":
|
||||||
linkType = LinkAction.Spectate;
|
linkType = LinkAction.Spectate;
|
||||||
break;
|
break;
|
||||||
|
case "u":
|
||||||
|
linkType = LinkAction.OpenUserProfile;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
linkType = LinkAction.External;
|
linkType = LinkAction.External;
|
||||||
break;
|
break;
|
||||||
@ -205,6 +210,15 @@ namespace osu.Game.Online.Chat
|
|||||||
return inputMessage;
|
return inputMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MessageFormatterResult FormatText(string text)
|
||||||
|
{
|
||||||
|
var result = format(text);
|
||||||
|
|
||||||
|
result.Links.Sort();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public class MessageFormatterResult
|
public class MessageFormatterResult
|
||||||
{
|
{
|
||||||
public List<Link> Links = new List<Link>();
|
public List<Link> Links = new List<Link>();
|
||||||
@ -239,6 +253,7 @@ namespace osu.Game.Online.Chat
|
|||||||
OpenEditorTimestamp,
|
OpenEditorTimestamp,
|
||||||
JoinMultiplayerMatch,
|
JoinMultiplayerMatch,
|
||||||
Spectate,
|
Spectate,
|
||||||
|
OpenUserProfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Link : IComparable<Link>
|
public class Link : IComparable<Link>
|
||||||
|
@ -155,6 +155,12 @@ namespace osu.Game
|
|||||||
/// <param name="setId">The set to display.</param>
|
/// <param name="setId">The set to display.</param>
|
||||||
public void ShowBeatmapSet(int setId) => beatmapSetOverlay.ShowBeatmapSet(setId);
|
public void ShowBeatmapSet(int setId) => beatmapSetOverlay.ShowBeatmapSet(setId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show a user's profile as an overlay.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user to display.</param>
|
||||||
|
public void ShowUser(long userId) => userProfile.ShowUser(userId);
|
||||||
|
|
||||||
protected void LoadScore(Score s)
|
protected void LoadScore(Score s)
|
||||||
{
|
{
|
||||||
scoreLoad?.Cancel();
|
scoreLoad?.Cancel();
|
||||||
|
@ -0,0 +1,165 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.Chat;
|
||||||
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
|
{
|
||||||
|
public class DrawableRecentActivity : DrawableProfileRow
|
||||||
|
{
|
||||||
|
private APIAccess api;
|
||||||
|
|
||||||
|
private readonly RecentActivity activity;
|
||||||
|
|
||||||
|
private LinkFlowContainer content;
|
||||||
|
|
||||||
|
public DrawableRecentActivity(RecentActivity activity)
|
||||||
|
{
|
||||||
|
this.activity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(APIAccess api)
|
||||||
|
{
|
||||||
|
this.api = api;
|
||||||
|
|
||||||
|
LeftFlowContainer.Padding = new MarginPadding { Left = 10, Right = 160 };
|
||||||
|
|
||||||
|
LeftFlowContainer.Add(content = new LinkFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
});
|
||||||
|
|
||||||
|
RightFlowContainer.Add(new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = activity.CreatedAt.LocalDateTime.ToShortDateString(),
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Font = "Exo2.0-RegularItalic",
|
||||||
|
TextSize = 12,
|
||||||
|
Colour = OsuColour.Gray(0xAA),
|
||||||
|
});
|
||||||
|
|
||||||
|
var formatted = createMessage();
|
||||||
|
|
||||||
|
content.AddLinks(formatted.Text, formatted.Links);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateLeftVisual()
|
||||||
|
{
|
||||||
|
switch (activity.Type)
|
||||||
|
{
|
||||||
|
case RecentActivityType.Rank:
|
||||||
|
return new DrawableRank(activity.ScoreRank)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 60,
|
||||||
|
FillMode = FillMode.Fit,
|
||||||
|
};
|
||||||
|
|
||||||
|
case RecentActivityType.Achievement:
|
||||||
|
return new MedalIcon(activity.Achievement.Slug)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 60,
|
||||||
|
FillMode = FillMode.Fit,
|
||||||
|
};
|
||||||
|
|
||||||
|
default:
|
||||||
|
return new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 60,
|
||||||
|
FillMode = FillMode.Fit,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string toAbsoluteUrl(string url) => $"{api.Endpoint}{url}";
|
||||||
|
|
||||||
|
private MessageFormatter.MessageFormatterResult createMessage()
|
||||||
|
{
|
||||||
|
string userLinkTemplate() => $"[{toAbsoluteUrl(activity.User?.Url)} {activity.User?.Username}]";
|
||||||
|
string beatmapLinkTemplate() => $"[{toAbsoluteUrl(activity.Beatmap?.Url)} {activity.Beatmap?.Title}]";
|
||||||
|
string beatmapsetLinkTemplate() => $"[{toAbsoluteUrl(activity.Beatmapset?.Url)} {activity.Beatmapset?.Title}]";
|
||||||
|
|
||||||
|
string message;
|
||||||
|
|
||||||
|
switch (activity.Type)
|
||||||
|
{
|
||||||
|
case RecentActivityType.Achievement:
|
||||||
|
message = $"{userLinkTemplate()} unlocked the {activity.Achievement.Name} medal!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.BeatmapPlaycount:
|
||||||
|
message = $"{beatmapLinkTemplate()} has been played {activity.Count} times!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.BeatmapsetApprove:
|
||||||
|
message = $"{beatmapsetLinkTemplate()} has been {activity.Approval.ToString().ToLowerInvariant()}!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.BeatmapsetDelete:
|
||||||
|
message = $"{beatmapsetLinkTemplate()} has been deleted.";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.BeatmapsetRevive:
|
||||||
|
message = $"{beatmapsetLinkTemplate()} has been revived from eternal slumber by {userLinkTemplate()}.";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.BeatmapsetUpdate:
|
||||||
|
message = $"{userLinkTemplate()} has updated the beatmap {beatmapsetLinkTemplate()}!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.BeatmapsetUpload:
|
||||||
|
message = $"{userLinkTemplate()} has submitted a new beatmap {beatmapsetLinkTemplate()}!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.Medal:
|
||||||
|
// apparently this shouldn't exist look at achievement instead (https://github.com/ppy/osu-web/blob/master/resources/assets/coffee/react/profile-page/recent-activity.coffee#L111)
|
||||||
|
message = string.Empty;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.Rank:
|
||||||
|
message = $"{userLinkTemplate()} achieved rank #{activity.Rank} on {beatmapLinkTemplate()} ({activity.Mode}!)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.RankLost:
|
||||||
|
message = $"{userLinkTemplate()} has lost first place on {beatmapLinkTemplate()} ({activity.Mode}!)";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.UserSupportAgain:
|
||||||
|
message = $"{userLinkTemplate()} has once again chosen to support osu! - thanks for your generosity!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.UserSupportFirst:
|
||||||
|
message = $"{userLinkTemplate()} has become an osu! supporter - thanks for your generosity!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.UserSupportGift:
|
||||||
|
message = $"{userLinkTemplate()} has received the gift of osu! supporter!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RecentActivityType.UsernameChange:
|
||||||
|
message = $"{activity.User?.PreviousUsername} has changed their username to {userLinkTemplate()}!";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
message = string.Empty;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MessageFormatter.FormatText(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs
Normal file
38
osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
|
{
|
||||||
|
public class MedalIcon : Container
|
||||||
|
{
|
||||||
|
private readonly string slug;
|
||||||
|
private readonly Sprite sprite;
|
||||||
|
|
||||||
|
private string url => $@"https://s.ppy.sh/images/medals-client/{slug}@2x.png";
|
||||||
|
|
||||||
|
public MedalIcon(string slug)
|
||||||
|
{
|
||||||
|
this.slug = slug;
|
||||||
|
|
||||||
|
Child = sprite = new Sprite
|
||||||
|
{
|
||||||
|
Height = 40,
|
||||||
|
Width = 40,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
sprite.Texture = textures.Get(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Users;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
|
{
|
||||||
|
public class PaginatedRecentActivityContainer : PaginatedContainer
|
||||||
|
{
|
||||||
|
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
||||||
|
: base(user, header, missing)
|
||||||
|
{
|
||||||
|
ItemsPerPage = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ShowMore()
|
||||||
|
{
|
||||||
|
base.ShowMore();
|
||||||
|
|
||||||
|
var req = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++ * ItemsPerPage);
|
||||||
|
|
||||||
|
req.Success += activities =>
|
||||||
|
{
|
||||||
|
ShowMoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0);
|
||||||
|
ShowMoreLoading.Hide();
|
||||||
|
|
||||||
|
if (!activities.Any() && VisiblePages == 1)
|
||||||
|
{
|
||||||
|
MissingText.Show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MissingText.Hide();
|
||||||
|
|
||||||
|
foreach (RecentActivity activity in activities)
|
||||||
|
{
|
||||||
|
ItemsContainer.Add(new DrawableRecentActivity(activity));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Api.Queue(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,22 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Game.Overlays.Profile.Sections.Recent;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections
|
namespace osu.Game.Overlays.Profile.Sections
|
||||||
{
|
{
|
||||||
public class RecentSection : ProfileSection
|
public class RecentSection : ProfileSection
|
||||||
{
|
{
|
||||||
public override string Title => "Recent";
|
public override string Title => "Recent";
|
||||||
|
|
||||||
public override string Identifier => "recent_activities";
|
public override string Identifier => "recent_activity";
|
||||||
|
|
||||||
|
public RecentSection()
|
||||||
|
{
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new PaginatedRecentActivityContainer(User, null, @"This user hasn't done anything notable recently!"),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,14 @@ namespace osu.Game.Overlays
|
|||||||
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowUser(long userId)
|
||||||
|
{
|
||||||
|
if (userId == Header.User.Id)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ShowUser(new User { Id = userId });
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowUser(User user, bool fetchOnline = true)
|
public void ShowUser(User user, bool fetchOnline = true)
|
||||||
{
|
{
|
||||||
userReq?.Cancel();
|
userReq?.Cancel();
|
||||||
@ -82,7 +90,7 @@ namespace osu.Game.Overlays
|
|||||||
sections = new ProfileSection[]
|
sections = new ProfileSection[]
|
||||||
{
|
{
|
||||||
//new AboutSection(),
|
//new AboutSection(),
|
||||||
//new RecentSection(),
|
new RecentSection(),
|
||||||
new RanksSection(),
|
new RanksSection(),
|
||||||
//new MedalsSection(),
|
//new MedalsSection(),
|
||||||
new HistoricalSection(),
|
new HistoricalSection(),
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Rulesets
|
|||||||
var instances = loaded_assemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r, (RulesetInfo)null)).ToList();
|
var instances = loaded_assemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r, (RulesetInfo)null)).ToList();
|
||||||
|
|
||||||
//add all legacy modes in correct order
|
//add all legacy modes in correct order
|
||||||
foreach (var r in instances.Where(r => r.LegacyID >= 0).OrderBy(r => r.LegacyID))
|
foreach (var r in instances.Where(r => r.LegacyID != null).OrderBy(r => r.LegacyID))
|
||||||
{
|
{
|
||||||
if (context.RulesetInfo.SingleOrDefault(rsi => rsi.ID == r.RulesetInfo.ID) == null)
|
if (context.RulesetInfo.SingleOrDefault(rsi => rsi.ID == r.RulesetInfo.ID) == null)
|
||||||
context.RulesetInfo.Add(r.RulesetInfo);
|
context.RulesetInfo.Add(r.RulesetInfo);
|
||||||
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets
|
|||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
//add any other modes
|
//add any other modes
|
||||||
foreach (var r in instances.Where(r => r.LegacyID < 0))
|
foreach (var r in instances.Where(r => r.LegacyID == null))
|
||||||
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo == r.RulesetInfo.InstantiationInfo) == null)
|
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo == r.RulesetInfo.InstantiationInfo) == null)
|
||||||
context.RulesetInfo.Add(r.RulesetInfo);
|
context.RulesetInfo.Add(r.RulesetInfo);
|
||||||
|
|
||||||
|
@ -25,32 +25,29 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using osu.Game.Screens.Play.BreaksOverlay;
|
using osu.Game.Screens.Play.BreaksOverlay;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class Player : OsuScreen, IProvideCursor
|
public class Player : ScreenWithBeatmapBackground, IProvideCursor
|
||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
|
||||||
|
|
||||||
protected override float BackgroundParallaxAmount => 0.1f;
|
protected override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
public override bool ShowOverlaysOnEnter => false;
|
||||||
|
|
||||||
public Action RestartRequested;
|
public Action RestartRequested;
|
||||||
|
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
|
||||||
|
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
public bool AllowPause { get; set; } = true;
|
public bool AllowPause { get; set; } = true;
|
||||||
public bool AllowLeadIn { get; set; } = true;
|
public bool AllowLeadIn { get; set; } = true;
|
||||||
public bool AllowResults { get; set; } = true;
|
public bool AllowResults { get; set; } = true;
|
||||||
|
|
||||||
|
private Bindable<bool> mouseWheelDisabled;
|
||||||
|
private Bindable<double> userAudioOffset;
|
||||||
|
|
||||||
public int RestartCount;
|
public int RestartCount;
|
||||||
|
|
||||||
public CursorContainer Cursor => RulesetContainer.Cursor;
|
public CursorContainer Cursor => RulesetContainer.Cursor;
|
||||||
@ -69,41 +66,27 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
|
|
||||||
private ScoreProcessor scoreProcessor;
|
|
||||||
protected RulesetContainer RulesetContainer;
|
|
||||||
|
|
||||||
#region User Settings
|
|
||||||
|
|
||||||
private Bindable<double> dimLevel;
|
|
||||||
private Bindable<double> blurLevel;
|
|
||||||
private Bindable<bool> showStoryboard;
|
|
||||||
private Bindable<bool> mouseWheelDisabled;
|
|
||||||
private Bindable<double> userAudioOffset;
|
|
||||||
|
|
||||||
private SampleChannel sampleRestart;
|
private SampleChannel sampleRestart;
|
||||||
|
|
||||||
#endregion
|
private ScoreProcessor scoreProcessor;
|
||||||
|
protected RulesetContainer RulesetContainer;
|
||||||
private Container storyboardContainer;
|
|
||||||
private DrawableStoryboard storyboard;
|
|
||||||
|
|
||||||
private HUDOverlay hudOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
private FailOverlay failOverlay;
|
private FailOverlay failOverlay;
|
||||||
|
|
||||||
|
private DrawableStoryboard storyboard;
|
||||||
|
private Container storyboardContainer;
|
||||||
|
|
||||||
private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
|
private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, OsuConfigManager config, APIAccess api)
|
private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
||||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
|
||||||
blurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
|
||||||
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
|
||||||
|
|
||||||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||||
|
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
|
||||||
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
|
||||||
|
|
||||||
WorkingBeatmap working = Beatmap.Value;
|
WorkingBeatmap working = Beatmap.Value;
|
||||||
Beatmap beatmap;
|
Beatmap beatmap;
|
||||||
@ -156,7 +139,6 @@ namespace osu.Game.Screens.Play
|
|||||||
// the final usable gameplay clock with user-set offsets applied.
|
// the final usable gameplay clock with user-set offsets applied.
|
||||||
var offsetClock = new FramedOffsetClock(adjustableClock);
|
var offsetClock = new FramedOffsetClock(adjustableClock);
|
||||||
|
|
||||||
userAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
|
|
||||||
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
||||||
userAudioOffset.TriggerChange();
|
userAudioOffset.TriggerChange();
|
||||||
|
|
||||||
@ -225,7 +207,7 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (showStoryboard)
|
if (ShowStoryboard)
|
||||||
initializeStoryboard(false);
|
initializeStoryboard(false);
|
||||||
|
|
||||||
// Bind ScoreProcessor to ourselves
|
// Bind ScoreProcessor to ourselves
|
||||||
@ -245,19 +227,6 @@ namespace osu.Game.Screens.Play
|
|||||||
mod.ApplyToClock(sourceClock);
|
mod.ApplyToClock(sourceClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeStoryboard(bool asyncLoad)
|
|
||||||
{
|
|
||||||
var beatmap = Beatmap.Value;
|
|
||||||
|
|
||||||
storyboard = beatmap.Storyboard.CreateDrawable(Beatmap.Value);
|
|
||||||
storyboard.Masking = true;
|
|
||||||
|
|
||||||
if (asyncLoad)
|
|
||||||
LoadComponentAsync(storyboard, storyboardContainer.Add);
|
|
||||||
else
|
|
||||||
storyboardContainer.Add(storyboard);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
sampleRestart?.Play();
|
sampleRestart?.Play();
|
||||||
@ -316,11 +285,6 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!loadedSuccessfully)
|
if (!loadedSuccessfully)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dimLevel.ValueChanged += _ => updateBackgroundElements();
|
|
||||||
blurLevel.ValueChanged += _ => updateBackgroundElements();
|
|
||||||
showStoryboard.ValueChanged += _ => updateBackgroundElements();
|
|
||||||
updateBackgroundElements();
|
|
||||||
|
|
||||||
Content.Alpha = 0;
|
Content.Alpha = 0;
|
||||||
Content
|
Content
|
||||||
.ScaleTo(0.7f)
|
.ScaleTo(0.7f)
|
||||||
@ -374,28 +338,6 @@ namespace osu.Game.Screens.Play
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBackgroundElements()
|
|
||||||
{
|
|
||||||
if (!IsCurrentScreen) return;
|
|
||||||
|
|
||||||
const float duration = 800;
|
|
||||||
|
|
||||||
var opacity = 1 - (float)dimLevel;
|
|
||||||
|
|
||||||
if (showStoryboard && storyboard == null)
|
|
||||||
initializeStoryboard(true);
|
|
||||||
|
|
||||||
var beatmap = Beatmap.Value;
|
|
||||||
var storyboardVisible = showStoryboard && beatmap.Storyboard.HasDrawable;
|
|
||||||
|
|
||||||
storyboardContainer
|
|
||||||
.FadeColour(OsuColour.Gray(opacity), duration, Easing.OutQuint)
|
|
||||||
.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, duration, Easing.OutQuint);
|
|
||||||
|
|
||||||
(Background as BackgroundScreenBeatmap)?.BlurTo(new Vector2((float)blurLevel.Value * 25), duration, Easing.OutQuint);
|
|
||||||
Background?.FadeTo(beatmap.Background != null && (!storyboardVisible || !beatmap.Storyboard.ReplacesBackground) ? opacity : 0, duration, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fadeOut()
|
private void fadeOut()
|
||||||
{
|
{
|
||||||
const float fade_out_duration = 250;
|
const float fade_out_duration = 250;
|
||||||
@ -409,5 +351,41 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused;
|
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused;
|
||||||
|
|
||||||
|
private void initializeStoryboard(bool asyncLoad)
|
||||||
|
{
|
||||||
|
if (storyboardContainer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var beatmap = Beatmap.Value;
|
||||||
|
|
||||||
|
storyboard = beatmap.Storyboard.CreateDrawable();
|
||||||
|
storyboard.Masking = true;
|
||||||
|
|
||||||
|
if (asyncLoad)
|
||||||
|
LoadComponentAsync(storyboard, storyboardContainer.Add);
|
||||||
|
else
|
||||||
|
storyboardContainer.Add(storyboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateBackgroundElements()
|
||||||
|
{
|
||||||
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
|
base.UpdateBackgroundElements();
|
||||||
|
|
||||||
|
if (ShowStoryboard && storyboard == null)
|
||||||
|
initializeStoryboard(true);
|
||||||
|
|
||||||
|
var beatmap = Beatmap.Value;
|
||||||
|
var storyboardVisible = ShowStoryboard && beatmap.Storyboard.HasDrawable;
|
||||||
|
|
||||||
|
storyboardContainer?
|
||||||
|
.FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint)
|
||||||
|
.FadeTo(storyboardVisible && BackgroundOpacity > 0 ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
|
if (storyboardVisible && beatmap.Storyboard.ReplacesBackground)
|
||||||
|
Background?.FadeTo(0, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Screens.Backgrounds;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
@ -17,7 +16,7 @@ using osu.Game.Screens.Play.PlayerSettings;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class PlayerLoader : OsuScreen
|
public class PlayerLoader : ScreenWithBeatmapBackground
|
||||||
{
|
{
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
@ -27,10 +26,6 @@ namespace osu.Game.Screens.Play
|
|||||||
private bool showOverlays = true;
|
private bool showOverlays = true;
|
||||||
public override bool ShowOverlaysOnEnter => showOverlays;
|
public override bool ShowOverlaysOnEnter => showOverlays;
|
||||||
|
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
|
||||||
|
|
||||||
public PlayerLoader(Player player)
|
public PlayerLoader(Player player)
|
||||||
{
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
@ -93,8 +88,6 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
Background.FadeTo(0.4f, 250);
|
|
||||||
|
|
||||||
Content.ScaleTo(0.7f);
|
Content.ScaleTo(0.7f);
|
||||||
|
|
||||||
contentIn();
|
contentIn();
|
||||||
|
@ -15,7 +15,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
private readonly PlayerSliderBar<double> dimSliderBar;
|
private readonly PlayerSliderBar<double> dimSliderBar;
|
||||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||||
private readonly PlayerCheckbox showStoryboardToggle;
|
private readonly PlayerCheckbox showStoryboardToggle;
|
||||||
private readonly PlayerCheckbox mouseWheelDisabledToggle;
|
|
||||||
|
|
||||||
public VisualSettings()
|
public VisualSettings()
|
||||||
{
|
{
|
||||||
@ -35,8 +34,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
{
|
{
|
||||||
Text = "Toggles:"
|
Text = "Toggles:"
|
||||||
},
|
},
|
||||||
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" },
|
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" }
|
||||||
mouseWheelDisabledToggle = new PlayerCheckbox { LabelText = "Disable mouse wheel" }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +44,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
mouseWheelDisabledToggle.Bindable = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
57
osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs
Normal file
57
osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (c) 2007-2018 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.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Screens.Backgrounds;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
public abstract class ScreenWithBeatmapBackground : OsuScreen
|
||||||
|
{
|
||||||
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||||
|
|
||||||
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
|
protected const float BACKGROUND_FADE_DURATION = 800;
|
||||||
|
|
||||||
|
protected float BackgroundOpacity => 1 - (float)DimLevel;
|
||||||
|
|
||||||
|
#region User Settings
|
||||||
|
|
||||||
|
protected Bindable<double> DimLevel;
|
||||||
|
protected Bindable<double> BlurLevel;
|
||||||
|
protected Bindable<bool> ShowStoryboard;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
|
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
|
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnEntering(Screen last)
|
||||||
|
{
|
||||||
|
base.OnEntering(last);
|
||||||
|
DimLevel.ValueChanged += _ => UpdateBackgroundElements();
|
||||||
|
BlurLevel.ValueChanged += _ => UpdateBackgroundElements();
|
||||||
|
ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements();
|
||||||
|
UpdateBackgroundElements();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateBackgroundElements()
|
||||||
|
{
|
||||||
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
|
Background?.FadeTo(BackgroundOpacity, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
|
(Background as BackgroundScreenBeatmap)?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -169,20 +169,43 @@ namespace osu.Game.Screens.Select
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectBeatmap(BeatmapInfo beatmap)
|
/// <summary>
|
||||||
|
/// Selects a given beatmap on the carousel.
|
||||||
|
///
|
||||||
|
/// If bypassFilters is false, we will try to select another unfiltered beatmap in the same set. If the
|
||||||
|
/// entire set is filtered, no selection is made.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beatmap">The beatmap to select.</param>
|
||||||
|
/// <param name="bypassFilters">Whether to select the beatmap even if it is filtered (i.e., not visible on carousel).</param>
|
||||||
|
/// <returns>True if a selection was made, False if it wasn't.</returns>
|
||||||
|
public bool SelectBeatmap(BeatmapInfo beatmap, bool bypassFilters = true)
|
||||||
{
|
{
|
||||||
if (beatmap?.Hidden != false)
|
if (beatmap?.Hidden != false)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
foreach (CarouselBeatmapSet group in beatmapSets)
|
foreach (CarouselBeatmapSet set in beatmapSets)
|
||||||
{
|
{
|
||||||
var item = group.Beatmaps.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
|
if (!bypassFilters && set.Filtered)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var item = set.Beatmaps.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
|
||||||
|
|
||||||
|
if (item == null)
|
||||||
|
// The beatmap that needs to be selected doesn't exist in this set
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!bypassFilters && item.Filtered)
|
||||||
|
// The beatmap exists in this set but is filtered, so look for the first unfiltered map in the set
|
||||||
|
item = set.Beatmaps.FirstOrDefault(b => !b.Filtered);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
select(item);
|
select(item);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -214,11 +214,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
||||||
Beatmap.TriggerChange();
|
Beatmap.TriggerChange();
|
||||||
|
|
||||||
Beatmap.ValueChanged += b =>
|
Beatmap.ValueChanged += workingBeatmapChanged;
|
||||||
{
|
|
||||||
if (IsCurrentScreen)
|
|
||||||
Carousel.SelectBeatmap(b?.BeatmapInfo);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Edit(BeatmapInfo beatmap)
|
public void Edit(BeatmapInfo beatmap)
|
||||||
@ -261,6 +257,17 @@ namespace osu.Game.Screens.Select
|
|||||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||||
private BeatmapInfo beatmapNoDebounce;
|
private BeatmapInfo beatmapNoDebounce;
|
||||||
|
|
||||||
|
private void workingBeatmapChanged(WorkingBeatmap beatmap)
|
||||||
|
{
|
||||||
|
if (IsCurrentScreen && !Carousel.SelectBeatmap(beatmap?.BeatmapInfo, false))
|
||||||
|
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
|
||||||
|
if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value)
|
||||||
|
{
|
||||||
|
Ruleset.Value = beatmap.BeatmapInfo.Ruleset;
|
||||||
|
Carousel.SelectBeatmap(beatmap.BeatmapInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// selection has been changed as the result of interaction with the carousel.
|
/// selection has been changed as the result of interaction with the carousel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -450,16 +457,14 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void carouselBeatmapsLoaded()
|
private void carouselBeatmapsLoaded()
|
||||||
{
|
{
|
||||||
if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false)
|
if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Carousel.SelectedBeatmapSet == null && !Carousel.SelectNextRandom())
|
||||||
{
|
{
|
||||||
Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo);
|
// in the case random selection failed, we want to trigger selectionChanged
|
||||||
}
|
// to show the dummy beatmap (we have nothing else to display).
|
||||||
else if (Carousel.SelectedBeatmapSet == null)
|
carouselSelectionChanged(null);
|
||||||
{
|
|
||||||
if (!Carousel.SelectNextRandom())
|
|
||||||
// in the case random selection failed, we want to trigger selectionChanged
|
|
||||||
// to show the dummy beatmap (we have nothing else to display).
|
|
||||||
carouselSelectionChanged(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
private void load(BeatmapManager beatmaps)
|
private void load(BeatmapManager beatmaps)
|
||||||
{
|
{
|
||||||
var sets = beatmaps.GetAllUsableBeatmapSets();
|
var sets = beatmaps.GetAllUsableBeatmapSets();
|
||||||
var allBeatmaps = sets.SelectMany(s => s.Beatmaps).Where(b => ruleset.LegacyID < 0 || b.RulesetID == ruleset.LegacyID);
|
var allBeatmaps = sets.SelectMany(s => s.Beatmaps).Where(b => ruleset.LegacyID == null || b.RulesetID == ruleset.LegacyID);
|
||||||
|
|
||||||
allBeatmaps.ForEach(b => beatmapDisplays.Add(new BeatmapDisplay(b)));
|
allBeatmaps.ForEach(b => beatmapDisplays.Add(new BeatmapDisplay(b)));
|
||||||
}
|
}
|
||||||
|
@ -294,12 +294,16 @@
|
|||||||
<Compile Include="Online\API\DummyAPIAccess.cs" />
|
<Compile Include="Online\API\DummyAPIAccess.cs" />
|
||||||
<Compile Include="Online\API\IAPIProvider.cs" />
|
<Compile Include="Online\API\IAPIProvider.cs" />
|
||||||
<Compile Include="Online\API\APIDownloadRequest.cs" />
|
<Compile Include="Online\API\APIDownloadRequest.cs" />
|
||||||
|
<Compile Include="Online\API\Requests\GetUserRecentActivitiesRequest.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
||||||
<Compile Include="Migrations\20180125143340_Settings.cs" />
|
<Compile Include="Migrations\20180125143340_Settings.cs" />
|
||||||
<Compile Include="Migrations\20180125143340_Settings.Designer.cs">
|
<Compile Include="Migrations\20180125143340_Settings.Designer.cs">
|
||||||
<DependentUpon>20180125143340_Settings.cs</DependentUpon>
|
<DependentUpon>20180125143340_Settings.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Migrations\20180131154205_AddMuteBinding.cs" />
|
<Compile Include="Migrations\20180131154205_AddMuteBinding.cs" />
|
||||||
|
<Compile Include="Overlays\Profile\Sections\Recent\DrawableRecentActivity.cs" />
|
||||||
|
<Compile Include="Overlays\Profile\Sections\Recent\MedalIcon.cs" />
|
||||||
|
<Compile Include="Overlays\Profile\Sections\Recent\PaginatedRecentActivityContainer.cs" />
|
||||||
<Compile Include="Overlays\Profile\SupporterIcon.cs" />
|
<Compile Include="Overlays\Profile\SupporterIcon.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetFriendsRequest.cs" />
|
<Compile Include="Online\API\Requests\GetFriendsRequest.cs" />
|
||||||
<Compile Include="Overlays\Settings\DangerousSettingsButton.cs" />
|
<Compile Include="Overlays\Settings\DangerousSettingsButton.cs" />
|
||||||
@ -376,9 +380,11 @@
|
|||||||
<Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" />
|
<Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" />
|
||||||
<Compile Include="Rulesets\UI\JudgementContainer.cs" />
|
<Compile Include="Rulesets\UI\JudgementContainer.cs" />
|
||||||
<Compile Include="Rulesets\UI\ScalableContainer.cs" />
|
<Compile Include="Rulesets\UI\ScalableContainer.cs" />
|
||||||
|
<Compile Include="Screens\Play\ScreenWithBeatmapBackground.cs" />
|
||||||
<Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" />
|
<Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" />
|
||||||
<Compile Include="Rulesets\Objects\CatmullApproximator.cs" />
|
<Compile Include="Rulesets\Objects\CatmullApproximator.cs" />
|
||||||
<Compile Include="Rulesets\UI\HitObjectContainer.cs" />
|
<Compile Include="Rulesets\UI\HitObjectContainer.cs" />
|
||||||
|
<Compile Include="Rulesets\UI\ScalableContainer.cs" />
|
||||||
<Compile Include="Rulesets\UI\Scrolling\Visualisers\SequentialSpeedChangeVisualiser.cs" />
|
<Compile Include="Rulesets\UI\Scrolling\Visualisers\SequentialSpeedChangeVisualiser.cs" />
|
||||||
<Compile Include="Rulesets\UI\Scrolling\Visualisers\ISpeedChangeVisualiser.cs" />
|
<Compile Include="Rulesets\UI\Scrolling\Visualisers\ISpeedChangeVisualiser.cs" />
|
||||||
<Compile Include="Rulesets\UI\Scrolling\Visualisers\OverlappingSpeedChangeVisualiser.cs" />
|
<Compile Include="Rulesets\UI\Scrolling\Visualisers\OverlappingSpeedChangeVisualiser.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user