查看: 3557|回复: 15

[交流讨论] 求教一个图片预加载的插件

[复制链接]
梦石
0
星屑
490
在线时间
60 小时
注册时间
2023-7-19
回帖
58
发表于 2023-8-17 05:57:24 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
目前自制的游戏由于立绘的太大太多,出现了不管打开什么或者过图都要加载一段时间的问题,,需求一个能预加载的插件,有插件的大佬能帮助一下吗
梦石
0
星屑
3234
在线时间
566 小时
注册时间
2020-8-20
回帖
71
发表于 2023-8-17 09:46:19 | 显示全部楼层
试试过个
DKTools
https://dk-plugins.ru/mz/dktools/
回复

使用道具 举报

梦石
0
星屑
490
在线时间
60 小时
注册时间
2023-7-19
回帖
58
 楼主| 发表于 2023-8-17 17:22:57 | 显示全部楼层
pkeasygod 发表于 2023-8-17 09:46
试试过个
DKTools
https://dk-plugins.ru/mz/dktools/

额...多谢,但,很痛苦,我机翻了注释来看,有说是
==============

###初始预压###

允许您在启动游戏时预加载音频和图像文件。



##重要##

仅预加载您真正需要的文件,例如,接口元素!

不要加载游戏地图上使用的图像和声音!

使用“地图预加载”功能!



##自定义路径##

为了预加载具有资源的整个文件夹或具有非标准路径的文件,

您必须在“文本”选项卡而不是“文件”选项卡中指定“路径”。



###=========================================================================

###地图预加载###

允许您在特定地图上预加载音频和图像文件。



##自定义路径##

为了预加载具有资源的整个文件夹或具有非标准路径的文件,

您必须在“文本”选项卡而不是“文件”选项卡中指定“路径”。

但,,我不知道再那开啊,英文不行啊
回复

使用道具 举报

梦石
0
星屑
5062
在线时间
182 小时
注册时间
2021-3-31
回帖
194
发表于 2023-8-18 17:30:03 | 显示全部楼层
dk的?图片的加载基本上每个插件但凡涉及到图片的地方都有,除非是写法有问题,如果要沿用rm的bitmap的话我可以写个单纯的预加载某个或者某些场景的图片?如果要针对某个文件夹下的所有图片也没问题,前提是付费购买,50rmb????,仅适用于,如果不沿用rm的bitmap,往往加载速度更快,但是需要同时处理相应的插件,转换格式
獨立遊戲製作中
有空的时候也可以继续接单mv/mz插件定制
回复

使用道具 举报

梦石
0
星屑
490
在线时间
60 小时
注册时间
2023-7-19
回帖
58
 楼主| 发表于 2023-8-18 21:30:31 | 显示全部楼层
闪电超重火炮 发表于 2023-8-18 17:30
dk的?图片的加载基本上每个插件但凡涉及到图片的地方都有,除非是写法有问题,如果要沿用rm的bitmap的话我 ...

可以,不管因为我是利用空闲时间去制作的(现在在做单子~)~所以会在过段时间有时间做了,考虑一下,因为现在是用插件了,但还没时间研究,先谢谢了~
回复

使用道具 举报

梦石
0
星屑
5816
在线时间
971 小时
注册时间
2015-2-6
回帖
123

开拓者

发表于 2023-8-19 11:05:21 | 显示全部楼层
画像の事前読み込みを改善します,mit协议
[pre lang="javascript" file="PANDA_ImagePreLoad"]//=============================================================================
// PANDA_ImagePreLoad.js
//=============================================================================
// [Update History]
// 2021-05-29 Ver.1.0.0 First Release for MZ.
// 2021-06-23 Ver.1.1.0 fix for subfolder (MZ 1.3.0).
// 2021-07-05 Ver.1.1.1 revert fix for subfolder (MZ 1.3.2).

