设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 864|回复: 4
打印 上一主题 下一主题

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
578
在线时间
158 小时
注册时间
2020-10-11
帖子
38
跳转到指定楼层
1
发表于 2022-3-5 12:19:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
300星屑
本帖最后由 慕名景色 于 2022-3-7 03:48 编辑

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

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




MV运行效果



MZ报错情况






JS 代码复制下载
  1. /*---------------------------------------------------------------------------*
  2. * 2019/03/06 kido0617
  3. * http://kido0617.github.io/
  4. *---------------------------------------------------------------------------*/
  5.  
  6. /*:
  7. * @plugindesc ティッカープラグイン
  8. * @author kido0617
  9. * @help
  10. *   这是一个显示简单消息的插件。
  11. *   使用方法:
  12. *   TickerManager.show('\\I[5]あいうえお');
  13. *   
  14. *   ・如果变量是正的,它会自动加上+。
  15. *   TickerManager.show('\\V[5]');
  16. *
  17. *   ・ 如果您不想添加+,请指定false,如下所示
  18. *   TickerManager.show('\\V[5]', false);
  19. *
  20. *   ・想全部消除的情况请如下所示
  21. *   TickerManager.hideAll();
  22. *
  23. *   ・道具·武器·防具的记事栏
  24. *   <ticker:あいうえお> : 作为项目的说明在获取/消失时显示。如果没有,则显示项目描述的第一行
  25. *   
  26. *   ・清除日志
  27. *    TickerManager.clearAllLog();
  28. *
  29. *   ・清除1个旧日志
  30. *    TickerManager.clearOldestLog();
  31. *
  32. *
  33. * @param Opacity
  34. * @desc 背景の透明度(0 - 255)
  35. * @type number
  36. * @min 0
  37. * @max 255
  38. * @default 127
  39. *
  40. * @param DisplayDuration
  41. * @desc 表示時間[frame]
  42. * @type number
  43. * @default 180
  44. *
  45. * @param ToggleDuration
  46. * @desc 显示和擦除的时间[frame]
  47. * @type number
  48. * @default 30
  49. *
  50. * @param y位置
  51. * @desc 如果输入y位置偏移(Pixel)10,则偏移10像素。
  52. * @type number
  53. * @default 0
  54. *
  55. * @param x位置
  56. * @desc 如果输入x位置偏移(Pixel)10,则偏移10像素。
  57. * @type number
  58. * @default 0
  59. *
  60. * @param 幻灯片动画开始位置
  61. * @desc 从左边滑动到什么像素的位置?
  62. * @type number
  63. * @default 100
  64. *
  65. * @param 幻灯片动画结束位置
  66. * @desc 从左边向几个像素的位置滑动
  67. * @type number
  68. * @default 0
  69. *
  70. * @param y位置合わせスピード
  71. * @desc 当有两个或更多个时,当第一个消失时调整y位置时的动画速度[pixel/frame]
  72. * @type number
  73. * @default 5
  74. *
  75. * @param 上か下か
  76. * @desc 在屏幕上显示还是在下面显示
  77. * @default 上
  78. * @type select
  79. * @option 上
  80. * @option 下
  81. *
  82. * @param ティッカー高さ
  83. * @desc 代码的高度
  84. * @type number
  85. * @default 36
  86. *
  87. * @param フォントサイズ
  88. * @desc 字体大小
  89. * @type number
  90. * @default 28
  91. *
  92. * @param アイコンサイズ
  93. * @desc 图标大小
  94. * @type number
  95. * @default 32
  96. *
  97. * @param 背景画像
  98. * @desc 背景画像
  99. * @default
  100. * @type file
  101. * @dir img/pictures/
  102. *
  103. * @param 最大表示個数
  104. * @desc 可以显示的个数。过了之后,旧的就消失了。
  105. * @type number
  106. * @min 1
  107. * @max 100
  108. * @default 10
  109. *
  110. * @param 日志功能 ON 开关
  111. * @desc 它是一个开关,当它打开时作为日志保留而不删除。
  112. * @type switch
  113. * @default 0
  114. *
  115. * @param イージング
  116. * @desc 更改幻灯片动画的缓动
  117. * @default easeOutSine
  118. * @type select
  119. * @option linear
  120. * @option swingFromTo
  121. * @option swingFrom
  122. * @option swingTo
  123. * @option easeFromTo
  124. * @option easeFrom
  125. * @option easeTo
  126. * @option easeInQuad
  127. * @option easeOutQuad
  128. * @option easeInOutQuad
  129. * @option easeInCubic
  130. * @option easeOutCubic
  131. * @option easeInOutCubic
  132. * @option easeInQuart
  133. * @option easeOutQuart
  134. * @option easeInOutQuart
  135. * @option easeInQuint
  136. * @option easeOutQuint
  137. * @option easeInOutQuint
  138. * @option easeInSine
  139. * @option easeOutSine
  140. * @option easeInOutSine
  141. * @option easeInExpo
  142. * @option easeOutExpo
  143. * @option easeInOutExpo
  144. * @option easeInCirc
  145. * @option easeOutCirc
  146. * @option easeInOutCirc
  147. * @option easeOutBounce
  148. * @option easeInBack
  149. * @option easeOutBack
  150. * @option easeInOutBack
  151. * @option bounce
  152. * @option bouncePast
  153. * @option elastic
  154. *
  155. * @param 状态自动显示开关
  156. * @desc 当此处指定的开关为 ON 时,状态改变时自动显示代码。
  157. * @type switch
  158. * @default 0
  159. *
  160. * @param 物品/金钱自动显示开关
  161. * @desc 当此处指定的开关为 ON 时,当物品、武器和盔甲以及金钱增加/减少时自动显示代码。
  162. * @type switch
  163. * @default 0
  164. *
  165. * @param 消失時にティッカーを表示
  166. * @desc 物品、武器、盔甲和金币消失时是否显示窗口
  167. * @type boolean
  168. * @default true
  169. *
  170. * @param アイテム・武器防具入手時テキスト
  171. * @desc 这是您获得物品/武器/盔甲时的文字。
  172. * %1图标、%2物品名称、%3が個数、%4が説明に変わります。
  173. * 可以使用消息窗口的控制命令。
  174. * @default %1 %2 x %3 GET %4
  175. *
  176. * @param アイテム・武器防具消失時テキスト
  177. * @desc 物品·武器防具消失时显示的文本。
  178. * %1图标、%2物品名称、%3が個数、%4が説明に変わります。
  179. * 可以使用消息窗口的控制命令。
  180. * @default %1 %2 x %3 消失 %4
  181. *
  182. * @param お金入手時テキスト
  183. * @desc お金を入手したときのテキストです
  184. * %1图标、%2が金額、%3が通貨単位に変わります。
  185. * 可以使用消息窗口的控制命令。
  186. * @default %1 %2%3入手!
  187. *
  188. * @param お金消失時テキスト
  189. * @desc お金をなくしたしたときのテキストです
  190. * %1图标、%2が金額、%3が通貨単位に変わります。
  191. * 可以使用消息窗口的控制命令。
  192. * @default %1 %2%3消失!
  193. *
  194. * @param お金アイコン
  195. * @desc 得失金币的图标
  196. * @default 1
  197. * @type number
  198. *
  199. *
  200. * @param アイテム・武器・防具入手時SE
  201. * @desc アイテム・武器・防具入手時SE
  202. * @type struct<seSetting>
  203. *
  204. * @param アイテム・武器・防具消失時SE
  205. * @desc アイテム・武器・防具消失時SE
  206. * @type struct<seSetting>
  207. *
  208. * @param お金入手時SE
  209. * @desc お金入手時SE
  210. * @type struct<seSetting>
  211. *
  212. * @param お金消失時SE
  213. * @desc お金消失時SE
  214. * @type struct<seSetting>
  215. *
  216. */
  217.  
  218. /*~struct~seSetting:
  219. *
  220. * @param name
  221. * @desc ファイル名
  222. * @default
  223. * @dir audio/se/
  224. * @type file
  225. *
  226. * @param volume
  227. * @desc ボリューム
  228. * @default 90
  229. * @type number
  230. *
  231. * @param pitch
  232. * @desc ピッチ
  233. * @default 100
  234. * @type number
  235. *
  236. * @param pan
  237. * @desc パン
  238. * @default 0
  239. * @type number
  240. */
  241.  
  242.  
  243. (function () {
  244.  
  245.   const parameters = PluginManager.parameters('Ticker');
  246.   let defaultTickerSetting = {
  247.     maxDisplay: Number(parameters['最大表示個数'] || 10),
  248.     backgroundOpacity: Number(parameters['Opacity'] || 127),
  249.     displayDuration: Number(parameters['DisplayDuration'] || 3 * 60),
  250.     toggleDuration: Number(parameters['ToggleDuration'] || 30),
  251.     xPosition: Number(parameters['x位置'] || 0),
  252.     yPosition: Number(parameters['y位置'] || 0),
  253.     fixYSpeed: Number(parameters['y位置合わせスピード'] || 100),
  254.     slideFromX: Number(parameters['スライドアニメーション開始位置'] || 0),
  255.     slideToX: Number(parameters['スライドアニメーション終了位置'] || 0),
  256.     height: Number(parameters['ティッカー高さ']),
  257.     fontSize: Number(parameters['フォントサイズ']),
  258.     iconSize: Number(parameters['アイコンサイズ']),
  259.     backgroundImg: parameters['背景画像'],
  260.     isBaseTop: parameters['上か下か'] == '上',
  261.     easingType: parameters['イージング'],
  262.     logOnSwitch: Number(parameters['ログ機能ONスイッチ']),
  263.     stateAutoEnableSWId: Number(parameters['ステート自動表示スイッチ']),
  264.     autoSetting: {
  265.       enableSWId: Number(parameters['アイテム・お金自動表示スイッチ']),
  266.       enableLose: parameters['消失時にティッカーを表示'] == 'true',
  267.       getItemText: parameters['アイテム・武器防具入手時テキスト'],
  268.       loseItemText: parameters['アイテム・武器防具消失時テキスト'],
  269.       getGoldText: parameters['お金入手時テキスト'],
  270.       loseGoldText: parameters['お金消失時テキスト'],
  271.       goldIcon: parameters['お金アイコン'],
  272.       getItemSE: parseSE(parameters['アイテム・武器・防具入手時SE']),
  273.       getGoldSE: parseSE(parameters['お金入手時SE']),
  274.       loseItemSE: parseSE(parameters['アイテム・武器・防具消失時SE']),
  275.       loseGoldSE: parseSE(parameters['お金消失時SE']),
  276.     }
  277.   };
  278.  
  279.   const gameSystemInitialize = Game_System.prototype.initialize;
  280.   Game_System.prototype.initialize = function () {
  281.     //ゲーム内からパラメータを変更したいのでセーブデータに含める
  282.     gameSystemInitialize.call(this);
  283.     this.setDefaultTickerSetting();
  284.     this.tickerLogs = [];
  285.   };
  286.  
  287.   Game_System.prototype.setDefaultTickerSetting = function () {
  288.     this.ticker = JsonEx.makeDeepCopy(defaultTickerSetting);
  289.   };
  290.  
  291.   function parseSE(se) {
  292.     try {
  293.       se = JSON.parse(se);
  294.     } catch (e) {
  295.       return null;
  296.     }
  297.     if (!se || !se.name) return null;
  298.     se.pitch = Number(se.pitch);
  299.     se.volume = Number(se.volume);
  300.     se.pan = Number(se.pan);
  301.     return se;
  302.   }
  303.  
  304.   window.TickerManager = function () { };
  305.  
  306.   //パラメータをデフォルトに戻したいケースのため保持
  307.   TickerManager.param = defaultTickerSetting;
  308.  
  309.   TickerManager.createTickerContainer = function () {
  310.     //通常ティッカー用のコンテナ
  311.     if (!SceneManager._scene._tickerContainer) {
  312.       let tc = new TickerContainer(false);
  313.       SceneManager._scene._tickerContainer = tc;
  314.       SceneManager._scene.addChild(tc);
  315.     }
  316.     //ログティッカー表示用のコンテナ
  317.     if (!SceneManager._scene._tickerLogContainer) {
  318.       let tc = new TickerContainer(true);
  319.       SceneManager._scene._tickerLogContainer = tc;
  320.       SceneManager._scene.addChild(tc);
  321.     }
  322.   };
  323.  
  324.   TickerManager.show = function (text, needPlus = true) {
  325.     this.createTickerContainer();
  326.     if (this.isLogContainerEnable()) SceneManager._scene._tickerLogContainer.show(text, needPlus);
  327.     else SceneManager._scene._tickerContainer.show(text, needPlus);
  328.   };
  329.  
  330.   TickerManager.hideAll = function () {
  331.     if (SceneManager._scene._tickerContainer) {
  332.       SceneManager._scene._tickerContainer.hideAll();
  333.     }
  334.   };
  335.  
  336.   TickerManager.isLogContainerEnable = function () {
  337.     return this.isLogOn() && (SceneManager._scene.constructor == Scene_Map || SceneManager._scene.constructor == Scene_Battle);
  338.   };
  339.  
  340.   TickerManager.isLogOn = function () {
  341.     return $gameSwitches.value($gameSystem.ticker.logOnSwitch);
  342.   };
  343.  
  344.   TickerManager.isAutoDisplayEnabled = function () {
  345.     return $gameSystem.ticker.autoSetting.enableSWId > 0 && $gameSwitches.value($gameSystem.ticker.autoSetting.enableSWId);
  346.   };
  347.  
  348.   TickerManager.clearAllLog = function () {
  349.     if (!$gameParty.inBattle()) $gameSystem.tickerLogs = [];
  350.  
  351.     if (SceneManager._scene._tickerLogContainer) {
  352.       if ($gameParty.inBattle()) SceneManager._scene._tickerLogContainer.instantLog = [];
  353.       SceneManager._scene._tickerLogContainer.hideAll();
  354.     }
  355.   };
  356.  
  357.   TickerManager.clearOldestLog = function () {
  358.     if (!$gameParty.inBattle()) $gameSystem.tickerLogs.shift();
  359.     if (SceneManager._scene._tickerLogContainer) {
  360.       if ($gameParty.inBattle()) SceneManager._scene._tickerLogContainer.instantLog.shift();
  361.       SceneManager._scene._tickerLogContainer.hideOldest();
  362.     }
  363.   };
  364.  
  365.   var createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
  366.   Scene_Map.prototype.createDisplayObjects = function () {
  367.     createDisplayObjects.call(this);
  368.     //メニューから戻ったり、ロードしたりしたときにログ用のティッカーを復元する
  369.     if ($gameSystem.tickerLogs.length > 0) {
  370.       TickerManager.createTickerContainer();
  371.       $gameSystem.tickerLogs.forEach((log) => {
  372.         SceneManager._scene._tickerLogContainer.showFromLog(log);
  373.       });
  374.       SceneManager._scene._tickerLogContainer.alpha = TickerManager.isLogOn() ? 1 : 0;
  375.     }
  376.   };
  377.  
  378.   function TickerContainer(isLogMode) {
  379.     PIXI.Container.call(this);
  380.     this.isLogMode = isLogMode;
  381.     this.instantLog = [];  //そのシーンだけのログ
  382.   }
  383.  
  384.   TickerContainer.prototype = Object.create(PIXI.Container.prototype);
  385.   TickerContainer.prototype.constructor = TickerContainer;
  386.  
  387.   TickerContainer.prototype.update = function () {
  388.     this.displayFade();
  389.     for (var i = 0; i < this.children.length; i++) {
  390.       this.children[i].update();
  391.       if (this.children[i].tickerState == 'end') {
  392.         this.removeChildAt(i);
  393.         this.adjustY();
  394.         i--;
  395.       }
  396.     }
  397.   };
  398.  
  399.   TickerContainer.prototype.displayFade = function () {
  400.     //ログと通常の切替時にフェード入れる
  401.     const duration = 0.1;
  402.     var direction = 1;
  403.     var logEnabled = TickerManager.isLogContainerEnable();
  404.     if (this.isLogMode && !logEnabled) direction = -1;
  405.     else if (!this.isLogMode && logEnabled) direction = -1;
  406.     this.alpha = (this.alpha + direction * duration).clamp(0, 1);
  407.   };
  408.  
  409.   TickerContainer.prototype.show = function (text, needPlus) {
  410.     var ticker = this.makeTicker(text, needPlus);
  411.     if (this.isLogMode) {
  412.       //ログモードのとき画面切り替えやセーブに対応するため変換後のテキストを保存する。変換後でないと変数の値が変わる可能性がある
  413.       var logs = $gameParty.inBattle() ? this.instantLog : $gameSystem.tickerLogs;
  414.       logs.push(ticker.getCovertedText());
  415.       if (logs.length > $gameSystem.ticker.maxDisplay) {
  416.         logs.shift();
  417.       }
  418.     }
  419.     if (this.countDisplay() > $gameSystem.ticker.maxDisplay) this.hideOldest();
  420.   };
  421.  
  422.   TickerContainer.prototype.showFromLog = function (text, needPlus) {
  423.     //ログを復帰するとき。表示アニメーションを飛ばして最初から表示にしたい
  424.     var ticker = this.makeTicker(text, needPlus);
  425.     ticker.setDisplayMode();
  426.   };
  427.  
  428.   TickerContainer.prototype.makeTicker = function (text, needPlus) {
  429.     var ticker = new Ticker(text, needPlus, this.isLogMode);
  430.     ticker.setY(this.children.length);
  431.     this.addChild(ticker);
  432.     return ticker;
  433.   };
  434.  
  435.   TickerContainer.prototype.adjustY = function () {
  436.     //y位置直し
  437.     for (var i = 0; i < this.children.length; i++) {
  438.       this.children[i].setToY(i);
  439.     }
  440.   };
  441.  
  442.   TickerContainer.prototype.hideOldest = function () {
  443.     for (var i = 0; i < this.children.length; i++) {
  444.       if (this.children[i].isShowState()) {
  445.         this.children[i].hide();
  446.         return;
  447.       }
  448.     }
  449.   };
  450.  
  451.   TickerContainer.prototype.countDisplay = function () {
  452.     return this.children.filter((child) => child.isShowState()).length;
  453.   };
  454.  
  455.   TickerContainer.prototype.hideAll = function () {
  456.     for (var i = 0; i < this.children.length; i++)this.children[i].hide();
  457.   };
  458.  
  459.   function Ticker() {
  460.     this.frameCount = 0;
  461.     this.tickerState = 'showing';
  462.     this.initialize.apply(this, arguments);
  463.   }
  464.  
  465.   Ticker.prototype = Object.create(PIXI.Container.prototype);
  466.   Ticker.prototype.constructor = Ticker;
  467.  
  468.   Ticker.prototype.initialize = function (text, addPlus, isLogMode) {
  469.     PIXI.Container.call(this);
  470.     this.x = $gameSystem.ticker.xPosition;
  471.     this.width = Graphics.width;
  472.     this.height = $gameSystem.ticker.height;
  473.     this.text = text;
  474.     this.isLogMode = isLogMode;
  475.     this.createBackground();
  476.     this.contents = new Window_Ticker(text, $gameSystem.ticker.slideFromX, 0, this._width, this._height, addPlus);
  477.     this.addChild(this.contents);
  478.   };
  479.  
  480.   Ticker.prototype.setY = function (index) {
  481.     this.y = $gameSystem.ticker.isBaseTop ? this.height * index + $gameSystem.ticker.yPosition : Graphics.height - this.height * (index + 1) - $gameSystem.ticker.yPosition;
  482.   };
  483.  
  484.   Ticker.prototype.setToY = function (index) {
  485.     this.toY = $gameSystem.ticker.isBaseTop ? this.height * index + $gameSystem.ticker.yPosition : Graphics.height - this.height * (index + 1) - $gameSystem.ticker.yPosition;
  486.   };
  487.  
  488.   Ticker.prototype.createBackground = function () {
  489.     this._backSprite = new Sprite();
  490.     if ($gameSystem.ticker.backgroundImg) {
  491.       this._backSprite.bitmap = ImageManager.loadPicture($gameSystem.ticker.backgroundImg);
  492.     } else {
  493.       this._backSprite.bitmap = new Bitmap(this._width, this._height);
  494.       this._backSprite.bitmap.fillAll('rgba(0, 0, 0, 1)');
  495.     }
  496.     this._backSprite.opacity = 0;
  497.     this.addChild(this._backSprite);
  498.   };
  499.  
  500.   Ticker.prototype.hide = function () {
  501.     if (!this.isShowState()) return;
  502.     this.tickerState = 'hiding';
  503.     this.frameCount = 0;
  504.   };
  505.  
  506.   Ticker.prototype.isShowState = function () {
  507.     return this.tickerState == 'showing' || this.tickerState == 'display';
  508.   };
  509.  
  510.   Ticker.prototype.setDisplayMode = function () {
  511.     //アニメなしで表示する(ログのとき画面切り替えしたときとかのため)
  512.     this._backSprite.opacity = $gameSystem.ticker.backgroundOpacity;
  513.     this.contents.contentsOpacity = 255;
  514.     this.contents.x = $gameSystem.ticker.slideToX;
  515.     this.tickerState = 'display';
  516.   };
  517.  
  518.   Ticker.prototype.getCovertedText = function () {
  519.     return this.contents.convertEscapeCharacters(this.text);
  520.   };
  521.  
  522.   Ticker.prototype.update = function () {
  523.     this.children.forEach(function (child) {
  524.       child.update();
  525.     });
  526.     this.frameCount++;
  527.     if (this.toY != null && this.y != this.toY) {
  528.       if (this.y > this.toY) {
  529.         this.y -= $gameSystem.ticker.fixYSpeed;
  530.         if (this.y < this.toY) this.y = this.toY;
  531.       } else {
  532.         this.y += $gameSystem.ticker.fixYSpeed;
  533.         if (this.y > this.toY) this.y = this.toY;
  534.       }
  535.  
  536.     }
  537.     switch (this.tickerState) {
  538.       case 'showing':
  539.         var rate = easing[$gameSystem.ticker.easingType](this.frameCount / $gameSystem.ticker.toggleDuration);
  540.         this._backSprite.opacity = rate * $gameSystem.ticker.backgroundOpacity;
  541.         this.contents.contentsOpacity = rate * 255;
  542.         this.contents.x = $gameSystem.ticker.slideToX + (1 - rate) * $gameSystem.ticker.slideFromX;
  543.         if (this.frameCount == $gameSystem.ticker.toggleDuration) {
  544.           this.tickerState = 'display';
  545.           this.frameCount = 0;
  546.         }
  547.         break;
  548.       case 'display':
  549.         if (this.frameCount == $gameSystem.ticker.displayDuration) {
  550.           if (this.isLogMode) {
  551.             //ログ表示中は消去にいかない
  552.             return;
  553.           }
  554.           this.tickerState = 'hiding';
  555.           this.frameCount = 0;
  556.         }
  557.         break;
  558.       case 'hiding':
  559.         this._backSprite.opacity = (1 - this.frameCount / $gameSystem.ticker.toggleDuration) * $gameSystem.ticker.backgroundOpacity;
  560.         this.contents.contentsOpacity = (1 - this.frameCount / $gameSystem.ticker.toggleDuration) * 255;
  561.         if (this.frameCount == $gameSystem.ticker.toggleDuration) {
  562.           this.tickerState = 'end';
  563.         }
  564.         break;
  565.     }
  566.  
  567.   };
  568.  
  569.  
  570.   function Window_Ticker() {
  571.     this.initialize.apply(this, arguments);
  572.   }
  573.  
  574.   Window_Ticker.prototype = Object.create(Window_Base.prototype);
  575.   Window_Ticker.prototype.constructor = Window_Ticker;
  576.  
  577.   Window_Ticker.prototype.initialize = function (text, x, y, width, height, addPlus) {
  578.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  579.     this.opacity = 0;
  580.     this.contentsOpacity = 0;
  581.     this.addPlus = addPlus;
  582.     this.drawTextEx(text, 0, height / 2 - this.standardFontSize() / 2 - 4);
  583.   };
  584.  
  585.   Window_Ticker.prototype.lineHeight = function () {
  586.     return $gameSystem.ticker.fontSize + 8;
  587.   };
  588.  
  589.   Window_Ticker.prototype.standardPadding = function () {
  590.     return 0;
  591.   };
  592.  
  593.   Window_Ticker.prototype.standardFontSize = function () {
  594.     return $gameSystem.ticker.fontSize;
  595.   };
  596.  
  597.   //変数にプラス記号をつけるため
  598.   Window_Ticker.prototype.convertEscapeCharacters = function (text) {
  599.     text = text.replace(/\\/g, '\x1b');
  600.     text = text.replace(/\x1b\x1b/g, '\\');
  601.     text = text.replace(/\x1bV\[(\d+)\]/gi, function () {
  602.       var v = $gameVariables.value(parseInt(arguments[1]));
  603.       return (v > 0 && this.addPlus ? '+' : '') + v;
  604.     }.bind(this));
  605.     text = text.replace(/\x1bV\[\+*(\d+)\]/gi, function () {
  606.       var v = $gameVariables.value(parseInt(arguments[1]));
  607.       return (v > 0 && this.addPlus ? '+' : '') + v;
  608.     }.bind(this));
  609.     text = text.replace(/\x1bN\[(\d+)\]/gi, function () {
  610.       return this.actorName(parseInt(arguments[1]));
  611.     }.bind(this));
  612.     text = text.replace(/\x1bP\[(\d+)\]/gi, function () {
  613.       return this.partyMemberName(parseInt(arguments[1]));
  614.     }.bind(this));
  615.     text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
  616.     return text;
  617.   };
  618.  
  619.   Window_Ticker.prototype.processDrawIcon = function(iconIndex, textState) {
  620.     var size = this.getIconSize();
  621.     var y = ($gameSystem.ticker.height - size) / 2;
  622.     this.drawIcon(iconIndex, textState.x + 2, y);
  623.     textState.x += size + 4;
  624.   };
  625.  
  626.   Window_Ticker.prototype.drawIcon = function(iconIndex, x, y) {
  627.     var bitmap = ImageManager.loadSystem('IconSet');
  628.     var pw = Window_Base._iconWidth;
  629.     var ph = Window_Base._iconHeight;
  630.     var sx = iconIndex % 16 * pw;
  631.     var sy = Math.floor(iconIndex / 16) * ph;
  632.     var size = this.getIconSize();
  633.     this.contents.blt(bitmap, sx, sy, pw, ph, x, y, size, size);
  634.   };
  635.  
  636.   Window_Ticker.prototype.getIconSize = function() {
  637.     return $gameSystem.ticker.iconSize ? $gameSystem.ticker.iconSize : Window_Base._iconWidth;
  638.   };
  639.  
  640.   //自動表示-----------------------------------------------------------------
  641.  
  642.   function formatTickerText(text, strs) {
  643.     text = text.replace('%1', '\\I[' + strs[0] + ']');
  644.     for (var i = 1; i <= strs.length; i++) {
  645.       text = text.replace('%' + (i + 1), strs[i]);
  646.     }
  647.     return text;
  648.   }
  649.  
  650.   function GetItemDescription(item) {
  651.     if (item.meta.ticker) {
  652.       return item.meta.ticker;
  653.     }
  654.     return item.description.replace(/[\r\n]+.*/m, '');
  655.   }
  656.  
  657.   function showAutoTicker(getText, loseText, getSE, loseSE, strs, value) {
  658.     let format = '';
  659.     let se;
  660.     if (value > 0) {
  661.       format = getText;
  662.       se = getSE;
  663.     } else if ($gameSystem.ticker.autoSetting.enableLose && value < 0) {
  664.       format = loseText;
  665.       se = loseSE;
  666.     }
  667.     if (format) {
  668.       let formated = formatTickerText(format, strs);
  669.       TickerManager.show(formated);
  670.       if (se) {
  671.         AudioManager.playSe(se);
  672.       }
  673.     }
  674.   }
  675.  
  676.   // Change Gold
  677.   const command125 = Game_Interpreter.prototype.command125;
  678.   Game_Interpreter.prototype.command125 = function () {
  679.     command125.call(this);
  680.     if (TickerManager.isAutoDisplayEnabled()) {
  681.       let value = this.operateValue(this._params[0], this._params[1], this._params[2]);
  682.       showAutoTicker($gameSystem.ticker.autoSetting.getGoldText, $gameSystem.ticker.autoSetting.loseGoldText,
  683.         $gameSystem.ticker.autoSetting.getGoldSE, $gameSystem.ticker.autoSetting.loseGoldSE,
  684.         [$gameSystem.ticker.autoSetting.goldIcon, Math.abs(value), $dataSystem.currencyUnit], value);
  685.     }
  686.     return true;
  687.   };
  688.  
  689.   // Change Items
  690.   const command126 = Game_Interpreter.prototype.command126;
  691.   Game_Interpreter.prototype.command126 = function () {
  692.     command126.call(this);
  693.     if (TickerManager.isAutoDisplayEnabled()) {
  694.       let value = this.operateValue(this._params[1], this._params[2], this._params[3]);
  695.       let item = $dataItems[this._params[0]];
  696.       showAutoTicker($gameSystem.ticker.autoSetting.getItemText, $gameSystem.ticker.autoSetting.loseItemText,
  697.         $gameSystem.ticker.autoSetting.getItemSE, $gameSystem.ticker.autoSetting.loseItemSE,
  698.         [item.iconIndex, item.name, Math.abs(value), GetItemDescription(item)], value);
  699.     }
  700.     return true;
  701.   };
  702.  
  703.  
  704.   // Change Weapons
  705.   const command127 = Game_Interpreter.prototype.command127;
  706.   Game_Interpreter.prototype.command127 = function () {
  707.     command127.call(this);
  708.     if (TickerManager.isAutoDisplayEnabled()) {
  709.       let value = this.operateValue(this._params[1], this._params[2], this._params[3]);
  710.       let item = $dataWeapons[this._params[0]];
  711.       showAutoTicker($gameSystem.ticker.autoSetting.getItemText, $gameSystem.ticker.autoSetting.loseItemText,
  712.         $gameSystem.ticker.autoSetting.getItemSE, $gameSystem.ticker.autoSetting.loseItemSE,
  713.         [item.iconIndex, item.name, Math.abs(value), GetItemDescription(item)], value);
  714.     }
  715.     return true;
  716.   };
  717.  
  718.   // Change Armors
  719.   const command128 = Game_Interpreter.prototype.command128;
  720.   Game_Interpreter.prototype.command128 = function () {
  721.     command128.call(this);
  722.     if (TickerManager.isAutoDisplayEnabled()) {
  723.       let value = this.operateValue(this._params[1], this._params[2], this._params[3]);
  724.       let item = $dataArmors[this._params[0]];
  725.       showAutoTicker($gameSystem.ticker.autoSetting.getItemText, $gameSystem.ticker.autoSetting.loseItemText,
  726.         $gameSystem.ticker.autoSetting.getItemSE, $gameSystem.ticker.autoSetting.loseItemSE,
  727.         [item.iconIndex, item.name, Math.abs(value), GetItemDescription(item)], value);
  728.     }
  729.     return true;
  730.   };
  731.  
  732.   //ステート変化時の自動表示------------------------------------------------------
  733.  
  734.   function NeedStateChangeDisplay(){
  735.     if($gameSystem.ticker.stateAutoEnableSWId != 0 && !$gameSwitches.value($gameSystem.ticker.stateAutoEnableSWId)) return false;
  736.  
  737.     return  !(SceneManager._scene instanceof Scene_Battle) ||
  738.      ($gameTroop && $gameTroop.isEventRunning());
  739.   }
  740.  
  741.   const _gameBattlerBaseAddNewState = Game_BattlerBase.prototype.addNewState;
  742.   Game_BattlerBase.prototype.addNewState = function(stateId) {
  743.     if(NeedStateChangeDisplay() && this._states && !this._states.contains(stateId)){
  744.       let state = $dataStates[stateId];
  745.       if(state.message1) TickerManager.show(this._name + state.message1);
  746.     }
  747.     _gameBattlerBaseAddNewState.apply(this, arguments);
  748.   };
  749.  
  750.   const _gameBattlerBaseEraseState = Game_BattlerBase.prototype.eraseState;
  751.   Game_BattlerBase.prototype.eraseState = function(stateId) {
  752.     if(NeedStateChangeDisplay() && this._states && this._states.contains(stateId)){
  753.       let state = $dataStates[stateId];
  754.       if(state.message4) TickerManager.show(this._name + state.message4);
  755.     }
  756.     _gameBattlerBaseEraseState.apply(this, arguments);
  757.   };
  758.  
  759.   const _gameBattlerBaseClearStates = Game_BattlerBase.prototype.clearStates;
  760.   Game_BattlerBase.prototype.clearStates = function() {
  761.     if(NeedStateChangeDisplay() && this._states){
  762.       this._states.forEach(function(stateId) {
  763.         let state = $dataStates[stateId];
  764.         if(state.message4) TickerManager.show(this._name + state.message4);
  765.       }.bind(this));
  766.     }
  767.     _gameBattlerBaseClearStates.apply(this, arguments);
  768.   };
  769.  
  770.  
  771.   //歩行時のウィンドウでのステート表示を消す
  772.   Game_Actor.prototype.showAddedStates = function() {
  773.  
  774.   };
  775.  
  776.   Game_Actor.prototype.showRemovedStates = function() {
  777.  
  778.   };
  779.  
  780.  
  781.  
  782.   //戦闘中のバトルログをTickerに流す-------------------------------------
  783.   const _windowBackLogInitialize = Window_BattleLog.prototype.initialize;
  784.   Window_BattleLog.prototype.initialize = function () {
  785.     _windowBackLogInitialize.call(this);
  786.     this.visible = false;
  787.   };
  788.  
  789.   Window_BattleLog.prototype.drawLineText = function (index) {
  790.     if (this._actionIcon && this._lines[index].match('<SIMPLE>')) {
  791.       this._lines[index] = '\\I[' + this._actionIcon + ']' + this._lines[index];
  792.     }
  793.     TickerManager.show(this._lines[index].replace('<CENTER>', '').replace('<SIMPLE>', ''));
  794.     this._lines.pop();
  795.   };
  796.  
  797.   //easing-------------------------------------------------------------
  798.   var easing = {
  799.     linear: function (pos) {
  800.       return pos;
  801.     },
  802.  
  803.     easeInQuad: function (pos) {
  804.       return Math.pow(pos, 2);
  805.     },
  806.  
  807.     easeOutQuad: function (pos) {
  808.       return -(Math.pow((pos - 1), 2) - 1);
  809.     },
  810.  
  811.     easeInOutQuad: function (pos) {
  812.       if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 2);
  813.       return -0.5 * ((pos -= 2) * pos - 2);
  814.     },
  815.  
  816.     easeInCubic: function (pos) {
  817.       return Math.pow(pos, 3);
  818.     },
  819.  
  820.     easeOutCubic: function (pos) {
  821.       return (Math.pow((pos - 1), 3) + 1);
  822.     },
  823.  
  824.     easeInOutCubic: function (pos) {
  825.       if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 3);
  826.       return 0.5 * (Math.pow((pos - 2), 3) + 2);
  827.     },
  828.  
  829.     easeInQuart: function (pos) {
  830.       return Math.pow(pos, 4);
  831.     },
  832.  
  833.     easeOutQuart: function (pos) {
  834.       return -(Math.pow((pos - 1), 4) - 1);
  835.     },
  836.  
  837.     easeInOutQuart: function (pos) {
  838.       if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 4);
  839.       return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2);
  840.     },
  841.  
  842.     easeInQuint: function (pos) {
  843.       return Math.pow(pos, 5);
  844.     },
  845.  
  846.     easeOutQuint: function (pos) {
  847.       return (Math.pow((pos - 1), 5) + 1);
  848.     },
  849.  
  850.     easeInOutQuint: function (pos) {
  851.       if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 5);
  852.       return 0.5 * (Math.pow((pos - 2), 5) + 2);
  853.     },
  854.  
  855.     easeInSine: function (pos) {
  856.       return -Math.cos(pos * (Math.PI / 2)) + 1;
  857.     },
  858.  
  859.     easeOutSine: function (pos) {
  860.       return Math.sin(pos * (Math.PI / 2));
  861.     },
  862.  
  863.     easeInOutSine: function (pos) {
  864.       return (-0.5 * (Math.cos(Math.PI * pos) - 1));
  865.     },
  866.  
  867.     easeInExpo: function (pos) {
  868.       return (pos === 0) ? 0 : Math.pow(2, 10 * (pos - 1));
  869.     },
  870.  
  871.     easeOutExpo: function (pos) {
  872.       return (pos === 1) ? 1 : -Math.pow(2, -10 * pos) + 1;
  873.     },
  874.  
  875.     easeInOutExpo: function (pos) {
  876.       if (pos === 0) return 0;
  877.       if (pos === 1) return 1;
  878.       if ((pos /= 0.5) < 1) return 0.5 * Math.pow(2, 10 * (pos - 1));
  879.       return 0.5 * (-Math.pow(2, -10 * --pos) + 2);
  880.     },
  881.  
  882.     easeInCirc: function (pos) {
  883.       return -(Math.sqrt(1 - (pos * pos)) - 1);
  884.     },
  885.  
  886.     easeOutCirc: function (pos) {
  887.       return Math.sqrt(1 - Math.pow((pos - 1), 2));
  888.     },
  889.  
  890.     easeInOutCirc: function (pos) {
  891.       if ((pos /= 0.5) < 1) return -0.5 * (Math.sqrt(1 - pos * pos) - 1);
  892.       return 0.5 * (Math.sqrt(1 - (pos -= 2) * pos) + 1);
  893.     },
  894.  
  895.     easeOutBounce: function (pos) {
  896.       if ((pos) < (1 / 2.75)) {
  897.         return (7.5625 * pos * pos);
  898.       } else if (pos < (2 / 2.75)) {
  899.         return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  900.       } else if (pos < (2.5 / 2.75)) {
  901.         return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  902.       } else {
  903.         return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  904.       }
  905.     },
  906.  
  907.     easeInBack: function (pos) {
  908.       var s = 1.70158;
  909.       return (pos) * pos * ((s + 1) * pos - s);
  910.     },
  911.  
  912.     easeOutBack: function (pos) {
  913.       var s = 1.70158;
  914.       return (pos = pos - 1) * pos * ((s + 1) * pos + s) + 1;
  915.     },
  916.  
  917.     easeInOutBack: function (pos) {
  918.       var s = 1.70158;
  919.       if ((pos /= 0.5) < 1) return 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s));
  920.       return 0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
  921.     },
  922.  
  923.     elastic: function (pos) {
  924.       return -1 * Math.pow(4, -8 * pos) * Math.sin((pos * 6 - 1) * (2 * Math.PI) / 2) + 1;
  925.     },
  926.  
  927.     swingFromTo: function (pos) {
  928.       var s = 1.70158;
  929.       return ((pos /= 0.5) < 1) ? 0.5 * (pos * pos * (((s *= (1.525)) + 1) * pos - s)) :
  930.         0.5 * ((pos -= 2) * pos * (((s *= (1.525)) + 1) * pos + s) + 2);
  931.     },
  932.  
  933.     swingFrom: function (pos) {
  934.       var s = 1.70158;
  935.       return pos * pos * ((s + 1) * pos - s);
  936.     },
  937.  
  938.     swingTo: function (pos) {
  939.       var s = 1.70158;
  940.       return (pos -= 1) * pos * ((s + 1) * pos + s) + 1;
  941.     },
  942.  
  943.     bounce: function (pos) {
  944.       if (pos < (1 / 2.75)) {
  945.         return (7.5625 * pos * pos);
  946.       } else if (pos < (2 / 2.75)) {
  947.         return (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  948.       } else if (pos < (2.5 / 2.75)) {
  949.         return (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  950.       } else {
  951.         return (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  952.       }
  953.     },
  954.  
  955.     bouncePast: function (pos) {
  956.       if (pos < (1 / 2.75)) {
  957.         return (7.5625 * pos * pos);
  958.       } else if (pos < (2 / 2.75)) {
  959.         return 2 - (7.5625 * (pos -= (1.5 / 2.75)) * pos + 0.75);
  960.       } else if (pos < (2.5 / 2.75)) {
  961.         return 2 - (7.5625 * (pos -= (2.25 / 2.75)) * pos + 0.9375);
  962.       } else {
  963.         return 2 - (7.5625 * (pos -= (2.625 / 2.75)) * pos + 0.984375);
  964.       }
  965.     },
  966.  
  967.     easeFromTo: function (pos) {
  968.       if ((pos /= 0.5) < 1) return 0.5 * Math.pow(pos, 4);
  969.       return -0.5 * ((pos -= 2) * Math.pow(pos, 3) - 2);
  970.     },
  971.  
  972.     easeFrom: function (pos) {
  973.       return Math.pow(pos, 4);
  974.     },
  975.  
  976.     easeTo: function (pos) {
  977.       return Math.pow(pos, 0.25);
  978.     }
  979.   };
  980.  
  981. })();

