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

Project1

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

[已经解决] 哪位同学有物品合成系统?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
27 小时
注册时间
2014-7-19
帖子
110
跳转到指定楼层
1
发表于 2015-9-1 13:35:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我需要不带负重系统的,谁有可以发给我吗?谢谢。

Lv4.逐梦者

素材区好人

梦石
3
星屑
6812
在线时间
3462 小时
注册时间
2011-7-21
帖子
2254

极短24参与极短23参与极短22参与极短21参与

2
发表于 2015-9-1 18:00:18 | 只看该作者
这个?
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. # 欢迎访问[url]www.66RPG.com[/url]
  4. # 梦想世界,在你手中
  5. #==============================================================================  
  6. #
  7. # Sample master list for crafting script (物品分类增强版) v1.1
  8. # written by Deke
  9. # 增强:叶子
  10. #
  11. # 12-30-2005 v1.0
  12. # 8-17-2006 v1.1
  13. # 修正了返回界面时不显示成品的BUG
  14. # 修正了材料大于8个不显示的BUG
  15. # 描绘物品美化
  16. # 自动检测能否合成
  17. #============================================================================================
  18. # 简介:
  19. # 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
  20. # 物品方法。
  21. # ------
  22. # 增强版补充说明:
  23. # 在这个增强版中,可以对成品进行手动分类。
  24. # 成品增加了一个分类属性。
  25. # 这个分类纯粹是按自己的意愿,没有规定第几类必须是什么。
  26. # 召唤特定分类的界面,就只会看到特定分类的成品。
  27. #
  28. # 例如:
  29. # 使用脚本$scene = Scene_Craft.new(1),
  30. # 出来的界面就只会显示成品分类为1的东西
  31. # 同样道理,使用脚本$scene = Scene_Craft.new(2),
  32. # 出来的界面就只会显示成品分类为2的东西
  33. #
  34. # 如果使用脚本$scene = Scene_Craft.new或$scene = Scene_Craft.new(0)来召唤界面
  35. # 就可以看到所有成品。
  36. #
  37. # 注意:不要弄混淆“成品种类”和“成品分类”
  38. # 成品种类是指成品是普通物品(0),防具(1)或武器(2)
  39. # 成品分类是指此物品的自定义分类
  40. #
  41. #
  42. # 使用方法:
  43. # 1、召唤界面:使用脚本$scene = Scene_Craft.new(分类的数字)
  44. # 例如:使用脚本$scene = Scene_Craft.new(1),出来分类1的界面
  45. #
  46. # 2、学习合成:$game_party.learn_recipe(合成项目)
  47. #
  48. #  2.1、其实这个脚本可以使同一成品有不同配方
  49. #
  50. #    就这样说可能解释得不清楚,先来解释一下脚本学习配方的原理:
  51. #    $game_party.learn_recipe(合成项目)的处理过程并不是直接学习这个配方,
  52. #    而是在配方库中找到和合成项目成品相同的配方。
  53. #
  54. #    如果配方库中有两个配方成品相同的话,配方版本就变得重要。
  55. #    $game_party.learn_recipe(合成项目,配方版本)
  56. #    配方版本为1的话,学到的配方就是@recipe_list[xx]中与合成项目成品相同且数字最小的配方
  57. #    配方版本为2的话,学到的配方就是数字第二小的配方
  58. #    在上面这个脚本语句中,不填配方版本的话就默认为1
  59. #
  60. #  2.2、忘记配方:$game_party.forget_recipe(合成项目)
  61. #   2.21、同样道理,这个语句也可以写配方版本
  62. #    $game_party.forget_recipe(合成项目,配方版本)
  63. #    配方版本定义见2.1
  64. #
  65. #  2.3、配方版本不能乱填!例如游戏中某一个配方的成品是唯一的,与所有其它配方的成品都不相同
  66. #   那么学习的时候就不用填配方版本。
  67. #   如果这时在配方版本填了2的话,就有可能学不到或者忘不了(-_-||)
  68. #   
  69. #
  70. # 3、合成定义:
  71. # 这个合成脚本可以定义两种合成物品。一种是预先定义好了的,就像下面这样,
  72. # 直接写在这里就可以,另一种是在学习之前现场定义。
  73. #
  74. # 4、举例
  75. #  4.1、学会recipe_list[1]定义的合成:$game_party.learn_recipe($game_temp.recipe_list[1])
  76. #       注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
  77. #
  78. #  4.2、在游戏中临时定义一种合成,让玩家学会。使用事件中的脚本如下,   
  79. #  脚本:
  80. #    材料 = [$game_variables[1],$game_variables[2]]  #——材料编号是变量1、2的编号
  81. #    材料种类 = [0,0]                                #——材料是物品
  82. #    材料数量 = [$game_variables[3],$game_variables[4]]  #——需要材料数量是变量3、4的编号
  83. #    成品 = $game_variables[5]                       #——获得结果编号是5
  84. #    成品种类 = 1                                    #——成品是防具类
  85. #    成品分类 = 1                                    #——这一项不写的话默认为0
  86. #    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类,成品分类))
  87. #    上面这条语句的成品分类这一项不写也行,这样它就默认为0了。
  88. #    (也就是此物品没有分类,不会在分类菜单中出现)
  89. #    省略成品分类的脚本语句可以像下面这样写:
  90. #    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类))
  91. #
  92. #===========================================================================================
  93. class Game_Temp
  94.   attr_reader :recipe_list  
  95.   alias crafting_temp_initialize initialize
  96.   def initialize
  97.     crafting_temp_initialize
  98.     @recipe_list=[]
  99.     get_recipe_list
  100.   end  
  101.   def get_recipe_list   
  102.     ###########################################################################
  103.     # 19 号合成物品设定 (低级矿石×3= 中级矿石) 成品分类:1
  104.     ##########################################################################
  105.     材料 = [30]             # 需要材料的数据库编号
  106.     材料种类 = [0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  107.     材料数量 = [5]         # 需要材料的数量
  108.     成品 = 31                  # 获得物品编号
  109.     成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
  110.     成品分类 = 1              # 获得成品分类
  111.     @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  112.  
  113.   end # of get_recipe_list method
  114. end # of updates to Game_Temp Class
  115.  
  116. #================================
  117. # CRAFTING PROGRAM
  118. #----------------------------------------------------------------
  119. #-written by Deke
  120. #-yes_no window code created by Phsylomortis
  121. #----------------------------------------------------------------
  122. #================================
  123.  
  124. #updates to Game_Party class
  125.  
  126. class Game_Party
  127.  
  128.   attr_accessor       :recipes
  129.  
  130.   alias crafting_party_initialize initialize
  131.  
  132.   def initialize
  133.     crafting_party_initialize
  134.     @recipes=[]
  135.   end
  136.  
  137.   #----------------------------------------------------------------------
  138.   def know?(recipe, version = 1)
  139.     unless recipe.is_a?(Game_Recipe)
  140.       recipe = get_recipe_from_master_list(recipe, version)
  141.     end
  142.     return $game_party.recipes.include?(recipe)
  143.   end
  144.  
  145. #----------------------------------------------------------------------
  146.   def learn_recipe(recipe , version = 1)
  147.     unless recipe.is_a?(Game_Recipe)
  148.       recipe = get_recipe_from_master_list(recipe, version)
  149.     end
  150.     if recipe.is_a?(Game_Recipe)
  151.       unless know?(recipe)
  152.         @recipes.push(recipe)
  153.       end
  154.     end
  155.   end
  156.  
  157. #----------------------------------------------------------------------
  158.   def forget_recipe(recipe , version = 1)
  159.     if !recipe.is_a?(Game_Recipe)
  160.       recipe = get_recipe_from_master_list(recipe, version)
  161.     end
  162.     if recipe.is_a?(Game_Recipe)
  163.       for i in [email]0...@recipes.size[/email]
  164.         if recipe == @recipes[i]
  165.           index = i
  166.           break
  167.         end
  168.       end
  169.       if index != nil
  170.         @recipes.delete(@recipes[index])
  171.       end
  172.     end
  173.   end
  174.  
  175. #----------------------------------------------------------------------
  176.   def get_recipe_from_master_list(item, version)
  177.     index = nil
  178.     for i in 0...$game_temp.recipe_list.size
  179.       if item[0] == $game_temp.recipe_list[i].result and item[1] ==$game_temp.recipe_list[i].result_type
  180.         version -= 1
  181.         if version == 0
  182.           index = i
  183.           break
  184.         end
  185.       end
  186.     end
  187.     if index.is_a?(Integer)
  188.       return ($game_temp.recipe_list[index])
  189.     else
  190.       return false
  191.     end
  192.   end
  193.  
  194. end # of Game_Party updates
  195.  
  196. #================================
  197. class Game_Recipe
  198.  
  199.   attr_reader :ingredients
  200.   attr_reader :quantities
  201.   attr_reader :result
  202.   attr_reader :result_type
  203.   attr_reader :ingredient_types
  204.   attr_reader :craft_type  #物品分类
  205.  
  206. #----------------------------------------------------------------------
  207.   def initialize( ingredients, ingredient_types, quantities, result, result_type, craft_type=0)
  208.     @ingredients = ingredients
  209.     @ingredient_types = ingredient_types
  210.     @quantities = quantities
  211.     @result = result
  212.     @result_type = result_type
  213.     @craft_type = craft_type
  214.   end
  215.  
  216. #----------------------------------------------------------------------
  217.   def name
  218.     case @result_type
  219.       when 0
  220.         name = $data_items[@result].name
  221.       when 1
  222.         name = $data_armors[@result].name
  223.       when 2
  224.         name = $data_weapons[@result].name
  225.     end
  226.     return name
  227.   end
  228.  
  229. #----------------------------------------------------------------------
  230.  
  231.   def item
  232.     case @result_type
  233.       when 0
  234.         item = $data_items[@result]
  235.       when 1
  236.         item = $data_armors[@result]
  237.       when 2
  238.         item = $data_weapons[@result]
  239.     end
  240.     return item
  241.   end
  242.  
  243. #----------------------------------------------------------------------
  244.   def have
  245.     have_all = true
  246.     for i in [email]0...@ingredients.size[/email]
  247.       case @ingredient_types[i]
  248.         when 0
  249.           if $game_party.item_number(@ingredients[i]) < @quantities[i]
  250.             have_all=false
  251.           end
  252.         when 1
  253.           if $game_party.armor_number(@ingredients[i]) < @quantities[i]
  254.             have_all=false
  255.           end
  256.         when 2
  257.           if $game_party.weapon_number(@ingredients[i]) < @quantities[i]
  258.             have_all=false
  259.           end
  260.       end
  261.     end
  262.     return have_all
  263.   end
  264.  
  265. #----------------------------------------------------------------------
  266.   def decrement
  267.     for i in [email]0...@ingredients.size[/email]
  268.       case @ingredient_types[i]
  269.       when 0
  270.         $game_party.lose_item(@ingredients[i], @quantities[i])
  271.       when 1
  272.         $game_party.lose_armor(@ingredients[i], @quantities[i])
  273.       when 2
  274.         $game_party.lose_weapon(@ingredients[i], @quantities[i])
  275.       end
  276.     end
  277.   end
  278.  
  279. #----------------------------------------------------------------------
  280.   def make
  281.     if have
  282.       case @result_type
  283.       when 0
  284.         $game_party.gain_item(@result, 1)
  285.       when 1
  286.         $game_party.gain_armor(@result, 1)
  287.       when 2
  288.         $game_party.gain_weapon(@result, 1)
  289.       end
  290.       decrement
  291.     end
  292.   end
  293.  
  294. #----------------------------------------------------------------------
  295.   def == (recipe)
  296.     if recipe.is_a?(Game_Recipe)
  297.       equal = true
  298.       if recipe.ingredients != self.ingredients
  299.         equal = false
  300.       end
  301.       if recipe.ingredient_types != self.ingredient_types
  302.         equal = false
  303.       end
  304.       if recipe.quantities != self.quantities
  305.         equal = false
  306.       end
  307.       if recipe.result != self.result
  308.         equal=false
  309.       end
  310.       if recipe.result_type != self.result_type
  311.         equal = false
  312.       end
  313.     else
  314.       equal = false
  315.     end
  316.     return equal
  317.   end
  318.  
  319. end # of Game_Recipe class
  320.  
  321. #===================================
  322.  
  323. class Window_Craft < Window_Selectable
  324.   attr_reader :data #声明数据
  325.   #--------------------------------------------------------------------------
  326.   def initialize(craft_type=0)
  327.     @craft_type = craft_type
  328.     super(0, 64, 240, 416)
  329.     @column_max = 1
  330.     refresh
  331.     self.index = 0
  332.   end
  333.  
  334.   #--------------------------------------------------------------------------
  335.   def recipe
  336.     return @data[self.index]
  337.   end
  338.  
  339.   #--------------------------------------------------------------------------
  340.   def refresh
  341.     if self.contents != nil
  342.       self.contents.dispose
  343.       self.contents = nil
  344.     end
  345.     @data = []
  346.     for i in 0...$game_party.recipes.size
  347.        #@craft_type为0时就显示全部物品
  348.        #不为0时就显示对应物品
  349.       if @craft_type == 0
  350.         @data.push($game_party.recipes[i])
  351.       elsif $game_party.recipes[i].craft_type == @craft_type
  352.         @data.push($game_party.recipes[i])
  353.       end
  354.     end
  355.     @item_max = @data.size
  356.     if @item_max > 0
  357.       self.contents = Bitmap.new(width - 32, row_max * 32)
  358.       self.contents.font.name = "黑体" # = "黑体"
  359.       self.contents.font.size = 18 # = 18
  360.       for i in 0...@item_max
  361.         x = 16
  362.         y = i * 32
  363.         able = true
  364.         for ingredient in 0...@data[i].ingredients.size
  365.           case @data[i].ingredient_types[ingredient]
  366.           when 0
  367.             count = $game_party.item_number(@data[i].ingredients[ingredient])
  368.           when 1
  369.             count = $game_party.armor_number(@data[i].ingredients[ingredient])
  370.           when 2
  371.             count = $game_party.weapon_number(@data[i].ingredients[ingredient])
  372.           end
  373.           if count < @data[i].quantities[ingredient]
  374.             able = false
  375.             break
  376.           end
  377.         end
  378.         draw_item_name(@data[i].item, x, y, able)
  379.       end
  380.     end
  381.   end
  382.  
  383.   #--------------------------------------------------------------------------
  384.   #def draw_item(index)
  385.   #  recipe = @data[index]
  386.   #  self.contents.font.color = recipe.have ? normal_color : disabled_color
  387.   #  x = 16
  388.   #  y = index * 32
  389.   #  self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
  390.   #end
  391.  
  392.   #--------------------------------------------------------------------------
  393.   # ● 描绘物品名
  394.   #     item : 物品
  395.   #     x    : 描画目标 X 坐标
  396.   #     y    : 描画目标 Y 坐标
  397.   #--------------------------------------------------------------------------
  398.   def draw_item_name(item, x, y, able = true)
  399.     if item == nil
  400.       return
  401.     end
  402.     if !able
  403.       self.contents.font.color = disabled_color
  404.     end
  405.     bitmap = RPG::Cache.icon(item.icon_name)
  406.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  407.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  408.     self.contents.font.color = normal_color
  409.   end
  410.  
  411.   #--------------------------------------------------------------------------
  412.   def update_help
  413.     current_recipe = recipe
  414.     if current_recipe.is_a?(Game_Recipe)
  415.     case current_recipe.result_type
  416.       when 0
  417.         description = $data_items[current_recipe.result].description
  418.       when 1
  419.         description = $data_armors[current_recipe.result].description
  420.       when 2
  421.         description = $data_weapons[current_recipe.result].description
  422.       end
  423.     else
  424.       description = ""
  425.     end
  426.     @help_window.set_text(description)
  427.     @help_window.update
  428.   end
  429.  
  430. end # of Window_Craft
  431.  
  432. #=======================================
  433. class Window_CraftResult < Window_Base
  434.  
  435.   #--------------------------------------------------------------------------
  436.   def initialize
  437.     super(240, 64, 400, 184)
  438.     self.contents = Bitmap.new(width - 32, height - 32)
  439.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  440.     self.contents.font.size = 18 # = 20
  441.     @result = nil
  442.     @type = nil
  443.   end
  444.  
  445.   #--------------------------------------------------------------------------
  446.   def refresh
  447.     self.contents.clear
  448.     case @type
  449.       when 0
  450.         item = $data_items[@result]
  451.         if item.recover_hp_rate > item.recover_hp
  452.           hp_string = "HP回复率:"
  453.           hp_stat = item.recover_hp_rate
  454.         else
  455.           hp_string = "HP回复量:"
  456.           hp_stat = item.recover_hp
  457.         end
  458.         if item.recover_sp_rate > item.recover_sp
  459.           sp_string = "SP回复率:"
  460.           sp_stat = item.recover_sp_rate
  461.         else
  462.           sp_string = "SP回复量:"
  463.           sp_stat = item.recover_sp
  464.         end
  465.         @strings = [hp_string, sp_string, "物理防御:" , "魔法防御:", "命中率:", "分散度:"]
  466.         @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
  467.                        $game_party.item_number(@result)]
  468.         @bitmap = RPG::Cache.icon(item.icon_name)
  469.       when 1
  470.         item = $data_armors[@result]
  471.         @strings = ["物理防御:", "魔法防御:", "回避修正:", "力量增加:", "灵巧增加:",
  472.                        "速度增加:", "魔力增加:"]
  473.         @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
  474.                     item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
  475.         @bitmap = RPG::Cache.icon(item.icon_name)
  476.       when 2
  477.         item = $data_weapons[@result]
  478.         @strings =["攻击力:", "物理防御:", "魔法防御:", "力量增加:", "灵巧增加:",
  479.                     "速度增加:", "魔力增加:"]
  480.         @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
  481.                     item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
  482.         @bitmap = RPG::Cache.icon(item.icon_name)
  483.     end
  484.     for i in [email]0...@strings.size[/email]
  485.       x = i%2 * 184
  486.       y = i /2 *28 +32
  487.       self.contents.font.color = normal_color
  488.       self.contents.draw_text(x,y,100, 28,@strings[i])
  489.       self.contents.font.color = system_color
  490.       self.contents.draw_text(x + 110, y, 45, 28, @stats[i].to_s)
  491.     end
  492.     self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
  493.     self.contents.font.color= normal_color
  494.     self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
  495.     self.contents.font.color = system_color
  496.     count = @stats[@stats.size - 1].to_s
  497.     self.contents.draw_text(294, 0, 45, 28, count )
  498.   end
  499.  
  500. #----------------------------------------------------------------------
  501.   def set_result(result , type)
  502.     @result = result
  503.     @type = type
  504.     refresh
  505.   end
  506.  
  507. end #of Window_CraftResult
  508.  
  509. #=======================================
  510. class Window_CraftIngredients < Window_Base
  511.  
  512.   #--------------------------------------------------------------------------
  513.   def initialize
  514.     super(240, 248, 400, 232)
  515.     self.contents = Bitmap.new(width - 32, height - 32)
  516.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  517.     self.contents.font.size = 18 # = 20
  518.     @ingredients = []
  519.     @types = []
  520.     @quantities = []
  521.     @item = nil
  522.     @count = 0
  523.     @counter = 0
  524.     @real_oy = 0
  525.   end
  526.  
  527.   #--------------------------------------------------------------------------
  528.   def refresh
  529.     @counter = 0
  530.     self.contents.clear
  531.     self.contents = Bitmap.new(width - 32, @ingredients.size * 26)
  532.     for i in [email]0...@ingredients.size[/email]
  533.       case @types[i]
  534.       when 0
  535.         @item = $data_items[@ingredients[i]]
  536.         @count = $game_party.item_number(@ingredients[i])
  537.       when 1
  538.         @item = $data_armors[@ingredients[i]]
  539.         @count = $game_party.armor_number(@ingredients[i])
  540.       when 2
  541.         @item = $data_weapons[@ingredients[i]]
  542.         @count = $game_party.weapon_number(@ingredients[i])
  543.       end
  544.       y = i *26
  545.       self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
  546.       self.contents.font.color = @count >= @quantities[i] ? normal_color : disabled_color
  547.       self.contents.draw_text(30, y, 280, 28, @item.name)
  548.       self.contents.draw_text(300, y, 45, 28, @quantities[i].to_s)
  549.       self.contents.font.color = system_color
  550.       self.contents.draw_text(245, y, 45, 28, @count.to_s )     
  551.     end
  552.   end
  553.  
  554.   #--------------------------------------------------------------------------
  555.   def set_ingredients(ingredients , types, quantities)
  556.     @ingredients = ingredients
  557.     @types = types
  558.     @quantities = quantities
  559.     refresh
  560.     if @ingredients.size > 7
  561.       self.oy = -52
  562.       @real_oy = 0
  563.     else
  564.       self.oy = 0
  565.     end
  566.   end
  567.  
  568.   def update
  569.     super
  570.     @counter += 1
  571.     if @ingredients.size > 7 and @counter > 30
  572.       @real_oy = (@real_oy + 1) % ((@ingredients.size - 3) * 26)
  573.       self.oy = @real_oy - 52
  574.     end
  575.   end
  576.  
  577. end # of Window_CraftIngredients
  578.  
  579. #======================================
  580. class Scene_Craft
  581.  
  582.   #--------------------------------------------------------------------------
  583.   # @craft_type:物品种类,0就是全部
  584.   def initialize(craft_type=0,craft_index=0)
  585.     @craft_index=craft_index
  586.     @craft_type = craft_type
  587.   end
  588.  
  589.   #--------------------------------------------------------------------------
  590.   def main
  591.     @craft_window = Window_Craft.new(@craft_type)
  592.     @craft_window.index=@craft_index
  593.     @confirm_window = Window_Base.new(120, 188, 400, 64)
  594.     @confirm_window.contents = Bitmap.new(368, 32)
  595.     @confirm_window.contents.font.name = "黑体"
  596.     @confirm_window.contents.font.size = 20
  597.     @help_window = Window_Help.new
  598.     @craft_window.help_window = @help_window
  599.     @result_window=Window_CraftResult.new
  600.     @ingredients_window=Window_CraftIngredients.new
  601.     if @craft_window.data.size > 0 #本类窗口物品大于0的话
  602.       @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  603.       @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  604.                                                           @craft_window.recipe.ingredient_types,
  605.                                                           @craft_window.recipe.quantities)
  606.     end
  607.     @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
  608.     @confirm_window.visible = false
  609.     @confirm_window.z = 1500
  610.     @yes_no_window.visible = false
  611.     @yes_no_window.active = false
  612.     @yes_no_window.index = 1
  613.     @yes_no_window.x = 270
  614.     @yes_no_window.y = 252
  615.     @yes_no_window.z = 1500
  616.     @label_window = Window_Base.new(450,200,190,52)
  617.     @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
  618.     @label_window.contents.font.size=20
  619.     @label_window.contents.font.color = @label_window.normal_color
  620.     @label_window.contents.font.name = "黑体"
  621.     @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, "  现有   需要")
  622.     Graphics.transition
  623.     loop do
  624.       Graphics.update
  625.       Input.update
  626.       update
  627.       if $scene != self
  628.         break
  629.       end
  630.     end
  631.     Graphics.freeze
  632.     @help_window.dispose
  633.     @craft_window.dispose
  634.     @result_window.dispose
  635.     @ingredients_window.dispose
  636.     @confirm_window.dispose
  637.     @yes_no_window.dispose
  638.     @label_window.dispose
  639.   end
  640.  
  641.   #--------------------------------------------------------------------------
  642.   def update
  643.     @craft_window.update
  644.     @ingredients_window.update
  645.     if @craft_window.active
  646.       update_craft
  647.       return
  648.     end
  649.     if @yes_no_window.active
  650.       confirm_update
  651.       return
  652.     end
  653.   end
  654.  
  655.   #--------------------------------------------------------------------------
  656.   def update_craft
  657.     if Input.dir4 != 0
  658.       if @craft_window.data.size > 0 #本类窗口物品大于0的话
  659.         @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  660.         @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  661.                                                            @craft_window.recipe.ingredient_types,
  662.                                                            @craft_window.recipe.quantities)
  663.       end
  664.     end
  665.     if Input.trigger?(Input::B)
  666.       $game_system.se_play($data_system.cancel_se)
  667.       $scene = Scene_Map.new
  668.       return
  669.     end
  670.     if Input.trigger?(Input::C) and $game_party.recipes.size != 0
  671.       @recipe = @craft_window.recipe
  672.       if @recipe != nil
  673.         if @recipe.have
  674.           @yes_no_window.active = true
  675.           @craft_window.active = false
  676.         else
  677.           $game_system.se_play($data_system.buzzer_se)
  678.           return
  679.         end
  680.       else
  681.         $game_system.se_play($data_system.buzzer_se)
  682.         return
  683.       end
  684.     end
  685.   end
  686.  
  687.   #--------------------------------------------------------------------------
  688.   def confirm_update
  689.     @craft_index = @craft_window.index
  690.     @confirm_window.visible = true
  691.     @confirm_window.z = 1500
  692.     @yes_no_window.visible = true
  693.     @yes_no_window.active = true
  694.     @yes_no_window.z = 1500
  695.     @yes_no_window.update
  696.     string = "合成 " + @recipe.name + "?"
  697.     cw = @confirm_window.contents.text_size(string).width
  698.     center = @confirm_window.contents.width/2 - cw /2
  699.     unless @drawn
  700.       @confirm_window.contents.draw_text(center, 0, cw, 30, string)
  701.       @drawn = true
  702.     end
  703.     if Input.trigger?(Input::C)
  704.       if @yes_no_window.index == 0
  705.         $game_system.se_play($data_system.decision_se)
  706.         @recipe.make
  707.         $game_system.se_play($data_system.save_se)
  708.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  709.       else
  710.         $game_system.se_play($data_system.cancel_se)
  711.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  712.       end
  713.     end
  714.     if Input.trigger?(Input::B)
  715.       $game_system.se_play($data_system.cancel_se)
  716.       $scene=Scene_Craft.new(@craft_type,@craft_index)
  717.     end
  718.   end
  719.  
  720. end # of Scene_Craft
  721.  
  722. #==============================================================================
  723. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  724. # 欢迎访问[url]www.66RPG.com[/url]
  725. # 梦想世界,在你手中
  726. #==============================================================================

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
75
在线时间
27 小时
注册时间
2014-7-19
帖子
110
3
 楼主| 发表于 2015-9-2 06:47:03 手机端发表。 | 只看该作者
无忧谷主幻 发表于 2015-9-1 18:00
这个?
#==============================================================================
# 本脚本来自w ...

谢谢@︶ㄣ牛排ぶ 满意回答
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
99
在线时间
59 小时
注册时间
2015-9-4
帖子
43
4
发表于 2017-7-11 12:10:47 | 只看该作者
无忧谷主幻 发表于 2015-9-1 18:00
这个?
#==============================================================================
# 本脚本来自w ...

有参考范烈吗 谢谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 20:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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