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

Project1

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

[已经过期] 战斗结束物品显示

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3526
在线时间
1887 小时
注册时间
2010-6-19
帖子
1210
跳转到指定楼层
1
发表于 2015-2-3 13:42:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
XP默认的脚本,战斗结束之后,会显示获得的 经验 金钱 物品这些,但是都是统一显示的,


我像改成分开显示,先显示经验和经验,接着显示物品,如果多个物品的话,就1个1个显示。

我是这么改的,不过总觉得有问题。来个朋友帮看下
  1. #==============================================================================
  2. # ■ Window_BattleResult
  3. #------------------------------------------------------------------------------
  4. #  战斗结束时、显示获得的 EXP 及金钱的窗口。
  5. #==============================================================================

  6. class Window_BattleResult < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     exp       : EXP
  10.   #     gold      : 金钱
  11.   #     treasures : 宝物
  12.   #--------------------------------------------------------------------------
  13.   def initialize(exp, gold, treasures)
  14.     @exp = exp
  15.     @gold = gold
  16.     @treasures = treasures
  17.     super(160,200-20, 310,@treasures.size * 24 + 64 -16)
  18.     self.contents = Bitmap.new(width - 32, height - 32)
  19.     self.back_opacity = 255
  20.     self.y = 240 - height / 2
  21.     self.z = 1000
  22.     self.visible = false
  23.     refresh
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 刷新
  27.   #--------------------------------------------------------------------------
  28.   def refresh
  29.    for actor in $game_party.actors
  30.     self.contents.font.name = (["宋体","黑体"])
  31.     self.contents.font.bold = true                       # 字体粗细
  32.     self.contents.font.color = Color.new(255, 255, 88)   # 黄色
  33.     self.contents.font.size = 16
  34.       self.contents.draw_text(-1, -8,300, 32,"你得到了" + @exp.to_s + "点经验和" + @gold.to_s + "两银子。")
  35.       self.contents.draw_text(-1, 16,300, 32,"你获得了" + @tiem_name.to_s)
  36.       self.contents.draw_text(-1, 40,300, 32,"你获得了" + @tiem_name.to_s)
  37.       self.contents.draw_text(-1, 40+(24*1), 300, 32,"你获得了" + @tiem_name.to_s)
  38.       self.contents.draw_text(-1, 40+(24*2), 300, 32,"你获得了" + @tiem_name.to_s)
  39.     y = 32
  40.     for item in @treasures
  41.       draw_item_name(item, 4+20, y)
  42.       y += 24
  43.     end
  44.   end
  45. end
复制代码

Lv3.寻梦者

梦石
0
星屑
1019
在线时间
145 小时
注册时间
2013-10-16
帖子
271
2
发表于 2015-2-3 17:21:20 | 只看该作者
"你获得了" + @tiem_name.to_s

大神,你确认不是 @item_name.to_s?我醉了!

点评

貌似@item_name.to_s的时候,没发现啥问题。  发表于 2015-2-3 19:56
开心咸鱼每一天~
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
1
星屑
23984
在线时间
3339 小时
注册时间
2011-7-8
帖子
3926

开拓者

3
发表于 2015-2-3 19:39:13 | 只看该作者
draw之间没有 等待 的话是不是也是一口气都显示了?

点评