Ticker.zip

7.3 KB, 下载次数: 9

最佳答案

查看完整内容

除了 window_base 的参数变了以外,commandXXX 的参数也变了,params 从函数参数里传了。

Lv4.逐梦者

梦石
0
星屑
9617
在线时间
566 小时
注册时间
2017-9-28
帖子
208
2
发表于 2022-3-5 12:19:10 | 只看该作者
Ticker.zip (7.04 KB, 下载次数: 9) 除了 window_base 的参数变了以外,commandXXX 的参数也变了,params 从函数参数里传了。
喵喵喵
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9617
在线时间
566 小时
注册时间
2017-9-28
帖子
208
3
发表于 2022-3-6 10:39:27 | 只看该作者
随手修了几个地方,可能还有没修的: Ticker.zip (7.22 KB, 下载次数: 12)

diff:

DIFF 代码复制
  1. --- "a/Ticker.js"
  2. +++ b/Ticker.js
  3. @@ -4,6 +4,7 @@
  4.   *---------------------------------------------------------------------------*/
  5.  
  6. /*:
  7. + * @target MZ
  8.   * @plugindesc ティッカープラグイン
  9.   * @author kido0617
  10.   * @help
  11. @@ -575,7 +576,7 @@
  12.    Window_Ticker.prototype.constructor = Window_Ticker;
  13.  
  14.    Window_Ticker.prototype.initialize = function (text, x, y, width, height, addPlus) {
  15. -    Window_Base.prototype.initialize.call(this, x, y, width, height);
  16. +    Window_Base.prototype.initialize.call(this, new Rectangle(x, y, width, height));
  17.      this.opacity = 0;
  18.      this.contentsOpacity = 0;
  19.      this.addPlus = addPlus;
  20. @@ -586,8 +587,13 @@
  21.      return $gameSystem.ticker.fontSize + 8;
  22.    };
  23. -  Window_Ticker.prototype.standardPadding = function () {
  24. -    return 0;
  25. +  Window_Ticker.prototype.updatePadding = function () {
  26. +    this.padding = 0;
  27. +  };
  28. +
  29. +  Window_Ticker.prototype.resetFontSettings = function () {
  30. +    Window_Base.prototype.resetFontSettings.apply(this, arguments);
  31. +    this.contents.fontSize = this.standardFontSize();
  32.    };
  33.  
  34.    Window_Ticker.prototype.standardFontSize = function () {
喵喵喵
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
578
在线时间
158 小时
注册时间
2020-10-11
帖子
38
4
 楼主| 发表于 2022-3-7 03:58:14 | 只看该作者
hyrious 发表于 2022-3-6 10:39
随手修了几个地方,可能还有没修的:

diff:

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


进入战斗也会报错,


但是依旧万分感谢,

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

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

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

点评

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-11 18:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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