-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1811 from andy840119/apply-auto-generator-into-ed…
…itor Apply auto generator into editor.
- Loading branch information
Showing
16 changed files
with
381 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...esets.Karaoke.Tests/Screens/Edit/Beatmap/Configs/TestSceneBeatmapGeneratorConfigDialog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Rulesets.Karaoke.Configuration; | ||
using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Configs.Generator.Beatmaps.Pages; | ||
using osu.Game.Tests.Visual; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Screens.Edit.Beatmap.Configs; | ||
|
||
[TestFixture] | ||
public partial class TestSceneBeatmapGeneratorConfigDialog : OsuTestScene | ||
{ | ||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
var config = new KaraokeRulesetEditGeneratorConfigManager(); | ||
Dependencies.Cache(config); | ||
} | ||
|
||
[TestCase(typeof(PageGeneratorConfigDialog), TestName = nameof(PageGeneratorConfigDialog))] | ||
public void TestGenerate(Type configType) | ||
{ | ||
AddStep("Show dialog", () => | ||
{ | ||
Schedule(() => | ||
{ | ||
Child = Activator.CreateInstance(configType) as Drawable; | ||
Child?.Show(); | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...Rulesets.Karaoke/Screens/Edit/Beatmaps/Configs/Generator/Beatmaps/Pages/GenericSection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Graphics.UserInterfaceV2; | ||
using osu.Game.Rulesets.Karaoke.Edit.Checks; | ||
using osu.Game.Rulesets.Karaoke.Edit.Generator.Beatmaps.Pages; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Configs.Generator.Beatmaps.Pages; | ||
|
||
public partial class GenericSection : GeneratorConfigSection<PageGeneratorConfig> | ||
{ | ||
private readonly LabelledSliderBar<double> minTimeTextBox; | ||
private readonly LabelledSliderBar<double> maxTimeTextButton; | ||
private readonly LabelledSwitchButton clearExistPagesSwitchButton; | ||
|
||
protected override string Title => "Generic"; | ||
|
||
public GenericSection(Bindable<PageGeneratorConfig> current) | ||
: base(current) | ||
{ | ||
Children = new Drawable[] | ||
{ | ||
minTimeTextBox = new LabelledSliderBar<double> | ||
{ | ||
Label = "Min time", | ||
Description = "Min interval between pages.", | ||
Current = new BindableDouble | ||
{ | ||
MinValue = CheckBeatmapPageInfo.MIN_INTERVAL, | ||
MaxValue = CheckBeatmapPageInfo.MAX_INTERVAL, | ||
Precision = 0.1f, | ||
} | ||
}, | ||
maxTimeTextButton = new LabelledSliderBar<double> | ||
{ | ||
Label = "Max time", | ||
Description = "Max interval between pages.", | ||
Current = new BindableDouble | ||
{ | ||
MinValue = CheckBeatmapPageInfo.MIN_INTERVAL, | ||
MaxValue = CheckBeatmapPageInfo.MAX_INTERVAL, | ||
Precision = 0.1f, | ||
} | ||
}, | ||
clearExistPagesSwitchButton = new LabelledSwitchButton | ||
{ | ||
Label = "Clear the exist page.", | ||
Description = "Clear the exist page after generated.", | ||
}, | ||
}; | ||
|
||
RegisterConfig(minTimeTextBox.Current, nameof(PageGeneratorConfig.MinTime)); | ||
RegisterConfig(maxTimeTextButton.Current, nameof(PageGeneratorConfig.MaxTime)); | ||
RegisterConfig(clearExistPagesSwitchButton.Current, nameof(PageGeneratorConfig.ClearExistPages)); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...raoke/Screens/Edit/Beatmaps/Configs/Generator/Beatmaps/Pages/PageGeneratorConfigDialog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Bindables; | ||
using osu.Game.Overlays; | ||
using osu.Game.Rulesets.Karaoke.Configuration; | ||
using osu.Game.Rulesets.Karaoke.Edit.Generator.Beatmaps.Pages; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Configs.Generator.Beatmaps.Pages | ||
{ | ||
public partial class PageGeneratorConfigDialog : GeneratorConfigDialog<PageGeneratorConfig> | ||
{ | ||
protected override KaraokeRulesetEditGeneratorSetting Config => KaraokeRulesetEditGeneratorSetting.BeatmapPageGeneratorConfig; | ||
|
||
protected override OverlayColourScheme OverlayColourScheme => OverlayColourScheme.Green; | ||
|
||
protected override string Title => "Page generator config."; | ||
|
||
protected override string Description => "Change config for page generator."; | ||
|
||
protected override GeneratorConfigSection[] CreateConfigSection(Bindable<PageGeneratorConfig> current) | ||
{ | ||
return new GeneratorConfigSection[] | ||
{ | ||
new GenericSection(current), | ||
}; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...aoke/Screens/Edit/Beatmaps/Configs/Generator/Beatmaps/Pages/PageGeneratorConfigPopover.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Bindables; | ||
using osu.Game.Rulesets.Karaoke.Configuration; | ||
using osu.Game.Rulesets.Karaoke.Edit.Generator.Beatmaps.Pages; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Configs.Generator.Beatmaps.Pages | ||
{ | ||
public partial class PageGeneratorConfigPopover : GeneratorConfigPopover<PageGeneratorConfig> | ||
{ | ||
protected override KaraokeRulesetEditGeneratorSetting Config => KaraokeRulesetEditGeneratorSetting.BeatmapPageGeneratorConfig; | ||
|
||
protected override GeneratorConfigSection[] CreateConfigSection(Bindable<PageGeneratorConfig> current) | ||
{ | ||
return new GeneratorConfigSection[] | ||
{ | ||
new GenericSection(current), | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.