查看: 3466|回复: 9

[已经过期] 帮我看下这个插连接插件是怎么会事。YEP.21 – External Links

[复制链接]
梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
发表于 2017-4-30 00:32:13 | 显示全部楼层 |阅读模式

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

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

×
  1. //=============================================================================
  2. // Yanfly Engine Plugins - External Links
  3. // YEP_ExternalLinks.js
  4. //=============================================================================

  5. var Imported = Imported || {};
  6. Imported.YEP_ExternalLinks = true;

  7. var Yanfly = Yanfly || {};
  8. Yanfly.LINK = Yanfly.LINK || {};

  9. //=============================================================================
  10. /*:
  11. * @plugindesc v1.00 Link back to your home page through the title screen
  12. * and also be able to link your players from within the game.
  13. * @author Yanfly Engine Plugins
  14. *
  15. * @param Home Page URL
  16. * @desc Places a link to your website homepage at the title screen.
  17. * Leave this blank if you don't wish to enable this feature.
  18. * @default [url]https://www.google.com/[/url]
  19. *
  20. * @param Home Page Text
  21. * @desc This is how 'Home Page' will appear on the title screen.
  22. * @default Home Page
  23. *
  24. * @param Popup Blocker Notice
  25. * @desc This is a window to notify the player the link was blocked
  26. * by a pop-up blocker.
  27. * @default The link was blocked by a pop-up blocker.
  28. *
  29. * @help
  30. * ============================================================================
  31. * Introduction                                                     .
  32. * ============================================================================
  33. * This plugin allows you to place a "link" to your home page at the title
  34. * screen's command window towards the bottom. To adjust where the link goes,
  35. * change the Home Page URL in the plugin's parameters.
  36. *
  37. * ============================================================================
  38. * Plugin Commands
  39. * ============================================================================
  40. *
  41. * If you wish to send players to other links, you can use the following
  42. * plugin commands.
  43. *
  44. * Plugin Command
  45. *   OpenNewTab [url]http://www.google.com/[/url]     Opens link in a new tab.
  46. *   OpenNewWindow [url]http://www.google.com/[/url]  Opens link in a new window.
  47. *
  48. * Some web browsers may not differentiate these commands too much.
  49. */
  50. //=============================================================================

  51. //=============================================================================
  52. // Parameter Variables
  53. //=============================================================================

  54. Yanfly.Parameters = PluginManager.parameters('YEP_ExternalLinks');
  55. Yanfly.Param = Yanfly.Param || {};

  56. Yanfly.Param.HomePageUrl = String(Yanfly.Parameters['Home Page URL']);
  57. Yanfly.Param.HomePageText = String(Yanfly.Parameters['Home Page Text']);
  58. Yanfly.Param.PopupMessage = String(Yanfly.Parameters['Popup Blocker Notice']);

  59. //=============================================================================
  60. // SceneManager
  61. //=============================================================================

  62. SceneManager.openPopupBlockerMessage = function() {
  63.         this._scene.openPopupBlockerMessage();
  64. };

  65. //=============================================================================
  66. // Game_Interpreter
  67. //=============================================================================

  68. Yanfly.LINK.Game_Interpreter_pluginCommand =
  69.     Game_Interpreter.prototype.pluginCommand;
  70. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  71.     Yanfly.LINK.Game_Interpreter_pluginCommand.call(this, command, args)
  72.     if (command === 'OpenNewTab') this.openNewTab(args);
  73.                 if (command === 'OpenNewWindow') this.openNewWindow(args);
  74. };

  75. Game_Interpreter.prototype.openNewTab = function(args) {
  76.         TouchInput.clear();
  77.         Input.clear();
  78.         var url = String(args[0]);
  79.         var win = window.open(url, '_blank');
  80.         if (win) {
  81.                 win.focus();
  82.         } else {
  83.                 SceneManager.openPopupBlockerMessage();
  84.         }
  85. };

  86. Game_Interpreter.prototype.openNewWindow = function(args) {
  87.         TouchInput.clear();
  88.         Input.clear();
  89.         var url = String(args[0]);
  90.         var win = window.open(url);
  91.         if (win) {
  92.                 win.focus();
  93.         } else {
  94.                 SceneManager.openPopupBlockerMessage();
  95.         }
  96. };

  97. //=============================================================================
  98. // Window_TitleCommand
  99. //=============================================================================

  100. Yanfly.LINK.Window_TitleCommand_makeCommandList =
  101.                 Window_TitleCommand.prototype.makeCommandList;
  102. Window_TitleCommand.prototype.makeCommandList = function() {
  103.     Yanfly.LINK.Window_TitleCommand_makeCommandList.call(this);
  104.                 this.addHomePageCommand();
  105. };

  106. Window_TitleCommand.prototype.addHomePageCommand = function() {
  107.     if (Yanfly.Param.HomePageUrl.length <= 0) return;
  108.                 this.addCommand(Yanfly.Param.HomePageText, 'homePage');
  109. };

  110. //=============================================================================
  111. // Window_PopupBlocker
  112. //=============================================================================

  113. function Window_PopupBlocker() {
  114.     this.initialize.apply(this, arguments);
  115. }

  116. Window_PopupBlocker.prototype = Object.create(Window_Base.prototype);
  117. Window_PopupBlocker.prototype.constructor = Window_PopupBlocker;

  118. Window_PopupBlocker.prototype.initialize = function() {
  119.     var width = Graphics.boxWidth;
  120.     var height = this.fittingHeight(1);
  121.     Window_Base.prototype.initialize.call(this, 0, 0, width, height);
  122.                 this.resizeWindow();
  123.                 this.refresh();
  124.                 this.openness = 0;
  125. };

  126. Window_PopupBlocker.prototype.resizeWindow = function() {
  127.                 this.width = this.windowWidth();
  128.                 this.createContents();
  129.                 this.x = (Graphics.boxWidth - this.width) / 2;
  130.                 this.y = (Graphics.boxHeight - this.height) / 2;
  131. };

  132. Window_PopupBlocker.prototype.windowWidth = function() {
  133.                 return this.textWidth(Yanfly.Param.PopupMessage);
  134. };

  135. Window_PopupBlocker.prototype.refresh = function() {
  136.                 this.contents.clear();
  137.                 this.drawText(Yanfly.Param.PopupMessage, 0, 0, this.contents.width);
  138. };

  139. //=============================================================================
  140. // Scene_Base
  141. //=============================================================================

  142. Yanfly.LINK.Scene_Base_createWindowLayer =
  143.                 Scene_Base.prototype.createWindowLayer;
  144. Scene_Base.prototype.createWindowLayer = function() {
  145.                 Yanfly.LINK.Scene_Base_createWindowLayer.call(this);
  146.                 this.createPopupBlockerMessage();
  147. };

  148. Scene_Base.prototype.createPopupBlockerMessage = function() {
  149.                 this._popupBlockerWindow = new Window_PopupBlocker();
  150.                 this.addWindow(this._popupBlockerWindow);
  151.                 this._popupCounter = 0;
  152. };

  153. Yanfly.LINK.Scene_Base_update = Scene_Base.prototype.update;
  154. Scene_Base.prototype.update = function() {
  155.     Yanfly.LINK.Scene_Base_update.call(this);
  156.                 this.updatePopupBlockerMessage();
  157. };

  158. Scene_Base.prototype.updatePopupBlockerMessage = function() {
  159.                 if (!this._popupBlockerWindow) return;
  160.                 if (this._popupBlockerWindow.isClosed()) return;
  161.                 if (--this._popupCounter > 0) return;
  162.                 this.closePopupBlockerMessage();
  163. };

  164. Scene_Base.prototype.openPopupBlockerMessage = function() {
  165.                 this._popupBlockerWindow.open();
  166.                 this._popupBlockerWindow.activate();
  167.                 this._popupCounter = 180;
  168. };

  169. Scene_Base.prototype.closePopupBlockerMessage = function() {
  170.                 if (!this._popupBlockerWindow) return;
  171.                 if (this._popupBlockerWindow.isClosed()) return;
  172.                 this._popupBlockerWindow.close();
  173.                 this._popupBlockerWindow.deactivate();
  174. };

  175. //=============================================================================
  176. // Scene_Base
  177. //=============================================================================

  178. Yanfly.LINK.Scene_Title_createCommandWindow =
  179.                 Scene_Title.prototype.createCommandWindow;
  180. Scene_Title.prototype.createCommandWindow = function() {
  181.     Yanfly.LINK.Scene_Title_createCommandWindow.call(this);
  182.                 this._commandWindow.setHandler('homePage', this.commandHomePage.bind(this));
  183. };

  184. Scene_Title.prototype.commandHomePage = function() {
  185.         TouchInput.clear();
  186.         Input.clear();
  187.         this._commandWindow.activate();
  188.         var win = window.open(Yanfly.Param.HomePageUrl, '_blank');
  189.         if (win) {
  190.                 win.focus();
  191.         } else {
  192.                 SceneManager.openPopupBlockerMessage();
  193.         }
  194. };

  195. //=============================================================================
  196. // End of File
  197. //=============================================================================
