设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
楼主: xjzsq
打印 上一主题 下一主题

[原创发布] [教程]RMMV脚本教程——菜单美化(一)

[复制链接]

Lv1.梦旅人

梦石
0
星屑
229
在线时间
41 小时
注册时间
2019-12-29
帖子
5
1
发表于 2019-12-30 01:30:50 | 显示全部楼层
交作业,真的就是照抄Window_Gold:
JAVASCRIPT 代码复制
  1. Window_Gold.prototype.refresh = function() {
  2.     var x = this.textPadding();
  3.     var width = this.contents.width - this.textPadding() * 2;
  4.     this.contents.clear();
  5.     this.drawIcon(313, 0, 0);
  6.     this.drawCurrencyValue(this.value(), this.currencyUnit(), x, 0, width);
  7. };
  8.  
  9.  
  10. var iconIndex = [208, 64, 137, 84, 75, 242, 229, 82];
  11. Window_MenuCommand.prototype.drawItem = function(index) {
  12.     var rect = this.itemRectForText(index);
  13.     var align = this.itemTextAlign();
  14.     this.resetTextColor();
  15.     this.changePaintOpacity(this.isCommandEnabled(index));
  16.     this.drawIcon(iconIndex[index],rect.x,rect.y);
  17.     this.drawText(this.commandName(index), rect.x+36, rect.y, rect.width, align);
  18. };
  19.  
  20.  
  21. Scene_Menu.prototype.create = function() {
  22.     //场景菜单基础 创建 呼叫(this)
  23.     Scene_MenuBase.prototype.create.call(this);
  24.     //创建命令窗口()
  25.     this.createCommandWindow();
  26.     //创建金钱窗口()
  27.     this.createGoldWindow();
  28.     //创建状态窗口()
  29.     this.createStatusWindow();
  30.  
  31.     this.createStepWindow();
  32. };
  33. Scene_Menu.prototype.createStepWindow = function() {
  34.     //金钱窗口 = 新 窗口金钱(0,0)
  35.     this._StepWindow = new Window_Step(0, 0);
  36.     //金钱窗口 y = 图形 盒高 - 金钱窗口 高
  37.     this._StepWindow.y = Graphics.boxHeight - this._StepWindow.height*2;
  38.     //添加窗口(金钱窗口)
  39.     this.addWindow(this._StepWindow);
  40. }
  41.  
  42.  
  43. function Window_Step() {
  44.     this.initialize.apply(this, arguments);
  45. }
  46.  
  47.  
  48. Window_Step.prototype = Object.create(Window_Base.prototype);
  49.  
  50. Window_Step.prototype.constructor = Window_Step;
  51.  
  52.  
  53. Window_Step.prototype.initialize = function(x, y) {
  54.     var width = this.windowWidth();
  55.     var height = this.windowHeight();
  56.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  57.     this.refresh();
  58. };
  59.  
  60. Window_Step.prototype.windowWidth = function() {
  61.     return 240;
  62. };
  63.  
  64. Window_Step.prototype.windowHeight = function() {
  65.     return this.fittingHeight(1);
  66. };
  67.  
  68. Window_Step.prototype.refresh = function() {
  69.     var x = this.textPadding();
  70.     var width = this.contents.width - this.textPadding() * 2;
  71.     this.contents.clear();
  72.     this.drawIcon(176, 0, 0);
  73.     this.drawCurrencyValue(this.value(), this.currencyUnit(), x, 0, width);
  74. };
  75.  
  76. Window_Step.prototype.value = function() {
  77.     return $gameParty.steps();
  78. };
  79.  
  80. Window_Step.prototype.currencyUnit = function() {
  81.     return 's';
  82. };

点评

作业好评!就是图标选择的有点迷  发表于 2019-12-30 16:37
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-7 16:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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