查看: 1639|回复: 4

[有事请教] MV显示简单消息插件适配MZ 求助

[复制链接]
梦石
0
星屑
613
在线时间
161 小时
注册时间
2020-10-11
回帖
30
发表于 2022-3-5 12:19:09 | 显示全部楼层 |阅读模式
悬赏300星屑已解决
本帖最后由 慕名景色 于 2022-3-7 03:48 编辑

找到一个简单的消息提醒插件,但是MZ使用会报错

因为插件比较符合我的需求,
相关代码应该比较简单,但是本人水平有限。
所以想悬赏求个高手帮忙适配一下该插件,万分感谢。




MV运行效果
Z}JGNX50@)(0~DD8Y7A1WH0.png
P3LMFB635_J5R}QFO3YLUJS.png

MZ报错情况

AE~{H[]4[`}A$%XT_63FZ@V.png

FCOP]}1~NV{WMVFZ%7{LONE.png


[pre lang="js" file="Ticker.js"]/*---------------------------------------------------------------------------*
* 2019/03/06 kido0617
* http://kido0617.github.io/
*---------------------------------------------------------------------------*/

/*:
* @plugindesc ティッカープラグイン
* @author kido0617
* @help
*   这是一个显示简单消息的插件。
*   使用方法:
*   TickerManager.show('\\I[5]あいうえお');
*   
*   ・如果变量是正的,它会自动加上+。
*   TickerManager.show('\\V[5]');
*
*   ・ 如果您不想添加+,请指定false,如下所示
*   TickerManager.show('\\V[5]', false);
*
*   ・想全部消除的情况请如下所示
*   TickerManager.hideAll();
*
*   ・道具·武器·防具的记事栏
*   <ticker:あいうえお> : 作为项目的说明在获取/消失时显示。如果没有,则显示项目描述的第一行
*   
*   ・清除日志
*    TickerManager.clearAllLog();
*
*   ・清除1个旧日志
*    TickerManager.clearOldestLog();
*
*
* @param Opacity
* @desc 背景の透明度(0 - 255)
* @type number
* @min 0
* @max 255
* @default 127
*
* @param DisplayDuration
* @desc 表示時間[frame]
* @type number
* @default 180
*
* @param ToggleDuration
* @desc 显示和擦除的时间[frame]
* @type number
* @default 30
*
* @param y位置
* @desc 如果输入y位置偏移(Pixel)10,则偏移10像素。
* @type number
* @default 0
*
* @param x位置
* @desc 如果输入x位置偏移(Pixel)10,则偏移10像素。
* @type number
* @default 0
*
* @param 幻灯片动画开始位置
* @desc 从左边滑动到什么像素的位置?
* @type number
* @default 100
*
* @param 幻灯片动画结束位置
* @desc 从左边向几个像素的位置滑动
* @type number
* @default 0
*
* @param y位置合わせスピード
* @desc 当有两个或更多个时,当第一个消失时调整y位置时的动画速度[pixel/frame]
* @type number
* @default 5
*
* @param 上か下か
* @desc 在屏幕上显示还是在下面显示
* @default 上
* @type select
* @option 上
* @option 下
*
* @param ティッカー高さ
* @desc 代码的高度
* @type number
* @default 36
*
* @param フォントサイズ
* @desc 字体大小
* @type number
* @default 28
*
* @param アイコンサイズ
* @desc 图标大小
* @type number
* @default 32
*
* @param 背景画像
* @desc 背景画像
* @default
* @type file
* @dir img/pictures/
*
* @param 最大表示個数
* @desc 可以显示的个数。过了之后,旧的就消失了。
* @type number
* @min 1
* @max 100
* @default 10
*
* @param 日志功能 ON 开关
* @desc 它是一个开关,当它打开时作为日志保留而不删除。
* @type switch
* @default 0
*
* @param イージング
* @desc 更改幻灯片动画的缓动
* @default easeOutSine
* @type select
* @option linear
* @option swingFromTo
* @option swingFrom
* @option swingTo
* @option easeFromTo
* @option easeFrom
* @option easeTo
* @option easeInQuad
* @option easeOutQuad
* @option easeInOutQuad
* @option easeInCubic
* @option easeOutCubic
* @option easeInOutCubic
* @option easeInQuart
* @option easeOutQuart
* @option easeInOutQuart
* @option easeInQuint
* @option easeOutQuint
* @option easeInOutQuint
* @option easeInSine
* @option easeOutSine
* @option easeInOutSine
* @option easeInExpo
* @option easeOutExpo
* @option easeInOutExpo
* @option easeInCirc
* @option easeOutCirc
* @option easeInOutCirc
* @option easeOutBounce
* @option easeInBack
* @option easeOutBack
* @option easeInOutBack
* @option bounce
* @option bouncePast
* @option elastic
*
* @param 状态自动显示开关
* @desc 当此处指定的开关为 ON 时,状态改变时自动显示代码。
* @type switch
* @default 0
*
* @param 物品/金钱自动显示开关
* @desc 当此处指定的开关为 ON 时,当物品、武器和盔甲以及金钱增加/减少时自动显示代码。
* @type switch
* @default 0
*
* @param 消失時にティッカーを表示
* @desc 物品、武器、盔甲和金币消失时是否显示窗口
* @type boolean
* @default true
*
* @param アイテム・武器防具入手時テキスト
* @desc 这是您获得物品/武器/盔甲时的文字。
* %1图标、%2物品名称、%3が個数、%4が説明に変わります。
* 可以使用消息窗口的控制命令。
* @default %1 %2 x %3 GET %4
*
* @param アイテム・武器防具消失時テキスト
* @desc 物品·武器防具消失时显示的文本。
* %1图标、%2物品名称、%3が個数、%4が説明に変わります。
* 可以使用消息窗口的控制命令。
* @default %1 %2 x %3 消失 %4
*
* @param お金入手時テキスト
* @desc お金を入手したときのテキストです
* %1图标、%2が金額、%3が通貨単位に変わります。
* 可以使用消息窗口的控制命令。
* @default %1 %2%3入手!
*
* @param お金消失時テキスト
* @desc お金をなくしたしたときのテキストです
* %1图标、%2が金額、%3が通貨単位に変わります。
* 可以使用消息窗口的控制命令。
* @default %1 %2%3消失!
*
* @param お金アイコン
* @desc 得失金币的图标
* @default 1
* @type number
*
*
* @param アイテム・武器・防具入手時SE
* @desc アイテム・武器・防具入手時SE
* @type struct<seSetting>
*
* @param アイテム・武器・防具消失時SE
* @desc アイテム・武器・防具消失時SE
* @type struct<seSetting>
*
* @param お金入手時SE
* @desc お金入手時SE
* @type struct<seSetting>
*
* @param お金消失時SE
* @desc お金消失時SE
* @type struct<seSetting>
*
*/

/*~struct~seSetting:
*
* @param name
* @desc ファイル名
* @default
* @dir audio/se/
* @type file
*
* @param volume
* @desc ボリューム
* @default 90
* @type number
*
* @param pitch
* @desc ピッチ
* @default 100
* @type number
*
* @param pan
* @desc パン
* @default 0
* @type number
*/


(function () {

  const parameters = PluginManager.parameters('Ticker');
  let defaultTickerSetting = {
    maxDisplay: Number(parameters['最大表示個数'] || 10),
    backgroundOpacity: Number(parameters['Opacity'] || 127),
    displayDuration: Number(parameters['DisplayDuration'] || 3 * 60),
    toggleDuration: Number(parameters['ToggleDuration'] || 30),
    xPosition: Number(parameters['x位置'] || 0),
    yPosition: Number(parameters['y位置'] || 0),
    fixYSpeed: Number(parameters['y位置合わせスピード'] || 100),
    slideFromX: Number(parameters['スライドアニメーション開始位置'] || 0),
    slideToX: Number(parameters['スライドアニメーション終了位置'] || 0),
    height: Number(parameters['ティッカー高さ']),
    fontSize: Number(parameters['フォントサイズ']),
    iconSize: Number(parameters['アイコンサイズ']),
    backgroundImg: parameters['背景画像'],
    isBaseTop: parameters['上か下か'] == '上',
    easingType: parameters['イージング'],
    logOnSwitch: Number(parameters['ログ機能ONスイッチ']),
    stateAutoEnableSWId: Number(parameters['ステート自動表示スイッチ']),
    autoSetting: {
      enableSWId: Number(parameters['アイテム・お金自動表示スイッチ']),
      enableLose: parameters['消失時にティッカーを表示'] == 'true',
      getItemText: parameters['アイテム・武器防具入手時テキスト'],
      loseItemText: parameters['アイテム・武器防具消失時テキスト'],
      getGoldText: parameters['お金入手時テキスト'],
      loseGoldText: parameters['お金消失時テキスト'],
      goldIcon: parameters['お金アイコン'],
      getItemSE: parseSE(parameters['アイテム・武器・防具入手時SE']),
      getGoldSE: parseSE(parameters['お金入手時SE']),
      loseItemSE: parseSE(parameters['アイテム・武器・防具消失時SE']),
      loseGoldSE: parseSE(parameters['お金消失時SE']),
    }
  };

  const gameSystemInitialize = Game_System.prototype.initialize;
  Game_System.prototype.initialize = function () {
    //ゲーム内からパラメータを変更したいのでセーブデータに含める
    gameSystemInitialize.call(this);
    this.setDefaultTickerSetting();
    this.tickerLogs = [];
  };

  Game_System.prototype.setDefaultTickerSetting = function () {
    this.ticker = JsonEx.makeDeepCopy(defaultTickerSetting);
  };

  function parseSE(se) {
    try {
      se = JSON.parse(se);
    } catch (e) {
      return null;
    }
    if (!se || !se.name) return null;
    se.pitch = Number(se.pitch);
    se.volume = Number(se.volume);
    se.pan = Number(se.pan);
    return se;
  }

  window.TickerManager = function () { };

  //パラメータをデフォルトに戻したいケースのため保持
  TickerManager.param = defaultTickerSetting;

  TickerManager.createTickerContainer = function () {
    //通常ティッカー用のコンテナ
    if (!SceneManager._scene._tickerContainer) {
      let tc = new TickerContainer(false);
      SceneManager._scene._tickerContainer = tc;
      SceneManager._scene.addChild(tc);
    }
    //ログティッカー表示用のコンテナ
    if (!SceneManager._scene._tickerLogContainer) {
      let tc = new TickerContainer(true);
      SceneManager._scene._tickerLogContainer = tc;
      SceneManager._scene.addChild(tc);
    }
  };

  TickerManager.show = function (text, needPlus = true) {
    this.createTickerContainer();
    if (this.isLogContainerEnable()) SceneManager._scene._tickerLogContainer.show(text, needPlus);
    else SceneManager._scene._tickerContainer.show(text, needPlus);
  };

  TickerManager.hideAll = function () {
    if (SceneManager._scene._tickerContainer) {
      SceneManager._scene._tickerContainer.hideAll();
    }
  };

  TickerManager.isLogContainerEnable = function () {
    return this.isLogOn() && (SceneManager._scene.constructor == Scene_Map || SceneManager._scene.constructor == Scene_Battle);
  };

  TickerManager.isLogOn = function () {
    return $gameSwitches.value($gameSystem.ticker.logOnSwitch);
  };

  TickerManager.isAutoDisplayEnabled = function () {
    return $gameSystem.ticker.autoSetting.enableSWId > 0 && $gameSwitches.value($gameSystem.ticker.autoSetting.enableSWId);
  };

  TickerManager.clearAllLog = function () {
    if (!$gameParty.inBattle()) $gameSystem.tickerLogs = [];

    if (SceneManager._scene._tickerLogContainer) {
      if ($gameParty.inBattle()) SceneManager._scene._tickerLogContainer.instantLog = [];
      SceneManager._scene._tickerLogContainer.hideAll();
    }
  };

  TickerManager.clearOldestLog = function () {
    if (!$gameParty.inBattle()) $gameSystem.tickerLogs.shift();
    if (SceneManager._scene._tickerLogContainer) {
      if ($gameParty.inBattle()) SceneManager._scene._tickerLogContainer.instantLog.shift();
      SceneManager._scene._tickerLogContainer.hideOldest();
    }
  };

  var createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
  Scene_Map.prototype.createDisplayObjects = function () {
    createDisplayObjects.call(this);
    //メニューから戻ったり、ロードしたりしたときにログ用のティッカーを復元する
    if ($gameSystem.tickerLogs.length > 0) {
      TickerManager.createTickerContainer();
      $gameSystem.tickerLogs.forEach((log) => {
        SceneManager._scene._tickerLogContainer.showFromLog(log);
      });
      SceneManager._scene._tickerLogContainer.alpha = TickerManager.isLogOn() ? 1 : 0;
    }
  };

  function TickerContainer(isLogMode) {
    PIXI.Container.call(this);
    this.isLogMode = isLogMode;
    this.instantLog = [];  //そのシーンだけのログ
  }

  TickerContainer.prototype = Object.create(PIXI.Container.prototype);
  TickerContainer.prototype.constructor = TickerContainer;

  TickerContainer.prototype.update = function () {
    this.displayFade();
    for (var i = 0; i < this.children.length; i++) {
      this.children.update();
      if (this.children.tickerState == 'end') {
        this.removeChildAt(i);
        this.adjustY();
        i--;
      }
    }
  };

  TickerContainer.prototype.displayFade = function () {
    //ログと通常の切替時にフェード入れる
    const duration = 0.1;
    var direction = 1;
    var logEnabled = TickerManager.isLogContainerEnable();
    if (this.isLogMode && !logEnabled) direction = -1;
    else if (!this.isLogMode && logEnabled) direction = -1;
    this.alpha = (this.alpha + direction * duration).clamp(0, 1);
  };

  TickerContainer.prototype.show = function (text, needPlus) {
    var ticker = this.makeTicker(text, needPlus);
    if (this.isLogMode) {
      //ログモードのとき画面切り替えやセーブに対応するため変換後のテキストを保存する。変換後でないと変数の値が変わる可能性がある
      var logs = $gameParty.inBattle() ? this.instantLog : $gameSystem.tickerLogs;
      logs.push(ticker.getCovertedText());
      if (logs.length > $gameSystem.ticker.maxDisplay) {
        logs.shift();
      }
    }
    if (this.countDisplay() > $gameSystem.ticker.maxDisplay) this.hideOldest();
  };

  TickerContainer.prototype.showFromLog = function (text, needPlus) {
    //ログを復帰するとき。表示アニメーションを飛ばして最初から表示にしたい
    var ticker = this.makeTicker(text, needPlus);
    ticker.setDisplayMode();
  };

  TickerContainer.prototype.makeTicker = function (text, needPlus) {
    var ticker = new Ticker(text, needPlus, this.isLogMode);
    ticker.setY(this.children.length);
    this.addChild(ticker);
    return ticker;
  };

  TickerContainer.prototype.adjustY = function () {
    //y位置直し
    for (var i = 0; i < this.children.length; i++) {
      this.children.setToY(i);
    }
  };

  TickerContainer.prototype.hideOldest = function () {
    for (var i = 0; i < this.children.length; i++) {
      if (this.children.isShowState()) {
        this.children.hide();
        return;
      }
    }
  };

  TickerContainer.prototype.countDisplay = function () {
    return this.children.filter((child) => child.isShowState()).length;
  };

  TickerContainer.prototype.hideAll = function () {
    for (var i = 0; i < this.children.length; i++)this.children.hide();
  };

  function Ticker() {
    this.frameCount = 0;
    this.tickerState = 'showing';
    this.initialize.apply(this, arguments);
  }

  Ticker.prototype = Object.create(PIXI.Container.prototype);
  Ticker.prototype.constructor = Ticker;

  Ticker.prototype.initialize = function (text, addPlus, isLogMode) {
    PIXI.Container.call(this);
    this.x = $gameSystem.ticker.xPosition;
    this.width = Graphics.width;
    this.height = $gameSystem.ticker.height;
    this.text = text;
    this.isLogMode = isLogMode;
    this.createBackground();
    this.contents = new Window_Ticker(text, $gameSystem.ticker.slideFromX, 0, this._width, this._height, addPlus);
    this.addChild(this.contents);
  };

  Ticker.prototype.setY = function (index) {
    this.y = $gameSystem.ticker.isBaseTop ? this.height * index + $gameSystem.ticker.yPosition : Graphics.height - this.height * (index + 1) - $gameSystem.ticker.yPosition;
  };

  Ticker.prototype.setToY = function (index) {
    this.toY = $gameSystem.ticker.isBaseTop ? this.height * index + $gameSystem.ticker.yPosition : Graphics.height - this.height * (index + 1) - $gameSystem.ticker.yPosition;
  };

  Ticker.prototype.createBackground = function () {
    this._backSprite = new Sprite();
    if ($gameSystem.ticker.backgroundImg) {
      this._backSprite.bitmap = ImageManager.loadPicture($gameSystem.ticker.backgroundImg);
    } else {
      this._backSprite.bitmap = new Bitmap(this._width, this._height);
      this._backSprite.bitmap.fillAll('rgba(0, 0, 0, 1)');
    }
    this._backSprite.opacity = 0;
    this.addChild(this._backSprite);
  };

  Ticker.prototype.hide = function () {
    if (!this.isShowState()) return;
    this.tickerState = 'hiding';
    this.frameCount = 0;
  };

  Ticker.prototype.isShowState = function () {
    return this.tickerState == 'showing' || this.tickerState == 'display';
  };

  Ticker.prototype.setDisplayMode = function () {
    //アニメなしで表示する(ログのとき画面切り替えしたときとかのため)
    this._backSprite.opacity = $gameSystem.ticker.backgroundOpacity;
    this.contents.contentsOpacity = 255;
    this.contents.x = $gameSystem.ticker.slideToX;
    this.tickerState = 'display';
  };

  Ticker.prototype.getCovertedText = function () {
    return this.contents.convertEscapeCharacters(this.text);
  };

  Ticker.prototype.update = function () {
    this.children.forEach(function (child) {
      child.update();
    });
    this.frameCount++;
    if (this.toY != null && this.y != this.toY) {
      if (this.y > this.toY) {
        this.y -= $gameSystem.ticker.fixYSpeed;
        if (this.y < this.toY) this.y = this.toY;
      } else {
        this.y += $gameSystem.ticker.fixYSpeed;
        if (this.y > this.toY) this.y = this.toY;
      }

    }
    switch (this.tickerState) {
      case 'showing':
        var rate = easing[$gameSystem.ticker.easingType](this.frameCount / $gameSystem.ticker.toggleDuration);
        this._backSprite.opacity = rate * $gameSystem.ticker.backgroundOpacity;
        this.contents.contentsOpacity = rate * 255;
        this.contents.x = $gameSystem.ticker.slideToX + (1 - rate) * $gameSystem.ticker.slideFromX;
        if (this.frameCount == $gameSystem.ticker.toggleDuration) {
          this.tickerState = 'display';
          this.frameCount = 0;
        }
        break;
      case 'display':
        if (this.frameCount == $gameSystem.ticker.displayDuration) {
          if (this.isLogMode) {
            //ログ表示中は消去にいかない
            return;
          }
          this.tickerState = 'hiding';
          this.frameCount = 0;
        }
        break;
      case 'hiding':
        this._backSprite.opacity = (1 - this.frameCount / $gameSystem.ticker.toggleDuration) * $gameSystem.ticker.backgroundOpacity;
        this.contents.contentsOpacity = (1 - this.frameCount / $gameSystem.ticker.toggleDuration) * 255;
        if (this.frameCount == $gameSystem.ticker.toggleDuration) {
          this.tickerState = 'end';
        }
        break;
    }

  };


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

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

  Window_Ticker.prototype.initialize = function (text, x, y, width, height, addPlus) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this.opacity = 0;
    this.contentsOpacity = 0;
    this.addPlus = addPlus;
    this.drawTextEx(text, 0, height / 2 - this.standardFontSize() / 2 - 4);
  };

  Window_Ticker.prototype.lineHeight = function () {
    return $gameSystem.ticker.fontSize + 8;
  };

  Window_Ticker.prototype.standardPadding = function () {
    return 0;
  };

  Window_Ticker.prototype.standardFontSize = function () {
    return $gameSystem.ticker.fontSize;
  };

  //変数にプラス記号をつけるため
  Window_Ticker.prototype.convertEscapeCharacters = function (text) {
    text = text.replace(/\\/g, '\x1b');
    text = text.replace(/\x1b\x1b/g, '\\');
    text = text.replace(/\x1bV\[(\d+)\]/gi, function () {
      var v = $gameVariables.value(parseInt(arguments[1]));
      return (v > 0 && this.addPlus ? '+' : '') + v;
    }.bind(this));
    text = text.replace(/\x1bV\[\+*(\d+)\]/gi, function () {
      var v = $gameVariables.value(parseInt(arguments[1]));
      return (v > 0 && this.addPlus ? '+' : '') + v;
    }.bind(this));
    text = text.replace(/\x1bN\[(\d+)\]/gi, function () {
      return this.actorName(parseInt(arguments[1]));
    }.bind(this));
    text = text.replace(/\x1bP\[(\d+)\]/gi, function () {
      return this.partyMemberName(parseInt(arguments[1]));
    }.bind(this));
    text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
    return text;
  };

  Window_Ticker.prototype.processDrawIcon = function(iconIndex, textState) {
    var size = this.getIconSize();
    var y = ($gameSystem.ticker.height - size) / 2;
    this.drawIcon(iconIndex, textState.x + 2, y);
    textState.x += size + 4;
  };

  Window_Ticker.prototype.drawIcon = function(iconIndex, x, y) {
    var bitmap = ImageManager.loadSystem('IconSet');
    var pw = Window_Base._iconWidth;
    var ph = Window_Base._iconHeight;
    var sx = iconIndex % 16 * pw;
    var sy = Math.floor(iconIndex / 16) * ph;
    var size = this.getIconSize();
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y, size, size);
  };

  Window_Ticker.prototype.getIconSize = function() {
    return $gameSystem.ticker.iconSize ? $gameSystem.ticker.iconSize : Window_Base._iconWidth;
  };

  //自動表示-----------------------------------------------------------------

  function formatTickerText(text, strs) {
    text = text.replace('%1', '\\I[' + strs[0] + ']');
    for (var i = 1; i <= strs.length; i++) {
      text = text.replace('%' + (i + 1), strs);
    }
    return text;
  }

  function GetItemDescription(item) {
    if (item.meta.ticker) {
      return item.meta.ticker;
    }
    return item.description.replace(/[\r\n]+.*/m, '');
  }

  function showAutoTicker(getText, loseText, getSE, loseSE, strs, value) {
    let format = '';
    let se;
    if (value > 0) {
      format = getText;
      se = getSE;
    } else if ($gameSystem.ticker.autoSetting.enableLose && value < 0) {
      format = loseText;
      se = loseSE;
    }
    if (format) {
      let formated = formatTickerText(format, strs);
      TickerManager.show(formated);
      if (se) {
        AudioManager.playSe(se);
      }
    }
  }

  // Change Gold
  const command125 = Game_Interpreter.prototype.command125;
  Game_Interpreter.prototype.command125 = function () {
    command125.call(this);
    if (TickerManager.isAutoDisplayEnabled()) {
      let value = this.operateValue(this._params[0], this._params[1], this._params[2]);
      showAutoTicker($gameSystem.ticker.autoSetting.getGoldText, $gameSystem.ticker.autoSetting.loseGoldText,
        $gameSystem.ticker.autoSetting.getGoldSE, $gameSystem.ticker.autoSetting.loseGoldSE,
        [$gameSystem.ticker.autoSetting.goldIcon, Math.abs(value), $dataSystem.currencyUnit], value);
    }
    return true;
  };

  // Change Items
  const command126 = Game_Interpreter.prototype.command126;
  Game_Interpreter.prototype.command126 = function () {
    command126.call(this);
    if (TickerManager.isAutoDisplayEnabled()) {
      let value = this.operateValue(this._params[1], this._params[2], this._params[3]);
      let item = $dataItems[this._params[0]];
      showAutoTicker($gameSystem.ticker.autoSetting.getItemText, $gameSystem.ticker.autoSetting.loseItemText,
        $gameSystem.ticker.autoSetting.getItemSE, $gameSystem.ticker.autoSetting.loseItemSE,
        [item.iconIndex, item.name, Math.abs(value), GetItemDescription(item)], value);
    }
    return true;
  };


  // Change Weapons
  const command127 = Game_Interpreter.prototype.command127;
  Game_Interpreter.prototype.command127 = function () {
    command127.call(this);
    if (TickerManager.isAutoDisplayEnabled()) {
      let value = this.operateValue(this._params[1], this._params[2], this._params[3]);
      let item = $dataWeapons[this._params[0]];
      showAutoTicker($gameSystem.ticker.autoSetting.getItemText, $gameSystem.ticker.autoSetting.loseItemText,
        $gameSystem.ticker.autoSetting.getItemSE, $gameSystem.ticker.autoSetting.loseItemSE,
        [item.iconIndex, item.name, Math.abs(value), GetItemDescription(item)], value);
    }
    return true;
  };

  // Change Armors
  const command128 = Game_Interpreter.prototype.command128;
  Game_Interpreter.prototype.command128 = function () {
    command128.call(this);
    if (TickerManager.isAutoDisplayEnabled()) {
      let value = this.operateValue(this._params[1], this._params[2], this._params[3]);
      let item = $dataArmors[this._params[0]];
      showAutoTicker($gameSystem.ticker.autoSetting.getItemText, $gameSystem.ticker.autoSetting.loseItemText,
        $gameSystem.ticker.autoSetting.getItemSE, $gameSystem.ticker.autoSetting.loseItemSE,
        [item.iconIndex, item.name, Math.abs(value), GetItemDescription(item)], value);
    }
    return true;
  };

  //ステート変化時の自動表示------------------------------------------------------

  function NeedStateChangeDisplay(){
    if($gameSystem.ticker.stateAutoEnableSWId != 0 && !$gameSwitches.value($gameSystem.ticker.stateAutoEnableSWId)) return false;

    return  !(SceneManager._scene instanceof Scene_Battle) ||
     ($gameTroop && $gameTroop.isEventRunning());
  }

  const _gameBattlerBaseAddNewState = Game_BattlerBase.prototype.addNewState;
  Game_BattlerBase.prototype.addNewState = function(stateId) {
    if(NeedStateChangeDisplay() && this._states && !this._states.contains(stateId)){
      let state = $dataStates[stateId];
      if(state.message1) TickerManager.show(this._name + state.message1);
    }
    _gameBattlerBaseAddNewState.apply(this, arguments);
  };

  const _gameBattlerBaseEraseState = Game_BattlerBase.prototype.eraseState;
  Game_BattlerBase.prototype.eraseState = function(stateId) {
    if(NeedStateChangeDisplay() && this._states && this._states.contains(stateId)){
      let state = $dataStates[stateId];
      if(state.message4) TickerManager.show(this._name + state.message4);
    }
    _gameBattlerBaseEraseState.apply(this, arguments);
  };

  const _gameBattlerBaseClearStates = Game_BattlerBase.prototype.clearStates;
  Game_BattlerBase.prototype.clearStates = function() {
    if(NeedStateChangeDisplay() && this._states){
      this._states.forEach(function(stateId) {
        let state = $dataStates[stateId];
        if(state.message4) TickerManager.show(this._name + state.message4);
      }.bind(this));
    }
    _gameBattlerBaseClearStates.apply(this, arguments);
  };

  
  //歩行時のウィンドウでのステート表示を消す
  Game_Actor.prototype.showAddedStates = function() {
   
  };

  Game_Actor.prototype.showRemovedStates = function() {
   
  };


  
  //戦闘中のバトルログをTickerに流す-------------------------------------
  const _windowBackLogInitialize = Window_BattleLog.prototype.initialize;
  Window_BattleLog.prototype.initialize = function () {
    _windowBackLogInitialize.call(this);
    this.visible = false;
  };

  Window_BattleLog.prototype.drawLineText = function (index) {
    if (this._actionIcon && this._lines[index].match('<SIMPLE>')) {
      this._lines[index] = '\\I[' + this._actionIcon + ']' + this._lines[index];
    }
    TickerManager.show(this._lines[index].replace('<CENTER>', '').replace('<SIMPLE>', ''));
    this._lines.pop();
  };

  //easing-------------------------------------------------------------
  var easing = {
    linear: function (pos) {
      return pos;
    },

    easeInQuad: function (pos) {
      return Math.pow(pos, 2);
    },

    easeOutQuad: function (pos) {
      return -(Math.pow((pos - 1), 2) - 1);
    },

    easeInOutQuad: function (pos) {
      if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 2);
      return -0.5 * ((pos -= 2) * pos - 2);
    },

    easeInCubic: function (pos) {
      return Math.pow(pos, 3);
    },

    easeOutCubic: function (pos) {
      return (Math.pow((pos - 1), 3) + 1);
    },

    easeInOutCubic: function (pos) {
      if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 3);
      return 0.5 * (Math.pow((pos - 2), 3) + 2);
    },

    easeInQuart: function (pos) {
      return Math.pow(pos, 4);
    },

    easeOutQuart: function (pos) {
      return -(Math.pow((pos - 1), 4) - 1);
    },

    easeInOutQuart: function (pos) {
      if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 4);
      return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2);
    },

    easeInQuint: function (pos) {
      return Math.pow(pos, 5);
    },

    easeOutQuint: function (pos) {
      return (Math.pow((pos - 1), 5) + 1);
    },

    easeInOutQuint: function (pos) {
      if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 5);
      return 0.5 * (Math.pow((pos - 2), 5) + 2);
    },

    easeInSine: function (pos) {
      return -Math.cos(pos * (Math.PI / 2)) + 1;
    },

    easeOutSine: function (pos) {
      return Math.sin(pos * (Math.PI / 2));
    },

    easeInOutSine: function (pos) {
      return (-0.5 * (Math.cos(Math.PI * pos) - 1));
    },

    easeInExpo: function (pos) {
      return (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1));
    },

    easeOutExpo: function (pos) {
      return (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1;
    },

    easeInOutExpo: function (pos) {
      if (pos === 0) return 0;
      if (pos === 1) return 1;
      if ((pos /= 0.5) < 1) return 0.5 * Math.pow(2, 10 * (pos - 1));
      return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
    },

    easeInCirc: function (pos) {
      return -(Math.sqrt(1 - (pos * pos)) - 1);
    },

    easeOutCirc: function (pos) {
      return Math.sqrt(1 - Math.pow((pos - 1), 2));
    },

    easeInOutCirc: function (pos) {
      if ((pos /= 0.5) < 1) return -0.5 * (Math.sqrt(1 - pos * pos) - 1);
      return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1);
    },

    easeOutBounce: function (pos) {
      if ((pos) < (1 / 2.75)) {
        return (7.5625 * pos * pos);
      } else if (pos < (2 / 2.75)) {
        return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
      } else if (pos < (2.5 / 2.75)) {
        return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
      } else {
        return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
      }
    },

    easeInBack: function (pos) {
      var s = 1.70158;
      return (pos) * pos * ((s + 1) * pos - s);
    },

    easeOutBack: function (pos) {
      var s = 1.70158;
      return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;
    },

    easeInOutBack: function (pos) {
      var s = 1.70158;
      if ((pos /= 0.5) < 1) return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s));
      return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
    },

    elastic: function (pos) {
      return -1 * Math.pow(4, -8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1;
    },

    swingFromTo: function (pos) {
      var s = 1.70158;
      return ((pos /= 0.5) < 1) ? 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) :
        0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
    },

    swingFrom: function (pos) {
      var s = 1.70158;
      return pos * pos * ((s + 1) * pos - s);
    },

    swingTo: function (pos) {
      var s = 1.70158;
      return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
    },

    bounce: function (pos) {
      if (pos < (1 / 2.75)) {
        return (7.5625 * pos * pos);
      } else if (pos < (2 / 2.75)) {
        return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
      } else if (pos < (2.5 / 2.75)) {
        return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
      } else {
        return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
      }
    },

    bouncePast: function (pos) {
      if (pos < (1 / 2.75)) {
        return (7.5625 * pos * pos);
      } else if (pos < (2 / 2.75)) {
        return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
      } else if (pos < (2.5 / 2.75)) {
        return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
      } else {
        return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
      }
    },

    easeFromTo: function (pos) {
      if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 4);
      return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2);
    },

    easeFrom: function (pos) {
      return Math.pow(pos, 4);
    },

    easeTo: function (pos) {
      return Math.pow(pos, 0.25);
    }
  };

})();[/pre]

Ticker.zip

7.3 KB, 下载次数: 9

最佳答案

查看完整内容

除了 window_base 的参数变了以外,commandXXX 的参数也变了,params 从函数参数里传了。
梦石
0
星屑
9862
在线时间
580 小时
注册时间
2017-9-28
回帖
203
发表于 2022-3-5 12:19:10 | 显示全部楼层
Ticker.zip (7.04 KB, 下载次数: 9) 除了 window_base 的参数变了以外,commandXXX 的参数也变了,params 从函数参数里传了。
喵喵喵
回复

使用道具 举报

梦石
0
星屑
9862
在线时间
580 小时
注册时间
2017-9-28
回帖
203
发表于 2022-3-6 10:39:27 | 显示全部楼层
随手修了几个地方,可能还有没修的: Ticker.zip (7.22 KB, 下载次数: 12)

diff:

[pre lang="diff"]--- "a/Ticker.js"
+++ b/Ticker.js
@@ -4,6 +4,7 @@
  *---------------------------------------------------------------------------*/

/*:
+ * @target MZ
  * @plugindesc ティッカープラグイン
  * @author kido0617
  * @help
@@ -575,7 +576,7 @@
   Window_Ticker.prototype.constructor = Window_Ticker;

   Window_Ticker.prototype.initialize = function (text, x, y, width, height, addPlus) {
-    Window_Base.prototype.initialize.call(this, x, y, width, height);
+    Window_Base.prototype.initialize.call(this, new Rectangle(x, y, width, height));
     this.opacity = 0;
     this.contentsOpacity = 0;
     this.addPlus = addPlus;
@@ -586,8 +587,13 @@
     return $gameSystem.ticker.fontSize + 8;
   };
-  Window_Ticker.prototype.standardPadding = function () {
-    return 0;
+  Window_Ticker.prototype.updatePadding = function () {
+    this.padding = 0;
+  };
+
+  Window_Ticker.prototype.resetFontSettings = function () {
+    Window_Base.prototype.resetFontSettings.apply(this, arguments);
+    this.contents.fontSize = this.standardFontSize();
   };

   Window_Ticker.prototype.standardFontSize = function () {[/pre]
喵喵喵
回复

使用道具 举报

梦石
0
星屑
613
在线时间
161 小时
注册时间
2020-10-11
回帖
30
 楼主| 发表于 2022-3-7 03:58:14 | 显示全部楼层
hyrious 发表于 2022-3-6 10:39
随手修了几个地方,可能还有没修的:

diff:

虽然还是会报错,金钱或者物品增加时候会报错,

ZNOT78(JPNF]~_[JQ4L)]FU.png
进入战斗也会报错,

GW0)`$T%XY)_IA~M4E_31]P.png
但是依旧万分感谢,

这插件代码挺多的,其实我需要的只是那个修改变量显示日志的功能,那功能MV战斗界面也能完美运行。

能推荐一个插件或者,避免无效修改把这个插件的其他比如获取物品提醒功能删了都行。

因为前天等了一天每看到回复,所以昨天也就没抱有期待进论坛回复慢了。万分抱歉。

点评

有空我再修修  发表于 2022-3-7 06:28
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部