RMMV基于托管网站的游戏版本更新检测
RMMV基于托管网站的游戏版本更新检测楼主没发过什么帖子,也不知道该说些啥,就是基于github或者coding的游戏版本检查,首先是在这些网站上拥有自己的仓库,然后发布page页,新建一个关于版本的文件,然后在rmmv中用插件进行判断,详细说明在demo中有写,依赖jquery,有不懂的回复说明。
地址如下
插件地址:https://ycxyi.github.io/plugs/Ycx_VersionCheck.js
插件预览,记得有位大大说 document会覆盖,有建议可以及时提,谢谢。
JAVASCRIPT 代码
//=============================================================================
// Ycx_VersionCheck.js
//=============================================================================
var Imported = Imported || {};
Imported.Ycx_VersionCheck = true;
var Ycx = Ycx || {};
Ycx.CHECK = Ycx.CHECK || {};
/*:
* @plugindesc 基于代码托管网站的检测游戏版本插件 v1.0.0
* @author ycx
*
* @param nowVersion
* @desc 目前游戏版本
* @default 1.0.0
*
*
* @param urlText
* @desc 检测版本的url地址
* @default http://ycxm.coding.me/jquery/version.txt
*
* @param showInTitle
* @desc 菜单是否显示版本检查false 不显示true 显示
* @default true
*
*@param showInTitleText
* @desc showInTitle为true,即要显示的标题命令文字
* @default 版本检测
*
*
* @param urlOpen
* @desc 有新版本则要打开的url地址
* @default http://ycxm.coding.me/jquery/version.rar
*
* @param startCheck
* @desc 是否开始游戏就检查版本false 不检查true 检查
* @default true
*
*
* @help
* ================================================================
* 检测游戏版本
* ================================================================
* 依赖项:需要导入Jquery.js
*
* nowVersion:当前游戏版本。
*
* urlText:检测版本的url地址,代码托管网站的文件地址,得到的是版本号,不要写其他的。
*
* showInTitle:是否在标题显示版本检查这一项。false 不显示true 显示
*
* showInTitleText:showInTitle为true时,即要显示的标题命令文字。
*
* urlOpen:检测到有新版本则要打开的url地址,可打开官网之类。
*
* startCheck:是否开始游戏就检查版本。 false 不检查true 检查
*
* 插件命令:“命令 内容” 形式,示例如下:
* 1. checkversion http://ycxm.coding.me/jquery/version.txt 检测游戏版本
*
* 2. openurlhttps://www.baidu.com 打开网址,可打开游戏官网等。
*
*最后qq:1359762297
*ycx插件库:https://github.com/ycxYI/plugs(待更新)
*
*/
Ycx.parameters = PluginManager.parameters('Ycx_VersionCheck');
Ycx.nowVersion = String(Ycx.parameters['nowVersion'] || '1.0.0');
Ycx.urlText = String(Ycx.parameters['urlText'] || 'http://ycxm.coding.me/jquery/version.txt');
Ycx.showInTitle = String(Ycx.parameters['showInTitle'] || 'true');
Ycx.showInTitleText = String(Ycx.parameters['showInTitleText'] || '版本检测');
Ycx.urlOpen = String(Ycx.parameters['urlOpen'] || 'http://ycxm.coding.me/jquery/version.rar');
Ycx.startCheck = String(Ycx.parameters['startCheck'] || 'true');
//=============================================================================
// SceneManager
//=============================================================================
SceneManager.openPopupBlockerMessage = function(){
this._scene.openPopupBlockerMessage();
};
//=============================================================================
// Game_Interpreter
//=============================================================================
Ycx.CHECK.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args){
Ycx.CHECK.Game_Interpreter_pluginCommand.call(this, command, args)
if(command === 'checkversion')this.checkVersion(args);
if(command === 'openurl')this.openurl(args);
};
Game_Interpreter.prototype.checkVersion = function(args){
TouchInput.clear();
Input.clear();
var url = String(args);
$(document).load(url, function(responseText, textStatus){
if(Ycx.nowVersion == responseText){
alert("已经是最新版本!");
}else{
if(confirm("存在最新版本是否更新?")){
var win = window.open(url);
if(win){
win.focus();
}else{
SceneManager.openPopupBlockerMessage();
}
}
}
});
};
Game_Interpreter.prototype.openurl = function(args){
TouchInput.clear();
Input.clear();
var url = String(args);
var win = window.open(url);
if(win){
win.focus();
}else{
SceneManager.openPopupBlockerMessage();
}
};
//-----------------------------------------------------------------------------
//开始检测
//-----------------------------------------------------------------------------
if(Ycx.startCheck == "true"){
$(document).load(Ycx.urlText, function(responseText, textStatus){
if(Ycx.nowVersion == responseText){
alert("已经是最新版本!");
}else{
if(confirm("存在最新版本是否更新?")){
var win = window.open(Ycx.urlOpen);
if(win){
win.focus();
}else{
SceneManager.openPopupBlockerMessage();
}
}
}
});
}
//-----------------------------------------------------------------------------
// Scene_Title
//-----------------------------------------------------------------------------
Scene_Title.prototype.createCommandWindow = function(){
this._commandWindow = new Window_TitleCommand();
this._commandWindow.setHandler('newGame', this.commandNewGame.bind(this));
this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
this._commandWindow.setHandler('options', this.commandOptions.bind(this));
if(Ycx.showInTitle == "true"){
this._commandWindow.setHandler('Check', this.versionCheck.bind(this));
}
this.addWindow(this._commandWindow);
};
Scene_Title.prototype.versionCheck = function(){
this._commandWindow.close();
$(document).load(Ycx.urlText, function(responseText, textStatus){
if(Ycx.nowVersion == responseText){
alert("已经是最新版本!");
}else{
if(confirm("存在最新版本是否更新?")){
var win = window.open(Ycx.urlOpen);
if(win){
win.focus();
}else{
SceneManager.openPopupBlockerMessage();
}
}
}
});
SceneManager.goto(Scene_Title);
};
//-----------------------------------------------------------------------------
// Window_TitleCommand
//-----------------------------------------------------------------------------
Window_TitleCommand.prototype.makeCommandList = function(){
this.addCommand(TextManager.newGame, 'newGame');
this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
this.addCommand(TextManager.options, 'options');
if(Ycx.showInTitle == "true"){
this.addCommand(Ycx.showInTitleText, 'Check');
}
};
本帖来自P1论坛作者易大师,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=398017若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]