mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge branch 'master' into contributing-guidelines
This commit is contained in:
commit
8529486a5c
@ -237,6 +237,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
{
|
{
|
||||||
Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y + size.Y / 2),
|
Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y + size.Y / 2),
|
||||||
TexturePosition = textureRect.BottomLeft,
|
TexturePosition = textureRect.BottomLeft,
|
||||||
|
TextureRect = new Vector4(0, 0, 1, 1),
|
||||||
Colour = DrawColourInfo.Colour.BottomLeft.Linear,
|
Colour = DrawColourInfo.Colour.BottomLeft.Linear,
|
||||||
Time = part.Time
|
Time = part.Time
|
||||||
});
|
});
|
||||||
@ -245,6 +246,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
{
|
{
|
||||||
Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y + size.Y / 2),
|
Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y + size.Y / 2),
|
||||||
TexturePosition = textureRect.BottomRight,
|
TexturePosition = textureRect.BottomRight,
|
||||||
|
TextureRect = new Vector4(0, 0, 1, 1),
|
||||||
Colour = DrawColourInfo.Colour.BottomRight.Linear,
|
Colour = DrawColourInfo.Colour.BottomRight.Linear,
|
||||||
Time = part.Time
|
Time = part.Time
|
||||||
});
|
});
|
||||||
@ -253,6 +255,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
{
|
{
|
||||||
Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y - size.Y / 2),
|
Position = new Vector2(part.Position.X + size.X / 2, part.Position.Y - size.Y / 2),
|
||||||
TexturePosition = textureRect.TopRight,
|
TexturePosition = textureRect.TopRight,
|
||||||
|
TextureRect = new Vector4(0, 0, 1, 1),
|
||||||
Colour = DrawColourInfo.Colour.TopRight.Linear,
|
Colour = DrawColourInfo.Colour.TopRight.Linear,
|
||||||
Time = part.Time
|
Time = part.Time
|
||||||
});
|
});
|
||||||
@ -261,6 +264,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
{
|
{
|
||||||
Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y - size.Y / 2),
|
Position = new Vector2(part.Position.X - size.X / 2, part.Position.Y - size.Y / 2),
|
||||||
TexturePosition = textureRect.TopLeft,
|
TexturePosition = textureRect.TopLeft,
|
||||||
|
TextureRect = new Vector4(0, 0, 1, 1),
|
||||||
Colour = DrawColourInfo.Colour.TopLeft.Linear,
|
Colour = DrawColourInfo.Colour.TopLeft.Linear,
|
||||||
Time = part.Time
|
Time = part.Time
|
||||||
});
|
});
|
||||||
@ -290,6 +294,9 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
[VertexMember(2, VertexAttribPointerType.Float)]
|
[VertexMember(2, VertexAttribPointerType.Float)]
|
||||||
public Vector2 TexturePosition;
|
public Vector2 TexturePosition;
|
||||||
|
|
||||||
|
[VertexMember(4, VertexAttribPointerType.Float)]
|
||||||
|
public Vector4 TextureRect;
|
||||||
|
|
||||||
[VertexMember(1, VertexAttribPointerType.Float)]
|
[VertexMember(1, VertexAttribPointerType.Float)]
|
||||||
public float Time;
|
public float Time;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
|
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
|
||||||
|
|
||||||
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap));
|
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod()?.CreateReplayScore(beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AddCheckSteps()
|
protected override void AddCheckSteps()
|
||||||
|
@ -246,7 +246,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
((BindableList<Channel>)ChannelManager.AvailableChannels).AddRange(channels);
|
((BindableList<Channel>)ChannelManager.AvailableChannels).AddRange(channels);
|
||||||
|
|
||||||
Child = ChatOverlay = new TestChatOverlay { RelativeSizeAxes = Axes.Both, };
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
ChannelManager,
|
||||||
|
ChatOverlay = new TestChatOverlay { RelativeSizeAxes = Axes.Both, },
|
||||||
|
};
|
||||||
|
|
||||||
ChatOverlay.Show();
|
ChatOverlay.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,14 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestSoloResults createResultsScreen() => new TestSoloResults(new TestScoreInfo(new OsuRuleset().RulesetInfo));
|
private TestResultsScreen createResultsScreen() => new TestResultsScreen(new TestScoreInfo(new OsuRuleset().RulesetInfo));
|
||||||
|
|
||||||
|
private UnrankedSoloResultsScreen createUnrankedSoloResultsScreen() => new UnrankedSoloResultsScreen(new TestScoreInfo(new OsuRuleset().RulesetInfo));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ResultsWithoutPlayer()
|
public void ResultsWithoutPlayer()
|
||||||
{
|
{
|
||||||
TestSoloResults screen = null;
|
TestResultsScreen screen = null;
|
||||||
OsuScreenStack stack;
|
OsuScreenStack stack;
|
||||||
|
|
||||||
AddStep("load results", () =>
|
AddStep("load results", () =>
|
||||||
@ -60,13 +62,23 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
[Test]
|
[Test]
|
||||||
public void ResultsWithPlayer()
|
public void ResultsWithPlayer()
|
||||||
{
|
{
|
||||||
TestSoloResults screen = null;
|
TestResultsScreen screen = null;
|
||||||
|
|
||||||
AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen()));
|
AddStep("load results", () => Child = new TestResultsContainer(screen = createResultsScreen()));
|
||||||
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
||||||
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
|
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ResultsForUnranked()
|
||||||
|
{
|
||||||
|
UnrankedSoloResultsScreen screen = null;
|
||||||
|
|
||||||
|
AddStep("load results", () => Child = new TestResultsContainer(screen = createUnrankedSoloResultsScreen()));
|
||||||
|
AddUntilStep("wait for loaded", () => screen.IsLoaded);
|
||||||
|
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
|
||||||
|
}
|
||||||
|
|
||||||
private class TestResultsContainer : Container
|
private class TestResultsContainer : Container
|
||||||
{
|
{
|
||||||
[Cached(typeof(Player))]
|
[Cached(typeof(Player))]
|
||||||
@ -86,11 +98,11 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestSoloResults : ResultsScreen
|
private class TestResultsScreen : ResultsScreen
|
||||||
{
|
{
|
||||||
public HotkeyRetryOverlay RetryOverlay;
|
public HotkeyRetryOverlay RetryOverlay;
|
||||||
|
|
||||||
public TestSoloResults(ScoreInfo score)
|
public TestResultsScreen(ScoreInfo score)
|
||||||
: base(score)
|
: base(score)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -102,5 +114,24 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
RetryOverlay = InternalChildren.OfType<HotkeyRetryOverlay>().SingleOrDefault();
|
RetryOverlay = InternalChildren.OfType<HotkeyRetryOverlay>().SingleOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class UnrankedSoloResultsScreen : SoloResultsScreen
|
||||||
|
{
|
||||||
|
public HotkeyRetryOverlay RetryOverlay;
|
||||||
|
|
||||||
|
public UnrankedSoloResultsScreen(ScoreInfo score)
|
||||||
|
: base(score)
|
||||||
|
{
|
||||||
|
Score.Beatmap.OnlineBeatmapID = 0;
|
||||||
|
Score.Beatmap.Status = BeatmapSetOnlineStatus.Pending;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
RetryOverlay = InternalChildren.OfType<HotkeyRetryOverlay>().SingleOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,12 +93,6 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel))
|
if (!(e.NewValue is ChannelSelectorTabItem.ChannelSelectorTabChannel))
|
||||||
JoinChannel(e.NewValue);
|
JoinChannel(e.NewValue);
|
||||||
|
|
||||||
if (e.NewValue?.MessagesLoaded == false)
|
|
||||||
{
|
|
||||||
// let's fetch a small number of messages to bring us up-to-date with the backlog.
|
|
||||||
fetchInitalMessages(e.NewValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -240,7 +234,6 @@ namespace osu.Game.Online.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
JoinChannel(channel);
|
JoinChannel(channel);
|
||||||
CurrentChannel.Value = channel;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "help":
|
case "help":
|
||||||
@ -275,7 +268,7 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
// join any channels classified as "defaults"
|
// join any channels classified as "defaults"
|
||||||
if (joinDefaults && defaultChannels.Any(c => c.Equals(channel.Name, StringComparison.OrdinalIgnoreCase)))
|
if (joinDefaults && defaultChannels.Any(c => c.Equals(channel.Name, StringComparison.OrdinalIgnoreCase)))
|
||||||
JoinChannel(ch);
|
joinChannel(ch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
req.Failure += error =>
|
req.Failure += error =>
|
||||||
@ -296,7 +289,7 @@ namespace osu.Game.Online.Chat
|
|||||||
/// <param name="channel">The channel </param>
|
/// <param name="channel">The channel </param>
|
||||||
private void fetchInitalMessages(Channel channel)
|
private void fetchInitalMessages(Channel channel)
|
||||||
{
|
{
|
||||||
if (channel.Id <= 0) return;
|
if (channel.Id <= 0 || channel.MessagesLoaded) return;
|
||||||
|
|
||||||
var fetchInitialMsgReq = new GetMessagesRequest(channel);
|
var fetchInitialMsgReq = new GetMessagesRequest(channel);
|
||||||
fetchInitialMsgReq.Success += messages =>
|
fetchInitialMsgReq.Success += messages =>
|
||||||
@ -351,9 +344,10 @@ namespace osu.Game.Online.Chat
|
|||||||
/// Joins a channel if it has not already been joined.
|
/// Joins a channel if it has not already been joined.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="channel">The channel to join.</param>
|
/// <param name="channel">The channel to join.</param>
|
||||||
/// <param name="alreadyJoined">Whether the channel has already been joined server-side. Will skip a join request.</param>
|
|
||||||
/// <returns>The joined channel. Note that this may not match the parameter channel as it is a backed object.</returns>
|
/// <returns>The joined channel. Note that this may not match the parameter channel as it is a backed object.</returns>
|
||||||
public Channel JoinChannel(Channel channel, bool alreadyJoined = false)
|
public Channel JoinChannel(Channel channel) => joinChannel(channel, true);
|
||||||
|
|
||||||
|
private Channel joinChannel(Channel channel, bool fetchInitialMessages = false)
|
||||||
{
|
{
|
||||||
if (channel == null) return null;
|
if (channel == null) return null;
|
||||||
|
|
||||||
@ -361,21 +355,36 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
// ensure we are joined to the channel
|
// ensure we are joined to the channel
|
||||||
if (!channel.Joined.Value)
|
if (!channel.Joined.Value)
|
||||||
{
|
|
||||||
if (alreadyJoined)
|
|
||||||
channel.Joined.Value = true;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
switch (channel.Type)
|
switch (channel.Type)
|
||||||
{
|
{
|
||||||
case ChannelType.Public:
|
case ChannelType.Multiplayer:
|
||||||
|
// join is implicit. happens when you join a multiplayer game.
|
||||||
|
// this will probably change in the future.
|
||||||
|
channel.Joined.Value = true;
|
||||||
|
joinChannel(channel, fetchInitialMessages);
|
||||||
|
return channel;
|
||||||
|
|
||||||
|
case ChannelType.Private:
|
||||||
|
// can't do this yet.
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
var req = new JoinChannelRequest(channel, api.LocalUser.Value);
|
var req = new JoinChannelRequest(channel, api.LocalUser.Value);
|
||||||
req.Success += () => JoinChannel(channel, true);
|
req.Success += () =>
|
||||||
|
{
|
||||||
|
channel.Joined.Value = true;
|
||||||
|
joinChannel(channel, fetchInitialMessages);
|
||||||
|
};
|
||||||
req.Failure += ex => LeaveChannel(channel);
|
req.Failure += ex => LeaveChannel(channel);
|
||||||
api.Queue(req);
|
api.Queue(req);
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (fetchInitialMessages)
|
||||||
|
fetchInitalMessages(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentChannel.Value == null)
|
if (CurrentChannel.Value == null)
|
||||||
@ -420,7 +429,8 @@ namespace osu.Game.Online.Chat
|
|||||||
foreach (var channel in updates.Presence)
|
foreach (var channel in updates.Presence)
|
||||||
{
|
{
|
||||||
// we received this from the server so should mark the channel already joined.
|
// we received this from the server so should mark the channel already joined.
|
||||||
JoinChannel(channel, true);
|
channel.Joined.Value = true;
|
||||||
|
joinChannel(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo: handle left channels
|
//todo: handle left channels
|
||||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
public static class SliderEventGenerator
|
public static class SliderEventGenerator
|
||||||
{
|
{
|
||||||
[Obsolete("Use the overload with cancellation support instead.")] // can be removed 20201115
|
[Obsolete("Use the overload with cancellation support instead.")] // can be removed 20201115
|
||||||
|
// ReSharper disable once RedundantOverload.Global
|
||||||
public static IEnumerable<SliderEventDescriptor> Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount,
|
public static IEnumerable<SliderEventDescriptor> Generate(double startTime, double spanDuration, double velocity, double tickDistance, double totalDistance, int spanCount,
|
||||||
double? legacyLastTickOffset)
|
double? legacyLastTickOffset)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ using osu.Game.Rulesets.Scoring;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets
|
namespace osu.Game.Rulesets
|
||||||
{
|
{
|
||||||
@ -100,7 +101,8 @@ namespace osu.Game.Rulesets
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModAutoplay GetAutoplayMod() => GetAllMods().OfType<ModAutoplay>().First();
|
[CanBeNull]
|
||||||
|
public ModAutoplay GetAutoplayMod() => GetAllMods().OfType<ModAutoplay>().FirstOrDefault();
|
||||||
|
|
||||||
public virtual ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => null;
|
public virtual ISkin CreateLegacySkinProvider(ISkinSource source, IBeatmap beatmap) => null;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -24,6 +25,9 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
|
if (Score.Beatmap.OnlineBeatmapID == null || Score.Beatmap.Status <= BeatmapSetOnlineStatus.Pending)
|
||||||
|
return null;
|
||||||
|
|
||||||
var req = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
|
var req = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
|
||||||
req.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets)));
|
req.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets)));
|
||||||
return req;
|
return req;
|
||||||
|
@ -7,6 +7,8 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
@ -20,6 +22,9 @@ namespace osu.Game.Screens.Select
|
|||||||
private bool removeAutoModOnResume;
|
private bool removeAutoModOnResume;
|
||||||
private OsuScreen player;
|
private OsuScreen player;
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private NotificationOverlay notifications { get; set; }
|
||||||
|
|
||||||
public override bool AllowExternalScreenChange => true;
|
public override bool AllowExternalScreenChange => true;
|
||||||
|
|
||||||
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
|
protected override UserActivity InitialActivity => new UserActivity.ChoosingBeatmap();
|
||||||
@ -49,8 +54,11 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
if (removeAutoModOnResume)
|
if (removeAutoModOnResume)
|
||||||
{
|
{
|
||||||
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod()?.GetType();
|
||||||
|
|
||||||
|
if (autoType != null)
|
||||||
ModSelect.DeselectTypes(new[] { autoType }, true);
|
ModSelect.DeselectTypes(new[] { autoType }, true);
|
||||||
|
|
||||||
removeAutoModOnResume = false;
|
removeAutoModOnResume = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,10 +86,19 @@ namespace osu.Game.Screens.Select
|
|||||||
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
||||||
{
|
{
|
||||||
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||||
var autoType = auto.GetType();
|
var autoType = auto?.GetType();
|
||||||
|
|
||||||
var mods = Mods.Value;
|
var mods = Mods.Value;
|
||||||
|
|
||||||
|
if (autoType == null)
|
||||||
|
{
|
||||||
|
notifications?.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = "The current ruleset doesn't have an autoplay mod avalaible!"
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (mods.All(m => m.GetType() != autoType))
|
if (mods.All(m => m.GetType() != autoType))
|
||||||
{
|
{
|
||||||
Mods.Value = mods.Append(auto).ToArray();
|
Mods.Value = mods.Append(auto).ToArray();
|
||||||
|
Loading…
Reference in New Issue
Block a user