查看: 3180|回复: 0

[已经过期] BattleResultsPopup.js的改写

[复制链接]
梦石
0
星屑
85
在线时间
56 小时
注册时间
2011-4-6
回帖
14
发表于 2016-5-6 10:26:22 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 iusan 于 2016-5-10 16:11 编辑

官方自带脚本BattleResultsPopup.js会将战斗所得改成简洁明了的小框风格,但是却关闭了升级与学会技能的提醒。希望把这两项加进这个脚本里。
这里是脚本:
BattleResultsPopup.js//=============================================================================
// BattleResultsPopup.js
//=============================================================================

/*:
* @plugindesc 用一个战斗结果结算窗口来替代系统默认的文本战斗结果显示。
* @author Yoji Ojima
*
* @help 可用于学习自定义新的Window类,创建自定义窗口,使用战斗管理器
* (BattleManager),修改游戏角色处理机制以及场景管理。
*
* 此外将会学习到以上所有内容的链接和交互。
*/

(function() {

    var resultDisplaying = 0;

    var _BattleManager_initMembers = BattleManager.initMembers;
    BattleManager.initMembers = function() {
        _BattleManager_initMembers.call(this);
        resultDisplaying = 0;
    };

    var _BattleManager_update = BattleManager.update;
    BattleManager.update = function() {
        _BattleManager_update.call(this);
        if (resultDisplaying > 0) {
            if (++resultDisplaying >= 60) {
                if (Input.isTriggered('ok') || TouchInput.isTriggered()) {
                    resultDisplaying = 0;
                }
            }
        }
    };

    var _BattleManager_isBusy = BattleManager.isBusy;
    BattleManager.isBusy = function() {
        return _BattleManager_isBusy.call(this) || resultDisplaying > 0;
    };

    BattleManager.displayVictoryMessage = function() {
    };

    BattleManager.displayRewards = function() {
        resultDisplaying = 1;
    };

    Game_Actor.prototype.shouldDisplayLevelUp = function() {
        return false;
    };

    var _Scene_Battle_update = Scene_Battle.prototype.update;
    Scene_Battle.prototype.update = function() {
        _Scene_Battle_update.call(this);
        if (resultDisplaying > 30 && !this._resultWindow) {
            this._resultWindow = new Window_BattleResults();
            this.addWindow(this._resultWindow);
        }
    };

    var _Scene_Battle_stop = Scene_Battle.prototype.stop;
    Scene_Battle.prototype.stop = function() {
        _Scene_Battle_stop.call(this);
        if (this._resultWindow) {
            this._resultWindow.close();
        }
    };

    function Window_BattleResults() {
        this.initialize.apply(this, arguments);
    }

    Window_BattleResults.prototype = Object.create(Window_Base.prototype);
    Window_BattleResults.prototype.constructor = Window_BattleResults;

    Window_BattleResults.prototype.initialize = function() {
        var rewards = BattleManager._rewards;
        var width = 400;
        var height = this.fittingHeight(Math.min(9, rewards.items.length + 1));
        var statusHeight = this.fittingHeight(4);
        var x = (Graphics.boxWidth - width) / 2;
        var y = (Graphics.boxHeight - statusHeight - height) / 2;
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this.refresh();
        this.openness = 0;
        this.open();
    };

    Window_BattleResults.prototype.refresh = function() {
        var x = this.textPadding();
        var y = 0;
        var width = this.contents.width;
        var lineHeight = this.lineHeight();
        var rewards = BattleManager._rewards;
        var items = rewards.items;
        this.contents.clear();

        this.resetTextColor();
        this.drawText(rewards.exp, x, y);
        x += this.textWidth(rewards.exp) + 6;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.expA, x, y);
        x += this.textWidth(TextManager.expA + '  ');

        this.resetTextColor();
        this.drawText(rewards.gold, x, y);
        x += this.textWidth(rewards.gold) + 6;
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.currencyUnit, x, y);

        x = 0;
        y += lineHeight;

        items.forEach(function(item) {
            this.drawItemName(item, x, y, width);
            y += lineHeight;
        }, this);
    };

})();


试过粗暴地把
Game_Actor.prototype.shouldDisplayLevelUp = function() {
        return false;
改成return true,但是这样战斗结果就分了两个框显示,一个显示脚本结果,一个显示原始版升级提示。
要怎样才能在脚本效果里加上类似:
主角A 等级2→3 +火球术
这样的提示?

--------

没有人吗?再次尝试在脚本最后加入了几行,希望至少把升级提示做出来:
var _Game_Actor_levelUp_message = Game_Actor.prototype.levelUp;
        Game_Actor.prototype.levelUp = function() {
          _Game_Actor_levelUp_message.call(this);
                   this.drawActorName(actor, x, y);
                   this.drawText(actor.level, x, y);
                   };
然而战斗结果依然跳掉升级提示。求大神指点……
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部