| 
 
| 赞 | 8 |  
| VIP | 1 |  
| 好人卡 | 0 |  
| 积分 | 96 |  
| 经验 | 29580 |  
| 最后登录 | 2023-4-8 |  
| 在线时间 | 567 小时 |  
 Lv4.逐梦者 
	梦石7 星屑2585 在线时间567 小时注册时间2009-4-30帖子271 | 
4楼
 
 
 楼主|
发表于 2011-9-11 14:35:47
|
只看该作者 
| 本帖最后由 timmyyayaya 于 2011-9-11 14:41 编辑 
 是的,在下使用了其他的存盘脚本,不知该如何设置当选到某个档案按下时,跳出后面四个。
 复制代码timmyyayaya于2011-9-11 14:38补充以下内容:
#==============================================================================
# ■ Window_SaveFile
#------------------------------------------------------------------------------
#==============================================================================
class Window_SaveFile < Window_Selectable  
  
  
attr_reader :file_exist
  #--------------------------------------------------------------------------
  # ● 初始化物件
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    #super(260, 110, 360, 300)
    cursorOffset(70)  # 游标大小70
    @item_max = $SAVE_FILE_MAX_NUM
    @column_max = 1     #只有两列
    self.index = 0
    #确认档案是否存在
    @file_exist = []
    for i in 0..($SAVE_FILE_MAX_NUM - 1)
      filename = "Save#{i + 1}.rxdata"
      file_exist_temp = FileTest.exist?(filename)
      if file_exist_temp
        @file_exist[i] = 1
      else 
        @file_exist[i] = 0
      end
    end
    @filename = []
    @time_stamp = []
    @characters = []
    @frame_count = []
    @game_system = []
    @game_switches = []
    @game_variables = []
    @total_sec = []
    
     #打开档案读数据
    for i in 0..($SAVE_FILE_MAX_NUM - 1)
      @time_stamp[i] = Time.at(0)
      if @file_exist[i] == 1
        filename = "Save#{i + 1}.rxdata"
        file = File.open(filename, "r")
        @filename[i] = filename
        @time_stamp[i] = file.mtime
        @characters[i] = Marshal.load(file)
        @frame_count[i] = Marshal.load(file)
        @game_system[i] = Marshal.load(file)
        @game_switches[i] = Marshal.load(file)
        @game_variables[i] = Marshal.load(file)
        @total_sec[i] = @frame_count[i] / Graphics.frame_rate
        file.close
      end
    end
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 更新
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
   # self.contents = Bitmap.new(width - 32, $SAVE_FILE_MAX_NUM * 72)
    self.contents = Bitmap.new(width - 32, ($SAVE_FILE_MAX_NUM-1) * 75-32)
    for i in 0..($SAVE_FILE_MAX_NUM - 1)
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘项目
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def draw_item(index)
    x = 0 
    y = index * 70#75
    rect = Rect.new(x, y, 200, 36)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.font.color = system_color
    #描绘文件编号
    if index + 1 < 10
    name = "DATA 0#{index + 1}"
    self.contents.draw_text(x, y, 80, 32, name)
    else
    name = "DATA #{index + 1}"
    self.contents.draw_text(x, y, 80, 32, name)
    end
    if @file_exist[index] == 1
      # 描绘角色
      for i in 0...@characters[index].size
        first_one_pos = 160
        stand_distance = 32
        height_of_ground = 22
        bitmap = RPG::Cache.character(@characters[index][i][0], @characters[index][i][1])
        cw = bitmap.rect.width / 4
        ch = bitmap.rect.height / 4
        src_rect = Rect.new(0, 0, cw, ch)
        cx = first_one_pos - @characters[index].size * stand_distance + i * 32 - cw / 2
        self.contents.blt(cx, y+height_of_ground, bitmap, src_rect)
        #cw = bitmap.rect.width / 4
        #h = bitmap.rect.height / 4
        #rect = Rect.new(x + 60 + (cw * index), y + 36, cw, ch)
        #cx = 300 - @characters[index].size * 32 + index * 64 - cw / 2
        #self.contents.blt(cx, 68 - ch, bitmap, rect)
      end
      # 描绘游戏时间
      hour = @total_sec[index] / 60 / 60
      min = @total_sec[index] / 60 % 60
      time_string = sprintf("%02d:%02d", hour,min)
      
      self.contents.draw_text(x+150, y + 22, 160, 32, time_string, 2)
      # 描绘时间标记
      time_string = @time_stamp[index].strftime("%Y/%m/%d %H:%M")
      self.contents.draw_text(x+150, y + 44, 160, 32, time_string, 2)
    end
  end
  def save_window_update
    #update_cursor_rect
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到选单画面
      $scene = Scene_Menu.new(5)
      return
    end
    # 按下C键的场合下
    #if Input.trigger?(Input::C)
      # 命令窗口光标位置分歧
    #  case self.index
    #  when 0  # 返回标题画面
    #    command_to_title
    #  when 1  # 退出
    #    command_shutdown
    #  end
    #  return
    #end
  end
  
  def make_filename(file_index)
    return "Save#{file_index + 1}.rxdata"
  end
end
 | 
 |