mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:23:20 +08:00
Compare commits
24 Commits
7b0cd0069f
...
57ea625af6
Author | SHA1 | Date | |
---|---|---|---|
|
57ea625af6 | ||
|
be05f2a1c2 | ||
|
6ff1dec7b2 | ||
|
ce4aac4184 | ||
|
e920cfa187 | ||
|
164b809c89 | ||
|
f4e155bfa6 | ||
|
3cfa455369 | ||
|
25bb6cbf9b | ||
|
ad21b7f341 | ||
|
ea4cbb5c36 | ||
|
93e7afd5f3 | ||
|
d4f29487d3 | ||
|
dea5d8329d | ||
|
38e76d41b5 | ||
|
3e8b26c483 | ||
|
a7b4f975ca | ||
|
9bea112370 | ||
|
45ed2fdec2 | ||
|
72210bf9fe | ||
|
db08176049 | ||
|
617f8cce4a | ||
|
28b911f6ac | ||
|
426ca00516 |
@ -0,0 +1,133 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Taiko.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
||||||
|
{
|
||||||
|
public partial class TestSceneTaikoModQuarterize : TaikoModTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestOneThirdConversion()
|
||||||
|
{
|
||||||
|
CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new TaikoModQuarterize
|
||||||
|
{
|
||||||
|
OneThirdConversion = { Value = true },
|
||||||
|
},
|
||||||
|
Autoplay = false,
|
||||||
|
CreateBeatmap = () => new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject>
|
||||||
|
{
|
||||||
|
new Hit { StartTime = 1000, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1500, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 2000, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 2333, Type = HitType.Rim }, // mod removes this
|
||||||
|
new Hit { StartTime = 2666, Type = HitType.Centre }, // mod moves this to 2500
|
||||||
|
new Hit { StartTime = 3000, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 3500, Type = HitType.Centre },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReplayFrames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1200),
|
||||||
|
new TaikoReplayFrame(1500, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1700),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2200),
|
||||||
|
new TaikoReplayFrame(2500, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2700),
|
||||||
|
new TaikoReplayFrame(3000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(3200),
|
||||||
|
new TaikoReplayFrame(3500, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(3700),
|
||||||
|
},
|
||||||
|
PassCondition = () => Player.ScoreProcessor.Combo.Value == 6
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOneSixthConversion() => CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new TaikoModQuarterize
|
||||||
|
{
|
||||||
|
OneSixthConversion = { Value = true }
|
||||||
|
},
|
||||||
|
Autoplay = false,
|
||||||
|
CreateBeatmap = () => new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject>
|
||||||
|
{
|
||||||
|
new Hit { StartTime = 1000, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1250, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1500, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1666, Type = HitType.Rim }, // mod removes this
|
||||||
|
new Hit { StartTime = 1833, Type = HitType.Centre }, // mod moves this to 1750
|
||||||
|
new Hit { StartTime = 2000, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 2250, Type = HitType.Centre },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReplayFrames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1200),
|
||||||
|
new TaikoReplayFrame(1250, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1450),
|
||||||
|
new TaikoReplayFrame(1500, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1600),
|
||||||
|
new TaikoReplayFrame(1750, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1800),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2200),
|
||||||
|
new TaikoReplayFrame(2250, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(2450),
|
||||||
|
},
|
||||||
|
PassCondition = () => Player.ScoreProcessor.Combo.Value == 6
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOneEighthConversion() => CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new TaikoModQuarterize
|
||||||
|
{
|
||||||
|
OneEighthConversion = { Value = true }
|
||||||
|
},
|
||||||
|
Autoplay = false,
|
||||||
|
CreateBeatmap = () => new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject>
|
||||||
|
{
|
||||||
|
new Hit { StartTime = 1000, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1250, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1500, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 1625, Type = HitType.Rim }, // mod removes this
|
||||||
|
new Hit { StartTime = 1750, Type = HitType.Centre },
|
||||||
|
new Hit { StartTime = 2000, Type = HitType.Centre },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReplayFrames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1200),
|
||||||
|
new TaikoReplayFrame(1250, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1450),
|
||||||
|
new TaikoReplayFrame(1500, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1700),
|
||||||
|
new TaikoReplayFrame(1750, TaikoAction.LeftCentre),
|
||||||
|
new TaikoReplayFrame(1900),
|
||||||
|
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||||
|
},
|
||||||
|
PassCondition = () => Player.ScoreProcessor.Combo.Value == 5
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -144,6 +144,13 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
foreach (var nested in hitObject.NestedHitObjects)
|
foreach (var nested in hitObject.NestedHitObjects)
|
||||||
simulateHit(nested, ref attributes);
|
simulateHit(nested, ref attributes);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case StrongNestedHitObject:
|
||||||
|
// we never need to deal with these directly.
|
||||||
|
// the only thing strong hits do in terms of scoring is double their object's score increase,
|
||||||
|
// which is already handled at the parent object level via the `strongable.IsStrong` check lower down in this method.
|
||||||
|
// not handling these here can lead to them falsely being counted as combo-increasing when handling strong drum rolls!
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hitObject is DrumRollTick tick)
|
if (hitObject is DrumRollTick tick)
|
||||||
|
136
osu.Game.Rulesets.Taiko/Mods/TaikoModQuarterize.cs
Normal file
136
osu.Game.Rulesets.Taiko/Mods/TaikoModQuarterize.cs
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
|
{
|
||||||
|
public class TaikoModQuarterize : Mod, IApplicableToBeatmap
|
||||||
|
{
|
||||||
|
public override string Name => "Quarterize";
|
||||||
|
public override string Acronym => "QR";
|
||||||
|
public override double ScoreMultiplier => 0.6;
|
||||||
|
public override LocalisableString Description => "Simplify tricky rhythms!";
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
|
|
||||||
|
[SettingSource("1/3 to 1/2 conversion", "Converts 1/3 patterns to 1/2 rhythm.")]
|
||||||
|
public Bindable<bool> OneThirdConversion { get; } = new BindableBool(false);
|
||||||
|
|
||||||
|
[SettingSource("1/6 to 1/4 conversion", "Converts 1/6 patterns to 1/4 rhythm.")]
|
||||||
|
public Bindable<bool> OneSixthConversion { get; } = new BindableBool(true);
|
||||||
|
|
||||||
|
[SettingSource("1/8 to 1/4 conversion", "Converts 1/8 patterns to 1/4 rhythm.")]
|
||||||
|
public Bindable<bool> OneEighthConversion { get; } = new BindableBool(false);
|
||||||
|
|
||||||
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
var taikoBeatmap = (TaikoBeatmap)beatmap;
|
||||||
|
var controlPointInfo = taikoBeatmap.ControlPointInfo;
|
||||||
|
List<Hit> toRemove = new List<Hit>();
|
||||||
|
|
||||||
|
// Snap conversions for rhythms
|
||||||
|
var snapConversions = new Dictionary<int, double>
|
||||||
|
{
|
||||||
|
{ 8, 4.0 }, // 1/8 snap to 1/4 snap
|
||||||
|
{ 6, 4.0 }, // 1/6 snap to 1/4 snap
|
||||||
|
{ 3, 2.0 }, // 1/3 snap to 1/2 snap
|
||||||
|
};
|
||||||
|
|
||||||
|
bool inPattern = false;
|
||||||
|
|
||||||
|
List<Hit> hits = taikoBeatmap.HitObjects.Where(obj => obj is Hit).Cast<Hit>().ToList();
|
||||||
|
|
||||||
|
foreach (var snapConversion in snapConversions)
|
||||||
|
{
|
||||||
|
int patternStartIndex = 0;
|
||||||
|
|
||||||
|
// Skip processing if the corresponding conversion is disabled
|
||||||
|
if (!shouldProcessRhythm(snapConversion.Key))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (int i = 0; i < hits.Count; i++)
|
||||||
|
{
|
||||||
|
double snapValue = i < hits.Count - 1
|
||||||
|
? getSnapBetweenNotes(controlPointInfo, hits[i], hits[i + 1])
|
||||||
|
: 1; // No next note, default to a safe 1/1 snap
|
||||||
|
|
||||||
|
if (snapValue == snapConversion.Key)
|
||||||
|
{
|
||||||
|
if (!inPattern)
|
||||||
|
{
|
||||||
|
patternStartIndex = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
inPattern = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if end of pattern
|
||||||
|
if (inPattern && snapValue != snapConversion.Key)
|
||||||
|
{
|
||||||
|
// End of the pattern
|
||||||
|
inPattern = false;
|
||||||
|
|
||||||
|
// Iterate through the pattern
|
||||||
|
for (int j = patternStartIndex; j <= i; j++)
|
||||||
|
{
|
||||||
|
int currentHitPosition = j - patternStartIndex;
|
||||||
|
|
||||||
|
if (snapConversion.Key == 8)
|
||||||
|
{
|
||||||
|
// 1/8: Remove the second note
|
||||||
|
if (currentHitPosition % 2 == 1)
|
||||||
|
{
|
||||||
|
toRemove.Add(hits[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 1/6 and 1/3: Remove the second note and adjust the third
|
||||||
|
if (currentHitPosition % 3 == 1)
|
||||||
|
{
|
||||||
|
toRemove.Add(hits[j]);
|
||||||
|
}
|
||||||
|
else if (currentHitPosition % 3 == 2 && j < hits.Count - 1)
|
||||||
|
{
|
||||||
|
double offset = controlPointInfo.TimingPointAt(hits[j].StartTime).BeatLength / snapConversion.Value;
|
||||||
|
hits[j].StartTime = hits[j + 1].StartTime - offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove queued notes
|
||||||
|
taikoBeatmap.HitObjects.RemoveAll(obj => toRemove.Contains(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getSnapBetweenNotes(ControlPointInfo controlPointInfo, Hit currentNote, Hit nextNote)
|
||||||
|
{
|
||||||
|
double gapMs = nextNote.StartTime - currentNote.StartTime;
|
||||||
|
var currentTimingPoint = controlPointInfo.TimingPointAt(currentNote.StartTime);
|
||||||
|
|
||||||
|
return controlPointInfo.GetClosestBeatDivisor(gapMs + currentTimingPoint.Time);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool shouldProcessRhythm(int snap)
|
||||||
|
{
|
||||||
|
return snap switch
|
||||||
|
{
|
||||||
|
3 => OneThirdConversion.Value,
|
||||||
|
6 => OneSixthConversion.Value,
|
||||||
|
8 => OneEighthConversion.Value,
|
||||||
|
_ => false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -130,6 +130,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
new TaikoModEasy(),
|
new TaikoModEasy(),
|
||||||
new TaikoModNoFail(),
|
new TaikoModNoFail(),
|
||||||
new MultiMod(new TaikoModHalfTime(), new TaikoModDaycore()),
|
new MultiMod(new TaikoModHalfTime(), new TaikoModDaycore()),
|
||||||
|
new TaikoModQuarterize(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.DifficultyIncrease:
|
case ModType.DifficultyIncrease:
|
||||||
|
@ -5,25 +5,64 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Online.Rooms.RoomStatuses;
|
using osu.Game.Online.Rooms.RoomStatuses;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||||
|
using osu.Game.Tests.Resources;
|
||||||
using osu.Game.Tests.Visual.OnlinePlay;
|
using osu.Game.Tests.Visual.OnlinePlay;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Playlists
|
namespace osu.Game.Tests.Visual.Playlists
|
||||||
{
|
{
|
||||||
public partial class TestScenePlaylistsRoomSubScreen : OnlinePlayTestScene
|
public partial class TestScenePlaylistsRoomSubScreen : OnlinePlayTestScene
|
||||||
{
|
{
|
||||||
|
private const double track_length = 10000;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
protected new TestRoomManager RoomManager => (TestRoomManager)base.RoomManager;
|
protected new TestRoomManager RoomManager => (TestRoomManager)base.RoomManager;
|
||||||
|
|
||||||
|
private BeatmapManager beatmaps = null!;
|
||||||
|
private RulesetStore rulesets = null!;
|
||||||
|
private BeatmapSetInfo? importedSet;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(GameHost host, AudioManager audio)
|
||||||
|
{
|
||||||
|
Dependencies.Cache(rulesets = new RealmRulesetStore(Realm));
|
||||||
|
Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, null, audio, Resources, host, Beatmap.Default));
|
||||||
|
Dependencies.Cache(new ScoreManager(rulesets, () => beatmaps, LocalStorage, Realm, API));
|
||||||
|
Dependencies.Cache(Realm);
|
||||||
|
|
||||||
|
beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
|
||||||
|
|
||||||
|
Realm.Write(r =>
|
||||||
|
{
|
||||||
|
foreach (var set in r.All<BeatmapSetInfo>())
|
||||||
|
{
|
||||||
|
foreach (var b in set.Beatmaps)
|
||||||
|
{
|
||||||
|
// These will all have a virtual track length of 1000, see WorkingBeatmap.GetVirtualTrack().
|
||||||
|
b.Length = track_length - 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStatusUpdateOnEnter()
|
public void TestStatusUpdateOnEnter()
|
||||||
{
|
{
|
||||||
@ -69,5 +108,42 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
AddAssert("close button present", () => roomScreen.ChildrenOfType<DangerousRoundedButton>().Any());
|
AddAssert("close button present", () => roomScreen.ChildrenOfType<DangerousRoundedButton>().Any());
|
||||||
AddUntilStep("wait for close button to disappear", () => !roomScreen.ChildrenOfType<DangerousRoundedButton>().Any());
|
AddUntilStep("wait for close button to disappear", () => !roomScreen.ChildrenOfType<DangerousRoundedButton>().Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(120_000, true)] // Definitely enough time.
|
||||||
|
[TestCase(45_000, true)] // Enough time.
|
||||||
|
[TestCase(35_000, false)] // Not enough time to complete beatmap after lenience.
|
||||||
|
[TestCase(20_000, false)] // Not enough time.
|
||||||
|
[TestCase(5_000, false)] // Not enough time to complete beatmap before lenience.
|
||||||
|
[TestCase(37_500, true, 2)] // Enough time to complete beatmap after mods are applied.
|
||||||
|
public void TestReadyButtonEnablementPeriod(int offsetMs, bool enabled, double rate = 1)
|
||||||
|
{
|
||||||
|
Room room = null!;
|
||||||
|
PlaylistsRoomSubScreen roomScreen = null!;
|
||||||
|
|
||||||
|
AddStep("create room", () =>
|
||||||
|
{
|
||||||
|
RoomManager.AddRoom(room = new Room
|
||||||
|
{
|
||||||
|
Name = @"Test Room",
|
||||||
|
Host = api.LocalUser.Value,
|
||||||
|
Category = RoomCategory.Normal,
|
||||||
|
StartDate = DateTimeOffset.Now,
|
||||||
|
EndDate = DateTimeOffset.Now.AddMilliseconds(offsetMs),
|
||||||
|
Playlist =
|
||||||
|
[
|
||||||
|
new PlaylistItem(importedSet!.Beatmaps[0])
|
||||||
|
{
|
||||||
|
RequiredMods = rate == 1
|
||||||
|
? []
|
||||||
|
: [new APIMod(new OsuModDoubleTime { SpeedChange = { Value = rate } })]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("push screen", () => LoadScreen(roomScreen = new PlaylistsRoomSubScreen(room)));
|
||||||
|
AddUntilStep("wait for screen load", () => roomScreen.IsCurrentScreen());
|
||||||
|
AddUntilStep("ready button enabled", () => roomScreen.ChildrenOfType<PlaylistsReadyButton>().SingleOrDefault()?.Enabled.Value, () => Is.EqualTo(enabled));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -10,7 +11,9 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Playlists
|
namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||||
{
|
{
|
||||||
@ -19,6 +22,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<WorkingBeatmap> gameBeatmap { get; set; } = null!;
|
private IBindable<WorkingBeatmap> gameBeatmap { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
|
|
||||||
private readonly Room room;
|
private readonly Room room;
|
||||||
|
|
||||||
public PlaylistsReadyButton(Room room)
|
public PlaylistsReadyButton(Room room)
|
||||||
@ -63,14 +69,14 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Enabled.Value = hasRemainingAttempts && enoughTimeLeft;
|
Enabled.Value = hasRemainingAttempts && enoughTimeLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override LocalisableString TooltipText
|
public override LocalisableString TooltipText
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!enoughTimeLeft)
|
if (!enoughTimeLeft())
|
||||||
return "No time left!";
|
return "No time left!";
|
||||||
|
|
||||||
if (!hasRemainingAttempts)
|
if (!hasRemainingAttempts)
|
||||||
@ -80,9 +86,17 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool enoughTimeLeft =>
|
private bool enoughTimeLeft()
|
||||||
// This should probably consider the length of the currently selected item, rather than a constant 30 seconds.
|
{
|
||||||
room.EndDate != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < room.EndDate;
|
double rate = ModUtils.CalculateRateWithMods(mods.Value);
|
||||||
|
|
||||||
|
// We want to avoid users not being able to submit scores if they chose to not skip,
|
||||||
|
// so track length is chosen over playable length.
|
||||||
|
double trackLength = Math.Round(gameBeatmap.Value.Track.Length / rate);
|
||||||
|
|
||||||
|
// Additional 30 second delay added to account for load and/or submit time.
|
||||||
|
return room.EndDate != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(trackLength) < room.EndDate;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
|
@ -401,7 +401,6 @@ namespace osu.Game.Screens.Select
|
|||||||
if (beatmap == null || bpmLabelContainer == null)
|
if (beatmap == null || bpmLabelContainer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// this doesn't consider mods which apply variable rates, yet.
|
|
||||||
double rate = ModUtils.CalculateRateWithMods(mods.Value);
|
double rate = ModUtils.CalculateRateWithMods(mods.Value);
|
||||||
|
|
||||||
int bpmMax = FormatUtils.RoundBPM(beatmap.ControlPointInfo.BPMMaximum, rate);
|
int bpmMax = FormatUtils.RoundBPM(beatmap.ControlPointInfo.BPMMaximum, rate);
|
||||||
|
@ -286,6 +286,7 @@ namespace osu.Game.Utils
|
|||||||
{
|
{
|
||||||
double rate = 1;
|
double rate = 1;
|
||||||
|
|
||||||
|
// TODO: This doesn't consider mods which apply variable rates, yet.
|
||||||
foreach (var mod in mods.OfType<IApplicableToRate>())
|
foreach (var mod in mods.OfType<IApplicableToRate>())
|
||||||
rate = mod.ApplyToRate(0, rate);
|
rate = mod.ApplyToRate(0, rate);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user