作者: haosama 时间: 2021-12-29 13:50
//-----------------------------------------------------------------------------
// Galv's Screen Buttons
//-----------------------------------------------------------------------------
// For: RPGMAKER MV
// Galv_ScreenButtons.js
//-----------------------------------------------------------------------------
// 2017-01-06 - Version 1.3 - fixed a bug with mouse move enabled and no
// button with id 0
// 2016-12-15 - Version 1.2 - fixed a bug I created fixing the other bug
// 2016-12-13 - Version 1.1 - fixed a bug with mobile touch going into menus
// 2016-11-30 - Version 1.0 - release
//-----------------------------------------------------------------------------
// Terms can be found at:
// galvs-scripts.com
//-----------------------------------------------------------------------------
var Imported = Imported || {};
Imported.Galv_ScreenButtons = true;
var Galv = Galv || {}; // Galv's main object
Galv.SBTNS = Galv.SBTNS || {}; // Galv's stuff
//-----------------------------------------------------------------------------
/*:
* @plugindesc (v.1.3) Show buttons on screen that can be touched or clicked.
*
* @author Galv - galvs-scripts.com
*
* @param Precache Buttons
* @desc A list of image names from /img/system/ for your buttons you wish to use should be precached
* @default BtnUp,BtnDown,BtnRight,BtnLeft,BtnOk,BtnCancel
*
* @param Disable Mouse Move
* @desc Disable moving character on the map with mouse click true/false
* @default true
*
* @param Button Fade
* @desc Speed that the buttons fade in/out when disabling/enabling
* @default 30
*
*
* @help
* Galv's Screen Buttons
* ----------------------------------------------------------------------------
* This plugin enables you to create buttons on the screen that can be clicked
* and touched to run a script or emulate a button press.
*
* Buttons are given an id that can be used if you wish to replace an existing
* button with a new one during the game.
*
* ----------------------------------------------------------------------------
* SCRIPT CALLS
* ----------------------------------------------------------------------------
*
* Galv.SBTNS.addButton(id,'type','img',x,y,['actionType','action'],e);
*
* id = the id of the button. Use a unique number for each button.
* 'type' = can currently be 'map' or 'mapX' with x being map id
* 'img' = the image name located in /img/system/
* x = the x position of the button
* y = the y postiion of the button
* 'actionType' = You can choose one of the following types here:
* 'button' to emulate a button while button is being pressed
* 'buttonT' to emulate a button being triggered
* 'script' to run script code when button is pressed
* 'event' to run a common event when button is pressed
* 'action' = The resulting action relating to the actionType
* 'button' action is used for key press. Some examples:
* 'ok','cancel','shift','up','down','left','right'
* 'script' action is the script call you wish to run
* 'event' action is the common event id to run
* e = A number used for button opacity when events (such as show
* text) are running. 0-255. If it is 255 then the button
* will stay visible and still be able to be pressed.
* Less than 255 the button will be disabled. Leave this blank
* for the button to automatically be invisible during events.
*
* EXAMPLES:
* Galv.SBTNS.addButton(1,'map','BtnOk',570,500,['button','ok']);
* Galv.SBTNS.addButton(2,'map','BtnRun',690,500,['button','shift']);
* Galv.SBTNS.addButton(3,'map','BtnMenu',0,0,['script','SceneManager.push(Scene_Equip)']);
* Galv.SBTNS.addButton(4,'map1','BtnEvent',0,0,['event',1]);
*
*
* $gameSystem._hideBtns = status; // status can be true or false to hide
* // or show all buttons
* ----------------------------------------------------------------------------
*/