查看: 5762|回复: 9

[原创发布] RMMV基于托管网站的游戏版本更新检测

[复制链接]
梦石
0
星屑
70
在线时间
51 小时
注册时间
2014-11-29
回帖
14
发表于 2016-12-30 13:57:59 | 显示全部楼层 |阅读模式

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

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

×
  RMMV基于托管网站的游戏版本更新检测
楼主没发过什么帖子,也不知道该说些啥,就是基于github或者coding的游戏版本检查,首先是在这些网站上拥有自己的仓库,然后发布page页,新建一个关于版本的文件,然后在rmmv中用插件进行判断,详细说明在demo中有写,依赖jquery,有不懂的回复说明。

地址如下 RMMV插件游戏版本检测(原).rar (1.24 MB, 下载次数: 145)



插件地址:https://ycxyi.github.io/plugs/Ycx_VersionCheck.js

插件预览,记得有位大大说 document会覆盖,有建议可以及时提,谢谢。

  1. //=============================================================================
  2. // Ycx_VersionCheck.js
  3. //=============================================================================
  4. var Imported = Imported || {};
  5. Imported.Ycx_VersionCheck = true;

  6. var Ycx = Ycx || {};
  7. Ycx.CHECK = Ycx.CHECK || {};
  8. /*:
  9. * @plugindesc 基于代码托管网站的检测游戏版本插件 v1.0.0
  10. * @author ycx
  11. *
  12. * @param nowVersion
  13. * @desc 目前游戏版本
  14. * @default 1.0.0
  15. *
  16. *
  17. * @param urlText
  18. * @desc 检测版本的url地址
  19. * @default [url]http://ycxm.coding.me/jquery/version.txt[/url]
  20. *
  21. * @param showInTitle
  22. * @desc 菜单是否显示版本检查  false 不显示  true 显示
  23. * @default true
  24. *
  25. *  @param showInTitleText
  26. * @desc showInTitle为true,即要显示的标题命令文字
  27. * @default 版本检测
  28. *
  29. *  
  30. * @param urlOpen
  31. * @desc 有新版本则要打开的url地址
  32. * @default [url]http://ycxm.coding.me/jquery/version.rar[/url]
  33. *
  34. * @param startCheck
  35. * @desc 是否开始游戏就检查版本  false 不检查  true 检查
  36. * @default true
  37. *
  38. *
  39. * @help
  40. * ================================================================
  41. * 检测游戏版本
  42. * ================================================================
  43. *   依赖项:需要导入Jquery.js
  44. *
  45. *   nowVersion:当前游戏版本。
  46. *
  47. *   urlText:检测版本的url地址,代码托管网站的文件地址,得到的是版本号,不要写其他的。
  48. *   
  49. *   showInTitle:是否在标题显示版本检查这一项。  false 不显示  true 显示
  50. *
  51. *   showInTitleText:showInTitle为true时,即要显示的标题命令文字。
  52. *
  53. *   urlOpen:检测到有新版本则要打开的url地址,可打开官网之类。
  54. *
  55. *   startCheck:是否开始游戏就检查版本。   false 不检查  true 检查
  56. *
  57. *   插件命令:“命令 内容” 形式,示例如下:
  58. *       1. checkversion [url]http://ycxm.coding.me/jquery/version.txt[/url]      检测游戏版本
  59. *
  60. *       2. openurl  [url]https://www.baidu.com[/url]                             打开网址,可打开游戏官网等。
  61. *
  62. *  最后qq:1359762297
  63. *  ycx插件库:[url]https://github.com/ycxYI/plugs[/url](待更新)
  64. *
  65. */
  66.  

  67. Ycx.parameters = PluginManager.parameters('Ycx_VersionCheck');

  68. Ycx.nowVersion = String(Ycx.parameters['nowVersion'] || '1.0.0');
  69. Ycx.urlText = String(Ycx.parameters['urlText'] || 'http://ycxm.coding.me/jquery/version.txt');
  70. Ycx.showInTitle = String(Ycx.parameters['showInTitle'] || 'true');
  71. Ycx.showInTitleText = String(Ycx.parameters['showInTitleText'] || '版本检测');
  72. Ycx.urlOpen = String(Ycx.parameters['urlOpen'] || 'http://ycxm.coding.me/jquery/version.rar');
  73. Ycx.startCheck = String(Ycx.parameters['startCheck'] || 'true');

  74. //=============================================================================
  75. // SceneManager
  76. //=============================================================================

  77. SceneManager.openPopupBlockerMessage = function() {
  78.         this._scene.openPopupBlockerMessage();
  79. };

  80. //=============================================================================
  81. // Game_Interpreter
  82. //=============================================================================

  83. Ycx.CHECK.Game_Interpreter_pluginCommand =
  84.     Game_Interpreter.prototype.pluginCommand;
  85. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  86.     Ycx.CHECK.Game_Interpreter_pluginCommand.call(this, command, args)
  87.     if (command === 'checkversion') this.checkVersion(args);
  88.     if (command === 'openurl') this.openurl(args);
  89. };

  90. Game_Interpreter.prototype.checkVersion = function(args) {
  91.     TouchInput.clear();
  92.     Input.clear();
  93.     var url = String(args[0]);
  94.     $(document).load(url, function(responseText, textStatus) {
  95.         if (Ycx.nowVersion == responseText) {
  96.             alert("已经是最新版本!");
  97.         } else {
  98.             if (confirm("存在最新版本是否更新?")) {
  99.                 var win = window.open(url);
  100.                 if (win) {
  101.                     win.focus();
  102.                 } else {
  103.                     SceneManager.openPopupBlockerMessage();
  104.                 }
  105.             }
  106.         }

  107.     });
  108. };

  109. Game_Interpreter.prototype.openurl = function(args) {
  110.     TouchInput.clear();
  111.     Input.clear();
  112.     var url = String(args[0]);
  113.     var win = window.open(url);
  114.     if (win) {
  115.         win.focus();
  116.     } else {
  117.         SceneManager.openPopupBlockerMessage();
  118.     }
  119.            
  120. };

  121. //-----------------------------------------------------------------------------
  122. //开始检测
  123. //-----------------------------------------------------------------------------
  124. if (Ycx.startCheck == "true") {
  125.     $(document).load(Ycx.urlText, function(responseText, textStatus) {

  126.         if (Ycx.nowVersion == responseText) {
  127.             alert("已经是最新版本!");
  128.         } else {
  129.             if (confirm("存在最新版本是否更新?")) {
  130.                 var win = window.open(Ycx.urlOpen);
  131.                 if (win) {
  132.                     win.focus();
  133.                 } else {
  134.                     SceneManager.openPopupBlockerMessage();
  135.                 }
  136.             }
  137.         }

  138.     });
  139. }

  140. //-----------------------------------------------------------------------------
  141. // Scene_Title
  142. //-----------------------------------------------------------------------------

  143. Scene_Title.prototype.createCommandWindow = function() {
  144.     this._commandWindow = new Window_TitleCommand();
  145.     this._commandWindow.setHandler('newGame', this.commandNewGame.bind(this));
  146.     this._commandWindow.setHandler('continue', this.commandContinue.bind(this));
  147.     this._commandWindow.setHandler('options', this.commandOptions.bind(this));
  148.     if (Ycx.showInTitle == "true") {
  149.         this._commandWindow.setHandler('Check', this.versionCheck.bind(this));
  150.     }
  151.     this.addWindow(this._commandWindow);
  152. };

  153. Scene_Title.prototype.versionCheck = function() {
  154.     this._commandWindow.close();
  155.     $(document).load(Ycx.urlText, function(responseText, textStatus) {
  156.         if (Ycx.nowVersion == responseText) {
  157.             alert("已经是最新版本!");
  158.         } else {
  159.             if (confirm("存在最新版本是否更新?")) {
  160.                 var win = window.open(Ycx.urlOpen);
  161.                 if (win) {
  162.                     win.focus();
  163.                 } else {
  164.                     SceneManager.openPopupBlockerMessage();
  165.                 }
  166.             }
  167.         }
  168.     });
  169.     SceneManager.goto(Scene_Title);
  170. };

  171. //-----------------------------------------------------------------------------
  172. // Window_TitleCommand
  173. //-----------------------------------------------------------------------------

  174. Window_TitleCommand.prototype.makeCommandList = function() {
  175.     this.addCommand(TextManager.newGame, 'newGame');
  176.     this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled());
  177.     this.addCommand(TextManager.options, 'options');
  178.     if (Ycx.showInTitle == "true") {
  179.         this.addCommand(Ycx.showInTitleText, 'Check');
  180.     }
  181. };
复制代码

评分

参与人数 1星屑 +120 收起 理由
garfeng + 120 我很赞同

查看全部评分


梦石
0
星屑
102
在线时间
402 小时
注册时间
2013-11-2
回帖
80
发表于 2016-12-30 15:25:38 | 显示全部楼层
感谢大大分享,记得va里也有类似的·功能
回复

使用道具 举报

梦石
0
星屑
15309
在线时间
720 小时
注册时间
2011-7-16
回帖
1373

开拓者

发表于 2016-12-30 15:34:59 | 显示全部楼层
正需要啊,不用自己写了,多谢大师
RMMV网络插件,开源免费,内含服务器端,无需强制登录,云数据,弹幕,云存档,排名,兑换码,版本检测,可自由上架下架删除。q群399090587
免打包运行MV游戏,云游戏,安卓App雷神游戏厅,在线玩游戏,上传下载游戏
开源游戏:重装机兵之重装归来【RMMV制作】全球首款按照美剧分季分集的方式发布的游戏
体素画 -- MV画3D像素图的画板
RMMV显示3D模型和场景的插件
RMMV显示spine骨骼动画的插件
RMMV秘密通道插件
突破敌群数量上限8个的插件
在rmmv中显示gif动态图片的插件
一款可以在mv游戏界面的任意位置显示任意文字的插件
RMMV Toast 插件 带物品得失提示,可以设置开启关闭 兼容yep itemcore
制作一个改名卡道具插件、调整标题页面菜单的插件、在标题页面之前显示大段文字的插件、标题页面显示版本号的插件
物品得失自动提示自动上色自动换行插件
我的Q群 663889472
另外,我的插件、范例、游戏都在这里
回复 1 0

