Advertisement
nio_kasgami

IntuitiveMobileButtonV2

Mar 15th, 2016
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /*:
  3.  * @plugindesc Permit to create Menu/back button for menu, battle and map.
  4.  * @author Nio Kasgami
  5.  * @version 1.01
  6.  * @require nothing
  7.  *
  8.  * @param MainMenuPosX
  9.  * @desc for Menu in X-Axis.
  10.  * @default 10
  11.  *
  12.  * @param MainMenuPosY
  13.  * @desc for menu in Y-Axis.
  14.  * @default 0
  15.  *
  16.  * @param MapButtonPosX
  17.  * @desc for map in X-Axis.
  18.  * @default 10
  19.  *
  20.  * @param MapButtonPosY
  21.  * @desc for map in Y-Axis.
  22.  * @default 0
  23.  *
  24.  * @param FileButtonPosX
  25.  * @desc for save and load in X-Axis.
  26.  * @default 10
  27.  *
  28.  * @param FileButtonPosY
  29.  * @desc for save and load in Y-Axis.
  30.  * @default 0
  31.  *
  32.  * @param OptionButtonPosX
  33.  * @desc for options in X-Axis.
  34.  * @default 10
  35.  *
  36.  * @param OptionButtonPosY
  37.  * @desc for options in Y-Axis.
  38.  * @default 0
  39.  *
  40.  * @param ItemPosButtonX
  41.  * @desc for item in X-Axis.
  42.  * @default 10
  43.  *
  44.  * @param ItemPosButtonY
  45.  * @desc for item in Y-Axis.
  46.  * @default 0
  47.  *
  48.  * @param ItemButtonPos2X
  49.  * @desc for when you select a item who require a actor in X-Axis.
  50.  * @default 30
  51.  *
  52.  * @param ItemButtonPos2Y
  53.  * @desc for when you select a item who require a actor in Y-Axis.
  54.  * @default 0
  55.  *
  56.  * @param EquipButtonPosX
  57.  * @desc for equip in X-Axis.
  58.  * @default 10
  59.  *
  60.  * @param EquipButtonPosY
  61.  * @desc for equip in Y-Axis.
  62.  * @default 0
  63.  *
  64.  * @param SkillButtonPosX
  65.  * @desc for skill in X-Axis.
  66.  * @default 10
  67.  *
  68.  * @param SkillButtonPosY
  69.  * @desc for skill in Y-Axis.
  70.  * @default 0
  71.  *
  72.  * @param SkillButtonPos2X
  73.  * @desc for when you select a skill who require a actor in X-Axis.
  74.  * @default 10
  75.  *
  76.  * @param SkillButtonPos2Y
  77.  * @desc for when you select a skill who require a actor in Y-Axis.
  78.  * @default 0
  79.  *
  80.  * @param StatusButtonPosX
  81.  * @desc for status in X-Axis.
  82.  * @default 10
  83.  *
  84.  * @param StatusButtonPosY
  85.  * @desc for status in Y-Axis.
  86.  * @default 0
  87.  *
  88.  * @param BattleButtonPosX
  89.  * @desc when you are on the screen in X-Axis.
  90.  * @default 10
  91.  *
  92.  * @param BattleButtonPosY
  93.  * @desc when you are on the screen in Y-Axis.
  94.  * @default 0
  95.  *
  96.  * @param BattleButtonPos2X
  97.  * @desc when you are in skill window in X-Axis.
  98.  * @default 10
  99.  *
  100.  * @param BattleButtonPos2Y
  101.  * @desc when you are in skill window in Y-Axis.
  102.  * @default 0
  103.  *
  104.  * @param BattleButtonPos3X
  105.  * @desc when you are in item window in X-Axis.
  106.  * @default 10
  107.  *
  108.  * @param BattleButtonPos3Y
  109.  * @desc when you are in item window in Y-Axis.
  110.  * @default 0
  111.  *
  112.  * @param BattleButtonPos4X
  113.  * @desc when you are in target enemy in X-Axis.
  114.  * @default 10
  115.  *
  116.  * @param BattleButtonPos4Y
  117.  * @desc when you are in target enemy in Y-Axis.
  118.  * @default 0
  119. */
  120. var NioPlugin = NioPlugin || {};
  121.  NioPlugin.Alias = NioPlugin.Alias || {};
  122.  
  123.  NioPlugin.Parameters = PluginManager.parameters('IntuitiveMobileButtonV2');
  124.  
  125.  NioPlugin.Param = NioPlugin.Param || {};
  126.  
  127.  // menu processing
  128.  NioPlugin.Param.MainMenuPosX = Number(NioPlugin.Parameters['MainMenuPosX']);
  129.  NioPlugin.Param.MainMenuPosY = Number(NioPlugin.Parameters['MainMenuPosY']);
  130.  NioPlugin.Param.MapPosX = Number(NioPlugin.Parameters['MapButtonPosX']);
  131.  NioPlugin.Param.MapPosY = Number(NioPlugin.Parameters['MapButtonPosY']);
  132.  NioPlugin.Param.FilePosX = Number(NioPlugin.Parameters['FileButtonPosX']);
  133.  NioPlugin.Param.FilePosY = Number(NioPlugin.Parameters['FileButtonPosY']);
  134.  NioPlugin.Param.OptionPosX = Number(NioPlugin.Parameters['OptionButtonPosX']);
  135.  NioPlugin.Param.OptionPosY = Number(NioPlugin.Parameters['OptionButtonPosY']);
  136.  NioPlugin.Param.ItemPosX = Number(NioPlugin.Parameters['ItemPosButtonX']);
  137.  NioPlugin.Param.ItemPosY = Number(NioPlugin.Parameters['ItemPosButtonY']);
  138.  NioPlugin.Param.ItemPos2X = Number(NioPlugin.Parameters['ItemButtonPos2X']);
  139.  NioPlugin.Param.ItemPos2Y = Number(NioPlugin.Parameters['ItemButtonPos2Y']);
  140.  NioPlugin.Param.EquipPosX = Number(NioPlugin.Parameters['EquipButtonPosX']);
  141.  NioPlugin.Param.EquipPosY = Number(NioPlugin.Parameters['EquipButtonPosY']);
  142.  NioPlugin.Param.SkillPosX = Number(NioPlugin.Parameters['SkillButtonPosX']);
  143.  NioPlugin.Param.SkillPosY = Number(NioPlugin.Parameters['SkillButtonPosY']);
  144.  NioPlugin.Param.SkillPos2X = Number(NioPlugin.Parameters['SkillButtonPos2X']);
  145.  NioPlugin.Param.SkillPos2Y = Number(NioPlugin.Parameters['SkillButtonPos2Y']);
  146.  NioPlugin.Param.StatusPosX = Number(NioPlugin.Parameters['StatusButtonPosX']);
  147.  NioPlugin.Param.StatusPosY = Number(NioPlugin.Parameters['StatusButtonPosY']);
  148.  
  149.  // Battle Processing
  150.  NioPlugin.Param.BattlePosX = Number(NioPlugin.Parameters['BattleButtonPosX']); // on normal screen X.
  151.  NioPlugin.Param.BattlePosY = Number(NioPlugin.Parameters['BattleButtonPosY']); // on normal screen Y.
  152.  NioPlugin.Param.BattlePos2X = Number(NioPlugin.Parameters['BattleButtonPos2X']); // on item screen X.
  153.  NioPlugin.Param.BattlePos2Y = Number(NioPlugin.Parameters['BattleButtonPos2Y']); // on target screen Y.
  154.  NioPlugin.Param.BattlePos3X = Number(NioPlugin.Parameters['BattleButtonPos3X']); // on skill screen X.
  155.  NioPlugin.Param.BattlePos3Y = Number(NioPlugin.Parameters['BattleButtonPos3Y']); // on skill screen Y.
  156.  NioPlugin.Param.BattlePos4X = Number(NioPlugin.Parameters['BattleButtonPos4X']);  // on target screen X.
  157.  NioPlugin.Param.BattlePos4Y = Number(NioPlugin.Parameters['BattleButtonPos4Y']); // on item screen Y.
  158.  
  159. //==============================================================================
  160. // ■ NioPlugin
  161. //------------------------------------------------------------------------------
  162. // The Static class who handle param.
  163. //==============================================================================
  164.  
  165.  function NKS(){this.initialize.apply(this, arguments);}
  166.   NKS.prototype.constructor = NKS
  167.  
  168.   NKS.prototype.initialize = function(){
  169.     this.getPlugin();
  170.     this.getParam();
  171.   };
  172.  
  173.   NKS.prototype.getPlugin = function(){
  174.     this._mobileButton = this.setPluginName('IntuitiveMobileButtonV2');
  175.   };
  176.  
  177.   NKS.prototype.getParam = function(){
  178.  
  179.   };
  180.  
  181.   NKS.prototype.setPluginName = function(plugin){
  182.     return PluginManager.parameters(plugin);
  183.   };
  184.  
  185.   NKS.prototype.setArray = function(plugin, param){
  186.     return plugin[param].split(',').map( function (i) {return Number(i || 0);} );
  187.   };
  188.  
  189.   NKS.prototype.setString = function(plugin, param){
  190.     return String(plugin[param]);
  191.   };
  192.  
  193.  
  194. //===============================================================================
  195. // => END : Game_Temp
  196. //===============================================================================
  197.  
  198.  
  199. //==============================================================================
  200. // ■ Game_Temp
  201. //------------------------------------------------------------------------------
  202. // The game object class for temporary data that is not included in save data.
  203. //==============================================================================
  204.  
  205.   NioPlugin.Alias.N01 = Game_Temp.prototype.setDestination;
  206.   Game_Temp.prototype.setDestination = function(x,y){
  207.     var button = SceneManager._scene._button;
  208.     if(!button.isButtonTouched()){
  209.         NioPlugin.Alias.N01.call(this,x,y);
  210.     }
  211.   };
  212. //===============================================================================
  213. // => END : Game_Temp
  214. //===============================================================================
  215.  
  216.  
  217. //==============================================================================
  218. // ■ Scene_Boot
  219. //------------------------------------------------------------------------------
  220. // The scene class for initializing the entire game.
  221. //==============================================================================
  222.  
  223.   NioPlugin.Alias.N02 = Scene_Boot.prototype.create;
  224.   Scene_Boot.prototype.create = function(){
  225.     NioPlugin.Alias.N02.call(this);
  226.     ImageManager.loadSystem('MenuButton');
  227.     ImageManager.loadSystem('CancelBackButton');
  228.   };
  229. //===============================================================================
  230. // => END : Scene_Boot
  231. //===============================================================================
  232.  
  233. //==============================================================================
  234. // ■ Scene_MenuBase
  235. //------------------------------------------------------------------------------
  236. // The superclass of all the menu-type scenes.
  237. //==============================================================================
  238.  
  239.   Scene_MenuBase.prototype._currentWindow = null;
  240.  
  241.   NioPlugin.Alias.N03 = Scene_MenuBase.prototype.create;
  242.   Scene_MenuBase.prototype.create = function(){
  243.     NioPlugin.Alias.N03.call(this);
  244.     this.createButton();
  245.   };
  246.  
  247.   Scene_MenuBase.prototype.createButton = function(){};
  248.  
  249.   Scene_MenuBase.prototype.currentHandler = function(){
  250.     SoundManager.playCancel();
  251.   };
  252.  
  253.   Scene_MenuBase.prototype.onMain = function(){
  254.     this.setTrigger('Main');
  255.     this.popScene();
  256.   };
  257.  
  258.   Scene_MenuBase.prototype.setTrigger = function(trigger){
  259.     this._currentWindow = trigger;
  260.   };
  261. //===============================================================================
  262. // => END : Scene_MenuBase
  263. //===============================================================================
  264.  
  265. //==============================================================================
  266. // ■ Scene_Menu
  267. //------------------------------------------------------------------------------
  268. // The scene class of the menu screen.
  269. //==============================================================================
  270.  
  271.   Scene_Menu.prototype.createButton = function(){
  272.     Scene_MenuBase.prototype.createButton.call(this);
  273.     this._button = new Sprite_Button();
  274.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  275.     this._button.x = this.buttonScreenX();
  276.     this._button.y = this.buttonScreenY();
  277.     this._button.setClickHandler(this.currentHandler.bind(this));
  278.     this.setTrigger('Main');
  279.     this.addChild(this._button);
  280.   };
  281.  
  282.   Scene_Menu.prototype.buttonScreenX = function(){
  283.     return (Graphics.boxWidth / 2) + NioPlugin.Param.MainMenuPosX;
  284.   };
  285.  
  286.   Scene_Menu.prototype.buttonScreenY = function(){
  287.     return (Graphics.boxHeight / 2) + NioPlugin.Param.MainMenuPosY;
  288.   };
  289.  
  290.  
  291.   Scene_Menu.prototype.currentHandler = function(){
  292.     Scene_MenuBase.prototype.currentHandler.call(this);
  293.     switch(this._currentWindow){
  294.         case 'Main' : this.onMain(); break;
  295.         case 'OnActor' : this.onActorCancel(); break;
  296.         case 'OnFormation' : this.onFormationActorCancel(); break;
  297.     }
  298.   };
  299.  
  300.   Scene_Menu.prototype.onActorCancel = function(){
  301.     this.setTrigger('Main');
  302.     this.onPersonalCancel();
  303.   };
  304.  
  305.  
  306.   Scene_Menu.prototype.onFormationActorCancel = function(){
  307.     this.setTrigger('Main');
  308.     this.onFormationCancel();
  309.   };
  310.  
  311.   NioPlugin.Alias.N05 = Scene_Menu.prototype.commandPersonal;
  312.   Scene_Menu.prototype.commandPersonal = function(){
  313.     this.setTrigger('OnActor');
  314.     NioPlugin.Alias.N05.call(this);
  315.   };
  316.  
  317.   NioPlugin.Alias.N08 = Scene_Menu.prototype.onPersonalOk;
  318.   Scene_Menu.prototype.onPersonalOk = function(){
  319.     this.setTrigger('Main');
  320.     NioPlugin.Alias.N08.call(this);
  321.   };
  322.  
  323.   NioPlugin.Alias.N06 = Scene_Menu.prototype.commandFormation;
  324.   Scene_Menu.prototype.commandFormation = function(){
  325.     this.setTrigger('OnFormation');
  326.     NioPlugin.Alias.N06.call(this);
  327.   };
  328.  
  329.   NioPlugin.Alias.N07 = Scene_Menu.prototype.onFormationOk;
  330.   Scene_Menu.prototype.onFormationOk = function(){
  331.     this.setTrigger('Main');
  332.     NioPlugin.Alias.N06.call(this);
  333.   };
  334.  
  335.   // Actual obsolete method
  336.   Scene_Menu.prototype.onMain = function(){
  337.     Scene_MenuBase.prototype.onMain.call(this);
  338.    
  339.   };
  340. //===============================================================================
  341. // => END : Scene_Menu
  342. //===============================================================================
  343.  
  344. //==============================================================================
  345. // ■ Scene_File
  346. //------------------------------------------------------------------------------
  347. // The superclass of Scene_Save and Scene_Load.
  348. //==============================================================================
  349.  
  350.   Scene_File.prototype.createButton = function(){
  351.     this._button = new Sprite_Button();
  352.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  353.     this._button.x = this.buttonScreenX();
  354.     this._button.y = this.buttonScreenY();
  355.     this._button.setClickHandler(this.currentHandler.bind(this));
  356.     this.addChild(this._button);
  357.   };
  358.  
  359.   Scene_File.prototype.currentHandler = function(){
  360.     Scene_MenuBase.prototype.currentHandler.call(this);
  361.     this.onMain();
  362.   };
  363.   Scene_File.prototype.buttonScreenX = function(){
  364.     return (Graphics.boxWidth / 2) + NioPlugin.Param.FilePosX;
  365.   };
  366.  
  367.   Scene_File.prototype.buttonScreenY = function(){
  368.     return (Graphics.boxHeight / 2) + NioPlugin.Param.FilePosY;
  369.   };
  370. //===============================================================================
  371. // => END : Scene_File
  372. //===============================================================================
  373.  
  374. //==============================================================================
  375. // ■ Scene_Options
  376. //------------------------------------------------------------------------------
  377. // The scene class of the options screen.
  378. //==============================================================================
  379.  
  380.   Scene_Options.prototype.createButton = function(){
  381.     this._button = new Sprite_Button();
  382.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  383.     this._button.x = this.buttonScreenX();
  384.     this._button.y = this.buttonScreenY();
  385.     this._button.setClickHandler(this.currentHandler.bind(this));
  386.     this.addChild(this._button);
  387.   };
  388.  
  389.   Scene_Options.prototype.currentHandler = function(){
  390.     Scene_MenuBase.prototype.currentHandler.call(this);
  391.     this.onMain();
  392.   };
  393.  
  394.   Scene_Options.prototype.buttonScreenX = function(){
  395.     return (Graphics.boxWidth / 2) + NioPlugin.Param.OptionPosX;
  396.   };
  397.  
  398.   Scene_Options.prototype.buttonScreenY = function(){
  399.     return (Graphics.boxHeight / 2) + NioPlugin.Param.OptionPosY;
  400.   };
  401. //===============================================================================
  402. // => END : Scene_Options
  403. //===============================================================================
  404.  
  405. //==============================================================================
  406. // ■ Scene_Status
  407. //------------------------------------------------------------------------------
  408. // The scene class of the status screen.
  409. //==============================================================================
  410.  
  411.   Scene_Status.prototype.createButton = function(){
  412.     this._button = new Sprite_Button();
  413.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  414.     this._button.x = this.buttonScreenX();
  415.     this._button.y = this.buttonScreenY();
  416.     this._button.setClickHandler(this.currentHandler.bind(this));
  417.     this.addChildAt(this._button,2);
  418.   };
  419.  
  420.   Scene_Status.prototype.currentHandler = function(){
  421.     Scene_MenuBase.prototype.currentHandler.call(this);
  422.     this.onMain();
  423.   };
  424.  
  425.   Scene_Status.prototype.buttonScreenX = function(){
  426.     return (Graphics.boxWidth / 2) + NioPlugin.Param.StatusPosX;
  427.   };
  428.  
  429.   Scene_Status.prototype.buttonScreenY = function(){
  430.     return (Graphics.boxHeight / 2) + NioPlugin.Param.StatusPosY;
  431.   };
  432. //===============================================================================
  433. // => END : Scene_Status
  434. //===============================================================================
  435.  
  436. //==============================================================================
  437. // ■ Scene_Item
  438. //------------------------------------------------------------------------------
  439. // The scene class of the item screen.
  440. //==============================================================================
  441.  
  442.   Scene_Item.prototype.createButton = function(){
  443.     this._button = new Sprite_Button();
  444.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  445.     this._button.setClickHandler(this.currentHandler.bind(this));
  446.     this.setTrigger('Main');
  447.     this.addChildAt(this._button, 2);
  448.   };
  449.  
  450.   Scene_Item.prototype.buttonScreenX = function(){
  451.     var width = (Graphics.boxWidth / 2);
  452.     if(this._currentWindow === 'Actor'){
  453.       return width +  NioPlugin.Param.ItemPos2X;
  454.     } else {
  455.       return width + NioPlugin.Param.ItemPosX;
  456.     }      
  457.   };
  458.  
  459.   Scene_Item.prototype.buttonScreenY = function(){
  460.     var height = (Graphics.boxHeight / 2);
  461.     if(this._currentWindow === 'Actor'){
  462.       return height + NioPlugin.Param.ItemPos2X;
  463.     } else {
  464.       return height + NioPlugin.Param.ItemPosY;
  465.     }  
  466.   };
  467.  
  468.   Scene_Item.prototype.currentHandler = function(){
  469.     Scene_ItemBase.prototype.currentHandler.call(this);
  470.     switch(this._currentWindow){
  471.       case 'Main' : this.onMain(); break;
  472.       case 'category' : this.cancelCategory(); break;
  473.       case 'Actor' : this.cancelActor(); break;
  474.     }
  475.   };
  476.  
  477.   NioPlugin.Alias.N10 = Scene_Item.prototype.onCategoryOk;
  478.   Scene_Item.prototype.onCategoryOk = function() {
  479.     NioPlugin.Alias.N10.call(this);
  480.     this.setTrigger('category');
  481.   };
  482.  
  483.   Scene_Item.prototype.cancelCategory = function(){
  484.     this.onItemCancel();
  485.     this.setTrigger('Main');
  486.   };
  487.  
  488.   NioPlugin.Alias.N11 = Scene_Item.prototype.onItemOk;
  489.   Scene_Item.prototype.onItemOk = function(){
  490.     NioPlugin.Alias.N11.call(this);
  491.     this.setTrigger('Actor');
  492.     this._button.x = this.buttonScreenX() - 50;
  493.   };
  494.  
  495.   Scene_Item.prototype.cancelActor = function(){
  496.     this.onActorCancel();
  497.     this.setTrigger('category');
  498.   };
  499.  
  500.   Scene_Item.prototype.update = function(){
  501.     Scene_ItemBase.prototype.update.call(this);
  502.     this.updateButtonPos();
  503.   };
  504.  
  505.   Scene_Item.prototype.updateButtonPos = function(){
  506.     this._button.x = this.buttonScreenX();
  507.     this._button.y = this.buttonScreenY();
  508.   };
  509. //===============================================================================
  510. // => END : Scene_Item
  511. //===============================================================================
  512.  
  513. //==============================================================================
  514. // ■ Scene_Equip
  515. //------------------------------------------------------------------------------
  516. // The scene class of the equipment screen.
  517. //==============================================================================
  518.  
  519.   Scene_Equip.prototype.createButton = function(){
  520.     this._button = new Sprite_Button();
  521.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  522.     this._button.x = this.buttonScreenX();
  523.     this._button.y = this.buttonScreenY();
  524.     this._button.setClickHandler(this.currentHandler.bind(this));
  525.     this.setTrigger('Main');
  526.     this.addChildAt(this._button, 2);
  527.   };
  528.  
  529.   Scene_Equip.prototype.buttonScreenX = function(){
  530.     return (Graphics.boxWidth/ 2) + NioPlugin.Param.EquipPosX;
  531.   };
  532.  
  533.   Scene_Equip.prototype.buttonScreenY = function(){
  534.     return (Graphics.boxHeight / 2) + NioPlugin.Param.EquipPosY;
  535.   };
  536.  
  537.   Scene_Equip.prototype.currentHandler = function(){
  538.     Scene_MenuBase.prototype.currentHandler.call(this);
  539.     switch(this._currentWindow){
  540.       case 'Main' : this.onMain(); break;
  541.       case 'Slot' : this.onSlot(); break;
  542.       case 'List' : this.onList(); break;
  543.     }
  544.   };
  545.  
  546.   NioPlugin.Alias.N12 = Scene_Equip.prototype.onSlotOk;
  547.   Scene_Equip.prototype.onSlotOk = function(){
  548.     NioPlugin.Alias.N12.call(this);
  549.     this.setTrigger('List');
  550.   };
  551.  
  552.   Scene_Equip.prototype.onSlot = function(){
  553.     this.onSlotCancel();
  554.     this.setTrigger('Main');
  555.   };
  556.  
  557.   NioPlugin.Alias.N13 = Scene_Equip.prototype.onItemOk;
  558.   Scene_Equip.prototype.onItemOk = function(){
  559.     NioPlugin.Alias.N13.call(this);
  560.     this.setTrigger('Slot');
  561.   };
  562.  
  563.   Scene_Equip.prototype.onList = function(){
  564.     this.onItemCancel();
  565.     this.setTrigger('Slot');
  566.   };
  567. //===============================================================================
  568. // => END : Scene_Equip
  569. //===============================================================================
  570.  
  571. //==============================================================================
  572. // ■ Scene_Skill
  573. //------------------------------------------------------------------------------
  574. // The scene class of the skill screen.
  575. //==============================================================================
  576.  
  577.   Scene_Skill.prototype.createButton = function(){
  578.     this._button = new Sprite_Button();
  579.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  580.     this._button.setClickHandler(this.currentHandler.bind(this));
  581.     this.setTrigger('Main');
  582.     this.addChildAt(this._button, 2);
  583.   };
  584.  
  585.   Scene_Skill.prototype.buttonScreenX = function(){
  586.     var width = (Graphics.boxWidth / 2 );
  587.     if(this._currentWindow === 'Actor'){
  588.       return width + NioPlugin.Param.SkillPos2X;
  589.     } else {
  590.       return width + NioPlugin.Param.SkillPosX;
  591.     }
  592.   };
  593.  
  594.   Scene_Skill.prototype.buttonScreenY = function(){
  595.     var height = (Graphics.boxHeight / 2 );
  596.     if(this._currentWindow === 'Actor'){
  597.       return height + NioPlugin.Param.SkillPos2Y;
  598.     } else {
  599.       return height + NioPlugin.Param.SkillPosY;
  600.     }
  601.   };
  602.  
  603.   Scene_Skill.prototype.currentHandler = function(){
  604.     Scene_ItemBase.prototype.currentHandler.call(this);
  605.     switch(this._currentWindow){
  606.       case 'Main' : this.onMain(); break;
  607.       case 'List' : this.onList(); break;
  608.       case 'Actor': this.onActor(); break;
  609.     }
  610.   };
  611.  
  612.   NioPlugin.Alias.N14 = Scene_Skill.prototype.commandSkill;
  613.   Scene_Skill.prototype.commandSkill = function(){
  614.     NioPlugin.Alias.N14.call(this);
  615.     this.setTrigger('List');
  616.   };
  617.   Scene_Skill.prototype.onList = function(){
  618.     this.onItemCancel();
  619.     this.setTrigger('Main');
  620.   };
  621.  
  622.   Scene_Skill.prototype.onActor = function(){
  623.     this.onActorCancel();
  624.     this.setTrigger('List');
  625.   };
  626.  
  627.   NioPlugin.Alias.N25 = Scene_Skill.prototype.onItemOk;
  628.   Scene_Skill.prototype.onItemOk = function(){
  629.     NioPlugin.Alias.N25.call(this);
  630.     this.setTrigger('Actor');
  631.   };
  632.  
  633.   Scene_Skill.prototype.update = function(){
  634.     Scene_ItemBase.prototype.update.call(this);
  635.     this.updateButtonPos();
  636.   };
  637.  
  638.   Scene_Skill.prototype.updateButtonPos = function(){
  639.     this._button.x = this.buttonScreenX();
  640.     this._button.y = this.buttonScreenY();
  641.   };
  642. //===============================================================================
  643. // => END : Scene_Skill
  644. //===============================================================================
  645.  
  646. //==============================================================================
  647. // ■ Scene_Shop
  648. //------------------------------------------------------------------------------
  649. // The scene class of the shop screen.
  650. //==============================================================================
  651.  
  652.   Scene_Shop.prototype.createButton = function(){
  653.     this._button = new Sprite_Button();
  654.     this._button.bitmap = ImageManager.loadSystem("CancelBackButton");
  655.     this._button.x = this.buttonScreenX();
  656.     this._button.y = this.buttonScreenY();
  657.     this._button.setClickHandler(this.currentHandler.bind(this));
  658.     this.addChildAt(this._button, 2);
  659.   };
  660.  
  661.   Scene_Shop.prototype.buttonScreenX = function(){};
  662. //===============================================================================
  663. // => END : Scene_Skill
  664. //===============================================================================
  665.  
  666. //==============================================================================
  667. // ■ Scene_Map
  668. //------------------------------------------------------------------------------
  669. // The scene class of the map screen.
  670. //==============================================================================
  671.  
  672.  NioPlugin.Alias.N04 = Scene_Map.prototype.createDisplayObjects;
  673.  Scene_Map.prototype.createDisplayObjects = function(){
  674.     NioPlugin.Alias.N04.call(this);
  675.     this.createButton();
  676.  };
  677.  Scene_Map.prototype.createButton = function(){
  678.     this._button = new Sprite_Button();
  679.     this._button.bitmap = ImageManager.loadSystem("MenuButton");
  680.     this._button.x = this.buttonScreenX();
  681.     this._button.y = this.buttonScreenY();
  682.     this._button.setClickHandler(this.callMenu.bind(this));
  683.     this.addChild(this._button);
  684.  };
  685.  
  686.  NioPlugin.Alias.N09 = Scene_Map.prototype.update;
  687.  Scene_Map.prototype.update = function(){
  688.     this.updateButtonVisibility();
  689.     NioPlugin.Alias.N09.call(this);
  690.  };
  691.  
  692.  Scene_Map.prototype.updateButtonVisibility = function(){
  693.     if($gameSystem.isMenuEnabled()){
  694.         this._button.visible = true;
  695.     } else {
  696.         this._button.visible = false;
  697.     }
  698.  };
  699.  Scene_Map.prototype.buttonScreenX = function(){
  700.     return (Graphics.boxWidth / 2) + NioPlugin.Param.MapPosX;
  701.  };
  702.  
  703.  Scene_Map.prototype.buttonScreenY = function(){
  704.     return (Graphics.boxHeight / 2) + NioPlugin.Param.MapPosY;
  705.  };
  706. //===============================================================================
  707. // => END : Scene_Map
  708. //===============================================================================
  709.  
  710. //==============================================================================
  711. // ■ Scene_Battle
  712. //------------------------------------------------------------------------------
  713. // The scene class of the battle screen.
  714. //==============================================================================
  715.  
  716.   Scene_Battle.prototype._currentWindow = null;
  717.  
  718.   Scene_Battle.prototype.setTrigger = function(trigger){
  719.     this._currentWindow = trigger;
  720.   };
  721.  
  722.   NioPlugin.Alias.N15 = Scene_Battle.prototype.createDisplayObjects;
  723.   Scene_Battle.prototype.createDisplayObjects = function(){
  724.     NioPlugin.Alias.N15.call(this);
  725.     this.createButton();
  726.   };
  727.  
  728.   Scene_Battle.prototype.createButton = function(){
  729.     this._button = new Sprite_Button();
  730.     this._button.bitmap = ImageManager.loadSystem('CancelBackButton');
  731.     this._button.setClickHandler(this.currentHandler.bind(this));
  732.     this.setTrigger('Party');
  733.     this._button.visible = true;
  734.     this.addChild(this._button);
  735.     this.updateButtonVisibility();
  736.     console.log( NioPlugin.Param.BattlePosX);
  737.   };
  738.  
  739.   Scene_Battle.prototype.buttonScreenX = function(){
  740.    // var width = (Graphics.boxWidth / 2);
  741.     switch(this._currentWindow){
  742.       case 'OnCommand' : return (Graphics.boxWidth / 2) + NioPlugin.Param.BattlePosX; break;
  743.       case 'OnActor' : return  (Graphics.boxWidth / 2)  + NioPlugin.Param.BattlePosX; break;
  744.       case 'OnSkill' : return (Graphics.boxWidth / 2)  + NioPlugin.Param.BattlePos2X; break;
  745.       case 'OnItem' : return (Graphics.boxWidth / 2)  + NioPlugin.Param.BattlePos3X; break;
  746.       case 'OnTarget' : return (Graphics.boxWidth / 2)  + NioPlugin.Param.BattlePos4X; break;
  747.     }
  748.   };
  749.  
  750.   Scene_Battle.prototype.buttonScreenY = function(){
  751.    // var height = (Graphics.boxheight / 2);
  752.     switch(this._currentWindow){
  753.       case 'OnCommand' : return (Graphics.boxHeight / 2) + NioPlugin.Param.BattlePosY; break;
  754.       case 'OnActor' : return  (Graphics.boxHeight / 2) + NioPlugin.Param.BattlePosY; break;
  755.       case 'OnSkill' : return (Graphics.boxHeight / 2) + NioPlugin.Param.BattlePos2Y; break;
  756.       case 'OnItem' : return (Graphics.boxHeight / 2) + NioPlugin.Param.BattlePos3Y; break;
  757.       case 'OnTarget' : return (Graphics.boxHeight / 2) + NioPlugin.Param.BattlePos4Y; break;
  758.     }
  759.   };
  760.  
  761.   NioPlugin.Alias.N16 = Scene_Battle.prototype.update
  762.   Scene_Battle.prototype.update = function(){
  763.     NioPlugin.Alias.N16.call(this);
  764.     this.updateButtonVisibility();
  765.     this.updateButtonPos();
  766.   };
  767.  
  768.   Scene_Battle.prototype.updateButtonVisibility = function(){
  769.     if(this._currentWindow === 'Party' || BattleManager.isAborting() || BattleManager.isBattleEnd() ){
  770.       this._button.visible = false;
  771.     } else {
  772.       this._button.visible = true;
  773.     }
  774.   };
  775.  
  776.   Scene_Battle.prototype.updateButtonPos = function(){
  777.     this._button.x = this.buttonScreenX();
  778.     this._button.y = this.buttonScreenY();
  779.   };
  780.  
  781.   Scene_Battle.prototype.currentHandler = function(){
  782.    // console.log("Was before " + this._currentWindow);
  783.     switch(this._currentWindow){
  784.       case 'OnCommand' : this.onCommand(); break;
  785.       case 'OnActor' : this.onActor(); break;
  786.       case 'OnTarget' : this.onTarget(); break;
  787.       case 'OnSkill' : this.onSkill(); break;
  788.       case 'OnItem' : this.onItem(); break;
  789.     }
  790.    // console.log("Is now " + this._currentWindow);
  791.     SoundManager.playCancel();
  792.   };
  793.  
  794.   NioPlugin.Alias.N17 = Scene_Battle.prototype.commandFight;
  795.   Scene_Battle.prototype.commandFight = function(){
  796.     NioPlugin.Alias.N17.call(this);
  797.     this.setTrigger('OnCommand');
  798.   };
  799.  
  800.   NioPlugin.Alias.N18 = Scene_Battle.prototype.commandAttack;
  801.   Scene_Battle.prototype.commandAttack = function(){
  802.     NioPlugin.Alias.N18.call(this);
  803.     this.setTrigger('OnTarget');
  804.   };
  805.  
  806.   NioPlugin.Alias.N19 = Scene_Battle.prototype.commandSkill;
  807.   Scene_Battle.prototype.commandSkill = function(){
  808.     NioPlugin.Alias.N19.call(this);
  809.     this.setTrigger('OnSkill');
  810.   };
  811.  
  812.   NioPlugin.Alias.N20 = Scene_Battle.prototype.commandItem;
  813.   Scene_Battle.prototype.commandItem = function(){
  814.     NioPlugin.Alias.N20.call(this);
  815.     this.setTrigger('OnItem');
  816.   };
  817.  
  818.   Scene_Battle.prototype.onCommand = function(){
  819.     this.selectPreviousCommand();
  820.     if(BattleManager.actor() <= 0){ //this._actorCommandWindow.currentSymbol() === 'Guard'
  821.       this.setTrigger('Party');
  822.     }
  823.   };
  824.  
  825.   Scene_Battle.prototype.onActor = function(){
  826.     this.onActorCancel();
  827.     switch(this._actorCommandWindow.currentSymbol()){
  828.       case 'skill' : this.setTrigger('OnSkill'); break;
  829.       case 'item' : this.setTrigger('OnItem'); break;
  830.     }  
  831.   };
  832.  
  833.   Scene_Battle.prototype.onTarget = function(){
  834.     this.onEnemyCancel();
  835.     switch(this._actorCommandWindow.currentSymbol()){
  836.       case 'attack' : this.setTrigger('OnCommand'); break;
  837.       case 'skill' : this.setTrigger('OnSkill'); break;
  838.       case 'item' : this.setTrigger('OnItem'); break;
  839.     }  
  840.   };
  841.  
  842.   Scene_Battle.prototype.onSkill = function(){
  843.     this.onSkillCancel();
  844.     this.setTrigger('OnCommand');
  845.   };
  846.  
  847.   Scene_Battle.prototype.onItem = function(){
  848.     this.onItemCancel();
  849.     this.setTrigger('OnCommand');
  850.   };
  851.  
  852.   NioPlugin.Alias.N21 = Scene_Battle.prototype.onEnemyOk;
  853.   Scene_Battle.prototype.onEnemyOk = function(){
  854.     NioPlugin.Alias.N21.call(this);
  855.     this.setTrigger('OnCommand');
  856.     console.log(this._button.visible);
  857.   };
  858.  
  859.   NioPlugin.Alias.N22 = Scene_Battle.prototype.onActorOk;
  860.   Scene_Battle.prototype.onActorOk = function(){
  861.     NioPlugin.Alias.N22.call(this);
  862.     this.setTrigger('OnCommand');
  863.   };
  864.   /*
  865.   NioPlugin.Alias.N23 = Scene_Battle.prototype.onItemOk;
  866.   Scene_Battle.prototype.onItemOk = function(){
  867.     NioPlugin.Alias.N23.call(this);
  868.     var action = BattleManager.inputtingAction();
  869.     if(!action.needsSelection()){
  870.       this.setTrigger('OnCommand');
  871.     } else if(action.isForOpponent()){
  872.       this.setTrigger('OnTarget');
  873.     } else {
  874.       this.setTrigger('OnActor');
  875.     }
  876.   };
  877.   */
  878.  /*
  879.   NioPlugin.Alias.N24 = Scene_Battle.prototype.onSkillOk;
  880.   Scene_Battle.prototype.onSkillOk = function(){
  881.     this._helpWindow.clear();
  882.     NioPlugin.Alias.N24.call(this);
  883.     var action = BattleManager.inputtingAction();
  884.     if(!action.needsSelection()){
  885.       this.setTrigger('OnCommand');
  886.     } else if(action.isForOpponent()){
  887.       this.setTrigger('OnTarget');
  888.     } else {
  889.       this.setTrigger('OnActor');
  890.     }
  891.   };
  892.  */
  893.  
  894.  Scene_Battle.prototype.onSelectAction = function() {
  895.     var action = BattleManager.inputtingAction();
  896.     this._skillWindow.hide();
  897.     this._itemWindow.hide();
  898.     if (!action.needsSelection()) {
  899.         this.selectNextCommand();
  900.         this.setTrigger('OnCommand');
  901.     } else if (action.isForOpponent()) {
  902.         this.selectEnemySelection();
  903.         this.setTrigger('OnTarget');
  904.     } else {
  905.         this.selectActorSelection();
  906.         this.setTrigger('OnActor');
  907.     }
  908.   };
  909.  
  910.  
  911.   Scene_Battle.prototype.endCommandSelection = function(){
  912.     this._partyCommandWindow.close();
  913.     this._actorCommandWindow.close();
  914.     this._statusWindow.deselect();
  915.     this.setTrigger('Party');
  916.   };
  917.  
  918.  
  919. //===============================================================================
  920. // => END : Scene_Battle
  921. //===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement