赞 | 58 |
VIP | 37 |
好人卡 | 59 |
积分 | 12 |
经验 | 66255 |
最后登录 | 2023-5-29 |
在线时间 | 1017 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1232
- 在线时间
- 1017 小时
- 注册时间
- 2011-4-30
- 帖子
- 1516
|
<script type="text/javascript" src="js/rpg_managers.js"></script>
里
//-----------------------------------------------------------------------------
// PluginManager
// 插件管理器
// The static class that manages the plugins.
// 这个静态的类 管理 插件
function PluginManager() {
throw new Error('This is a static class');
}
//路径
PluginManager._path = 'js/plugins/';
//脚本
PluginManager._scripts = [];
//错误地址
PluginManager._errorUrls = [];
//参数
PluginManager._parameters = {};
//安装
PluginManager.setup = function(plugins) {
plugins.forEach(function(plugin) {
if (plugin.status && !this._scripts.contains(plugin.name)) {
this.setParameters(plugin.name, plugin.parameters);
this.loadScript(plugin.name + '.js');
this._scripts.push(plugin.name);
}
}, this);
};
//检查错误
PluginManager.checkErrors = function() {
var url = this._errorUrls.shift();
if (url) {
throw new Error('Failed to load: ' + url);
}
};
//参数
PluginManager.parameters = function(name) {
return this._parameters[name.toLowerCase()] || {};
};
//设置参数
PluginManager.setParameters = function(name, parameters) {
this._parameters[name.toLowerCase()] = parameters;
};
//读取脚本
PluginManager.loadScript = function(name) {
var url = this._path + name;
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.async = false;
script.onerror = this.onError.bind(this);
script._url = url;
document.body.appendChild(script);
};
//在错误
PluginManager.onError = function(e) {
this._errorUrls.push(e.target._url);
};
<script type="text/javascript" src="js/plugins.js"></script>
里
// Generated by RPG Maker.
// Do not edit this file directly.
var $plugins =
[
{"name":"Fonts","status":true,"description":"Change game default fonts and waiting fonts to load","parameters":{"Bitmap Font":"\"黑体\",GameFont","Window Font":"\"黑体\",GameFont","Fonts":"\"黑体\",GameFont"}}
];
<script type="text/javascript" src="js/main.js"></script>
里
//=============================================================================
// main.js
//=============================================================================
//插件管理器 安装
PluginManager.setup($plugins);
//窗口正在加载
window.onload = function() {
//场景管理器运行 引导场景 (Scene_Boot);
SceneManager.run(Scene_Boot);
};
|
|