-
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.
- Loading branch information
1 parent
e814583
commit 866e348
Showing
5 changed files
with
202 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
// 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.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Rulesets.Karaoke.Graphics.UserInterface; | ||
using osu.Game.Skinning; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Style | ||
{ | ||
internal class NoteColorSection : StyleSection | ||
{ | ||
private ColorPicker noteColorPicker; | ||
private ColorPicker blinkColorPicker; | ||
|
||
protected override string Title => "Color"; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(SkinManager manager) | ||
{ | ||
Children = new Drawable[] | ||
{ | ||
noteColorPicker = new ColorPicker | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
}, | ||
blinkColorPicker = new ColorPicker | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
} | ||
}; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +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 osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Graphics.UserInterfaceV2; | ||
using osu.Game.Rulesets.Karaoke.Graphics.UserInterface; | ||
using osu.Game.Skinning; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Style | ||
{ | ||
internal class NoteFontSection : StyleSection | ||
{ | ||
private ColorPicker textColorPicker; | ||
private LabelledSwitchButton boldSwitchButton; | ||
|
||
protected override string Title => "Font"; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(SkinManager manager) | ||
{ | ||
Children = new Drawable[] | ||
{ | ||
textColorPicker = new ColorPicker | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
}, | ||
boldSwitchButton = new LabelledSwitchButton | ||
{ | ||
Label = "Bold", | ||
Description = "Select bold or not.", | ||
} | ||
}; | ||
} | ||
} | ||
} |
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,98 @@ | ||
// 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.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Game.Overlays; | ||
using osu.Game.Rulesets.Karaoke.Configuration; | ||
using osu.Game.Rulesets.Karaoke.UI; | ||
using osu.Game.Rulesets.Karaoke.UI.Position; | ||
using osu.Game.Rulesets.UI.Scrolling; | ||
using osu.Game.Rulesets.UI.Scrolling.Algorithms; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Style | ||
{ | ||
public class NoteStylePreview : Container | ||
{ | ||
private const int preview_column = 9; | ||
|
||
[Cached(Type = typeof(IScrollingInfo))] | ||
private readonly PreviewScrollingInfo scrollingInfo = new PreviewScrollingInfo(); | ||
|
||
[Cached(Type = typeof(IPositionCalculator))] | ||
private readonly PositionCalculator positionCalculator = new PositionCalculator(preview_column); | ||
|
||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) | ||
{ | ||
var configCache = parent.Get<RulesetConfigCache>(); | ||
var config = (KaraokeRulesetConfigManager)configCache.GetConfigFor(new KaraokeRuleset()); | ||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); | ||
dependencies.Cache(new KaraokeSessionStatics(config, null)); | ||
|
||
return dependencies; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OverlayColourProvider colourProvider, StyleManager manager) | ||
{ | ||
Masking = true; | ||
CornerRadius = 15; | ||
FillMode = FillMode.Fit; | ||
FillAspectRatio = 2f; | ||
Children = new Drawable[] | ||
{ | ||
new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Colour = colourProvider.Background1, | ||
}, | ||
new PreviewDrawableNoteArea | ||
{ | ||
Anchor = Anchor.Centre, | ||
Origin = Anchor.Centre | ||
} | ||
}; | ||
} | ||
|
||
public class PreviewDrawableNoteArea : NotePlayfield | ||
{ | ||
public PreviewDrawableNoteArea() | ||
: base(preview_column) | ||
{ | ||
} | ||
} | ||
|
||
public class PreviewScrollingInfo : IScrollingInfo | ||
{ | ||
public IBindable<ScrollingDirection> Direction { get; } = new Bindable<ScrollingDirection>(); | ||
|
||
public IBindable<double> TimeRange { get; } = new BindableDouble(); | ||
|
||
public IScrollAlgorithm Algorithm { get; set; } = new ZeroScrollAlgorithm(); | ||
|
||
private class ZeroScrollAlgorithm : IScrollAlgorithm | ||
{ | ||
protected const double START_TIME = 1000000000; | ||
|
||
public double GetDisplayStartTime(double originTime, float offset, double timeRange, float scrollLength) | ||
=> double.MinValue; | ||
|
||
public float GetLength(double startTime, double endTime, double timeRange, float scrollLength) | ||
=> scrollLength; | ||
|
||
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength) | ||
=> (float)((time - START_TIME) / timeRange) * scrollLength; | ||
|
||
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength) | ||
=> 0; | ||
|
||
public void Reset() | ||
{ | ||
} | ||
} | ||
} | ||
} | ||
} |
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