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

[转载发布] 对话框跟随角色 =-= 改进中(已适配 YEP_MessageCore )

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

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10465
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13215

    灌水之王

    发表于 2024-2-13 14:54:17 | 显示全部楼层 |阅读模式
    不支持1.3版本,不支持1.3版本,奇怪的bug,请勿使用!







    代码下载地址:http://pan.baidu.com/s/1pJVMRl5

    不知道是不是大家都选择使用YEP_messageCore,现出一个针对它的优化版本,具体请看注释。[code]//=============================================================================
    //fuki.js
    //=============================================================================
    /**
    * @Author:      Garfeng Gu
    * @Email:       [email protected]
    * @CreateTime:  2015-12-12 21:44:12
    * @LastModified:2015-12-16 20:18:19

    * @Description: 呼出对话框 for RPG Maker MV
    *               在使用时,添加[文本显示],填写\fuki[eventId]正文内容,即可在游
    *               戏里将对话框定位到相应角色上方,eventId设为0时,对应主角。
    *               如:\fuki[1]你好,阿尔西斯。
    *               强烈推荐使用下方页面的自动换行脚本:
    *               https://rpg.blue/thread-386230-1-1.html
    *               本代码已适配YEP_Message,使用方法请参考下方对应函数处的注释。

    * @License:     No part of this source code could be used for commercial/business
    *               purpose without the express written permission of Garfeng Gu.
    */



    /*没有使用YEP_MessageCore则删掉本行
    //没有使用YEP_MessageCore的童鞋请将这一段的注释删掉
    Window_Message.prototype.startMessage = function()
    {
        this._textState = {};
        this._textState.index = 0;
        var text = this.convertEscapeCharacters($gameMessage.allText());
        text = this.getFukiId(text);
        this._textState.text = text;
        this.newPage(this._textState);
        this.updatePlacement();
        this.updateBackground();
        this.open();
    }
    没有使用YEP_MessageCore则删掉本行*/

    /*
    //使用了YEP_MessageCore的童鞋请把YEP_MessageCore里的
    //Window_Message.prototype.adjustWindowSettings
    //和Window_Message.prototype.convertEscapeCharacters做如下修改。
    Window_Message.prototype.adjustWindowSettings = function() {
        if(this.setfuki == undefined || this.setfuki == 0){ //Add by Garfeng Gu
            this.width = this.windowWidth();
            this.height = Math.min(this.windowHeight(), Graphics.boxHeight);
            if (Math.abs(Graphics.boxHeight - this.height) < this.lineHeight()) {
                this.height = Graphics.boxHeight;
            }
            this.createContents();
            this.x = (Graphics.boxWidth - this.width) / 2;
        }//Add by Garfeng Gu
    };

    Window_Message.prototype.convertEscapeCharacters = function(text) {
        text = Window_Base.prototype.convertEscapeCharacters.call(this, text);
        text = this.getFukiId(text);//Add by Garfeng Gu
        text = this.convertNameBox(text);
        text = this.convertMessageCharacters(text);
        return text;
    };
    */

    Window_Message.prototype.updatePlacement = function() {
        if(this.setfuki == undefined || this.setfuki==0){
        this._positionType = $gameMessage.positionType();
        this.y = this._positionType * (Graphics.boxHeight - this.height) / 2;
        this._goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - this._goldWindow.height;
    }
    };

    Window_Message.prototype.getFukiId = function(text)
    {
        //fuki
        var eventid = -1;
        text = text.replace(/\x1bFUKI\[(\d+)\]/gi,function(){
            eventid = arguments[1];
            return "";
        });
        if(eventid>=0){
            this.fukiPalcement(eventid);
        }
        else
        {
            this.setfuki = 0;
        }

        return text;
    };


    Window_Message.prototype.fukiPalcement = function (eventid)
    {

            var idx,idy;
            if(eventid!=0){
                idx = $gameMap._events[eventid]._x;
                idy = $gameMap._events[eventid]._y;
            }
            else
            {
                idx = $gamePlayer._x;
                idy = $gamePlayer._y;
            }



            idx = $gameMap.adjustX(idx);
            idy = $gameMap.adjustY(idy);

            var width = this.windowWidth()/2;
            var height = this.windowHeight();
            var x = idx*48 + 24 - width/2;//
            var y = idy*48 - 24 - height;


            if(x+width>Graphics.boxWidth) x = (Graphics.boxWidth - width);
            else if(xGraphics.boxHeight) y = Graphics.boxHeight - height;

            else if(y
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-10 16:10 , Processed in 0.138624 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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