| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 3 |  
| 经验 | 2826 |  
| 最后登录 | 2022-6-13 |  
| 在线时间 | 58 小时 |  
 Lv2.观梦者 
	梦石0 星屑257 在线时间58 小时注册时间2009-5-25帖子39 | 
| 本帖最后由 ainlee 于 2011-11-1 00:47 编辑 
 如附圖
 只要選到存檔就掛!
 
   該行錯誤,但該行我看跟原本的專案一樣
 
   所以我猜是◎ Scene_File有錯吧?(我有使用沉影大大的新樣式)
 對於這一串亂碼我實在是很沒辦法复制代码#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File < Scene_Menu_Base
  #--------------------------------------------------------------------------
  # ◎ 初始化對象
  #     saving     : 存檔標誌 (false 為載入畫面)
  #     from_title : 調用標題畫面的 "繼續" 標誌
  #     from_event : 事件的 "調用存檔畫面" 的調用標誌
  #--------------------------------------------------------------------------
  def initialize(saving, from_title, from_event)
    @saving = saving
    @from_title = from_title
    @from_event = from_event
  end
  #--------------------------------------------------------------------------
  # ◎ 開始處理
  #--------------------------------------------------------------------------
  def start
    super
    @help_window = Window_Help.new
    if $game_temp.menu_bitmap.width == 1
      @menu_command_window = Window_Base.new(0,360,544,56)
      create_title_graphic
    end
    create_choice_window
    create_file_command_window
    if @saving
      @index = $game_temp.last_file_index
      @help_window.set_text(Vocab::SaveMessage)
    else
      @index = self.latest_file_index
      @help_window.set_text(Vocab::LoadMessage)
    end
    @refresh_index = @file_command_window.index = @index
    @item_max = MAX_SAVE_ID
    create_savefile_window
    @savefile_window.openness = 0
  end
  #--------------------------------------------------------------------------
  # ◎ 結束處理
  #--------------------------------------------------------------------------
  def terminate
    @@menu_index = @menu_command_window.index unless @from_title
    @menu_command_window.dispose
    @help_window.dispose
    dispose_item_windows
    dispose_menu_background
  end
  #--------------------------------------------------------------------------
  # ◎ 還原至原先的畫面
  #--------------------------------------------------------------------------
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(@@menu_index)
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 更新畫面
  #--------------------------------------------------------------------------
  def update
    super
    @help_window.update
    if @choice_window.visible
      update_choice_window
    else
      update_savefile_windows
      update_savefile_selection
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 開始後處理
  #--------------------------------------------------------------------------
  def post_start
    super
    open_savefile_window
  end
  #--------------------------------------------------------------------------
  # ◎ 結束前處理
  #--------------------------------------------------------------------------
  def pre_terminate
    super
    close_savefile_window
  end
  #--------------------------------------------------------------------------
  # ◎ 生成標題畫面背景
  #--------------------------------------------------------------------------
  def create_title_graphic
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = Cache.system("Title")
  end
  #--------------------------------------------------------------------------
  # ○ 生成指令視窗
  #     index : 默認項目編號
  #--------------------------------------------------------------------------
  def create_menu_command_window(index = 0)
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    s7 = "陣型設定"
    @menu_command_window = Window_Menu_Command.new(544, [s1, s2, s3, s4, s7, s5, s6])
    @menu_command_window.y = @show ? 416 : 360
    @menu_command_window.index = index
    @menu_command_window.refresh
    if $game_party.members.size == 0          # 同伴人數為 0 的情況下
      @menu_command_window.draw_item(0, false)     # 物品無效化
      @menu_command_window.draw_item(1, false)     # 特技無效化
      @menu_command_window.draw_item(2, false)     # 裝備無效化
      @menu_command_window.draw_item(3, false)     # 狀態無效化
      @command_window.draw_item(4, false)     # 陣形編成を無効化
    end
    if $game_switches[AGOW::FORMATION::CALL_SCENE_SWI] == false
      @command_window.draw_item(4, false)     # 陣形編成を無効化
    end
    if $game_system.save_disabled             # 禁止存檔的情況下
      @menu_command_window.draw_item(5, false)     # 存檔無效化
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 生成存檔檔清單窗口
  #--------------------------------------------------------------------------
  def create_file_command_window
    file_names = []
    digit = MAX_SAVE_ID.to_s.size
    str_f = ""
    digit.times{|n| str_f += "0"}
    str_f[str_f.size-1, 1] = digit.to_s
    for i in 0...MAX_SAVE_ID
      id = sprintf("%#{str_f}d", i+1)
      file_names.push(Vocab::File + "\s" + id)
    end
    @file_command_window = Window_Command.new(112, file_names)
    @file_command_window.height = 298
    @file_command_window.x = 64
    @file_command_window.y = 59
    @file_command_window.openness = 0
  end
  #--------------------------------------------------------------------------
  # ◎ 生成覆蓋提示表單
  #--------------------------------------------------------------------------
  def create_choice_window
    @choice_window = Window_Choice.new
    @choice_window.visible = false
    @choice_window.z = 999
  end
  #--------------------------------------------------------------------------
  # ◎ 生成檔案名
  #     file_index : 存檔檔索引
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rvdata"
  end
  #--------------------------------------------------------------------------
  # ◎ 生成存檔檔窗口
  #--------------------------------------------------------------------------
  def create_savefile_window
    @savefile_window = Window_SaveFile.new(@file_command_window.index, make_filename(@file_command_window.index))
  end
  #--------------------------------------------------------------------------
  # ◎ 釋放存檔檔
  #--------------------------------------------------------------------------
  def dispose_item_windows
    @file_command_window.dispose
    @savefile_window.dispose
  end
  #--------------------------------------------------------------------------
  # ◎ 打開指令視窗
  #--------------------------------------------------------------------------
  def open_savefile_window
    @file_command_window.open
    @savefile_window.open
    begin
      @file_command_window.update
      @savefile_window.update
      Graphics.update
    end until @savefile_window.openness == 255
  end
  #--------------------------------------------------------------------------
  # ◎ 關閉指令視窗
  #--------------------------------------------------------------------------
  def close_savefile_window
    @file_command_window.close
    @savefile_window.close
    begin
      @file_command_window.update
      @savefile_window.update
      Graphics.update
    end until @savefile_window.openness == 0
  end
  #--------------------------------------------------------------------------
  # ◎ 更新存檔檔窗口
  #--------------------------------------------------------------------------
  def update_savefile_windows
    @file_command_window.update
    @savefile_window.update
  end
  #--------------------------------------------------------------------------
  # ◎ 更新存檔檔選擇
  #--------------------------------------------------------------------------
  def update_savefile_selection
    if Input.trigger?(Input::C)
      determine_savefile
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    end
    if @refresh_index != @file_command_window.index
      @refresh_index = @file_command_window.index
      @savefile_window.dispose
      create_savefile_window
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 更新覆蓋提示表單
  #--------------------------------------------------------------------------
  def update_choice_window
    @choice_window.update
    if Input.trigger?(Input::C)
      if @choice_window.value
        Sound.play_save
        do_save
      else
        Sound.play_cancel
      end
      @choice_window.visible = false
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      @choice_window.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 確定存檔檔
  #--------------------------------------------------------------------------
  def determine_savefile
    if @saving
      if @savefile_window.file_exist
        @choice_window.visible = true
      else
        Sound.play_save
        do_save
      end
    else
      if @savefile_window.file_exist
        Sound.play_load
        do_load
      else
        Sound.play_buzzer
        return
      end
    end
    $game_temp.last_file_index = @index
  end
  #--------------------------------------------------------------------------
  # ◎ 生成檔案名
  #     file_index : 存檔檔索引 (0~3)
  #--------------------------------------------------------------------------
  def make_filename(file_index)
    return "Save#{file_index + 1}.rvdata"
  end
  #--------------------------------------------------------------------------
  # ◎ 按時間戳記選擇最新的文件
  #--------------------------------------------------------------------------
  def latest_file_index
    index = 0
    latest_time = Time.at(0) # 時間戳記
    for i in 0...MAX_SAVE_ID
      file_name = make_filename(i)
      if FileTest.exist?(SAVE_DIR + file_name)
        file = File.open(SAVE_DIR + file_name, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          index = i
        end
      end
    end
    return index
  end
  #--------------------------------------------------------------------------
  # ◎ 執行存檔
  #--------------------------------------------------------------------------
  def do_save
    file_name = make_filename(@file_command_window.index)
    file = File.open(SAVE_DIR + file_name, "wb")
    write_save_data(file)
    # 保存點陣圖
    file_bitmap = $game_temp.save_bitmap.clone
    Marshal.dump(file_bitmap, file)
    file.close
    file_bitmap.dispose
    return_scene
  end
  #--------------------------------------------------------------------------
  # ◎ 執行載入
  #--------------------------------------------------------------------------
  def do_load
    file_name = make_filename(@file_command_window.index)
    file = File.open(SAVE_DIR + file_name, "rb")
    read_save_data(file)
    file.close
    $scene = Scene_Map.new
    RPG::BGM.fade(1500)
    Graphics.fadeout(60)
    Graphics.wait(40)
    @last_bgm.play
    @last_bgs.play
  end
  #--------------------------------------------------------------------------
  # ● 寫入存檔資料
  #     file : 寫入檔用物件 (已經打開)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    characters = []
    for actor in $game_party.members
      characters.push([actor.character_name, actor.character_index])
    end
    $game_system.save_count += 1
    $game_system.version_id = $data_system.version_id
    @last_bgm = RPG::BGM::last
    @last_bgs = RPG::BGS::last
    Marshal.dump(characters,           file)
    Marshal.dump(Graphics.frame_count, file)
    Marshal.dump(@last_bgm,            file)
    Marshal.dump(@last_bgs,            file)
    Marshal.dump($game_system,         file)
    Marshal.dump($game_message,        file)
    Marshal.dump($game_switches,       file)
    Marshal.dump($game_variables,      file)
    Marshal.dump($game_self_switches,  file)
    Marshal.dump($game_actors,         file)
    Marshal.dump($game_party,          file)
    Marshal.dump($game_troop,          file)
    Marshal.dump($game_map,            file)
    Marshal.dump($game_player,         file)
  end
  #--------------------------------------------------------------------------
  # ● 讀取存檔數據
  #     file : 讀取檔用物件 (已經打開)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    characters           = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    @last_bgm            = Marshal.load(file)
    @last_bgs            = Marshal.load(file)
    $game_system         = Marshal.load(file)
    $game_message        = Marshal.load(file)
    $game_switches       = Marshal.load(file)
    $game_variables      = Marshal.load(file)
    $game_self_switches  = Marshal.load(file)
    $game_actors         = Marshal.load(file)
    $game_party          = Marshal.load(file)
    $game_troop          = Marshal.load(file)
    $game_map            = Marshal.load(file)
    $game_player         = Marshal.load(file)
    if $game_system.version_id != $data_system.version_id
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
  end
end
光是加入個陣型的選單我就搞了老半天....
 現在其實不只這個衝突
 但我想一個一個解決好了~
 希望各位大大可以幫幫忙~
 必要時我可以上傳專案
 | 
 |