加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
JS小白照着教程(https://www.jianshu.com/p/0bd8b462dac1)写了一个修改分辨率的插件......
/* @param 默认分辨率宽 * @desc 默认分辨率(宽) * @default 816 * @param 默认分辨率高 * @desc 默认分辨率(高) * @default 624 */ var params = PluginManager.parameters("TX_W_changeWindowSize"); var screenWidth = Number(params["默认分辨率宽"]); var screenHeight = Number(params["默认分辨率高"]); setScreenSize(screenWidth, screenHeight); var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function(command, args){ _Game_Interpreter_pluginCommand.call(this, command, args); switch(command){ case "changeWindowSize": var _screenWidth = Number(args[0]) || 816; var _screenHeight = Number(args[1]) || 624; setScreenSize(_screenWidth, _screenHeight); break; case "UseMVSize": setScreenSize(816, 624); break; default: break; } } function setScreenSize(screenWidth, screenHeight){ var deltaWidth = screenWidth - window.innerWidth; var deltaHeight = screenHeight - window.innerHeight; window.moveBy(- deltaWidth / 2, - deltaHeight / 2); window.resizeBy(deltaWidth, deltaHeight); }
/* @param 默认分辨率宽
* @desc 默认分辨率(宽)
* @default 816
* @param 默认分辨率高
* @desc 默认分辨率(高)
* @default 624
*/
var params = PluginManager.parameters("TX_W_changeWindowSize");
var screenWidth = Number(params["默认分辨率宽"]);
var screenHeight = Number(params["默认分辨率高"]);
setScreenSize(screenWidth, screenHeight);
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args){
_Game_Interpreter_pluginCommand.call(this, command, args);
switch(command){
case "changeWindowSize":
var _screenWidth = Number(args[0]) || 816;
var _screenHeight = Number(args[1]) || 624;
setScreenSize(_screenWidth, _screenHeight);
break;
case "UseMVSize":
setScreenSize(816, 624);
break;
default: break;
}
}
function setScreenSize(screenWidth, screenHeight){
var deltaWidth = screenWidth - window.innerWidth;
var deltaHeight = screenHeight - window.innerHeight;
window.moveBy(- deltaWidth / 2, - deltaHeight / 2);
window.resizeBy(deltaWidth, deltaHeight);
}
自己试着添加了几个参数,加了设置默认分辨率的代码,结果出错了(说是NW.js级别太高?)
有大佬知道怎么回事吗? |