其他都没改吗?好神奇!  发表于 2015-2-3 20:03
貌似可以达到我要的效果,先显示经验和金钱,然后按下C键盘,显示物品和装备,1次显示1个,问题是如果有10个装备的,就要弄10个tiem_name。。。  发表于 2015-2-3 19:56
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
211
在线时间
845 小时
注册时间
2014-5-5
帖子
944
4
发表于 2015-2-10 12:42:00 | 只看该作者
  1. #==============================================================================
  2. # ■ Window_BattleResult
  3. #------------------------------------------------------------------------------
  4. #  战斗结束时、显示获得的 EXP 及金钱的窗口。
  5. #==============================================================================

  6. class Window_BattleResult < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     exp       : EXP
  10.   #     gold      : 金钱
  11.   #     treasures : 宝物
  12.   #--------------------------------------------------------------------------
  13.   def initialize(exp, gold, treasures)
  14.     @exp = exp
  15.     @gold = gold
  16.     @treasures = treasures
  17.    
  18.     super(160, 30, 320, 3 * 32 + 324)#@treasures.size * 32 + 164)
  19.     self.contents = Bitmap.new(width - 32, height - 32)
  20.     self.y = 160 - height / 2
  21.     self.z = 99999
  22.     #self.back_opacity = 160
  23.     #self.back_opacity = 0
  24.     self.windowskin = RPG::Cache.windowskin("")
  25.     #self.visible = false
  26.    
  27. #  if @treasures.size != 3
  28.     @win_window = Window_Base.new(260, 88, 118, 48)
  29. #   else
  30. #   @win_window = Window_Base.new(260, 88 + 40, 118, 48)
  31. #  end
  32.   
  33.     @win_window.contents = Bitmap.new(368, 32)
  34.     win_string = "战斗总结"
  35.     #@win_window.contents.font.name = "黑体"
  36.     @win_window.contents.font.size = 16
  37.     @win_window.contents.font.name = Font.default_name
  38.     #@win_window.contents.font.size = Font.default_size
  39.     @win_window.contents.font.color = Color.new(-255,-255,-255,255)
  40.     @win_window.contents.draw_text(8, -8, 78, 32, win_string)
  41.     @win_window.windowskin = RPG::Cache.windowskin("skin_pal2")
  42.    
  43. #  if @treasures.size != 3
  44.     @exp_window = Window_Base.new(225, 141, 188, 48)
  45. #  else
  46. #   @exp_window = Window_Base.new(225, 141 + 40, 188, 48)
  47. # end
  48.   
  49.     @exp_window.contents = Bitmap.new(368, 32)
  50.     exp_string = "获得经验值"
  51.     @exp_window.contents.font.size = 16
  52.     @exp_window.contents.font.name = Font.default_name
  53.     #@win_window.contents.font.size = Font.default_size
  54.     @exp_window.contents.font.color = Color.new(-255,-255,-255,255)
  55.     @exp_window.contents.draw_text(5, -8, 78, 32, exp_string)
  56.     @exp_window.visible = false
  57.     @exp_window.windowskin = RPG::Cache.windowskin("skin_pal2")
  58.    
  59.    
  60. #   if @treasures.size != 3
  61.     @money_window = Window_Base.new(190, 146 + 58 - 10, 268, 48)
  62. # else
  63. #    @money_window = Window_Base.new(190, 146 + 88, 268, 48)
  64. #  end
  65.     @money_window.contents = Bitmap.new(368, 32)
  66.     money_string = "打败敌人获得           文钱"
  67.     @money_window.contents.font.size = 16
  68.     @money_window.contents.font.name = Font.default_name
  69.     #@win_window.contents.font.size = Font.default_size
  70.     @money_window.contents.font.color = Color.new(-255,-255,-255,255)
  71.     @money_window.contents.draw_text(5, -8, 268, 32, money_string)
  72.     @money_window.z = 9999
  73.     @money_window.visible = false
  74.     @money_window.windowskin = RPG::Cache.windowskin("skin_pal2")
  75.    
  76.     #if @treasures.size != 3 and @treasures.size > 3
  77.     #@win_item_window = Window_Base.new(205, 146 + 116 - 15, 238, 48)
  78.     @win_item_window = Window_Base.new(180, 146 + 116 - 15, 290, 73)
  79.     #@win_item_window = Window_Base.new(205 + 48, 146 + 116 - 15, 118, 88)
  80.     @win_item_window.contents = Bitmap.new(368, 32)
  81.     win_item_string = "获得物品"
  82.     @win_item_window.contents.font.size = 16
  83.     @win_item_window.contents.font.name = Font.default_name
  84.     @win_item_window.contents.font.color = Color.new(-255,-255,-255,255)
  85.     @win_item_window.contents.draw_text(5, -8, 150, 32, win_item_string)
  86.     @win_item_window.z = 9999
  87.     @win_item_window.visible = false
  88.     @win_item_window.windowskin = RPG::Cache.windowskin("skin_pal2")
  89.    #   end
  90.       
  91.     refresh
  92.   end

  93.   #--------------------------------------------------------------------------
  94.   # ● 描绘物品名
  95.   #     item : 物品
  96.   #     x    : 描画目标 X 坐标
  97.   #     y    : 描画目标 Y 坐标
  98.   #--------------------------------------------------------------------------
  99.   def draw_item_name1(item, x, y)
  100.     if item == nil
  101.       return
  102.     end
  103.     bitmap = RPG::Cache.icon(item.icon_name)
  104.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  105.     self.contents.font.color = Color.new(-255, -255, -255, 255)
  106.     self.contents.font.size = 18
  107.     self.contents.draw_text(x +24, y, 212, 32, item.name)
  108.   end

  109.   #--------------------------------------------------------------------------
  110.   # ● 刷新
  111.   #--------------------------------------------------------------------------
  112.   def refresh
  113.     self.contents.clear
  114.     x = 4
  115.     #self.contents.font.color = normal_color
  116.    
  117.     20.times{Graphics.update}  
  118.    
  119.     @exp_window.visible = true
  120.     self.contents.font.color = Color.new(-255,-255,-255,255)
  121.     cx = contents.text_size(@exp.to_s).width
  122.     #self.contents.draw_text(155, 74, cx, 32, @exp.to_s)
  123.    
  124.    # if @treasures.size != 3
  125.     self.contents.draw_text(155, 74 + 114 - 5, cx, 32, @exp.to_s)
  126.    #   else
  127.   #  self.contents.draw_text(155, 74 + 114 + 35, cx, 32, @exp.to_s)
  128.   #  end
  129.     #self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  130.     x += cx + 4
  131.    
  132.     20.times{Graphics.update}  

  133.     #self.contents.font.color = system_color
  134.     #cx = contents.text_size("").width
  135.     #self.contents.draw_text(x, 0, 64, 32, "")
  136.     #x += cx + 16
  137.    
  138.     #self.contents.font.color = normal_color
  139.     self.contents.font.color = Color.new(-255,-255,-255,255)
  140.     cx = contents.text_size(@gold.to_s).width
  141.     #self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  142.     #self.contents.draw_text(145, 74 + 60, cx, 32, @gold.to_s)
  143.    
  144.     @money_window.visible = true
  145.    
  146.   #  if @treasures.size != 3
  147.     self.contents.draw_text(140, 74 + 172 - 10, cx, 32, @gold.to_s)
  148.    #   else
  149.   #  self.contents.draw_text(140, 74 + 172 + 30, cx, 32, @gold.to_s)
  150. # end
  151.   
  152.     x += cx + 4
  153.    
  154.     #self.contents.font.color = system_color
  155.     #self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  156.     y = 282 + 26#21 - 15
  157.    
  158.     20.times{Graphics.update}  
  159.    
  160.     for item in @treasures
  161.       #self.contents.color = Color.new(-255,-255,-255,255)
  162.       #self.contents.draw_item_name(item, 90, y)
  163.    # if @treasures.size != 3 and @treasures.size > 3
  164.       @win_item_window.visible = true
  165.     #  end
  166.       draw_item_name1(item,x-20 ,286 + 25)#90, y)
  167.       #draw_item_name(item,90, y)
  168.       x += 120
  169.       y += 32
  170.    end
  171.     20.times{Graphics.update}  
  172.    
  173.   end
  174.   
  175.     def dispose
  176.       super
  177.       @win_window.dispose
  178.       @exp_window.dispose
  179.       @money_window.dispose
  180.       @win_item_window.dispose
  181.       end
  182. end
  183.   
复制代码

评分

参与人数 1星屑 +66 收起 理由
hys111111 + 66 楼主是要分开显示,搞错了

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 17:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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