mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 19:02:58 +08:00
Merge branch 'master' into beatmap-carousel-v2-split-panels
This commit is contained in:
commit
092c7b4253
@ -120,6 +120,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
public double FramesPerSecond => throw new NotImplementedException();
|
||||
public FrameTimeInfo TimeInfo => throw new NotImplementedException();
|
||||
public double StartTime => throw new NotImplementedException();
|
||||
public double GameplayStartTime => throw new NotImplementedException();
|
||||
|
||||
public IAdjustableAudioComponent AdjustmentsFromMods => adjustableAudioComponent;
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
private readonly Bindable<bool> waitingOnFrames = new Bindable<bool>();
|
||||
|
||||
private readonly double gameplayStartTime;
|
||||
public double GameplayStartTime { get; }
|
||||
|
||||
private IGameplayClock? parentGameplayClock;
|
||||
|
||||
@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
framedClock = new FramedClock(manualClock = new ManualClock());
|
||||
|
||||
this.gameplayStartTime = gameplayStartTime;
|
||||
GameplayStartTime = gameplayStartTime;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
@ -257,8 +257,8 @@ namespace osu.Game.Rulesets.UI
|
||||
return;
|
||||
}
|
||||
|
||||
if (manualClock.CurrentTime < gameplayStartTime)
|
||||
manualClock.CurrentTime = proposedTime = Math.Min(gameplayStartTime, proposedTime);
|
||||
if (manualClock.CurrentTime < GameplayStartTime)
|
||||
manualClock.CurrentTime = proposedTime = Math.Min(GameplayStartTime, proposedTime);
|
||||
else if (Math.Abs(manualClock.CurrentTime - proposedTime) > sixty_frame_time * 1.2f)
|
||||
{
|
||||
proposedTime = proposedTime > manualClock.CurrentTime
|
||||
|
@ -12,15 +12,19 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
@ -31,11 +35,17 @@ using Container = osu.Framework.Graphics.Containers.Container;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
{
|
||||
public abstract partial class DrawableRoom : CompositeDrawable
|
||||
public abstract partial class DrawableRoom : CompositeDrawable, IHasContextMenu
|
||||
{
|
||||
protected const float CORNER_RADIUS = 10;
|
||||
private const float height = 100;
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OsuGame? game { get; set; }
|
||||
|
||||
public readonly Room Room;
|
||||
|
||||
protected readonly Bindable<PlaylistItem?> SelectedItem = new Bindable<PlaylistItem?>();
|
||||
@ -330,6 +340,26 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
}
|
||||
}
|
||||
|
||||
public virtual MenuItem[] ContextMenuItems
|
||||
{
|
||||
get
|
||||
{
|
||||
var items = new List<MenuItem>();
|
||||
|
||||
if (Room.RoomID.HasValue)
|
||||
{
|
||||
items.AddRange([
|
||||
new OsuMenuItem("View in browser", MenuItemType.Standard, () => game?.OpenUrlExternally(formatRoomUrl(Room.RoomID.Value))),
|
||||
new OsuMenuItem("Copy link", MenuItemType.Standard, () => game?.CopyUrlToClipboard(formatRoomUrl(Room.RoomID.Value)))
|
||||
]);
|
||||
}
|
||||
|
||||
return items.ToArray();
|
||||
|
||||
string formatRoomUrl(long id) => $@"{api.WebsiteRootUrl}/multiplayer/rooms/{id}";
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual UpdateableBeatmapBackgroundSprite CreateBackground() => new UpdateableBeatmapBackgroundSprite();
|
||||
|
||||
protected virtual IEnumerable<Drawable> CreateBottomDetails()
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
/// <summary>
|
||||
/// A <see cref="DrawableRoom"/> with lounge-specific interactions such as selection and hover sounds.
|
||||
/// </summary>
|
||||
public partial class DrawableLoungeRoom : DrawableRoom, IFilterable, IHasContextMenu, IHasPopover, IKeyBindingHandler<GlobalAction>
|
||||
public partial class DrawableLoungeRoom : DrawableRoom, IFilterable, IHasPopover, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private const float transition_duration = 60;
|
||||
private const float selection_border_width = 4;
|
||||
@ -155,17 +155,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
|
||||
public Popover GetPopover() => new PasswordEntryPopover(Room);
|
||||
|
||||
public MenuItem[] ContextMenuItems
|
||||
public override MenuItem[] ContextMenuItems
|
||||
{
|
||||
get
|
||||
{
|
||||
var items = new List<MenuItem>
|
||||
{
|
||||
new OsuMenuItem("Create copy", MenuItemType.Standard, () =>
|
||||
{
|
||||
lounge?.OpenCopy(Room);
|
||||
})
|
||||
};
|
||||
var items = new List<MenuItem>();
|
||||
|
||||
items.AddRange(base.ContextMenuItems);
|
||||
|
||||
items.Add(new OsuMenuItemSpacer());
|
||||
items.Add(new OsuMenuItem("Create copy", MenuItemType.Standard, () => lounge?.OpenCopy(Room)));
|
||||
|
||||
if (Room.Type == MatchType.Playlists && Room.Host?.Id == api.LocalUser.Value.Id && Room.StartDate?.AddMinutes(5) >= DateTimeOffset.Now && !Room.HasEnded)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
@ -156,10 +157,15 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new DrawableMatchRoom(Room, allowEdit)
|
||||
new OsuContextMenuContainer
|
||||
{
|
||||
OnEdit = () => settingsOverlay.Show(),
|
||||
SelectedItem = SelectedItem
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = new DrawableMatchRoom(Room, allowEdit)
|
||||
{
|
||||
OnEdit = () => settingsOverlay.Show(),
|
||||
SelectedItem = SelectedItem
|
||||
}
|
||||
}
|
||||
},
|
||||
null,
|
||||
|
@ -39,6 +39,8 @@ namespace osu.Game.Screens.Play
|
||||
/// </remarks>
|
||||
public double StartTime { get; protected set; }
|
||||
|
||||
public double GameplayStartTime { get; protected set; }
|
||||
|
||||
public IAdjustableAudioComponent AdjustmentsFromMods { get; } = new AudioAdjustments();
|
||||
|
||||
private readonly BindableBool isPaused = new BindableBool(true);
|
||||
|
@ -18,6 +18,11 @@ namespace osu.Game.Screens.Play
|
||||
/// </remarks>
|
||||
double StartTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The time from which actual gameplay should start. When intro time is skipped, this will be the seeked location.
|
||||
/// </summary>
|
||||
double GameplayStartTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// All adjustments applied to this clock which come from mods.
|
||||
/// </summary>
|
||||
|
@ -57,8 +57,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private Track track;
|
||||
|
||||
private readonly double skipTargetTime;
|
||||
|
||||
[Resolved]
|
||||
private MusicController musicController { get; set; } = null!;
|
||||
|
||||
@ -66,25 +64,25 @@ namespace osu.Game.Screens.Play
|
||||
/// Create a new master gameplay clock container.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The beatmap to be used for time and metadata references.</param>
|
||||
/// <param name="skipTargetTime">The latest time which should be used when introducing gameplay. Will be used when skipping forward.</param>
|
||||
public MasterGameplayClockContainer(WorkingBeatmap beatmap, double skipTargetTime)
|
||||
/// <param name="gameplayStartTime">The latest time which should be used when introducing gameplay. Will be used when skipping forward.</param>
|
||||
public MasterGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStartTime)
|
||||
: base(beatmap.Track, applyOffsets: true, requireDecoupling: true)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.skipTargetTime = skipTargetTime;
|
||||
|
||||
track = beatmap.Track;
|
||||
|
||||
StartTime = findEarliestStartTime();
|
||||
GameplayStartTime = gameplayStartTime;
|
||||
StartTime = findEarliestStartTime(gameplayStartTime, beatmap);
|
||||
}
|
||||
|
||||
private double findEarliestStartTime()
|
||||
private static double findEarliestStartTime(double gameplayStartTime, WorkingBeatmap beatmap)
|
||||
{
|
||||
// here we are trying to find the time to start playback from the "zero" point.
|
||||
// generally this is either zero, or some point earlier than zero in the case of storyboards, lead-ins etc.
|
||||
|
||||
// start with the originally provided latest time (if before zero).
|
||||
double time = Math.Min(0, skipTargetTime);
|
||||
double time = Math.Min(0, gameplayStartTime);
|
||||
|
||||
// if a storyboard is present, it may dictate the appropriate start time by having events in negative time space.
|
||||
// this is commonly used to display an intro before the audio track start.
|
||||
@ -119,10 +117,10 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
public void Skip()
|
||||
{
|
||||
if (GameplayClock.CurrentTime > skipTargetTime - MINIMUM_SKIP_TIME)
|
||||
if (GameplayClock.CurrentTime > GameplayStartTime - MINIMUM_SKIP_TIME)
|
||||
return;
|
||||
|
||||
double skipTarget = skipTargetTime - MINIMUM_SKIP_TIME;
|
||||
double skipTarget = GameplayStartTime - MINIMUM_SKIP_TIME;
|
||||
|
||||
if (StartTime < -10000 && GameplayClock.CurrentTime < 0 && skipTarget > 6000)
|
||||
// double skip exception for storyboards with very long intros
|
||||
@ -187,7 +185,8 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log($"Playback discrepancy detected ({playbackDiscrepancyCount} of allowed {allowed_playback_discrepancies}): {elapsedGameplayClockTime:N1} vs {elapsedValidationTime:N1}");
|
||||
Logger.Log(
|
||||
$"Playback discrepancy detected ({playbackDiscrepancyCount} of allowed {allowed_playback_discrepancies}): {elapsedGameplayClockTime:N1} vs {elapsedValidationTime:N1}");
|
||||
}
|
||||
|
||||
elapsedValidationTime = null;
|
||||
|
@ -298,7 +298,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
Debug.Assert(gameplayClock != null);
|
||||
|
||||
// TODO: the blocking conditions should probably display a message.
|
||||
if (!player.IsBreakTime.Value && gameplayClock.CurrentTime - gameplayClock.StartTime > 10000)
|
||||
if (!player.IsBreakTime.Value && gameplayClock.CurrentTime - gameplayClock.GameplayStartTime > 10000)
|
||||
return false;
|
||||
|
||||
if (gameplayClock.IsPaused.Value)
|
||||
|
Loading…
Reference in New Issue
Block a user