//============================================================================= // TimerCountInMenu.js // ---------------------------------------------------------------------------- // (C)2017 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.1.0 2024/07/14 MZで動作するようリファクタリング // 1.0.1 2017/08/04 画面キャプチャにタイマー画像が含まれないよう修正 // 1.0.0 2017/08/03 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/TimerCountInMenu.js @plugindesc Timer count plugin on the menu screen @author Triacontane @license MIT License @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/triacontane-MZ-plugins ). Original plugin by Triacontane. Please check the latest official version at: https://triacontane.blogspot.com ----- TimerCountInMenu.js This plugin will count down the timer on the menu screen and shop screen. You can specify whether or not this will occur on each screen using parameters. You can also move to the map screen when the timer expires. Terms of Use: You may modify and redistribute this plugin without permission from the author, and there are no restrictions on its use (commercial, 18+, etc.). This plugin is now yours. @param behaviorInMenu @text Works on the menu screen @desc The timer runs on the menu screen and on subsequent screens. @type boolean @default true @param behaviorInNameInput @text Works on the name input screen @desc Start the timer on the name entry screen. @type boolean @default true @param behaviorInShop @text Works on the shop screen @desc Activate the timer on the shop screen. @type boolean @default true @param behaviorInSave @text Works on the save screen @desc Activate the timer on the save screen. @type boolean @default true @param expireToMap @text Time runs out and the map changes @desc If the time runs out, you will be forced to go to the map screen. @type boolean @default true */ /*:ja @plugindesc メニュー画面でのタイマーカウントプラグイン @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/TimerCountInMenu.js @base PluginCommonBase @orderAfter PluginCommonBase @author トリアコンタン @param behaviorInMenu @text メニュー画面で動作 @desc メニュー画面およびその先の画面でタイマーを動作させます。 @default true @type boolean @param behaviorInNameInput @text 名前入力画面で動作 @desc 名前入力画面でタイマーを動作させます。 @default true @type boolean @param behaviorInShop @text ショップ画面で動作 @desc ショップ画面でタイマーを動作させます。 @default true @type boolean @param behaviorInSave @text セーブ画面で動作 @desc セーブ画面でタイマーを動作させます。 @default true @type boolean @param expireToMap @text 時間切れでマップ移動 @desc 時間切れになった場合、強制的にマップ画面に移動します。 @default true @type boolean @help TimerCountInMenu.js メニュー画面やショップ画面でタイマーのカウントが進むようになります。 パラメータで画面ごとに動作有無を指定できます。 時間切れでマップ画面に移動することもできます。 利用規約: 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) についても制限はありません。 このプラグインはもうあなたのものです。 */ (()=> { 'use strict'; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); //============================================================================= // Scene_Base // タイマーをカウントするシーンかどうかを判定します。 //============================================================================= Scene_Base.prototype.isCountTimer = function() { return false; }; Scene_MenuBase.prototype.isCountTimer = function() { return param.behaviorInMenu; }; Scene_Name.prototype.isCountTimer = function() { return param.behaviorInNameInput; }; Scene_Shop.prototype.isCountTimer = function() { return param.behaviorInShop; }; Scene_File.prototype.isCountTimer = function() { return param.behaviorInSave; }; //============================================================================= // Scene_Map // キャプチャ作成時にタイマーを描画対象から外します。 //============================================================================= const _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function() { this._spriteset.setTimerOpacity(0); _Scene_Map_terminate.apply(this, arguments); this._spriteset.setTimerOpacity(255); }; //============================================================================= // Scene_MenuBase // タイマーをカウントするシーンの場合はタイマーを作成してカウントを進めます。 //============================================================================= const _Scene_MenuBase_create = Scene_MenuBase.prototype.create; Scene_MenuBase.prototype.create = function() { _Scene_MenuBase_create.apply(this, arguments); if (this.isCountTimer()) { this.createTimer(); } }; Scene_MenuBase.prototype.createTimer = function() { this._timerSprite = new Sprite_Timer(); this.addChild(this._timerSprite); }; const _Scene_MenuBase_update = Scene_MenuBase.prototype.update; Scene_MenuBase.prototype.update = function() { _Scene_MenuBase_update.apply(this, arguments); this.updateTimer(); }; Scene_MenuBase.prototype.updateTimer = function() { if (this.isCountTimer() && $gameTimer) { $gameTimer.update(this.isActive()); } }; //============================================================================= // Scene_Title // タイトル画面を表示するときにタイマーを初期化します。 //============================================================================= const _Scene_Title_start = Scene_Title.prototype.start; Scene_Title.prototype.start = function() { _Scene_Title_start.apply(this, arguments); if ($gameTimer) { $gameTimer.initialize(); } }; //============================================================================= // Spriteset_Base // タイマースプライトの可視状態を設定します。 //============================================================================= Spriteset_Base.prototype.setTimerOpacity = function(opacity) { this._timerSprite.opacity = opacity; }; //============================================================================= // Game_Timer // タイマーが0になったときに強制的にマップ画面に移動します。 //============================================================================= const _Game_Timer_onExpire = Game_Timer.prototype.onExpire; Game_Timer.prototype.onExpire = function() { _Game_Timer_onExpire.apply(this, arguments); if (SceneManager.isCountTimerScene() && !$gameParty.inBattle() && param.expireToMap) { SoundManager.playCancel(); SceneManager.goto(Scene_Map); } }; //============================================================================= // SceneManager // タイマーをカウントするシーンかどうかを判定します。 //============================================================================= SceneManager.isCountTimerScene = function() { return this._scene.isCountTimer(); }; })();