使用道具 举报

梦石
0
星屑
3930
在线时间
1198 小时
注册时间
2016-8-9
回帖
2355

开拓者

发表于 2016-12-31 13:09:53 | 显示全部楼层
不知道为何不能给分,但是至少要回复一下楼主表示感谢
酸酸甜甜就④哇噢
回复

使用道具 举报

梦石
0
星屑
2152
在线时间
427 小时
注册时间
2013-8-28
回帖
87
发表于 2017-1-20 06:18:22 | 显示全部楼层
哈哈
回复

使用道具 举报

梦石
2
星屑
5550
在线时间
2566 小时
注册时间
2012-2-9
回帖
947

开拓者

发表于 2017-1-20 09:00:01 | 显示全部楼层
可以更进一步,在version文件里提供各版本升级包下载地址,直链地址,用js下载升级包覆盖本地游戏目录,这样就可以自动升级了。
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2017-1-20 10:42:55 | 显示全部楼层
SRD_AutoUpdater.js
可在version文件里提供各版本升级文件下载地址,可以自动升级。
Download the Plugin Here:
http://sumrndm.site/auto-updater/
示範視頻
https://www.youtube.com/watch?v= ... p;index=92&t=3s

评分

参与人数 1星屑 +120 收起 理由
garfeng + 120 我很赞同

查看全部评分

回复

使用道具 举报

梦石
0
星屑
70
在线时间
51 小时
注册时间
2014-11-29
回帖
14
 楼主| 发表于 2017-1-22 01:41:24 | 显示全部楼层
garfeng 发表于 2017-1-20 09:00
可以更进一步,在version文件里提供各版本升级包下载地址,直链地址,用js下载升级包覆盖本地游戏目录,这 ...

我知道了,感谢

回复

使用道具 举报

梦石
0
星屑
70
在线时间
51 小时
注册时间
2014-11-29
回帖
14
 楼主| 发表于 2017-1-22 01:42:34 | 显示全部楼层
tseyik 发表于 2017-1-20 10:42
SRD_AutoUpdater.js
可在version文件里提供各版本升级文件下载地址,可以自动升级。
Download the Plugin H ...

好的,我会看看的

回复

使用道具 举报

梦石
0
星屑
1433
在线时间
128 小时
注册时间
2018-7-31
回帖
50
发表于 2023-8-3 16:21:42 | 显示全部楼层
https://rpg.blue/thread-398017-1-1.html谁指导下仓库那边如何设置
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部