Project1

标题: 自从改了1024分辨率之后合成菜单出错了~~求助大大,感谢 [打印本页]

作者: xie7    时间: 2014-6-13 17:09
标题: 自从改了1024分辨率之后合成菜单出错了~~求助大大,感谢
本帖最后由 xie7 于 2014-6-13 17:12 编辑

感谢帮助~~~

window selectable里的
提示
RUBY 代码复制
  1. def item_width
  2.     (width - standard_padding * 2 + spacing) / col_max - spacing
  3.   end


这里出错



脚本用的是
RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # 本腳本來自[url]www.66RPG.com[/url],使用和轉載請保留此信息
  4. #==============================================================================
  5. #==============================================================================
  6. #
  7. #每添加一个制造的类型,最上面的类别菜单就会多一项。
  8. #
  9. #添加类型的方法是:
  10. #$game_party.add_cook_type(类别名称,类别介绍, 类别状态-默认false)
  11. #
  12. #举例:
  13. #$game_party.add_cook_type("制药","调配药品", true)
  14. #
  15. #添加配方的方法:
  16. #$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,配方状态)
  17. #
  18. #举例:
  19. #$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[18,2]],[[1,1]],true)
  20. #
  21. #调用窗口的方法:SceneManager.call(Scene_Cook)
  22. #
  23. #
  24. #==============================================================================
  25.  
  26. #==============================================================================
  27. # ■ Cookbook_Type
  28. #------------------------------------------------------------------------------
  29. #  食谱类型类。
  30. #==============================================================================
  31.  
  32. class Cookbook_Type
  33.   attr_reader :index
  34.   attr_reader :name
  35.   attr_reader :description
  36.   attr_reader :enabled
  37.   #--------------------------------------------------------------------------
  38.   # ● 初始化对象
  39.   #--------------------------------------------------------------------------
  40.   def initialize(index, name, description, enabled = false)
  41.     @index = index
  42.     @name = name
  43.     @description = description
  44.     @enabled = enabled
  45.   end
  46.  
  47.   def enable(en)
  48.     @enabled = en
  49.   end
  50. end
  51.  
  52. #==============================================================================
  53. # ■ Cookbook
  54. #------------------------------------------------------------------------------
  55. #  食谱类。本类在 Game_Task 类的内部使用。
  56. #   食谱属性:食谱序号,食谱名称,食谱类型,食谱介绍,原料,成品
  57. #==============================================================================
  58.  
  59. class Cookbook
  60.   attr_reader :index
  61.   attr_reader :name
  62.   attr_reader :description
  63.   attr_reader :type
  64.   attr_reader :input
  65.   attr_reader :output
  66.   attr_reader :enabled
  67.   #--------------------------------------------------------------------------
  68.   # ● 初始化对象
  69.   #--------------------------------------------------------------------------
  70.   def initialize(index, name, description, type, input, output, enabled = true)
  71.     @index = index
  72.     @name = name
  73.     @description = description
  74.     @type = type
  75.     @input = input
  76.     @output = output
  77.     @enabled = enabled
  78.   end
  79.  
  80.   def enable(en)
  81.     @enabled = en
  82.   end
  83.  
  84.   #--------------------------------------------------------------------------
  85.   # ● 查询列表中的物品
  86.   #--------------------------------------------------------------------------
  87.   def in_list?(item, list)
  88.     list.each do |arr|
  89.       return true if arr[0] == item.id
  90.     end
  91.     return false
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 查询是否是材料列表中的物品
  95.   #--------------------------------------------------------------------------
  96.   def resource?(item)
  97.     in_list?(item, @input)
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 查询是否是产出列表中的物品
  101.   #--------------------------------------------------------------------------
  102.   def output?(item)
  103.     in_list?(item, @output)
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 查询材料需求量
  107.   #--------------------------------------------------------------------------
  108.   def amount(item, i)
  109.     if i == 0
  110.       @input.each do |arr|
  111.         return arr[1] if arr[0] == item.id
  112.       end
  113.     else
  114.       @output.each do |arr|
  115.         return arr[1] if arr[0] == item.id
  116.       end
  117.     end
  118.     return 0
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 查询材料是否足够
  122.   #--------------------------------------------------------------------------
  123.   def enough?
  124.     input.each do |arr|
  125.       return false if $data_items[arr[0]] && arr[1] > $game_party.item_number($data_items[arr[0]])
  126.     end
  127.     return true
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● 查询某件材料是否足够
  131.   #--------------------------------------------------------------------------
  132.   def item_enough?(item)
  133.     input.each do |arr|
  134.       return false if arr[0] == item.id && arr[1] > $game_party.item_number(item)
  135.     end
  136.     return true
  137.   end
  138. end
  139.  
  140. #==============================================================================
  141. # ■ Game_Party
  142. #==============================================================================
  143.  
  144. class Game_Party < Game_Unit
  145.   #--------------------------------------------------------------------------
  146.   # ● 初始化对象
  147.   #--------------------------------------------------------------------------
  148.   alias old_init initialize
  149.   def initialize
  150.     old_init
  151.     @cook_types = []
  152.     @cookbooks = []
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 添加新的制造类型
  156.   #--------------------------------------------------------------------------
  157.   def add_cook_type(n, d, en)
  158.     @cook_types.push(Cookbook_Type.new(@cook_types.size, n, d, en)) if !have_cook_type?(n)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 添加新的食谱
  162.   #--------------------------------------------------------------------------
  163.   def add_cookbook(n, d, type, input, output, en)
  164.     if !have_cookbook?(n) && have_cook_type?(type)
  165.       @cookbooks.push(Cookbook.new(@cookbooks.size, n, d, type, input, output, en))
  166.     end
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 判断名称为n的制造类型是否存在
  170.   #--------------------------------------------------------------------------
  171.   def have_cook_type?(n)
  172.     @cook_types.each do |x|
  173.       return true if x.name == n
  174.     end
  175.     return false
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 判断名称为n的食谱是否存在
  179.   #--------------------------------------------------------------------------
  180.   def have_cookbook?(n)
  181.     @cookbooks.each do |x|
  182.       return true if x.name == n
  183.     end
  184.     return false
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 返回制造类型列表
  188.   #--------------------------------------------------------------------------
  189.   def cook_types
  190.     return @cook_types
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 返回食谱列表
  194.   #--------------------------------------------------------------------------
  195.   def cookbooks(type = nil)
  196.     return @cookbooks if type == nil
  197.     arr = []
  198.     @cookbooks.each do |x|
  199.       arr.push(x) if x.type == type
  200.     end
  201.     return arr
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 更改序号为i的制造类型的使用状态
  205.   #--------------------------------------------------------------------------
  206.   def set_cook_type(i, en)
  207.     @cook_types[i].enable(en)
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 更改序号为i的食谱的使用状态
  211.   #--------------------------------------------------------------------------
  212.   def set_cookbook(i, en)
  213.     @cookbooks[i].enable(en)
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 返回制造类型数目
  217.   #--------------------------------------------------------------------------
  218.   def cook_types_size
  219.     return @cook_types.size
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ● 查询名称为n的制造类型的描述
  223.   #--------------------------------------------------------------------------
  224.   def cook_type_description(n)
  225.     @cook_types.each do |x|
  226.       return x.description if x.name == n
  227.     end
  228.     return ""
  229.   end
  230. end
  231.  
  232. #==============================================================================
  233. # ■ Scene_Cook
  234. #------------------------------------------------------------------------------
  235. #  制造画面
  236. #==============================================================================
  237.  
  238. class Scene_Cook < Scene_ItemBase
  239.   #--------------------------------------------------------------------------
  240.   # ● 开始处理
  241.   #--------------------------------------------------------------------------
  242.   def start
  243.     super
  244.     create_category_window
  245.     create_cookbook_window
  246.     create_description_window
  247.     create_needs_window
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 生成分类窗口
  251.   #--------------------------------------------------------------------------
  252.   def create_category_window
  253.     @category_window = Window_CookCategory.new
  254.     @category_window.viewport = @viewport
  255.     @category_window.y = 0
  256.     @category_window.set_handler(:ok,     method(:on_category_ok))
  257.     @category_window.set_handler(:cancel, method(:return_scene))
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● 生成食谱窗口
  261.   #--------------------------------------------------------------------------
  262.   def create_cookbook_window
  263.     wy = @category_window.height
  264.     wh = Graphics.height - wy
  265.     @item_window = Window_CookList.new(0, wy, Graphics.width*0.5 , wh)
  266.     @item_window.viewport = @viewport
  267.     @item_window.set_handler(:ok,     method(:on_item_ok))
  268.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  269.     @category_window.item_window = @item_window
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 生成描述窗口
  273.   #--------------------------------------------------------------------------
  274.   def create_description_window
  275.     wy = @category_window.height
  276.     @help_window = Window_Description.new(Graphics.width*0.5, wy)
  277.     @help_window.viewport = @viewport
  278.     @item_window.help_window = @help_window
  279.     @category_window.help_window = @help_window
  280.   end
  281.     #--------------------------------------------------------------------------
  282.   # ● 生成材料窗口
  283.   #--------------------------------------------------------------------------
  284.   def create_needs_window
  285.     wy = @category_window.height + @help_window.height
  286.     wh = Graphics.height - wy
  287.     @needs_window = Window_NeedsList.new(Graphics.width*0.5, wy, Graphics.width*0.5 , wh)
  288.     #@item_window.viewport = @viewport
  289.     @item_window.needs_window = @needs_window
  290.  
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 分类“确定”
  294.   #--------------------------------------------------------------------------
  295.   def on_category_ok
  296.     @item_window.activate
  297.     @item_window.select_last
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● 食谱“确定”
  301.   #--------------------------------------------------------------------------
  302.   def on_item_ok
  303.     #$game_party.last_item.object = item
  304.     cook
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● 食谱“取消”
  308.   #--------------------------------------------------------------------------
  309.   def on_item_cancel
  310.     @item_window.unselect
  311.     @category_window.activate
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 制造
  315.   #--------------------------------------------------------------------------
  316.   def cook
  317.     if item.enough?
  318.       play_se_for_item
  319.       use_item
  320.       @needs_window.refresh
  321.       @item_window.refresh
  322.       activate_item_window
  323.     end
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 播放制作声效
  327.   #--------------------------------------------------------------------------
  328.   def play_se_for_item
  329.     Sound.play_recovery
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 使用食谱
  333.   #--------------------------------------------------------------------------
  334.   def use_item
  335.     #super
  336.     #@item_window.redraw_current_item
  337.     $data_items.each do |it|
  338.       if it && !it.name.empty?
  339.         $game_party.gain_item(it,-item.amount(it,0)) if item.resource?(it)
  340.         $game_party.gain_item(it,item.amount(it,1)) if item.output?(it)
  341.       end
  342.     end
  343.   end
  344. end
  345.  
  346.  
  347. #==============================================================================
  348. # ■ Window_CookCategory
  349. #------------------------------------------------------------------------------
  350. #  制造画面中,显示制造类型的窗口。
  351. #==============================================================================
  352.  
  353. class Window_CookCategory < Window_HorzCommand
  354.   #--------------------------------------------------------------------------
  355.   # ● 定义实例变量
  356.   #--------------------------------------------------------------------------
  357.   attr_reader   :item_window
  358.   #--------------------------------------------------------------------------
  359.   # ● 初始化对象
  360.   #--------------------------------------------------------------------------
  361.   def initialize
  362.     super(0, 0)
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● 获取窗口的宽度
  366.   #--------------------------------------------------------------------------
  367.   def window_width
  368.     Graphics.width
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 获取列数
  372.   #--------------------------------------------------------------------------
  373.   def col_max
  374.     return $game_party.cook_types_size
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 更新画面
  378.   #--------------------------------------------------------------------------
  379.   def update
  380.     super
  381.     #@item_window.category = current_symbol if @item_window
  382.     @item_window.category = current_data[:name] if @item_window
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 生成制造列表
  386.   #--------------------------------------------------------------------------
  387.   def make_command_list
  388.     $game_party.cook_types.each do |t|
  389.       add_command(t.name, t.index, t.enabled)
  390.     end
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ● 设置制造列表窗口
  394.   #--------------------------------------------------------------------------
  395.   def item_window=(item_window)
  396.     @item_window = item_window
  397.     update
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # ● 更新帮助内容
  401.   #--------------------------------------------------------------------------
  402.   def update_help
  403.     @help_window.set_text($game_party.cook_type_description(current_data[:name]))
  404.   end
  405. end
  406.  
  407. #==============================================================================
  408. # ■ Window_CookList
  409. #------------------------------------------------------------------------------
  410. #  任务画面中,显示已获得任务的窗口。
  411. #==============================================================================
  412.  
  413. class Window_CookList < Window_Selectable
  414.   #--------------------------------------------------------------------------
  415.   # ● 定义实例变量
  416.   #--------------------------------------------------------------------------
  417.   attr_reader   :needs_window
  418.   #--------------------------------------------------------------------------
  419.   # ● 初始化对象
  420.   #--------------------------------------------------------------------------
  421.   def initialize(x, y, width, height)
  422.     super
  423.     @data = []
  424.     @category = $game_party.cook_types_size > 0 ? $game_party.cook_types[0].name : nil
  425.     refresh
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● 设置分类
  429.   #--------------------------------------------------------------------------
  430.   def category=(category)
  431.     return if @category == category
  432.     @category = category
  433.     refresh
  434.     self.oy = 0
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 设置材料窗口
  438.   #--------------------------------------------------------------------------
  439.   def needs_window=(needs_window)
  440.     @needs_window = needs_window
  441.     update
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● 获取列数
  445.   #--------------------------------------------------------------------------
  446.   def col_max
  447.     return 1
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● 获取项目数
  451.   #--------------------------------------------------------------------------
  452.   def item_max
  453.     @data ? @data.size : 1
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 获取食谱
  457.   #--------------------------------------------------------------------------
  458.   def item
  459.     @data && index >= 0 ? @data[index] : nil
  460.   end
  461.   #--------------------------------------------------------------------------
  462.   # ● 获取选择食谱的有效状态
  463.   #--------------------------------------------------------------------------
  464.   def current_item_enabled?
  465.     enable?(@data[index])
  466.   end
  467.   #--------------------------------------------------------------------------
  468.   # ● 查询此食谱是否可用
  469.   #--------------------------------------------------------------------------
  470.   def enable?(item)
  471.     item.enabled && item.enough?
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # ● 生成食谱列表
  475.   #--------------------------------------------------------------------------
  476.   def make_item_list
  477.     @data = $game_party.cookbooks(@category)
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # ● 返回上一个选择的位置
  481.   #--------------------------------------------------------------------------
  482.   def select_last
  483.     select(0)
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ● 绘制项目
  487.   #--------------------------------------------------------------------------
  488.   def draw_item(index)
  489.     item = @data[index]
  490.     if item
  491.       rect = item_rect(index)
  492.       rect.width -= 4
  493.       draw_item_name(item, rect.x, rect.y, enable?(item))
  494.     end
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # ● 绘制名称
  498.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  499.   #--------------------------------------------------------------------------
  500.   def draw_item_name(item, x, y, enabled = true, width = 300)
  501.     return unless item
  502.     text = item.name
  503.     text += "[材料不足]" if !item.enough?
  504.     change_color(normal_color, enabled)
  505.     draw_text(x, y, width, line_height, text)
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● 更新帮助内容
  509.   #--------------------------------------------------------------------------
  510.   def update_help
  511.     @help_window.set_item(item)
  512.   end
  513.    #--------------------------------------------------------------------------
  514.   # ● 更新食谱清单
  515.   #--------------------------------------------------------------------------
  516.   def update_needslist
  517.     @needs_window.set_item(item)
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● 调用帮助窗口的更新方法
  521.   #--------------------------------------------------------------------------
  522.   def call_update_help
  523.     update_help if @help_window
  524.     update_needslist if @needs_window
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # ● 刷新
  528.   #--------------------------------------------------------------------------
  529.   def refresh
  530.     make_item_list
  531.     create_contents
  532.     draw_all_items
  533.   end
  534. end
  535. #==============================================================================
  536. # ■ Window_Description
  537. #------------------------------------------------------------------------------
  538. #  显示食谱的说明的窗口
  539. #==============================================================================
  540.  
  541. class Window_Description < Window_Base
  542.   #--------------------------------------------------------------------------
  543.   # ● 初始化对象
  544.   #--------------------------------------------------------------------------
  545.   def initialize(x, y)
  546.     super(x, y, Graphics.width*0.5, fitting_height(4))
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● 设置内容
  550.   #--------------------------------------------------------------------------
  551.   def set_text(text)
  552.     if text != @text
  553.       @text = text
  554.       refresh
  555.     end
  556.   end
  557.   #--------------------------------------------------------------------------
  558.   # ● 清除
  559.   #--------------------------------------------------------------------------
  560.   def clear
  561.     set_text("")
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ● 设置食谱的介绍
  565.   #--------------------------------------------------------------------------
  566.   def set_item(item)
  567.     set_text(item ? item.description : "")
  568.   end
  569.   #--------------------------------------------------------------------------
  570.   # ● 刷新
  571.   #--------------------------------------------------------------------------
  572.   def refresh
  573.     contents.clear
  574.     draw_text_ex(4, 0, @text)
  575.   end
  576. end
  577.  
  578. #==============================================================================
  579. # ■ Window_NeedsList
  580. #------------------------------------------------------------------------------
  581. #  制造画面中,显示食谱所需材料的窗口。
  582. #==============================================================================
  583.  
  584. class Window_NeedsList < Window_Selectable
  585.   #--------------------------------------------------------------------------
  586.   # ● 初始化对象
  587.   #--------------------------------------------------------------------------
  588.   def initialize(x, y, width, height)
  589.     super
  590.     @category = :item
  591.     @cookbook = nil
  592.     @data = []
  593.     refresh
  594.   end
  595.   #--------------------------------------------------------------------------
  596.   # ● 获取列数
  597.   #--------------------------------------------------------------------------
  598.   def col_max
  599.     return 1
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● 获取项目数
  603.   #--------------------------------------------------------------------------
  604.   def item_max
  605.     @data ? @data.size : 1
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ● 获取物品
  609.   #--------------------------------------------------------------------------
  610.   def item
  611.     @data && index >= 0 ? @data[index] : nil
  612.   end
  613.   #--------------------------------------------------------------------------
  614.   # ● 查询列表中是否含有此物品
  615.   #--------------------------------------------------------------------------
  616.   def include?(item)
  617.     item.is_a?(RPG::Item) && !item.key_item?
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 获取选择食谱的有效状态
  621.   #--------------------------------------------------------------------------
  622.   def current_item_enabled?
  623.     enable?(@data[index])
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● 查询此食谱是否可用
  627.   #--------------------------------------------------------------------------
  628.   def enable?(item)
  629.     $game_party.usable?(item) && @cookbook.item_enough?(item)
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ● 生成物品列表
  633.   #--------------------------------------------------------------------------
  634.   def make_item_list
  635.     @data = []
  636.     return if @cookbook== nil
  637.     tmp1 = []
  638.     tmp2 = []
  639.     $data_items.each do |item|
  640.       tmp1.push([item, 0]) if item && !item.name.empty? && @cookbook.resource?(item)
  641.       tmp2.push([item, 1]) if item && !item.name.empty? && @cookbook.output?(item)
  642.     end
  643.     if tmp1.size > 0 && tmp2.size > 0
  644.       @data.push(["需要材料:",0])
  645.       @data += tmp1
  646.       @data.push(["可以获得:",1])
  647.       @data += tmp2
  648.     end
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ● 返回上一个选择的位置
  652.   #--------------------------------------------------------------------------
  653.   def select_last
  654.     select(0)
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 绘制项目
  658.   #--------------------------------------------------------------------------
  659.   def draw_item(index)
  660.     item = @data[index]
  661.     if item
  662.       rect = item_rect(index)
  663.       rect.width -= 4
  664.       if item[0].is_a?(RPG::Item)
  665.         draw_item_name(item, rect.x, rect.y, enable?(item[0]))
  666.         draw_item_number(rect, item[0])
  667.       else
  668.         draw_input_output(item, rect.x, rect.y)
  669.       end
  670.     end
  671.   end
  672.   #--------------------------------------------------------------------------
  673.   # ● 绘制物品名称
  674.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  675.   #--------------------------------------------------------------------------
  676.   def draw_item_name(item, x, y, enabled = true, width = 172)
  677.     return unless item
  678.     text = item[0].name + "*" + String(@cookbook.amount(item[0], item[1]))
  679.     draw_icon(item[0].icon_index, x, y, enabled)
  680.     change_color(normal_color, enable?(item[0]))
  681.     draw_text(x + 24, y, width, line_height, text)
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # ● 绘制输入和产出
  685.   #--------------------------------------------------------------------------
  686.   def draw_input_output(item, x, y, enabled = false, width = 172)
  687.     return unless item
  688.     if item[1] == 0
  689.       text = "[需要]"
  690.     else
  691.       text = "[可以获得]"
  692.     end
  693.     change_color(normal_color, @cookbook.enough?)
  694.     draw_text(x , y, width, line_height, text)
  695.   end
  696.   #--------------------------------------------------------------------------
  697.   # ● 绘制物品个数
  698.   #--------------------------------------------------------------------------
  699.   def draw_item_number(rect, item)
  700.     draw_text(rect, sprintf("现有%2d", $game_party.item_number(item)), 2)
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # ● 刷新
  704.   #--------------------------------------------------------------------------
  705.   def refresh
  706.     make_item_list
  707.     create_contents
  708.     draw_all_items
  709.   end
  710.   #--------------------------------------------------------------------------
  711.   # ● 设置食谱的材料
  712.   #--------------------------------------------------------------------------
  713.   def set_item(item)
  714.     @cookbook = item
  715.     refresh
  716.   end
  717. end
  718.  
  719. #==============================================================================
  720. # 本腳本來自[url]www.66RPG.com[/url],使用和轉載請保留此信息
  721. #==============================================================================
  722.  
  723.  
  724. # add by Sion 2013.12.17
  725. # 作者修改了原范例的菜单,但是在原系统脚本里改的。
  726. # 整理出来写在这里, 不需要改菜单的同学把这些删掉就可以。
  727. class Scene_Menu
  728.   def command_cook
  729.     SceneManager.call(Scene_Cook)
  730.   end
  731.   alias_method :s20131217_create_command_window, :create_command_window
  732.   def create_command_window
  733.     s20131217_create_command_window
  734.     @command_window.set_handler(:cook, method(:command_cook))
  735.   end
  736. end
  737. class Window_MenuCommand
  738.   alias_method :s20131217_add_main_commands, :add_main_commands
  739.   def add_main_commands
  740.     s20131217_add_main_commands
  741.     add_command("制造",   :cook,   main_commands_enabled)
  742.   end
  743. end


再次感谢
作者: taroxd    时间: 2014-6-13 17:22
本帖最后由 taroxd 于 2014-6-13 17:29 编辑

第374行改为这样试试看~
RUBY 代码复制
  1. size = $game_party.cook_types_size
  2. size == 0 ? 1 : size

作者: xie7    时间: 2014-6-13 22:45
taroxd 发表于 2014-6-13 17:22
第374行改为这样试试看~
size = $game_party.cook_types_size
size == 0 ? 1 : size[/pre]

改了之后提示


麻烦看一下~
作者: taroxd    时间: 2014-6-14 06:23
把2L的改回来,然后在最后追加
RUBY 代码复制
  1. class Window_CookCategory
  2.   def item_width
  3.     col_max == 0 ? width - standard_padding * 2 : super
  4.   end
  5. end


如果还是不行,我就没办法了,问脚本作者去吧……
作者: xie7    时间: 2014-6-14 08:03
感谢~~试过了 window selectable里的 174行又出错了,不过还是感谢抽空帮忙~~谢谢~~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1