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

Project1

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

[已经解决] 求教,窗口修改

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
跳转到指定楼层
1
发表于 2014-4-12 12:50:27 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 guoyq1988 于 2014-4-12 12:51 编辑

如图所示,获得的物品按顺序出现在对应的坐标上
脚本盲,虽然知道在172行那里改,但修改了好多次都不行,求教!

  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.     [url=home.php?mod=space&uid=13302]@exp[/url] = exp
  15.     [url=home.php?mod=space&uid=236945]@gold[/url] = 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.z = 9999
  42.     @win_window.windowskin = RPG::Cache.windowskin("替换窗口- 5.png")
  43.    
  44. #  if @treasures.size != 3
  45.     @exp_window = Window_Base.new(225, 141, 188, 48)
  46. #  else
  47. #   @exp_window = Window_Base.new(225, 141 + 40, 188, 48)
  48. # end
  49.   
  50.     @exp_window.contents = Bitmap.new(368, 32)
  51.     exp_string = "获得经验值"
  52.     @exp_window.contents.font.size = 16
  53.     @exp_window.contents.font.name = Font.default_name
  54.     #@win_window.contents.font.size = Font.default_size
  55.     @exp_window.contents.font.color = Color.new(-255,-255,-255,255)
  56.     @exp_window.contents.draw_text(5, -8, 78, 32, exp_string)
  57.     @exp_window.z = 9999
  58.     @exp_window.visible = false
  59.     @exp_window.windowskin = RPG::Cache.windowskin("替换窗口- 5.png")
  60.    
  61.    
  62. #   if @treasures.size != 3
  63.     @money_window = Window_Base.new(190, 146 + 58 - 10, 268, 48)
  64. # else
  65. #    @money_window = Window_Base.new(190, 146 + 88, 268, 48)
  66. #  end
  67.     @money_window.contents = Bitmap.new(368, 32)
  68.     money_string = "打败敌人获得           文钱"
  69.     @money_window.contents.font.size = 16
  70.     @money_window.contents.font.name = Font.default_name
  71.     #@win_window.contents.font.size = Font.default_size
  72.     @money_window.contents.font.color = Color.new(-255,-255,-255,255)
  73.     @money_window.contents.draw_text(5, -8, 268, 32, money_string)
  74.     @money_window.z = 9999
  75.     @money_window.visible = false
  76.     @money_window.windowskin = RPG::Cache.windowskin("替换窗口- 5.png")
  77.    
  78.     #if @treasures.size != 3 and @treasures.size > 3
  79.     #@win_item_window = Window_Base.new(205, 146 + 116 - 15, 238, 48)
  80.     @win_item_window = Window_Base.new(120, 146 + 116 - 15, 400, 150)
  81.     #@win_item_window = Window_Base.new(205 + 48, 146 + 116 - 15, 118, 88)
  82.     @win_item_window.contents = Bitmap.new(400, 32)
  83.     win_item_string = "获得物品"
  84.     @win_item_window.contents.font.size = 16
  85.     @win_item_window.contents.font.name = Font.default_name
  86.     @win_item_window.contents.font.color = Color.new(-255,-255,-255,255)
  87.     @win_item_window.contents.draw_text(150, -8, 200, 32, win_item_string)
  88.     @win_item_window.z = 9999
  89.     @win_item_window.visible = false
  90.     @win_item_window.windowskin = RPG::Cache.windowskin("替换窗口- 5.png")
  91.    #   end
  92.       
  93.     refresh
  94.   end

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

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

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

点评

更新了  发表于 2014-4-12 20:22
上传工程我试试看  发表于 2014-4-12 13:34

   
【RMXP共享】50个脚本整合的系统

Lv3.寻梦者

梦石
0
星屑
2744
在线时间
2630 小时
注册时间
2013-1-16
帖子
5657

贵宾

2
发表于 2014-4-12 13:15:07 | 只看该作者
本帖最后由 myownroc 于 2014-4-12 20:21 编辑

建议参考Window_Item的内容……


思路:将战利品放入一个数组中,根据其在数组中的index判断左右的位置,然后更改相应的x坐标
ps:脚本盲赶紧去学啊……
如果上传工程,我可以帮你改改。


将166行for item in treasures到176行end的内容替换为
  1.     t = @treasures.size / 2
  2.     t = t + 1 if @treasures.size % 2 == 1
  3.     @win_item_window.height = 32 * (t + 1) + 24
  4.     for i in [email protected]
  5.       item = @treasures[i]
  6.       x = i % 2 == 0 ? 32 : i % 2 == 1 ? 160 : 160
  7.       y = i / 2 * 32 + 320
  8.       @win_item_window.visible = true
  9.       draw_item_name1(item, x, y)
  10.     end
复制代码
几个说明:坐标什么的要是不满意请自行修改……
白色的字写在近乎白色的底上实在不合适
如果战利品多,则战利品窗口会遮挡住战斗图(这个我不管了……)

最后吐槽一下脚本的排版

点评

为楼主的好学精神而感动0.0~~  发表于 2014-4-15 09:25
....那个系统我是一个一个整合进去的,排版神马的没注意。。。  发表于 2014-4-12 20:29
并非本人不想学,只是奔三的上班族,中午学了,晚上又忘了,目前在看侠客的视频教程,慢慢学了  发表于 2014-4-12 19:03
链接: http://pan.baidu.com/s/1kTDiPKz  发表于 2014-4-12 19:00

评分

参与人数 1星屑 +155 收起 理由
怪蜀黍 + 155 认可答案,别自己分类啊去申请认可.

查看全部评分

(Created by @喵kano)


施工现场:hotege.github.io
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
3
 楼主| 发表于 2014-4-12 20:45:15 | 只看该作者
myownroc 发表于 2014-4-12 13:15
建议参考Window_Item的内容……


思路:将战利品放入一个数组中,根据其在数组中的index判断左右的位置 ...

谢谢版主
测试可行,坐标那些我直接会改
扯谈下,本人每测试一个脚本就会先备份一次
这个是3月备份的,有点乱
新的工程因为加入地图和音频,有近200M,就没上传

点评

看得出来  发表于 2014-4-13 00:47

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 23:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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