/*:
* @target MZ
* @plugindesc Improve image preloading.
* @author panda(werepanda.jp)
* @url http://www.werepanda.jp/blog/20210529185556.html
*
* @help Improve image preloading to eliminate image display lag.
*
* By default, when the event starts, the face images of [Show Text]
* and the picture images of [Show Picture] in the 200 lines
* from the beginning of the event are loaded first.
* This allows the images to be displayed quickly when they are actually used.
* However, since there is no additional preloading of images appearing after
* the 200th line, the lag will be noticeable later in the long event.
*
* To solve this problem,
* this plugin allows you to set the number of lines to preload.
* When the number is 0, all lines of the event will be preloaded.
* However, if the event is very long, it may take some time to preload.
* In addition to the face images of Show Text and the picture of Show Picture,
* the parallaxe images of [Change Parallax] and the character images of
* [Change Image] in [Set Movenemt Route] are also preloaded.
*
* You can also use the plugin command "Preload Image" to preload any images.
*
* [License]
* this plugin is released under MIT license.
* https://opensource.org/licenses/mit-license.php
*
* @param SliceRows
* @text Preload Lines
* @desc Specify the number of lines to be preloaded in the event. 0 means all lines will be preloaded.
* @type number
* @default 0
* @min 0
*
* @command PRELOAD_IMAGE
* @text Preload Image
* @desc Preload the specified image file.
*
* @arg file
* @text Image File Name
* @desc Specify the image file to be preloaded.
* @type file
* @dir img/
*
*/

/*:ja
* @target MZ
* @plugindesc 画像の事前読み込みを改善します。
* @author panda(werepanda.jp)
* @url http://www.werepanda.jp/blog/20210529185556.html
*
* @help 画像の事前読み込みを改善して、画像の表示ラグを解消します。
*
* デフォルトでは、イベント開始時にイベントの先頭から200行目までにある
* 「文章の表示」の顔グラフィックと「ピクチャの表示」の画像を先に読み込んで
* 実際の使用時に画像を素早く表示できるようになっています。
* しかし、200行目以降に登場する画像を追加で先読みすることはないため、
* 長いイベントの場合、後半は画像の表示ラグが目立ってしまいます。
*
* そこで、プラグインパラメータで先読み行数を任意に設定できるようにしました。
* 先読み行数を 0 にすると、イベントの全行を先読みします。
* ただし、非常に長いイベントの場合は先読みに時間がかかる可能性があります。
* また「文章の表示」の顔グラフィックと「ピクチャの表示」の画像以外に、
* 「遠景の変更」の遠景画像と「移動ルートの設定」中の「画像の変更」で
* 使われる画像ファイルも、先読みしてくれるようになっています。
*
* また、プラグインコマンド「画像先読み」で、任意の画像を先読みできます。
* あわせてご利用ください。
*
* ■ 利用規約
* このプラグインはMITライセンスで配布されます。
* ご自由にお使いください。
* https://opensource.org/licenses/mit-license.php
*
* @param SliceRows
* @text 先読み行数
* @desc イベントで画像の先読み対象となる行数を指定します。0を指定すると全行が対象になります。
* @type number
* @default 0
* @min 0
*
* @command PRELOAD_IMAGE
* @text 画像先読み
* @desc 指定した画像ファイルを先読みします。
*
* @arg file
* @text 画像ファイル名
* @desc 先読みする画像ファイルを指定します。
* @type file
* @dir img/
*
*/

/*:ko
* @target MZ
* @plugindesc 이미지의 미리 불러오기를 개선합니다.
* @author panda(werepanda.jp)
* @url http://www.werepanda.jp/blog/20210529185556.html
*
* @help 이미지의 미리 불러오기를 개선하여 이미지의 표시 렉을 해소합니다.
*
* 기본적으로 이벤트가 시작할 때에 이벤트 명령의 처음부터 200행까지
* "텍스트 표시"의 얼굴 이미지와 "그림 표시"의 그림을 미리 불러오고
* 실제로 사용할 때에 그 이미지를 빠르게 표시할 수 있습니다.
* 그러나 200행 이후에 등장하는 이미지를 추가로 불러오지는 않기 때문에
* 긴 이벤트의 경우 후반은 이미지의 표시 렉이 눈에 띕니다.
*
* 그래서 플러그인 매개 변수로 미리 불러올 행수를 설정할 수 있도록 했습니다.
* 행수를 0으로 하면, 이벤트의 모든 행을 미리 불러옵니다.
* 다만 매우 긴 이벤트의 경우는 미리 불러오는데 시간이 걸릴 가능성이 있습니다.
* 또한 "텍스트 표시"의 얼굴 이미지와 "그림 표시"의 그림 이미지 이외에도
* "먼 배경 변경"과 "이동 루트 설정"중의 "이미지 변경"에서 사용되는
* 이비지 파일도 미리 불러오기 해줍니다.
*
* 또 플러그인 명령 "이미지 미리 불러오기"로, 임의의 이미지를 미리 불러오기
* 할 수 있습니다. 함께 이용하시기 바랍니다.
*
* [이용 약관]
* 이 플러그인은 MIT 라이센스로 공개됩니다.
* https://opensource.org/licenses/mit-license.php
*
* @param SliceRows
* @text 미리 불러올 행수
* @desc 이벤트에서 이미지 미리 불러오기 대상이 될 행수를 지정합니다. 0을 지정하면 모든 행이 대상이 됩니다.
* @type number
* @default 0
* @min 0
*
* @command PRELOAD_IMAGE
* @text 이미지 미리 불러오기
* @desc 지정된 이미지 파일을 미리 불러옵니다.
*
* @arg file
* @text 이미지 파일명
* @desc 미리 불러올 이미지 파일을 지정합니다.
* @type file
* @dir img/
*
*/


