Advertisement
nio_kasgami

ButtonPatch

Mar 18th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*:
  2.  * @plugindesc Patch for place below the Intituive button
  3.  * @author Nio Kasgami
  4.  * @version 1.00
  5.  * @require nothing
  6.  *
  7.  *
  8. */
  9.  
  10.  
  11. var NioPlugin = NioPlugin || {};
  12.  NioPlugin.Alias = NioPlugin.Alias || {};
  13.  
  14.  NioPlugin.Parameters = PluginManager.parameters('ButtonPatch');
  15.  
  16.  NioPlugin.Param = NioPlugin.Param || {};
  17.  
  18. var Yanfly = Yanfly || {};
  19.   Yanfly.Param = Yanfly.Param || {};
  20.  
  21. //==============================================================================
  22. // ■ Scene_Map
  23. //------------------------------------------------------------------------------
  24. // The scene class of the map screen.
  25. //==============================================================================
  26.  
  27.   // overwriting for make sure it's work like it's supposed.
  28.   Scene_Map.prototype.terminate = function() {
  29.     Scene_Base.prototype.terminate.call(this);
  30.     if (!SceneManager.isNextScene(Scene_Battle)) {
  31.         this._button.visible = false;
  32.         this._spriteset.update();
  33.         this._mapNameWindow.hide();
  34.         SceneManager.snapForBackground();
  35.     }
  36.     $gameScreen.clearZoom();
  37.   };
  38.  
  39. //===============================================================================
  40. // => END : Scene_Map
  41. //===============================================================================
  42.  
  43. //==============================================================================
  44. // ■ Scene_Battle
  45. //------------------------------------------------------------------------------
  46. // The scene class of the battle screen.
  47. //==============================================================================
  48.  
  49.   // Overwrite the command so this work with Yanfly BattleCore
  50.   Scene_Battle.prototype.createButton = function(){
  51.     this._button = new Sprite_Button();
  52.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  53.     this._button.setClickHandler(this.currentHandler.bind(this));
  54.     this.defineTrigger();
  55.     this._button.visible = true;
  56.     this.addChild(this._button);
  57.     this.updateButtonVisibility();
  58.   };
  59.   // new method who check wether yanfly is enabled or not.
  60.   Scene_Battle.prototype.defineTrigger = function(){
  61.     if(eval(Yanfly.Param.BECStartActCmd)){
  62.         this.setTrigger('OnCommand');
  63.     } else{
  64.         this.setTrigger('Party');
  65.     }
  66.   };
  67. //===============================================================================
  68. // => END : Scene_Battle
  69. //===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement