mirror of
https://github.com/SK-la/Ez2Lazer.git
synced 2026-03-13 11:20:28 +00:00
1. 匹配新版按钮控件的自动宽度写法 2. 统一Ez日志写入方向 3.移除历史修改:缓存启用mod列表,切换mod时保持通用mod开启状态 4.代码格式化、 5.修改文件名称表意,更直观
53 lines
2.0 KiB
C#
53 lines
2.0 KiB
C#
// 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.Bindables;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Logging;
|
|
using osu.Game.Graphics.UserInterface;
|
|
using osu.Game.LAsEzExtensions.Configuration;
|
|
|
|
namespace osu.Game.LAsEzExtensions.UserInterface
|
|
{
|
|
public partial class ShearedKSPreviewButton : ShearedButton
|
|
{
|
|
public Bindable<KeySoundPreviewMode> State = new Bindable<KeySoundPreviewMode>();
|
|
|
|
protected override void LoadComplete()
|
|
{
|
|
Action = () => State.Value = (KeySoundPreviewMode)(((int)State.Value + 1) % 3);
|
|
Logger.Log($@"[Ez]KeySoundPreviewMode: {State.Value.ToString()}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
|
|
State.BindValueChanged(_ => UpdateState(), true);
|
|
|
|
base.LoadComplete();
|
|
}
|
|
|
|
protected virtual void UpdateState()
|
|
{
|
|
// Visual mapping for three states:
|
|
// 0 = off, 1 = on (default highlight), 2 = alt-on (distinct beige colour)
|
|
switch (State.Value)
|
|
{
|
|
case KeySoundPreviewMode.Off:
|
|
DarkerColour = ColourProvider.Background3;
|
|
LighterColour = ColourProvider.Background1;
|
|
TextColour = ColourProvider.Content1;
|
|
break;
|
|
|
|
case KeySoundPreviewMode.AutoPreview:
|
|
DarkerColour = ColourProvider.Highlight1;
|
|
LighterColour = ColourProvider.Colour0;
|
|
TextColour = ColourProvider.Background6;
|
|
break;
|
|
|
|
case KeySoundPreviewMode.AutoPlayPlus:
|
|
default:
|
|
DarkerColour = Colour4.PaleGoldenrod;
|
|
LighterColour = Colour4.LightGoldenrodYellow;
|
|
TextColour = ColourProvider.Background6;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|