Skip to content

Commit 316562a

Browse files
committed
up 字体渲染
1 parent d533e67 commit 316562a

5 files changed

Lines changed: 52 additions & 30 deletions

File tree

.github/workflows/onejar.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
## This workflow uses actions that are not certified by GitHub.
2-
## They are provided by a third-party and are governed by
3-
## separate terms of service, privacy policy, and support
4-
## documentation.
5-
## This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6-
## For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7-
#
8-
#name: AllMusic OneJar
9-
#
10-
#on:
11-
# push:
12-
# # Sequence of patterns matched against refs/heads
13-
# branches:
14-
# - 'releases/**'
15-
# # Sequence of patterns matched against refs/tags
16-
# tags:
17-
# - '*'
18-
#
19-
#jobs:
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: AllMusic OneJar
9+
10+
on:
11+
push:
12+
# Sequence of patterns matched against refs/heads
13+
branches:
14+
- 'releases/**'
15+
# Sequence of patterns matched against refs/tags
16+
tags:
17+
- '*'
18+
19+
jobs:
2020
# build_onejar_fabric_1_16_5:
2121
# runs-on: windows-latest
2222
# permissions:

server/core/src/main/java/com/coloryr/allmusic/server/core/command/sub/CommandHudSet.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,14 @@ public void execute(Object sender, String name, String[] args) {
232232
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
233233
return;
234234
}
235-
if (!HudUtils.setColor(name, type, args[3])) {
235+
int color = HudUtils.setColor(name, type, args[3]);
236+
if (color == -1) {
236237
AllMusic.side.sendMessage(sender, AllMusic.getMessage().command.error);
237238
return;
238239
}
239240
AllMusic.side.sendMessage(sender, AllMusic.getMessage().hud.set2
240241
.replace(ARG.hud, AllMusic.getMessage().hudList.getHud(type))
241-
.replace(ARG.color, args[3]));
242+
.replace(ARG.color, String.format("%06X", color & 0xFFFFFF)));
242243
}
243244
}
244245

