//============================================================================= // TMPlugin - 戻るボタン // バージョン: 1.0.0 // 最終更新日: 2016/10/28 // 配布元 : http://hikimoki.sakura.ne.jp/ //----------------------------------------------------------------------------- // Copyright (c) 2016 tomoaky // Released under the MIT license. // http://opensource.org/licenses/mit-license.php //============================================================================= /*: @plugindesc Displays a back button for tapping in the menu scene. @author tomoaky @url https://github.com/munokura/tomoaky-MV-plugins @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/tomoaky-MV-plugins ). Original plugin by tomoaky. ----- Preparation: Save the button image distributed with the plugin in the img/system folder. The file name is backButton.png. https://github.com/munokura/tomoaky-MV-plugins/tree/master/img/system If you want to use your own button image, either create one with the same name as the one above, or change the plugin parameter buttonImage. How to Use: If you install this plugin with the button image in the img/system folder, the back button will automatically be displayed. You can adjust the button's position for each scene using the plugin parameters, so change it to your liking. Transparent areas of the button image (alpha value 0) will not respond to taps. There are no plugin commands. This plugin has been tested with RPG Maker MV Version 1.3.3. @param buttonImage @desc Image to display as a button. Default: backButton @default backButton @type file @require 1 @dir img/system/ @param sceneMenuX @desc Scene_Menu back button X coordinate. Initial value: 0 @default 0 @param sceneMenuY @desc Scene_Menu back button Y coordinate. Initial value: 0 @default 0 @param sceneItemX @desc Scene_Item back button X coordinate. Initial value: 0 @default 0 @param sceneItemY @desc Back button Y coordinate of Scene_Item. Initial value: 0 @default 0 @param sceneSkillX @desc Scene_Skill back button X coordinate. Default: 0 @default 0 @param sceneSkillY @desc Scene_Skill back button Y coordinate. Default: 0 @default 0 @param sceneEquipX @desc Back button X coordinate of Scene_Equip. Default value: 0 @default 0 @param sceneEquipY @desc Back button Y coordinate of Scene_Equip. Initial value: 0 @default 0 @param sceneStatusX @desc Back button X coordinate of Scene_Status. Initial value: 0 @default 0 @param sceneStatusY @desc Back button Y coordinate of Scene_Status. Initial value: 0 @default 0 @param sceneOptionsX @desc Back button X coordinate of Scene_Options. Default value: 0 @default 0 @param sceneOptionsY @desc Back button Y coordinate of Scene_Options. Initial value: 0 @default 0 @param sceneSaveX @desc Scene_Save back button X coordinate. Default: 0 @default 0 @param sceneSaveY @desc Scene_Save back button Y coordinate. Default: 0 @default 0 @param sceneLoadX @desc Back button X coordinate of Scene_Load. Default value: 0 @default 0 @param sceneLoadY @desc Scene_Load back button Y coordinate. Default: 0 @default 0 @param sceneGameEndX @desc Scene_GameEnd back button X coordinate. Initial value: 0 @default 0 @param sceneGameEndY @desc Scene_GameEnd back button Y coordinate. Initial value: 0 @default 0 @param sceneShopX @desc Scene_Shop back button X coordinate. Initial value: 0 @default 0 @param sceneShopY @desc Scene_Shop back button Y coordinate. Initial value: 0 @default 0 @param sceneNameX @desc Back button X coordinate of Scene_Name. Default: 0 @default 0 @param sceneNameY @desc Back button Y coordinate of Scene_Name. Default: 0 @default 0 */ /*:ja @plugindesc メニューシーンにタップ操作用の戻るボタンを表示します。 @author tomoaky @url https://github.com/munokura/tomoaky-MV-plugins @license MIT License @help 準備: プラグインと一緒に配布しているボタン画像を img/system フォルダに 保存してください。ファイル名は backButton.png となっています。 オリジナルのボタン画像を使用する場合は上記ファイル名と同名のものを 用意するか、プラグインパラメータ buttonImage を変更してください。 https://github.com/munokura/tomoaky-MV-plugins/tree/master/img/system 使い方: ボタン画像を img/system フォルダ内に置いた状態で、このプラグインを 導入すれば、自動的に戻るボタンが表示されるようになります。 プラグインパラメータでボタンの表示位置をシーンごとに調節できますので お好みで変更してください。 ボタン画像の透過部分(アルファ値が 0 )はタップに反応しません。 プラグインコマンドはありません。 このプラグインは RPGツクールMV Version 1.3.3 で動作確認をしています。 @param buttonImage @desc ボタンとして表示する画像。 初期値: backButton @default backButton @type file @require 1 @dir img/system/ @param sceneMenuX @desc Scene_Menuの戻るボタンX座標。 初期値: 0 @default 0 @param sceneMenuY @desc Scene_Menuの戻るボタンY座標。 初期値: 0 @default 0 @param sceneItemX @desc Scene_Itemの戻るボタンX座標。 初期値: 0 @default 0 @param sceneItemY @desc Scene_Itemの戻るボタンY座標。 初期値: 0 @default 0 @param sceneSkillX @desc Scene_Skillの戻るボタンX座標。 初期値: 0 @default 0 @param sceneSkillY @desc Scene_Skillの戻るボタンY座標。 初期値: 0 @default 0 @param sceneEquipX @desc Scene_Equipの戻るボタンX座標。 初期値: 0 @default 0 @param sceneEquipY @desc Scene_Equipの戻るボタンY座標。 初期値: 0 @default 0 @param sceneStatusX @desc Scene_Statusの戻るボタンX座標。 初期値: 0 @default 0 @param sceneStatusY @desc Scene_Statusの戻るボタンY座標。 初期値: 0 @default 0 @param sceneOptionsX @desc Scene_Optionsの戻るボタンX座標。 初期値: 0 @default 0 @param sceneOptionsY @desc Scene_Optionsの戻るボタンY座標。 初期値: 0 @default 0 @param sceneSaveX @desc Scene_Saveの戻るボタンX座標。 初期値: 0 @default 0 @param sceneSaveY @desc Scene_Saveの戻るボタンY座標。 初期値: 0 @default 0 @param sceneLoadX @desc Scene_Loadの戻るボタンX座標。 初期値: 0 @default 0 @param sceneLoadY @desc Scene_Loadの戻るボタンY座標。 初期値: 0 @default 0 @param sceneGameEndX @desc Scene_GameEndの戻るボタンX座標。 初期値: 0 @default 0 @param sceneGameEndY @desc Scene_GameEndの戻るボタンY座標。 初期値: 0 @default 0 @param sceneShopX @desc Scene_Shopの戻るボタンX座標。 初期値: 0 @default 0 @param sceneShopY @desc Scene_Shopの戻るボタンY座標。 初期値: 0 @default 0 @param sceneNameX @desc Scene_Nameの戻るボタンX座標。 初期値: 0 @default 0 @param sceneNameY @desc Scene_Nameの戻るボタンY座標。 初期値: 0 @default 0 */ var Imported = Imported || {}; Imported.TMBackButton = true; var TMPlugin = TMPlugin || {}; TMPlugin.BackButton = {}; TMPlugin.BackButton.Parameters = PluginManager.parameters('TMBackButton'); TMPlugin.BackButton.ButtonImage = TMPlugin.BackButton.Parameters['buttonImage'] || 'backButton'; TMPlugin.BackButton.SceneMenuX = +(TMPlugin.BackButton.Parameters['sceneMenuX'] || 0); TMPlugin.BackButton.SceneMenuY = +(TMPlugin.BackButton.Parameters['sceneMenuY'] || 0); TMPlugin.BackButton.SceneItemX = +(TMPlugin.BackButton.Parameters['sceneItemX'] || 0); TMPlugin.BackButton.SceneItemY = +(TMPlugin.BackButton.Parameters['sceneItemY'] || 0); TMPlugin.BackButton.SceneSkillX = +(TMPlugin.BackButton.Parameters['sceneSkillX'] || 0); TMPlugin.BackButton.SceneSkillY = +(TMPlugin.BackButton.Parameters['sceneSkillY'] || 0); TMPlugin.BackButton.SceneEquipX = +(TMPlugin.BackButton.Parameters['sceneEquipX'] || 0); TMPlugin.BackButton.SceneEquipY = +(TMPlugin.BackButton.Parameters['sceneEquipY'] || 0); TMPlugin.BackButton.SceneStatusX = +(TMPlugin.BackButton.Parameters['sceneStatusX'] || 0); TMPlugin.BackButton.SceneStatusY = +(TMPlugin.BackButton.Parameters['sceneStatusY'] || 0); TMPlugin.BackButton.SceneOptionsX = +(TMPlugin.BackButton.Parameters['sceneOptionsX'] || 0); TMPlugin.BackButton.SceneOptionsY = +(TMPlugin.BackButton.Parameters['sceneOptionsY'] || 0); TMPlugin.BackButton.SceneSaveX = +(TMPlugin.BackButton.Parameters['sceneSaveX'] || 0); TMPlugin.BackButton.SceneSaveY = +(TMPlugin.BackButton.Parameters['sceneSaveY'] || 0); TMPlugin.BackButton.SceneLoadX = +(TMPlugin.BackButton.Parameters['sceneLoadX'] || 0); TMPlugin.BackButton.SceneLoadY = +(TMPlugin.BackButton.Parameters['sceneLoadY'] || 0); TMPlugin.BackButton.SceneGameEndX = +(TMPlugin.BackButton.Parameters['sceneGameEndX'] || 0); TMPlugin.BackButton.SceneGameEndY = +(TMPlugin.BackButton.Parameters['sceneGameEndY'] || 0); TMPlugin.BackButton.SceneShopX = +(TMPlugin.BackButton.Parameters['sceneShopX'] || 0); TMPlugin.BackButton.SceneShopY = +(TMPlugin.BackButton.Parameters['sceneShopY'] || 0); TMPlugin.BackButton.SceneNameX = +(TMPlugin.BackButton.Parameters['sceneNameX'] || 0); TMPlugin.BackButton.SceneNameY = +(TMPlugin.BackButton.Parameters['sceneNameY'] || 0); (function() { //----------------------------------------------------------------------------- // Window_Selectable // var _Window_Selectable_processTouch = Window_Selectable.prototype.processTouch; Window_Selectable.prototype.processTouch = function() { if (this.isOpenAndActive() && TouchInput.isTriggered()) { var backButton = SceneManager._scene._backButtonSprite; if (this.isCancelEnabled() && backButton && backButton.width) { var x = backButton.x; var y = backButton.y; if (TouchInput.x >= x && TouchInput.x < x + backButton.width && TouchInput.y >= y && TouchInput.y < y + backButton.height && +backButton.bitmap.getAlphaPixel(TouchInput.x - x, TouchInput.y - y) > 0) { this.processCancel(); return; } } } _Window_Selectable_processTouch.call(this); }; //----------------------------------------------------------------------------- // Scene_MenuBase // var _Scene_MenuBase_create = Scene_MenuBase.prototype.create; Scene_MenuBase.prototype.create = function() { _Scene_MenuBase_create.call(this); this.createBackButton(); }; Scene_MenuBase.prototype.createBackButton = function() { this._backButtonSprite = new Sprite(); this._backButtonSprite.bitmap = ImageManager.loadSystem(TMPlugin.BackButton.ButtonImage); this._backButtonSprite.x = this.backButtonX(); this._backButtonSprite.y = this.backButtonY(); this.addChild(this._backButtonSprite); }; Scene_MenuBase.prototype.backButtonX = function() { return 0; }; Scene_MenuBase.prototype.backButtonY = function() { return 0; }; //----------------------------------------------------------------------------- // Scene_Menu // Scene_Menu.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneMenuX; }; Scene_Menu.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneMenuY; }; //----------------------------------------------------------------------------- // Scene_Item // Scene_Item.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneItemX; }; Scene_Item.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneItemY; }; //----------------------------------------------------------------------------- // Scene_Skill // Scene_Skill.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneSkillX; }; Scene_Skill.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneSkillY; }; //----------------------------------------------------------------------------- // Scene_Equip // Scene_Equip.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneEquipX; }; Scene_Equip.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneEquipY; }; //----------------------------------------------------------------------------- // Scene_Status // Scene_Status.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneStatusX; }; Scene_Status.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneStatusY; }; //----------------------------------------------------------------------------- // Scene_Options // Scene_Options.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneOptionsX; }; Scene_Options.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneOptionsY; }; //----------------------------------------------------------------------------- // Scene_Save // Scene_Save.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneSaveX; }; Scene_Save.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneSaveY; }; //----------------------------------------------------------------------------- // Scene_Load // Scene_Load.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneLoadX; }; Scene_Load.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneLoadY; }; //----------------------------------------------------------------------------- // Scene_GameEnd // Scene_GameEnd.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneGameEndX; }; Scene_GameEnd.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneGameEndY; }; //----------------------------------------------------------------------------- // Scene_Shop // Scene_Shop.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneShopX; }; Scene_Shop.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneShopY; }; //----------------------------------------------------------------------------- // Scene_Name // Scene_Name.prototype.backButtonX = function() { return TMPlugin.BackButton.SceneNameX; }; Scene_Name.prototype.backButtonY = function() { return TMPlugin.BackButton.SceneNameY; }; })();