设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2369|回复: 9
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
跳转到指定楼层
1
发表于 2017-4-30 00:32:13 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // Yanfly Engine Plugins - External Links
  3. // YEP_ExternalLinks.js
  4. //=============================================================================
  5.  
  6. var Imported = Imported || {};
  7. Imported.YEP_ExternalLinks = true;
  8.  
  9. var Yanfly = Yanfly || {};
  10. Yanfly.LINK = Yanfly.LINK || {};
  11.  
  12. //=============================================================================
  13. /*:
  14.  * @plugindesc v1.00 Link back to your home page through the title screen
  15.  * and also be able to link your players from within the game.
  16.  * @author Yanfly Engine Plugins
  17.  *
  18.  * @param Home Page URL
  19.  * @desc Places a link to your website homepage at the title screen.
  20.  * Leave this blank if you don't wish to enable this feature.
  21.  * @default [url]https://www.google.com/[/url]
  22.  *
  23.  * @param Home Page Text
  24.  * @desc This is how 'Home Page' will appear on the title screen.
  25.  * @default Home Page
  26.  *
  27.  * @param Popup Blocker Notice
  28.  * @desc This is a window to notify the player the link was blocked
  29.  * by a pop-up blocker.
  30.  * @default The link was blocked by a pop-up blocker.
  31.  *
  32.  * @help
  33.  * ============================================================================
  34.  * Introduction                                                     .
  35.  * ============================================================================
  36.  * This plugin allows you to place a "link" to your home page at the title
  37.  * screen's command window towards the bottom. To adjust where the link goes,
  38.  * change the Home Page URL in the plugin's parameters.
  39.  *
  40.  * ============================================================================
  41.  * Plugin Commands
  42.  * ============================================================================
  43.  *
  44.  * If you wish to send players to other links, you can use the following
  45.  * plugin commands.
  46.  *
  47.  * Plugin Command
  48.  *   OpenNewTab [url]http://www.google.com/[/url]     Opens link in a new tab.
  49.  *   OpenNewWindow [url]http://www.google.com/[/url]  Opens link in a new window.
  50.  *
  51.  * Some web browsers may not differentiate these commands too much.
  52.  */
  53. //=============================================================================
  54.  
  55. //=============================================================================
  56. // Parameter Variables
  57. //=============================================================================
  58.  
  59. Yanfly.Parameters = PluginManager.parameters('YEP_ExternalLinks');
  60. Yanfly.Param = Yanfly.Param || {};
  61.  
  62. Yanfly.Param.HomePageUrl = String(Yanfly.Parameters['Home Page URL']);
  63. Yanfly.Param.HomePageText = String(Yanfly.Parameters['Home Page Text']);
  64. Yanfly.Param.PopupMessage = String(Yanfly.Parameters['Popup Blocker Notice']);
  65.  
  66. //=============================================================================
  67. // SceneManager
  68. //=============================================================================
  69.  
  70. SceneManager.openPopupBlockerMessage = function() {
  71.         this._scene.openPopupBlockerMessage();
  72. };
  73.  
  74. //=============================================================================
  75. // Game_Interpreter
  76. //=============================================================================
  77.  
  78. Yanfly.LINK.Game_Interpreter_pluginCommand =
  79.     Game_Interpreter.prototype.pluginCommand;
  80. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  81.     Yanfly.LINK.Game_Interpreter_pluginCommand.call(this, command, args)
  82.     if (command === 'OpenNewTab') this.openNewTab(args);
  83.                 if (command === 'OpenNewWindow') this.openNewWindow(args);
  84. };
  85.  
  86. Game_Interpreter.prototype.openNewTab = function(args) {
  87.         TouchInput.clear();
  88.         Input.clear();
  89.         var url = String(args[0]);
  90.         var win = window.open(url, '_blank');
  91.         if (win) {
  92.                 win.focus();
  93.         } else {
  94.                 SceneManager.openPopupBlockerMessage();
  95.         }
  96. };
  97.  
  98. Game_Interpreter.prototype.openNewWindow = function(args) {
  99.         TouchInput.clear();
  100.         Input.clear();
  101.         var url = String(args[0]);
  102.         var win = window.open(url);
  103.         if (win) {
  104.                 win.focus();
  105.         } else {
  106.                 SceneManager.openPopupBlockerMessage();
  107.         }
  108. };
  109.  
  110. //=============================================================================
  111. // Window_TitleCommand
  112. //=============================================================================
  113.  
  114. Yanfly.LINK.Window_TitleCommand_makeCommandList =
  115.                 Window_TitleCommand.prototype.makeCommandList;
  116. Window_TitleCommand.prototype.makeCommandList = function() {
  117.     Yanfly.LINK.Window_TitleCommand_makeCommandList.call(this);
  118.                 this.addHomePageCommand();
  119. };
  120.  
  121. Window_TitleCommand.prototype.addHomePageCommand = function() {
  122.     if (Yanfly.Param.HomePageUrl.length <= 0) return;
  123.                 this.addCommand(Yanfly.Param.HomePageText, 'homePage');
  124. };
  125.  
  126. //=============================================================================
  127. // Window_PopupBlocker
  128. //=============================================================================
  129.  
  130. function Window_PopupBlocker() {
  131.     this.initialize.apply(this, arguments);
  132. }
  133.  
  134. Window_PopupBlocker.prototype = Object.create(Window_Base.prototype);
  135. Window_PopupBlocker.prototype.constructor = Window_PopupBlocker;
  136.  
  137. Window_PopupBlocker.prototype.initialize = function() {
  138.     var width = Graphics.boxWidth;
  139.     var height = this.fittingHeight(1);
  140.     Window_Base.prototype.initialize.call(this, 0, 0, width, height);
  141.                 this.resizeWindow();
  142.                 this.refresh();
  143.                 this.openness = 0;
  144. };
  145.  
  146. Window_PopupBlocker.prototype.resizeWindow = function() {
  147.                 this.width = this.windowWidth();
  148.                 this.createContents();
  149.                 this.x = (Graphics.boxWidth - this.width) / 2;
  150.                 this.y = (Graphics.boxHeight - this.height) / 2;
  151. };
  152.  
  153. Window_PopupBlocker.prototype.windowWidth = function() {
  154.                 return this.textWidth(Yanfly.Param.PopupMessage);
  155. };
  156.  
  157. Window_PopupBlocker.prototype.refresh = function() {
  158.                 this.contents.clear();
  159.                 this.drawText(Yanfly.Param.PopupMessage, 0, 0, this.contents.width);
  160. };
  161.  
  162. //=============================================================================
  163. // Scene_Base
  164. //=============================================================================
  165.  
  166. Yanfly.LINK.Scene_Base_createWindowLayer =
  167.                 Scene_Base.prototype.createWindowLayer;
  168. Scene_Base.prototype.createWindowLayer = function() {
  169.                 Yanfly.LINK.Scene_Base_createWindowLayer.call(this);
  170.                 this.createPopupBlockerMessage();
  171. };
  172.  
  173. Scene_Base.prototype.createPopupBlockerMessage = function() {
  174.                 this._popupBlockerWindow = new Window_PopupBlocker();
  175.                 this.addWindow(this._popupBlockerWindow);
  176.                 this._popupCounter = 0;
  177. };
  178.  
  179. Yanfly.LINK.Scene_Base_update = Scene_Base.prototype.update;
  180. Scene_Base.prototype.update = function() {
  181.     Yanfly.LINK.Scene_Base_update.call(this);
  182.                 this.updatePopupBlockerMessage();
  183. };
  184.  
  185. Scene_Base.prototype.updatePopupBlockerMessage = function() {
  186.                 if (!this._popupBlockerWindow) return;
  187.                 if (this._popupBlockerWindow.isClosed()) return;
  188.                 if (--this._popupCounter > 0) return;
  189.                 this.closePopupBlockerMessage();
  190. };
  191.  
  192. Scene_Base.prototype.openPopupBlockerMessage = function() {
  193.                 this._popupBlockerWindow.open();
  194.                 this._popupBlockerWindow.activate();
  195.                 this._popupCounter = 180;
  196. };
  197.  
  198. Scene_Base.prototype.closePopupBlockerMessage = function() {
  199.                 if (!this._popupBlockerWindow) return;
  200.                 if (this._popupBlockerWindow.isClosed()) return;
  201.                 this._popupBlockerWindow.close();
  202.                 this._popupBlockerWindow.deactivate();
  203. };
  204.  
  205. //=============================================================================
  206. // Scene_Base
  207. //=============================================================================
  208.  
  209. Yanfly.LINK.Scene_Title_createCommandWindow =
  210.                 Scene_Title.prototype.createCommandWindow;
  211. Scene_Title.prototype.createCommandWindow = function() {
  212.     Yanfly.LINK.Scene_Title_createCommandWindow.call(this);
  213.                 this._commandWindow.setHandler('homePage', this.commandHomePage.bind(this));
  214. };
  215.  
  216. Scene_Title.prototype.commandHomePage = function() {
  217.         TouchInput.clear();
  218.         Input.clear();
  219.         this._commandWindow.activate();
  220.         var win = window.open(Yanfly.Param.HomePageUrl, '_blank');
  221.         if (win) {
  222.                 win.focus();
  223.         } else {
  224.                 SceneManager.openPopupBlockerMessage();
  225.         }
  226. };
  227.  
  228. //=============================================================================
  229. // End of File
  230. //=============================================================================





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




