mirror of
https://github.com/ppy/osu
synced 2025-03-25 04:18:03 +00:00
Merge branch 'master' into moreOptionsFromSkin.ini
This commit is contained in:
commit
8cd058ed9a
osu.Game.Rulesets.Osu/Difficulty
osu.Game.Tests/Visual
osu.Game
@ -105,13 +105,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
|
|
||||||
double approachRateFactor = 1.0f;
|
double approachRateFactor = 1.0f;
|
||||||
if (Attributes.ApproachRate > 10.33f)
|
if (Attributes.ApproachRate > 10.33f)
|
||||||
approachRateFactor += 0.45f * (Attributes.ApproachRate - 10.33f);
|
approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f);
|
||||||
else if (Attributes.ApproachRate < 8.0f)
|
else if (Attributes.ApproachRate < 8.0f)
|
||||||
{
|
{
|
||||||
// HD is worth more with lower ar!
|
|
||||||
if (mods.Any(h => h is OsuModHidden))
|
|
||||||
approachRateFactor += 0.02f * (8.0f - Attributes.ApproachRate);
|
|
||||||
else
|
|
||||||
approachRateFactor += 0.01f * (8.0f - Attributes.ApproachRate);
|
approachRateFactor += 0.01f * (8.0f - Attributes.ApproachRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +115,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
|
|
||||||
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
// We want to give more reward for lower AR when it comes to aim and HD. This nerfs high AR and buffs lower AR.
|
||||||
if (mods.Any(h => h is OsuModHidden))
|
if (mods.Any(h => h is OsuModHidden))
|
||||||
aimValue *= 1.02 + (11.0f - Attributes.ApproachRate) / 50.0; // Gives a 1.04 bonus for AR10, a 1.06 bonus for AR9, a 1.02 bonus for AR11.
|
aimValue *= 1.0f + 0.04f * (12.0f - Attributes.ApproachRate);
|
||||||
|
|
||||||
if (mods.Any(h => h is OsuModFlashlight))
|
if (mods.Any(h => h is OsuModFlashlight))
|
||||||
{
|
{
|
||||||
@ -152,13 +148,19 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
if (beatmapMaxCombo > 0)
|
if (beatmapMaxCombo > 0)
|
||||||
speedValue *= Math.Min(Math.Pow(scoreMaxCombo, 0.8f) / Math.Pow(beatmapMaxCombo, 0.8f), 1.0f);
|
speedValue *= Math.Min(Math.Pow(scoreMaxCombo, 0.8f) / Math.Pow(beatmapMaxCombo, 0.8f), 1.0f);
|
||||||
|
|
||||||
|
double approachRateFactor = 1.0f;
|
||||||
|
if (Attributes.ApproachRate > 10.33f)
|
||||||
|
approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f);
|
||||||
|
|
||||||
|
speedValue *= approachRateFactor;
|
||||||
|
|
||||||
if (mods.Any(m => m is OsuModHidden))
|
if (mods.Any(m => m is OsuModHidden))
|
||||||
speedValue *= 1.18f;
|
speedValue *= 1.0f + 0.04f * (12.0f - Attributes.ApproachRate);
|
||||||
|
|
||||||
// Scale the speed value with accuracy _slightly_
|
// Scale the speed value with accuracy _slightly_
|
||||||
speedValue *= 0.5f + accuracy / 2.0f;
|
speedValue *= 0.02f + accuracy;
|
||||||
// It is important to also consider accuracy difficulty when doing that
|
// It is important to also consider accuracy difficulty when doing that
|
||||||
speedValue *= 0.98f + Math.Pow(Attributes.OverallDifficulty, 2) / 2500;
|
speedValue *= 0.96f + Math.Pow(Attributes.OverallDifficulty, 2) / 1600;
|
||||||
|
|
||||||
return speedValue;
|
return speedValue;
|
||||||
}
|
}
|
||||||
@ -186,7 +188,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
accuracyValue *= Math.Min(1.15f, Math.Pow(amountHitObjectsWithAccuracy / 1000.0f, 0.3f));
|
accuracyValue *= Math.Min(1.15f, Math.Pow(amountHitObjectsWithAccuracy / 1000.0f, 0.3f));
|
||||||
|
|
||||||
if (mods.Any(m => m is OsuModHidden))
|
if (mods.Any(m => m is OsuModHidden))
|
||||||
accuracyValue *= 1.02f;
|
accuracyValue *= 1.08f;
|
||||||
if (mods.Any(m => m is OsuModFlashlight))
|
if (mods.Any(m => m is OsuModFlashlight))
|
||||||
accuracyValue *= 1.02f;
|
accuracyValue *= 1.02f;
|
||||||
|
|
||||||
|
@ -17,12 +17,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public TestCaseMatchLeaderboard()
|
public TestCaseMatchLeaderboard()
|
||||||
{
|
{
|
||||||
Add(new MatchLeaderboard(new Room { RoomID = { Value = 3 } })
|
Add(new MatchLeaderboard
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Size = new Vector2(550f, 450f),
|
Size = new Vector2(550f, 450f),
|
||||||
Scope = MatchLeaderboardScope.Overall,
|
Scope = MatchLeaderboardScope.Overall,
|
||||||
|
Room = new Room { RoomID = { Value = 3 } }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +57,19 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
private class TestSongSelect : PlaySongSelect
|
private class TestSongSelect : PlaySongSelect
|
||||||
{
|
{
|
||||||
|
public Action StartRequested;
|
||||||
|
|
||||||
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
|
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
|
||||||
|
|
||||||
public WorkingBeatmap CurrentBeatmap => Beatmap.Value;
|
public WorkingBeatmap CurrentBeatmap => Beatmap.Value;
|
||||||
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
|
public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap;
|
||||||
public new BeatmapCarousel Carousel => base.Carousel;
|
public new BeatmapCarousel Carousel => base.Carousel;
|
||||||
|
|
||||||
|
protected override bool OnStart()
|
||||||
|
{
|
||||||
|
StartRequested?.Invoke();
|
||||||
|
return base.OnStart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestSongSelect songSelect;
|
private TestSongSelect songSelect;
|
||||||
@ -182,6 +190,27 @@ namespace osu.Game.Tests.Visual
|
|||||||
void onRulesetChange(RulesetInfo ruleset) => rulesetChangeIndex = actionIndex--;
|
void onRulesetChange(RulesetInfo ruleset) => rulesetChangeIndex = actionIndex--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestStartAfterUnMatchingFilterDoesNotStart()
|
||||||
|
{
|
||||||
|
addManyTestMaps();
|
||||||
|
AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "has selection");
|
||||||
|
|
||||||
|
bool startRequested = false;
|
||||||
|
|
||||||
|
AddStep("set filter and finalize", () =>
|
||||||
|
{
|
||||||
|
songSelect.StartRequested = () => startRequested = true;
|
||||||
|
|
||||||
|
songSelect.Carousel.Filter(new FilterCriteria { SearchText = "somestringthatshouldn'tbematchable" });
|
||||||
|
songSelect.FinaliseSelection();
|
||||||
|
|
||||||
|
songSelect.StartRequested = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("start not requested", () => !startRequested);
|
||||||
|
}
|
||||||
|
|
||||||
private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())));
|
private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray())));
|
||||||
|
|
||||||
private static int importId;
|
private static int importId;
|
||||||
|
@ -79,6 +79,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
AddInternal(new DrawableLinkCompiler(drawables.OfType<SpriteText>().ToList())
|
AddInternal(new DrawableLinkCompiler(drawables.OfType<SpriteText>().ToList())
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
TooltipText = tooltipText ?? (url != text ? url : string.Empty),
|
TooltipText = tooltipText ?? (url != text ? url : string.Empty),
|
||||||
Action = action ?? (() =>
|
Action = action ?? (() =>
|
||||||
{
|
{
|
||||||
@ -122,5 +123,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We want the compilers to always be visible no matter where they are, so RelativeSizeAxes is used.
|
||||||
|
// However due to https://github.com/ppy/osu-framework/issues/2073, it's possible for the compilers to be relative size in the flow's auto-size axes - an unsupported operation.
|
||||||
|
// Since the compilers don't display any content and don't affect the layout, it's simplest to exclude them from the flow.
|
||||||
|
public override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Where(c => !(c is DrawableLinkCompiler));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// 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 System.Linq;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -13,8 +13,9 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Screens.Multi.Components;
|
using osu.Game.Screens.Multi.Components;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -37,11 +38,10 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
private Box statusStrip;
|
private Box statusStrip;
|
||||||
private UpdateableBeatmapBackgroundSprite background;
|
private UpdateableBeatmapBackgroundSprite background;
|
||||||
private ParticipantCountDisplay participantCount;
|
private ParticipantCountDisplay participantCount;
|
||||||
private FillFlowContainer topFlow, participantsFlow;
|
|
||||||
private OsuSpriteText name, status;
|
private OsuSpriteText name, status;
|
||||||
private BeatmapTypeInfo beatmapTypeInfo;
|
private BeatmapTypeInfo beatmapTypeInfo;
|
||||||
private ScrollContainer participantsScroll;
|
|
||||||
private ParticipantInfo participantInfo;
|
private ParticipantInfo participantInfo;
|
||||||
|
private MatchParticipants participants;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
@ -58,141 +58,141 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.FromHex(@"343138"),
|
Colour = OsuColour.FromHex(@"343138"),
|
||||||
},
|
},
|
||||||
topFlow = new FillFlowContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.Both,
|
||||||
AutoSizeAxes = Axes.Y,
|
RowDimensions = new[]
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Container
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
new Dimension(GridSizeMode.Distributed),
|
||||||
|
},
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
new FillFlowContainer
|
||||||
Height = 200,
|
|
||||||
Masking = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
background = new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both },
|
RelativeSizeAxes = Axes.X,
|
||||||
new Box
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Container
|
||||||
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding(20),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
participantCount = new ParticipantCountDisplay
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 200,
|
||||||
|
Masking = true,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
background = new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both },
|
||||||
Origin = Anchor.TopRight,
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding(20),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
participantCount = new ParticipantCountDisplay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
},
|
||||||
|
name = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
TextSize = 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
name = new OsuSpriteText
|
},
|
||||||
|
statusStrip = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 5,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
new Box
|
||||||
Origin = Anchor.BottomLeft,
|
{
|
||||||
TextSize = 30,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.FromHex(@"28242d"),
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
LayoutDuration = transition_duration,
|
||||||
|
Padding = contentPadding,
|
||||||
|
Spacing = new Vector2(0f, 5f),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
status = new OsuSpriteText
|
||||||
|
{
|
||||||
|
TextSize = 14,
|
||||||
|
Font = @"Exo2.0-Bold",
|
||||||
|
},
|
||||||
|
beatmapTypeInfo = new BeatmapTypeInfo(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = contentPadding,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
participantInfo = new ParticipantInfo(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
statusStrip = new Box
|
new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
participants = new MatchParticipants
|
||||||
Height = 5,
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Box
|
RelativeSizeAxes = Axes.Both,
|
||||||
{
|
}
|
||||||
RelativeSizeAxes = Axes.Both,
|
}
|
||||||
Colour = OsuColour.FromHex(@"28242d"),
|
}
|
||||||
},
|
}
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
LayoutDuration = transition_duration,
|
|
||||||
Padding = contentPadding,
|
|
||||||
Spacing = new Vector2(0f, 5f),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
status = new OsuSpriteText
|
|
||||||
{
|
|
||||||
TextSize = 14,
|
|
||||||
Font = @"Exo2.0-Bold",
|
|
||||||
},
|
|
||||||
beatmapTypeInfo = new BeatmapTypeInfo(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Padding = contentPadding,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
participantInfo = new ParticipantInfo(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
participantsScroll = new OsuScrollContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Padding = new MarginPadding { Top = contentPadding.Top, Left = 38, Right = 37 },
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
participantsFlow = new FillFlowContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
LayoutDuration = transition_duration,
|
|
||||||
Spacing = new Vector2(5f),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
participantInfo.Host.BindTo(bindings.Host);
|
participantInfo.Host.BindTo(bindings.Host);
|
||||||
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
|
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
|
||||||
participantInfo.Participants.BindTo(bindings.Participants);
|
participantInfo.Participants.BindTo(bindings.Participants);
|
||||||
|
|
||||||
participantCount.Participants.BindTo(bindings.Participants);
|
participantCount.Participants.BindTo(bindings.Participants);
|
||||||
participantCount.ParticipantCount.BindTo(bindings.ParticipantCount);
|
participantCount.ParticipantCount.BindTo(bindings.ParticipantCount);
|
||||||
participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
|
participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
|
||||||
|
|
||||||
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||||
beatmapTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
|
beatmapTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
|
||||||
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
||||||
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||||
|
|
||||||
bindings.Status.BindValueChanged(displayStatus);
|
bindings.Status.BindValueChanged(displayStatus);
|
||||||
bindings.Participants.BindValueChanged(p => participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u)));
|
|
||||||
bindings.Name.BindValueChanged(n => name.Text = n);
|
bindings.Name.BindValueChanged(n => name.Text = n);
|
||||||
|
|
||||||
Room.BindValueChanged(updateRoom, true);
|
Room.BindValueChanged(updateRoom, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRoom(Room room)
|
private void updateRoom(Room room)
|
||||||
{
|
{
|
||||||
bindings.Room = room;
|
bindings.Room = room;
|
||||||
|
participants.Room = room;
|
||||||
|
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
participantsFlow.FadeIn(transition_duration);
|
|
||||||
participantCount.FadeIn(transition_duration);
|
participantCount.FadeIn(transition_duration);
|
||||||
beatmapTypeInfo.FadeIn(transition_duration);
|
beatmapTypeInfo.FadeIn(transition_duration);
|
||||||
name.FadeIn(transition_duration);
|
name.FadeIn(transition_duration);
|
||||||
@ -200,7 +200,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
participantsFlow.FadeOut(transition_duration);
|
|
||||||
participantCount.FadeOut(transition_duration);
|
participantCount.FadeOut(transition_duration);
|
||||||
beatmapTypeInfo.FadeOut(transition_duration);
|
beatmapTypeInfo.FadeOut(transition_duration);
|
||||||
name.FadeOut(transition_duration);
|
name.FadeOut(transition_duration);
|
||||||
@ -210,13 +209,6 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
|
||||||
{
|
|
||||||
base.UpdateAfterChildren();
|
|
||||||
|
|
||||||
participantsScroll.Height = DrawHeight - topFlow.DrawHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayStatus(RoomStatus s)
|
private void displayStatus(RoomStatus s)
|
||||||
{
|
{
|
||||||
status.Text = s.Message;
|
status.Text = s.Message;
|
||||||
@ -226,39 +218,113 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
status.FadeColour(c, transition_duration);
|
status.FadeColour(c, transition_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UserTile : Container, IHasTooltip
|
|
||||||
{
|
|
||||||
private readonly User user;
|
|
||||||
|
|
||||||
public string TooltipText => user.Username;
|
|
||||||
|
|
||||||
public UserTile(User user)
|
|
||||||
{
|
|
||||||
this.user = user;
|
|
||||||
Size = new Vector2(70f);
|
|
||||||
CornerRadius = 5f;
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = OsuColour.FromHex(@"27252d"),
|
|
||||||
},
|
|
||||||
new UpdateableAvatar
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
User = user,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RoomStatusNoneSelected : RoomStatus
|
private class RoomStatusNoneSelected : RoomStatus
|
||||||
{
|
{
|
||||||
public override string Message => @"No Room Selected";
|
public override string Message => @"No Room Selected";
|
||||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray8;
|
public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MatchParticipants : CompositeDrawable
|
||||||
|
{
|
||||||
|
private Room room;
|
||||||
|
private readonly FillFlowContainer fill;
|
||||||
|
|
||||||
|
public Room Room
|
||||||
|
{
|
||||||
|
get { return room; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (room == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
room = value;
|
||||||
|
updateParticipants();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MatchParticipants()
|
||||||
|
{
|
||||||
|
Padding = new MarginPadding { Horizontal = 10 };
|
||||||
|
|
||||||
|
InternalChild = new ScrollContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = fill = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Full,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private APIAccess api { get; set; }
|
||||||
|
|
||||||
|
private GetRoomScoresRequest request;
|
||||||
|
|
||||||
|
private void updateParticipants()
|
||||||
|
{
|
||||||
|
var roomId = room.RoomID.Value ?? 0;
|
||||||
|
|
||||||
|
request?.Cancel();
|
||||||
|
|
||||||
|
// nice little progressive fade
|
||||||
|
int time = 500;
|
||||||
|
foreach (var c in fill.Children)
|
||||||
|
{
|
||||||
|
c.Delay(500 - time).FadeOut(time, Easing.Out);
|
||||||
|
time = Math.Max(20, time - 20);
|
||||||
|
c.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roomId == 0) return;
|
||||||
|
|
||||||
|
request = new GetRoomScoresRequest(roomId);
|
||||||
|
request.Success += scores =>
|
||||||
|
{
|
||||||
|
if (roomId != room.RoomID.Value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fill.Clear();
|
||||||
|
foreach (var s in scores)
|
||||||
|
fill.Add(new UserTile(s.User));
|
||||||
|
|
||||||
|
fill.FadeInFromZero(1000, Easing.OutQuint);
|
||||||
|
};
|
||||||
|
|
||||||
|
api.Queue(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class UserTile : CompositeDrawable, IHasTooltip
|
||||||
|
{
|
||||||
|
private readonly User user;
|
||||||
|
|
||||||
|
public string TooltipText => user.Username;
|
||||||
|
|
||||||
|
public UserTile(User user)
|
||||||
|
{
|
||||||
|
this.user = user;
|
||||||
|
Size = new Vector2(70f);
|
||||||
|
CornerRadius = 5f;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = OsuColour.FromHex(@"27252d"),
|
||||||
|
},
|
||||||
|
new UpdateableAvatar
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
User = user,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,18 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
{
|
{
|
||||||
public Action<IEnumerable<APIRoomScoreInfo>> ScoresLoaded;
|
public Action<IEnumerable<APIRoomScoreInfo>> ScoresLoaded;
|
||||||
|
|
||||||
private readonly Room room;
|
public Room Room
|
||||||
|
|
||||||
public MatchLeaderboard(Room room)
|
|
||||||
{
|
{
|
||||||
this.room = room;
|
get => bindings.Room;
|
||||||
|
set => bindings.Room = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly RoomBindings bindings = new RoomBindings();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
room.RoomID.BindValueChanged(id =>
|
bindings.RoomID.BindValueChanged(id =>
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
return;
|
return;
|
||||||
@ -38,10 +39,10 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
|
|
||||||
protected override APIRequest FetchScores(Action<IEnumerable<APIRoomScoreInfo>> scoresCallback)
|
protected override APIRequest FetchScores(Action<IEnumerable<APIRoomScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
if (room.RoomID == null)
|
if (bindings.RoomID.Value == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var req = new GetRoomScoresRequest(room.RoomID.Value ?? 0);
|
var req = new GetRoomScoresRequest(bindings.RoomID.Value ?? 0);
|
||||||
|
|
||||||
req.Success += r =>
|
req.Success += r =>
|
||||||
{
|
{
|
||||||
|
@ -71,10 +71,11 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
leaderboard = new MatchLeaderboard(room)
|
leaderboard = new MatchLeaderboard
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding(10),
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Room = room
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
@ -103,8 +103,8 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
|
|||||||
public class ResultsMatchLeaderboard : MatchLeaderboard
|
public class ResultsMatchLeaderboard : MatchLeaderboard
|
||||||
{
|
{
|
||||||
public ResultsMatchLeaderboard(Room room)
|
public ResultsMatchLeaderboard(Room room)
|
||||||
: base(room)
|
|
||||||
{
|
{
|
||||||
|
Room = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool FadeTop => true;
|
protected override bool FadeTop => true;
|
||||||
|
@ -39,6 +39,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
|
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
|
RoomID.UnbindFrom(room.RoomID);
|
||||||
Name.UnbindFrom(room.Name);
|
Name.UnbindFrom(room.Name);
|
||||||
Host.UnbindFrom(room.Host);
|
Host.UnbindFrom(room.Host);
|
||||||
Status.UnbindFrom(room.Status);
|
Status.UnbindFrom(room.Status);
|
||||||
@ -56,6 +57,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
|
|
||||||
if (room != null)
|
if (room != null)
|
||||||
{
|
{
|
||||||
|
RoomID.BindTo(room.RoomID);
|
||||||
Name.BindTo(room.Name);
|
Name.BindTo(room.Name);
|
||||||
Host.BindTo(room.Host);
|
Host.BindTo(room.Host);
|
||||||
Status.BindTo(room.Status);
|
Status.BindTo(room.Status);
|
||||||
@ -82,6 +84,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
currentRuleset.Value = playlistItem?.Ruleset;
|
currentRuleset.Value = playlistItem?.Ruleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public readonly Bindable<int?> RoomID = new Bindable<int?>();
|
||||||
public readonly Bindable<string> Name = new Bindable<string>();
|
public readonly Bindable<string> Name = new Bindable<string>();
|
||||||
public readonly Bindable<User> Host = new Bindable<User>();
|
public readonly Bindable<User> Host = new Bindable<User>();
|
||||||
public readonly Bindable<RoomStatus> Status = new Bindable<RoomStatus>();
|
public readonly Bindable<RoomStatus> Status = new Bindable<RoomStatus>();
|
||||||
|
@ -297,14 +297,14 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
|
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
|
||||||
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
|
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
|
||||||
{
|
{
|
||||||
// avoid attempting to continue before a selection has been obtained.
|
|
||||||
// this could happen via a user interaction while the carousel is still in a loading state.
|
|
||||||
if (Carousel.SelectedBeatmap == null) return;
|
|
||||||
|
|
||||||
// if we have a pending filter operation, we want to run it now.
|
// if we have a pending filter operation, we want to run it now.
|
||||||
// it could change selection (ie. if the ruleset has been changed).
|
// it could change selection (ie. if the ruleset has been changed).
|
||||||
Carousel.FlushPendingFilterOperations();
|
Carousel.FlushPendingFilterOperations();
|
||||||
|
|
||||||
|
// avoid attempting to continue before a selection has been obtained.
|
||||||
|
// this could happen via a user interaction while the carousel is still in a loading state.
|
||||||
|
if (Carousel.SelectedBeatmap == null) return;
|
||||||
|
|
||||||
if (beatmap != null)
|
if (beatmap != null)
|
||||||
Carousel.SelectBeatmap(beatmap);
|
Carousel.SelectBeatmap(beatmap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user