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

Project1

 找回密码
 注册会员
搜索

关于状态窗口改造(依据角色不同自定义不同背景)的问题

查看数: 4550 | 评论数: 7 | 收藏 1
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2016-1-18 22:34

正文摘要:

本帖最后由 负零 于 2016-1-18 22:35 编辑 经过@夏末渐离的提示(准确说是枪手),已经解决了插入问题,但现在另外一个问题难住了,就是依据角色不同自定义不同背景。在VA上是实现的,也请各位大神指导指导。 首 ...

回复

lirhtc 发表于 2016-3-25 18:01:59
请问您是如何用谷歌的这个Developer Tools 来调试MV程序的,方便告知一下吗?十分感谢
负零 发表于 2016-1-24 12:19:17
夜狠简单 发表于 2016-1-19 04:26
/*:
*@plugindesc        给角色简单的增加自己的背景。
@author        - -

已经弄好
  1. //-----------------------------------------------------------------------------
  2. // Window_Status
  3. //
  4. // The window for displaying full status on the status screen.

  5. function Window_Status() {
  6.     this.initialize.apply(this, arguments);
  7. }

  8. Window_Status.prototype = Object.create(Window_Selectable.prototype);
  9. Window_Status.prototype.constructor = Window_Status;

  10. Window_Status.prototype.initialize = function() {
  11.     var width = Graphics.boxWidth;
  12.     var height = Graphics.boxHeight;
  13.     Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
  14.         this.opacity = 0;
  15.     this.refresh();
  16.     this.activate();
  17. };

  18. Window_Status.prototype.setActor = function(actor) {
  19.     if (this._actor !== actor) {
  20.         this._actor = actor;
  21.                 this.removeChild(this.backSprite2);
  22.         this.refresh();
  23.     }
  24. };

  25. Window_Status.prototype.refresh = function() {
  26.     this.contents.clear();
  27.     if (this._actor) {
  28.         var lineHeight = this.lineHeight();
  29.         // this.drawBlock1(lineHeight * 0);
  30.         this.drawHorzLine(lineHeight * 1);
  31.         // this.drawBlock2(lineHeight * 2);
  32.         this.drawHorzLine(lineHeight * 6);
  33.         this.drawBlock3(lineHeight * 7);
  34.         this.drawHorzLine(lineHeight * 13);
  35.         this.drawBlock4(lineHeight * 14);
  36.                 this.draw_backg();
  37.                 // =========================================
  38.                                 // var bitm='Status_'+this._actor.name();//读取 Status_角色名 图片
  39.                 // this.backSprite2 = new Sprite(ImageManager.loadBattleback1(bitm));
  40.             // this.backSprite2.opacity=255;//透明度设置
  41.             // this.addChild(this.backSprite2);
  42.                         // =========================================
  43.     }
  44. };

  45. Window_Status.prototype.drawBlock1 = function(y) {
  46.     this.drawActorName(this._actor, 6, y);
  47.     this.drawActorClass(this._actor, 192, y);
  48.     this.drawActorNickname(this._actor, 432, y);
  49. };

  50. Window_Status.prototype.drawBlock2 = function(y) {
  51.     this.drawActorFace(this._actor, 12, y);
  52.     this.drawBasicInfo(204, y);
  53.     this.drawExpInfo(456, y);
  54. };

  55. Window_Status.prototype.drawBlock3 = function(y) {
  56.     this.drawParameters(48, y);
  57.     // this.drawEquipments(432, y);
  58. };

  59. Window_Status.prototype.drawBlock4 = function(y) {
  60.     this.drawProfile(6, y);
  61. };

  62. Window_Status.prototype.drawHorzLine = function(y) {
  63.     var lineY = y + this.lineHeight() / 2 - 1;
  64.     this.contents.paintOpacity = 48;
  65.     this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
  66.     this.contents.paintOpacity = 255;
  67. };

  68. Window_Status.prototype.lineColor = function() {
  69.     return this.normalColor();
  70. };

  71. Window_Status.prototype.drawBasicInfo = function(x, y) {
  72.     var lineHeight = this.lineHeight();
  73.     this.drawActorLevel(this._actor, x, y + lineHeight * 0);
  74.     this.drawActorIcons(this._actor, x, y + lineHeight * 1);
  75.     this.drawActorHp(this._actor, x, y + lineHeight * 2);
  76.     this.drawActorMp(this._actor, x, y + lineHeight * 3);
  77. };

  78. Window_Status.prototype.drawParameters = function(x, y) {
  79.     var lineHeight = this.lineHeight();
  80.     for (var i = 0; i < 6; i++) {
  81.         var paramId = i + 2;
  82.         var y2 = y + lineHeight * i;
  83.         this.changeTextColor(this.systemColor());
  84.         this.drawText(TextManager.param(paramId), x, y2, 160);
  85.         this.resetTextColor();
  86.         this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
  87.     }
  88. };

  89. Window_Status.prototype.drawExpInfo = function(x, y) {
  90.     var lineHeight = this.lineHeight();
  91.     var expTotal = TextManager.expTotal.format(TextManager.exp);
  92.     var expNext = TextManager.expNext.format(TextManager.level);
  93.     var value1 = this._actor.currentExp();
  94.     var value2 = this._actor.nextRequiredExp();
  95.     if (this._actor.isMaxLevel()) {
  96.         value1 = '-------';
  97.         value2 = '-------';
  98.     }
  99.     this.changeTextColor(this.systemColor());
  100.     this.drawText(expTotal, x, y + lineHeight * 0, 270);
  101.     this.drawText(expNext, x, y + lineHeight * 2, 270);
  102.     this.resetTextColor();
  103.     this.drawText(value1, x, y + lineHeight * 1, 270, 'right');
  104.     this.drawText(value2, x, y + lineHeight * 3, 270, 'right');
  105. };

  106. Window_Status.prototype.drawEquipments = function(x, y) {
  107.     var equips = this._actor.equips();
  108.     var count = Math.min(equips.length, this.maxEquipmentLines());
  109.     for (var i = 0; i < count; i++) {
  110.         this.drawItemName(equips[i], x, y + this.lineHeight() * i);
  111.     }
  112. };

  113. Window_Status.prototype.drawProfile = function(x, y) {
  114.     this.drawTextEx(this._actor.profile(), x, y);
  115. };

  116. Window_Status.prototype.maxEquipmentLines = function() {
  117.     return 6;
  118. };

  119. Window_Status.prototype.draw_backg = function()
  120. {
  121.     var bitm='Status_'+this._actor.name();//读取 Status_角色名 图片
  122.         //this.contents.clear();
  123.         this.back_sprite=new Sprite();
  124.     this.back_sprite.bitmap=ImageManager.loadBattleback1(bitm);
  125.         this.back_sprite.opacity=255
  126.         this.addChild(this.back_sprite);
  127.     this.addChildToBack(this.back_sprite); //or this.addChildAt(child,index);
  128. };
复制代码
帮忙看看,有哪个地方不妥的。

点评

~~!  发表于 2016-1-24 21:17
你居然让我等了好几天  发表于 2016-1-24 13:14
负零 发表于 2016-1-19 17:22:32
感谢楼上,我先试试。

点评

你弄好教教我  发表于 2016-1-19 22:21
夜狠简单 发表于 2016-1-19 04:26:42
JAVASCRIPT 代码复制
  1. /*:
  2. *@plugindesc        给角色简单的增加自己的背景。
  3. @author        - -
  4. @param       
  5. @desc       
  6. @default       
  7. *@help        例如一号角色叫’哈罗德‘,则在img\battlebacks1文件下放一张命名为
  8. *Status_哈罗德.png的图片作为角色背景图 ,默认透明度140
  9. */
  10.  
  11.  
  12.  
  13. (function() {
  14.  
  15.  
  16.  
  17. Window_Status.prototype = Object.create(Window_Selectable.prototype);
  18. Window_Status.prototype.constructor = Window_Status;
  19.  
  20. Window_Status.prototype.initialize = function() {
  21.     var width = Graphics.boxWidth;
  22.     var height = Graphics.boxHeight;
  23.     Window_Selectable.prototype.initialize.call(this, 0, 0, width, height);
  24.     this.refresh();
  25.     this.activate();
  26. };
  27.  
  28.  
  29.  
  30. Window_Status.prototype.setActor = function(actor) {
  31.     if (this._actor !== actor) {
  32.         this._actor = actor;
  33. //=====================================================
  34.                 this.removeChild(this.backSprite2);
  35. //=====================================================
  36.         this.refresh();
  37.     }
  38. };
  39.  
  40.  
  41.  
  42. Window_Status.prototype.refresh = function() {
  43.     this.contents.clear();
  44.     if (this._actor) {
  45.         var lineHeight = this.lineHeight();
  46.         this.drawBlock1(lineHeight * 0);
  47.         this.drawHorzLine(lineHeight * 1);
  48.         this.drawBlock2(lineHeight * 2);
  49.         this.drawHorzLine(lineHeight * 6);
  50.         this.drawBlock3(lineHeight * 7);
  51.         this.drawHorzLine(lineHeight * 13);
  52.         this.drawBlock4(lineHeight * 14);
  53. //=========================================================================
  54.                 var bitm='Status_'+this._actor.name();//读取 Status_角色名 图片
  55.                 this.backSprite2 = new Sprite(ImageManager.loadBattleback1(bitm));
  56.             this.backSprite2.opacity=140;//透明度设置
  57.             this.addChild(this.backSprite2);
  58. //=========================================================================
  59.     };
  60. };
  61.  
  62. Window_Status.prototype.drawBlock1 = function(y) {
  63.     this.drawActorName(this._actor, 6, y);
  64.     this.drawActorClass(this._actor, 192, y);
  65.     this.drawActorNickname(this._actor, 432, y);
  66. };
  67.  
  68. Window_Status.prototype.drawBlock2 = function(y) {
  69.     this.drawActorFace(this._actor, 12, y);
  70.     this.drawBasicInfo(204, y);
  71.     this.drawExpInfo(456, y);
  72. };
  73.  
  74. Window_Status.prototype.drawBlock3 = function(y) {
  75.     this.drawParameters(48, y);
  76.     this.drawEquipments(432, y);
  77. };
  78.  
  79. Window_Status.prototype.drawBlock4 = function(y) {
  80.     this.drawProfile(6, y);
  81. };
  82.  
  83. Window_Status.prototype.drawHorzLine = function(y) {
  84.     var lineY = y + this.lineHeight() / 2 - 1;
  85.     this.contents.paintOpacity = 48;
  86.     this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
  87.     this.contents.paintOpacity = 255;
  88. };
  89.  
  90. Window_Status.prototype.lineColor = function() {
  91.     return this.normalColor();
  92. };
  93.  
  94. Window_Status.prototype.drawBasicInfo = function(x, y) {
  95.     var lineHeight = this.lineHeight();
  96.     this.drawActorLevel(this._actor, x, y + lineHeight * 0);
  97.     this.drawActorIcons(this._actor, x, y + lineHeight * 1);
  98.     this.drawActorHp(this._actor, x, y + lineHeight * 2);
  99.     this.drawActorMp(this._actor, x, y + lineHeight * 3);
  100. };
  101.  
  102. Window_Status.prototype.drawParameters = function(x, y) {
  103.     var lineHeight = this.lineHeight();
  104.     for (var i = 0; i < 6; i++) {
  105.         var paramId = i + 2;
  106.         var y2 = y + lineHeight * i;
  107.         this.changeTextColor(this.systemColor());
  108.         this.drawText(TextManager.param(paramId), x, y2, 160);
  109.         this.resetTextColor();
  110.         this.drawText(this._actor.param(paramId), x + 160, y2, 60, 'right');
  111.     }
  112. };
  113.  
  114. Window_Status.prototype.drawExpInfo = function(x, y) {
  115.     var lineHeight = this.lineHeight();
  116.     var expTotal = TextManager.expTotal.format(TextManager.exp);
  117.     var expNext = TextManager.expNext.format(TextManager.level);
  118.     var value1 = this._actor.currentExp();
  119.     var value2 = this._actor.nextRequiredExp();
  120.     if (this._actor.isMaxLevel()) {
  121.         value1 = '-------';
  122.         value2 = '-------';
  123.     }
  124.     this.changeTextColor(this.systemColor());
  125.     this.drawText(expTotal, x, y + lineHeight * 0, 270);
  126.     this.drawText(expNext, x, y + lineHeight * 2, 270);
  127.     this.resetTextColor();
  128.     this.drawText(value1, x, y + lineHeight * 1, 270, 'right');
  129.     this.drawText(value2, x, y + lineHeight * 3, 270, 'right');
  130. };
  131.  
  132. Window_Status.prototype.drawEquipments = function(x, y) {
  133.     var equips = this._actor.equips();
  134.     var count = Math.min(equips.length, this.maxEquipmentLines());
  135.     for (var i = 0; i < count; i++) {
  136.         this.drawItemName(equips[i], x, y + this.lineHeight() * i);
  137.     }
  138. };
  139.  
  140. Window_Status.prototype.drawProfile = function(x, y) {
  141.     this.drawTextEx(this._actor.profile(), x, y);
  142. };
  143.  
  144. Window_Status.prototype.maxEquipmentLines = function() {
  145.     return 6;
  146. };
  147.  
  148. })();


点评

额,我已经尽力了,脑洞不行  发表于 2016-1-19 22:22
马蛋,自己看这句式和问句都不太舒服,不好意思。就是求指导的意思。  发表于 2016-1-19 18:11
求指导。  发表于 2016-1-19 17:37
设置255不透明的时候,还有一点透明?另外,数值描绘的Z轴小于背景?  发表于 2016-1-19 17:37

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 认可答案

查看全部评分

trentswd 发表于 2016-1-19 03:25:05
转义符啊
比如空格就是%20
为了防止麻烦,保持文件名里面只有大小写英文和数字和下划线就没有这种烦恼了……
西姐 发表于 2016-1-18 22:45:06
有个插件可以换立绘,但它根据的是队伍位置,我也想改成根据数据库ID的

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

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

GMT+8, 2024-12-3 22:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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