(() => {
        'use strict';
       
        // This Plugin Name
        const pluginName = decodeURIComponent(document.currentScript.src).match(/([^\/]+)\.js$/)[1];
       
        // Parameters
        const parameters = PluginManager.parameters(pluginName);
        const SliceRows = parseInt(parameters['SliceRows']) || 0;
       
       
        //--------------------------------------------------
        // Plugin Command "PreLoad Image"
        //--------------------------------------------------
        PluginManager.registerCommand(pluginName, 'PRELOAD_IMAGE', function(args) {
               
                // get arguments
                const file = args['file'] || '';
               
                // preload image
                if (file !== '') {
                        ImageManager.loadBitmap('img/', file);
                }
               
        });
       
       
        //--------------------------------------------------
        // Game_Interpreter.loadImages
        //  [Modified Definition]
        //--------------------------------------------------
        const _Game_Interpreter_loadImages = Game_Interpreter.prototype.loadImages;
        Game_Interpreter.prototype.loadImages = function() {
                // slice event commands (if SliceRows = 0, get all commands)
                const list = (SliceRows > 0) ? this._list.slice(0, SliceRows) : this._list;
                for (const command of list) {
                        switch (command.code) {
                                case 101: // Show Text
                                        ImageManager.loadFace(command.parameters[0]);
                                        break;
                                case 231: // Show Picture
                                        ImageManager.loadPicture(command.parameters[1]);
                                        break;
                                case 284: // Change Parallax (added)
                                        ImageManager.loadParallax(command.parameters[0]);
                                        break;
                                case 205: // Set Movement Route (added)
                                        const commands = command.parameters[1].list;
                                        for (const cmd of commands) {
                                                switch (cmd.code) {
                                                        case 41:        // Change Character
                                                                ImageManager.loadCharacter(cmd.parameters[0]);
                                                                break;
                                                }
                                        }
                                        break;
                        }
                }
        };
       
})();

[/pre]
好久没用论坛代码功能,试一下
此书生之言,可言而不可用也 ↑-_-||

仓管610早晚班,没多余精力做别的了 →_→
回复

使用道具 举报

梦石
0
星屑
490
在线时间
60 小时
注册时间
2023-7-19
回帖
58
 楼主| 发表于 2023-8-19 16:19:23 | 显示全部楼层
戏蹑群星斗 发表于 2023-8-19 11:05
画像の事前読み込みを改善します,mit协议
//========================================================== ...

啊,,,这个怎么用,,我是画师,只知道一点点代码知识~
回复

使用道具 举报

梦石
0
星屑
5062
在线时间
182 小时
注册时间
2021-3-31
回帖
194
发表于 2023-8-21 22:50:32 | 显示全部楼层
~谓伊~ 发表于 2023-8-18 21:30
可以,不管因为我是利用空闲时间去制作的(现在在做单子~)~所以会在过段时间有时间做了,考虑一下,因为 ...

问题不大,图片数量过多还有一种解决方式是使用纹理打包
獨立遊戲製作中
有空的时候也可以继续接单mv/mz插件定制
回复

使用道具 举报

梦石
0
星屑
1321
在线时间
116 小时
注册时间
2007-12-15
回帖
59
发表于 2023-8-22 15:42:56 | 显示全部楼层
你看下这个视频,有个延迟处理的方法。使用setTimeout函数
【【RMMZ】边打星铁边做游戏 #5 背包格子-哔哩哔哩】 https://b23.tv/h8d6yGW
回复

使用道具 举报

梦石
0
星屑
490
在线时间
60 小时
注册时间
2023-7-19
回帖
58
 楼主| 发表于 2023-8-22 23:13:58 | 显示全部楼层
wu5563 发表于 2023-8-22 15:42
你看下这个视频,有个延迟处理的方法。使用setTimeout函数
【【RMMZ】边打星铁边做游戏 #5 背包格子-哔哩哔 ...

非常感谢
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部