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

Project1

 找回密码
 注册会员
搜索
123
返回列表 发新帖
楼主: xjzsq
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
1
在线时间
0 小时
注册时间
2021-10-11
帖子
3
21
发表于 2021-10-11 18:04:19 | 只看该作者
支持一下
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
390
在线时间
48 小时
注册时间
2020-4-24
帖子
61
22
发表于 2021-11-14 18:14:49 | 只看该作者
作业那个怎么总是覆盖金钱的窗口啊...
风碎于形
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
390
在线时间
48 小时
注册时间
2020-4-24
帖子
61
23
发表于 2021-11-14 18:42:44 | 只看该作者
本帖最后由 haiyin 于 2021-11-14 19:02 编辑

找到问题了,我之前所做的都只是新增了窗口,但是并没有在scenes中显示出来...好像还没有人交作业,我就交下作业吧 有点乱..



  1. /*:
  2. *@author 作者
  3. *@plugindesc 插件描述
  4. *@help 帮助文档
  5. *
  6. *
  7. */

  8. (function() {
  9.         //金钱窗口
  10.         function Window_DIY_Gold() {
  11.                 this.initialize.apply(this, arguments);
  12.         }
  13.         //继承Window_Gold.prototype
  14.         Window_DIY_Gold.prototype = Object.create(Window_Gold.prototype);
  15.         Window_DIY_Gold.prototype.constructor = Window_DIY_Gold;
  16.         //刷新
  17.         Window_DIY_Gold.prototype.refresh = function() {
  18.                 Window_Gold.prototype.refresh.call(this);
  19.                 this.drawIcon(313, 0, 0);
  20.         };
  21.         //创建窗口
  22.         Scene_Menu.prototype.createGoldWindow = function() {
  23.                 this._goldWindow = new Window_DIY_Gold(0, 0);
  24.                 this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
  25.                 this.addWindow(this._goldWindow);
  26.         };
  27.         //添加菜单图标 iconIndex对应的是菜单中从0开始的菜单选项索引值对应的图标索引值
  28.         var iconIndex = [208, 64, 137, 84, 75, 242, 229, 82];
  29.         Window_MenuCommand.prototype.drawItem = function(index) {
  30.                 //选项
  31.                 var rect = this.itemRectForText(index);
  32.                 //排列方式
  33.                 var align = this.itemTextAlign();
  34.                 //文字颜色
  35.                 this.resetTextColor();
  36.                 //透明状态
  37.                 this.changePaintOpacity(this.isCommandEnabled(index));
  38.                 //图标
  39.                 this.drawIcon(iconIndex[index], rect.x, rect.y);
  40.                 //MV中图标的大小是36*36,因此文字的x值应该向右也就是加上36 参数:名称 x y 宽 排列方式
  41.                 this.drawText(this.commandName(index), rect.x + 36, rect.y, rect.width - 36, align);
  42.         }
  43.         //创建步数窗口
  44.         function Window_DIY_Step() {
  45.                 this.initialize.apply(this, arguments);
  46.         }

  47.         Window_DIY_Step.prototype = Object.create(Window_Base.prototype);
  48.         //创建构造函数
  49.         Window_DIY_Step.prototype.constructor = Window_DIY_Step;

  50.         Window_DIY_Step.prototype.initialize = function(x, y) {
  51.                 var width = this.windowWidth();
  52.                 var height = this.windowHeight();
  53.                 Window_Base.prototype.initialize.call(this, x, y, width, height);
  54.                 this.refresh();
  55.         };

  56.         Window_DIY_Step.prototype.windowWidth = function() {
  57.                 return 240;
  58.         };

  59.         Window_DIY_Step.prototype.windowHeight = function() {
  60.                 return this.fittingHeight(1);
  61.         };

  62.         Window_DIY_Step.prototype.refresh = function() {
  63.                 var x = this.textPadding();
  64.                 var width = this.contents.width - this.textPadding() * 2;
  65.                 this.contents.clear();
  66.                 this.drawIcon(82, 0, 0);
  67.                 this.drawCurrencyValue(this.value(), this.currencyUnit(), x, 0, width);
  68.         };

  69.         Window_DIY_Step.prototype.value = function() {
  70.                 return $gameParty.steps();
  71.         };

  72.         Window_DIY_Step.prototype.currencyUnit = function() {
  73.                 return "S";
  74.         };

  75.         Window_DIY_Step.prototype.open = function() {
  76.                 this.refresh();
  77.                 Window_Base.prototype.open.call(this);
  78.         };
  79.         //新增步数窗口
  80.         Scene_Menu.prototype.createWindowDIYStep = function() {
  81.                 this._stepWindow = new Window_DIY_Step(0, 0);
  82.                 //设置上边距
  83.                 this._stepWindow.y = Graphics.boxHeight - this._stepWindow.height*2 - 5;
  84.                 this.addWindow(this._stepWindow);

  85.         }
  86.         //显示菜单窗口
  87.         Scene_Menu.prototype.create = function() {
  88.                 Scene_MenuBase.prototype.create.call(this);
  89.                 this.createCommandWindow();
  90.                 this.createGoldWindow();
  91.                 this.createStatusWindow();
  92.                 this.createWindowDIYStep();
  93.         };
  94. })();
复制代码

zy.PNG (780.04 KB, 下载次数: 11)

展示

展示

评分

参与人数 1+1 收起 理由
夏虫沉默 + 1 塞糖

查看全部评分

风碎于形
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
119
在线时间
7 小时
注册时间
2021-7-25
帖子
17
24
发表于 2021-11-25 15:34:30 | 只看该作者
66666666666666666666
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-26 00:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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