赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 0 |
最后登录 | 2025-5-12 |
在线时间 | 6 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 51
- 在线时间
- 6 小时
- 注册时间
- 2025-4-29
- 帖子
- 6
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
找了很久没有找到类似的插件,自己整了一个。
可以自定义鼠标,鼠标点击的时候可以切换成其他动效。
效果图是这样:
url:https://github.com/SekiShiyo/RMMZ/blob/main/MousePointer
代码不知道咋贴,直接paste上来。
/*:
* @target MZ
* @plugindesc v1.0 自定义点击状态鼠标指针(点击检测)
* @author SekiShiyo
*
*
* @param defaultCursor
* @text 默认光标图片
* @type file
* @dir img/system
* @desc 默认状态下显示的光标图像(不含扩展名)
*
* @param clickCursor
* @text 点击时光标图片
* @type file
* @dir img/system
* @desc 鼠标点击时显示的光标图像(不含扩展名)
*
* @help
* - 将两张图放入 img/system 文件夹;
* - 默认使用 defaultCursor 图像;
* - 鼠标按下时切换为 clickCursor 图像;
* - 自动适配 MZ 场景;
* - 不使用 PIXI Sprite,不会被遮挡。
*/
(() => {
const params = PluginManager.parameters("MousePointer") || {};
const defaultCursor = params["defaultCursor"] || "Cursor1";
const clickCursor = params["clickCursor"] || "Cursor2";
let isPressed = false;
// 设置光标图像(使用 CSS)
function updateCursorImage(imageName) {
const url = `url("img/system/${imageName}.png"), auto`;
document.body.style.cursor = url;
}
// 初始设置
window.addEventListener("load", () => {
updateCursorImage(defaultCursor);
});
// 在每帧检测按压状态
const _SceneManager_updateMain = SceneManager.updateMain;
SceneManager.updateMain = function() {
_SceneManager_updateMain.call(this);
const nowPressed = TouchInput.isPressed();
if (nowPressed !== isPressed) {
isPressed = nowPressed;
updateCursorImage(isPressed ? clickCursor : defaultCursor);
}
};
})();
|
|