以上是插件代码。各位大神帮我看看是哪里的毛病?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
2
 楼主| 发表于 2017-5-1 22:59:13 | 只看该作者
顶一下,求大神指教。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
3
 楼主| 发表于 2017-5-2 10:18:32 手机端发表。 | 只看该作者
每曰一顶。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
80
在线时间
254 小时
注册时间
2011-3-14
帖子
85
4
发表于 2017-5-2 22:35:04 | 只看该作者
插件参数HomePageUrl地址里面 Https => Http
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
5
 楼主| 发表于 2017-5-6 23:11:36 | 只看该作者
wymwaq 发表于 2017-5-2 22:35
插件参数HomePageUrl地址里面 Https => Http

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
6
 楼主| 发表于 2017-5-6 23:28:59 | 只看该作者
wymwaq 发表于 2017-5-2 22:35
插件参数HomePageUrl地址里面 Https => Http

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
7
 楼主| 发表于 2017-5-11 08:06:52 手机端发表。 | 只看该作者
顶一下,
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-10-7
帖子
24
8
 楼主| 发表于 2017-5-12 12:36:09 手机端发表。 | 只看该作者
顶一下,在可以打开网址了,可是返回游戏鼠标不能用了,怎么办?只能用上下键进入游戏?

点评

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-27 23:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表