mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-27 04:40:15 +08:00
@@ -98,7 +98,7 @@ class RenderLevel extends RenderBox {
|
|||||||
3 => const Color(0xFF7BCDEF),
|
3 => const Color(0xFF7BCDEF),
|
||||||
4 => const Color(0xFFFEBB8B),
|
4 => const Color(0xFFFEBB8B),
|
||||||
5 => const Color(0xFFEE672A),
|
5 => const Color(0xFFEE672A),
|
||||||
_ => const Color(0xFFFF0000),
|
_ => const Color(0xFFF04C49),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,20 +140,21 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
void drawBolt() => drawParagraph(_boltIcon, const Offset(840, 5));
|
void drawBolt() => drawParagraph(_boltIcon, const Offset(840, 5));
|
||||||
|
|
||||||
void _draw1(Paint paint) {
|
void _draw1(Paint paint) {
|
||||||
drawRRect(const .fromLTRBXY(673, _botY, 833, _botYB, 20, 20), paint);
|
final path = Path()
|
||||||
drawRRect(
|
..addRRect(const .fromLTRBXY(673, _botY, 833, _botYB, 20, 20))
|
||||||
.fromLTRBAndCorners(
|
..addRRect(
|
||||||
673,
|
.fromLTRBAndCorners(
|
||||||
_topY,
|
673,
|
||||||
787,
|
_topY,
|
||||||
_topYB,
|
787,
|
||||||
topLeft: _r,
|
_topYB,
|
||||||
bottomLeft: _r,
|
topLeft: _r,
|
||||||
topRight: _r,
|
bottomLeft: _r,
|
||||||
),
|
topRight: _r,
|
||||||
paint,
|
),
|
||||||
);
|
)
|
||||||
drawRect(const .fromLTRB(719, _topYB, 787, _botY), paint);
|
..addRect(const .fromLTRB(719, _topYB, 787, _botY));
|
||||||
|
drawPath(path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawLEDigit(int digit, Paint paint) {
|
void drawLEDigit(int digit, Paint paint) {
|
||||||
@@ -195,8 +196,9 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
Paint paint,
|
Paint paint,
|
||||||
) {
|
) {
|
||||||
// 横段
|
// 横段
|
||||||
|
final path = Path();
|
||||||
if (a) {
|
if (a) {
|
||||||
_drawRRect(
|
_addRRect(
|
||||||
_left,
|
_left,
|
||||||
_topY,
|
_topY,
|
||||||
_right,
|
_right,
|
||||||
@@ -205,11 +207,11 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
_r,
|
_r,
|
||||||
f ? .zero : _r,
|
f ? .zero : _r,
|
||||||
b ? .zero : _r,
|
b ? .zero : _r,
|
||||||
paint,
|
path,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (g) {
|
if (g) {
|
||||||
_drawRRect(
|
_addRRect(
|
||||||
_left,
|
_left,
|
||||||
_midY,
|
_midY,
|
||||||
_right,
|
_right,
|
||||||
@@ -218,11 +220,11 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
b ? .zero : _r,
|
b ? .zero : _r,
|
||||||
e ? .zero : _r,
|
e ? .zero : _r,
|
||||||
c ? .zero : _r,
|
c ? .zero : _r,
|
||||||
paint,
|
path,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (d) {
|
if (d) {
|
||||||
_drawRRect(
|
_addRRect(
|
||||||
_left,
|
_left,
|
||||||
_botY,
|
_botY,
|
||||||
_right,
|
_right,
|
||||||
@@ -231,7 +233,7 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
c ? .zero : _r,
|
c ? .zero : _r,
|
||||||
_r,
|
_r,
|
||||||
_r,
|
_r,
|
||||||
paint,
|
path,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +244,7 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
final bottom = g ? _midY : (e ? _midMid : _midYB);
|
final bottom = g ? _midY : (e ? _midMid : _midYB);
|
||||||
final rTop = a ? Radius.zero : _r;
|
final rTop = a ? Radius.zero : _r;
|
||||||
final rBot = g || e ? Radius.zero : _r;
|
final rBot = g || e ? Radius.zero : _r;
|
||||||
_drawRRect(_left, top, _lColR, bottom, rTop, rTop, rBot, rBot, paint);
|
_addRRect(_left, top, _lColR, bottom, rTop, rTop, rBot, rBot, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 右上竖段 b
|
// 右上竖段 b
|
||||||
@@ -251,7 +253,7 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
final bottom = g ? _midY : (c ? _midMid : _midYB);
|
final bottom = g ? _midY : (c ? _midMid : _midYB);
|
||||||
final rTop = a ? Radius.zero : _r;
|
final rTop = a ? Radius.zero : _r;
|
||||||
final rBot = g || c ? Radius.zero : _r;
|
final rBot = g || c ? Radius.zero : _r;
|
||||||
_drawRRect(_rColL, top, _right, bottom, rTop, rTop, rBot, rBot, paint);
|
_addRRect(_rColL, top, _right, bottom, rTop, rTop, rBot, rBot, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 左下竖段 e
|
// 左下竖段 e
|
||||||
@@ -260,7 +262,7 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
final bottom = d ? _botY : _botYB;
|
final bottom = d ? _botY : _botYB;
|
||||||
final rTop = g || f ? Radius.zero : _r;
|
final rTop = g || f ? Radius.zero : _r;
|
||||||
final rBot = d ? Radius.zero : _r;
|
final rBot = d ? Radius.zero : _r;
|
||||||
_drawRRect(_left, top, _lColR, bottom, rTop, rTop, rBot, rBot, paint);
|
_addRRect(_left, top, _lColR, bottom, rTop, rTop, rBot, rBot, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 右下竖段 c
|
// 右下竖段 c
|
||||||
@@ -269,12 +271,14 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
final bottom = d ? _botY : _botYB;
|
final bottom = d ? _botY : _botYB;
|
||||||
final rTop = g || b ? Radius.zero : _r;
|
final rTop = g || b ? Radius.zero : _r;
|
||||||
final rBot = d ? Radius.zero : _r;
|
final rBot = d ? Radius.zero : _r;
|
||||||
_drawRRect(_rColL, top, _right, bottom, rTop, rTop, rBot, rBot, paint);
|
_addRRect(_rColL, top, _right, bottom, rTop, rTop, rBot, rBot, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawPath(path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 绘制圆角矩形,四角全零时退化为矩形
|
/// 绘制圆角矩形,四角全零时退化为矩形
|
||||||
void _drawRRect(
|
void _addRRect(
|
||||||
double l,
|
double l,
|
||||||
double t,
|
double t,
|
||||||
double r,
|
double r,
|
||||||
@@ -283,12 +287,12 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
Radius tr,
|
Radius tr,
|
||||||
Radius bl,
|
Radius bl,
|
||||||
Radius br,
|
Radius br,
|
||||||
Paint paint,
|
Path path,
|
||||||
) {
|
) {
|
||||||
if (tl == .zero && tr == .zero && bl == .zero && br == .zero) {
|
if (tl == .zero && tr == .zero && bl == .zero && br == .zero) {
|
||||||
drawRect(.fromLTRB(l, t, r, b), paint);
|
path.addRect(.fromLTRB(l, t, r, b));
|
||||||
} else {
|
} else {
|
||||||
drawRRect(
|
path.addRRect(
|
||||||
.fromLTRBAndCorners(
|
.fromLTRBAndCorners(
|
||||||
l,
|
l,
|
||||||
t,
|
t,
|
||||||
@@ -299,7 +303,6 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
bottomLeft: bl,
|
bottomLeft: bl,
|
||||||
bottomRight: br,
|
bottomRight: br,
|
||||||
),
|
),
|
||||||
paint,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,62 +318,79 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
)
|
)
|
||||||
..lineTo(395, 408)
|
..lineTo(395, 408)
|
||||||
..arcToPoint(
|
..arcToPoint(
|
||||||
const Offset(420, 415.5), // 避免拼接裂缝, 实为419.5, 415
|
const Offset(419.5, 415),
|
||||||
radius: const .circular(50),
|
radius: const .circular(50),
|
||||||
clockwise: false,
|
clockwise: false,
|
||||||
)
|
)
|
||||||
..lineTo(420, 340.5) // 419.5, 340
|
..arcToPoint(
|
||||||
|
const Offset(444, 408),
|
||||||
|
radius: const .circular(50),
|
||||||
|
clockwise: false,
|
||||||
|
)
|
||||||
|
..lineTo(539, 313)
|
||||||
|
..arcToPoint(
|
||||||
|
const Offset(543, 292),
|
||||||
|
radius: const .circular(50),
|
||||||
|
clockwise: false,
|
||||||
|
)
|
||||||
|
..lineTo(543, 282)
|
||||||
|
..lineTo(476, 282)
|
||||||
|
..lineTo(419.5, 340)
|
||||||
..lineTo(363, 282)
|
..lineTo(363, 282)
|
||||||
..close();
|
..close();
|
||||||
|
|
||||||
void drawLevelLv(Paint paint) {
|
void drawLevelLv(Paint paint) {
|
||||||
const double lvTop = 106;
|
const double lvTop = 106;
|
||||||
|
|
||||||
drawRRect(
|
drawPath(
|
||||||
.fromLTRBAndCorners(
|
Path()
|
||||||
56,
|
..addRRect(
|
||||||
lvTop,
|
.fromLTRBAndCorners(
|
||||||
123,
|
56,
|
||||||
_botYB,
|
lvTop,
|
||||||
topLeft: _r,
|
123,
|
||||||
topRight: _r,
|
_botYB,
|
||||||
bottomLeft: _r,
|
topLeft: _r,
|
||||||
),
|
topRight: _r,
|
||||||
paint,
|
bottomLeft: _r,
|
||||||
);
|
),
|
||||||
drawRRect(
|
)
|
||||||
.fromLTRBAndCorners(
|
..addRRect(
|
||||||
123,
|
.fromLTRBAndCorners(
|
||||||
_botY,
|
123,
|
||||||
256,
|
_botY,
|
||||||
_botYB,
|
256,
|
||||||
topRight: _r,
|
_botYB,
|
||||||
bottomRight: _r,
|
topRight: _r,
|
||||||
),
|
bottomRight: _r,
|
||||||
|
),
|
||||||
|
),
|
||||||
paint,
|
paint,
|
||||||
);
|
);
|
||||||
|
|
||||||
final vL = RRect.fromLTRBAndCorners(
|
final path = Path()
|
||||||
_vLeft,
|
..addRRect(
|
||||||
lvTop,
|
RRect.fromLTRBAndCorners(
|
||||||
363,
|
_vLeft,
|
||||||
282,
|
lvTop,
|
||||||
topLeft: _r,
|
363,
|
||||||
topRight: _r,
|
282,
|
||||||
);
|
topLeft: _r,
|
||||||
|
topRight: _r,
|
||||||
drawRRect(vL, paint);
|
),
|
||||||
|
)
|
||||||
const double vSymmetryX = 419.5;
|
..addRRect(
|
||||||
|
RRect.fromLTRBAndCorners(
|
||||||
drawPath(vV, paint);
|
476,
|
||||||
save();
|
lvTop,
|
||||||
translate(vSymmetryX, 0);
|
543,
|
||||||
scale(-1, 1);
|
282,
|
||||||
translate(-vSymmetryX, 0);
|
topLeft: _r,
|
||||||
drawRRect(vL, paint);
|
topRight: _r,
|
||||||
drawPath(vV, paint);
|
),
|
||||||
restore();
|
)
|
||||||
|
..addPath(vV, .zero);
|
||||||
|
drawPath(path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const double _totalR = 930;
|
static const double _totalR = 930;
|
||||||
@@ -380,29 +400,29 @@ extension type LevelCanvas(Canvas _) implements Canvas {
|
|||||||
void drawLevelBack(Paint paint, {bool bolt = false}) {
|
void drawLevelBack(Paint paint, {bool bolt = false}) {
|
||||||
const radius = Radius.circular(27);
|
const radius = Radius.circular(27);
|
||||||
final double right = bolt ? _extendR : _totalR;
|
final double right = bolt ? _extendR : _totalR;
|
||||||
drawRRect(
|
final path = Path()
|
||||||
RRect.fromLTRBAndCorners(
|
..addRRect(
|
||||||
0,
|
RRect.fromLTRBAndCorners(
|
||||||
48,
|
0,
|
||||||
right,
|
48,
|
||||||
_totalB,
|
right,
|
||||||
topLeft: radius,
|
_totalB,
|
||||||
bottomLeft: radius,
|
topLeft: radius,
|
||||||
bottomRight: radius,
|
bottomLeft: radius,
|
||||||
),
|
bottomRight: radius,
|
||||||
paint,
|
),
|
||||||
);
|
)
|
||||||
drawRRect(
|
..addRRect(
|
||||||
RRect.fromLTRBAndCorners(
|
RRect.fromLTRBAndCorners(
|
||||||
576,
|
576,
|
||||||
0,
|
0,
|
||||||
right,
|
right,
|
||||||
48,
|
48,
|
||||||
topLeft: radius,
|
topLeft: radius,
|
||||||
topRight: radius,
|
topRight: radius,
|
||||||
),
|
),
|
||||||
paint,
|
);
|
||||||
);
|
drawPath(path, paint);
|
||||||
|
|
||||||
if (bolt) drawBolt();
|
if (bolt) drawBolt();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user