设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 65|回复: 0

[转载发布] MBS_MobileDirPad_Upgraded

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    8037

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    30081
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    39012

    灌水之王

    发表于 5 天前 | 显示全部楼层 |阅读模式
    Spoiler:  For moderators and author
    Hi!
    I have talked with Mask in the Brazilian forum a long time ago about this plugin. And he said that don't care if I edit the plugin as long I maintain the same terms of use. Here is the conversation I had with him in the Brazilian forum:



    Google Translate:

                            Oops, hello

    So, unfortunately, I haven't had any time to dedicate to maintaining/supporting my RPG Maker plugins for a while. So I don't think I'll be able to help you with what you want there (if they haven't already helped you with rm web), it was bad.

    As for editing, go without fear. I don't have much attachment to my scripts to the point of preventing other people from messing with them (I just wish you luck understanding the mess they are kkk). I only ask that you follow the Creative Commons Attribution-ShareAlike license, as I ask for in my topics.

    Also, see if RMWeb accepts you to post edits to plugins. It is possible that they will ask you to post as a comment on the original plugin topic or something.               
    Click to expand...


    Also, I released this version in the Brazilian forum too, and he received it well:



    Google Translate:

                            Interesting. It would be nice to also see that multi-touch and 8 directions implemented, apart from the other bugs that the guys commented on the original topic there hahaha

    Incidentally, consider opening a PR on GitHub: https://github.com/masked-rpgmaker/JS/blob/master/mv/MBS_MobileDirPad.js

    That way I can update the original script with its improvements \ o               
    Click to expand...


    Author: Masked(or Brandt)
    *No longer supported*


    Introduction

    This plugin is an updated version of the old Mbs_MobileDirPad made by Masked (or Brandt).
    It contains the new plugin parameters and also, unlike the old one, this one contains all the standard buttons of the Rpg maker mv.

    Features

    • Add buttons shift, menu, page down, and page up.

    How to use

    If you don't want to use a button, just leave the parameter empty.
    To hide or show the controls use the plugin commands(not case sensitive):
    MobileDirPad disable
    MobileDirPad enable

    Screenshots
    Spoiler










    Save it with the name of MBS_MobileDirPad_Upgraded.js
    Spoiler: Get the plugin here
                    JavaScript:       
    1. //=============================================================================
    2. // MBS - Mobile Dir Pad Upgraded
    3. //-----------------------------------------------------------------------------
    4. // por Masked
    5. //=============================================================================
    6. //-----------------------------------------------------------------------------
    7. // Especificações do plugin (Não modifique!)
    8. // Plugin specifications (Do not modify!)
    9. //
    10. /*:
    11. @author Masked
    12. @plugindesc v1.0 - Creates buttons on screen for mobile games.
    13. <MBS MobileDirPad>
    14. @help
    15. ==============================================================================
    16. Introduction
    17. ==============================================================================
    18. This plugin is an updated version of the old Mbs_MobileDirPad made by Masked
    19. (or Brandt).
    20. It contains the new plugin parameters and also, unlike the old one, this one
    21. contains all the standard buttons of the Rpg maker mv.
    22. ==============================================================================
    23. How to use
    24. ==============================================================================
    25. If you don't want to use a button, just leave the parameter empty.
    26. To hide or show the controls use the plugin commands(not case sensitive):
    27. MobileDirPad disable
    28. MobileDirPad enable
    29. ==============================================================================
    30. Credits
    31. ==============================================================================
    32. - You MUST give credits to Masked.
    33. - You can optionally give credits to me, Eliaquim.
    34. ==============================================================================
    35. Update log
    36. ==============================================================================
    37. Version 1.0 - 04/11/2020
    38. - Released!
    39. @param dPadImage
    40. @text DirPad image
    41. @type file
    42. @dir img/system
    43. @desc The file path for the DPad image
    44. @default
    45. @param dPadX
    46. @text Position X
    47. @type number
    48. @desc The DirPad image position X on screen
    49. @default 20
    50. @parent dPadImage
    51. @param dPadY
    52. @text Position Y
    53. @type number
    54. @desc The DirPad image position Y on screen
    55. @default 430
    56. @parent dPadImage
    57. @param dPadSize
    58. @text DirPad size
    59. @type number
    60. @desc The DPad buttons size
    61. @default 52
    62. @parent dPadImage
    63. @param actionButtonImage
    64. @text Action button image
    65. @type file
    66. @dir img/system
    67. @desc The file path for the Action Button image
    68. @default
    69. @param actionButtonX
    70. @text Position X
    71. @type number
    72. @desc The ActionButton image position on screen (on format x; y)
    73. @default 600
    74. @parent actionButtonImage
    75. @param actionButtonY
    76. @text Position Y
    77. @type number
    78. @desc The ActionButton image position on screen (on format x; y)
    79. @default 536
    80. @parent actionButtonImage
    81. @param cancelButtonImage
    82. @text Cancel button image
    83. @type file
    84. @dir img/system
    85. @desc The file path for the Cancel Button image
    86. @default
    87. @param cancelButtonX
    88. @text Position X
    89. @type number
    90. @desc The CancelButton image position X on screen
    91. @default 700
    92. @parent cancelButtonImage
    93. @param cancelButtonY
    94. @text Position Y
    95. @type number
    96. @desc The CancelButton image position Y on screen
    97. @parent cancelButtonImage
    98. @param shiftButtonImage
    99. @text Shift button image
    100. @type file
    101. @dir img/system
    102. @desc The file path for the Attack Button image
    103. @default
    104. @param shiftButtonX
    105. @text Position X
    106. @type number
    107. @desc The RunButton image position X on screen
    108. @default 30
    109. @parent shiftButtonImage
    110. @param shiftButtonY
    111. @text Position Y
    112. @type number
    113. @desc The RunButton image position Y on screen
    114. @default 360
    115. @parent shiftButtonImage
    116. @param menuButtonImage
    117. @text Menu button image
    118. @type file
    119. @dir img/system
    120. @desc The file path for the Menu Button image
    121. @default
    122. @param menuButtonX
    123. @text Position X
    124. @type number
    125. @desc The MenuButton image position X on screen
    126. @default 760
    127. @parent menuButtonImage
    128. @param menuButtonY
    129. @text Position Y
    130. @type number
    131. @desc The MenuButton image position Y on screen
    132. @default 0
    133. @parent menuButtonImage
    134. @param qButtonImage
    135. @text PageUp button image
    136. @type file
    137. @dir img/system
    138. @desc The file path for the Q Button image
    139. @default
    140. @param qButtonX
    141. @text Position X
    142. @type number
    143. @desc The QButton image position X on screen
    144. @default 600
    145. @parent qButtonImage
    146. @param qButtonY
    147. @text Position Y
    148. @type number
    149. @desc The QButton image position Y on screen
    150. @default 440
    151. @parent qButtonImage
    152. @param wButtonImage
    153. @text PageDown button image
    154. @type file
    155. @dir img/system
    156. @desc The file path for the Q Button image
    157. @default
    158. @param wButtonX
    159. @text Position X
    160. @type number
    161. @desc The QButton image position X on screen
    162. @default 700
    163. @parent wButtonImage
    164. @param wButtonY
    165. @text Position Y
    166. @type number
    167. @desc The QButton image position Y on screen
    168. @default 406
    169. @parent wButtonImage
    170. @param opacity
    171. @text Control's opacity
    172. @type number
    173. @min 0
    174. @max 255
    175. @desc The opacity used for the controls(0 - 255).
    176. @default 255
    177. @param hideDuration
    178. @text Hide Duration
    179. @type number
    180. @desc Number of frames the UI hiding take
    181. @default 15
    182. @param pcDebug
    183. @text Debug on Pc
    184. @type boolean
    185. @desc Set to 'true' if you want to debug the script on a computer and to 'false' otherwise.
    186. @default true
    187. @param onlyInMap
    188. @text Only in Map
    189. @type boolean
    190. @desc Set to 'true' if you want the dpad to show up just at the map scene and to 'false' otherwise.
    191. @default false
    192. */
    193. /*:pt
    194. @author Masked
    195. @plugindesc v1.0 - Cria botões na tela para jogos mobile.
    196. <MBS MobileDirPad>
    197. @help
    198. ==============================================================================
    199. Introdução
    200. ==============================================================================
    201. Este plugin é uma versão atualizada do antigo Mbs_MobileDirPad feito por
    202. Masked(ou Brandt).
    203. Contém os novos parâmetros de plugin e também, diferente do antigo, este
    204. contém todos os botões padrões do rpg maker mv.
    205. ==============================================================================
    206. Como usar
    207. ==============================================================================
    208. Para não usar um botão, apenas deixe o parâmetro vazio.
    209. Para esconder ou mostrar os controles use os comandos de plugin:
    210. MobileDirPad disable
    211. MobileDirPad enable
    212. ==============================================================================
    213. Créditos
    214. ==============================================================================
    215. - Você DEVE dar créditos para o Masked.
    216. - Você pode, se quiser, dar créditos para mim, Eliaquim.
    217. ==============================================================================
    218. Atualizações
    219. ==============================================================================
    220. Versão 1.0 - 11/04/2020
    221. - Lançado!
    222. @param dPadImage
    223. @text DirPad image
    224. @type file
    225. @dir img/system
    226. @desc O arquivo de imagem deste botão.
    227. @default
    228. @param dPadX
    229. @text Posição X
    230. @type number
    231. @desc A posição X desse botão na tela.
    232. @default 20
    233. @parent dPadImage
    234. @param dPadY
    235. @text Posição Y
    236. @type number
    237. @desc A posição Y desse botão na tela.
    238. @default 430
    239. @parent dPadImage
    240. @param dPadSize
    241. @text DirPad size
    242. @type number
    243. @desc The DPad buttons size
    244. @default 52
    245. @parent dPadImage
    246. @param actionButtonImage
    247. @text Action button image
    248. @type file
    249. @dir img/system
    250. @desc O arquivo de imagem deste botão.
    251. @default
    252. @param actionButtonX
    253. @text Posição X
    254. @type number
    255. @desc A posição X desse botão na tela.
    256. @default 600
    257. @parent actionButtonImage
    258. @param actionButtonY
    259. @text Posição Y
    260. @type number
    261. @desc A posição Y desse botão na tela.
    262. @default 536
    263. @parent actionButtonImage
    264. @param cancelButtonImage
    265. @text Cancel button image
    266. @type file
    267. @dir img/system
    268. @desc O arquivo de imagem deste botão.
    269. @default
    270. @param cancelButtonX
    271. @text Posição X
    272. @type number
    273. @desc A posição X desse botão na tela.
    274. @default 700
    275. @parent cancelButtonImage
    276. @param cancelButtonY
    277. @text Posição Y
    278. @type number
    279. @desc A posição Y desse botão na tela.
    280. @parent cancelButtonImage
    281. @param shiftButtonImage
    282. @text Shift button image
    283. @type file
    284. @dir img/system
    285. @desc O arquivo de imagem deste botão.
    286. @default
    287. @param shiftButtonX
    288. @text Posição X
    289. @type number
    290. @desc A posição X desse botão na tela.
    291. @default 30
    292. @parent shiftButtonImage
    293. @param shiftButtonY
    294. @text Posição Y
    295. @type number
    296. @desc A posição Y desse botão na tela.
    297. @default 360
    298. @parent shiftButtonImage
    299. @param menuButtonImage
    300. @text Menu button image
    301. @type file
    302. @dir img/system
    303. @desc O arquivo de imagem deste botão.
    304. @default
    305. @param menuButtonX
    306. @text Posição X
    307. @type number
    308. @desc A posição X desse botão na tela.
    309. @default 760
    310. @parent menuButtonImage
    311. @param menuButtonY
    312. @text Posição Y
    313. @type number
    314. @desc A posição Y desse botão na tela.
    315. @default 0
    316. @parent menuButtonImage
    317. @param qButtonImage
    318. @text PageUp button image
    319. @type file
    320. @dir img/system
    321. @desc O arquivo de imagem deste botão.
    322. @default
    323. @param qButtonX
    324. @text Posição X
    325. @type number
    326. @desc A posição X desse botão na tela.
    327. @default 600
    328. @parent qButtonImage
    329. @param qButtonY
    330. @text Posição Y
    331. @type number
    332. @desc A posição Y desse botão na tela.
    333. @default 440
    334. @parent qButtonImage
    335. @param wButtonImage
    336. @text PageDown button image
    337. @type file
    338. @dir img/system
    339. @desc O arquivo de imagem deste botão.
    340. @default
    341. @param wButtonX
    342. @text Posição X
    343. @type number
    344. @desc A posição X desse botão na tela.
    345. @default 700
    346. @parent wButtonImage
    347. @param wButtonY
    348. @text Posição Y
    349. @type number
    350. @desc A posição Y desse botão na tela.
    351. @default 406
    352. @parent wButtonImage
    353. @param opacity
    354. @text Opacidade do controle
    355. @type number
    356. @min 0
    357. @max 255
    358. @desc A transparência do controle(0 - 255).
    359. @default 255
    360. @param hideDuration
    361. @text Delay para esconder controles
    362. @type number
    363. @desc Número de frames para o controle se esconder.
    364. @default 15
    365. @param pcDebug
    366. @text Testar no pc
    367. @type boolean
    368. @desc Coloque para true se você quer testar os controles no pc.
    369. @default true
    370. @param onlyInMap
    371. @text Somente no mapa
    372. @type boolean
    373. @desc Coloque true para mostrar os controles somente na cena do mapa.
    374. @default false
    375. */
    376. "use strict";
    377. var Imported = Imported || {};
    378. Imported.MBS_MobileDirPad_Upgraded = true;
    379. var MBS = MBS || {};
    380. MBS.MobileDirPad = MBS.MobileDirPad || {};
    381. MBS.MobileDirPad.convertParameters = function(parameters){
    382.     MBS.MobileDirPad.parseParameters = function(string) {
    383.         try {
    384.             return JSON.parse(string, (key, value) => {
    385.                 try {
    386.                     return MBS.MobileDirPad.parseParameters(value)
    387.                 } catch (e) {
    388.                     return value
    389.                 }
    390.             })
    391.         } catch (e) {
    392.             return string
    393.             }
    394.         }
    395.         return MBS.MobileDirPad.parseParameters(JSON.stringify(parameters))
    396. };
    397. MBS.MobileDirPad.Parameters = PluginManager.parameters('MBS_MobileDirPad_Upgraded');
    398. MBS.MobileDirPad.Param = MBS.MobileDirPad.convertParameters(MBS.MobileDirPad.Parameters) || {};
    399.      //-----------------------------------------------------------------------------
    400.     // Module functions
    401.     //
    402.      MBS.MobileDirPad.enable = function(flag) {
    403.         Scene_Base.dirpad = flag;
    404.         if (flag) {
    405.             SceneManager._scene.showUserInterface();
    406.         } else {
    407.             SceneManager._scene.hideUserInterface();
    408.         }
    409.     };
    410.     //-----------------------------------------------------------------------------
    411.     // Sprite_DirPad
    412.     //
    413.     // Sprite for the Directional Pad
    414.     function Sprite_DirPad() {
    415.         this.initialize.apply(this, arguments);
    416.     }
    417.     Sprite_DirPad.prototype = Object.create(Sprite_Base.prototype);
    418.     Sprite_DirPad.prototype.constructor = Sprite_DirPad;
    419.     Sprite_DirPad.prototype.initialize = function() {
    420.         Sprite_Base.prototype.initialize.call(this);
    421.         this.bitmap = ImageManager.loadSystem(MBS.MobileDirPad.Param.dPadImage);
    422.         this.anchor.y = 0;//0.5;
    423.         this.anchor.x = 0;//0.5;
    424.         this.z = 5;
    425.         this._lastDir = '';
    426.     };
    427.     Sprite_DirPad.prototype.update = function() {
    428.         Sprite_Base.prototype.update.call(this);
    429.         if (!this.visible) return;
    430.         this.updateMovement();
    431.         this.updateTouch();
    432.     };
    433.     Sprite_DirPad.prototype.updateMovement = function() {
    434.         if (this._moveDuration > 0) {
    435.             this.x += this._moveSpeed;
    436.             this._moveDuration--;
    437.         }
    438.     };
    439.     Sprite_DirPad.prototype.updateTouch = function() {
    440.         if (this._lastDir.length > 0) {
    441.             this._lastDir.split(" ").forEach(function (d) {
    442.                 Input._currentState[d] = false;
    443.             });
    444.             this._lastDir = '';
    445.         }
    446.         let s = MBS.MobileDirPad.Param.dPadSize;
    447.         if (TouchInput.isPressed()) {
    448.             let sx = this.x - this.width * this.anchor.x;
    449.             let sy = this.y - this.height * this.anchor.y;
    450.             let rect = this.getBounds();
    451.          
    452.             this._lastDir = '';
    453.             if (rect.contains(TouchInput.x,TouchInput.y) && TouchInput.x - rect.x > s * 2) {
    454.                 Input._currentState['right'] = true;
    455.                 this._lastDir = 'right';
    456.             } else if (rect.contains(TouchInput.x,TouchInput.y) && TouchInput.x - rect.x < s) {
    457.                 Input._currentState['left'] = true;
    458.                 this._lastDir = 'left';
    459.             }
    460.             if (rect.contains(TouchInput.x,TouchInput.y) && TouchInput.y - rect.y > s * 2) {
    461.                 Input._currentState['down'] = true;
    462.                 this._lastDir += ' down';
    463.             } else if (rect.contains(TouchInput.x,TouchInput.y) && TouchInput.y - rect.y < s) {
    464.                 Input._currentState['up'] = true;
    465.                 this._lastDir += ' up';
    466.             }
    467.             this._lastDir = this._lastDir.trim();
    468.         }
    469.     };
    470.     Sprite_DirPad.prototype.hide = function() {
    471.         this._moveDuration = MBS.MobileDirPad.Param.hideDuration;
    472.         let dest = 0 - 64 - this.width * (1 + this.anchor.x);
    473.         this._moveSpeed = (dest - this.x) / this._moveDuration;
    474.     };
    475.     Sprite_DirPad.prototype.show = function() {
    476.         this._moveDuration = MBS.MobileDirPad.Param.hideDuration;
    477.         let dest = MBS.MobileDirPad.Param.dPadX;
    478.         this._moveSpeed = (dest - this.x) / this._moveDuration;
    479.     };
    480.     //-----------------------------------------------------------------------------
    481.     // Sprite_ActionButton
    482.     //
    483.     // Sprite for the action button
    484.     function Sprite_mbsButton() {
    485.         this.initialize.apply(this, arguments);
    486.     }
    487.     Sprite_mbsButton.prototype = Object.create(Sprite_Base.prototype);
    488.     Sprite_mbsButton.prototype.constructor = Sprite_mbsButton;
    489.     Sprite_mbsButton.prototype.initialize = function(type) {
    490.         Sprite_Base.prototype.initialize.call(this);
    491.         this._type = type;
    492.       
    493.         let imgPath = '';  // default, empty string
    494.     switch (type) {
    495.         case 0:
    496.     imgPath = MBS.MobileDirPad.Param.actionButtonImage;
    497.     break;
    498.         case 1:
    499.     imgPath = MBS.MobileDirPad.Param.cancelButtonImage;
    500.     break;
    501.         case 2:
    502.     imgPath = MBS.MobileDirPad.Param.shiftButtonImage;
    503.     break;
    504.         case 3:
    505.     imgPath = MBS.MobileDirPad.Param.menuButtonImage;
    506.     break;
    507.         case 4:
    508.     imgPath = MBS.MobileDirPad.Param.qButtonImage;
    509.     break;
    510.         case 5:
    511.     imgPath = MBS.MobileDirPad.Param.wButtonImage;
    512.     break;
    513.         default:
    514.     console.error('MBS_MobileDirPad_Upgraded.js: button type ' + type + ' not recognised!');
    515.     break;
    516. }
    517.         // These next two lines are the ones you edited
    518.         if (imgPath == '') {
    519.             this.visible = false;  // make invisible if no image is assigned
    520.         }else{
    521.             this.bitmap = ImageManager.loadSystem(imgPath);  // else load image
    522.         }
    523.       
    524.         this.anchor.y = 0;//0.5;
    525.         this.anchor.x = 0;//0.5;
    526.         this._moveDuration = 0;
    527.         this._moveSpeed = 0;
    528.         this.z = 5;
    529.     };
    530.     Sprite_mbsButton.prototype.update = function() {
    531.         Sprite_Base.prototype.update.call(this);
    532.         if (!this.visible) return;
    533.         this.updateMovement();
    534.         this.updateTouch();
    535.     };
    536.     Sprite_mbsButton.prototype.updateMovement = function() {
    537.         if (this._moveDuration > 0) {
    538.             this.x += this._moveSpeed;
    539.             this._moveDuration--;
    540.         }
    541.     };
    542.     Sprite_mbsButton.prototype.updateTouch = function() {
    543.         switch(this._type){
    544.             case 0:
    545.                 if(TouchInput.isTriggered()){
    546.                     let rect = new PIXI.Rectangle(this.x - this.width * this.anchor.x, this.y - this.height * this.anchor.y, this.width, this.height);
    547.                     Input._currentState['ok'] = rect.contains(TouchInput.x, TouchInput.y);
    548.                 } else {
    549.                     Input._currentState['ok'] = false;
    550.                 }
    551.             break;
    552.             case 1:
    553.                 if(TouchInput.isTriggered()){
    554.                     let rect = new PIXI.Rectangle(this.x - this.width * this.anchor.x, this.y - this.height * this.anchor.y, this.width, this.height);
    555.                     Input._currentState['cancel'] = rect.contains(TouchInput.x, TouchInput.y);
    556.                 } else {
    557.                     Input._currentState['cancel'] = false;
    558.                 }
    559.             break;
    560.             case 2:
    561.                 if(TouchInput.isTriggered()){
    562.                     let rect = new PIXI.Rectangle(this.x - this.width * this.anchor.x, this.y - this.height * this.anchor.y, this.width, this.height);
    563.                     Input._currentState['shift'] = rect.contains(TouchInput.x, TouchInput.y);
    564.                 } else {
    565.                     Input._currentState['shift'] = false;
    566.                 }
    567.             break;
    568.             case 3:
    569.                 if(TouchInput.isTriggered()){
    570.                     let rect = new PIXI.Rectangle(this.x - this.width * this.anchor.x, this.y - this.height * this.anchor.y, this.width, this.height);
    571.                     Input._currentState['menu'] = rect.contains(TouchInput.x, TouchInput.y);
    572.                 } else {
    573.                     Input._currentState['menu'] = false;
    574.                 }
    575.             break;
    576.             case 4:
    577.                 if(TouchInput.isTriggered()){
    578.                     let rect = new PIXI.Rectangle(this.x - this.width * this.anchor.x, this.y - this.height * this.anchor.y, this.width, this.height);
    579.                     Input._currentState['pageup'] = rect.contains(TouchInput.x, TouchInput.y);
    580.                 } else {
    581.                     Input._currentState['pageup'] = false;
    582.                 }
    583.             break;
    584.             case 5:
    585.                 if(TouchInput.isTriggered()){
    586.                     let rect = new PIXI.Rectangle(this.x - this.width * this.anchor.x, this.y - this.height * this.anchor.y, this.width, this.height);
    587.                     Input._currentState['pagedown'] = rect.contains(TouchInput.x, TouchInput.y);
    588.                 } else {
    589.                     Input._currentState['pagedown'] = false;
    590.                 }
    591.             break;
    592.         }
    593.     };
    594.     Sprite_mbsButton.prototype.hide = function() {
    595.         this._moveDuration = MBS.MobileDirPad.Param.hideDuration;
    596.         let dest = Graphics.width + this.width * this.anchor.x + 64;
    597.         this._moveSpeed = (dest - this.x) / this._moveDuration;
    598.     }
    599.     Sprite_mbsButton.prototype.show = function() {
    600.         this._moveDuration = MBS.MobileDirPad.Param.hideDuration;
    601.       
    602.         let dest = '';  // default, empty string
    603.             switch (this._type) {
    604.                 case 0:
    605.             dest = MBS.MobileDirPad.Param.actionButtonX;
    606.             break;
    607.                 case 1:
    608.             dest = MBS.MobileDirPad.Param.cancelButtonX;
    609.             break;
    610.                 case 2:
    611.             dest = MBS.MobileDirPad.Param.shiftButtonX;
    612.             break;
    613.                 case 3:
    614.             dest = MBS.MobileDirPad.Param.menuButtonX;
    615.             break;
    616.                 case 4:
    617.             dest = MBS.MobileDirPad.Param.qButtonX;
    618.             break;
    619.                 case 5:
    620.             dest = MBS.MobileDirPad.Param.wButtonX;
    621.             break;
    622.                 default:
    623.             console.error('MBS_MobileDirPad_Upgraded.js: button type ' + type + ' not recognised!');
    624.             break;
    625.         }
    626.         this._moveSpeed = (dest - this.x) / this._moveDuration;
    627.     }
    628.     //-----------------------------------------------------------------------------
    629.     // Scene_Base
    630.     //
    631.     // The base scene class for all other scenes
    632.     Scene_Base.prototype.isMobileDevice = function() {
    633.         return Utils.isMobileDevice() || MBS.MobileDirPad.Param.pcDebug;
    634.     };
    635.     Scene_Base.dirpad = true;
    636.     MBS.MobileDirPad.Scene_Base_start = Scene_Base.prototype.start;
    637.     Scene_Base.prototype.start = function() {
    638.         MBS.MobileDirPad.Scene_Base_start.apply(this, arguments);
    639.         Scene_Base.dirpad = Scene_Base.dirpad && this.isMobileDevice();
    640.         if (!MBS.MobileDirPad.Param.onlyInMap || this instanceof Scene_Map) {
    641.             this.createDirPad();
    642.             this.createActionButtons();
    643.             MBS.MobileDirPad.enable(Scene_Base.dirpad);
    644.         }
    645.     };
    646.     MBS.MobileDirPad.Scene_Base_update = Scene_Base.prototype.update;
    647.     Scene_Base.prototype.update = function() {
    648.         MBS.MobileDirPad.Scene_Base_update.apply(this, arguments);
    649.         if (this.isMobileDevice() && this._dirPad != undefined && this._aButton != undefined && this._cButton != undefined && this._shiftButton != undefined && this._mButton != undefined && this._qButton != undefined && this._wButton != undefined)
    650.             this._dirPad.visible = this._aButton.visible = this._cButton.visible = this._shiftButton.visible = this._mButton.visible = this._qButton.visible = this._wButton.visible = Scene_Base.dirpad;
    651.     };
    652.     Scene_Base.prototype.createDirPad = function() {
    653.         this._dirPad = new Sprite_DirPad();
    654.         this._dirPad.opacity = MBS.MobileDirPad.Param.opacity;
    655.         this._dirPad.x = MBS.MobileDirPad.Param.dPadX;
    656.         this._dirPad.y = MBS.MobileDirPad.Param.dPadY;
    657.         this.addChild(this._dirPad);
    658.     };
    659.     Scene_Base.prototype.createActionButtons = function() {
    660.         this._aButton = new Sprite_mbsButton(0);
    661.         this._aButton.opacity = MBS.MobileDirPad.Param.opacity;
    662.         this._aButton.x = MBS.MobileDirPad.Param.actionButtonX;
    663.         this._aButton.y = MBS.MobileDirPad.Param.actionButtonY;
    664.         this._cButton = new Sprite_mbsButton(1);
    665.         this._cButton.opacity = MBS.MobileDirPad.Param.opacity;
    666.         this._cButton.x = MBS.MobileDirPad.Param.cancelButtonX;
    667.         this._cButton.y = MBS.MobileDirPad.Param.cancelButtonY;
    668.       
    669.         this._shiftButton = new Sprite_mbsButton(2);
    670.         this._shiftButton.opacity = MBS.MobileDirPad.Param.opacity;
    671.         this._shiftButton.x = MBS.MobileDirPad.Param.shiftButtonX;
    672.         this._shiftButton.y = MBS.MobileDirPad.Param.shiftButtonY;
    673.       
    674.         this._mButton = new Sprite_mbsButton(3);
    675.         this._mButton.opacity = MBS.MobileDirPad.Param.opacity;
    676.         this._mButton.x = MBS.MobileDirPad.Param.menuButtonX;
    677.         this._mButton.y = MBS.MobileDirPad.Param.menuButtonY;
    678.       
    679.         this._qButton = new Sprite_mbsButton(4);
    680.         this._qButton.opacity = MBS.MobileDirPad.Param.opacity;
    681.         this._qButton.x = MBS.MobileDirPad.Param.qButtonX;
    682.         this._qButton.y = MBS.MobileDirPad.Param.qButtonY;
    683.       
    684.         this._wButton = new Sprite_mbsButton(5);
    685.         this._wButton.opacity = MBS.MobileDirPad.Param.opacity;
    686.         this._wButton.x = MBS.MobileDirPad.Param.wButtonX;
    687.         this._wButton.y = MBS.MobileDirPad.Param.wButtonY;
    688.         this.addChild(this._aButton);
    689.         this.addChild(this._cButton);
    690.         this.addChild(this._shiftButton);
    691.         this.addChild(this._mButton);
    692.         this.addChild(this._qButton);
    693.         this.addChild(this._wButton);
    694.     };
    695.     Scene_Base.prototype.hideUserInterface = function() {
    696.         this._dirPad.hide();
    697.         this._aButton.hide();
    698.         this._cButton.hide();
    699.         this._shiftButton.hide();
    700.         this._mButton.hide();
    701.         this._qButton.hide();
    702.         this._wButton.hide();
    703.     };
    704.     Scene_Base.prototype.showUserInterface = function() {
    705.         this._dirPad.show();
    706.         this._aButton.show();
    707.         this._cButton.show();
    708.         this._shiftButton.show();
    709.         this._mButton.show();
    710.         this._qButton.show();
    711.         this._wButton.show();
    712.     };
    713.     //-----------------------------------------------------------------------------
    714.     // Scene_Map
    715.     //
    716.     // The map scene
    717.     MBS.MobileDirPad.Scene_Map_createMessageWindow = Scene_Map.prototype.createMessageWindow;
    718.     Scene_Map.prototype.createMessageWindow = function() {
    719.         MBS.MobileDirPad.Scene_Map_createMessageWindow.call(this);
    720.         let oldStartMessage = this._messageWindow.startMessage;
    721.         let oldTerminateMessage = this._messageWindow.terminateMessage;
    722.         let scene = this;
    723.         this._messageWindow.startMessage = function() {
    724.             oldStartMessage.apply(this, arguments);
    725.             scene.hideUserInterface();
    726.         };
    727.         Window_Message.prototype.terminateMessage = function() {
    728.             oldTerminateMessage.apply(this, arguments);
    729.             scene.showUserInterface();
    730.         };
    731.     };
    732.     MBS.MobileDirPad.Scene_Map_terminate = Scene_Map.prototype.terminate;
    733.     Scene_Map.prototype.terminate = function() {
    734.         if (this.isMobileDevice())
    735.             this._dirPad.visible = this._aButton.visible = this._cButton.visible = this._shiftButton.visible = this._mButton.visible = this._qButton.visible = this._wButton.visible = false;
    736.         MBS.MobileDirPad.Scene_Map_terminate.apply(this, arguments);
    737.     };
    738.     MBS.MobileDirPad.Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch;
    739.     Scene_Map.prototype.processMapTouch = function() {
    740.         if (!(this.isMobileDevice() && Scene_Base.dirpad)) MBS.MobileDirPad.Scene_Map_processMapTouch.apply(this, arguments);
    741.     };
    742.     //-----------------------------------------------------------------------------
    743.     // Plugin Command
    744.     //
    745.     MBS.MobileDirPad.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    746.       Game_Interpreter.prototype.pluginCommand = function (command, args) {
    747.         MBS.MobileDirPad.Game_Interpreter_pluginCommand.apply(this, arguments);
    748.         let cmd = command.toUpperCase();
    749.         let args0 = args[0].toUpperCase();
    750.           if (cmd === "MOBILEDIRPAD") {
    751.               if (args0 === "ENABLE") {
    752.                   MBS.MobileDirPad.enable(true);
    753.               } else if (args0 === "disable") {
    754.                   MBS.MobileDirPad.enable(false);
    755.               }
    756.           }
    757.       };
    758. // })(MBS.MobileDirPad);
    759. Imported["MBS_MobileDirPad_Upgraded"] = 1.1;
    760. if (Imported["MVCommons"]) {
    761.       PluginManager.register("MBS_MobileDirPad_Upgraded", 1.1, "Shows a DirPad and action buttons when using mobile devices", {
    762.       email: "masked.rpg@gmail.com",
    763.       name: "Masked",
    764.       website: "N/A"
    765.     }, "31-10-2015");
    766. }
    复制代码


    Terms of Use

    - You MUST give credits to Masked.
    It follows the one already made by the author here.

    [/CENTER]
    Update Log
    Version 1.0 - 04/11/2020
    - Released!


    本贴来自国际rpgmaker官方论坛作者:Eliaquim处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/mbs_mobiledirpad_upgraded.120070/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 10:42 , Processed in 0.118508 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表