Guest User

Untitled

a guest
Jun 23rd, 2016
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.03 KB | None | 0 0
  1. //=============================================================================
  2. // AltMenuScreen3.js
  3. //=============================================================================
  4.  
  5. /*:
  6. * @plugindesc Yet Another menu screen layout.
  7. * @author Sasuke KANNAZUKI, Yoji Ojima
  8. *
  9. * @default
  10. * @param bgBitmapMenu
  11. * @desc background bitmap file at menu scene. put at img/pictures.
  12. * @default
  13. *
  14. * @param bgBitmapItem
  15. * @desc background bitmap file at item scene. put at img/pictures.
  16. * @default
  17. *
  18. * @param bgBitmapSkill
  19. * @desc background bitmap file at skill scene. put at img/pictures.
  20. * @default
  21. *
  22. * @param bgBitmapEquip
  23. * @desc background bitmap file at equip scene. put at img/pictures.
  24. * @default
  25. *
  26. * @param bgBitmapStatus
  27. * @desc background bitmap file at status scene. put at img/pictures.
  28. * @default
  29. *
  30. * @param bgBitmapOptions
  31. * @desc background bitmap file at option scene. put at img/pictures.
  32. * @default
  33. *
  34. * @param bgBitmapFile
  35. * @desc background bitmap file at save/load scene. put at img/pictures.
  36. * @default
  37. *
  38. * @param bgBitmapGameEnd
  39. * @desc background bitmap file at gameEnd scene. put at img/pictures.
  40. * @default
  41. *
  42. * @param maxColsMenu
  43. * @desc max column at menu window
  44. * @default 4
  45. *
  46. * @param commandRows
  47. * @desc number of visible rows at command window
  48. * @default 2
  49. *
  50. * @param isDisplayStatus
  51. * @desc whether display status or not. (1 = yes, 0 = no)
  52. * @default 1
  53. *
  54. * @param iconCoin
  55. * @desc Icon ID to coin/gold/money in the main menu.
  56. * @default 314
  57. *
  58. * @param textMapName
  59. * @desc Text to precede the name of current map.
  60. * @default Map Name:
  61. *
  62. * @param textPlaytime
  63. * @desc Text to playtime.
  64. * @default Playtime:
  65. *
  66. * @help This plugin does not provide plugin commands.
  67. * The differences with AltMenuscreen are follows:
  68. * - windows are transparent at all menu scene.
  69. * - it can set the background bitmap for each scenes at menu.
  70. * - picture is actors' original
  71. *
  72. * Actor' note:
  73. * <stand_picture:filename> set actor's standing picture at menu.
  74. * put file at img/pictures.
  75. *
  76. * preferred size of actor's picture:
  77. * width: 174px(maxColsMenu=4), 240px(maxColsMenu=3)
  78. * height: 408px(commandRows=2), 444px(commandRows=1)
  79. */
  80.  
  81. /*:ja
  82. * @plugindesc レイアウトの異なるメニュー画面
  83. * @author 神無月サスケ, Yoji Ojima
  84. *
  85. * @param bgBitmapMenu
  86. * @desc メニュー背景にするビットマップファイルです。
  87. * img/pictures に置いてください。
  88. * @default
  89. *
  90. * @param bgBitmapItem
  91. * @desc アイテム画面背景にするビットマップファイルです。
  92. * img/pictures に置いてください。
  93. * @default
  94. *
  95. * @param bgBitmapSkill
  96. * @desc スキル画面背景にするビットマップファイルです。
  97. * img/pictures に置いてください。
  98. * @default
  99. *
  100. * @param bgBitmapEquip
  101. * @desc 装備画面背景にするビットマップファイルです。
  102. * img/pictures に置いてください。
  103. * @default
  104. *
  105. * @param bgBitmapStatus
  106. * @desc ステータス画面背景にするビットマップファイルです。
  107. * img/pictures に置いてください。
  108. * @default
  109. *
  110. * @param bgBitmapOptions
  111. * @desc オプション画面背景にするビットマップファイルです。
  112. * img/pictures に置いてください。
  113. * @default
  114. *
  115. * @param bgBitmapFile
  116. * @desc セーブ/ロード画面背景にするビットマップファイルです。
  117. * img/pictures に置いてください。
  118. * @default
  119. *
  120. * @param bgBitmapGameEnd
  121. * @desc ゲーム終了画面背景にするビットマップファイルです。
  122. * img/pictures に置いてください。
  123. * @default
  124. *
  125. * @param maxColsMenu
  126. * @desc アクターを表示するウィンドウの1画面の登録最大数です。
  127. * @default 4
  128. *
  129. * @param commandRows
  130. * @desc コマンドウィンドウの行数です。
  131. * @default 2
  132. *
  133. * @param isDisplayStatus
  134. * @desc ステータスを表示するかしないかを選びます。(1 = yes, 0 = no)
  135. * @default 1
  136. *
  137. * @help このプラグインには、プラグインコマンドはありません。
  138. *
  139. * AltMenuscreen との違いは以下です:
  140. * - メニュー画面すべてのウィンドウが透明です
  141. * - メニューそれぞれのシーンに背景ビットマップを付けることが出来ます。
  142. * - アクターに立ち絵を利用します。
  143. *
  144. * アクターのメモに以下のように書いてください:
  145. * <stand_picture:ファイル名> ファイル名が、そのアクターの立ち絵になります。
  146. * ファイルは img/pictures に置いてください。
  147. *
  148. * 望ましいアクター立ち絵のサイズ:
  149. * 幅:3列:240px, 4列:174px
  150. * 高さ: コマンドウィンドウ 1行:444px 2行:408px
  151. *
  152. */
  153.  
  154. (function() {
  155.  
  156. // set parameters
  157. var parameters = PluginManager.parameters('AltMenuScreen3');
  158. var bgBitmapMenu = parameters['bgBitmapMenu'] || '';
  159. var bgBitmapItem = parameters['bgBitmapItem'] || '';
  160. var bgBitmapSkill = parameters['bgBitmapSkill'] || '';
  161. var bgBitmapEquip = parameters['bgBitmapEquip'] || '';
  162. var bgBitmapStatus = parameters['bgBitmapStatus'] || '';
  163. var bgBitmapOptions = parameters['bgBitmapOptions'] || '';
  164. var bgBitmapFile = parameters['bgBitmapFile'] || '';
  165. var bgBitmapGameEnd = parameters['bgBitmapGameEnd'] || '';
  166. var maxColsMenuWnd = Number(parameters['maxColsMenu'] || 4);
  167. var rowsCommandWnd = Number(parameters['commandRows'] || 2);
  168. var isDisplayStatus = !!Number(parameters['isDisplayStatus']);
  169.  
  170. var iconCoin = Number(parameters['iconCoin'] || 314);
  171. var textMapName = parameters['textMapName'] || "Map Name:";
  172. var textPlaytime = parameters['textPlaytime'] || "Playtime";
  173.  
  174. //
  175. // make transparent windows for each scenes in menu.
  176. //
  177. var _Scene_Menu_create = Scene_Menu.prototype.create;
  178. Scene_Menu.prototype.create = function() {
  179. _Scene_Menu_create.call(this);
  180. this._statusWindow.x = 0;
  181. this._statusWindow.y = this._commandWindow.height;
  182. // make transparent for all windows at menu scene.
  183. this._statusWindow.opacity = 0;
  184. this._goldWindow.opacity = 0;
  185. this._commandWindow.opacity = 0;
  186. };
  187.  
  188. var _Scene_Item_create = Scene_Item.prototype.create;
  189. Scene_Item.prototype.create = function() {
  190. _Scene_Item_create.call(this);
  191. this._helpWindow.opacity = 0;
  192. this._categoryWindow.opacity = 0;
  193. this._itemWindow.opacity = 0;
  194. this._actorWindow.opacity = 0;
  195. };
  196.  
  197. var _Scene_Skill_create = Scene_Skill.prototype.create;
  198. Scene_Skill.prototype.create = function() {
  199. _Scene_Skill_create.call(this);
  200. this._helpWindow.opacity = 0;
  201. this._skillTypeWindow.opacity = 0;
  202. this._statusWindow.opacity = 0;
  203. this._itemWindow.opacity = 0;
  204. this._actorWindow.opacity = 0;
  205. };
  206.  
  207. var _Scene_Equip_create = Scene_Equip.prototype.create;
  208. Scene_Equip.prototype.create = function() {
  209. _Scene_Equip_create.call(this);
  210. this._helpWindow.opacity = 0;
  211. this._statusWindow.opacity = 0;
  212. this._commandWindow.opacity = 0;
  213. this._slotWindow.opacity = 0;
  214. this._itemWindow.opacity = 0;
  215. };
  216.  
  217. var _Scene_Status_create = Scene_Status.prototype.create;
  218. Scene_Status.prototype.create = function() {
  219. _Scene_Status_create.call(this);
  220. this._statusWindow.opacity = 0;
  221. };
  222.  
  223. var _Scene_Options_create = Scene_Options.prototype.create;
  224. Scene_Options.prototype.create = function() {
  225. _Scene_Options_create.call(this);
  226. this._optionsWindow.opacity = 0;
  227. };
  228.  
  229. var _Scene_File_create = Scene_File.prototype.create;
  230. Scene_File.prototype.create = function() {
  231. _Scene_File_create.call(this);
  232. this._helpWindow.opacity = 0;
  233. this._listWindow.opacity = 0;
  234. };
  235.  
  236. var _Scene_GameEnd_create = Scene_GameEnd.prototype.create;
  237. Scene_GameEnd.prototype.create = function() {
  238. _Scene_GameEnd_create.call(this);
  239. this._commandWindow.opacity = 0;
  240. };
  241.  
  242. //
  243. // load bitmap that set in plugin parameter
  244. //
  245. var _Scene_Menu_createBackground = Scene_Menu.prototype.createBackground;
  246. Scene_Menu.prototype.createBackground = function(){
  247. if(bgBitmapMenu){
  248. this._backgroundSprite = new Sprite();
  249. this._backgroundSprite.bitmap =
  250. ImageManager.loadPicture(bgBitmapMenu);
  251. this.addChild(this._backgroundSprite);
  252. return;
  253. }
  254. // if background file is invalid, it does original process.
  255. _Scene_Menu_createBackground.call(this);
  256. };
  257.  
  258. var _Scene_Item_createBackground = Scene_Item.prototype.createBackground;
  259. Scene_Item.prototype.createBackground = function(){
  260. if(bgBitmapItem){
  261. this._backgroundSprite = new Sprite();
  262. this._backgroundSprite.bitmap =
  263. ImageManager.loadPicture(bgBitmapItem);
  264. this.addChild(this._backgroundSprite);
  265. return;
  266. }
  267. // if background file is invalid, it does original process.
  268. _Scene_Item_createBackground.call(this);
  269. };
  270.  
  271. var _Scene_Skill_createBackground = Scene_Skill.prototype.createBackground;
  272. Scene_Skill.prototype.createBackground = function(){
  273. if(bgBitmapSkill){
  274. this._backgroundSprite = new Sprite();
  275. this._backgroundSprite.bitmap =
  276. ImageManager.loadPicture(bgBitmapSkill);
  277. this.addChild(this._backgroundSprite);
  278. return;
  279. }
  280. // if background file is invalid, it does original process.
  281. _Scene_Skill_createBackground.call(this);
  282. };
  283.  
  284. var _Scene_Equip_createBackground = Scene_Equip.prototype.createBackground;
  285. Scene_Equip.prototype.createBackground = function(){
  286. if(bgBitmapEquip){
  287. this._backgroundSprite = new Sprite();
  288. this._backgroundSprite.bitmap =
  289. ImageManager.loadPicture(bgBitmapEquip);
  290. this.addChild(this._backgroundSprite);
  291. return;
  292. }
  293. // if background file is invalid, it does original process.
  294. _Scene_Equip_createBackground.call(this);
  295. };
  296.  
  297. var _Scene_Status_createBackground =
  298. Scene_Status.prototype.createBackground;
  299. Scene_Status.prototype.createBackground = function(){
  300. if(bgBitmapStatus){
  301. this._backgroundSprite = new Sprite();
  302. this._backgroundSprite.bitmap =
  303. ImageManager.loadPicture(bgBitmapStatus);
  304. this.addChild(this._backgroundSprite);
  305. return;
  306. }
  307. // if background file is invalid, it does original process.
  308. _Scene_Status_createBackground.call(this);
  309. };
  310.  
  311. var _Scene_Options_createBackground =
  312. Scene_Options.prototype.createBackground;
  313. Scene_Options.prototype.createBackground = function(){
  314. if(bgBitmapOptions){
  315. this._backgroundSprite = new Sprite();
  316. this._backgroundSprite.bitmap =
  317. ImageManager.loadPicture(bgBitmapOptions);
  318. this.addChild(this._backgroundSprite);
  319. return;
  320. }
  321. // if background file is invalid, it does original process.
  322. _Scene_Options_createBackground.call(this);
  323. };
  324.  
  325. var _Scene_File_createBackground = Scene_File.prototype.createBackground;
  326. Scene_File.prototype.createBackground = function(){
  327. if(bgBitmapFile){
  328. this._backgroundSprite = new Sprite();
  329. this._backgroundSprite.bitmap =
  330. ImageManager.loadPicture(bgBitmapFile);
  331. this.addChild(this._backgroundSprite);
  332. return;
  333. }
  334. // if background file is invalid, it does original process.
  335. _Scene_File_createBackground.call(this);
  336. };
  337.  
  338. var _Scene_GameEnd_createBackground =
  339. Scene_GameEnd.prototype.createBackground;
  340. Scene_GameEnd.prototype.createBackground = function(){
  341. if(bgBitmapGameEnd){
  342. this._backgroundSprite = new Sprite();
  343. this._backgroundSprite.bitmap =
  344. ImageManager.loadPicture(bgBitmapGameEnd);
  345. this.addChild(this._backgroundSprite);
  346. return;
  347. }
  348. // if background file is invalid, it does original process.
  349. _Scene_GameEnd_createBackground.call(this);
  350. };
  351.  
  352. //
  353. // alt menu screen processes
  354. //
  355. Window_MenuCommand.prototype.windowWidth = function() {
  356. return Graphics.boxWidth;
  357. };
  358.  
  359. Window_MenuCommand.prototype.maxCols = function() {
  360. return maxColsMenuWnd;
  361. };
  362.  
  363. Window_MenuCommand.prototype.numVisibleRows = function() {
  364. return rowsCommandWnd;
  365. };
  366.  
  367. Window_MenuStatus.prototype.windowWidth = function() {
  368. return Graphics.boxWidth;
  369. };
  370.  
  371. Window_MenuStatus.prototype.windowHeight = function() {
  372. var h1 = this.fittingHeight(1);
  373. var h2 = this.fittingHeight(rowsCommandWnd);
  374. return Graphics.boxHeight - h1 - h2;
  375. };
  376.  
  377. Window_MenuStatus.prototype.maxCols = function() {
  378. return maxColsMenuWnd;
  379. };
  380.  
  381. Window_MenuStatus.prototype.numVisibleRows = function() {
  382. return 1;
  383. };
  384.  
  385. Window_MenuStatus.prototype.drawItemImage = function(index) {
  386. var actor = $gameParty.members()[index];
  387. var rect = this.itemRectForText(index);
  388. // load stand_picture
  389. var bitmapName = $dataActors[actor.actorId()].meta.stand_picture;
  390. var bitmap = bitmapName ? ImageManager.loadPicture(bitmapName) : null;
  391. var w = Math.min(rect.width, (bitmapName ? bitmap.width : 144));
  392. var h = Math.min(rect.height, (bitmapName ? bitmap.height : 144));
  393. var lineHeight = this.lineHeight();
  394. this.changePaintOpacity(actor.isBattleMember());
  395. if(bitmap){
  396. var sx = (bitmap.width > w) ? (bitmap.width - w) / 2 : 0;
  397. var sy = (bitmap.height > h) ? (bitmap.height - h) / 2 : 0;
  398. var dx = (bitmap.width > rect.width) ? rect.x :
  399. rect.x + (rect.width - bitmap.width) / 2;
  400. var dy = (bitmap.height > rect.height) ? rect.y :
  401. rect.y + (rect.height - bitmap.height) / 2;
  402. this.contents.blt(bitmap, sx, sy, w, h, dx, dy);
  403. } else { // when bitmap is not set, do the original process.
  404. this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
  405. }
  406. this.changePaintOpacity(true);
  407. };
  408.  
  409. Window_MenuStatus.prototype.drawItemStatus = function(index) {
  410. if(!isDisplayStatus){
  411. return;
  412. }
  413. var actor = $gameParty.members()[index];
  414. var rect = this.itemRectForText(index);
  415. var x = rect.x;
  416. var y = rect.y;
  417. var width = rect.width;
  418. var bottom = y + rect.height;
  419. var lineHeight = this.lineHeight();
  420. this.drawActorName(actor, x, y + lineHeight * 0, width);
  421. this.drawActorLevel(actor, x, y + lineHeight * 1, width);
  422. this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
  423. this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
  424. this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
  425. this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
  426. };
  427.  
  428. var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
  429. Window_MenuActor.prototype.initialize = function() {
  430. _Window_MenuActor_initialize.call(this);
  431. this.y = this.fittingHeight(2);
  432. };
  433. //=============================================================================
  434. // Scene_Menu (modification)
  435. //
  436. // This modification replace the creation of Window_Gold for Window_MenuData.
  437. //=============================================================================
  438. Scene_Menu.prototype.createGoldWindow = function() {
  439. this._goldWindow = new Window_MenuData(0, 0);
  440. this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
  441. this.addWindow(this._goldWindow);
  442. };
  443.  
  444. var Silenity_Scene_Menu_update = Scene_Menu.prototype.update;
  445. Scene_Menu.prototype.update = function() {
  446. // Alias
  447. Silenity_Scene_Menu_update.call(this);
  448. // Atualização na janela de tempo de jogo e dinheiro.
  449. this._goldWindow.refresh();
  450. };
  451. //=============================================================================
  452. // Window_MenuData (new)
  453. //
  454. // This window shows the game time, actual map and gold.
  455. //=============================================================================
  456. function Window_MenuData() {
  457. this.initialize.apply(this, arguments);
  458. }
  459.  
  460. Window_MenuData.prototype = Object.create(Window_Base.prototype);
  461. Window_MenuData.prototype.constructor = Window_MenuData;
  462.  
  463. Window_MenuData.prototype.initialize = function(x, y) {
  464. var width = this.windowWidth();
  465. var height = this.windowHeight();
  466. Window_Base.prototype.initialize.call(this, x, y, width, height);
  467. this.refresh();
  468. };
  469.  
  470. Window_MenuData.prototype.windowWidth = function() {
  471. return Graphics.boxWidth;
  472. };
  473.  
  474. Window_MenuData.prototype.windowHeight = function() {
  475. return this.fittingHeight(1);
  476. };
  477.  
  478. Window_MenuData.prototype.refresh = function() {
  479. this.contents.clear();
  480. this.changeTextColor(this.systemColor());
  481. this.drawText(textMapName, 20, 0, this.contents.width / 2, 'left');
  482. this.drawText(textPlaytime, this.contents.width / 2 - 100, 0, this.contents.width / 2, 'left');
  483. this.resetTextColor();
  484. this.drawText($gameMap.displayName(), 120, 0, this.contents.width / 2, 'left');
  485. this.drawText($gameSystem.playtimeText(), this.contents.width / 2 + 5, 0, this.contents.width - 36, 'left');
  486. this.drawIcon(iconCoin, this.contents.width - 50, 0);
  487. var gold = "";
  488. gold += String(parseInt($gameParty.gold() / 1000));
  489. if (gold == "0") {
  490. gold = "";
  491. } else {
  492. gold += ",";
  493. };
  494. gold += String($gameParty.gold() % 1000);
  495. this.drawText(gold, this.contents.width - 135, 0, 74, 'right');
  496. };
  497.  
  498. Window_MenuData.prototype.open = function() {
  499. this.refresh();
  500. Window_Base.prototype.open.call(this);
  501. };
  502.  
  503. })();
Advertisement
Add Comment
Please, Sign In to add comment