| 赞 | 35  | 
 
| VIP | 0 | 
 
| 好人卡 | 72 | 
 
| 积分 | 64 | 
 
| 经验 | 38967 | 
 
| 最后登录 | 2025-10-26 | 
 
| 在线时间 | 1471 小时 | 
 
 
 
 
 
Lv4.逐梦者 
	- 梦石
 - 0 
 
        - 星屑
 - 6365 
 
        - 在线时间
 - 1471 小时
 
        - 注册时间
 - 2015-7-25
 
        - 帖子
 - 620
 
 
   
 
 | 
	
写了个超级简陋的合成功能 (x  
使用方式:事件脚本 $scene = Scene_Synthesis.new(:Food) #调用Food合成台 
module MFXRB   Food = {}   Food[1] = [2,3,4] #合成台代号(首字母大写)[成品id] = [材料1,材料2,....,材料n]   Food[2] = [3,5]   Food[3] = [7,8]   Forge = {}   Forge[10] = [20,30] end class Scene_Synthesis   def initialize(type)     @type = type   end   def main     @synthesis_window = Window_Synthesis.new(@type)     Graphics.transition     # 主循环     loop do       # 刷新游戏画面       Graphics.update       # 刷新输入信息       Input.update       # 刷新画面       update       # 如果切换画面就中断循环       if $scene != self         break       end     end     # 准备过渡     Graphics.freeze     # 释放窗口     @synthesis_window.dispose   end   def update     @synthesis_window.update     # 刷新窗口     if @synthesis_window.active       update_synthesis       return     end   end   def update_synthesis     # 按下 B 键的情况下     if Input.trigger?(Input::B)       # 演奏取消 SE       $game_system.se_play($data_system.cancel_se)       $scene = Scene_Map.new       return     end     # 按下 C 键的情况下     if Input.trigger?(Input::C)       item = @synthesis_window.item       return unless @synthesis_window.can_synthesis?(item.id)       type = @synthesis_window.get_type       $game_party.gain_item(item.id,1)       type[item.id].each {|id| $game_party.gain_item(id,-1)}       @synthesis_window.refresh       @synthesis_window.active = true     end   end end class Window_Synthesis < Window_Selectable   def initialize(type)     super(0, 0, 640, 480)     @type = type     @data = []     get_type.keys.each {|i| @data << $data_items[i]}     @item_max = @data.size     self.contents = Bitmap.new(width - 32, row_max * 32)     self.active = true     refresh     self.index = 0   end   def item     return @data[self.index]   end   def get_type     MFXRB.const_get(@type)   end   def refresh     self.contents.clear     @item_max.times {|i|draw_item(i)}   end   def can_synthesis?(id)     get_type[id].each {|i| return false if $game_party.item_number(i) == 0}     true   end   def draw_item(index)     item = @data[index]     self.contents.font.color = can_synthesis?(item.id) ? normal_color : disabled_color     x = 4     y = index * 32     rect = Rect.new(x, y, self.width / @column_max - 32, 32)     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))     bitmap = RPG::Cache.icon(item.icon_name)     opacity = self.contents.font.color == normal_color ? 255 : 128     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)     get_type[item.id].each {|i| self.contents.draw_text(x+200+get_type[item.id].index(i)*150, y, 212, 32, $data_items[i].name, 0)}   end end 
 
 module MFXRB  
  Food = {}  
  Food[1] = [2,3,4] #合成台代号(首字母大写)[成品id] = [材料1,材料2,....,材料n]  
  Food[2] = [3,5]  
  Food[3] = [7,8]  
  Forge = {}  
  Forge[10] = [20,30]  
end  
class Scene_Synthesis  
  def initialize(type)  
    @type = type  
  end  
  def main  
    @synthesis_window = Window_Synthesis.new(@type)  
    Graphics.transition  
    # 主循环  
    loop do  
      # 刷新游戏画面  
      Graphics.update  
      # 刷新输入信息  
      Input.update  
      # 刷新画面  
      update  
      # 如果切换画面就中断循环  
      if $scene != self  
        break  
      end  
    end  
    # 准备过渡  
    Graphics.freeze  
    # 释放窗口  
    @synthesis_window.dispose  
  end  
  def update  
    @synthesis_window.update  
    # 刷新窗口  
    if @synthesis_window.active  
      update_synthesis  
      return  
    end  
  end  
  def update_synthesis  
    # 按下 B 键的情况下  
    if Input.trigger?(Input::B)  
      # 演奏取消 SE  
      $game_system.se_play($data_system.cancel_se)  
      $scene = Scene_Map.new  
      return  
    end  
    # 按下 C 键的情况下  
    if Input.trigger?(Input::C)  
      item = @synthesis_window.item  
      return unless @synthesis_window.can_synthesis?(item.id)  
      type = @synthesis_window.get_type  
      $game_party.gain_item(item.id,1)  
      type[item.id].each {|id| $game_party.gain_item(id,-1)}  
      @synthesis_window.refresh  
      @synthesis_window.active = true  
    end  
  end  
end  
class Window_Synthesis < Window_Selectable  
  def initialize(type)  
    super(0, 0, 640, 480)  
    @type = type  
    @data = []  
    get_type.keys.each {|i| @data << $data_items[i]}  
    @item_max = @data.size  
    self.contents = Bitmap.new(width - 32, row_max * 32)  
    self.active = true  
    refresh  
    self.index = 0  
  end  
  def item  
    return @data[self.index]  
  end  
  def get_type  
    MFXRB.const_get(@type)  
  end  
  def refresh  
    self.contents.clear  
    @item_max.times {|i|draw_item(i)}  
  end  
  def can_synthesis?(id)  
    get_type[id].each {|i| return false if $game_party.item_number(i) == 0}  
    true  
  end  
  def draw_item(index)  
    item = @data[index]  
    self.contents.font.color = can_synthesis?(item.id) ? normal_color : disabled_color  
    x = 4  
    y = index * 32  
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)  
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))  
    bitmap = RPG::Cache.icon(item.icon_name)  
    opacity = self.contents.font.color == normal_color ? 255 : 128  
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)  
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)  
    get_type[item.id].each {|i| self.contents.draw_text(x+200+get_type[item.id].index(i)*150, y, 212, 32, $data_items[i].name, 0)}  
  end  
end  
 
  |   
 
 
 
 |