查看: 1966|回复: 1

[有事请教] 读档提示档位会被覆盖的脚本

[复制链接]
梦石
0
星屑
574
在线时间
80 小时
注册时间
2023-7-5
回帖
21
发表于 2023-7-17 14:38:47 | 显示全部楼层 |阅读模式

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

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

×
[fold=scene_load已改的脚本103行报错]#==============================================================================# ■ Scene_Load#------------------------------------------------------------------------------#  处理读档画面的类。#==============================================================================class Scene_Load < Scene_File  #--------------------------------------------------------------------------  # ● 初始化对像  #--------------------------------------------------------------------------  def initialize    # 再生成临时对像    $game_temp = Game_Temp.new    # 选择存档时间最新的文件    $game_temp.last_file_index = 0    latest_time = Time.at(0)    for i in 0..39      filename = make_filename(i)      if FileTest.exist?(filename)        file = File.open(filename, "r")        if file.mtime > latest_time          latest_time = file.mtime          $game_temp.last_file_index = i        end        file.close      end    end    super("读取哪个存档?")    #这行开始    @confirm_window = Window_Base.new(120, 188, 400, 64)    @confirm_window.contents = Bitmap.new(368, 32)    string = "读取存档会丢失当前进度"    @confirm_window.contents.font.name = "黑体"    @confirm_window.contents.font.size = 24    @confirm_window.contents.draw_text(4, 0, 368, 32, string)    @yes_no_window = Window_Command.new(100, ["继续", "取消"])    @confirm_window.visible = false    @confirm_window.z = 1500    @yes_no_window.visible = false    @yes_no_window.active = false    #选项光标放在第二行——取消    @yes_no_window.index = 1    @yes_no_window.x = 270    @yes_no_window.y = 252    @yes_no_window.z = 1500    @mode = 0#这行结束  end  #--------------------------------------------------------------------------  # ● 确定时的处理  #--------------------------------------------------------------------------  def on_decision(filename)    # 文件不存在的情况下    unless FileTest.exist?(filename)      # 演奏冻结 SE      $game_system.se_play($data_system.buzzer_se)      return    end    #这行开始        if FileTest.exist?(filename)      @confirm_window.visible = true      @yes_no_window.visible = true      @yes_no_window.active = true      @mode = 1    else#这行结束    # 演奏读档 SE    $game_system.se_play($data_system.load_se)    # 写入存档数据    file = File.open(filename, "rb")    read_save_data(file)    file.close    # 还原 BGM、BGS    $game_system.bgm_play($game_system.playing_bgm)    $game_system.bgs_play($game_system.playing_bgs)    # 刷新地图 (执行并行事件)    $game_map.update    # 切换到地图画面    $scene = Scene_Map.new  end  #补语法endend#这行开始 -----------------------------  def update    if @mode == 0      super    else      @help_window.update      @yes_no_window.update      if Input.trigger?(Input::C)        $game_system.se_play($data_system.decision_se)        if @yes_no_window.index == 0          @yes_no_window.visible = false          @yes_no_window.active = false          @confirm_window.visible = false          filename = make_filename(@file_index)          $game_system.se_play($data_system.save_se)          file = File.open(filename, "rb")          read_save_data(file)          file.close          #这里可能有问题          if $game_temp.read_calling = false            $scene = Scene_Menu.new (6)          else            $scene = Scene_Map.new          end        else          @confirm_window.visible = false          @yes_no_window.visible = false          @yes_no_window.active = false          @yes_no_window.index = 1          @mode = 0        end      end      if Input.trigger?(Input::B)        @confirm_window.visible = false        @yes_no_window.visible = false        @yes_no_window.active = false        @yes_no_window.index = 1        @mode = 0      return    end  endend#这行结束 -----------------------------  #--------------------------------------------------------------------------  # ● 取消时的处理  #--------------------------------------------------------------------------  def on_cancel    # 演奏取消 SE    $game_system.se_play($data_system.cancel_se)    # 切换到标题画面    $scene = Scene_End.new  end  #--------------------------------------------------------------------------  # ● 读取存档数据  #     file : 读取用文件对像 (已经打开)  #--------------------------------------------------------------------------  def read_save_data(file)    # 读取描绘存档文件用的角色数据    characters = Marshal.load(file)    $game_map_name      = Marshal.load(file)    # 读取测量游戏时间用画面计数    Graphics.frame_count = Marshal.load(file)    # 读取各种游戏对像    $game_system        = Marshal.load(file)    $game_switches      = Marshal.load(file)    $game_variables     = Marshal.load(file)    $game_self_switches = Marshal.load(file)    $game_screen        = 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.magic_number != $data_system.magic_number      # 重新装载地图      $game_map.setup($game_map.map_id)      $game_player.center($game_player.x, $game_player.y)    end    # 刷新同伴成员    $game_party.refresh  endend#这行开始#class Scene_File#  alias carol3_main main#  def main#    carol3_main#    if self.is_a?(Scene_Load)#      @confirm_window.dispose#      @yes_no_window.dispose#    end#  end#end#这行结束[/fold]
梦石
0
星屑
574
在线时间
80 小时
注册时间
2023-7-5
回帖
21
 楼主| 发表于 2023-7-17 14:43:33 | 显示全部楼层
不会直接上传代码,还请忽视一楼内容,附件有工程

Project2.zip

211.11 KB, 下载次数: 3

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部