CI / Go Backend (push) Canceled after 0s
初始化 monorepo: Go后端(7微服务) + Unity客户端(9模块) + 启动器 HTML5原型: Three.js 3D体素世界, Perlin噪声地形, 原版材质, 22种方块 Minecraft创造模式背包: 双栏布局, 拖拽移动物品, 方向性元件引脚 AI助搭策划文档 + 客户端/服务端骨架 + Docker Compose + CI
81 lines
2.2 KiB
C#
81 lines
2.2 KiB
C#
using System.Windows.Controls.Primitives;
|
|
|
|
namespace PCL;
|
|
|
|
public class MyScrollBar : ScrollBar
|
|
{
|
|
// 基础
|
|
|
|
public int Uuid = ModBase.GetUuid();
|
|
|
|
public MyScrollBar()
|
|
{
|
|
IsEnabledChanged += (_, _) => RefreshColor();
|
|
GotMouseCapture += (_, _) => RefreshColor();
|
|
LostMouseCapture += (_, _) => RefreshColor();
|
|
MouseEnter += (_, _) => RefreshColor();
|
|
MouseLeave += (_, _) => RefreshColor();
|
|
IsVisibleChanged += (_, _) => RefreshColor();
|
|
}
|
|
|
|
// 指向动画
|
|
|
|
private void RefreshColor()
|
|
{
|
|
try
|
|
{
|
|
// 判断当前颜色
|
|
double newOpacity;
|
|
string newColor;
|
|
int time;
|
|
if (!IsVisible)
|
|
{
|
|
newOpacity = 0d;
|
|
time = 20; // 防止错误的尺寸判断导致闪烁
|
|
newColor = "ColorBrush4";
|
|
}
|
|
else if (IsMouseCaptureWithin)
|
|
{
|
|
newOpacity = 1d;
|
|
newColor = "ColorBrush4";
|
|
time = 50;
|
|
}
|
|
else if (IsMouseOver)
|
|
{
|
|
newOpacity = 0.9d;
|
|
newColor = "ColorBrush3";
|
|
time = 130;
|
|
}
|
|
else
|
|
{
|
|
newOpacity = 0.5d;
|
|
newColor = "ColorBrush4";
|
|
time = 180;
|
|
}
|
|
|
|
// 触发颜色动画
|
|
if (IsLoaded && ModAnimation.AniControlEnabled == 0) // 防止默认属性变更触发动画
|
|
{
|
|
// 有动画
|
|
ModAnimation.AniStart(
|
|
new[]
|
|
{
|
|
ModAnimation.AaColor(this, ForegroundProperty, newColor, time),
|
|
ModAnimation.AaOpacity(this, newOpacity - Opacity, time)
|
|
}, "MyScrollBar Color " + Uuid);
|
|
}
|
|
else
|
|
{
|
|
// 无动画
|
|
ModAnimation.AniStop("MyScrollBar Color " + Uuid);
|
|
SetResourceReference(ForegroundProperty, newColor);
|
|
Opacity = newOpacity;
|
|
}
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
ModBase.Log(ex, "滚动条颜色改变出错");
|
|
}
|
|
}
|
|
} |