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

Project1

 找回密码
 注册会员
搜索

战斗结束物品显示

查看数: 2051 | 评论数: 3 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2015-2-3 13:42

正文摘要:

XP默认的脚本,战斗结束之后,会显示获得的 经验 金钱 物品这些,但是都是统一显示的, 我是这么改的,不过总觉得有问题。来个朋友帮看下#==================================================================== ...

回复

邪月长啸 发表于 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 楼主是要分开显示,搞错了

查看全部评分

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

点评

其他都没改吗?好神奇!  发表于 2015-2-3 20:03
貌似可以达到我要的效果,先显示经验和金钱,然后按下C键盘,显示物品和装备,1次显示1个,问题是如果有10个装备的,就要弄10个tiem_name。。。  发表于 2015-2-3 19:56
rpg-sheep 发表于 2015-2-3 17:21:20
"你获得了" + @tiem_name.to_s

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

点评

貌似@item_name.to_s的时候,没发现啥问题。  发表于 2015-2-3 19:56
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-11-27 08:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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