mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 03:13:22 +08:00
Compare commits
20 Commits
57ea625af6
...
57b4bdb19a
Author | SHA1 | Date | |
---|---|---|---|
|
57b4bdb19a | ||
|
f09d8f097a | ||
|
457957d3b8 | ||
|
2ceb3f6f85 | ||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
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:
|
||||||
|
@ -44,6 +44,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString CheckUpdate => new TranslatableString(getKey(@"check_update"), @"Check for updates");
|
public static LocalisableString CheckUpdate => new TranslatableString(getKey(@"check_update"), @"Check for updates");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Checking for updates"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString CheckingForUpdates => new TranslatableString(getKey(@"checking_for_updates"), @"Checking for updates");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Open osu! folder"
|
/// "Open osu! folder"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -13,6 +12,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Statistics;
|
using osu.Framework.Statistics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
@ -36,8 +36,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Storage storage { get; set; } = null!;
|
private Storage storage { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuGame? game { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, OsuGame? game)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Add(new SettingsEnumDropdown<ReleaseStream>
|
Add(new SettingsEnumDropdown<ReleaseStream>
|
||||||
{
|
{
|
||||||
@ -50,23 +53,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
Add(checkForUpdatesButton = new SettingsButton
|
Add(checkForUpdatesButton = new SettingsButton
|
||||||
{
|
{
|
||||||
Text = GeneralSettingsStrings.CheckUpdate,
|
Text = GeneralSettingsStrings.CheckUpdate,
|
||||||
Action = () =>
|
Action = () => checkForUpdates().FireAndForget()
|
||||||
{
|
|
||||||
checkForUpdatesButton.Enabled.Value = false;
|
|
||||||
Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(task => Schedule(() =>
|
|
||||||
{
|
|
||||||
if (!task.GetResultSafely())
|
|
||||||
{
|
|
||||||
notifications?.Post(new SimpleNotification
|
|
||||||
{
|
|
||||||
Text = GeneralSettingsStrings.RunningLatestRelease(game!.Version),
|
|
||||||
Icon = FontAwesome.Solid.CheckCircle,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
checkForUpdatesButton.Enabled.Value = true;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +81,44 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task checkForUpdates()
|
||||||
|
{
|
||||||
|
if (updateManager == null || game == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
checkForUpdatesButton.Enabled.Value = false;
|
||||||
|
|
||||||
|
var checkingNotification = new ProgressNotification
|
||||||
|
{
|
||||||
|
Text = GeneralSettingsStrings.CheckingForUpdates,
|
||||||
|
};
|
||||||
|
notifications?.Post(checkingNotification);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool foundUpdate = await updateManager.CheckForUpdateAsync().ConfigureAwait(true);
|
||||||
|
|
||||||
|
if (!foundUpdate)
|
||||||
|
{
|
||||||
|
notifications?.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = GeneralSettingsStrings.RunningLatestRelease(game.Version),
|
||||||
|
Icon = FontAwesome.Solid.CheckCircle,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// This sequence allows the notification to be immediately dismissed.
|
||||||
|
checkingNotification.State = ProgressNotificationState.Cancelled;
|
||||||
|
checkingNotification.Close(false);
|
||||||
|
checkForUpdatesButton.Enabled.Value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void exportLogs()
|
private void exportLogs()
|
||||||
{
|
{
|
||||||
ProgressNotification notification = new ProgressNotification
|
ProgressNotification notification = new ProgressNotification
|
||||||
|
Loading…
Reference in New Issue
Block a user