查看: 3619|回复: 4

[已经过期] 关于“选项”菜单能否自定义项目?

[复制链接]
梦石
0
星屑
1336
在线时间
158 小时
注册时间
2006-2-12
回帖
157
发表于 2016-8-23 17:38:51 | 显示全部楼层 |阅读模式

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

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

×
有什么办法或者脚本插件能更改“选项”里面的具体项目,比如选项中默认有:指令记忆、始终冲刺、BGM、SE、ME、BGS音量,我可以更改为只有BGM音量和SE音量这两项吗?又或者我是否能能添加几项功能?
梦石
0
星屑
311
在线时间
204 小时
注册时间
2007-2-4
回帖
1772
发表于 2016-8-23 19:33:33 | 显示全部楼层
本帖最后由 玄天 于 2016-8-23 19:41 编辑

原地址:https://raw.githubusercontent.co ... izeConfigDefault.js

  1. //=============================================================================
  2. // CustomizeConfigDefault.js
  3. // ----------------------------------------------------------------------------
  4. // Copyright (c) 2015 Triacontane
  5. // This plugin is released under the MIT License.
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. // ----------------------------------------------------------------------------
  8. // Version
  9. // 1.1.0 2016/08/01 項目自体を非表示にする機能を追加しました。
  10. // 1.0.3 2016/06/22 多言語対応
  11. // 1.0.2 2016/01/17 競合対策
  12. // 1.0.1 2015/11/01 既存コードの再定義方法を修正(内容に変化なし)
  13. // 1.0.0 2015/11/01 初版
  14. // ----------------------------------------------------------------------------
  15. // [Blog]   : [url]http://triacontane.blogspot.jp/[/url]
  16. // [Twitter]: [url]https://twitter.com/triacontane/[/url]
  17. // [GitHub] : [url]https://github.com/triacontane/[/url]
  18. //=============================================================================

  19. /*:
  20. * @plugindesc Setting default value for Options
  21. * @author triacontane
  22. *
  23. * @param AlwaysDash
  24. * @desc Always dash(ON/OFF)
  25. * @default OFF
  26. *
  27. * @param CommandRemember
  28. * @desc Command remember(ON/OFF)
  29. * @default OFF
  30. *
  31. * @param BgmVolume
  32. * @desc BGM Volume(0-100)
  33. * @default 100
  34. *
  35. * @param BgsVolume
  36. * @desc BGS Volume(0-100)
  37. * @default 100
  38. *
  39. * @param MeVolume
  40. * @desc ME Volume(0-100)
  41. * @default 100
  42. *
  43. * @param SeVolume
  44. * @desc SE Volume(0-100)
  45. * @default 100
  46. *
  47. * @param EraseAlwaysDash
  48. * @desc Erase AlwaysDash Option(ON/OFF)
  49. * @default OFF
  50. *
  51. * @param EraseCommandRemember
  52. * @desc Erase CommandRemember Option(ON/OFF)
  53. * @default OFF
  54. *
  55. * @param EraseBgmVolume
  56. * @desc Erase BgmVolume Option(ON/OFF)
  57. * @default OFF
  58. *
  59. * @param EraseBgsVolume
  60. * @desc Erase BgsVolume Option(ON/OFF)
  61. * @default OFF
  62. *
  63. * @param EraseMeVolume
  64. * @desc Erase MeVolume Option(ON/OFF)
  65. * @default OFF
  66. *
  67. * @param EraseSeVolume
  68. * @desc Erase SeVolume Option(ON/OFF)
  69. * @default OFF
  70. *
  71. * @help Setting default value for Options.
  72. *
  73. * This plugin is released under the MIT License.
  74. */
  75. /*:ja
  76. * @plugindesc オプションデフォルト値設定プラグイン
  77. * @author トリアコンタン
  78. *
  79. * @param 常時ダッシュ
  80. * @desc 常にダッシュする。(Shiftキーを押している場合のみ歩行)(ON/OFF)
  81. * @default OFF
  82. *
  83. * @param コマンド記憶
  84. * @desc 選択したコマンドを記憶する。(ON/OFF)
  85. * @default OFF
  86. *
  87. * @param BGM音量
  88. * @desc BGMの音量。0-100
  89. * @default 100
  90. *
  91. * @param BGS音量
  92. * @desc BGSの音量。0-100
  93. * @default 100
  94. *
  95. * @param ME音量
  96. * @desc MEの音量。0-100
  97. * @default 100
  98. *
  99. * @param SE音量
  100. * @desc SEの音量。0-100
  101. * @default 100
  102. *
  103. * @param 常時ダッシュ消去
  104. * @desc 常時ダッシュの項目を非表示にする。(ON/OFF)
  105. * @default OFF
  106. *
  107. * @param コマンド記憶消去
  108. * @desc コマンド記憶の項目を非表示にする。(ON/OFF)
  109. * @default OFF
  110. *
  111. * @param BGM音量消去
  112. * @desc BGM音量の項目を非表示にする。(ON/OFF)
  113. * @default OFF
  114. *
  115. * @param BGS音量消去
  116. * @desc BGS音量の項目を非表示にする。(ON/OFF)
  117. * @default OFF
  118. *
  119. * @param ME音量消去
  120. * @desc ME音量の項目を非表示にする。(ON/OFF)
  121. * @default OFF
  122. *
  123. * @param SE音量消去
  124. * @desc SE音量の項目を非表示にする。(ON/OFF)
  125. * @default OFF
  126. *
  127. * @help オプション画面で設定可能な項目のデフォルト値を指定した値に変更します。
  128. * 例えば、初回から常時ダッシュをONにしておけば
  129. * プレイヤーが設定を変更する手間を省くことができます。
  130. * この処理はconfig.rpgsaveが未作成の場合にのみ実行されます。
  131. *
  132. * また、項目そのものを消去することもできます。
  133. * 例えば、戦闘がないゲームでは「コマンド記憶」等は不要なので消去できます。
  134. *
  135. * このプラグインにはプラグインコマンドはありません。
  136. *
  137. * 利用規約:
  138. *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
  139. *  についても制限はありません。
  140. *  このプラグインはもうあなたのものです。
  141. */
  142. (function() {
  143.     'use strict';
  144.     var pluginName = 'CustomizeConfigDefault';

  145.     var getParamNumber = function(paramNames, min, max) {
  146.         var value = getParamOther(paramNames);
  147.         if (arguments.length < 2) min = -Infinity;
  148.         if (arguments.length < 3) max = Infinity;
  149.         return (parseInt(value, 10) || 0).clamp(min, max);
  150.     };

  151.     var getParamBoolean = function(paramNames) {
  152.         var value = getParamOther(paramNames);
  153.         return (value || '').toUpperCase() === 'ON';
  154.     };

  155.     var getParamOther = function(paramNames) {
  156.         if (!Array.isArray(paramNames)) paramNames = [paramNames];
  157.         for (var i = 0; i < paramNames.length; i++) {
  158.             var name = PluginManager.parameters(pluginName)[paramNames[i]];
  159.             if (name) return name;
  160.         }
  161.         return null;
  162.     };

  163.     //=============================================================================
  164.     // パラメータの取得と整形
  165.     //=============================================================================
  166.     var paramAlwaysDash           = getParamBoolean(['AlwaysDash', '常時ダッシュ']);
  167.     var paramCommandRemember      = getParamBoolean(['CommandRemember', 'コマンド記憶']);
  168.     var paramBgmVolume            = getParamNumber(['BgmVolume', 'BGM音量'], 0, 100);
  169.     var paramBgsVolume            = getParamNumber(['BgsVolume', 'BGS音量'], 0, 100);
  170.     var paramMeVolume             = getParamNumber(['MeVolume', 'ME音量'], 0, 100);
  171.     var paramSeVolume             = getParamNumber(['SeVolume', 'SE音量'], 0, 100);
  172.     var paramEraseAlwaysDash      = getParamBoolean(['EraseAlwaysDash', '常時ダッシュ消去']);
  173.     var paramEraseCommandRemember = getParamBoolean(['EraseCommandRemember', 'コマンド記憶消去']);
  174.     var paramEraseBgmVolume       = getParamBoolean(['EraseBgmVolume', 'BGM音量消去']);
  175.     var paramEraseBgsVolume       = getParamBoolean(['EraseBgsVolume', 'BGS音量消去']);
  176.     var paramEraseMeVolume        = getParamBoolean(['EraseMeVolume', 'ME音量消去']);
  177.     var paramEraseSeVolume        = getParamBoolean(['EraseSeVolume', 'SE音量消去']);

  178.     //=============================================================================
  179.     // ConfigManager
  180.     //  それぞれの項目に初期値を与えます。
  181.     //=============================================================================
  182.     var _ConfigManagerApplyData = ConfigManager.applyData;
  183.     ConfigManager.applyData     = function(config) {
  184.         _ConfigManagerApplyData.apply(this, arguments);
  185.         if (config.alwaysDash == null)      this.alwaysDash = paramAlwaysDash;
  186.         if (config.commandRemember == null) this.commandRemember = paramCommandRemember;
  187.         if (config.bgmVolume == null)       this.bgmVolume = paramBgmVolume;
  188.         if (config.bgsVolume == null)       this.bgsVolume = paramBgsVolume;
  189.         if (config.meVolume == null)        this.meVolume = paramMeVolume;
  190.         if (config.seVolume == null)        this.seVolume = paramSeVolume;
  191.     };

  192.     //=============================================================================
  193.     // Window_Options
  194.     //  パラメータを空白にした項目を除去します。
  195.     //=============================================================================
  196.     var _Window_Options_makeCommandList = Window_Options.prototype.makeCommandList;
  197.     Window_Options.prototype.makeCommandList = function() {
  198.         _Window_Options_makeCommandList.apply(this, arguments);
  199.         if (paramEraseAlwaysDash) this.eraseOption('alwaysDash');
  200.         if (paramEraseCommandRemember) this.eraseOption('commandRemember');
  201.         if (paramEraseBgmVolume) this.eraseOption('bgmVolume');
  202.         if (paramEraseBgsVolume) this.eraseOption('bgsVolume');
  203.         if (paramEraseMeVolume) this.eraseOption('meVolume');
  204.         if (paramEraseSeVolume) this.eraseOption('seVolume');
  205.     };

  206.     Window_Options.prototype.eraseOption = function(symbol) {
  207.         for (var i = 0; i < this._list.length; i++) {
  208.             if (this._list[i].symbol === symbol) {
  209.                 this._list.splice(i, 1);
  210.                 break;
  211.             }
  212.         }
  213.     };
  214. })();