server/core/src/main/java/com/coloryr/allmusic/server/core/sql/DataSql.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,27 @@ public class DataSql {
3030
" \"info_dir\" integer(6),\n" +
3131
" \"info_shadow\" integer(1),\n" +
3232
" \"info_enable\" integer(1),\n" +
33+
" \"info_alpha\" float,\n" +
3334
" \"lyric_x\" integer(6),\n" +
3435
" \"lyric_y\" integer(6),\n" +
3536
" \"lyric_color\" integer(20),\n" +
3637
" \"lyric_dir\" integer(6),\n" +
3738
" \"lyric_shadow\" integer(1),\n" +
3839
" \"lyric_enable\" integer(1),\n" +
40+
" \"lyric_alpha\" float,\n" +
3941
" \"list_x\" integer(6),\n" +
4042
" \"list_y\" integer(6),\n" +
4143
" \"list_color\" integer(20),\n" +
4244
" \"list_dir\" integer(6),\n" +
4345
" \"list_shadow\" integer(1),\n" +
4446
" \"list_enable\" integer(1),\n" +
47+
" \"list_alpha\" float,\n" +
4548
" \"pic_x\" integer(6),\n" +
4649
" \"pic_y\" integer(6),\n" +
4750
" \"pic_dir\" integer(6),\n" +
4851
" \"pic_size\" integer(6),\n" +
4952
" \"pic_enable\" integer(1),\n" +
53+
" \"pic_alpha\" float,\n" +
5054
" \"pic_rotate\" integer(1),\n" +
5155
" \"pic_rotate_speed\" integer(6)\n" +
5256
");";
@@ -161,22 +165,26 @@ private static void update(String name, HudPosObj hud) {
161165
"info_dir=" + hud.info.dir.ordinal() + "," +
162166
"info_shadow=" + (hud.info.shadow ? 1 : 0) + "," +
163167
"info_enable=" + (hud.info.enable ? 1 : 0) + "," +
168+
"info_alpha=" + hud.info.alpha + "," +
164169
"lyric_x=" + hud.lyric.x + "," +
165170
"lyric_y=" + hud.lyric.y + "," +
166171
"lyric_color=" + hud.lyric.color + "," +
167172
"lyric_dir=" + hud.lyric.dir.ordinal() + "," +
168173
"lyric_shadow=" + (hud.lyric.shadow ? 1 : 0) + "," +
169174
"lyric_enable=" + (hud.lyric.enable ? 1 : 0) + "," +
175+
"lyric_alpha=" + hud.lyric.alpha + "," +
170176
"list_x=" + hud.list.x + "," +
171177
"list_y=" + hud.list.y + "," +
172178
"list_color=" + hud.list.color + "," +
173179
"list_dir=" + hud.list.dir.ordinal() + "," +
174180
"list_shadow=" + (hud.list.shadow ? 1 : 0) + "," +
175181
"list_enable=" + (hud.list.enable ? 1 : 0) + "," +
182+
"list_alpha=" + hud.list.alpha + "," +
176183
"pic_x=" + hud.pic.x + "," +
177184
"pic_y=" + hud.pic.y + "," +
178185
"pic_dir=" + hud.pic.dir.ordinal() + "," +
179186
"pic_enable=" + (hud.pic.enable ? 1 : 0) + "," +
187+
"pic_alpha=" + hud.pic.alpha + "," +
180188
"pic_size=" + hud.pic.color + "," +
181189
"pic_rotate=" + (hud.pic.shadow ? 1 : 0) + "," +
182190
"pic_rotate_speed=" + hud.picRotateSpeed + " WHERE name='" + name + "'";
@@ -205,11 +213,13 @@ public static void addUser(String name, HudPosObj hud) {
205213
update(name, hud);
206214
} else {
207215
Statement stat = connection.createStatement();
208-
sql = "INSERT INTO allmusic (name,info_x,info_y," +
209-
"info_enable,lyric_x,lyric_y,lyric_enable,list_x,list_y,list_enable," +
216+
sql = "INSERT INTO allmusic (name," +
217+
"info_x,info_y,info_enable,lyric_x,lyric_y,lyric_enable," +
218+
"list_x,list_y,list_enable," +
210219
"pic_x,pic_y,pic_enable,pic_size,pic_rotate,pic_rotate_speed," +
211220
"info_color,info_dir,info_shadow,lyric_color,lyric_dir," +
212-
"lyric_shadow,list_color,list_dir,list_shadow,pic_dir)" +
221+
"lyric_shadow,list_color,list_dir,list_shadow,pic_dir," +
222+
"info_alpha,lyric_alpha,list_alpha,pic_alpha)" +
213223
"VALUES ('" + name + "'," +
214224
hud.info.x + "," +
215225
hud.info.y + "," +
@@ -235,7 +245,11 @@ public static void addUser(String name, HudPosObj hud) {
235245
hud.list.color + "," +
236246
hud.list.dir.ordinal() + "," +
237247
(hud.list.shadow ? 1 : 0) + "," +
238-
hud.pic.dir.ordinal() +
248+
hud.pic.dir.ordinal() + "," +
249+
hud.info.alpha + "," +
250+
hud.lyric.alpha + "," +
251+
hud.list.alpha + "," +
252+
hud.pic.alpha +
239253
")";
240254
stat.execute(sql);
241255
stat.close();
@@ -258,7 +272,8 @@ public static HudPosObj readHud(String name) {
258272
ResultSet set = stat.executeQuery("SELECT info_x,info_y,info_enable,lyric_x," +
259273
"lyric_y,lyric_enable,list_x,list_y,list_enable,pic_x,pic_y,pic_enable,pic_size," +
260274
"pic_rotate,pic_rotate_speed,info_color,info_dir,info_shadow,lyric_color," +
261-
"lyric_dir,lyric_shadow,list_color,list_dir,list_shadow,pic_dir FROM allmusic WHERE name='" + name + "'");
275+
"lyric_dir,lyric_shadow,list_color,list_dir,list_shadow,pic_dir," +
276+
"info_alpha,lyric_alpha,list_alpha,pic_alpha FROM allmusic WHERE name='" + name + "'");
262277
HudDirType[] vas = HudDirType.values();
263278
HudPosObj obj = null;
264279
if (set.next()) {
@@ -296,6 +311,10 @@ public static HudPosObj readHud(String name) {
296311
obj.list.dir = vas[set.getInt(23)];
297312
obj.list.shadow = set.getInt(24) == 1;
298313
obj.pic.dir = vas[set.getInt(25)];
314+
obj.info.alpha = set.getFloat(26);
315+
obj.lyric.alpha = set.getFloat(27);
316+
obj.list.alpha = set.getFloat(28);
317+
obj.pic.alpha = set.getFloat(29);
299318
}
300319
stat.close();
301320

server/core/src/main/java/com/coloryr/allmusic/server/core/utils/HudUtils.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public static HudDirType setDir(String player, HudType hud, String arg) {
462462
return type;
463463
}
464464

465-
public static boolean setColor(String player, HudType type, String arg) {
465+
public static int setColor(String player, HudType type, String arg) {
466466
int color;
467467
try {
468468
if (arg.startsWith("0x")) {
@@ -473,9 +473,11 @@ public static boolean setColor(String player, HudType type, String arg) {
473473
color = Integer.parseUnsignedInt(arg);
474474
}
475475
} catch (Exception ignored) {
476-
return false;
476+
return -1;
477477
}
478478

479+
color = (color & -67108864) == 0 ? color | 0xFF000000 : color;
480+
479481
HudPosObj obj = get(player);
480482
if (obj == null)
481483
obj = AllMusic.getConfig().defaultHud.copy();
@@ -498,7 +500,7 @@ public static boolean setColor(String player, HudType type, String arg) {
498500
addAndSave(player, obj);
499501
HudUtils.sendHudPos(player);
500502

501-
return true;
503+
return color;
502504
}
503505

504506
public static boolean setShadow(String name, HudType pos, String arg) {

0 commit comments

Comments
 (0)