| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2017-6-6 |
| 在线时间 | 73 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 73 小时
- 注册时间
- 2010-10-7
- 回帖
- 14
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
- //=============================================================================
- // Yanfly Engine Plugins - External Links
- // YEP_ExternalLinks.js
- //=============================================================================
- var Imported = Imported || {};
- Imported.YEP_ExternalLinks = true;
- var Yanfly = Yanfly || {};
- Yanfly.LINK = Yanfly.LINK || {};
- //=============================================================================
- /*:
- * @plugindesc v1.00 Link back to your home page through the title screen
- * and also be able to link your players from within the game.
- * @author Yanfly Engine Plugins
- *
- * @param Home Page URL
- * @desc Places a link to your website homepage at the title screen.
- * Leave this blank if you don't wish to enable this feature.
- * @default [url]https://www.google.com/[/url]
- *
- * @param Home Page Text
- * @desc This is how 'Home Page' will appear on the title screen.
- * @default Home Page
- *
- * @param Popup Blocker Notice
- * @desc This is a window to notify the player the link was blocked
- * by a pop-up blocker.
- * @default The link was blocked by a pop-up blocker.
- *
- * @help
- * ============================================================================
- * Introduction .
- * ============================================================================
- * This plugin allows you to place a "link" to your home page at the title
- * screen's command window towards the bottom. To adjust where the link goes,
- * change the Home Page URL in the plugin's parameters.
- *
- * ============================================================================
- * Plugin Commands
- * ============================================================================
- *
- * If you wish to send players to other links, you can use the following
- * plugin commands.
- *
- * Plugin Command
- * OpenNewTab [url]http://www.google.com/[/url] Opens link in a new tab.
- * OpenNewWindow [url]http://www.google.com/[/url] Opens link in a new window.
- *
- * Some web browsers may not differentiate these commands too much.
- */
- //=============================================================================
- //=============================================================================
- // Parameter Variables
- //=============================================================================
- Yanfly.Parameters = PluginManager.parameters('YEP_ExternalLinks');
- Yanfly.Param = Yanfly.Param || {};
- Yanfly.Param.HomePageUrl = String(Yanfly.Parameters['Home Page URL']);
- Yanfly.Param.HomePageText = String(Yanfly.Parameters['Home Page Text']);
- Yanfly.Param.PopupMessage = String(Yanfly.Parameters['Popup Blocker Notice']);
- //=============================================================================
- // SceneManager
- //=============================================================================
- SceneManager.openPopupBlockerMessage = function() {
- this._scene.openPopupBlockerMessage();
- };
- //=============================================================================
- // Game_Interpreter
- //=============================================================================
- Yanfly.LINK.Game_Interpreter_pluginCommand =
- Game_Interpreter.prototype.pluginCommand;
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
- Yanfly.LINK.Game_Interpreter_pluginCommand.call(this, command, args)
- if (command === 'OpenNewTab') this.openNewTab(args);
- if (command === 'OpenNewWindow') this.openNewWindow(args);
- };
- Game_Interpreter.prototype.openNewTab = function(args) {
- TouchInput.clear();
- Input.clear();
- var url = String(args[0]);
- var win = window.open(url, '_blank');
- if (win) {
- win.focus();
- } else {
- SceneManager.openPopupBlockerMessage();
- }
- };
- Game_Interpreter.prototype.openNewWindow = function(args) {
- TouchInput.clear();
- Input.clear();
- var url = String(args[0]);
- var win = window.open(url);
- if (win) {
- win.focus();
- } else {
- SceneManager.openPopupBlockerMessage();
- }
- };
- //=============================================================================
- // Window_TitleCommand
- //=============================================================================
- Yanfly.LINK.Window_TitleCommand_makeCommandList =
- Window_TitleCommand.prototype.makeCommandList;
- Window_TitleCommand.prototype.makeCommandList = function() {
- Yanfly.LINK.Window_TitleCommand_makeCommandList.call(this);
- this.addHomePageCommand();
- };
- Window_TitleCommand.prototype.addHomePageCommand = function() {
- if (Yanfly.Param.HomePageUrl.length <= 0) return;
- this.addCommand(Yanfly.Param.HomePageText, 'homePage');
- };
- //=============================================================================
- // Window_PopupBlocker
- //=============================================================================
- function Window_PopupBlocker() {
- this.initialize.apply(this, arguments);
- }
- Window_PopupBlocker.prototype = Object.create(Window_Base.prototype);
- Window_PopupBlocker.prototype.constructor = Window_PopupBlocker;
- Window_PopupBlocker.prototype.initialize = function() {
- var width = Graphics.boxWidth;
- var height = this.fittingHeight(1);
- Window_Base.prototype.initialize.call(this, 0, 0, width, height);
- this.resizeWindow();
- this.refresh();
- this.openness = 0;
- };
- Window_PopupBlocker.prototype.resizeWindow = function() {
- this.width = this.windowWidth();
- this.createContents();
- this.x = (Graphics.boxWidth - this.width) / 2;
- this.y = (Graphics.boxHeight - this.height) / 2;
- };
- Window_PopupBlocker.prototype.windowWidth = function() {
- return this.textWidth(Yanfly.Param.PopupMessage);
- };
- Window_PopupBlocker.prototype.refresh = function() {
- this.contents.clear();
- this.drawText(Yanfly.Param.PopupMessage, 0, 0, this.contents.width);
- };
- //=============================================================================
- // Scene_Base
- //=============================================================================
- Yanfly.LINK.Scene_Base_createWindowLayer =
- Scene_Base.prototype.createWindowLayer;
- Scene_Base.prototype.createWindowLayer = function() {
- Yanfly.LINK.Scene_Base_createWindowLayer.call(this);
- this.createPopupBlockerMessage();
- };
- Scene_Base.prototype.createPopupBlockerMessage = function() {
- this._popupBlockerWindow = new Window_PopupBlocker();
- this.addWindow(this._popupBlockerWindow);
- this._popupCounter = 0;
- };
- Yanfly.LINK.Scene_Base_update = Scene_Base.prototype.update;
- Scene_Base.prototype.update = function() {
- Yanfly.LINK.Scene_Base_update.call(this);
- this.updatePopupBlockerMessage();
- };
- Scene_Base.prototype.updatePopupBlockerMessage = function() {
- if (!this._popupBlockerWindow) return;
- if (this._popupBlockerWindow.isClosed()) return;
- if (--this._popupCounter > 0) return;
- this.closePopupBlockerMessage();
- };
- Scene_Base.prototype.openPopupBlockerMessage = function() {
- this._popupBlockerWindow.open();
- this._popupBlockerWindow.activate();
- this._popupCounter = 180;
- };
- Scene_Base.prototype.closePopupBlockerMessage = function() {
- if (!this._popupBlockerWindow) return;
- if (this._popupBlockerWindow.isClosed()) return;
- this._popupBlockerWindow.close();
- this._popupBlockerWindow.deactivate();
- };
- //=============================================================================
- // Scene_Base
- //=============================================================================
- Yanfly.LINK.Scene_Title_createCommandWindow =
- Scene_Title.prototype.createCommandWindow;
- Scene_Title.prototype.createCommandWindow = function() {
- Yanfly.LINK.Scene_Title_createCommandWindow.call(this);
- this._commandWindow.setHandler('homePage', this.commandHomePage.bind(this));
- };
- Scene_Title.prototype.commandHomePage = function() {
- TouchInput.clear();
- Input.clear();
- this._commandWindow.activate();
- var win = window.open(Yanfly.Param.HomePageUrl, '_blank');
- if (win) {
- win.focus();
- } else {
- SceneManager.openPopupBlockerMessage();
- }
- };
- //=============================================================================
- // End of File
- //=============================================================================
复制代码
这个是YEP_ExternalLinks 这个插件,为游戏插件超连接的,可是为什么添加后,在游戏开始标题上点击后会是空白?可是在游戏中却能打开网址?
这是插件脚本
在标题页面打开始空白
进入游戏时用插件脚本能打开
以上是插件代码。各位大神帮我看看是哪里的毛病? |
|