楼主: wabcmcc

[交流讨论] YEP_PictureCommonEvents演示工程

[复制链接]
梦石
0
星屑
343
在线时间
40 小时
注册时间
2021-8-24
回帖
53
发表于 2022-10-24 18:28:05 | 显示全部楼层
mz能否做一个
回复

使用道具 举报

梦石
2
星屑
8479
在线时间
463 小时
注册时间
2021-12-4
回帖
486

MZ评测员

发表于 2022-10-24 23:13:51 | 显示全部楼层

D:\Steam\steamapps\common\RPG Maker MZ\newdata\js\plugins\ButtonPicture.js
MZ官方自带了一个耶。
[pre lang="javascript" file="ButtonPicture.js"](() => {
    const pluginName = "ButtonPicture";

    PluginManager.registerCommand(pluginName, "set", args => {
        const pictureId = Number(args.pictureId);
        const commonEventId = Number(args.commonEventId);
        const picture = $gameScreen.picture(pictureId);
        if (picture) {
            picture.mzkp_commonEventId = commonEventId;
        }
    });

    Sprite_Picture.prototype.isClickEnabled = function() {
        const picture = this.picture();
        return picture && picture.mzkp_commonEventId && !$gameMessage.isBusy();
    };

    Sprite_Picture.prototype.onClick = function() {
        $gameTemp.reserveCommonEvent(this.picture().mzkp_commonEventId);
    };

    Spriteset_Base.prototype.mzkp_isAnyPicturePressed = function() {
        return this._pictureContainer.children.some(sprite =>
            sprite.isPressed()
        );
    };

    const _Scene_Map_isAnyButtonPressed =
        Scene_Map.prototype.isAnyButtonPressed;
    Scene_Map.prototype.isAnyButtonPressed = function() {
        return (
            _Scene_Map_isAnyButtonPressed.apply(this, arguments) ||
            this._spriteset.mzkp_isAnyPicturePressed()
        );
    };
})();[/pre]
回复

使用道具 举报

梦石
0
星屑
343
在线时间
40 小时
注册时间
2021-8-24
回帖
53
发表于 2022-10-24 23:25:49 | 显示全部楼层
小秋橙 发表于 2022-10-24 23:13
D:\Steam\steamapps\common\RPG Maker MZ\newdata\js\plugins\ButtonPicture.js
MZ官方自带了一个耶。
(( ...

找了很久都不知道有这个,我以为直接买了mz啥都有了,感谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部