1、修改默认的攻击指令,防御指令,技能指令,物品指令的函数:
Window_ActorCommand.prototype.makeCommandList = function() {
if (this._actor) {
this.addAttackCommand();
this.addSkillCommands();
this.addGuardCommand();
this.addItemCommand();
}
};
该函数位于rpg_windows.js文件的5383行
2、如何判断MV工程目录下的某个文件是否存在:
转载地址:点击跳转
var XdRsData = XdRsData || {};
XdRsData.fileExists = function(path) {
path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, ''+path);
if (path.match(/^\/([A-Z]\:)/)) path = path.slice(1);
var fs = require('fs');
return fs.existsSync(decodeURIComponent(path));
};
此处源码第三行中replace的第二个参数由'/'+path变为''+patch。
使用用法:
XdRsData.fileExists(path)
path以工程目录路劲为起点的路劲名和欲判断的文件名。文件名需要带上扩展名,如: .txt .png .mp3 .ttf ….什么的。
请注意,如果打包后使用这个方法的话需要手动在前面加上www才行。
举例:判断工程目录下是否存在名为Test的文本文件:
XdRsData.fileExists('Test.txt')
判断工程目录里的img/faces下是否存在名为Actor1的头像图片:
XdRsData.fileExists('img/faces/Actor1.png')
判断工程目录里的img/characters下是否存在名为Vehicle的行走图片:
XdRsData.fileExists('img/characters/Vehicle.png')
返回值:存在true; 不存在false。
文章封面(AI):