光标修改api

This commit is contained in:
草莓 2024-12-03 00:16:11 +08:00
parent 1db2345494
commit 30fb75ec85
4 changed files with 27 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -1233,5 +1233,11 @@ main.floors.Caimhome=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"bg2map": [
],
"fg2map": [
]
}

View File

@ -8864,5 +8864,25 @@ core.plugin.animate = {
CGUI.style.zIndex = 10000
main.core.ui.CG.update()
}
},
"光标设置": function () {
// 在此增加新插件
this.mouse = function (image) {
const canvas = document.createElement('canvas'); //CGui画布设置
canvas.width = 32
canvas.height = 32
const ctx = canvas.getContext("2d")
let info = core.getBlockInfo(image);
if (!info) {
// 检查状态栏图标
if (core.statusBar.icons[image] instanceof Image)
info = { image: core.statusBar.icons[image], posX: 0, posY: 0, height: 32 };
else return;
}
core.drawIcon(ctx, image, 0, 0, 32, 32)
const data = canvas.toDataURL("image/png")
core.dom.gameGroup.style.cursor = `url(${data}),auto`
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 KiB