复制代码





这个是YEP_ExternalLinks  这个插件,为游戏插件超连接的,可是为什么添加后,在游戏开始标题上点击后会是空白?可是在游戏中却能打开网址?

这是插件脚本

这是插件脚本

在标题页面打开始空白

在标题页面打开始空白

进入游戏时用插件脚本能打开

进入游戏时用插件脚本能打开


以上是插件代码。各位大神帮我看看是哪里的毛病?
梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
 楼主| 发表于 2017-5-1 22:59:13 | 显示全部楼层
顶一下,求大神指教。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
 楼主| 发表于 2017-5-2 10:18:32 来自手机 | 显示全部楼层
每曰一顶。。。
回复

使用道具 举报

梦石
0
星屑
95
在线时间
256 小时
注册时间
2011-3-14
回帖
78
发表于 2017-5-2 22:35:04 | 显示全部楼层
插件参数HomePageUrl地址里面 Https => Http
回复

使用道具 举报

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
 楼主| 发表于 2017-5-6 23:11:36 | 显示全部楼层
wymwaq 发表于 2017-5-2 22:35
插件参数HomePageUrl地址里面 Https => Http

终于来人啦,请问怎么改才行?{:8_457:}
回复

使用道具 举报

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
 楼主| 发表于 2017-5-6 23:28:59 | 显示全部楼层
wymwaq 发表于 2017-5-2 22:35
插件参数HomePageUrl地址里面 Https => Http

现在可以打开网址了,可是返回游戏鼠标不能用了,怎么办?只能用上下键进入游戏?
回复

使用道具 举报

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
 楼主| 发表于 2017-5-11 08:06:52 来自手机 | 显示全部楼层
顶一下,
回复

使用道具 举报

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
回帖
14
 楼主| 发表于 2017-5-12 12:36:09 来自手机 | 显示全部楼层
顶一下,在可以打开网址了,可是返回游戏鼠标不能用了,怎么办?只能用上下键进入游戏?

点评

直接点窗口的x就可以关闭了 相当于另开了个窗口  发表于 2017-12-28 21:09
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部