复制代码
新しい誕生祝いだッ!
回复 1 0

使用道具 举报

梦石
0
星屑
1336
在线时间
158 小时
注册时间
2006-2-12
回帖
157
 楼主| 发表于 2016-8-23 22:07:06 | 显示全部楼层
玄天 发表于 2016-8-23 19:33
原地址:https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/CustomizeConfigDefault.js

/ ...

谢谢!这个插件能够去除部分原有选项,那请问如何能增加我所需要的内容呢?
回复

使用道具 举报

梦石
0
星屑
311
在线时间
204 小时
注册时间
2007-2-4
回帖
1772
发表于 2016-8-23 22:09:16 | 显示全部楼层
douqunbo 发表于 2016-8-23 22:07
谢谢!这个插件能够去除部分原有选项,那请问如何能增加我所需要的内容呢? ...

同一个作者早就想到了。

  1. //=============================================================================
  2. // CustomizeConfigItem.js
  3. // ----------------------------------------------------------------------------
  4. // Copyright (c) 2015 Triacontane
  5. // This software is released under the MIT License.
  6. // [url]http://opensource.org/licenses/mit-license.php[/url]
  7. // ----------------------------------------------------------------------------
  8. // Version
  9. // 1.1.1 2016/08/14 スイッチ項目、音量項目の初期値が無効になっていた問題を修正
  10. // 1.1.0 2016/04/29 項目をクリックしたときに項目値が循環するよう修正
  11. // 1.0.0 2016/01/17 初版
  12. // ----------------------------------------------------------------------------
  13. // [Blog]   : [url]http://triacontane.blogspot.jp/[/url]
  14. // [Twitter]: [url]https://twitter.com/triacontane/[/url]
  15. // [GitHub] : [url]https://github.com/triacontane/[/url]
  16. //=============================================================================

  17. /*:ja
  18. * @plugindesc オプション任意項目作成プラグイン
  19. * @author トリアコンタン
  20. *
  21. * 項目を増やしたい場合は、以下をコピーしてください。
  22. * -------------------------------------------------------
  23. * @param スイッチ項目1
  24. * @desc 項目の情報です。以下の順で指定します。
  25. * 名称,初期値(ON/OFF),スイッチ番号,隠しフラグ
  26. * @default スイッチ項目1:OFF:0:OFF
  27. *
  28. * @param 数値項目1
  29. * @desc 項目の情報です。以下の順で指定します。
  30. * 名称:初期値(数値):変数番号:隠しフラグ:最小値:最大値:変化値
  31. * @default 数値項目1:0:0:OFF:0:10:1
  32. *
  33. * @param 音量項目1
  34. * @desc 項目の情報です。以下の順で指定します。
  35. * 名称:初期値(数値(0...100)):変数番号:隠しフラグ
  36. * @default 音量項目1:0:0:OFF
  37. *
  38. * @param 文字項目1
  39. * @desc 項目の情報です。以下の順で指定します。
  40. * 名称:初期値(Index(数値)):変数番号:隠しフラグ:文字の配列
  41. * @default 文字項目1:0:0:OFF:EASY, NORMAL, HARD, VERY HARD
  42. *
  43. * @param スイッチ項目2
  44. * @desc 項目の情報です。以下の順で指定します。
  45. * 名称,初期値(ON/OFF),スイッチ番号,隠しフラグ
  46. * @default スイッチ項目2:OFF:0:OFF
  47. *
  48. * @param 数値項目2
  49. * @desc 項目の情報です。以下の順で指定します。
  50. * 名称:初期値(数値):変数番号:隠しフラグ:最小値:最大値:変化値
  51. * @default 数値項目2:0:0:OFF:0:10:1
  52. *
  53. * @param 音量項目2
  54. * @desc 項目の情報です。以下の順で指定します。
  55. * 名称:初期値(数値(0...100)):変数番号:隠しフラグ
  56. * @default 音量項目2:0:0:OFF
  57. *
  58. * @param 文字項目2
  59. * @desc 項目の情報です。以下の順で指定します。
  60. * 名称:初期値(Index(数値)):変数番号:隠しフラグ:文字の配列
  61. * @default 文字項目2:0:0:OFF:EASY, NORMAL, HARD, VERY HARD
  62. * --------------------------------------------------------
  63. *
  64. * @help オプション画面に任意の項目を追加します。
  65. * 項目の種類は、以下の四種類があります。
  66. * 不要な項目は値を空に設定してください。
  67. *
  68. * ・スイッチ項目:
  69. * ON/OFFを選択する項目です。指定した番号のスイッチと値が同期されます。
  70. * オプションから値を設定すれば、それがスイッチに反映され、
  71. * スイッチを変更すれば、オプションの値に反映されます。
  72. * さらに、値はセーブデータ間で共有されます。
  73. * 隠しフラグを設定すると、オプション画面に表示されなくなります。
  74. * ゲームを進めないと出現しない項目などに利用できます。
  75. * 隠しフラグはプラグインコマンドから解除できます。
  76. * それぞれの値はコロン(:)区切りで指定してください。
  77. *
  78. * 指定項目「名称:初期値:値が設定されるスイッチ:隠しフラグ」
  79. * 例:スイッチ項目1:OFF:1:OFF
  80. *
  81. * ・数値項目:
  82. * 数値を選択する項目です。指定した番号の変数と値が同期されます。
  83. * スイッチ項目で指定した内容に加えて、
  84. * 最小値と最大値および一回の入力で変化する値を指定します。
  85. *
  86. * 指定項目「名称:初期値:値が設定される変数:隠しフラグ:最小値:最大値:変化値」
  87. * 例:数値項目1:0:1:OFF:0:10:1
  88. *
  89. * ・音量項目:
  90. * 音量を選択する項目です。BGMボリュームなどと同じ仕様で
  91. * キャラクターごとのボイス音量等に使ってください。
  92. *
  93. * 指定項目「名称:初期値:値が設定される変数:隠しフラグ」
  94. * 例:音量項目1:0:2:OFF
  95. *
  96. * ・文字項目:
  97. * 文字を選択する項目です。指定した文字の配列から項目を選択します。
  98. * 選択した文字のインデックス(開始位置は0)が変数に設定されます。
  99. * 初期値に設定する値もインデックスです。
  100. *
  101. * 設定項目「名称:初期値:値が設定される変数:隠しフラグ:文字の配列」
  102. * 例:文字項目1:0:3:OFF:EASY, NORMAL, HARD, VERY HARD
  103. *
  104. * プラグインコマンド詳細
  105. *  イベントコマンド「プラグインコマンド」から実行。
  106. *  (パラメータの間は半角スペースで区切る)
  107. *
  108. *  CC_UNLOCK or
  109. *  オプション任意項目の隠し解除 [項目名]
  110. *   指定した項目の隠しフラグを解除します。
  111. *  使用例:CC_ITEM_VALID 数値項目1
  112. *
  113. * 利用規約:
  114. *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
  115. *  についても制限はありません。
  116. *  このプラグインはもうあなたのものです。
  117. */

  118. (function () {
  119.     'use strict';
  120.     var pluginName = 'CustomizeConfigItem';

  121.     var getParamString = function(paramNames) {
  122.         var value = getParamOther(paramNames);
  123.         return value == null ? '' : value;
  124.     };

  125.     var getParamOther = function(paramNames) {
  126.         if (!Array.isArray(paramNames)) paramNames = [paramNames];
  127.         for (var i = 0; i < paramNames.length; i++) {
  128.             var name = PluginManager.parameters(pluginName)[paramNames[i]];
  129.             if (name) return name;
  130.         }
  131.         return null;
  132.     };

  133.     var getCommandName = function (command) {
  134.         return (command || '').toUpperCase();
  135.     };

  136.     var getArgArrayString = function (args, upperFlg) {
  137.         var values = getArgString(args, upperFlg).split(',');
  138.         for (var i = 0; i < values.length; i++) values[i] = values[i].trim();
  139.         return values;
  140.     };

  141.     var getArgString = function (args, upperFlg) {
  142.         return upperFlg ? args.toUpperCase() : args;
  143.     };

  144.     var getArgNumber = function (arg, min, max) {
  145.         if (arguments.length < 2) min = -Infinity;
  146.         if (arguments.length < 3) max = Infinity;
  147.         return (parseInt(arg, 10) || 0).clamp(min, max);
  148.     };

  149.     var getArgBoolean = function(arg) {
  150.         return (arg || '').toUpperCase() == 'ON';
  151.     };

  152.     if (!Object.prototype.hasOwnProperty('iterate')) {
  153.         Object.defineProperty(Object.prototype, 'iterate', {
  154.             value : function (handler) {
  155.                 Object.keys(this).forEach(function (key, index) {
  156.                     handler.call(this, key, this[key], index);
  157.                 }, this);
  158.             }
  159.         });
  160.     }

  161.     //=============================================================================
  162.     // Game_Interpreter
  163.     //  プラグインコマンドを追加定義します。
  164.     //=============================================================================
  165.     var _Game_Interpreter_pluginCommand      = Game_Interpreter.prototype.pluginCommand;
  166.     Game_Interpreter.prototype.pluginCommand = function (command, args) {
  167.         _Game_Interpreter_pluginCommand.call(this, command, args);
  168.         try {
  169.             this.pluginCommandCustomizeConfigItem(command, args);
  170.         } catch (e) {
  171.             if ($gameTemp.isPlaytest() && Utils.isNwjs()) {
  172.                 var window = require('nw.gui').Window.get();
  173.                 if (!window.isDevToolsOpen()) {
  174.                     var devTool = window.showDevTools();
  175.                     devTool.moveTo(0, 0);
  176.                     devTool.resizeTo(Graphics.width, Graphics.height);
  177.                     window.focus();
  178.                 }
  179.             }
  180.             console.log('プラグインコマンドの実行中にエラーが発生しました。');
  181.             console.log('- コマンド名  : ' + command);
  182.             console.log('- コマンド引数 : ' + args);
  183.             console.log('- エラー原因   : ' + e.toString());
  184.         }
  185.     };

  186.     Game_Interpreter.prototype.pluginCommandCustomizeConfigItem = function (command, args) {
  187.         switch (getCommandName(command)) {
  188.             case 'CC_UNLOCK' :
  189.             case 'オプション任意項目の隠し解除' :
  190.                 ConfigManager.customParamUnlock(args[0]);
  191.                 break;
  192.         }
  193.     };

  194.     //=============================================================================
  195.     // ConfigManager
  196.     //  追加項目の設定値や初期値を管理します。
  197.     //=============================================================================
  198.     ConfigManager.customParams = null;
  199.     ConfigManager.hiddenInfo = {};

  200.     ConfigManager.getCustomParams = function() {
  201.         if (this.customParams != null) return this.customParams;
  202.         this.customParams = {};
  203.         var i, result;
  204.         for (i = 1, result = true; result; i++) {
  205.             result = this._getCustomParamItem('スイッチ項目', 'Boolean', i);
  206.         }
  207.         for (i = 1, result = true; result; i++) {
  208.             result = this._getCustomParamItem('数値項目', 'Number', i);
  209.         }
  210.         for (i = 1, result = true; result; i++) {
  211.             result = this._getCustomParamItem('音量項目', 'Volume', i);
  212.         }
  213.         for (i = 1, result = true; result; i++) {
  214.             result = this._getCustomParamItem('文字項目', 'String', i);
  215.         }
  216.         return this.customParams;
  217.     };

  218.     ConfigManager._getCustomParamItem = function(paramBaseName, symbolType, i) {
  219.         var param = getParamString(paramBaseName + '%1'.format(i)).split(':');
  220.         if (param.length > 1) {
  221.             try {
  222.                 var data        = {};
  223.                 data.symbol     = symbolType + '%1'.format(i);
  224.                 data.name       = getArgString(param[0]);
  225.                 data.initValue  = symbolType === 'Boolean' ? getArgBoolean(param[1]) : getArgNumber(param[1]);
  226.                 data.variable   = getArgNumber(param[2]);
  227.                 data.hidden     = getArgBoolean(param[3]);
  228.                 switch (symbolType) {
  229.                     case 'Number':
  230.                         data.min    = getArgNumber(param[4]);
  231.                         data.max    = getArgNumber(param[5]);
  232.                         data.offset = getArgNumber(param[6]);
  233.                         break;
  234.                     case 'String':
  235.                         data.values = getArgArrayString(param[4]);
  236.                         data.min    = 0;
  237.                         data.max    = data.values.length - 1;
  238.                         break;
  239.                 }
  240.                 this.customParams[data.symbol] = data;
  241.             } catch (e) {
  242.                 console.log('パラメータの指定に不正があります。: ' + param + ' : ' + e.toString());
  243.                 return false;
  244.             }
  245.             return true;
  246.         }
  247.         return false;
  248.     };

  249.     var _ConfigManager_makeData = ConfigManager.makeData;
  250.     ConfigManager.makeData = function() {
  251.         var config = _ConfigManager_makeData.apply(this, arguments);
  252.         config.hiddenInfo = {};
  253.         this.getCustomParams().iterate(function(symbol) {
  254.             config[symbol] = this[symbol];
  255.             config.hiddenInfo[symbol] = this.hiddenInfo[symbol];
  256.         }.bind(this));
  257.         return config;
  258.     };

  259.     var _ConfigManager_applyData = ConfigManager.applyData;
  260.     ConfigManager.applyData = function(config) {
  261.         _ConfigManager_applyData.apply(this, arguments);
  262.         this.getCustomParams().iterate(function(symbol, item) {
  263.             if (symbol.contains('Boolean')) {
  264.                 this[symbol] = this.readFlagCustom(config, symbol, item);
  265.             } else if (symbol.contains('Volume')) {
  266.                 this[symbol] = this.readVolumeCustom(config, symbol, item);
  267.             } else {
  268.                 this[symbol] = this.readOther(config, symbol, item);
  269.             }
  270.             this.hiddenInfo[symbol] = (config.hiddenInfo != null ? config.hiddenInfo[symbol] : item.hidden);
  271.         }.bind(this));
  272.     };

  273.     ConfigManager.customParamUnlock = function(name) {
  274.         this.getCustomParams().iterate(function(symbol, item) {
  275.             if (item.name === name) this.hiddenInfo[symbol] = false;
  276.         }.bind(this));
  277.         this.save();
  278.     };

  279.     ConfigManager.readOther = function(config, name, item) {
  280.         var value = config[name];
  281.         if (value !== undefined) {
  282.             return Number(value).clamp(item.min, item.max);
  283.         } else {
  284.             return item.initValue;
  285.         }
  286.     };

  287.     ConfigManager.readFlagCustom = function(config, name, item) {
  288.         if (config[name] !== undefined) {
  289.             return this.readFlag(config, name);
  290.         } else {
  291.             return item.initValue;
  292.         }
  293.     };

  294.     ConfigManager.readVolumeCustom = function(config, name, item) {
  295.         if (config[name] !== undefined) {
  296.             return this.readVolume(config, name);
  297.         } else {
  298.             return item.initValue;
  299.         }
  300.     };

  301.     ConfigManager.exportCustomParams = function() {
  302.         if (!$gameVariables || !$gameSwitches) return;
  303.         this.getCustomParams().iterate(function(symbol, item) {
  304.             if (item.variable > 0) {
  305.                 if (symbol.contains('Boolean')) {
  306.                     $gameSwitches.setValue(item.variable, !!this[symbol]);
  307.                 } else {
  308.                     $gameVariables.setValue(item.variable, this[symbol]);
  309.                 }
  310.             }
  311.         }.bind(this));
  312.     };

  313.     ConfigManager.importCustomParams = function() {
  314.         if (!$gameVariables || !$gameSwitches) return;
  315.         this.getCustomParams().iterate(function(symbol, item) {
  316.             if (item.variable > 0) {
  317.                 if (symbol.contains('Boolean')) {
  318.                     this[symbol] = $gameSwitches.value(item.variable);
  319.                 } else if (symbol.contains('Volume')) {
  320.                     this[symbol] = $gameVariables.value(item.variable).clamp(0, 100);
  321.                 } else {
  322.                     this[symbol] = $gameVariables.value(item.variable).clamp(item.min, item.max);
  323.                 }
  324.             }
  325.         }.bind(this));
  326.     };

  327.     var _ConfigManager_save = ConfigManager.save;
  328.     ConfigManager.save = function() {
  329.         _ConfigManager_save.apply(this, arguments);
  330.         this.exportCustomParams();
  331.     };

  332.     //=============================================================================
  333.     // Game_Map
  334.     //  リフレッシュ時にオプション値を同期します。
  335.     //=============================================================================
  336.     var _Game_Map_refresh = Game_Map.prototype.refresh;
  337.     Game_Map.prototype.refresh = function() {
  338.         _Game_Map_refresh.apply(this, arguments);
  339.         ConfigManager.importCustomParams();
  340.     };

  341.     //=============================================================================
  342.     // DataManager
  343.     //  セーブ時とロード時にオプション値を同期します。
  344.     //=============================================================================
  345.     var _DataManager_setupNewGame = DataManager.setupNewGame;
  346.     DataManager.setupNewGame = function() {
  347.         _DataManager_setupNewGame.apply(this, arguments);
  348.         ConfigManager.exportCustomParams();
  349.     };

  350.     var _DataManager_loadGameWithoutRescue = DataManager.loadGameWithoutRescue;
  351.     DataManager.loadGameWithoutRescue = function(savefileId) {
  352.         var result = _DataManager_loadGameWithoutRescue.apply(this, arguments);
  353.         ConfigManager.exportCustomParams();
  354.         return result;
  355.     };

  356.     //=============================================================================
  357.     // Window_Options
  358.     //  追加項目を描画します。
  359.     //=============================================================================
  360.     var _Window_Options_initialize = Window_Options.prototype.initialize;
  361.     Window_Options.prototype.initialize = function() {
  362.         this._customParams = ConfigManager.getCustomParams();
  363.         _Window_Options_initialize.apply(this, arguments);
  364.     };

  365.     var _Window_Options_makeCommandList = Window_Options.prototype.makeCommandList;
  366.     Window_Options.prototype.makeCommandList = function() {
  367.         _Window_Options_makeCommandList.apply(this, arguments);
  368.         this.addCustomOptions();
  369.     };

  370.     Window_Options.prototype.addCustomOptions = function() {
  371.         this._customParams.iterate(function(key, item) {
  372.             if (!ConfigManager.hiddenInfo[key]) this.addCommand(item.name, key);
  373.         }.bind(this));
  374.     };

  375.     var _Window_Options_statusText = Window_Options.prototype.statusText;
  376.     Window_Options.prototype.statusText = function(index) {
  377.         var result = _Window_Options_statusText.apply(this, arguments);
  378.         var symbol = this.commandSymbol(index);
  379.         var value  = this.getConfigValue(symbol);
  380.         if (this.isNumberSymbol(symbol)) {
  381.             result = this.numberStatusText(value);
  382.         } else if (this.isStringSymbol(symbol)) {
  383.             result = this.stringStatusText(value, symbol);
  384.         }
  385.         return result;
  386.     };

  387.     Window_Options.prototype.isNumberSymbol = function(symbol) {
  388.         return symbol.contains('Number');
  389.     };

  390.     Window_Options.prototype.isStringSymbol = function(symbol) {
  391.         return symbol.contains('String');
  392.     };

  393.     Window_Options.prototype.numberStatusText = function(value) {
  394.         return value;
  395.     };

  396.     Window_Options.prototype.stringStatusText = function(value, symbol) {
  397.         return this._customParams[symbol].values[value];
  398.     };

  399.     var _Window_Options_processOk = Window_Options.prototype.processOk;
  400.     Window_Options.prototype.processOk = function() {
  401.         if (!this._shiftValue(1, true)) _Window_Options_processOk.apply(this, arguments);
  402.     };

  403.     var _Window_Options_cursorRight = Window_Options.prototype.cursorRight;
  404.     Window_Options.prototype.cursorRight = function(wrap) {
  405.         if (!this._shiftValue(1, false)) _Window_Options_cursorRight.apply(this, arguments);
  406.     };

  407.     var _Window_Options_cursorLeft = Window_Options.prototype.cursorLeft;
  408.     Window_Options.prototype.cursorLeft = function(wrap) {
  409.         if (!this._shiftValue(-1, false)) _Window_Options_cursorLeft.apply(this, arguments);
  410.     };

  411.     Window_Options.prototype._shiftValue = function(sign, loopFlg) {
  412.         var symbol = this.commandSymbol(this.index());
  413.         var value = this.getConfigValue(symbol);
  414.         if (this.isNumberSymbol(symbol)) {
  415.             value += this.numberOffset(symbol) * sign;
  416.             this.changeValue(symbol, this._clampValue(value, symbol, loopFlg));
  417.             return true;
  418.         }
  419.         if (this.isStringSymbol(symbol)) {
  420.             value += sign;
  421.             this.changeValue(symbol, this._clampValue(value, symbol, loopFlg));
  422.             return true;
  423.         }
  424.         return false;
  425.     };

  426.     Window_Options.prototype._clampValue = function(value, symbol, loopFlg) {
  427.         var maxValue = this._customParams[symbol].max;
  428.         var minValue = this._customParams[symbol].min;
  429.         if (loopFlg) {
  430.             if (value > maxValue) value = minValue;
  431.             if (value < minValue) value = maxValue;
  432.         }
  433.         return value.clamp(this._customParams[symbol].min, this._customParams[symbol].max);
  434.     };

  435.     Window_Options.prototype.numberOffset = function(symbol) {
  436.         var value = this._customParams[symbol].offset;
  437.         if (Input.isPressed('shift')) value *= 10;
  438.         return value;
  439.     };

  440.     Window_Options.prototype.windowHeight = function() {
  441.         return this.fittingHeight(Math.min(this.numVisibleRows(), 14));
  442.     };
  443. })();
复制代码
新しい誕生祝いだッ!
回复 1 0

使用道具 举报

梦石
0
星屑
3930
在线时间
1198 小时
注册时间
2016-8-9
回帖
2355

开拓者

发表于 2017-1-6 16:45:39 | 显示全部楼层
玄天 发表于 2016-8-23 22:09
同一个作者早就想到了。

//======================================================================== ...

不好意思挖坟了,请教大神:
item这个插件下载下来安装后,不显示任何文字,检查了下的确是utf-8,不知何故,求指点!
酸酸甜甜就④哇噢
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部