-
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 #2314 from andy840119/migrate-lyric-style-into-stage
Use command pattern to update the lyric style.
- Loading branch information
Showing
34 changed files
with
186 additions
and
246 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
51 changes: 0 additions & 51 deletions
51
osu.Game.Rulesets.Karaoke.Tests/Resources/special-skin/lyric-styles.json
This file was deleted.
Oops, something went wrong.
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
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,8 +1,11 @@ | ||
// 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.Shaders; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Rulesets.Karaoke.Skinning.Tools; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Graphics.Sprites; | ||
|
||
|
@@ -18,6 +21,9 @@ public DrawableKaraokeSpriteText(Lyric lyric) | |
{ | ||
private readonly DisplayLyricProcessor processor; | ||
|
||
[Resolved] | ||
private ShaderManager? shaderManager { get; set; } | ||
|
||
protected DrawableKaraokeSpriteText(Lyric lyric) | ||
{ | ||
processor = new DisplayLyricProcessor(lyric) | ||
|
@@ -68,4 +74,14 @@ protected override void Dispose(bool isDisposing) | |
base.Dispose(isDisposing); | ||
processor.Dispose(); | ||
} | ||
|
||
public void UpdateStyle(LyricStyle style) | ||
{ | ||
// for prevent issue Collection was modified; enumeration operation may not execute. | ||
Schedule(() => | ||
{ | ||
LeftLyricTextShaders = SkinConverterTool.ConvertLeftSideShader(shaderManager, style); | ||
RightLyricTextShaders = SkinConverterTool.ConvertRightSideShader(shaderManager, style); | ||
}); | ||
} | ||
} |
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,23 +1,18 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// 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 System.Collections.Generic; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Extensions.Color4Extensions; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Shaders; | ||
using osu.Game.Rulesets.Karaoke.Objects.Drawables; | ||
using osu.Game.Rulesets.Karaoke.Skinning.Tools; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Skinning.Elements; | ||
namespace osu.Game.Rulesets.Karaoke.Graphics.Sprites; | ||
|
||
public class LyricStyle : IKaraokeSkinElement | ||
public class LyricStyle | ||
{ | ||
public static LyricStyle CreateDefault() => new() | ||
{ | ||
Name = "Default", | ||
LeftLyricTextShaders = new ICustomizedShader[] | ||
{ | ||
new StepShader | ||
|
@@ -60,25 +55,7 @@ public class LyricStyle : IKaraokeSkinElement | |
}, | ||
}; | ||
|
||
public int ID { get; set; } | ||
|
||
public string Name { get; set; } = string.Empty; | ||
|
||
public IReadOnlyList<ICustomizedShader> LeftLyricTextShaders = Array.Empty<ICustomizedShader>(); | ||
|
||
public IReadOnlyList<ICustomizedShader> RightLyricTextShaders = Array.Empty<ICustomizedShader>(); | ||
|
||
public void ApplyTo(Drawable d) | ||
{ | ||
if (d is not DrawableLyric drawableLyric) | ||
throw new InvalidDrawableTypeException(nameof(d)); | ||
|
||
var shaderManager = drawableLyric.Dependencies.Get<ShaderManager>(); | ||
drawableLyric.ApplyToLyricPieces(l => | ||
{ | ||
// Apply shader. | ||
l.LeftLyricTextShaders = SkinConverterTool.ConvertLeftSideShader(shaderManager, this); | ||
l.RightLyricTextShaders = SkinConverterTool.ConvertRightSideShader(shaderManager, this); | ||
}); | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
osu.Game.Rulesets.Karaoke/Resources/Skin/Default/lyric-styles.json
This file was deleted.
Oops, something went wrong.
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.