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

Project1

 找回密码
 注册会员
搜索
查看: 2160|回复: 3
打印 上一主题 下一主题

[已经解决] 这个脚本好像有点问题,求帮忙改改

[复制链接]

Lv1.梦旅人

梦石
0
星屑
144
在线时间
167 小时
注册时间
2014-12-16
帖子
50
跳转到指定楼层
1
发表于 2015-1-22 14:16:39 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_BattleResult
  3. #------------------------------------------------------------------------------
  4. #  战斗结束时、显示获得的 EXP 及金钱的窗口。
  5. #==============================================================================
  6.  
  7. class Window_BattleResult < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     exp       : EXP
  11.   #     gold      : 金钱
  12.   #     treasures : 宝物
  13.   #--------------------------------------------------------------------------
  14.   def initialize(exp, gold, treasures)
  15.     @exp = exp
  16.     @gold = gold
  17.     @treasures = treasures
  18.  
  19.     super(160, 30, 320, 3 * 32 + 324)#@treasures.size * 32 + 164)
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     self.y = 160 - height / 2
  22.     self.z = 99999
  23.     #self.back_opacity = 160
  24.     #self.back_opacity = 0
  25.     self.windowskin = RPG::Cache.windowskin("")
  26.     #self.visible = false
  27.  
  28. #  if @treasures.size != 3
  29.     @win_window = Window_Base.new(260, 88, 118, 48)
  30. #   else
  31. #   @win_window = Window_Base.new(260, 88 + 40, 118, 48)
  32. #  end
  33.  
  34.     @win_window.contents = Bitmap.new(368, 32)
  35.     win_string = "战斗总结"
  36.     #@win_window.contents.font.name = "黑体"
  37.     @win_window.contents.font.size = 16
  38.     @win_window.contents.font.name = Font.default_name
  39.     #@win_window.contents.font.size = Font.default_size
  40.     @win_window.contents.font.color = Color.new(255,255,255,255)
  41.     @win_window.contents.draw_text(5, -8, 268, 32, win_string)
  42.     @win_window.z = 9999
  43.     @win_window.windowskin = RPG::Cache.windowskin("plainpearl.png")
  44.  
  45. #  if @treasures.size != 3
  46.     @exp_window = Window_Base.new(225, 141, 188, 48)
  47. #  else
  48. #   @exp_window = Window_Base.new(225, 141 + 40, 188, 48)
  49. # end
  50.  
  51.     @exp_window.contents = Bitmap.new(368, 32)
  52.     exp_string = "获得经验值"
  53.     @exp_window.contents.font.size = 16
  54.     @exp_window.contents.font.name = Font.default_name
  55.     #@win_window.contents.font.size = Font.default_size
  56.     @exp_window.contents.font.color = Color.new(255,255,255,255)
  57.     @exp_window.contents.draw_text(5, -8, 268, 32, exp_string)
  58.     @exp_window.z = 9999
  59.     @exp_window.visible = false
  60.     @exp_window.windowskin = RPG::Cache.windowskin("plainpearl.png")
  61.  
  62.  
  63. #   if @treasures.size != 3
  64.     @money_window = Window_Base.new(190, 146 + 58 - 10, 268, 48)
  65. # else
  66. #    @money_window = Window_Base.new(190, 146 + 88, 268, 48)
  67. #  end
  68.     @money_window.contents = Bitmap.new(368, 32)
  69.     money_string = "打败敌人获得           金币"
  70.     @money_window.contents.font.size = 16
  71.     @money_window.contents.font.name = Font.default_name
  72.     #@win_window.contents.font.size = Font.default_size
  73.     @money_window.contents.font.color = Color.new(255,255,255,255)
  74.     @money_window.contents.draw_text(5, -8, 268, 32, money_string)
  75.     @money_window.z = 9999
  76.     @money_window.visible = false
  77.     @money_window.windowskin = RPG::Cache.windowskin("plainpearl.png")
  78.  
  79.     #if @treasures.size != 3 and @treasures.size > 3
  80.     #@win_item_window = Window_Base.new(205, 146 + 116 - 15, 238, 48)
  81.     @win_item_window = Window_Base.new(120, 146 + 116 - 15, 400, 150)
  82.     #@win_item_window = Window_Base.new(205 + 48, 146 + 116 - 15, 118, 88)
  83.     @win_item_window.contents = Bitmap.new(400, 32)
  84.     win_item_string = "获得物品"
  85.     @win_item_window.contents.font.size = 16
  86.     @win_item_window.contents.font.name = Font.default_name
  87.     @win_item_window.contents.font.color = Color.new(255,255,255,255)
  88.     @win_item_window.contents.draw_text(150, -8, 200, 32, win_item_string)
  89.     @win_item_window.z = 9999
  90.     @win_item_window.visible = false
  91.     @win_item_window.windowskin = RPG::Cache.windowskin("plainpearl.png")
  92.    #   end
  93.  
  94.     refresh
  95.   end
  96.  
  97.   #--------------------------------------------------------------------------
  98.   # ● 描绘物品名
  99.   #     item : 物品
  100.   #     x    : 描画目标 X 坐标
  101.   #     y    : 描画目标 Y 坐标
  102.   #--------------------------------------------------------------------------
  103.   def draw_item_name1(item, x, y)
  104.     if item == nil
  105.       return
  106.     end
  107.     bitmap = RPG::Cache.icon(item.icon_name)
  108.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  109.     self.contents.font.color = Color.new(-255, -255, -255, 255)
  110.     self.contents.font.size = 18
  111.     self.contents.draw_text(x +24, y, 212, 32, item.name)
  112.   end
  113.  
  114.   #--------------------------------------------------------------------------
  115.   # ● 刷新
  116.   #--------------------------------------------------------------------------
  117.   def refresh
  118.     self.contents.clear
  119.     x = 4
  120.     #self.contents.font.color = normal_color
  121.  
  122.     20.times{Graphics.update}  
  123.  
  124.     @exp_window.visible = true
  125.     self.contents.font.color = Color.new(-255,-255,-255,255)
  126.     cx = contents.text_size(@exp.to_s).width
  127.     #self.contents.draw_text(155, 74, cx, 32, @exp.to_s)
  128.  
  129.    # if @treasures.size != 3
  130.     self.contents.draw_text(155, 74 + 114 - 5, cx, 32, @exp.to_s)
  131.    #   else
  132.   #  self.contents.draw_text(155, 74 + 114 + 35, cx, 32, @exp.to_s)
  133.   #  end
  134.     #self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  135.     x += cx + 4
  136.  
  137.     20.times{Graphics.update}  
  138.  
  139.     #self.contents.font.color = system_color
  140.     #cx = contents.text_size("").width
  141.     #self.contents.draw_text(x, 0, 64, 32, "")
  142.     #x += cx + 16
  143.  
  144.     #self.contents.font.color = normal_color
  145.     self.contents.font.color = Color.new(-255,-255,-255,255)
  146.     cx = contents.text_size(@gold.to_s).width
  147.     #self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  148.     #self.contents.draw_text(145, 74 + 60, cx, 32, @gold.to_s)
  149.  
  150.     @money_window.visible = true
  151.  
  152.   #  if @treasures.size != 3
  153.     self.contents.draw_text(140, 74 + 172 - 10, cx, 32, @gold.to_s)
  154.    #   else
  155.   #  self.contents.draw_text(140, 74 + 172 + 30, cx, 32, @gold.to_s)
  156. # end
  157.  
  158.     x += cx+20
  159.  
  160.     #self.contents.font.color = system_color
  161.     #self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  162.     y = 282 + 26#21 - 15
  163.  
  164.     20.times{Graphics.update}  
  165.  
  166.     for item in @treasures
  167.       #self.contents.color = Color.new(-255,-255,-255,255)
  168.       #self.contents.draw_item_name(item, 90, y)
  169.    # if @treasures.size != 3 and @treasures.size > 3
  170.       @win_item_window.visible = true
  171.     #  end
  172.       draw_item_name1(item,x-200 ,320)#90, y)
  173.       #draw_item_name(item,90, y)
  174.       x += 120
  175.       y += 32
  176.    end
  177.     20.times{Graphics.update}  
  178.  
  179.   end
  180.  
  181.     def dispose
  182.       super
  183.       @win_window.dispose
  184.       @exp_window.dispose
  185.       @money_window.dispose
  186.       @win_item_window.dispose
  187.       end
  188.     end


