扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 151|回复: 0

[转载发布] 帮我看下这个插连接插件是怎么会事。YEP.21 – External Links

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10470
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13220

    灌水之王

    发表于 2024-2-24 16:11:09 | 显示全部楼层 |阅读模式
    JAVASCRIPT 代码下载
    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.closePopupBlockerMessage();
    109. };
    110. Scene_Base.prototype.openPopupBlockerMessage = function(){
    111.                 this._popupBlockerWindow.open();
    112.                 this._popupBlockerWindow.activate();
    113.                 this._popupCounter = 180;
    114. };
    115. Scene_Base.prototype.closePopupBlockerMessage = function(){
    116.                 if(!this._popupBlockerWindow)return;
    117.                 if(this._popupBlockerWindow.isClosed())return;
    118.                 this._popupBlockerWindow.close();
    119.                 this._popupBlockerWindow.deactivate();
    120. };
    121. //=============================================================================
    122. // Scene_Base
    123. //=============================================================================
    124. Yanfly.LINK.Scene_Title_createCommandWindow =
    125.                 Scene_Title.prototype.createCommandWindow;
    126. Scene_Title.prototype.createCommandWindow = function(){
    127.     Yanfly.LINK.Scene_Title_createCommandWindow.call(this);
    128.                 this._commandWindow.setHandler('homePage', this.commandHomePage.bind(this));
    129. };
    130. Scene_Title.prototype.commandHomePage = function(){
    131.         TouchInput.clear();
    132.         Input.clear();
    133.         this._commandWindow.activate();
    134.         var win = window.open(Yanfly.Param.HomePageUrl, '_blank');
    135.         if(win){
    136.                 win.focus();
    137.         }else{
    138.                 SceneManager.openPopupBlockerMessage();
    139.         }
    140. };
    141. //=============================================================================
    142. // End of File
    143. //=============================================================================
    复制代码





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




    以上是插件代码。各位大神帮我看看是哪里的毛病?
                 本帖来自P1论坛作者yangdanfeng,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=400267  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-3-10 19:46 , Processed in 0.132522 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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