mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 23:02:55 +08:00
Merge branch 'master' into updates-outside-of-gameplay-only-2
This commit is contained in:
commit
8dece70097
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -133,10 +133,7 @@ jobs:
|
|||||||
dotnet-version: "8.0.x"
|
dotnet-version: "8.0.x"
|
||||||
|
|
||||||
- name: Install .NET Workloads
|
- name: Install .NET Workloads
|
||||||
run: dotnet workload install maui-ios
|
run: dotnet workload install ios --from-rollback-file https://raw.githubusercontent.com/ppy/osu-framework/refs/heads/master/workloads.json
|
||||||
|
|
||||||
- name: Select Xcode 16
|
|
||||||
run: sudo xcode-select -s /Applications/Xcode_16.app/Contents/Developer
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build -c Debug osu.iOS
|
run: dotnet build -c Debug osu.iOS
|
||||||
|
6
.github/workflows/diffcalc.yml
vendored
6
.github/workflows/diffcalc.yml
vendored
@ -361,8 +361,7 @@ jobs:
|
|||||||
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
|
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
|
||||||
with:
|
with:
|
||||||
comment_tag: ${{ env.EXECUTION_ID }}
|
comment_tag: ${{ env.EXECUTION_ID }}
|
||||||
mode: upsert
|
mode: recreate
|
||||||
create_if_not_exists: false
|
|
||||||
message: |
|
message: |
|
||||||
Target: ${{ needs.generator.outputs.TARGET }}
|
Target: ${{ needs.generator.outputs.TARGET }}
|
||||||
Spreadsheet: ${{ needs.generator.outputs.SPREADSHEET_LINK }}
|
Spreadsheet: ${{ needs.generator.outputs.SPREADSHEET_LINK }}
|
||||||
@ -372,8 +371,7 @@ jobs:
|
|||||||
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
|
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0
|
||||||
with:
|
with:
|
||||||
comment_tag: ${{ env.EXECUTION_ID }}
|
comment_tag: ${{ env.EXECUTION_ID }}
|
||||||
mode: upsert
|
mode: recreate
|
||||||
create_if_not_exists: false
|
|
||||||
message: |
|
message: |
|
||||||
Difficulty calculation failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
Difficulty calculation failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.927.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.1007.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
@ -31,6 +32,7 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Screens.Edit.Setup;
|
using osu.Game.Screens.Edit.Setup;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch
|
namespace osu.Game.Rulesets.Catch
|
||||||
{
|
{
|
||||||
@ -223,10 +225,28 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
|
|
||||||
public override HitObjectComposer CreateHitObjectComposer() => new CatchHitObjectComposer(this);
|
public override HitObjectComposer CreateHitObjectComposer() => new CatchHitObjectComposer(this);
|
||||||
|
|
||||||
public override IEnumerable<SetupSection> CreateEditorSetupSections() =>
|
public override IEnumerable<Drawable> CreateEditorSetupSections() =>
|
||||||
[
|
[
|
||||||
|
new MetadataSection(),
|
||||||
new DifficultySection(),
|
new DifficultySection(),
|
||||||
new ColoursSection(),
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(SetupScreen.SPACING),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new ResourcesSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
},
|
||||||
|
new ColoursSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new DesignSection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
public override IBeatmapVerifier CreateBeatmapVerifier() => new CatchBeatmapVerifier();
|
public override IBeatmapVerifier CreateBeatmapVerifier() => new CatchBeatmapVerifier();
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Caching;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
|
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
|
||||||
@ -172,7 +173,10 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
|
|||||||
yield return new OsuMenuItem("Add vertex", MenuItemType.Standard, () =>
|
yield return new OsuMenuItem("Add vertex", MenuItemType.Standard, () =>
|
||||||
{
|
{
|
||||||
editablePath.AddVertex(rightMouseDownPosition);
|
editablePath.AddVertex(rightMouseDownPosition);
|
||||||
});
|
})
|
||||||
|
{
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.MouseLeft))
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -20,10 +20,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestKeyCountChange()
|
public void TestKeyCountChange()
|
||||||
{
|
{
|
||||||
LabelledSliderBar<float> keyCount = null!;
|
FormSliderBar<float> keyCount = null!;
|
||||||
|
|
||||||
AddStep("go to setup screen", () => InputManager.Key(Key.F4));
|
AddStep("go to setup screen", () => InputManager.Key(Key.F4));
|
||||||
AddUntilStep("retrieve key count slider", () => keyCount = Editor.ChildrenOfType<SetupScreen>().Single().ChildrenOfType<LabelledSliderBar<float>>().First(), () => Is.Not.Null);
|
AddUntilStep("retrieve key count slider", () => keyCount = Editor.ChildrenOfType<SetupScreen>().Single().ChildrenOfType<FormSliderBar<float>>().First(), () => Is.Not.Null);
|
||||||
AddAssert("key count is 5", () => keyCount.Current.Value, () => Is.EqualTo(5));
|
AddAssert("key count is 5", () => keyCount.Current.Value, () => Is.EqualTo(5));
|
||||||
AddStep("change key count to 8", () =>
|
AddStep("change key count to 8", () =>
|
||||||
{
|
{
|
||||||
|
@ -19,12 +19,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Setup
|
|||||||
{
|
{
|
||||||
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
||||||
|
|
||||||
private LabelledSliderBar<float> keyCountSlider { get; set; } = null!;
|
private FormSliderBar<float> keyCountSlider { get; set; } = null!;
|
||||||
private LabelledSwitchButton specialStyle { get; set; } = null!;
|
private FormCheckBox specialStyle { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> healthDrainSlider { get; set; } = null!;
|
private FormSliderBar<float> healthDrainSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
private FormSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
private FormSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> tickRateSlider { get; set; } = null!;
|
private FormSliderBar<double> tickRateSlider { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Editor? editor { get; set; }
|
private Editor? editor { get; set; }
|
||||||
@ -37,77 +37,81 @@ namespace osu.Game.Rulesets.Mania.Edit.Setup
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
keyCountSlider = new LabelledSliderBar<float>
|
keyCountSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsCsMania,
|
Caption = BeatmapsetsStrings.ShowStatsCsMania,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = "The number of columns in the beatmap",
|
||||||
Description = "The number of columns in the beatmap",
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
|
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 1,
|
Precision = 1,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
specialStyle = new LabelledSwitchButton
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
specialStyle = new FormCheckBox
|
||||||
{
|
{
|
||||||
Label = "Use special (N+1) style",
|
Caption = "Use special (N+1) style",
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 6K (5+1) or 8K (7+1) configurations.",
|
||||||
Description = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 6K (5+1) or 8K (7+1) configurations.",
|
|
||||||
Current = { Value = Beatmap.BeatmapInfo.SpecialStyle }
|
Current = { Value = Beatmap.BeatmapInfo.SpecialStyle }
|
||||||
},
|
},
|
||||||
healthDrainSlider = new LabelledSliderBar<float>
|
healthDrainSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsDrain,
|
Caption = BeatmapsetsStrings.ShowStatsDrain,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.DrainRateDescription,
|
||||||
Description = EditorSetupStrings.DrainRateDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
overallDifficultySlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
overallDifficultySlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsAccuracy,
|
Caption = BeatmapsetsStrings.ShowStatsAccuracy,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.OverallDifficultyDescription,
|
||||||
Description = EditorSetupStrings.OverallDifficultyDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
baseVelocitySlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
baseVelocitySlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.BaseVelocity,
|
Caption = EditorSetupStrings.BaseVelocity,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.BaseVelocityDescription,
|
||||||
Description = EditorSetupStrings.BaseVelocityDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
||||||
{
|
{
|
||||||
Default = 1.4,
|
Default = 1.4,
|
||||||
MinValue = 0.4,
|
MinValue = 0.4,
|
||||||
MaxValue = 3.6,
|
MaxValue = 3.6,
|
||||||
Precision = 0.01f,
|
Precision = 0.01f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
tickRateSlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
tickRateSlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.TickRate,
|
Caption = EditorSetupStrings.TickRate,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.TickRateDescription,
|
||||||
Description = EditorSetupStrings.TickRateDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
||||||
{
|
{
|
||||||
Default = 1,
|
Default = 1,
|
||||||
MinValue = 1,
|
MinValue = 1,
|
||||||
MaxValue = 4,
|
MaxValue = 4,
|
||||||
Precision = 1,
|
Precision = 1,
|
||||||
}
|
},
|
||||||
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -419,9 +419,12 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
return new ManiaFilterCriteria();
|
return new ManiaFilterCriteria();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<SetupSection> CreateEditorSetupSections() =>
|
public override IEnumerable<Drawable> CreateEditorSetupSections() =>
|
||||||
[
|
[
|
||||||
|
new MetadataSection(),
|
||||||
new ManiaDifficultySection(),
|
new ManiaDifficultySection(),
|
||||||
|
new ResourcesSection(),
|
||||||
|
new DesignSection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
public int GetKeyCount(IBeatmapInfo beatmapInfo, IReadOnlyList<Mod>? mods = null)
|
public int GetKeyCount(IBeatmapInfo beatmapInfo, IReadOnlyList<Mod>? mods = null)
|
||||||
|
@ -15,22 +15,22 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu.Tests";
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu.Tests";
|
||||||
|
|
||||||
[TestCase(6.710442985146793d, 239, "diffcalc-test")]
|
[TestCase(6.7154251995274938d, 239, "diffcalc-test")]
|
||||||
[TestCase(1.4386882251130073d, 54, "zero-length-sliders")]
|
[TestCase(1.4430610657612626d, 54, "zero-length-sliders")]
|
||||||
[TestCase(0.42506480230838789d, 4, "very-fast-slider")]
|
[TestCase(0.42630400627180914d, 4, "very-fast-slider")]
|
||||||
[TestCase(0.14102693012101306d, 2, "nan-slider")]
|
[TestCase(0.14143808967817237d, 2, "nan-slider")]
|
||||||
public void Test(double expectedStarRating, int expectedMaxCombo, string name)
|
public void Test(double expectedStarRating, int expectedMaxCombo, string name)
|
||||||
=> base.Test(expectedStarRating, expectedMaxCombo, name);
|
=> base.Test(expectedStarRating, expectedMaxCombo, name);
|
||||||
|
|
||||||
[TestCase(8.9742952703071666d, 239, "diffcalc-test")]
|
[TestCase(8.9808183779700208d, 239, "diffcalc-test")]
|
||||||
[TestCase(1.743180218215227d, 54, "zero-length-sliders")]
|
[TestCase(1.7483507893412422d, 54, "zero-length-sliders")]
|
||||||
[TestCase(0.55071082800473514d, 4, "very-fast-slider")]
|
[TestCase(0.55231632896800109d, 4, "very-fast-slider")]
|
||||||
public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
|
public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
|
||||||
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime());
|
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModDoubleTime());
|
||||||
|
|
||||||
[TestCase(6.710442985146793d, 239, "diffcalc-test")]
|
[TestCase(6.7154251995274938d, 239, "diffcalc-test")]
|
||||||
[TestCase(1.4386882251130073d, 54, "zero-length-sliders")]
|
[TestCase(1.4430610657612626d, 54, "zero-length-sliders")]
|
||||||
[TestCase(0.42506480230838789d, 4, "very-fast-slider")]
|
[TestCase(0.42630400627180914d, 4, "very-fast-slider")]
|
||||||
public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name)
|
public void TestClassicMod(double expectedStarRating, int expectedMaxCombo, string name)
|
||||||
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic());
|
=> Test(expectedStarRating, expectedMaxCombo, name, new OsuModClassic());
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
|||||||
private const double single_spacing_threshold = 125; // 1.25 circles distance between centers
|
private const double single_spacing_threshold = 125; // 1.25 circles distance between centers
|
||||||
private const double min_speed_bonus = 75; // ~200BPM
|
private const double min_speed_bonus = 75; // ~200BPM
|
||||||
private const double speed_balancing_factor = 40;
|
private const double speed_balancing_factor = 40;
|
||||||
|
private const double distance_multiplier = 0.94;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Evaluates the difficulty of tapping the current object, based on:
|
/// Evaluates the difficulty of tapping the current object, based on:
|
||||||
@ -50,12 +51,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
|||||||
// 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
// 0.93 is derived from making sure 260bpm OD8 streams aren't nerfed harshly, whilst 0.92 limits the effect of the cap.
|
||||||
strainTime /= Math.Clamp((strainTime / osuCurrObj.HitWindowGreat) / 0.93, 0.92, 1);
|
strainTime /= Math.Clamp((strainTime / osuCurrObj.HitWindowGreat) / 0.93, 0.92, 1);
|
||||||
|
|
||||||
// speedBonus will be 1.0 for BPM < 200
|
// speedBonus will be 0.0 for BPM < 200
|
||||||
double speedBonus = 1.0;
|
double speedBonus = 0.0;
|
||||||
|
|
||||||
// Add additional scaling bonus for streams/bursts higher than 200bpm
|
// Add additional scaling bonus for streams/bursts higher than 200bpm
|
||||||
if (strainTime < min_speed_bonus)
|
if (strainTime < min_speed_bonus)
|
||||||
speedBonus = 1 + 0.75 * Math.Pow((min_speed_bonus - strainTime) / speed_balancing_factor, 2);
|
speedBonus = 0.75 * Math.Pow((min_speed_bonus - strainTime) / speed_balancing_factor, 2);
|
||||||
|
|
||||||
double travelDistance = osuPrevObj?.TravelDistance ?? 0;
|
double travelDistance = osuPrevObj?.TravelDistance ?? 0;
|
||||||
double distance = travelDistance + osuCurrObj.MinimumJumpDistance;
|
double distance = travelDistance + osuCurrObj.MinimumJumpDistance;
|
||||||
@ -63,11 +64,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
|||||||
// Cap distance at single_spacing_threshold
|
// Cap distance at single_spacing_threshold
|
||||||
distance = Math.Min(distance, single_spacing_threshold);
|
distance = Math.Min(distance, single_spacing_threshold);
|
||||||
|
|
||||||
// Max distance bonus is 2 at single_spacing_threshold
|
// Max distance bonus is 1 * `distance_multiplier` at single_spacing_threshold
|
||||||
double distanceBonus = 1 + Math.Pow(distance / single_spacing_threshold, 3.5);
|
double distanceBonus = Math.Pow(distance / single_spacing_threshold, 3.95) * distance_multiplier;
|
||||||
|
|
||||||
// Base difficulty with all bonuses
|
// Base difficulty with all bonuses
|
||||||
double difficulty = speedBonus * distanceBonus * 1000 / strainTime;
|
double difficulty = (1 + speedBonus + distanceBonus) * 1000 / strainTime;
|
||||||
|
|
||||||
// Apply penalty if there's doubletappable doubles
|
// Apply penalty if there's doubletappable doubles
|
||||||
return difficulty * doubletapness;
|
return difficulty * doubletapness;
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
{
|
{
|
||||||
public class OsuPerformanceCalculator : PerformanceCalculator
|
public class OsuPerformanceCalculator : PerformanceCalculator
|
||||||
{
|
{
|
||||||
public const double PERFORMANCE_BASE_MULTIPLIER = 1.14; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things.
|
public const double PERFORMANCE_BASE_MULTIPLIER = 1.15; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things.
|
||||||
|
|
||||||
private double accuracy;
|
private double accuracy;
|
||||||
private int scoreMaxCombo;
|
private int scoreMaxCombo;
|
||||||
@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (attributes.SpeedNoteCount * 6.0);
|
double relevantAccuracy = attributes.SpeedNoteCount == 0 ? 0 : (relevantCountGreat * 6.0 + relevantCountOk * 2.0 + relevantCountMeh) / (attributes.SpeedNoteCount * 6.0);
|
||||||
|
|
||||||
// Scale the speed value with accuracy and OD.
|
// Scale the speed value with accuracy and OD.
|
||||||
speedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - Math.Max(attributes.OverallDifficulty, 8)) / 2);
|
speedValue *= (0.95 + Math.Pow(attributes.OverallDifficulty, 2) / 750) * Math.Pow((accuracy + relevantAccuracy) / 2.0, (14.5 - attributes.OverallDifficulty) / 2);
|
||||||
|
|
||||||
// Scale the speed value with # of 50s to punish doubletapping.
|
// Scale the speed value with # of 50s to punish doubletapping.
|
||||||
speedValue *= Math.Pow(0.99, countMeh < totalHits / 500.0 ? 0 : countMeh - totalHits / 500.0);
|
speedValue *= Math.Pow(0.99, countMeh < totalHits / 500.0 ? 0 : countMeh - totalHits / 500.0);
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
|||||||
|
|
||||||
private double currentStrain;
|
private double currentStrain;
|
||||||
|
|
||||||
private double skillMultiplier => 24.963;
|
private double skillMultiplier => 24.983;
|
||||||
private double strainDecayBase => 0.15;
|
private double strainDecayBase => 0.15;
|
||||||
|
|
||||||
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
if (segment.Count == 0)
|
if (segment.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var first = segment[0];
|
PathControlPoint first = segment[0];
|
||||||
|
|
||||||
if (first.Type != PathType.PERFECT_CURVE)
|
if (first.Type != PathType.PERFECT_CURVE)
|
||||||
return;
|
return;
|
||||||
@ -273,10 +273,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
if (selectedPieces.Length != 1)
|
if (selectedPieces.Length != 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var selectedPiece = selectedPieces.Single();
|
PathControlPointPiece<T> selectedPiece = selectedPieces.Single();
|
||||||
var selectedPoint = selectedPiece.ControlPoint;
|
PathControlPoint selectedPoint = selectedPiece.ControlPoint;
|
||||||
|
|
||||||
var validTypes = path_types;
|
PathType?[] validTypes = path_types;
|
||||||
|
|
||||||
if (selectedPoint == controlPoints[0])
|
if (selectedPoint == controlPoints[0])
|
||||||
validTypes = validTypes.Where(t => t != null).ToArray();
|
validTypes = validTypes.Where(t => t != null).ToArray();
|
||||||
@ -313,7 +313,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
if (Pieces.All(p => !p.IsSelected.Value))
|
if (Pieces.All(p => !p.IsSelected.Value))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var type = path_types[e.Key - Key.Number1];
|
PathType? type = path_types[e.Key - Key.Number1];
|
||||||
|
|
||||||
// The first control point can never be inherit type
|
// The first control point can never be inherit type
|
||||||
if (Pieces[0].IsSelected.Value && type == null)
|
if (Pieces[0].IsSelected.Value && type == null)
|
||||||
@ -357,7 +357,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
foreach (var p in Pieces.Where(p => p.IsSelected.Value))
|
foreach (var p in Pieces.Where(p => p.IsSelected.Value))
|
||||||
{
|
{
|
||||||
var pointsInSegment = hitObject.Path.PointsInSegment(p.ControlPoint);
|
List<PathControlPoint> pointsInSegment = hitObject.Path.PointsInSegment(p.ControlPoint);
|
||||||
int indexInSegment = pointsInSegment.IndexOf(p.ControlPoint);
|
int indexInSegment = pointsInSegment.IndexOf(p.ControlPoint);
|
||||||
|
|
||||||
if (type?.Type == SplineType.PerfectCurve)
|
if (type?.Type == SplineType.PerfectCurve)
|
||||||
@ -412,14 +412,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
public void DragInProgress(DragEvent e)
|
public void DragInProgress(DragEvent e)
|
||||||
{
|
{
|
||||||
Vector2[] oldControlPoints = hitObject.Path.ControlPoints.Select(cp => cp.Position).ToArray();
|
Vector2[] oldControlPoints = hitObject.Path.ControlPoints.Select(cp => cp.Position).ToArray();
|
||||||
var oldPosition = hitObject.Position;
|
Vector2 oldPosition = hitObject.Position;
|
||||||
double oldStartTime = hitObject.StartTime;
|
double oldStartTime = hitObject.StartTime;
|
||||||
|
|
||||||
if (selectedControlPoints.Contains(hitObject.Path.ControlPoints[0]))
|
if (selectedControlPoints.Contains(hitObject.Path.ControlPoints[0]))
|
||||||
{
|
{
|
||||||
// Special handling for selections containing head control point - the position of the hit object changes which means the snapped position and time have to be taken into account
|
// Special handling for selections containing head control point - the position of the hit object changes which means the snapped position and time have to be taken into account
|
||||||
Vector2 newHeadPosition = Parent!.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex]));
|
Vector2 newHeadPosition = Parent!.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex]));
|
||||||
var result = positionSnapProvider?.FindSnappedPositionAndTime(newHeadPosition);
|
SnapResult result = positionSnapProvider?.FindSnappedPositionAndTime(newHeadPosition);
|
||||||
|
|
||||||
Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position;
|
Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? newHeadPosition) - hitObject.Position;
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
for (int i = 1; i < hitObject.Path.ControlPoints.Count; i++)
|
for (int i = 1; i < hitObject.Path.ControlPoints.Count; i++)
|
||||||
{
|
{
|
||||||
var controlPoint = hitObject.Path.ControlPoints[i];
|
PathControlPoint controlPoint = hitObject.Path.ControlPoints[i];
|
||||||
// Since control points are relative to the position of the hit object, all points that are _not_ selected
|
// Since control points are relative to the position of the hit object, all points that are _not_ selected
|
||||||
// need to be offset _back_ by the delta corresponding to the movement of the head point.
|
// need to be offset _back_ by the delta corresponding to the movement of the head point.
|
||||||
// All other selected control points (if any) will move together with the head point
|
// All other selected control points (if any) will move together with the head point
|
||||||
@ -439,13 +439,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = positionSnapProvider?.FindSnappedPositionAndTime(Parent!.ToScreenSpace(e.MousePosition), SnapType.GlobalGrids);
|
SnapResult result = positionSnapProvider?.FindSnappedPositionAndTime(Parent!.ToScreenSpace(e.MousePosition), SnapType.GlobalGrids);
|
||||||
|
|
||||||
Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? Parent!.ToScreenSpace(e.MousePosition)) - dragStartPositions[draggedControlPointIndex] - hitObject.Position;
|
Vector2 movementDelta = Parent!.ToLocalSpace(result?.ScreenSpacePosition ?? Parent!.ToScreenSpace(e.MousePosition)) - dragStartPositions[draggedControlPointIndex] - hitObject.Position;
|
||||||
|
|
||||||
for (int i = 0; i < controlPoints.Count; ++i)
|
for (int i = 0; i < controlPoints.Count; ++i)
|
||||||
{
|
{
|
||||||
var controlPoint = controlPoints[i];
|
PathControlPoint controlPoint = controlPoints[i];
|
||||||
if (selectedControlPoints.Contains(controlPoint))
|
if (selectedControlPoints.Contains(controlPoint))
|
||||||
controlPoint.Position = dragStartPositions[i] + movementDelta;
|
controlPoint.Position = dragStartPositions[i] + movementDelta;
|
||||||
}
|
}
|
||||||
@ -495,8 +495,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
curveTypeItems = new List<MenuItem>();
|
curveTypeItems = new List<MenuItem>();
|
||||||
|
|
||||||
foreach (PathType? type in path_types)
|
for (int i = 0; i < path_types.Length; ++i)
|
||||||
{
|
{
|
||||||
|
PathType? type = path_types[i];
|
||||||
|
|
||||||
// special inherit case
|
// special inherit case
|
||||||
if (type == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
@ -506,7 +508,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
curveTypeItems.Add(new OsuMenuItemSpacer());
|
curveTypeItems.Add(new OsuMenuItemSpacer());
|
||||||
}
|
}
|
||||||
|
|
||||||
curveTypeItems.Add(createMenuItemForPathType(type));
|
curveTypeItems.Add(createMenuItemForPathType(type, InputKey.Number1 + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedPieces.Any(piece => piece.ControlPoint.Type?.Type == SplineType.Catmull))
|
if (selectedPieces.Any(piece => piece.ControlPoint.Type?.Type == SplineType.Catmull))
|
||||||
@ -540,7 +542,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
return menuItems.ToArray();
|
return menuItems.ToArray();
|
||||||
|
|
||||||
CurveTypeMenuItem createMenuItemForPathType(PathType? type) => new CurveTypeMenuItem(type, _ => updatePathTypeOfSelectedPieces(type));
|
CurveTypeMenuItem createMenuItemForPathType(PathType? type, InputKey? key = null)
|
||||||
|
{
|
||||||
|
Hotkey hotkey = default;
|
||||||
|
|
||||||
|
if (key != null)
|
||||||
|
hotkey = new Hotkey(new KeyCombination(InputKey.Alt, key.Value));
|
||||||
|
|
||||||
|
return new CurveTypeMenuItem(type, _ => updatePathTypeOfSelectedPieces(type)) { Hotkey = hotkey };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Caching;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -593,8 +594,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
changeHandler?.BeginChange();
|
changeHandler?.BeginChange();
|
||||||
addControlPoint(lastRightClickPosition);
|
addControlPoint(lastRightClickPosition);
|
||||||
changeHandler?.EndChange();
|
changeHandler?.EndChange();
|
||||||
}),
|
})
|
||||||
new OsuMenuItem("Convert to stream", MenuItemType.Destructive, convertToStream),
|
{
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.MouseLeft))
|
||||||
|
},
|
||||||
|
new OsuMenuItem("Convert to stream", MenuItemType.Destructive, convertToStream)
|
||||||
|
{
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.F))
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Always refer to the drawable object's slider body so subsequent movement deltas are calculated with updated positions.
|
// Always refer to the drawable object's slider body so subsequent movement deltas are calculated with updated positions.
|
||||||
|
@ -14,6 +14,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components.RadioButtons;
|
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||||
@ -90,6 +91,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
private ExpandableSlider<float> gridLinesRotationSlider = null!;
|
private ExpandableSlider<float> gridLinesRotationSlider = null!;
|
||||||
private EditorRadioButtonCollection gridTypeButtons = null!;
|
private EditorRadioButtonCollection gridTypeButtons = null!;
|
||||||
|
|
||||||
|
private ExpandableButton useSelectedObjectPositionButton = null!;
|
||||||
|
|
||||||
public OsuGridToolboxGroup()
|
public OsuGridToolboxGroup()
|
||||||
: base("grid")
|
: base("grid")
|
||||||
{
|
{
|
||||||
@ -112,6 +115,19 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
Current = StartPositionY,
|
Current = StartPositionY,
|
||||||
KeyboardStep = 1,
|
KeyboardStep = 1,
|
||||||
},
|
},
|
||||||
|
useSelectedObjectPositionButton = new ExpandableButton
|
||||||
|
{
|
||||||
|
ExpandedLabelText = "Centre on selected object",
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
if (editorBeatmap.SelectedHitObjects.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
StartPosition.Value = ((IHasPosition)editorBeatmap.SelectedHitObjects.Single()).Position;
|
||||||
|
updateEnabledStates();
|
||||||
|
},
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
},
|
||||||
spacingSlider = new ExpandableSlider<float>
|
spacingSlider = new ExpandableSlider<float>
|
||||||
{
|
{
|
||||||
Current = Spacing,
|
Current = Spacing,
|
||||||
@ -186,12 +202,6 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
gridLinesRotationSlider.ExpandedLabelText = $"Rotation: {rotation.NewValue:#,0.##}";
|
gridLinesRotationSlider.ExpandedLabelText = $"Rotation: {rotation.NewValue:#,0.##}";
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
expandingContainer?.Expanded.BindValueChanged(v =>
|
|
||||||
{
|
|
||||||
gridTypeButtons.FadeTo(v.NewValue ? 1f : 0f, 500, Easing.OutQuint);
|
|
||||||
gridTypeButtons.BypassAutoSizeAxes = !v.NewValue ? Axes.Y : Axes.None;
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
GridType.BindValueChanged(v =>
|
GridType.BindValueChanged(v =>
|
||||||
{
|
{
|
||||||
GridLinesRotation.Disabled = v.NewValue == PositionSnapGridType.Circle;
|
GridLinesRotation.Disabled = v.NewValue == PositionSnapGridType.Circle;
|
||||||
@ -211,6 +221,22 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
editorBeatmap.BeatmapReprocessed += updateEnabledStates;
|
||||||
|
editorBeatmap.SelectedHitObjects.BindCollectionChanged((_, _) => updateEnabledStates());
|
||||||
|
expandingContainer?.Expanded.BindValueChanged(v =>
|
||||||
|
{
|
||||||
|
gridTypeButtons.FadeTo(v.NewValue ? 1f : 0f, 500, Easing.OutQuint);
|
||||||
|
gridTypeButtons.BypassAutoSizeAxes = !v.NewValue ? Axes.Y : Axes.None;
|
||||||
|
updateEnabledStates();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateEnabledStates()
|
||||||
|
{
|
||||||
|
useSelectedObjectPositionButton.Enabled.Value = expandingContainer?.Expanded.Value == true
|
||||||
|
&& editorBeatmap.SelectedHitObjects.Count == 1
|
||||||
|
&& StartPosition.Value != ((IHasPosition)editorBeatmap.SelectedHitObjects.Single()).Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nextGridSize()
|
private void nextGridSize()
|
||||||
|
@ -16,13 +16,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Setup
|
|||||||
{
|
{
|
||||||
public partial class OsuDifficultySection : SetupSection
|
public partial class OsuDifficultySection : SetupSection
|
||||||
{
|
{
|
||||||
private LabelledSliderBar<float> circleSizeSlider { get; set; } = null!;
|
private FormSliderBar<float> circleSizeSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> healthDrainSlider { get; set; } = null!;
|
private FormSliderBar<float> healthDrainSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> approachRateSlider { get; set; } = null!;
|
private FormSliderBar<float> approachRateSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
private FormSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
private FormSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> tickRateSlider { get; set; } = null!;
|
private FormSliderBar<double> tickRateSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> stackLeniency { get; set; } = null!;
|
private FormSliderBar<float> stackLeniency { get; set; } = null!;
|
||||||
|
|
||||||
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
||||||
|
|
||||||
@ -31,103 +31,110 @@ namespace osu.Game.Rulesets.Osu.Edit.Setup
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
circleSizeSlider = new LabelledSliderBar<float>
|
circleSizeSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsCs,
|
Caption = BeatmapsetsStrings.ShowStatsCs,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.CircleSizeDescription,
|
||||||
Description = EditorSetupStrings.CircleSizeDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
|
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
healthDrainSlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
healthDrainSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsDrain,
|
Caption = BeatmapsetsStrings.ShowStatsDrain,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.DrainRateDescription,
|
||||||
Description = EditorSetupStrings.DrainRateDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
approachRateSlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
approachRateSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsAr,
|
Caption = BeatmapsetsStrings.ShowStatsAr,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.ApproachRateDescription,
|
||||||
Description = EditorSetupStrings.ApproachRateDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.ApproachRate)
|
Current = new BindableFloat(Beatmap.Difficulty.ApproachRate)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
overallDifficultySlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
overallDifficultySlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsAccuracy,
|
Caption = BeatmapsetsStrings.ShowStatsAccuracy,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.OverallDifficultyDescription,
|
||||||
Description = EditorSetupStrings.OverallDifficultyDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
baseVelocitySlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
baseVelocitySlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.BaseVelocity,
|
Caption = EditorSetupStrings.BaseVelocity,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.BaseVelocityDescription,
|
||||||
Description = EditorSetupStrings.BaseVelocityDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
||||||
{
|
{
|
||||||
Default = 1.4,
|
Default = 1.4,
|
||||||
MinValue = 0.4,
|
MinValue = 0.4,
|
||||||
MaxValue = 3.6,
|
MaxValue = 3.6,
|
||||||
Precision = 0.01f,
|
Precision = 0.01f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
tickRateSlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
tickRateSlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.TickRate,
|
Caption = EditorSetupStrings.TickRate,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.TickRateDescription,
|
||||||
Description = EditorSetupStrings.TickRateDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
||||||
{
|
{
|
||||||
Default = 1,
|
Default = 1,
|
||||||
MinValue = 1,
|
MinValue = 1,
|
||||||
MaxValue = 4,
|
MaxValue = 4,
|
||||||
Precision = 1,
|
Precision = 1,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
stackLeniency = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
stackLeniency = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = "Stack Leniency",
|
Caption = "Stack Leniency",
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = "In play mode, osu! automatically stacks notes which occur at the same location. Increasing this value means it is more likely to snap notes of further time-distance.",
|
||||||
Description = "In play mode, osu! automatically stacks notes which occur at the same location. Increasing this value means it is more likely to snap notes of further time-distance.",
|
|
||||||
Current = new BindableFloat(Beatmap.BeatmapInfo.StackLeniency)
|
Current = new BindableFloat(Beatmap.BeatmapInfo.StackLeniency)
|
||||||
{
|
{
|
||||||
Default = 0.7f,
|
Default = 0.7f,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 1,
|
MaxValue = 1,
|
||||||
Precision = 0.1f
|
Precision = 0.1f
|
||||||
}
|
},
|
||||||
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledSliderBar<float>>())
|
foreach (var item in Children.OfType<FormSliderBar<float>>())
|
||||||
item.Current.ValueChanged += _ => updateValues();
|
item.Current.ValueChanged += _ => updateValues();
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledSliderBar<double>>())
|
foreach (var item in Children.OfType<FormSliderBar<double>>())
|
||||||
item.Current.ValueChanged += _ => updateValues();
|
item.Current.ValueChanged += _ => updateValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +204,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
SpanStartTime = e.SpanStartTime,
|
SpanStartTime = e.SpanStartTime,
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
Position = Position + Path.PositionAt(e.PathProgress),
|
Position = Position + Path.PositionAt(e.PathProgress),
|
||||||
|
PathProgress = e.PathProgress,
|
||||||
StackHeight = StackHeight,
|
StackHeight = StackHeight,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -236,6 +237,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
|
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
|
||||||
Position = Position + Path.PositionAt(e.PathProgress),
|
Position = Position + Path.PositionAt(e.PathProgress),
|
||||||
StackHeight = StackHeight,
|
StackHeight = StackHeight,
|
||||||
|
PathProgress = e.PathProgress,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -248,14 +250,27 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
endPositionCache.Invalidate();
|
endPositionCache.Invalidate();
|
||||||
|
|
||||||
if (HeadCircle != null)
|
foreach (var nested in NestedHitObjects)
|
||||||
HeadCircle.Position = Position;
|
{
|
||||||
|
switch (nested)
|
||||||
|
{
|
||||||
|
case SliderHeadCircle headCircle:
|
||||||
|
headCircle.Position = Position;
|
||||||
|
break;
|
||||||
|
|
||||||
if (TailCircle != null)
|
case SliderTailCircle tailCircle:
|
||||||
TailCircle.Position = EndPosition;
|
tailCircle.Position = EndPosition;
|
||||||
|
break;
|
||||||
|
|
||||||
if (LastRepeat != null)
|
case SliderRepeat repeat:
|
||||||
LastRepeat.Position = RepeatCount % 2 == 0 ? Position : Position + Path.PositionAt(1);
|
repeat.Position = Position + Path.PositionAt(repeat.PathProgress);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SliderTick tick:
|
||||||
|
tick.Position = Position + Path.PositionAt(tick.PathProgress);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateNestedSamples()
|
protected void UpdateNestedSamples()
|
||||||
|
@ -5,6 +5,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public class SliderRepeat : SliderEndCircle
|
public class SliderRepeat : SliderEndCircle
|
||||||
{
|
{
|
||||||
|
public double PathProgress { get; set; }
|
||||||
|
|
||||||
public SliderRepeat(Slider slider)
|
public SliderRepeat(Slider slider)
|
||||||
: base(slider)
|
: base(slider)
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public int SpanIndex { get; set; }
|
public int SpanIndex { get; set; }
|
||||||
public double SpanStartTime { get; set; }
|
public double SpanStartTime { get; set; }
|
||||||
|
public double PathProgress { get; set; }
|
||||||
|
|
||||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
@ -39,6 +40,7 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Screens.Edit.Setup;
|
using osu.Game.Screens.Edit.Setup;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu
|
namespace osu.Game.Rulesets.Osu
|
||||||
{
|
{
|
||||||
@ -336,10 +338,28 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<SetupSection> CreateEditorSetupSections() =>
|
public override IEnumerable<Drawable> CreateEditorSetupSections() =>
|
||||||
[
|
[
|
||||||
|
new MetadataSection(),
|
||||||
new OsuDifficultySection(),
|
new OsuDifficultySection(),
|
||||||
new ColoursSection(),
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(SetupScreen.SPACING),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new ResourcesSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
},
|
||||||
|
new ColoursSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new DesignSection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// <seealso cref="OsuHitObject.ApplyDefaultsToSelf"/>
|
/// <seealso cref="OsuHitObject.ApplyDefaultsToSelf"/>
|
||||||
|
@ -232,8 +232,6 @@ namespace osu.Game.Rulesets.Osu.Utils
|
|||||||
slider.Position = workingObject.PositionModified = new Vector2(newX, newY);
|
slider.Position = workingObject.PositionModified = new Vector2(newX, newY);
|
||||||
workingObject.EndPositionModified = slider.EndPosition;
|
workingObject.EndPositionModified = slider.EndPosition;
|
||||||
|
|
||||||
shiftNestedObjects(slider, workingObject.PositionModified - workingObject.PositionOriginal);
|
|
||||||
|
|
||||||
return workingObject.PositionModified - previousPosition;
|
return workingObject.PositionModified - previousPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,22 +305,6 @@ namespace osu.Game.Rulesets.Osu.Utils
|
|||||||
return new RectangleF(left, top, right - left, bottom - top);
|
return new RectangleF(left, top, right - left, bottom - top);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Shifts all nested <see cref="SliderTick"/>s and <see cref="SliderRepeat"/>s by the specified shift.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="slider"><see cref="Slider"/> whose nested <see cref="SliderTick"/>s and <see cref="SliderRepeat"/>s should be shifted</param>
|
|
||||||
/// <param name="shift">The <see cref="Vector2"/> the <see cref="Slider"/>'s nested <see cref="SliderTick"/>s and <see cref="SliderRepeat"/>s should be shifted by</param>
|
|
||||||
private static void shiftNestedObjects(Slider slider, Vector2 shift)
|
|
||||||
{
|
|
||||||
foreach (var hitObject in slider.NestedHitObjects.Where(o => o is SliderTick || o is SliderRepeat))
|
|
||||||
{
|
|
||||||
if (!(hitObject is OsuHitObject osuHitObject))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
osuHitObject.Position += shift;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clamp a position to playfield, keeping a specified distance from the edges.
|
/// Clamp a position to playfield, keeping a specified distance from the edges.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -431,7 +413,6 @@ namespace osu.Game.Rulesets.Osu.Utils
|
|||||||
private class WorkingObject
|
private class WorkingObject
|
||||||
{
|
{
|
||||||
public float RotationOriginal { get; }
|
public float RotationOriginal { get; }
|
||||||
public Vector2 PositionOriginal { get; }
|
|
||||||
public Vector2 PositionModified { get; set; }
|
public Vector2 PositionModified { get; set; }
|
||||||
public Vector2 EndPositionModified { get; set; }
|
public Vector2 EndPositionModified { get; set; }
|
||||||
|
|
||||||
@ -442,7 +423,7 @@ namespace osu.Game.Rulesets.Osu.Utils
|
|||||||
{
|
{
|
||||||
PositionInfo = positionInfo;
|
PositionInfo = positionInfo;
|
||||||
RotationOriginal = HitObject is Slider slider ? getSliderRotation(slider) : 0;
|
RotationOriginal = HitObject is Slider slider ? getSliderRotation(slider) : 0;
|
||||||
PositionModified = PositionOriginal = HitObject.Position;
|
PositionModified = HitObject.Position;
|
||||||
EndPositionModified = HitObject.EndPosition;
|
EndPositionModified = HitObject.EndPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ namespace osu.Game.Rulesets.Taiko.Edit.Setup
|
|||||||
{
|
{
|
||||||
public partial class TaikoDifficultySection : SetupSection
|
public partial class TaikoDifficultySection : SetupSection
|
||||||
{
|
{
|
||||||
private LabelledSliderBar<float> healthDrainSlider { get; set; } = null!;
|
private FormSliderBar<float> healthDrainSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
private FormSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
private FormSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> tickRateSlider { get; set; } = null!;
|
private FormSliderBar<double> tickRateSlider { get; set; } = null!;
|
||||||
|
|
||||||
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
||||||
|
|
||||||
@ -28,64 +28,68 @@ namespace osu.Game.Rulesets.Taiko.Edit.Setup
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
healthDrainSlider = new LabelledSliderBar<float>
|
healthDrainSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsDrain,
|
Caption = BeatmapsetsStrings.ShowStatsDrain,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.DrainRateDescription,
|
||||||
Description = EditorSetupStrings.DrainRateDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
overallDifficultySlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
overallDifficultySlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsAccuracy,
|
Caption = BeatmapsetsStrings.ShowStatsAccuracy,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.OverallDifficultyDescription,
|
||||||
Description = EditorSetupStrings.OverallDifficultyDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
baseVelocitySlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
baseVelocitySlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.BaseVelocity,
|
Caption = EditorSetupStrings.BaseVelocity,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.BaseVelocityDescription,
|
||||||
Description = EditorSetupStrings.BaseVelocityDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
||||||
{
|
{
|
||||||
Default = 1.4,
|
Default = 1.4,
|
||||||
MinValue = 0.4,
|
MinValue = 0.4,
|
||||||
MaxValue = 3.6,
|
MaxValue = 3.6,
|
||||||
Precision = 0.01f,
|
Precision = 0.01f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
tickRateSlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
tickRateSlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.TickRate,
|
Caption = EditorSetupStrings.TickRate,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.TickRateDescription,
|
||||||
Description = EditorSetupStrings.TickRateDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
||||||
{
|
{
|
||||||
Default = 1,
|
Default = 1,
|
||||||
MinValue = 1,
|
MinValue = 1,
|
||||||
MaxValue = 4,
|
MaxValue = 4,
|
||||||
Precision = 1,
|
Precision = 1,
|
||||||
}
|
},
|
||||||
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledSliderBar<float>>())
|
foreach (var item in Children.OfType<FormSliderBar<float>>())
|
||||||
item.Current.ValueChanged += _ => updateValues();
|
item.Current.ValueChanged += _ => updateValues();
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledSliderBar<double>>())
|
foreach (var item in Children.OfType<FormSliderBar<double>>())
|
||||||
item.Current.ValueChanged += _ => updateValues();
|
item.Current.ValueChanged += _ => updateValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -86,10 +87,22 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
|||||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<HitObject>> selection)
|
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<HitObject>> selection)
|
||||||
{
|
{
|
||||||
if (selection.All(s => s.Item is Hit))
|
if (selection.All(s => s.Item is Hit))
|
||||||
yield return new TernaryStateToggleMenuItem("Rim") { State = { BindTarget = selectionRimState } };
|
{
|
||||||
|
yield return new TernaryStateToggleMenuItem("Rim")
|
||||||
|
{
|
||||||
|
State = { BindTarget = selectionRimState },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.W), new KeyCombination(InputKey.R)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (selection.All(s => s.Item is TaikoHitObject))
|
if (selection.All(s => s.Item is TaikoHitObject))
|
||||||
yield return new TernaryStateToggleMenuItem("Strong") { State = { BindTarget = selectionStrongState } };
|
{
|
||||||
|
yield return new TernaryStateToggleMenuItem("Strong")
|
||||||
|
{
|
||||||
|
State = { BindTarget = selectionStrongState },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.E)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in base.GetContextMenuItemsForSelection(selection))
|
foreach (var item in base.GetContextMenuItemsForSelection(selection))
|
||||||
yield return item;
|
yield return item;
|
||||||
|
@ -190,9 +190,12 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
|
|
||||||
public override HitObjectComposer CreateHitObjectComposer() => new TaikoHitObjectComposer(this);
|
public override HitObjectComposer CreateHitObjectComposer() => new TaikoHitObjectComposer(this);
|
||||||
|
|
||||||
public override IEnumerable<SetupSection> CreateEditorSetupSections() =>
|
public override IEnumerable<Drawable> CreateEditorSetupSections() =>
|
||||||
[
|
[
|
||||||
|
new MetadataSection(),
|
||||||
new TaikoDifficultySection(),
|
new TaikoDifficultySection(),
|
||||||
|
new ResourcesSection(),
|
||||||
|
new DesignSection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
public override IBeatmapVerifier CreateBeatmapVerifier() => new TaikoBeatmapVerifier();
|
public override IBeatmapVerifier CreateBeatmapVerifier() => new TaikoBeatmapVerifier();
|
||||||
|
@ -267,23 +267,26 @@ namespace osu.Game.Tests.Editing
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestUseCurrentSnap()
|
public void TestUseCurrentSnap()
|
||||||
{
|
{
|
||||||
|
ExpandableButton getCurrentSnapButton() => composer.ChildrenOfType<EditorToolboxGroup>().Single(g => g.Name == "snapping")
|
||||||
|
.ChildrenOfType<ExpandableButton>().Single();
|
||||||
|
|
||||||
AddStep("add objects to beatmap", () =>
|
AddStep("add objects to beatmap", () =>
|
||||||
{
|
{
|
||||||
editorBeatmap.Add(new HitCircle { StartTime = 1000 });
|
editorBeatmap.Add(new HitCircle { StartTime = 1000 });
|
||||||
editorBeatmap.Add(new HitCircle { Position = new Vector2(100), StartTime = 2000 });
|
editorBeatmap.Add(new HitCircle { Position = new Vector2(100), StartTime = 2000 });
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("hover use current snap button", () => InputManager.MoveMouseTo(composer.ChildrenOfType<ExpandableButton>().Single()));
|
AddStep("hover use current snap button", () => InputManager.MoveMouseTo(getCurrentSnapButton()));
|
||||||
AddUntilStep("use current snap expanded", () => composer.ChildrenOfType<ExpandableButton>().Single().Expanded.Value, () => Is.True);
|
AddUntilStep("use current snap expanded", () => getCurrentSnapButton().Expanded.Value, () => Is.True);
|
||||||
|
|
||||||
AddStep("seek before first object", () => EditorClock.Seek(0));
|
AddStep("seek before first object", () => EditorClock.Seek(0));
|
||||||
AddUntilStep("use current snap not available", () => composer.ChildrenOfType<ExpandableButton>().Single().Enabled.Value, () => Is.False);
|
AddUntilStep("use current snap not available", () => getCurrentSnapButton().Enabled.Value, () => Is.False);
|
||||||
|
|
||||||
AddStep("seek to between objects", () => EditorClock.Seek(1500));
|
AddStep("seek to between objects", () => EditorClock.Seek(1500));
|
||||||
AddUntilStep("use current snap available", () => composer.ChildrenOfType<ExpandableButton>().Single().Enabled.Value, () => Is.True);
|
AddUntilStep("use current snap available", () => getCurrentSnapButton().Enabled.Value, () => Is.True);
|
||||||
|
|
||||||
AddStep("seek after last object", () => EditorClock.Seek(2500));
|
AddStep("seek after last object", () => EditorClock.Seek(2500));
|
||||||
AddUntilStep("use current snap not available", () => composer.ChildrenOfType<ExpandableButton>().Single().Enabled.Value, () => Is.False);
|
AddUntilStep("use current snap not available", () => getCurrentSnapButton().Enabled.Value, () => Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertSnapDistance(float expectedDistance, HitObject? referenceObject, bool includeSliderVelocity)
|
private void assertSnapDistance(float expectedDistance, HitObject? referenceObject, bool includeSliderVelocity)
|
||||||
|
123
osu.Game.Tests/Visual/Editing/TestSceneColoursSection.cs
Normal file
123
osu.Game.Tests/Visual/Editing/TestSceneColoursSection.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
|
using osu.Game.Screens.Edit.Setup;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
|
{
|
||||||
|
[HeadlessTest]
|
||||||
|
public partial class TestSceneColoursSection : OsuManualInputManagerTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestNoBeatmapSkinColours()
|
||||||
|
{
|
||||||
|
LegacyBeatmapSkin skin = null!;
|
||||||
|
ColoursSection coloursSection = null!;
|
||||||
|
|
||||||
|
AddStep("create beatmap skin", () => skin = new LegacyBeatmapSkin(new BeatmapInfo(), null));
|
||||||
|
AddStep("create colours section", () => Child = new DependencyProvidingContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
CachedDependencies =
|
||||||
|
[
|
||||||
|
(typeof(EditorBeatmap), new EditorBeatmap(new Beatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo }
|
||||||
|
}, skin)),
|
||||||
|
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Aquamarine))
|
||||||
|
],
|
||||||
|
Child = coloursSection = new ColoursSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AddAssert("beatmap skin has no colours", () => skin.Configuration.CustomComboColours, () => Is.Empty);
|
||||||
|
AddAssert("section displays default combo colours",
|
||||||
|
() => coloursSection.ChildrenOfType<FormColourPalette>().Single().Colours,
|
||||||
|
() => Is.EquivalentTo(new Colour4[]
|
||||||
|
{
|
||||||
|
SkinConfiguration.DefaultComboColours[1],
|
||||||
|
SkinConfiguration.DefaultComboColours[2],
|
||||||
|
SkinConfiguration.DefaultComboColours[3],
|
||||||
|
SkinConfiguration.DefaultComboColours[0],
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("add a colour", () => coloursSection.ChildrenOfType<FormColourPalette>().Single().Colours.Add(Colour4.Aqua));
|
||||||
|
AddAssert("beatmap skin has colours",
|
||||||
|
() => skin.Configuration.CustomComboColours,
|
||||||
|
() => Is.EquivalentTo(new[]
|
||||||
|
{
|
||||||
|
SkinConfiguration.DefaultComboColours[1],
|
||||||
|
SkinConfiguration.DefaultComboColours[2],
|
||||||
|
SkinConfiguration.DefaultComboColours[3],
|
||||||
|
Color4.Aqua,
|
||||||
|
SkinConfiguration.DefaultComboColours[0],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestExistingColours()
|
||||||
|
{
|
||||||
|
LegacyBeatmapSkin skin = null!;
|
||||||
|
ColoursSection coloursSection = null!;
|
||||||
|
|
||||||
|
AddStep("create beatmap skin", () =>
|
||||||
|
{
|
||||||
|
skin = new LegacyBeatmapSkin(new BeatmapInfo(), null);
|
||||||
|
skin.Configuration.CustomComboColours = new List<Color4>
|
||||||
|
{
|
||||||
|
Color4.Azure,
|
||||||
|
Color4.Beige,
|
||||||
|
Color4.Chartreuse
|
||||||
|
};
|
||||||
|
});
|
||||||
|
AddStep("create colours section", () => Child = new DependencyProvidingContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
CachedDependencies =
|
||||||
|
[
|
||||||
|
(typeof(EditorBeatmap), new EditorBeatmap(new Beatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo }
|
||||||
|
}, skin)),
|
||||||
|
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Aquamarine))
|
||||||
|
],
|
||||||
|
Child = coloursSection = new ColoursSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AddAssert("section displays combo colours",
|
||||||
|
() => coloursSection.ChildrenOfType<FormColourPalette>().Single().Colours,
|
||||||
|
() => Is.EquivalentTo(new[]
|
||||||
|
{
|
||||||
|
Colour4.Beige,
|
||||||
|
Colour4.Chartreuse,
|
||||||
|
Colour4.Azure,
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("add a colour", () => coloursSection.ChildrenOfType<FormColourPalette>().Single().Colours.Add(Colour4.Aqua));
|
||||||
|
AddAssert("beatmap skin has colours",
|
||||||
|
() => skin.Configuration.CustomComboColours,
|
||||||
|
() => Is.EquivalentTo(new[]
|
||||||
|
{
|
||||||
|
Color4.Azure,
|
||||||
|
Color4.Beige,
|
||||||
|
Color4.Aqua,
|
||||||
|
Color4.Chartreuse
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -82,7 +83,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNudgeSelection()
|
public void TestNudgeSelectionTime()
|
||||||
{
|
{
|
||||||
HitCircle[] addedObjects = null!;
|
HitCircle[] addedObjects = null!;
|
||||||
|
|
||||||
@ -103,6 +104,51 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("objects reverted to original position", () => addedObjects[0].StartTime == 100);
|
AddAssert("objects reverted to original position", () => addedObjects[0].StartTime == 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNudgeSelectionPosition()
|
||||||
|
{
|
||||||
|
HitCircle addedObject = null!;
|
||||||
|
|
||||||
|
AddStep("add hitobjects", () => EditorBeatmap.AddRange(new[]
|
||||||
|
{
|
||||||
|
addedObject = new HitCircle { StartTime = 200, Position = new Vector2(100) },
|
||||||
|
}));
|
||||||
|
|
||||||
|
AddStep("select object", () => EditorBeatmap.SelectedHitObjects.Add(addedObject));
|
||||||
|
|
||||||
|
AddStep("nudge up", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.Key(Key.Up);
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
});
|
||||||
|
AddAssert("object position moved up", () => addedObject.Position.Y, () => Is.EqualTo(99).Within(Precision.FLOAT_EPSILON));
|
||||||
|
|
||||||
|
AddStep("nudge down", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.Key(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
});
|
||||||
|
AddAssert("object position moved down", () => addedObject.Position.Y, () => Is.EqualTo(100).Within(Precision.FLOAT_EPSILON));
|
||||||
|
|
||||||
|
AddStep("nudge left", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.Key(Key.Left);
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
});
|
||||||
|
AddAssert("object position moved left", () => addedObject.Position.X, () => Is.EqualTo(99).Within(Precision.FLOAT_EPSILON));
|
||||||
|
|
||||||
|
AddStep("nudge right", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.Key(Key.Right);
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
});
|
||||||
|
AddAssert("object position moved right", () => addedObject.Position.X, () => Is.EqualTo(100).Within(Precision.FLOAT_EPSILON));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRotateHotkeys()
|
public void TestRotateHotkeys()
|
||||||
{
|
{
|
||||||
|
@ -7,12 +7,14 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Setup;
|
using osu.Game.Screens.Edit.Setup;
|
||||||
@ -25,6 +27,9 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
private TestDesignSection designSection;
|
private TestDesignSection designSection;
|
||||||
private EditorBeatmap editorBeatmap { get; set; }
|
private EditorBeatmap editorBeatmap { get; set; }
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
@ -42,7 +47,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
(typeof(EditorBeatmap), editorBeatmap)
|
(typeof(EditorBeatmap), editorBeatmap)
|
||||||
},
|
},
|
||||||
Child = designSection = new TestDesignSection()
|
Child = designSection = new TestDesignSection { RelativeSizeAxes = Axes.X }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,11 +104,11 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
private partial class TestDesignSection : DesignSection
|
private partial class TestDesignSection : DesignSection
|
||||||
{
|
{
|
||||||
public new LabelledSwitchButton EnableCountdown => base.EnableCountdown;
|
public new FormCheckBox EnableCountdown => base.EnableCountdown;
|
||||||
|
|
||||||
public new FillFlowContainer CountdownSettings => base.CountdownSettings;
|
public new FillFlowContainer CountdownSettings => base.CountdownSettings;
|
||||||
public new LabelledEnumDropdown<CountdownType> CountdownSpeed => base.CountdownSpeed;
|
public new FormEnumDropdown<CountdownType> CountdownSpeed => base.CountdownSpeed;
|
||||||
public new LabelledNumberBox CountdownOffset => base.CountdownOffset;
|
public new FormTextBox CountdownOffset => base.CountdownOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
|
using osu.Game.Screens.Edit.Components.Menus;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Tests.Beatmaps.IO;
|
using osu.Game.Tests.Beatmaps.IO;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -60,7 +61,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
beatmapSetHashBefore = Beatmap.Value.BeatmapSetInfo.Hash;
|
beatmapSetHashBefore = Beatmap.Value.BeatmapSetInfo.Hash;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("click File", () => this.ChildrenOfType<DrawableOsuMenuItem>().First().TriggerClick());
|
AddStep("click File", () => this.ChildrenOfType<EditorMenuBar.DrawableEditorBarMenuItem>().First().TriggerClick());
|
||||||
|
|
||||||
if (i == 11)
|
if (i == 11)
|
||||||
{
|
{
|
||||||
@ -107,7 +108,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
EditorBeatmap.EndChange();
|
EditorBeatmap.EndChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("click File", () => this.ChildrenOfType<DrawableOsuMenuItem>().First().TriggerClick());
|
AddStep("click File", () => this.ChildrenOfType<EditorMenuBar.DrawableEditorBarMenuItem>().First().TriggerClick());
|
||||||
|
|
||||||
AddStep("click delete", () => getDeleteMenuItem().TriggerClick());
|
AddStep("click delete", () => getDeleteMenuItem().TriggerClick());
|
||||||
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
@ -135,9 +137,42 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
pressAndCheckTime(Key.Up, 0);
|
pressAndCheckTime(Key.Up, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pressAndCheckTime(Key key, double expectedTime)
|
[Test]
|
||||||
|
public void TestSeekBetweenObjects()
|
||||||
{
|
{
|
||||||
AddStep($"press {key}", () => InputManager.Key(key));
|
AddStep("add objects", () =>
|
||||||
|
{
|
||||||
|
EditorBeatmap.Clear();
|
||||||
|
EditorBeatmap.AddRange(new[]
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000, },
|
||||||
|
new HitCircle { StartTime = 2250, },
|
||||||
|
new HitCircle { StartTime = 3600, },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
AddStep("seek to 0", () => EditorClock.Seek(0));
|
||||||
|
|
||||||
|
pressAndCheckTime(Key.Right, 1000, Key.ControlLeft);
|
||||||
|
pressAndCheckTime(Key.Right, 2250, Key.ControlLeft);
|
||||||
|
pressAndCheckTime(Key.Right, 3600, Key.ControlLeft);
|
||||||
|
pressAndCheckTime(Key.Right, 3600, Key.ControlLeft);
|
||||||
|
pressAndCheckTime(Key.Left, 2250, Key.ControlLeft);
|
||||||
|
pressAndCheckTime(Key.Left, 1000, Key.ControlLeft);
|
||||||
|
pressAndCheckTime(Key.Left, 1000, Key.ControlLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pressAndCheckTime(Key key, double expectedTime, params Key[] modifiers)
|
||||||
|
{
|
||||||
|
AddStep($"press {key} with {(modifiers.Any() ? string.Join(',', modifiers) : "no modifiers")}", () =>
|
||||||
|
{
|
||||||
|
foreach (var modifier in modifiers)
|
||||||
|
InputManager.PressKey(modifier);
|
||||||
|
|
||||||
|
InputManager.Key(key);
|
||||||
|
|
||||||
|
foreach (var modifier in modifiers)
|
||||||
|
InputManager.ReleaseKey(modifier);
|
||||||
|
});
|
||||||
AddUntilStep($"time is {expectedTime}", () => EditorClock.CurrentTime, () => Is.EqualTo(expectedTime).Within(1));
|
AddUntilStep($"time is {expectedTime}", () => EditorClock.CurrentTime, () => Is.EqualTo(expectedTime).Within(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,13 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Setup;
|
using osu.Game.Screens.Edit.Setup;
|
||||||
@ -20,6 +22,9 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
public partial class TestSceneMetadataSection : OsuManualInputManagerTestScene
|
public partial class TestSceneMetadataSection : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private EditorBeatmap editorBeatmap = new EditorBeatmap(new Beatmap
|
private EditorBeatmap editorBeatmap = new EditorBeatmap(new Beatmap
|
||||||
{
|
{
|
||||||
@ -201,7 +206,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createSection()
|
private void createSection()
|
||||||
=> AddStep("create metadata section", () => Child = metadataSection = new TestMetadataSection());
|
=> AddStep("create metadata section", () => Child = metadataSection = new TestMetadataSection { RelativeSizeAxes = Axes.X });
|
||||||
|
|
||||||
private void assertArtistMetadata(string expected)
|
private void assertArtistMetadata(string expected)
|
||||||
=> AddAssert($"artist metadata is {expected}", () => editorBeatmap.Metadata.Artist, () => Is.EqualTo(expected));
|
=> AddAssert($"artist metadata is {expected}", () => editorBeatmap.Metadata.Artist, () => Is.EqualTo(expected));
|
||||||
@ -226,11 +231,11 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
private partial class TestMetadataSection : MetadataSection
|
private partial class TestMetadataSection : MetadataSection
|
||||||
{
|
{
|
||||||
public new LabelledTextBox ArtistTextBox => base.ArtistTextBox;
|
public new FormTextBox ArtistTextBox => base.ArtistTextBox;
|
||||||
public new LabelledTextBox RomanisedArtistTextBox => base.RomanisedArtistTextBox;
|
public new FormTextBox RomanisedArtistTextBox => base.RomanisedArtistTextBox;
|
||||||
|
|
||||||
public new LabelledTextBox TitleTextBox => base.TitleTextBox;
|
public new FormTextBox TitleTextBox => base.TitleTextBox;
|
||||||
public new LabelledTextBox RomanisedTitleTextBox => base.RomanisedTitleTextBox;
|
public new FormTextBox RomanisedTitleTextBox => base.RomanisedTitleTextBox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
{
|
{
|
||||||
Queue<(IWorkingBeatmap working, TrackChangeDirection changeDirection)> trackChangeQueue = null!;
|
Queue<(IWorkingBeatmap working, TrackChangeDirection changeDirection)> trackChangeQueue = null!;
|
||||||
|
|
||||||
|
AddStep("disable shuffle", () => Game.MusicController.Shuffle.Value = false);
|
||||||
|
|
||||||
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
||||||
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(TestResources.CreateTestBeatmapSetInfo()), 5);
|
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(TestResources.CreateTestBeatmapSetInfo()), 5);
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
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.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Comments;
|
using osu.Game.Overlays.Comments;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -28,9 +29,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
private TestCancellableCommentEditor cancellableCommentEditor = null!;
|
private TestCancellableCommentEditor cancellableCommentEditor = null!;
|
||||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||||
|
|
||||||
[SetUp]
|
[SetUpSteps]
|
||||||
public void SetUp() => Schedule(() =>
|
public void SetUpSteps()
|
||||||
Add(new FillFlowContainer
|
{
|
||||||
|
AddStep("create content", () => Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -43,7 +45,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
commentEditor = new TestCommentEditor(),
|
commentEditor = new TestCommentEditor(),
|
||||||
cancellableCommentEditor = new TestCancellableCommentEditor()
|
cancellableCommentEditor = new TestCancellableCommentEditor()
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCommitViaKeyboard()
|
public void TestCommitViaKeyboard()
|
||||||
@ -133,6 +136,34 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
assertLoggedInState();
|
assertLoggedInState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCommentsDisabled()
|
||||||
|
{
|
||||||
|
AddStep("no reason for disable", () => commentEditor.CommentableMeta.Value = new CommentableMeta
|
||||||
|
{
|
||||||
|
CurrentUserAttributes = new CommentableMeta.CommentableCurrentUserAttributes(),
|
||||||
|
});
|
||||||
|
AddAssert("textbox enabled", () => commentEditor.ChildrenOfType<TextBox>().Single().ReadOnly, () => Is.False);
|
||||||
|
|
||||||
|
AddStep("specific reason for disable", () => commentEditor.CommentableMeta.Value = new CommentableMeta
|
||||||
|
{
|
||||||
|
CurrentUserAttributes = new CommentableMeta.CommentableCurrentUserAttributes
|
||||||
|
{
|
||||||
|
CanNewCommentReason = "This comment section is disabled. For reasons.",
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AddAssert("textbox disabled", () => commentEditor.ChildrenOfType<TextBox>().Single().ReadOnly, () => Is.True);
|
||||||
|
|
||||||
|
AddStep("entire commentable meta missing", () => commentEditor.CommentableMeta.Value = null);
|
||||||
|
AddAssert("textbox enabled", () => commentEditor.ChildrenOfType<TextBox>().Single().ReadOnly, () => Is.False);
|
||||||
|
|
||||||
|
AddStep("current user attributes missing", () => commentEditor.CommentableMeta.Value = new CommentableMeta
|
||||||
|
{
|
||||||
|
CurrentUserAttributes = null,
|
||||||
|
});
|
||||||
|
AddAssert("textbox enabled", () => commentEditor.ChildrenOfType<TextBox>().Single().ReadOnly, () => Is.True);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCancelAction()
|
public void TestCancelAction()
|
||||||
{
|
{
|
||||||
@ -167,8 +198,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
protected override LocalisableString GetButtonText(bool isLoggedIn) =>
|
protected override LocalisableString GetButtonText(bool isLoggedIn) =>
|
||||||
isLoggedIn ? @"Commit" : "You're logged out!";
|
isLoggedIn ? @"Commit" : "You're logged out!";
|
||||||
|
|
||||||
protected override LocalisableString GetPlaceholderText(bool isLoggedIn) =>
|
protected override LocalisableString GetPlaceholderText() => @"This text box is empty";
|
||||||
isLoggedIn ? @"This text box is empty" : "Still empty, but now you can't type in it.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class TestCancellableCommentEditor : CancellableCommentEditor
|
private partial class TestCancellableCommentEditor : CancellableCommentEditor
|
||||||
@ -189,7 +219,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override LocalisableString GetButtonText(bool isLoggedIn) => @"Save";
|
protected override LocalisableString GetButtonText(bool isLoggedIn) => @"Save";
|
||||||
protected override LocalisableString GetPlaceholderText(bool isLoggedIn) => @"Multiline textboxes soon";
|
protected override LocalisableString GetPlaceholderText() => @"Multiline textboxes soon";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
},
|
},
|
||||||
new FormSliderBar<float>
|
new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Caption = "Instantaneous slider",
|
Caption = "Slider",
|
||||||
Current = new BindableFloat
|
Current = new BindableFloat
|
||||||
{
|
{
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
@ -82,19 +82,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
},
|
},
|
||||||
TabbableContentContainer = this,
|
TabbableContentContainer = this,
|
||||||
},
|
},
|
||||||
new FormSliderBar<float>
|
|
||||||
{
|
|
||||||
Caption = "Non-instantaneous slider",
|
|
||||||
Current = new BindableFloat
|
|
||||||
{
|
|
||||||
MinValue = 0,
|
|
||||||
MaxValue = 10,
|
|
||||||
Value = 5,
|
|
||||||
Precision = 0.1f,
|
|
||||||
},
|
|
||||||
Instantaneous = false,
|
|
||||||
TabbableContentContainer = this,
|
|
||||||
},
|
|
||||||
new FormEnumDropdown<CountdownType>
|
new FormEnumDropdown<CountdownType>
|
||||||
{
|
{
|
||||||
Caption = EditorSetupStrings.EnableCountdown,
|
Caption = EditorSetupStrings.EnableCountdown,
|
||||||
@ -105,6 +92,17 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Caption = "Audio file",
|
Caption = "Audio file",
|
||||||
PlaceholderText = "Select an audio file",
|
PlaceholderText = "Select an audio file",
|
||||||
},
|
},
|
||||||
|
new FormColourPalette
|
||||||
|
{
|
||||||
|
Caption = "Combo colours",
|
||||||
|
Colours =
|
||||||
|
{
|
||||||
|
Colour4.Red,
|
||||||
|
Colour4.Green,
|
||||||
|
Colour4.Blue,
|
||||||
|
Colour4.Yellow,
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public partial class TestSceneFormSliderBar : OsuTestScene
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTransferValueOnCommit()
|
||||||
|
{
|
||||||
|
OsuSpriteText text;
|
||||||
|
FormSliderBar<float> slider = null!;
|
||||||
|
|
||||||
|
AddStep("create content", () =>
|
||||||
|
{
|
||||||
|
Child = new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 0.5f,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
text = new OsuSpriteText(),
|
||||||
|
slider = new FormSliderBar<float>
|
||||||
|
{
|
||||||
|
Caption = "Slider",
|
||||||
|
Current = new BindableFloat
|
||||||
|
{
|
||||||
|
MinValue = 0,
|
||||||
|
MaxValue = 10,
|
||||||
|
Precision = 0.1f,
|
||||||
|
Default = 5f,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
slider.Current.BindValueChanged(_ => text.Text = $"Current value is: {slider.Current.Value}", true);
|
||||||
|
});
|
||||||
|
AddToggleStep("toggle transfer value on commit", b =>
|
||||||
|
{
|
||||||
|
if (slider.IsNotNull())
|
||||||
|
slider.TransferValueOnCommit = b;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
// 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 osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public partial class TestSceneHotkeyDisplay : ThemeComparisonTestScene
|
||||||
|
{
|
||||||
|
protected override Drawable CreateContent() => new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new HotkeyDisplay { Hotkey = new Hotkey(new KeyCombination(InputKey.MouseLeft)) },
|
||||||
|
new HotkeyDisplay { Hotkey = new Hotkey(GlobalAction.EditorDecreaseDistanceSpacing) },
|
||||||
|
new HotkeyDisplay { Hotkey = new Hotkey(PlatformAction.Save) },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -183,7 +183,14 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
#region Beatmap
|
#region Beatmap
|
||||||
|
|
||||||
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
public virtual bool BeatmapLoaded
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (beatmapFetchLock)
|
||||||
|
return beatmapLoadTask?.IsCompleted ?? false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IBeatmap Beatmap
|
public IBeatmap Beatmap
|
||||||
{
|
{
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -20,12 +22,15 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public partial class DrawableOsuMenuItem : Menu.DrawableMenuItem
|
public partial class DrawableOsuMenuItem : Menu.DrawableMenuItem
|
||||||
{
|
{
|
||||||
public const int MARGIN_HORIZONTAL = 17;
|
public const int MARGIN_HORIZONTAL = 10;
|
||||||
public const int MARGIN_VERTICAL = 4;
|
public const int MARGIN_VERTICAL = 4;
|
||||||
private const int text_size = 17;
|
public const int TEXT_SIZE = 17;
|
||||||
private const int transition_length = 80;
|
public const int TRANSITION_LENGTH = 80;
|
||||||
|
|
||||||
|
public BindableBool ShowCheckbox { get; } = new BindableBool();
|
||||||
|
|
||||||
private TextContainer text;
|
private TextContainer text;
|
||||||
|
private HotkeyDisplay hotkey;
|
||||||
private HoverClickSounds hoverClickSounds;
|
private HoverClickSounds hoverClickSounds;
|
||||||
|
|
||||||
public DrawableOsuMenuItem(MenuItem item)
|
public DrawableOsuMenuItem(MenuItem item)
|
||||||
@ -39,43 +44,47 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
BackgroundColour = Color4.Transparent;
|
BackgroundColour = Color4.Transparent;
|
||||||
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
BackgroundColourHover = Color4Extensions.FromHex(@"172023");
|
||||||
|
|
||||||
|
AddInternal(hotkey = new HotkeyDisplay
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Margin = new MarginPadding { Right = 10, Top = 1 },
|
||||||
|
});
|
||||||
AddInternal(hoverClickSounds = new HoverClickSounds());
|
AddInternal(hoverClickSounds = new HoverClickSounds());
|
||||||
|
|
||||||
updateTextColour();
|
updateText();
|
||||||
|
|
||||||
bool hasSubmenu = Item.Items.Any();
|
if (showChevron)
|
||||||
|
|
||||||
// Only add right chevron if direction of menu items is vertical (i.e. width is relative size, see `DrawableMenuItem.SetFlowDirection()`).
|
|
||||||
if (hasSubmenu && RelativeSizeAxes == Axes.X)
|
|
||||||
{
|
{
|
||||||
AddInternal(new SpriteIcon
|
AddInternal(new SpriteIcon
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding(6),
|
Margin = new MarginPadding { Horizontal = 10, },
|
||||||
Size = new Vector2(8),
|
Size = new Vector2(8),
|
||||||
Icon = FontAwesome.Solid.ChevronRight,
|
Icon = FontAwesome.Solid.ChevronRight,
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
text.Padding = new MarginPadding
|
// Only add right chevron if direction of menu items is vertical (i.e. width is relative size, see `DrawableMenuItem.SetFlowDirection()`).
|
||||||
{
|
private bool showChevron => Item.Items.Any() && RelativeSizeAxes == Axes.X;
|
||||||
// Add some padding for the chevron above.
|
|
||||||
Right = 5,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
ShowCheckbox.BindValueChanged(_ => updateState());
|
||||||
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
||||||
FinishTransforms();
|
FinishTransforms();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTextColour()
|
private void updateText()
|
||||||
{
|
{
|
||||||
switch ((Item as OsuMenuItem)?.Type)
|
var osuMenuItem = Item as OsuMenuItem;
|
||||||
|
|
||||||
|
switch (osuMenuItem?.Type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case MenuItemType.Standard:
|
case MenuItemType.Standard:
|
||||||
@ -90,6 +99,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
text.Colour = Color4Extensions.FromHex(@"ffcc22");
|
text.Colour = Color4Extensions.FromHex(@"ffcc22");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hotkey.Hotkey = osuMenuItem?.Hotkey ?? default;
|
||||||
|
hotkey.Alpha = EqualityComparer<Hotkey>.Default.Equals(hotkey.Hotkey, default) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
// this hack ensures that the menu can auto-size while leaving enough space for the hotkey display.
|
||||||
|
// the gist of it is that while the hotkey display is not in the text / "content" that determines sizing
|
||||||
|
// (because it cannot be, because we want the hotkey display to align to the *right* and not the left),
|
||||||
|
// enough padding to fit the hotkey with _its_ spacing is added as padding of the text to compensate.
|
||||||
|
text.Padding = new MarginPadding { Right = hotkey.Alpha > 0 || showChevron ? hotkey.DrawWidth + 15 : 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
@ -111,14 +134,16 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
if (IsHovered && IsActionable)
|
if (IsHovered && IsActionable)
|
||||||
{
|
{
|
||||||
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
text.BoldText.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
text.NormalText.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text.BoldText.FadeOut(transition_length, Easing.OutQuint);
|
text.BoldText.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
text.NormalText.FadeIn(transition_length, Easing.OutQuint);
|
text.NormalText.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
text.CheckboxContainer.Alpha = ShowCheckbox.Value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sealed override Drawable CreateContent() => text = CreateTextContainer();
|
protected sealed override Drawable CreateContent() => text = CreateTextContainer();
|
||||||
@ -138,14 +163,34 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
public readonly SpriteText NormalText;
|
public readonly SpriteText NormalText;
|
||||||
public readonly SpriteText BoldText;
|
public readonly SpriteText BoldText;
|
||||||
|
public readonly Container CheckboxContainer;
|
||||||
|
|
||||||
public TextContainer()
|
public TextContainer()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft;
|
|
||||||
Origin = Anchor.CentreLeft;
|
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Child = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Padding = new MarginPadding { Horizontal = MARGIN_HORIZONTAL, Vertical = MARGIN_VERTICAL, },
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
CheckboxContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = MARGIN_HORIZONTAL,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
NormalText = new OsuSpriteText
|
NormalText = new OsuSpriteText
|
||||||
@ -153,8 +198,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AlwaysPresent = true, // ensures that the menu item does not change width when switching between normal and bold text.
|
AlwaysPresent = true, // ensures that the menu item does not change width when switching between normal and bold text.
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Font = OsuFont.GetFont(size: text_size),
|
Font = OsuFont.GetFont(size: TEXT_SIZE),
|
||||||
Margin = new MarginPadding { Horizontal = MARGIN_HORIZONTAL, Vertical = MARGIN_VERTICAL },
|
|
||||||
},
|
},
|
||||||
BoldText = new OsuSpriteText
|
BoldText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
@ -162,8 +206,10 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
|
||||||
Margin = new MarginPadding { Horizontal = MARGIN_HORIZONTAL, Vertical = MARGIN_VERTICAL },
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
state = menuItem.State.GetBoundCopy();
|
state = menuItem.State.GetBoundCopy();
|
||||||
|
|
||||||
Add(stateIcon = new SpriteIcon
|
CheckboxContainer.Add(stateIcon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(10),
|
Size = new Vector2(10),
|
||||||
Margin = new MarginPadding { Horizontal = MARGIN_HORIZONTAL },
|
|
||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -62,14 +61,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
state.BindValueChanged(updateState, true);
|
state.BindValueChanged(updateState, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
// Todo: This is bad. This can maybe be done better with a refactor of DrawableOsuMenuItem.
|
|
||||||
stateIcon.X = BoldText.DrawWidth + 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateState(ValueChangedEvent<object> state)
|
private void updateState(ValueChangedEvent<object> state)
|
||||||
{
|
{
|
||||||
var icon = menuItem.GetIconForState(state.NewValue);
|
var icon = menuItem.GetIconForState(state.NewValue);
|
||||||
|
59
osu.Game/Graphics/UserInterface/Hotkey.cs
Normal file
59
osu.Game/Graphics/UserInterface/Hotkey.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// 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.Input;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Input;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public readonly record struct Hotkey
|
||||||
|
{
|
||||||
|
public KeyCombination[]? KeyCombinations { get; init; }
|
||||||
|
public GlobalAction? GlobalAction { get; init; }
|
||||||
|
public PlatformAction? PlatformAction { get; init; }
|
||||||
|
|
||||||
|
public Hotkey(params KeyCombination[] keyCombinations)
|
||||||
|
{
|
||||||
|
KeyCombinations = keyCombinations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hotkey(GlobalAction globalAction)
|
||||||
|
{
|
||||||
|
GlobalAction = globalAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Hotkey(PlatformAction platformAction)
|
||||||
|
{
|
||||||
|
PlatformAction = platformAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> ResolveKeyCombination(ReadableKeyCombinationProvider keyCombinationProvider, RealmKeyBindingStore keyBindingStore, GameHost gameHost)
|
||||||
|
{
|
||||||
|
var result = new List<string>();
|
||||||
|
|
||||||
|
if (KeyCombinations != null)
|
||||||
|
{
|
||||||
|
result.AddRange(KeyCombinations.Select(keyCombinationProvider.GetReadableString));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GlobalAction != null)
|
||||||
|
{
|
||||||
|
result.AddRange(keyBindingStore.GetReadableKeyCombinationsFor(GlobalAction.Value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlatformAction != null)
|
||||||
|
{
|
||||||
|
var action = PlatformAction.Value;
|
||||||
|
var bindings = gameHost.PlatformKeyBindings.Where(kb => (PlatformAction)kb.Action == action);
|
||||||
|
result.AddRange(bindings.Select(b => keyCombinationProvider.GetReadableString(b.KeyCombination)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
110
osu.Game/Graphics/UserInterface/HotkeyDisplay.cs
Normal file
110
osu.Game/Graphics/UserInterface/HotkeyDisplay.cs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
// 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 osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Input;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public partial class HotkeyDisplay : CompositeDrawable
|
||||||
|
{
|
||||||
|
private Hotkey hotkey;
|
||||||
|
|
||||||
|
public Hotkey Hotkey
|
||||||
|
{
|
||||||
|
get => hotkey;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (EqualityComparer<Hotkey>.Default.Equals(hotkey, value))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hotkey = value;
|
||||||
|
|
||||||
|
if (IsLoaded)
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FillFlowContainer flow = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private ReadableKeyCombinationProvider readableKeyCombinationProvider { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RealmKeyBindingStore realmKeyBindingStore { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameHost gameHost { get; set; } = null!;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = flow = new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5)
|
||||||
|
};
|
||||||
|
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
flow.Clear();
|
||||||
|
foreach (string h in hotkey.ResolveKeyCombination(readableKeyCombinationProvider, realmKeyBindingStore, gameHost))
|
||||||
|
flow.Add(new HotkeyBox(h));
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class HotkeyBox : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly string hotkey;
|
||||||
|
|
||||||
|
public HotkeyBox(string hotkey)
|
||||||
|
{
|
||||||
|
this.hotkey = hotkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider? colourProvider, OsuColour colours)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 3;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider?.Background6 ?? Colour4.Black.Opacity(0.7f),
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding { Horizontal = 5, Bottom = 1, },
|
||||||
|
Text = hotkey.ToUpperInvariant(),
|
||||||
|
Font = OsuFont.Default.With(size: 12, weight: FontWeight.Bold),
|
||||||
|
Colour = colourProvider?.Light1 ?? colours.GrayA,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,6 +42,25 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
|
sampleClose = audio.Samples.Get(@"UI/dropdown-close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
bool showCheckboxes = false;
|
||||||
|
|
||||||
|
foreach (var drawableItem in ItemsContainer)
|
||||||
|
{
|
||||||
|
if (drawableItem.Item is StatefulMenuItem)
|
||||||
|
showCheckboxes = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var drawableItem in ItemsContainer)
|
||||||
|
{
|
||||||
|
if (drawableItem is DrawableOsuMenuItem osuItem)
|
||||||
|
osuItem.ShowCheckbox.Value = showCheckboxes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void AnimateOpen()
|
protected override void AnimateOpen()
|
||||||
{
|
{
|
||||||
if (!TopLevelMenu && !wasOpened)
|
if (!TopLevelMenu && !wasOpened)
|
||||||
@ -109,7 +128,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Colour = BackgroundColourHover,
|
Colour = BackgroundColourHover,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 2f,
|
Height = 2f,
|
||||||
Width = 0.8f,
|
Width = 0.9f,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public readonly MenuItemType Type;
|
public readonly MenuItemType Type;
|
||||||
|
|
||||||
|
public Hotkey Hotkey { get; init; }
|
||||||
|
|
||||||
public OsuMenuItem(LocalisableString text, MenuItemType type = MenuItemType.Standard)
|
public OsuMenuItem(LocalisableString text, MenuItemType type = MenuItemType.Standard)
|
||||||
: this(text, type, null)
|
: this(text, type, null)
|
||||||
{
|
{
|
||||||
|
238
osu.Game/Graphics/UserInterfaceV2/FormColourPalette.cs
Normal file
238
osu.Game/Graphics/UserInterfaceV2/FormColourPalette.cs
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
// 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;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
|
{
|
||||||
|
public partial class FormColourPalette : CompositeDrawable
|
||||||
|
{
|
||||||
|
public BindableList<Colour4> Colours { get; } = new BindableList<Colour4>();
|
||||||
|
|
||||||
|
public LocalisableString Caption { get; init; }
|
||||||
|
public LocalisableString HintText { get; init; }
|
||||||
|
|
||||||
|
private Box background = null!;
|
||||||
|
private FormFieldCaption caption = null!;
|
||||||
|
private FillFlowContainer flow = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 5;
|
||||||
|
|
||||||
|
RoundedButton button;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background5,
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding(9),
|
||||||
|
Spacing = new Vector2(7),
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
caption = new FormFieldCaption
|
||||||
|
{
|
||||||
|
Caption = Caption,
|
||||||
|
TooltipText = HintText,
|
||||||
|
},
|
||||||
|
flow = new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Full,
|
||||||
|
Spacing = new Vector2(5),
|
||||||
|
Child = button = new RoundedButton
|
||||||
|
{
|
||||||
|
Action = addNewColour,
|
||||||
|
Size = new Vector2(70),
|
||||||
|
Text = "+",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
flow.SetLayoutPosition(button, float.MaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Colours.BindCollectionChanged((_, args) =>
|
||||||
|
{
|
||||||
|
if (args.Action != NotifyCollectionChangedAction.Replace)
|
||||||
|
updateColours();
|
||||||
|
}, true);
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addNewColour()
|
||||||
|
{
|
||||||
|
Color4 startingColour = Colours.Count > 0
|
||||||
|
? Colours.Last()
|
||||||
|
: Colour4.White;
|
||||||
|
|
||||||
|
Colours.Add(startingColour);
|
||||||
|
flow.OfType<ColourButton>().Last().TriggerClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
background.Colour = colourProvider.Background5;
|
||||||
|
caption.Colour = colourProvider.Content2;
|
||||||
|
|
||||||
|
BorderThickness = IsHovered ? 2 : 0;
|
||||||
|
|
||||||
|
if (IsHovered)
|
||||||
|
BorderColour = colourProvider.Light4;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateColours()
|
||||||
|
{
|
||||||
|
flow.RemoveAll(d => d is ColourButton, true);
|
||||||
|
|
||||||
|
for (int i = 0; i < Colours.Count; ++i)
|
||||||
|
{
|
||||||
|
// copy to avoid accesses to modified closure.
|
||||||
|
int colourIndex = i;
|
||||||
|
var colourButton = new ColourButton { Current = { Value = Colours[colourIndex] } };
|
||||||
|
colourButton.Current.BindValueChanged(colour => Colours[colourIndex] = colour.NewValue);
|
||||||
|
colourButton.DeleteRequested = () => Colours.RemoveAt(colourIndex);
|
||||||
|
flow.Add(colourButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class ColourButton : OsuClickableContainer, IHasPopover, IHasContextMenu
|
||||||
|
{
|
||||||
|
public Bindable<Colour4> Current { get; } = new Bindable<Colour4>();
|
||||||
|
public Action? DeleteRequested { get; set; }
|
||||||
|
|
||||||
|
private Box background = null!;
|
||||||
|
private OsuSpriteText hexCode = null!;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Size = new Vector2(70);
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 35;
|
||||||
|
Action = this.ShowPopover;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
background = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
hexCode = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Current.BindValueChanged(_ => updateState(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Popover GetPopover() => new ColourPickerPopover
|
||||||
|
{
|
||||||
|
Current = { BindTarget = Current }
|
||||||
|
};
|
||||||
|
|
||||||
|
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
|
{
|
||||||
|
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => DeleteRequested?.Invoke())
|
||||||
|
};
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
background.Colour = Current.Value;
|
||||||
|
hexCode.Text = Current.Value.ToHex();
|
||||||
|
hexCode.Colour = OsuColour.ForegroundTextColourFor(Current.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class ColourPickerPopover : OsuPopover, IHasCurrentValue<Colour4>
|
||||||
|
{
|
||||||
|
public Bindable<Colour4> Current
|
||||||
|
{
|
||||||
|
get => current.Current;
|
||||||
|
set => current.Current = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly BindableWithCurrent<Colour4> current = new BindableWithCurrent<Colour4>();
|
||||||
|
|
||||||
|
public ColourPickerPopover()
|
||||||
|
: base(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
Child = new OsuColourPicker
|
||||||
|
{
|
||||||
|
Current = { BindTarget = Current }
|
||||||
|
};
|
||||||
|
|
||||||
|
Body.BorderThickness = 2;
|
||||||
|
Body.BorderColour = colourProvider.Highlight1;
|
||||||
|
Content.Padding = new MarginPadding(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -68,6 +68,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public LocalisableString PlaceholderText { get; init; }
|
public LocalisableString PlaceholderText { get; init; }
|
||||||
|
|
||||||
|
public Container PreviewContainer { get; private set; } = null!;
|
||||||
|
|
||||||
private Box background = null!;
|
private Box background = null!;
|
||||||
|
|
||||||
private FormFieldCaption caption = null!;
|
private FormFieldCaption caption = null!;
|
||||||
@ -89,7 +91,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 50;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
@ -101,9 +103,23 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colourProvider.Background5,
|
Colour = colourProvider.Background5,
|
||||||
},
|
},
|
||||||
|
PreviewContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Horizontal = 1.5f,
|
||||||
|
Top = 1.5f,
|
||||||
|
Bottom = 50
|
||||||
|
},
|
||||||
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 50,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
Padding = new MarginPadding(9),
|
Padding = new MarginPadding(9),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -148,12 +164,13 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
popoverState.BindValueChanged(_ => updateState());
|
popoverState.BindValueChanged(_ => updateState());
|
||||||
|
current.BindDisabledChanged(_ => updateState());
|
||||||
current.BindValueChanged(_ =>
|
current.BindValueChanged(_ =>
|
||||||
{
|
{
|
||||||
updateState();
|
updateState();
|
||||||
onFileSelected();
|
onFileSelected();
|
||||||
});
|
}, true);
|
||||||
current.BindDisabledChanged(_ => updateState(), true);
|
FinishTransforms(true);
|
||||||
game.RegisterImportHandler(this);
|
game.RegisterImportHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +206,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
caption.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content2;
|
caption.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content2;
|
||||||
filenameText.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content1;
|
filenameText.Colour = Current.Disabled || Current.Value == null ? colourProvider.Foreground1 : colourProvider.Content1;
|
||||||
|
|
||||||
if (!Current.Disabled)
|
if (!Current.Disabled)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterfaceV2
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
{
|
{
|
||||||
public partial class FormNumberBox : FormTextBox
|
public partial class FormNumberBox : FormTextBox
|
||||||
@ -10,6 +12,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
internal override InnerTextBox CreateTextBox() => new InnerNumberBox
|
internal override InnerTextBox CreateTextBox() => new InnerNumberBox
|
||||||
{
|
{
|
||||||
AllowDecimals = AllowDecimals,
|
AllowDecimals = AllowDecimals,
|
||||||
|
SelectAllOnFocus = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
internal partial class InnerNumberBox : InnerTextBox
|
internal partial class InnerNumberBox : InnerTextBox
|
||||||
@ -17,7 +20,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
public bool AllowDecimals { get; init; }
|
public bool AllowDecimals { get; init; }
|
||||||
|
|
||||||
protected override bool CanAddCharacter(char character)
|
protected override bool CanAddCharacter(char character)
|
||||||
=> char.IsAsciiDigit(character) || (AllowDecimals && character == '.');
|
=> char.IsAsciiDigit(character) || (AllowDecimals && CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator.Contains(character));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ using osu.Framework.Input;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterfaceV2
|
namespace osu.Game.Graphics.UserInterfaceV2
|
||||||
@ -27,26 +28,22 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
public Bindable<T> Current
|
public Bindable<T> Current
|
||||||
{
|
{
|
||||||
get => current.Current;
|
get => current.Current;
|
||||||
set => current.Current = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool instantaneous = true;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether changes to the slider should instantaneously transfer to the text box (and vice versa).
|
|
||||||
/// If <see langword="false"/>, the transfer will happen on text box commit (explicit, or implicit via focus loss), or on slider drag end.
|
|
||||||
/// </summary>
|
|
||||||
public bool Instantaneous
|
|
||||||
{
|
|
||||||
get => instantaneous;
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
instantaneous = value;
|
current.Current = value;
|
||||||
|
currentNumberInstantaneous.Default = current.Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (slider.IsNotNull())
|
private readonly BindableNumberWithCurrent<T> current = new BindableNumberWithCurrent<T>();
|
||||||
slider.TransferValueOnCommit = !instantaneous;
|
|
||||||
}
|
private readonly BindableNumber<T> currentNumberInstantaneous = new BindableNumber<T>();
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether changes to the value should instantaneously transfer to outside bindables.
|
||||||
|
/// If <see langword="false"/>, the transfer will happen on text box commit (explicit, or implicit via focus loss), or on slider commit.
|
||||||
|
/// </summary>
|
||||||
|
public bool TransferValueOnCommit { get; set; }
|
||||||
|
|
||||||
private CompositeDrawable? tabbableContentContainer;
|
private CompositeDrawable? tabbableContentContainer;
|
||||||
|
|
||||||
@ -61,8 +58,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly BindableNumberWithCurrent<T> current = new BindableNumberWithCurrent<T>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Caption describing this slider bar, displayed on top of the controls.
|
/// Caption describing this slider bar, displayed on top of the controls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -83,8 +78,10 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
|
private readonly Bindable<Language> currentLanguage = new Bindable<Language>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, OsuGame? game)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 50;
|
Height = 50;
|
||||||
@ -107,7 +104,12 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding(9),
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 9,
|
||||||
|
Left = 9,
|
||||||
|
Right = 5,
|
||||||
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
caption = new FormFieldCaption
|
caption = new FormFieldCaption
|
||||||
@ -139,12 +141,15 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
Current = Current,
|
Current = currentNumberInstantaneous,
|
||||||
TransferValueOnCommit = !instantaneous,
|
OnCommit = () => current.Value = currentNumberInstantaneous.Value,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (game != null)
|
||||||
|
currentLanguage.BindTo(game.CurrentLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -159,10 +164,30 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
|
|
||||||
slider.IsDragging.BindValueChanged(_ => updateState());
|
slider.IsDragging.BindValueChanged(_ => updateState());
|
||||||
|
|
||||||
current.BindValueChanged(_ =>
|
current.ValueChanged += e => currentNumberInstantaneous.Value = e.NewValue;
|
||||||
|
current.MinValueChanged += v => currentNumberInstantaneous.MinValue = v;
|
||||||
|
current.MaxValueChanged += v => currentNumberInstantaneous.MaxValue = v;
|
||||||
|
current.PrecisionChanged += v => currentNumberInstantaneous.Precision = v;
|
||||||
|
current.DisabledChanged += disabled =>
|
||||||
{
|
{
|
||||||
|
if (disabled)
|
||||||
|
{
|
||||||
|
// revert any changes before disabling to make sure we are in a consistent state.
|
||||||
|
currentNumberInstantaneous.Value = current.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentNumberInstantaneous.Disabled = disabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
current.CopyTo(currentNumberInstantaneous);
|
||||||
|
currentLanguage.BindValueChanged(_ => Schedule(updateValueDisplay));
|
||||||
|
currentNumberInstantaneous.BindValueChanged(e =>
|
||||||
|
{
|
||||||
|
if (!TransferValueOnCommit)
|
||||||
|
current.Value = e.NewValue;
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
updateTextBoxFromSlider();
|
updateValueDisplay();
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,17 +195,15 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
|
|
||||||
private void textChanged(ValueChangedEvent<string> change)
|
private void textChanged(ValueChangedEvent<string> change)
|
||||||
{
|
{
|
||||||
if (!instantaneous) return;
|
|
||||||
|
|
||||||
tryUpdateSliderFromTextBox();
|
tryUpdateSliderFromTextBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textCommitted(TextBox t, bool isNew)
|
private void textCommitted(TextBox t, bool isNew)
|
||||||
{
|
{
|
||||||
tryUpdateSliderFromTextBox();
|
tryUpdateSliderFromTextBox();
|
||||||
|
|
||||||
// If the attempted update above failed, restore text box to match the slider.
|
// If the attempted update above failed, restore text box to match the slider.
|
||||||
Current.TriggerChange();
|
currentNumberInstantaneous.TriggerChange();
|
||||||
|
current.Value = currentNumberInstantaneous.Value;
|
||||||
|
|
||||||
flashLayer.Colour = ColourInfo.GradientVertical(colourProvider.Dark2.Opacity(0), colourProvider.Dark2);
|
flashLayer.Colour = ColourInfo.GradientVertical(colourProvider.Dark2.Opacity(0), colourProvider.Dark2);
|
||||||
flashLayer.FadeOutFromOne(800, Easing.OutQuint);
|
flashLayer.FadeOutFromOne(800, Easing.OutQuint);
|
||||||
@ -192,7 +215,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch (Current)
|
switch (currentNumberInstantaneous)
|
||||||
{
|
{
|
||||||
case Bindable<int> bindableInt:
|
case Bindable<int> bindableInt:
|
||||||
bindableInt.Value = int.Parse(textBox.Current.Value);
|
bindableInt.Value = int.Parse(textBox.Current.Value);
|
||||||
@ -203,7 +226,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Current.Parse(textBox.Current.Value, CultureInfo.CurrentCulture);
|
currentNumberInstantaneous.Parse(textBox.Current.Value, CultureInfo.CurrentCulture);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,9 +261,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
{
|
{
|
||||||
textBox.Alpha = 1;
|
textBox.Alpha = 1;
|
||||||
|
|
||||||
background.Colour = Current.Disabled ? colourProvider.Background4 : colourProvider.Background5;
|
background.Colour = currentNumberInstantaneous.Disabled ? colourProvider.Background4 : colourProvider.Background5;
|
||||||
caption.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content2;
|
caption.Colour = currentNumberInstantaneous.Disabled ? colourProvider.Foreground1 : colourProvider.Content2;
|
||||||
textBox.Colour = Current.Disabled ? colourProvider.Foreground1 : colourProvider.Content1;
|
textBox.Colour = currentNumberInstantaneous.Disabled ? colourProvider.Foreground1 : colourProvider.Content1;
|
||||||
|
|
||||||
BorderThickness = IsHovered || textBox.Focused.Value || slider.IsDragging.Value ? 2 : 0;
|
BorderThickness = IsHovered || textBox.Focused.Value || slider.IsDragging.Value ? 2 : 0;
|
||||||
BorderColour = textBox.Focused.Value ? colourProvider.Highlight1 : colourProvider.Light4;
|
BorderColour = textBox.Focused.Value ? colourProvider.Highlight1 : colourProvider.Light4;
|
||||||
@ -253,16 +276,17 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
background.Colour = colourProvider.Background5;
|
background.Colour = colourProvider.Background5;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTextBoxFromSlider()
|
private void updateValueDisplay()
|
||||||
{
|
{
|
||||||
if (updatingFromTextBox) return;
|
if (updatingFromTextBox) return;
|
||||||
|
|
||||||
textBox.Text = slider.GetDisplayableValue(Current.Value).ToString();
|
textBox.Text = slider.GetDisplayableValue(currentNumberInstantaneous.Value).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class Slider : OsuSliderBar<T>
|
private partial class Slider : OsuSliderBar<T>
|
||||||
{
|
{
|
||||||
public BindableBool IsDragging { get; set; } = new BindableBool();
|
public BindableBool IsDragging { get; set; } = new BindableBool();
|
||||||
|
public Action? OnCommit { get; set; }
|
||||||
|
|
||||||
private Box leftBox = null!;
|
private Box leftBox = null!;
|
||||||
private Box rightBox = null!;
|
private Box rightBox = null!;
|
||||||
@ -369,6 +393,16 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
{
|
{
|
||||||
nub.MoveToX(value, 200, Easing.OutPow10);
|
nub.MoveToX(value, 200, Easing.OutPow10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool Commit()
|
||||||
|
{
|
||||||
|
bool result = base.Commit();
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
OnCommit?.Invoke();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,6 +202,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
BorderThickness = 0;
|
||||||
background.Colour = colourProvider.Background4;
|
background.Colour = colourProvider.Background4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,14 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
|
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public string Url { get; set; } = string.Empty;
|
public string Url { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[JsonProperty("current_user_attributes")]
|
||||||
|
public CommentableCurrentUserAttributes? CurrentUserAttributes { get; set; }
|
||||||
|
|
||||||
|
public struct CommentableCurrentUserAttributes
|
||||||
|
{
|
||||||
|
[JsonProperty("can_new_comment_reason")]
|
||||||
|
public string? CanNewCommentReason { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,6 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
protected partial class StandAloneMessage : ChatLine
|
protected partial class StandAloneMessage : ChatLine
|
||||||
{
|
{
|
||||||
protected override float FontSize => 13;
|
|
||||||
protected override float Spacing => 5;
|
protected override float Spacing => 5;
|
||||||
protected override float UsernameWidth => 90;
|
protected override float UsernameWidth => 90;
|
||||||
|
|
||||||
|
@ -409,6 +409,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
KeyBindingStore = new RealmKeyBindingStore(realm, keyCombinationProvider);
|
KeyBindingStore = new RealmKeyBindingStore(realm, keyCombinationProvider);
|
||||||
KeyBindingStore.Register(globalBindings, RulesetStore.AvailableRulesets);
|
KeyBindingStore.Register(globalBindings, RulesetStore.AvailableRulesets);
|
||||||
|
dependencies.Cache(KeyBindingStore);
|
||||||
|
|
||||||
dependencies.Cache(globalBindings);
|
dependencies.Cache(globalBindings);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
|
|
||||||
public IReadOnlyCollection<Drawable> DrawableContentFlow => drawableContentFlow;
|
public IReadOnlyCollection<Drawable> DrawableContentFlow => drawableContentFlow;
|
||||||
|
|
||||||
protected virtual float FontSize => 12;
|
private const float font_size = 13;
|
||||||
|
|
||||||
protected virtual float Spacing => 15;
|
protected virtual float Spacing => 15;
|
||||||
|
|
||||||
@ -183,13 +183,13 @@ namespace osu.Game.Overlays.Chat
|
|||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Spacing = new Vector2(-1, 0),
|
Spacing = new Vector2(-1, 0),
|
||||||
Font = OsuFont.GetFont(size: FontSize, weight: FontWeight.SemiBold, fixedWidth: true),
|
Font = OsuFont.GetFont(size: font_size, weight: FontWeight.SemiBold, fixedWidth: true),
|
||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
},
|
},
|
||||||
drawableUsername = new DrawableChatUsername(message.Sender)
|
drawableUsername = new DrawableChatUsername(message.Sender)
|
||||||
{
|
{
|
||||||
Width = UsernameWidth,
|
Width = UsernameWidth,
|
||||||
FontSize = FontSize,
|
FontSize = font_size,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -258,7 +258,7 @@ namespace osu.Game.Overlays.Chat
|
|||||||
private void styleMessageContent(SpriteText text)
|
private void styleMessageContent(SpriteText text)
|
||||||
{
|
{
|
||||||
text.Shadow = false;
|
text.Shadow = false;
|
||||||
text.Font = text.Font.With(size: FontSize, italics: Message.IsAction, weight: isMention ? FontWeight.SemiBold : FontWeight.Medium);
|
text.Font = text.Font.With(size: font_size, italics: Message.IsAction, weight: isMention ? FontWeight.SemiBold : FontWeight.Medium);
|
||||||
|
|
||||||
Color4 messageColour = colourProvider?.Content1 ?? Colour4.White;
|
Color4 messageColour = colourProvider?.Content1 ?? Colour4.White;
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -21,6 +23,8 @@ namespace osu.Game.Overlays.Comments
|
|||||||
{
|
{
|
||||||
public abstract partial class CommentEditor : CompositeDrawable
|
public abstract partial class CommentEditor : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
public Bindable<CommentableMeta?> CommentableMeta { get; set; } = new Bindable<CommentableMeta?>();
|
||||||
|
|
||||||
private const int side_padding = 8;
|
private const int side_padding = 8;
|
||||||
|
|
||||||
protected abstract LocalisableString FooterText { get; }
|
protected abstract LocalisableString FooterText { get; }
|
||||||
@ -53,8 +57,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the placeholder text for the comment box.
|
/// Returns the placeholder text for the comment box.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="isLoggedIn">Whether the current user is logged in.</param>
|
protected abstract LocalisableString GetPlaceholderText();
|
||||||
protected abstract LocalisableString GetPlaceholderText(bool isLoggedIn);
|
|
||||||
|
|
||||||
protected bool ShowLoadingSpinner
|
protected bool ShowLoadingSpinner
|
||||||
{
|
{
|
||||||
@ -65,7 +68,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
else
|
else
|
||||||
loadingSpinner.Hide();
|
loadingSpinner.Hide();
|
||||||
|
|
||||||
updateCommitButtonState();
|
updateState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,25 +170,33 @@ namespace osu.Game.Overlays.Comments
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
Current.BindValueChanged(_ => updateCommitButtonState(), true);
|
Current.BindValueChanged(_ => updateState());
|
||||||
apiState.BindValueChanged(updateStateForLoggedIn, true);
|
apiState.BindValueChanged(_ => Scheduler.AddOnce(updateState));
|
||||||
|
CommentableMeta.BindValueChanged(_ => Scheduler.AddOnce(updateState));
|
||||||
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void OnCommit(string text);
|
protected abstract void OnCommit(string text);
|
||||||
|
|
||||||
private void updateCommitButtonState() =>
|
private void updateState()
|
||||||
commitButton.Enabled.Value = loadingSpinner.State.Value == Visibility.Hidden && !string.IsNullOrEmpty(Current.Value);
|
|
||||||
|
|
||||||
private void updateStateForLoggedIn(ValueChangedEvent<APIState> state) => Schedule(() =>
|
|
||||||
{
|
{
|
||||||
bool isAvailable = state.NewValue > APIState.Offline;
|
bool isOnline = apiState.Value > APIState.Offline;
|
||||||
|
LocalisableString? canNewCommentReason = CommentEditor.canNewCommentReason(CommentableMeta.Value);
|
||||||
|
bool commentsDisabled = canNewCommentReason != null;
|
||||||
|
bool canComment = isOnline && !commentsDisabled;
|
||||||
|
|
||||||
TextBox.PlaceholderText = GetPlaceholderText(isAvailable);
|
if (!isOnline)
|
||||||
TextBox.ReadOnly = !isAvailable;
|
TextBox.PlaceholderText = AuthorizationStrings.RequireLogin;
|
||||||
|
else if (canNewCommentReason != null)
|
||||||
|
TextBox.PlaceholderText = canNewCommentReason.Value;
|
||||||
|
else
|
||||||
|
TextBox.PlaceholderText = GetPlaceholderText();
|
||||||
|
TextBox.ReadOnly = !canComment;
|
||||||
|
|
||||||
if (isAvailable)
|
if (isOnline)
|
||||||
{
|
{
|
||||||
commitButton.Show();
|
commitButton.Show();
|
||||||
|
commitButton.Enabled.Value = !commentsDisabled && loadingSpinner.State.Value == Visibility.Hidden && !string.IsNullOrEmpty(Current.Value);
|
||||||
logInButton.Hide();
|
logInButton.Hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -193,7 +204,25 @@ namespace osu.Game.Overlays.Comments
|
|||||||
commitButton.Hide();
|
commitButton.Hide();
|
||||||
logInButton.Show();
|
logInButton.Show();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// https://github.com/ppy/osu-web/blob/83816dbe24ad2927273cba968f2fcd2694a121a9/resources/js/components/comment-editor.tsx#L54-L60
|
||||||
|
// careful here, logic is VERY finicky.
|
||||||
|
private static LocalisableString? canNewCommentReason(CommentableMeta? meta)
|
||||||
|
{
|
||||||
|
if (meta == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (meta.CurrentUserAttributes != null)
|
||||||
|
{
|
||||||
|
if (meta.CurrentUserAttributes.Value.CanNewCommentReason is string reason)
|
||||||
|
return reason;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AuthorizationStrings.CommentStoreDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
private partial class EditorTextBox : OsuTextBox
|
private partial class EditorTextBox : OsuTextBox
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
@ -49,6 +50,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
private int currentPage;
|
private int currentPage;
|
||||||
|
|
||||||
private FillFlowContainer pinnedContent;
|
private FillFlowContainer pinnedContent;
|
||||||
|
private NewCommentEditor newCommentEditor;
|
||||||
private FillFlowContainer content;
|
private FillFlowContainer content;
|
||||||
private DeletedCommentsCounter deletedCommentsCounter;
|
private DeletedCommentsCounter deletedCommentsCounter;
|
||||||
private CommentsShowMoreButton moreButton;
|
private CommentsShowMoreButton moreButton;
|
||||||
@ -114,7 +116,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Padding = new MarginPadding { Left = 60 },
|
Padding = new MarginPadding { Left = 60 },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Child = new NewCommentEditor
|
Child = newCommentEditor = new NewCommentEditor
|
||||||
{
|
{
|
||||||
OnPost = prependPostedComments
|
OnPost = prependPostedComments
|
||||||
}
|
}
|
||||||
@ -242,6 +244,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
protected void OnSuccess(CommentBundle response)
|
protected void OnSuccess(CommentBundle response)
|
||||||
{
|
{
|
||||||
commentCounter.Current.Value = response.Total;
|
commentCounter.Current.Value = response.Total;
|
||||||
|
newCommentEditor.CommentableMeta.Value = response.CommentableMeta.SingleOrDefault(m => m.Id == id.Value && m.Type == type.Value.ToString().ToSnakeCase().ToLowerInvariant());
|
||||||
|
|
||||||
if (!response.Comments.Any())
|
if (!response.Comments.Any())
|
||||||
{
|
{
|
||||||
@ -413,8 +416,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
protected override LocalisableString GetButtonText(bool isLoggedIn) =>
|
protected override LocalisableString GetButtonText(bool isLoggedIn) =>
|
||||||
isLoggedIn ? CommonStrings.ButtonsPost : CommentsStrings.GuestButtonNew;
|
isLoggedIn ? CommonStrings.ButtonsPost : CommentsStrings.GuestButtonNew;
|
||||||
|
|
||||||
protected override LocalisableString GetPlaceholderText(bool isLoggedIn) =>
|
protected override LocalisableString GetPlaceholderText() => CommentsStrings.PlaceholderNew;
|
||||||
isLoggedIn ? CommentsStrings.PlaceholderNew : AuthorizationStrings.RequireLogin;
|
|
||||||
|
|
||||||
protected override void OnCommit(string text)
|
protected override void OnCommit(string text)
|
||||||
{
|
{
|
||||||
|
@ -428,7 +428,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
if (replyEditorContainer.Count == 0)
|
if (replyEditorContainer.Count == 0)
|
||||||
{
|
{
|
||||||
replyEditorContainer.Show();
|
replyEditorContainer.Show();
|
||||||
replyEditorContainer.Add(new ReplyCommentEditor(Comment)
|
replyEditorContainer.Add(new ReplyCommentEditor(Comment, Meta)
|
||||||
{
|
{
|
||||||
OnPost = comments =>
|
OnPost = comments =>
|
||||||
{
|
{
|
||||||
|
@ -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.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
@ -26,12 +27,12 @@ namespace osu.Game.Overlays.Comments
|
|||||||
protected override LocalisableString GetButtonText(bool isLoggedIn) =>
|
protected override LocalisableString GetButtonText(bool isLoggedIn) =>
|
||||||
isLoggedIn ? CommonStrings.ButtonsReply : CommentsStrings.GuestButtonReply;
|
isLoggedIn ? CommonStrings.ButtonsReply : CommentsStrings.GuestButtonReply;
|
||||||
|
|
||||||
protected override LocalisableString GetPlaceholderText(bool isLoggedIn) =>
|
protected override LocalisableString GetPlaceholderText() => CommentsStrings.PlaceholderReply;
|
||||||
isLoggedIn ? CommentsStrings.PlaceholderReply : AuthorizationStrings.RequireLogin;
|
|
||||||
|
|
||||||
public ReplyCommentEditor(Comment parent)
|
public ReplyCommentEditor(Comment parent, IEnumerable<CommentableMeta> meta)
|
||||||
{
|
{
|
||||||
parentComment = parent;
|
parentComment = parent;
|
||||||
|
CommentableMeta.Value = meta.SingleOrDefault(m => m.Id == parent.CommentableId && m.Type == parent.CommentableType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -13,8 +14,10 @@ using osu.Framework.Graphics.Audio;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Audio.Effects;
|
using osu.Game.Audio.Effects;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
@ -43,6 +46,8 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableBool AllowTrackControl = new BindableBool(true);
|
public readonly BindableBool AllowTrackControl = new BindableBool(true);
|
||||||
|
|
||||||
|
public readonly BindableBool Shuffle = new BindableBool(true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when the global <see cref="WorkingBeatmap"/> has changed.
|
/// Fired when the global <see cref="WorkingBeatmap"/> has changed.
|
||||||
/// Includes direction information for display purposes.
|
/// Includes direction information for display purposes.
|
||||||
@ -66,12 +71,18 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private AudioFilter audioDuckFilter = null!;
|
private AudioFilter audioDuckFilter = null!;
|
||||||
|
|
||||||
|
private readonly Bindable<RandomSelectAlgorithm> randomSelectAlgorithm = new Bindable<RandomSelectAlgorithm>();
|
||||||
|
private readonly List<BeatmapSetInfo> previousRandomSets = new List<BeatmapSetInfo>();
|
||||||
|
private int randomHistoryDirection;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio, OsuConfigManager configManager)
|
||||||
{
|
{
|
||||||
AddInternal(audioDuckFilter = new AudioFilter(audio.TrackMixer));
|
AddInternal(audioDuckFilter = new AudioFilter(audio.TrackMixer));
|
||||||
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, audioDuckVolume);
|
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, audioDuckVolume);
|
||||||
sampleVolume = audio.VolumeSample.GetBoundCopy();
|
sampleVolume = audio.VolumeSample.GetBoundCopy();
|
||||||
|
|
||||||
|
configManager.BindWith(OsuSetting.RandomSelectAlgorithm, randomSelectAlgorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -238,8 +249,15 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Prev;
|
queuedDirection = TrackChangeDirection.Prev;
|
||||||
|
|
||||||
var playableSet = getBeatmapSets().AsEnumerable().TakeWhile(i => !i.Equals(current?.BeatmapSetInfo)).LastOrDefault(s => !s.Protected || allowProtectedTracks)
|
BeatmapSetInfo? playableSet;
|
||||||
|
|
||||||
|
if (Shuffle.Value)
|
||||||
|
playableSet = getNextRandom(-1, allowProtectedTracks);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playableSet = getBeatmapSets().AsEnumerable().TakeWhile(i => !i.Equals(current?.BeatmapSetInfo)).LastOrDefault(s => !s.Protected || allowProtectedTracks)
|
||||||
?? getBeatmapSets().AsEnumerable().LastOrDefault(s => !s.Protected || allowProtectedTracks);
|
?? getBeatmapSets().AsEnumerable().LastOrDefault(s => !s.Protected || allowProtectedTracks);
|
||||||
|
}
|
||||||
|
|
||||||
if (playableSet != null)
|
if (playableSet != null)
|
||||||
{
|
{
|
||||||
@ -327,8 +345,17 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
queuedDirection = TrackChangeDirection.Next;
|
queuedDirection = TrackChangeDirection.Next;
|
||||||
|
|
||||||
var playableSet = getBeatmapSets().AsEnumerable().SkipWhile(i => !i.Equals(current?.BeatmapSetInfo) || (i.Protected && !allowProtectedTracks)).ElementAtOrDefault(1)
|
BeatmapSetInfo? playableSet;
|
||||||
|
|
||||||
|
if (Shuffle.Value)
|
||||||
|
playableSet = getNextRandom(1, allowProtectedTracks);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playableSet = getBeatmapSets().AsEnumerable().SkipWhile(i => !i.Equals(current?.BeatmapSetInfo))
|
||||||
|
.Where(i => !i.Protected || allowProtectedTracks)
|
||||||
|
.ElementAtOrDefault(1)
|
||||||
?? getBeatmapSets().AsEnumerable().FirstOrDefault(i => !i.Protected || allowProtectedTracks);
|
?? getBeatmapSets().AsEnumerable().FirstOrDefault(i => !i.Protected || allowProtectedTracks);
|
||||||
|
}
|
||||||
|
|
||||||
var playableBeatmap = playableSet?.Beatmaps.FirstOrDefault();
|
var playableBeatmap = playableSet?.Beatmaps.FirstOrDefault();
|
||||||
|
|
||||||
@ -342,6 +369,58 @@ namespace osu.Game.Overlays
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BeatmapSetInfo? getNextRandom(int direction, bool allowProtectedTracks)
|
||||||
|
{
|
||||||
|
BeatmapSetInfo result;
|
||||||
|
|
||||||
|
var possibleSets = getBeatmapSets().AsEnumerable().Where(s => !s.Protected || allowProtectedTracks).ToArray();
|
||||||
|
|
||||||
|
if (possibleSets.Length == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// condition below checks if the signs of `randomHistoryDirection` and `direction` are opposite and not zero.
|
||||||
|
// if that is the case, it means that the user had previously chosen next track `randomHistoryDirection` times and wants to go back,
|
||||||
|
// or that the user had previously chosen previous track `randomHistoryDirection` times and wants to go forward.
|
||||||
|
// in both cases, it means that we have a history of previous random selections that we can rewind.
|
||||||
|
if (randomHistoryDirection * direction < 0)
|
||||||
|
{
|
||||||
|
Debug.Assert(Math.Abs(randomHistoryDirection) == previousRandomSets.Count);
|
||||||
|
result = previousRandomSets[^1];
|
||||||
|
previousRandomSets.RemoveAt(previousRandomSets.Count - 1);
|
||||||
|
randomHistoryDirection += direction;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the early-return above didn't cover it, it means that we have no history to fall back on
|
||||||
|
// and need to actually choose something random.
|
||||||
|
switch (randomSelectAlgorithm.Value)
|
||||||
|
{
|
||||||
|
case RandomSelectAlgorithm.Random:
|
||||||
|
result = possibleSets[RNG.Next(possibleSets.Length)];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RandomSelectAlgorithm.RandomPermutation:
|
||||||
|
var notYetPlayedSets = possibleSets.Except(previousRandomSets).ToArray();
|
||||||
|
|
||||||
|
if (notYetPlayedSets.Length == 0)
|
||||||
|
{
|
||||||
|
notYetPlayedSets = possibleSets;
|
||||||
|
previousRandomSets.Clear();
|
||||||
|
randomHistoryDirection = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = notYetPlayedSets[RNG.Next(notYetPlayedSets.Length)];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException(nameof(randomSelectAlgorithm), randomSelectAlgorithm.Value, "Unsupported random select algorithm");
|
||||||
|
}
|
||||||
|
|
||||||
|
previousRandomSets.Add(result);
|
||||||
|
randomHistoryDirection += direction;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private void restartTrack()
|
private void restartTrack()
|
||||||
{
|
{
|
||||||
// if not scheduled, the previously track will be stopped one frame later (see ScheduleAfterChildren logic in GameBase).
|
// if not scheduled, the previously track will be stopped one frame later (see ScheduleAfterChildren logic in GameBase).
|
||||||
|
@ -47,6 +47,7 @@ namespace osu.Game.Overlays
|
|||||||
private IconButton prevButton = null!;
|
private IconButton prevButton = null!;
|
||||||
private IconButton playButton = null!;
|
private IconButton playButton = null!;
|
||||||
private IconButton nextButton = null!;
|
private IconButton nextButton = null!;
|
||||||
|
private MusicIconButton shuffleButton = null!;
|
||||||
private IconButton playlistButton = null!;
|
private IconButton playlistButton = null!;
|
||||||
|
|
||||||
private ScrollingTextContainer title = null!, artist = null!;
|
private ScrollingTextContainer title = null!, artist = null!;
|
||||||
@ -69,6 +70,7 @@ namespace osu.Game.Overlays
|
|||||||
private OsuColour colours { get; set; } = null!;
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
private Bindable<bool> allowTrackControl = null!;
|
private Bindable<bool> allowTrackControl = null!;
|
||||||
|
private readonly BindableBool shuffle = new BindableBool(true);
|
||||||
|
|
||||||
public NowPlayingOverlay()
|
public NowPlayingOverlay()
|
||||||
{
|
{
|
||||||
@ -164,6 +166,14 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
shuffleButton = new MusicIconButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Position = new Vector2(bottom_black_area_height / 2, 0),
|
||||||
|
Action = shuffle.Toggle,
|
||||||
|
Icon = FontAwesome.Solid.Random,
|
||||||
|
},
|
||||||
playlistButton = new MusicIconButton
|
playlistButton = new MusicIconButton
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -227,6 +237,9 @@ namespace osu.Game.Overlays
|
|||||||
allowTrackControl = musicController.AllowTrackControl.GetBoundCopy();
|
allowTrackControl = musicController.AllowTrackControl.GetBoundCopy();
|
||||||
allowTrackControl.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledStates), true);
|
allowTrackControl.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledStates), true);
|
||||||
|
|
||||||
|
shuffle.BindTo(musicController.Shuffle);
|
||||||
|
shuffle.BindValueChanged(s => shuffleButton.FadeColour(s.NewValue ? colours.Yellow : Color4.White, 200, Easing.OutQuint), true);
|
||||||
|
|
||||||
musicController.TrackChanged += trackChanged;
|
musicController.TrackChanged += trackChanged;
|
||||||
trackChanged(beatmap.Value);
|
trackChanged(beatmap.Value);
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
toolboxContainer.Add(toolboxGroup = new EditorToolboxGroup("snapping")
|
toolboxContainer.Add(toolboxGroup = new EditorToolboxGroup("snapping")
|
||||||
{
|
{
|
||||||
|
Name = "snapping",
|
||||||
Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1,
|
Alpha = DistanceSpacingMultiplier.Disabled ? 0 : 1,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ using osu.Game.Graphics.UserInterfaceV2;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
internal partial class ExpandableButton : RoundedButton, IExpandable
|
public partial class ExpandableButton : RoundedButton, IExpandable
|
||||||
{
|
{
|
||||||
private float actualHeight;
|
private float actualHeight;
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed)
|
if (e.ControlPressed || e.AltPressed || e.SuperPressed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (checkLeftToggleFromKey(e.Key, out int leftIndex))
|
if (checkToolboxMappingFromKey(e.Key, out int leftIndex))
|
||||||
{
|
{
|
||||||
var item = toolboxCollection.Items.ElementAtOrDefault(leftIndex);
|
var item = toolboxCollection.Items.ElementAtOrDefault(leftIndex);
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkRightToggleFromKey(e.Key, out int rightIndex))
|
if (checkToggleMappingFromKey(e.Key, out int rightIndex))
|
||||||
{
|
{
|
||||||
var item = e.ShiftPressed
|
var item = e.ShiftPressed
|
||||||
? sampleBankTogglesCollection.ElementAtOrDefault(rightIndex)
|
? sampleBankTogglesCollection.ElementAtOrDefault(rightIndex)
|
||||||
@ -391,7 +391,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool checkLeftToggleFromKey(Key key, out int index)
|
private bool checkToolboxMappingFromKey(Key key, out int index)
|
||||||
{
|
{
|
||||||
if (key < Key.Number1 || key > Key.Number9)
|
if (key < Key.Number1 || key > Key.Number9)
|
||||||
{
|
{
|
||||||
@ -403,7 +403,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool checkRightToggleFromKey(Key key, out int index)
|
private bool checkToggleMappingFromKey(Key key, out int index)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
using osu.Framework.Extensions.EnumExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
@ -30,6 +31,7 @@ using osu.Game.Screens.Edit.Setup;
|
|||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets
|
namespace osu.Game.Rulesets
|
||||||
{
|
{
|
||||||
@ -396,10 +398,28 @@ namespace osu.Game.Rulesets
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be overridden to add ruleset-specific sections to the editor beatmap setup screen.
|
/// Can be overridden to add ruleset-specific sections to the editor beatmap setup screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual IEnumerable<SetupSection> CreateEditorSetupSections() =>
|
public virtual IEnumerable<Drawable> CreateEditorSetupSections() =>
|
||||||
[
|
[
|
||||||
|
new MetadataSection(),
|
||||||
new DifficultySection(),
|
new DifficultySection(),
|
||||||
new ColoursSection(),
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(25),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new ResourcesSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
},
|
||||||
|
new ColoursSection
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new DesignSection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -7,7 +7,10 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -78,8 +81,11 @@ namespace osu.Game.Screens.Edit.Components.Menus
|
|||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableEditorBarMenuItem(item);
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableEditorBarMenuItem(item);
|
||||||
|
|
||||||
private partial class DrawableEditorBarMenuItem : DrawableOsuMenuItem
|
internal partial class DrawableEditorBarMenuItem : DrawableMenuItem
|
||||||
{
|
{
|
||||||
|
private HoverClickSounds hoverClickSounds = null!;
|
||||||
|
private TextContainer text = null!;
|
||||||
|
|
||||||
public DrawableEditorBarMenuItem(MenuItem item)
|
public DrawableEditorBarMenuItem(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
@ -92,6 +98,8 @@ namespace osu.Game.Screens.Edit.Components.Menus
|
|||||||
BackgroundColour = colourProvider.Background2;
|
BackgroundColour = colourProvider.Background2;
|
||||||
ForegroundColourHover = colourProvider.Content1;
|
ForegroundColourHover = colourProvider.Content1;
|
||||||
BackgroundColourHover = colourProvider.Background1;
|
BackgroundColourHover = colourProvider.Background1;
|
||||||
|
|
||||||
|
AddInternal(hoverClickSounds = new HoverClickSounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -100,6 +108,36 @@ namespace osu.Game.Screens.Edit.Components.Menus
|
|||||||
|
|
||||||
Foreground.Anchor = Anchor.CentreLeft;
|
Foreground.Anchor = Anchor.CentreLeft;
|
||||||
Foreground.Origin = Anchor.CentreLeft;
|
Foreground.Origin = Anchor.CentreLeft;
|
||||||
|
Item.Action.BindDisabledChanged(_ => updateState(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
return base.OnHover(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
hoverClickSounds.Enabled.Value = IsActionable;
|
||||||
|
Alpha = IsActionable ? 1 : 0.2f;
|
||||||
|
|
||||||
|
if (IsHovered && IsActionable)
|
||||||
|
{
|
||||||
|
text.BoldText.FadeIn(DrawableOsuMenuItem.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
text.NormalText.FadeOut(DrawableOsuMenuItem.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text.BoldText.FadeOut(DrawableOsuMenuItem.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
text.NormalText.FadeIn(DrawableOsuMenuItem.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateBackgroundColour()
|
protected override void UpdateBackgroundColour()
|
||||||
@ -118,16 +156,56 @@ namespace osu.Game.Screens.Edit.Components.Menus
|
|||||||
base.UpdateForegroundColour();
|
base.UpdateForegroundColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableOsuMenuItem.TextContainer CreateTextContainer() => new TextContainer();
|
protected sealed override Drawable CreateContent() => text = new TextContainer();
|
||||||
|
}
|
||||||
|
|
||||||
private new partial class TextContainer : DrawableOsuMenuItem.TextContainer
|
private partial class TextContainer : Container, IHasText
|
||||||
{
|
{
|
||||||
|
public LocalisableString Text
|
||||||
|
{
|
||||||
|
get => NormalText.Text;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
NormalText.Text = value;
|
||||||
|
BoldText.Text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public readonly SpriteText NormalText;
|
||||||
|
public readonly SpriteText BoldText;
|
||||||
|
|
||||||
public TextContainer()
|
public TextContainer()
|
||||||
{
|
{
|
||||||
NormalText.Font = OsuFont.TorusAlternate;
|
AutoSizeAxes = Axes.Both;
|
||||||
BoldText.Font = OsuFont.TorusAlternate.With(weight: FontWeight.Bold);
|
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Horizontal = 17, Vertical = DrawableOsuMenuItem.MARGIN_VERTICAL, },
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
NormalText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
AlwaysPresent = true, // ensures that the menu item does not change width when switching between normal and bold text.
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Font = OsuFont.GetFont(size: DrawableOsuMenuItem.TEXT_SIZE),
|
||||||
|
},
|
||||||
|
BoldText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
AlwaysPresent = true, // ensures that the menu item does not change width when switching between normal and bold text.
|
||||||
|
Alpha = 0,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Font = OsuFont.GetFont(size: DrawableOsuMenuItem.TEXT_SIZE, weight: FontWeight.Bold),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class SubMenu : OsuMenu
|
private partial class SubMenu : OsuMenu
|
||||||
|
@ -8,6 +8,7 @@ using Humanizer;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -350,19 +351,69 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
if (SelectedBlueprints.All(b => b.Item is IHasComboInformation))
|
if (SelectedBlueprints.All(b => b.Item is IHasComboInformation))
|
||||||
{
|
{
|
||||||
yield return new TernaryStateToggleMenuItem("New combo") { State = { BindTarget = SelectionNewComboState } };
|
yield return new TernaryStateToggleMenuItem("New combo")
|
||||||
|
{
|
||||||
|
State = { BindTarget = SelectionNewComboState },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Q))
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return new OsuMenuItem("Sample")
|
yield return new OsuMenuItem("Sample") { Items = getSampleSubmenuItems().ToArray(), };
|
||||||
|
yield return new OsuMenuItem("Bank") { Items = getBankSubmenuItems().ToArray(), };
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<MenuItem> getSampleSubmenuItems()
|
||||||
{
|
{
|
||||||
Items = SelectionSampleStates.Select(kvp =>
|
var whistle = SelectionSampleStates[HitSampleInfo.HIT_WHISTLE];
|
||||||
new TernaryStateToggleMenuItem(kvp.Value.Description) { State = { BindTarget = kvp.Value } }).ToArray()
|
yield return new TernaryStateToggleMenuItem(whistle.Description)
|
||||||
|
{
|
||||||
|
State = { BindTarget = whistle },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.W))
|
||||||
};
|
};
|
||||||
|
|
||||||
yield return new OsuMenuItem("Bank")
|
var finish = SelectionSampleStates[HitSampleInfo.HIT_FINISH];
|
||||||
|
yield return new TernaryStateToggleMenuItem(finish.Description)
|
||||||
{
|
{
|
||||||
Items = SelectionBankStates.Select(kvp =>
|
State = { BindTarget = finish },
|
||||||
new TernaryStateToggleMenuItem(kvp.Value.Description) { State = { BindTarget = kvp.Value } }).ToArray()
|
Hotkey = new Hotkey(new KeyCombination(InputKey.E))
|
||||||
|
};
|
||||||
|
|
||||||
|
var clap = SelectionSampleStates[HitSampleInfo.HIT_CLAP];
|
||||||
|
yield return new TernaryStateToggleMenuItem(clap.Description)
|
||||||
|
{
|
||||||
|
State = { BindTarget = clap },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.R))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<MenuItem> getBankSubmenuItems()
|
||||||
|
{
|
||||||
|
var auto = SelectionBankStates[HIT_BANK_AUTO];
|
||||||
|
yield return new TernaryStateToggleMenuItem(auto.Description)
|
||||||
|
{
|
||||||
|
State = { BindTarget = auto },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Shift, InputKey.Q))
|
||||||
|
};
|
||||||
|
|
||||||
|
var normal = SelectionBankStates[HitSampleInfo.BANK_NORMAL];
|
||||||
|
yield return new TernaryStateToggleMenuItem(normal.Description)
|
||||||
|
{
|
||||||
|
State = { BindTarget = normal },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Shift, InputKey.W))
|
||||||
|
};
|
||||||
|
|
||||||
|
var soft = SelectionBankStates[HitSampleInfo.BANK_SOFT];
|
||||||
|
yield return new TernaryStateToggleMenuItem(soft.Description)
|
||||||
|
{
|
||||||
|
State = { BindTarget = soft },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Shift, InputKey.E))
|
||||||
|
};
|
||||||
|
|
||||||
|
var drum = SelectionBankStates[HitSampleInfo.BANK_DRUM];
|
||||||
|
yield return new TernaryStateToggleMenuItem(drum.Description)
|
||||||
|
{
|
||||||
|
State = { BindTarget = drum },
|
||||||
|
Hotkey = new Hotkey(new KeyCombination(InputKey.Shift, InputKey.R))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (SelectedBlueprints.Count == 1)
|
if (SelectedBlueprints.Count == 1)
|
||||||
items.AddRange(SelectedBlueprints[0].ContextMenuItems);
|
items.AddRange(SelectedBlueprints[0].ContextMenuItems);
|
||||||
|
|
||||||
items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, DeleteSelected));
|
items.Add(new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, DeleteSelected)
|
||||||
|
{
|
||||||
|
Hotkey = new Hotkey { PlatformAction = PlatformAction.Delete, KeyCombinations = [new KeyCombination(InputKey.Shift, InputKey.MouseRight), new KeyCombination(InputKey.MouseMiddle)] }
|
||||||
|
});
|
||||||
|
|
||||||
return items.ToArray();
|
return items.ToArray();
|
||||||
}
|
}
|
||||||
|
@ -362,13 +362,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
Items = new[]
|
Items = new[]
|
||||||
{
|
{
|
||||||
undoMenuItem = new EditorMenuItem(CommonStrings.Undo, MenuItemType.Standard, Undo),
|
undoMenuItem = new EditorMenuItem(CommonStrings.Undo, MenuItemType.Standard, Undo) { Hotkey = new Hotkey(PlatformAction.Undo) },
|
||||||
redoMenuItem = new EditorMenuItem(CommonStrings.Redo, MenuItemType.Standard, Redo),
|
redoMenuItem = new EditorMenuItem(CommonStrings.Redo, MenuItemType.Standard, Redo) { Hotkey = new Hotkey(PlatformAction.Redo) },
|
||||||
new OsuMenuItemSpacer(),
|
new OsuMenuItemSpacer(),
|
||||||
cutMenuItem = new EditorMenuItem(CommonStrings.Cut, MenuItemType.Standard, Cut),
|
cutMenuItem = new EditorMenuItem(CommonStrings.Cut, MenuItemType.Standard, Cut) { Hotkey = new Hotkey(PlatformAction.Cut) },
|
||||||
copyMenuItem = new EditorMenuItem(CommonStrings.Copy, MenuItemType.Standard, Copy),
|
copyMenuItem = new EditorMenuItem(CommonStrings.Copy, MenuItemType.Standard, Copy) { Hotkey = new Hotkey(PlatformAction.Copy) },
|
||||||
pasteMenuItem = new EditorMenuItem(CommonStrings.Paste, MenuItemType.Standard, Paste),
|
pasteMenuItem = new EditorMenuItem(CommonStrings.Paste, MenuItemType.Standard, Paste) { Hotkey = new Hotkey(PlatformAction.Paste) },
|
||||||
cloneMenuItem = new EditorMenuItem(CommonStrings.Clone, MenuItemType.Standard, Clone),
|
cloneMenuItem = new EditorMenuItem(CommonStrings.Clone, MenuItemType.Standard, Clone) { Hotkey = new Hotkey(GlobalAction.EditorCloneSelection) },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new MenuItem(CommonStrings.MenuBarView)
|
new MenuItem(CommonStrings.MenuBarView)
|
||||||
@ -721,10 +721,16 @@ namespace osu.Game.Screens.Edit
|
|||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case GlobalAction.EditorSeekToPreviousHitObject:
|
case GlobalAction.EditorSeekToPreviousHitObject:
|
||||||
|
if (editorBeatmap.SelectedHitObjects.Any())
|
||||||
|
return false;
|
||||||
|
|
||||||
seekHitObject(-1);
|
seekHitObject(-1);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case GlobalAction.EditorSeekToNextHitObject:
|
case GlobalAction.EditorSeekToNextHitObject:
|
||||||
|
if (editorBeatmap.SelectedHitObjects.Any())
|
||||||
|
return false;
|
||||||
|
|
||||||
seekHitObject(1);
|
seekHitObject(1);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -1194,7 +1200,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
yield return new EditorMenuItem(EditorStrings.DeleteDifficulty, MenuItemType.Standard, deleteDifficulty) { Action = { Disabled = Beatmap.Value.BeatmapSetInfo.Beatmaps.Count < 2 } };
|
yield return new EditorMenuItem(EditorStrings.DeleteDifficulty, MenuItemType.Standard, deleteDifficulty) { Action = { Disabled = Beatmap.Value.BeatmapSetInfo.Beatmaps.Count < 2 } };
|
||||||
yield return new OsuMenuItemSpacer();
|
yield return new OsuMenuItemSpacer();
|
||||||
|
|
||||||
var save = new EditorMenuItem(WebCommonStrings.ButtonsSave, MenuItemType.Standard, () => attemptMutationOperation(Save));
|
var save = new EditorMenuItem(WebCommonStrings.ButtonsSave, MenuItemType.Standard, () => attemptMutationOperation(Save)) { Hotkey = new Hotkey(PlatformAction.Save) };
|
||||||
saveRelatedMenuItems.Add(save);
|
saveRelatedMenuItems.Add(save);
|
||||||
yield return save;
|
yield return save;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup
|
namespace osu.Game.Screens.Edit.Setup
|
||||||
{
|
{
|
||||||
@ -13,23 +14,62 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
public override LocalisableString Title => EditorSetupStrings.ColoursHeader;
|
public override LocalisableString Title => EditorSetupStrings.ColoursHeader;
|
||||||
|
|
||||||
private LabelledColourPalette comboColours = null!;
|
private FormColourPalette comboColours = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
comboColours = new LabelledColourPalette
|
comboColours = new FormColourPalette
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.HitCircleSliderCombos,
|
Caption = EditorSetupStrings.HitCircleSliderCombos,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
|
||||||
ColourNamePrefix = EditorSetupStrings.ComboColourPrefix
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool syncingColours;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
if (Beatmap.BeatmapSkin != null)
|
if (Beatmap.BeatmapSkin != null)
|
||||||
comboColours.Colours.BindTo(Beatmap.BeatmapSkin.ComboColours);
|
comboColours.Colours.AddRange(Beatmap.BeatmapSkin.ComboColours);
|
||||||
|
|
||||||
|
if (comboColours.Colours.Count == 0)
|
||||||
|
{
|
||||||
|
// compare ctor of `EditorBeatmapSkin`
|
||||||
|
for (int i = 0; i < SkinConfiguration.DefaultComboColours.Count; ++i)
|
||||||
|
comboColours.Colours.Add(SkinConfiguration.DefaultComboColours[(i + 1) % SkinConfiguration.DefaultComboColours.Count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
comboColours.Colours.BindCollectionChanged((_, _) =>
|
||||||
|
{
|
||||||
|
if (Beatmap.BeatmapSkin != null)
|
||||||
|
{
|
||||||
|
if (syncingColours)
|
||||||
|
return;
|
||||||
|
|
||||||
|
syncingColours = true;
|
||||||
|
|
||||||
|
Beatmap.BeatmapSkin.ComboColours.Clear();
|
||||||
|
Beatmap.BeatmapSkin.ComboColours.AddRange(comboColours.Colours);
|
||||||
|
|
||||||
|
syncingColours = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Beatmap.BeatmapSkin?.ComboColours.BindCollectionChanged((_, _) =>
|
||||||
|
{
|
||||||
|
if (syncingColours)
|
||||||
|
return;
|
||||||
|
|
||||||
|
syncingColours = true;
|
||||||
|
|
||||||
|
comboColours.Colours.Clear();
|
||||||
|
comboColours.Colours.AddRange(Beatmap.BeatmapSkin?.ComboColours);
|
||||||
|
|
||||||
|
syncingColours = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,77 +15,77 @@ using osu.Game.Localisation;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup
|
namespace osu.Game.Screens.Edit.Setup
|
||||||
{
|
{
|
||||||
internal partial class DesignSection : SetupSection
|
public partial class DesignSection : SetupSection
|
||||||
{
|
{
|
||||||
protected LabelledSwitchButton EnableCountdown = null!;
|
protected FormCheckBox EnableCountdown = null!;
|
||||||
|
|
||||||
protected FillFlowContainer CountdownSettings = null!;
|
protected FillFlowContainer CountdownSettings = null!;
|
||||||
protected LabelledEnumDropdown<CountdownType> CountdownSpeed = null!;
|
protected FormEnumDropdown<CountdownType> CountdownSpeed = null!;
|
||||||
protected LabelledNumberBox CountdownOffset = null!;
|
protected FormNumberBox CountdownOffset = null!;
|
||||||
|
|
||||||
private LabelledSwitchButton widescreenSupport = null!;
|
private FormCheckBox widescreenSupport = null!;
|
||||||
private LabelledSwitchButton epilepsyWarning = null!;
|
private FormCheckBox epilepsyWarning = null!;
|
||||||
private LabelledSwitchButton letterboxDuringBreaks = null!;
|
private FormCheckBox letterboxDuringBreaks = null!;
|
||||||
private LabelledSwitchButton samplesMatchPlaybackRate = null!;
|
private FormCheckBox samplesMatchPlaybackRate = null!;
|
||||||
|
|
||||||
public override LocalisableString Title => EditorSetupStrings.DesignHeader;
|
public override LocalisableString Title => EditorSetupStrings.DesignHeader;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Children = new[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
EnableCountdown = new LabelledSwitchButton
|
EnableCountdown = new FormCheckBox
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.EnableCountdown,
|
Caption = EditorSetupStrings.EnableCountdown,
|
||||||
|
HintText = EditorSetupStrings.CountdownDescription,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None },
|
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None },
|
||||||
Description = EditorSetupStrings.CountdownDescription
|
|
||||||
},
|
},
|
||||||
CountdownSettings = new FillFlowContainer
|
CountdownSettings = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(5),
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
CountdownSpeed = new LabelledEnumDropdown<CountdownType>
|
CountdownSpeed = new FormEnumDropdown<CountdownType>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.CountdownSpeed,
|
Caption = EditorSetupStrings.CountdownSpeed,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None ? Beatmap.BeatmapInfo.Countdown : CountdownType.Normal },
|
Current = { Value = Beatmap.BeatmapInfo.Countdown != CountdownType.None ? Beatmap.BeatmapInfo.Countdown : CountdownType.Normal },
|
||||||
Items = Enum.GetValues<CountdownType>().Where(type => type != CountdownType.None)
|
Items = Enum.GetValues<CountdownType>().Where(type => type != CountdownType.None)
|
||||||
},
|
},
|
||||||
CountdownOffset = new LabelledNumberBox
|
CountdownOffset = new FormNumberBox
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.CountdownOffset,
|
Caption = EditorSetupStrings.CountdownOffset,
|
||||||
|
HintText = EditorSetupStrings.CountdownOffsetDescription,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.CountdownOffset.ToString() },
|
Current = { Value = Beatmap.BeatmapInfo.CountdownOffset.ToString() },
|
||||||
Description = EditorSetupStrings.CountdownOffsetDescription,
|
TabbableContentContainer = this,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Empty(),
|
widescreenSupport = new FormCheckBox
|
||||||
widescreenSupport = new LabelledSwitchButton
|
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.WidescreenSupport,
|
Caption = EditorSetupStrings.WidescreenSupport,
|
||||||
Description = EditorSetupStrings.WidescreenSupportDescription,
|
HintText = EditorSetupStrings.WidescreenSupportDescription,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.WidescreenStoryboard }
|
Current = { Value = Beatmap.BeatmapInfo.WidescreenStoryboard }
|
||||||
},
|
},
|
||||||
epilepsyWarning = new LabelledSwitchButton
|
epilepsyWarning = new FormCheckBox
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.EpilepsyWarning,
|
Caption = EditorSetupStrings.EpilepsyWarning,
|
||||||
Description = EditorSetupStrings.EpilepsyWarningDescription,
|
HintText = EditorSetupStrings.EpilepsyWarningDescription,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.EpilepsyWarning }
|
Current = { Value = Beatmap.BeatmapInfo.EpilepsyWarning }
|
||||||
},
|
},
|
||||||
letterboxDuringBreaks = new LabelledSwitchButton
|
letterboxDuringBreaks = new FormCheckBox
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.LetterboxDuringBreaks,
|
Caption = EditorSetupStrings.LetterboxDuringBreaks,
|
||||||
Description = EditorSetupStrings.LetterboxDuringBreaksDescription,
|
HintText = EditorSetupStrings.LetterboxDuringBreaksDescription,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.LetterboxInBreaks }
|
Current = { Value = Beatmap.BeatmapInfo.LetterboxInBreaks }
|
||||||
},
|
},
|
||||||
samplesMatchPlaybackRate = new LabelledSwitchButton
|
samplesMatchPlaybackRate = new FormCheckBox
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.SamplesMatchPlaybackRate,
|
Caption = EditorSetupStrings.SamplesMatchPlaybackRate,
|
||||||
Description = EditorSetupStrings.SamplesMatchPlaybackRateDescription,
|
HintText = EditorSetupStrings.SamplesMatchPlaybackRateDescription,
|
||||||
Current = { Value = Beatmap.BeatmapInfo.SamplesMatchPlaybackRate }
|
Current = { Value = Beatmap.BeatmapInfo.SamplesMatchPlaybackRate }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,12 +15,12 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
public partial class DifficultySection : SetupSection
|
public partial class DifficultySection : SetupSection
|
||||||
{
|
{
|
||||||
private LabelledSliderBar<float> circleSizeSlider { get; set; } = null!;
|
private FormSliderBar<float> circleSizeSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> healthDrainSlider { get; set; } = null!;
|
private FormSliderBar<float> healthDrainSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> approachRateSlider { get; set; } = null!;
|
private FormSliderBar<float> approachRateSlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
private FormSliderBar<float> overallDifficultySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
private FormSliderBar<double> baseVelocitySlider { get; set; } = null!;
|
||||||
private LabelledSliderBar<double> tickRateSlider { get; set; } = null!;
|
private FormSliderBar<double> tickRateSlider { get; set; } = null!;
|
||||||
|
|
||||||
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;
|
||||||
|
|
||||||
@ -29,90 +29,96 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
circleSizeSlider = new LabelledSliderBar<float>
|
circleSizeSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsCs,
|
Caption = BeatmapsetsStrings.ShowStatsCs,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.CircleSizeDescription,
|
||||||
Description = EditorSetupStrings.CircleSizeDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
|
Current = new BindableFloat(Beatmap.Difficulty.CircleSize)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
healthDrainSlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
healthDrainSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsDrain,
|
Caption = BeatmapsetsStrings.ShowStatsDrain,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.DrainRateDescription,
|
||||||
Description = EditorSetupStrings.DrainRateDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
Current = new BindableFloat(Beatmap.Difficulty.DrainRate)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
approachRateSlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
approachRateSlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsAr,
|
Caption = BeatmapsetsStrings.ShowStatsAr,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.ApproachRateDescription,
|
||||||
Description = EditorSetupStrings.ApproachRateDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.ApproachRate)
|
Current = new BindableFloat(Beatmap.Difficulty.ApproachRate)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
overallDifficultySlider = new LabelledSliderBar<float>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
overallDifficultySlider = new FormSliderBar<float>
|
||||||
{
|
{
|
||||||
Label = BeatmapsetsStrings.ShowStatsAccuracy,
|
Caption = BeatmapsetsStrings.ShowStatsAccuracy,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.OverallDifficultyDescription,
|
||||||
Description = EditorSetupStrings.OverallDifficultyDescription,
|
|
||||||
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
Current = new BindableFloat(Beatmap.Difficulty.OverallDifficulty)
|
||||||
{
|
{
|
||||||
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
Default = BeatmapDifficulty.DEFAULT_DIFFICULTY,
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 10,
|
MaxValue = 10,
|
||||||
Precision = 0.1f,
|
Precision = 0.1f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
baseVelocitySlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
baseVelocitySlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.BaseVelocity,
|
Caption = EditorSetupStrings.BaseVelocity,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.BaseVelocityDescription,
|
||||||
Description = EditorSetupStrings.BaseVelocityDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderMultiplier)
|
||||||
{
|
{
|
||||||
Default = 1.4,
|
Default = 1.4,
|
||||||
MinValue = 0.4,
|
MinValue = 0.4,
|
||||||
MaxValue = 3.6,
|
MaxValue = 3.6,
|
||||||
Precision = 0.01f,
|
Precision = 0.01f,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
tickRateSlider = new LabelledSliderBar<double>
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
|
},
|
||||||
|
tickRateSlider = new FormSliderBar<double>
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.TickRate,
|
Caption = EditorSetupStrings.TickRate,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
HintText = EditorSetupStrings.TickRateDescription,
|
||||||
Description = EditorSetupStrings.TickRateDescription,
|
|
||||||
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
Current = new BindableDouble(Beatmap.Difficulty.SliderTickRate)
|
||||||
{
|
{
|
||||||
Default = 1,
|
Default = 1,
|
||||||
MinValue = 1,
|
MinValue = 1,
|
||||||
MaxValue = 4,
|
MaxValue = 4,
|
||||||
Precision = 1,
|
Precision = 1,
|
||||||
}
|
},
|
||||||
|
TransferValueOnCommit = true,
|
||||||
|
TabbableContentContainer = this,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledSliderBar<float>>())
|
foreach (var item in Children.OfType<FormSliderBar<float>>())
|
||||||
item.Current.ValueChanged += _ => updateValues();
|
item.Current.ValueChanged += _ => updateValues();
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledSliderBar<double>>())
|
foreach (var item in Children.OfType<FormSliderBar<double>>())
|
||||||
item.Current.ValueChanged += _ => updateValues();
|
item.Current.ValueChanged += _ => updateValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// 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 osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup
|
|
||||||
{
|
|
||||||
internal partial class LabelledRomanisedTextBox : LabelledTextBox
|
|
||||||
{
|
|
||||||
protected override OsuTextBox CreateTextBox() => new RomanisedTextBox();
|
|
||||||
|
|
||||||
private partial class RomanisedTextBox : OsuTextBox
|
|
||||||
{
|
|
||||||
protected override bool AllowIme => false;
|
|
||||||
|
|
||||||
protected override bool CanAddCharacter(char character)
|
|
||||||
=> MetadataUtils.IsRomanised(character);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,16 +14,16 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
public partial class MetadataSection : SetupSection
|
public partial class MetadataSection : SetupSection
|
||||||
{
|
{
|
||||||
protected LabelledTextBox ArtistTextBox = null!;
|
protected FormTextBox ArtistTextBox = null!;
|
||||||
protected LabelledTextBox RomanisedArtistTextBox = null!;
|
protected FormTextBox RomanisedArtistTextBox = null!;
|
||||||
|
|
||||||
protected LabelledTextBox TitleTextBox = null!;
|
protected FormTextBox TitleTextBox = null!;
|
||||||
protected LabelledTextBox RomanisedTitleTextBox = null!;
|
protected FormTextBox RomanisedTitleTextBox = null!;
|
||||||
|
|
||||||
private LabelledTextBox creatorTextBox = null!;
|
private FormTextBox creatorTextBox = null!;
|
||||||
private LabelledTextBox difficultyTextBox = null!;
|
private FormTextBox difficultyTextBox = null!;
|
||||||
private LabelledTextBox sourceTextBox = null!;
|
private FormTextBox sourceTextBox = null!;
|
||||||
private LabelledTextBox tagsTextBox = null!;
|
private FormTextBox tagsTextBox = null!;
|
||||||
|
|
||||||
public override LocalisableString Title => EditorSetupStrings.MetadataHeader;
|
public override LocalisableString Title => EditorSetupStrings.MetadataHeader;
|
||||||
|
|
||||||
@ -34,33 +34,26 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
ArtistTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.Artist,
|
ArtistTextBox = createTextBox<FormTextBox>(EditorSetupStrings.Artist,
|
||||||
!string.IsNullOrEmpty(metadata.ArtistUnicode) ? metadata.ArtistUnicode : metadata.Artist),
|
!string.IsNullOrEmpty(metadata.ArtistUnicode) ? metadata.ArtistUnicode : metadata.Artist),
|
||||||
RomanisedArtistTextBox = createTextBox<LabelledRomanisedTextBox>(EditorSetupStrings.RomanisedArtist,
|
RomanisedArtistTextBox = createTextBox<FormRomanisedTextBox>(EditorSetupStrings.RomanisedArtist,
|
||||||
!string.IsNullOrEmpty(metadata.Artist) ? metadata.Artist : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),
|
!string.IsNullOrEmpty(metadata.Artist) ? metadata.Artist : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),
|
||||||
|
TitleTextBox = createTextBox<FormTextBox>(EditorSetupStrings.Title,
|
||||||
Empty(),
|
|
||||||
|
|
||||||
TitleTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.Title,
|
|
||||||
!string.IsNullOrEmpty(metadata.TitleUnicode) ? metadata.TitleUnicode : metadata.Title),
|
!string.IsNullOrEmpty(metadata.TitleUnicode) ? metadata.TitleUnicode : metadata.Title),
|
||||||
RomanisedTitleTextBox = createTextBox<LabelledRomanisedTextBox>(EditorSetupStrings.RomanisedTitle,
|
RomanisedTitleTextBox = createTextBox<FormRomanisedTextBox>(EditorSetupStrings.RomanisedTitle,
|
||||||
!string.IsNullOrEmpty(metadata.Title) ? metadata.Title : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),
|
!string.IsNullOrEmpty(metadata.Title) ? metadata.Title : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),
|
||||||
|
creatorTextBox = createTextBox<FormTextBox>(EditorSetupStrings.Creator, metadata.Author.Username),
|
||||||
Empty(),
|
difficultyTextBox = createTextBox<FormTextBox>(EditorSetupStrings.DifficultyName, Beatmap.BeatmapInfo.DifficultyName),
|
||||||
|
sourceTextBox = createTextBox<FormTextBox>(BeatmapsetsStrings.ShowInfoSource, metadata.Source),
|
||||||
creatorTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.Creator, metadata.Author.Username),
|
tagsTextBox = createTextBox<FormTextBox>(BeatmapsetsStrings.ShowInfoTags, metadata.Tags)
|
||||||
difficultyTextBox = createTextBox<LabelledTextBox>(EditorSetupStrings.DifficultyName, Beatmap.BeatmapInfo.DifficultyName),
|
|
||||||
sourceTextBox = createTextBox<LabelledTextBox>(BeatmapsetsStrings.ShowInfoSource, metadata.Source),
|
|
||||||
tagsTextBox = createTextBox<LabelledTextBox>(BeatmapsetsStrings.ShowInfoTags, metadata.Tags)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private TTextBox createTextBox<TTextBox>(LocalisableString label, string initialValue)
|
private TTextBox createTextBox<TTextBox>(LocalisableString label, string initialValue)
|
||||||
where TTextBox : LabelledTextBox, new()
|
where TTextBox : FormTextBox, new()
|
||||||
=> new TTextBox
|
=> new TTextBox
|
||||||
{
|
{
|
||||||
Label = label,
|
Caption = label,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
|
||||||
Current = { Value = initialValue },
|
Current = { Value = initialValue },
|
||||||
TabbableContentContainer = this
|
TabbableContentContainer = this
|
||||||
};
|
};
|
||||||
@ -75,13 +68,13 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox));
|
ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox));
|
||||||
TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox));
|
TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox));
|
||||||
|
|
||||||
foreach (var item in Children.OfType<LabelledTextBox>())
|
foreach (var item in Children.OfType<FormTextBox>())
|
||||||
item.OnCommit += onCommit;
|
item.OnCommit += onCommit;
|
||||||
|
|
||||||
updateReadOnlyState();
|
updateReadOnlyState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transferIfRomanised(string value, LabelledTextBox target)
|
private void transferIfRomanised(string value, FormTextBox target)
|
||||||
{
|
{
|
||||||
if (MetadataUtils.IsRomanised(value))
|
if (MetadataUtils.IsRomanised(value))
|
||||||
target.Current.Value = value;
|
target.Current.Value = value;
|
||||||
@ -119,5 +112,18 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
|
|
||||||
Beatmap.SaveState();
|
Beatmap.SaveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private partial class FormRomanisedTextBox : FormTextBox
|
||||||
|
{
|
||||||
|
internal override InnerTextBox CreateTextBox() => new RomanisedTextBox();
|
||||||
|
|
||||||
|
private partial class RomanisedTextBox : InnerTextBox
|
||||||
|
{
|
||||||
|
protected override bool AllowIme => false;
|
||||||
|
|
||||||
|
protected override bool CanAddCharacter(char character)
|
||||||
|
=> MetadataUtils.IsRomanised(character);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,16 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup
|
namespace osu.Game.Screens.Edit.Setup
|
||||||
{
|
{
|
||||||
internal partial class ResourcesSection : SetupSection
|
public partial class ResourcesSection : SetupSection
|
||||||
{
|
{
|
||||||
private LabelledFileChooser audioTrackChooser = null!;
|
private FormFileSelector audioTrackChooser = null!;
|
||||||
private LabelledFileChooser backgroundChooser = null!;
|
private FormFileSelector backgroundChooser = null!;
|
||||||
|
|
||||||
public override LocalisableString Title => EditorSetupStrings.ResourcesHeader;
|
public override LocalisableString Title => EditorSetupStrings.ResourcesHeader;
|
||||||
|
|
||||||
@ -34,28 +35,33 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Editor? editor { get; set; }
|
private Editor? editor { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
private SetupScreenHeaderBackground headerBackground = null!;
|
||||||
private SetupScreenHeader header { get; set; } = null!;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
headerBackground = new SetupScreenHeaderBackground
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 110,
|
||||||
|
};
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
backgroundChooser = new LabelledFileChooser(".jpg", ".jpeg", ".png")
|
backgroundChooser = new FormFileSelector(".jpg", ".jpeg", ".png")
|
||||||
{
|
{
|
||||||
Label = GameplaySettingsStrings.BackgroundHeader,
|
Caption = GameplaySettingsStrings.BackgroundHeader,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
PlaceholderText = EditorSetupStrings.ClickToSelectBackground,
|
||||||
TabbableContentContainer = this
|
|
||||||
},
|
},
|
||||||
audioTrackChooser = new LabelledFileChooser(".mp3", ".ogg")
|
audioTrackChooser = new FormFileSelector(".mp3", ".ogg")
|
||||||
{
|
{
|
||||||
Label = EditorSetupStrings.AudioTrack,
|
Caption = EditorSetupStrings.AudioTrack,
|
||||||
FixedLabelWidth = LABEL_WIDTH,
|
PlaceholderText = EditorSetupStrings.ClickToSelectTrack,
|
||||||
TabbableContentContainer = this
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
backgroundChooser.PreviewContainer.Add(headerBackground);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(working.Value.Metadata.BackgroundFile))
|
if (!string.IsNullOrEmpty(working.Value.Metadata.BackgroundFile))
|
||||||
backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile);
|
backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile);
|
||||||
|
|
||||||
@ -64,8 +70,6 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
|
|
||||||
backgroundChooser.Current.BindValueChanged(backgroundChanged);
|
backgroundChooser.Current.BindValueChanged(backgroundChanged);
|
||||||
audioTrackChooser.Current.BindValueChanged(audioTrackChanged);
|
audioTrackChooser.Current.BindValueChanged(audioTrackChanged);
|
||||||
|
|
||||||
updatePlaceholderText();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ChangeBackgroundImage(FileInfo source)
|
public bool ChangeBackgroundImage(FileInfo source)
|
||||||
@ -92,7 +96,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
editorBeatmap.SaveState();
|
editorBeatmap.SaveState();
|
||||||
|
|
||||||
working.Value.Metadata.BackgroundFile = destination.Name;
|
working.Value.Metadata.BackgroundFile = destination.Name;
|
||||||
header.Background.UpdateBackground();
|
headerBackground.UpdateBackground();
|
||||||
|
|
||||||
editor?.ApplyToBackground(bg => bg.RefreshBackground());
|
editor?.ApplyToBackground(bg => bg.RefreshBackground());
|
||||||
|
|
||||||
@ -132,22 +136,12 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
if (file.NewValue == null || !ChangeBackgroundImage(file.NewValue))
|
if (file.NewValue == null || !ChangeBackgroundImage(file.NewValue))
|
||||||
backgroundChooser.Current.Value = file.OldValue;
|
backgroundChooser.Current.Value = file.OldValue;
|
||||||
|
|
||||||
updatePlaceholderText();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void audioTrackChanged(ValueChangedEvent<FileInfo?> file)
|
private void audioTrackChanged(ValueChangedEvent<FileInfo?> file)
|
||||||
{
|
{
|
||||||
if (file.NewValue == null || !ChangeAudioTrack(file.NewValue))
|
if (file.NewValue == null || !ChangeAudioTrack(file.NewValue))
|
||||||
audioTrackChooser.Current.Value = file.OldValue;
|
audioTrackChooser.Current.Value = file.OldValue;
|
||||||
|
|
||||||
updatePlaceholderText();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePlaceholderText()
|
|
||||||
{
|
|
||||||
audioTrackChooser.Text = audioTrackChooser.Current.Value?.Name ?? EditorSetupStrings.ClickToSelectTrack;
|
|
||||||
backgroundChooser.Text = backgroundChooser.Current.Value?.Name ?? EditorSetupStrings.ClickToSelectBackground;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,55 +1,81 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup
|
namespace osu.Game.Screens.Edit.Setup
|
||||||
{
|
{
|
||||||
public partial class SetupScreen : EditorScreen
|
public partial class SetupScreen : EditorScreen
|
||||||
{
|
{
|
||||||
[Cached]
|
public const float COLUMN_WIDTH = 450;
|
||||||
private SectionsContainer<SetupSection> sections { get; } = new SetupScreenSectionsContainer();
|
public const float SPACING = 28;
|
||||||
|
public const float MAX_WIDTH = 2 * COLUMN_WIDTH + SPACING;
|
||||||
[Cached]
|
|
||||||
private SetupScreenHeader header = new SetupScreenHeader();
|
|
||||||
|
|
||||||
public SetupScreen()
|
public SetupScreen()
|
||||||
: base(EditorScreenMode.SongSetup)
|
: base(EditorScreenMode.SongSetup)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OsuScrollContainer scroll = null!;
|
||||||
|
private FillFlowContainer flow = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
|
private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
||||||
|
|
||||||
List<SetupSection> sectionsEnumerable =
|
Children = new Drawable[]
|
||||||
[
|
{
|
||||||
new ResourcesSection(),
|
new Box
|
||||||
new MetadataSection()
|
|
||||||
];
|
|
||||||
|
|
||||||
sectionsEnumerable.AddRange(ruleset.CreateEditorSetupSections());
|
|
||||||
sectionsEnumerable.Add(new DesignSection());
|
|
||||||
|
|
||||||
Add(new Box
|
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Background3,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
});
|
Colour = colourProvider.Background3,
|
||||||
|
},
|
||||||
Add(sections.With(s =>
|
scroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
s.RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both,
|
||||||
s.ChildrenEnumerable = sectionsEnumerable;
|
Padding = new MarginPadding(15),
|
||||||
s.FixedHeader = header;
|
Child = flow = new FillFlowContainer
|
||||||
}));
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Full,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Spacing = new Vector2(25),
|
||||||
|
ChildrenEnumerable = ruleset.CreateEditorSetupSections().Select(section => section.With(s =>
|
||||||
|
{
|
||||||
|
s.Width = 450;
|
||||||
|
s.Anchor = Anchor.TopCentre;
|
||||||
|
s.Origin = Anchor.TopCentre;
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
if (scroll.DrawWidth > MAX_WIDTH)
|
||||||
|
{
|
||||||
|
flow.RelativeSizeAxes = Axes.None;
|
||||||
|
flow.Width = MAX_WIDTH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flow.RelativeSizeAxes = Axes.X;
|
||||||
|
flow.Width = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExiting(ScreenExitEvent e)
|
public override void OnExiting(ScreenExitEvent e)
|
||||||
@ -62,19 +88,5 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
// (and potentially block the exit procedure for save).
|
// (and potentially block the exit procedure for save).
|
||||||
GetContainingFocusManager()?.TriggerFocusContention(this);
|
GetContainingFocusManager()?.TriggerFocusContention(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class SetupScreenSectionsContainer : SectionsContainer<SetupSection>
|
|
||||||
{
|
|
||||||
protected override UserTrackingScrollContainer CreateScrollContainer()
|
|
||||||
{
|
|
||||||
var scrollContainer = base.CreateScrollContainer();
|
|
||||||
|
|
||||||
// Workaround for masking issues (see https://github.com/ppy/osu-framework/issues/1675#issuecomment-910023157)
|
|
||||||
// Note that this actually causes the full scroll range to be reduced by 2px at the bottom, but it's not really noticeable.
|
|
||||||
scrollContainer.Margin = new MarginPadding { Top = 2 };
|
|
||||||
|
|
||||||
return scrollContainer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
InternalChild = content = new Container
|
InternalChild = content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true
|
Masking = true,
|
||||||
|
CornerRadius = 3.5f,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -34,33 +34,25 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Vertical = 10,
|
|
||||||
Horizontal = 100
|
|
||||||
};
|
|
||||||
|
|
||||||
InternalChild = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(20),
|
Spacing = new Vector2(10),
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new SectionHeader(Title)
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
Margin = new MarginPadding { Left = 9, },
|
||||||
Text = Title
|
|
||||||
},
|
},
|
||||||
flow = new FillFlowContainer
|
flow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(5),
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,17 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public partial class ArgonSongProgressBar : SongProgressBar
|
public partial class ArgonSongProgressBar : SongProgressBar, IHasTooltip
|
||||||
{
|
{
|
||||||
// Parent will handle restricting the area of valid input.
|
// Parent will handle restricting the area of valid input.
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||||
@ -33,6 +35,23 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private double trackTime => (EndTime - StartTime) * Progress;
|
private double trackTime => (EndTime - StartTime) * Progress;
|
||||||
|
|
||||||
|
private float lastMouseX;
|
||||||
|
|
||||||
|
public LocalisableString TooltipText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double progress = Math.Clamp(lastMouseX, 0, DrawWidth) / DrawWidth;
|
||||||
|
|
||||||
|
TimeSpan currentSpan = TimeSpan.FromMilliseconds(Math.Round((EndTime - StartTime) * progress));
|
||||||
|
|
||||||
|
int seconds = currentSpan.Duration().Seconds;
|
||||||
|
int minutes = (int)Math.Floor(currentSpan.Duration().TotalMinutes);
|
||||||
|
|
||||||
|
return $"{minutes}:{seconds:D2} ({progress:P0})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ArgonSongProgressBar(float barHeight)
|
public ArgonSongProgressBar(float barHeight)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -84,6 +103,14 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), mainColour, 200, Easing.In);
|
playfieldBar.TransformTo(nameof(playfieldBar.AccentColour), mainColour, 200, Easing.In);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
|
{
|
||||||
|
base.OnMouseMove(e);
|
||||||
|
|
||||||
|
lastMouseX = e.MousePosition.X;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
if (Interactive)
|
if (Interactive)
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.5.0" />
|
<PackageReference Include="Realm" Version="11.5.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2024.927.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2024.1007.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.904.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.904.0" />
|
||||||
<PackageReference Include="Sentry" Version="4.3.0" />
|
<PackageReference Include="Sentry" Version="4.3.0" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
<MtouchInterpreter>-all</MtouchInterpreter>
|
<MtouchInterpreter>-all</MtouchInterpreter>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.927.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.1007.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user