为何得到了物品却没有显示出来呢?

评分

参与人数 1星屑 +35 收起 理由
︶ㄣ牛排ぶ + 35 手动认可奖励

查看全部评分

qliphoth.exe 中的 0x1i-666 确认到未处理的异常。

写入位置 0x00-000 时发生访问冲突。

您想忽略此错误并尝试继续吗? <Y/N>...[ ]

===CARNAGE===

恶gn善iod道ru知能oy似no相yr们gn我a与s经i已do人G那

着doo活lfe远永rif就g吃n子i果r的b树o命t生t摘又n手a伸w他怕d恐n在a现

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

2
发表于 2015-1-22 17:19:46 | 只看该作者
看看第 172 行有没有被正确调用,坐标是否在窗口内部

评分

参与人数 1星屑 +200 收起 理由
RyanBern + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
144
在线时间
167 小时
注册时间
2014-12-16
帖子
50
3
 楼主| 发表于 2015-1-22 19:01:38 | 只看该作者
taroxd 发表于 2015-1-22 17:19
看看第 172 行有没有被正确调用,坐标是否在窗口内部

知道了!谢谢!
qliphoth.exe 中的 0x1i-666 确认到未处理的异常。

写入位置 0x00-000 时发生访问冲突。

您想忽略此错误并尝试继续吗? <Y/N>...[ ]

===CARNAGE===

恶gn善iod道ru知能oy似no相yr们gn我a与s经i已do人G那

着doo活lfe远永rif就g吃n子i果r的b树o命t生t摘又n手a伸w他怕d恐n在a现
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
144
在线时间
167 小时
注册时间
2014-12-16
帖子
50
4
 楼主| 发表于 2015-1-22 19:20:16 | 只看该作者
taroxd 发表于 2015-1-22 17:19
看看第 172 行有没有被正确调用,坐标是否在窗口内部


再求教一下,我把172行改成这样后:draw_item_name1(item,0 ,320)#90, y)
为什么获得的物品全重叠在一起了啊?

点评

@taroxd:知道了,谢谢!  发表于 2015-1-23 19:11
不是你全部都画在了 (0, 320) 这个位置了吗?当然是重叠在一起的  发表于 2015-1-23 16:15
qliphoth.exe 中的 0x1i-666 确认到未处理的异常。

写入位置 0x00-000 时发生访问冲突。

您想忽略此错误并尝试继续吗? <Y/N>...[ ]

===CARNAGE===

恶gn善iod道ru知能oy似no相yr们gn我a与s经i已do人G那

着doo活lfe远永rif就g吃n子i果r的b树o命t生t摘又n手a伸w他怕d恐n在a现
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 20:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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