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

Project1

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

[已经解决] 如何修改物品选择项之间的间隔?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
31 小时
注册时间
2014-7-3
帖子
15
跳转到指定楼层
1
发表于 2014-11-28 16:26:17 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如图,使用的是线索仓库脚本

想请教一下大家怎么改变这几个物品之间的间隔……




↓我自行修改后的脚本……


RUBY 代码复制
  1. #####################################################################
  2. #简陋的线索仓库= =
  3. #
  4. #偷懒用了物品栏= =
  5. #调用$scene = Scene_Clue.new
  6. #物品名+“,”+类别代号+“,”+颜色代号= =
  7. #比如"照片,3,1"显示出来是照片类,粉色字= =
  8. #类别代号:   0 :侦探小说   1 :书信  2 :日记  3 :照片  4 :备用1  
  9. #5 :备用2  6 :备用3
  10. #(名称是胡乱设的说= =可以自己改~删掉大概也米关系吧= =)
  11. #颜色代号: 和帮助里一样的说
  12. #如果物品设置的不能使用,按回车显示出的就是物品说明```
  13. #可以使用的话就挂公共事件= =
  14.  
  15. #物品说明栏  \V[n]显示第n号变量的值
  16. #            \E  换行
  17. #            \C[n]换用第n号颜色
  18. #            \N[n]显示第n号角色名称
  19. #            \P[n]显示在cluepics里的cluepic_n图片(照片什么的用吧= =)
  20. #暂时米想到还有什么其他的了= =
  21. ########################################################################
  22. class Window_Clue < Window_Selectable
  23.   def initialize
  24.     super(0, 85, 640, 380)
  25.     @column_max = 2
  26.     refresh(0)
  27.     self.index = 0
  28.   end
  29.   def item
  30.     return @data[self.index]
  31.   end
  32.   def clear
  33.     if self.contents != nil
  34.     self.contents.clear
  35.   end
  36.   end
  37.   def refresh(type)
  38.     if self.contents != nil
  39.       self.contents.dispose
  40.       self.contents = nil
  41.     end
  42.     @data = []
  43. case type
  44. when 0
  45.     for i in 1...$data_items.size
  46.       if $data_items[i].name.split(/,/)[1] == "0" and $game_party.item_number(i) > 0
  47.         @data.push($data_items[i])
  48.       end
  49.     end
  50. when 1
  51.     for i in 1...$data_items.size
  52.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "1"
  53.         @data.push($data_items[i])
  54.       end
  55.     end
  56. when 2
  57.     for i in 1...$data_items.size
  58.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "2"
  59.         @data.push($data_items[i])
  60.       end
  61.     end
  62. when 3
  63.     for i in 1...$data_items.size
  64.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "3"
  65.         @data.push($data_items[i])
  66.       end
  67.     end
  68. when 4
  69.     for i in 1...$data_items.size
  70.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "4"
  71.         @data.push($data_items[i])
  72.       end
  73.     end
  74. when 5
  75.     for i in 1...$data_items.size
  76.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "5"
  77.         @data.push($data_items[i])
  78.       end
  79.     end
  80. when 6
  81.     for i in 1...$data_items.size
  82.       if $game_party.item_number(i) > 0 and $data_items[i].name.split(/,/)[1] == "6"
  83.         @data.push($data_items[i])
  84.       end
  85.     end
  86.   end
  87. @item_max = @data.size
  88.     if @item_max > 0
  89.       self.contents = Bitmap.new(width - 32, row_max * 32)
  90.       for i in 0...@item_max
  91.         draw_item(i)
  92.         self.z=1896
  93.       end
  94.     end
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 描绘项目
  98.   #     index : 项目编号
  99.   #--------------------------------------------------------------------------
  100.   def draw_item(index)
  101.     item = @data[index]
  102.     case item
  103.     when RPG::Item
  104.       number = $game_party.item_number(item.id)
  105.     end
  106.       self.contents.font.color = normal_color
  107.     x = 4 + index % 2 * (205 + 32)
  108.     y = index / 2 * 32
  109.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  110.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  111.     bitmap = RPG::Cache.icon(item.icon_name)
  112.     opacity = self.contents.font.color == normal_color ? 255 : 128
  113.  
  114. if !item.name.split(/,/)[2].nil?
  115.      self.contents.font.color = text_color(item.name.split(/,/)[2].to_i)
  116.    else
  117.      self.contents.font.color = text_color(7)
  118.    end
  119.  
  120.   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  121.     self.contents.draw_text(x + 28, y, 212, 32, item.name.split(/,/)[0], 0)
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 刷新帮助文本
  125.   #--------------------------------------------------------------------------
  126.   def update_help
  127.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  128.   end
  129. end
  130. module RPG
  131.   module Cache
  132.     def self.cluepic(filename)
  133.       self.load_bitmap("Graphics/cluepics/", filename)
  134.     end
  135.   end
  136. end
  137. class Window_ClueHelp < Window_Base
  138.   def initialize
  139.     super(50, 50, 380, 380)
  140.     self.contents = Bitmap.new(width - 32, height - 32)
  141.     self.z = 99999
  142.   end
  143.   def clear
  144.     self.contents.clear
  145.   end
  146.   def set_text(mes)
  147.     self.contents.clear
  148.     self.contents.font.color = normal_color
  149.     x = y = 0
  150.     @cursor_width = 0
  151.     if $game_temp.choice_start == 0
  152.       x = 8
  153.     end
  154.     if mes!= nil
  155.       text = mes.clone
  156.       begin
  157.         last_text = text.clone
  158.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  159.       end until text == last_text
  160.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  161.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  162.       end
  163.       text.gsub!(/\\\\/) { "\000" }
  164.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  165.       text.gsub!(/\\[Gg]/) { "\002" }
  166.       text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "\003[#{$1}]" }
  167.       text.gsub!(/\\[Ee]/) { "\004" }
  168.       while ((c = text.slice!(/./m)) != nil)
  169.         if c == "\000"
  170.           c = "\\"
  171.         end
  172.         if c == "\001"
  173.           text.sub!(/\[([0-9]+)\]/, "")
  174.           color = $1.to_i
  175.           if color >= 0 and color <= 7
  176.             self.contents.font.color = text_color(color)
  177.           end
  178.           next
  179.         end
  180.       if c == "\002"
  181.           y += 1
  182.         x = 0
  183.         next
  184.       end
  185.       if c == "\003"
  186.         text.sub!(/\[([0-9]+)\]/, "")
  187.         t = RPG::Cache.cluepic("cluepic_#{$1}")
  188.         self.contents.blt(x, 32 * y, t, t.rect)
  189.         t.dispose
  190.         next
  191.       end
  192.         if c == "\004"
  193.           y += 1
  194.           x = 0
  195.           if y >= $game_temp.choice_start
  196.             x = 8
  197.           end
  198.           next
  199.         end
  200.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  201.         x += self.contents.text_size(c).width
  202.       end
  203.     end
  204.   end
  205. end
  206. class Scene_Clue
  207.     def main
  208.           @spriteset = Spriteset_Map.new
  209.     @help_window = Window_ClueHelp.new
  210.     @help_window.visible = false
  211.     @clue_window = Window_Clue.new
  212.     @clue_window.opacity = 160
  213.     @clue_window.index = -1
  214.     @clue_window.clear
  215.     @clue_window.active = false
  216.     @class_window = Window_Command.new(160, ["————"])
  217. @class_window.opacity = 160
  218.     @clue_window.help_window = @help_window
  219.        Graphics.transition
  220.     loop do
  221.       Graphics.update
  222.       Input.update
  223.       update
  224.       if $scene != self
  225.         break
  226.       end
  227.     end
  228.     Graphics.freeze
  229.     @spriteset.dispose
  230.     @help_window.dispose
  231.     @clue_window.dispose
  232.     @class_window.dispose
  233.   end  
  234. def update
  235.     @help_window.update
  236.     @clue_window.update
  237.     @class_window.update
  238.     if @class_window.active
  239.       update_class
  240.       return
  241.     end
  242.     if @clue_window.active
  243.       update_clue
  244.       return
  245.     end
  246.       if @help_window.active
  247.       update_help
  248.       return
  249.     end
  250.   end
  251.    def update_class
  252.    if Input.trigger?(Input::B)
  253.      $game_system.se_play($data_system.cancel_se)
  254.      $scene = Scene_Map.new
  255.    end
  256.    if Input.trigger?(Input::C)
  257.      $game_system.se_play($data_system.decision_se)
  258.     @class_window.active = false
  259.      @clue_window.active = true
  260.      @clue_window.index = 0
  261.      @clue_window.refresh(@class_window.index)
  262.      @help_window.visible = false
  263.    end
  264.    if Input.dir4 !=0
  265.      @clue_window.refresh(@class_window.index)
  266.    end
  267. end
  268.     def update_clue
  269. @help_window.visible = false
  270.     if Input.trigger?(Input::B)
  271.       $game_system.se_play($data_system.cancel_se)
  272.       @help_window.clear
  273.       @help_window.visible = false
  274.       @clue_window.active = false
  275.       @class_window.active = true
  276.       @clue_window.index = -1
  277.     end
  278.     if Input.trigger?(Input::C)
  279.       @item = @clue_window.item
  280.       unless @item.is_a?(RPG::Item)
  281.         $game_system.se_play($data_system.buzzer_se)
  282.         return
  283.       end
  284.       if $game_party.item_can_use?(@item.id)
  285.          $game_system.se_play(@item.menu_se)
  286.         if @item.consumable
  287.           $game_party.lose_item(@item.id, 1)
  288.           @clue_window.draw_item(@clue_window.index)
  289.         end
  290.         if $game_party.all_dead?
  291.           $scene = Scene_Gameover.new
  292.           return
  293.         end
  294.         if @item.common_event_id > 0
  295.           $game_temp.common_event_id = @item.common_event_id
  296.           $scene = Scene_Map.new
  297.           return
  298.         end
  299.       return
  300.       else
  301.         $game_system.se_play($data_system.decision_se)
  302.       @clue_window.active = false
  303.     @help_window.visible = true
  304.     @help_window.active = true
  305.         return
  306.       end
  307.      end  
  308.  
  309.   end
  310.   def update_help
  311.     @help_window.active = true
  312.   @help_window.visible = true
  313.   if Input.trigger?(Input::B)
  314.       $game_system.se_play($data_system.cancel_se)
  315.      @help_window.active = false
  316.    @help_window.visible = false
  317.     @clue_window.active = true
  318.   end
  319.   end
  320. end

Lv1.梦旅人

梦石
0
星屑
76
在线时间
1379 小时
注册时间
2012-7-5
帖子
1698

开拓者

2
发表于 2014-11-30 13:06:42 | 只看该作者
你给的脚本第107行
    x = 4 + index % 2 * (205 + 32)
修改红字部分即可

评分

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

查看全部评分


  -fk: -azogi:
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
31 小时
注册时间
2014-7-3
帖子
15
3
 楼主| 发表于 2014-12-7 12:48:26 | 只看该作者
kuerlulu 发表于 2014-11-30 13:06
你给的脚本第107行
    x = 4 + index % 2 * (205 + 32)
修改红字部分即可

谢了,主要是我自己解决完了,我这个新手以后还是自己解决问题吧
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 14:36

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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