| 
 
| 赞 | 1 |  
| VIP | 220 |  
| 好人卡 | 25 |  
| 积分 | 8 |  
| 经验 | 51477 |  
| 最后登录 | 2013-1-12 |  
| 在线时间 | 943 小时 |  
 Lv2.观梦者 花开堪折直须折
 
	梦石0 星屑791 在线时间943 小时注册时间2010-7-17帖子4963 
 | 
| 
上截图附件和脚本
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  不多说了,脚本里啰嗦的要死
 
   复制代码#==============================================================================
# 〇 R剧用的存读档界面
#              By.冰舞蝶恋
#------------------------------------------------------------------------------
# 用法就不必介绍了吧!坐标什么的都是自动居中(适应于任何分辨率)
# 文字可以自己改动,用更改指定角色名字的指令用来做出章节效果。
# 默认用队伍中的第一个角色的名字来作为章节。
# 主要因为考虑到R剧打开菜单的可能性很小……最好是不能打开菜单,用事件打开
# 存档界面,不然就穿帮了,哈哈………
# 啊呀,啰嗦了老半天了,最后感谢剑兰前..辈(啊,怎么又说漏嘴了!!会折寿的!)
#==============================================================================
#==============================================================================
# ■ Window_SaveFile
#------------------------------------------------------------------------------
#  显示存档以及读档画面、保存文件的窗口。
#==============================================================================
class Window_SaveFile
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_reader   :filename                 # 文件名称
  attr_reader   :file_exist               # 文件存在标志
  attr_reader   :time_stamp               # 时间标记
  attr_reader   :selected                 # 选择状态
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     file_index : 存档文件的索引(0-3)
  #     filename   : 文件名称
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super((Graphics.width-230)/2, (Graphics.height-64*3)/2 + 28 + file_index % 3 * 64, 230, 64)#56,544, 90)
    @file_index = file_index
    @filename = filename
    load_gamedata
    refresh
    @selected = false
  end
  #--------------------------------------------------------------------------  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = 16
    name = Vocab::File + " #{@file_index + 1}"
    self.contents.draw_text(4, 0+8, 200, WLH, name)
    @name_width = contents.text_size(name).width
    if @file_exist
      draw_party_characters(152, 58)
      draw_playtime(0, 34, contents.width - 4, 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 载入部分游戏资料
  #    默认情况下,开关和变数不会用到。(以备扩充情况下如:显示地名等时使用)
  #--------------------------------------------------------------------------
  def load_gamedata
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      begin
        @characters     = Marshal.load(file)
        @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_actors    = Marshal.load(file)
        @game_party     = Marshal.load(file)
        @game_player    = Marshal.load(file)
        @total_sec = @frame_count / Graphics.frame_rate
      rescue
        @file_exist = false
      ensure
        file.close
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘游戏时间
  #     x : 绘制点 X 座标
  #     y : 绘制点 Y 座标
  #     width : 描绘区域宽度
  #     align : 对齐方式
  #--------------------------------------------------------------------------
  def draw_playtime(x, y, width, align)
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    time_string = sprintf(" %02d时%02d分", hour, min, sec)#%02d:%02d:%02d
    c = 544 - 230
    self.contents.font.size = 16
    self.contents.font.color = system_color
    self.contents.draw_text(x-374+8+c, y-36-2, width, WLH, "游戏时间:",2)
    self.contents.font.color = normal_color
    self.contents.draw_text(x-320+8+c, y-36-2, width, WLH, time_string, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(x-406+8+c, y-20-2, width, WLH, "章节:", 2)
  end
  #--------------------------------------------------------------------------
  # ● 描绘队员
  #     x : 绘制点 X 座标
  #     y : 绘制点 Y 座标
  #--------------------------------------------------------------------------
  def draw_party_characters(x, y)
    for i in [email protected]
      name = @characters[i][2]
      self.contents.font.size = 16
      self.contents.font.color = normal_color
      self.contents.draw_text(x-56+8+ i * 544, y-44-2, 200, 24, name, 0)
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新光标
  #--------------------------------------------------------------------------
  def update_cursor
    if @selected
      self.cursor_rect.set(0, 0+7, @name_width + 8, WLH)
    else
      self.cursor_rect.empty
    end
  end
end
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
#  存档画面及读档画面的类。
#==============================================================================
class Scene_File
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_savefile_windows
    @z_window = Window_Z.new(0, 0)
    if @saving
      @index = $game_temp.last_file_index
    else
      @index = self.latest_file_index
    end
    @savefile_windows[@index].selected = true
  end
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @z_window.dispose
    dispose_item_windows
  end
  #--------------------------------------------------------------------------
  # ● 更新画面
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @z_window.update
    update_savefile_windows
    update_savefile_selection
  end
  #--------------------------------------------------------------------------
  # ● 生成存档窗口
  #--------------------------------------------------------------------------
  def create_savefile_windows
    @savefile_windows = []
    for i in 0..2
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
    @item_max = 3
  end
  #--------------------------------------------------------------------------
  # ● 写入存档数据
  #     file : 写入存档对象(已开启)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    characters = []
    for actor in $game_party.members
      characters.push([actor.character_name, actor.character_index, actor.name])
    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
end
#==============================================================================
# ■ Window_Z
#------------------------------------------------------------------------------
#  显示读档或是存档的文字。
#==============================================================================
class Window_Z < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     file_index : 存档文件的索引(0-3)
  #     filename   : 文件名称
  #--------------------------------------------------------------------------
  def initialize(x,y)
    super((Graphics.width-230)/2, (Graphics.height-56)/2-64*2+32, 230, 56)#544, 90)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.bold = true
    self.contents.draw_text(60, 2, 230, WLH, "存读记忆")
  end
end
 R剧存档.rar
(244.15 KB, 下载次数: 774) | 
 评分
查看全部评分
 |