设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1407|回复: 0
打印 上一主题 下一主题

[已经过期] 截图存档脚本如何配合人物跟随脚本,当开启跟随时存档zhix...

[复制链接]

Lv1.梦旅人

梦石
0
星屑
90
在线时间
186 小时
注册时间
2010-6-24
帖子
111
跳转到指定楼层
1
发表于 2016-4-12 20:38:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
想请问一下各位大神,截图存档脚本如何配合人物跟随脚本,当开启只显示队友A时,存档时其他角色不显)呢?(比如开启跟随时存档显示四个角色,当关闭跟随时就只显示队长一个角色)我 用的是下面的截图存档脚本.谢谢各位大神.
###使用说明
#使用前请复制sceneshot.dll到游戏文件下,并新建文件夹Save
#将此文本插入main前面
#游戏前显示头像的文件名为:人物角色名_f,请自行建立几张做测试,不然找不到图片会报错
#自动存档按钮F5 存入档位0(也就是自动存档那栏)
#使用前,请在菜单脚本:scene_menu里面,
#     when 4 # 存档
#     # 禁止存档的情况下
#     if $game_system.save_disabled
#       # 演奏冻结 SE
#       $game_system.se_play($data_system.buzzer_se)
#       return
#     end
#     # 演奏确定 SE
#     $game_system.se_play($data_system.decision_se)
#     # 切换到存档画面
#     $scene = Scene_Save.new <--这行
#替换为:   $scene = Scene_Loadsave.new
#另,在原scene_title里,48行左右
#    for i in 0..3
#          for i in 0..3
#     if FileTest.exist?("Save#{i+1}.rxdata")
###################改成if FileTest.exist?("Save/Save#{i+1}.rxdata")
#        @continue_enabled = true
#      end
#    end
#否则继续游戏时会检测不到存档

class Window_File < Window_Base
attr_accessor :index
def initialize(index = 0)
   @backsp = Sprite.new
  # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
   @backsp.z = 100
   super(160,64,480,416)
   #这行可以不用
   self.contents = Bitmap.new(width - 32, height - 32)
   #去框##
   self.opacity=0
   ##
   @index = index
   #这里我要说明一句,之所以用sprite是为了放缩图片
   @sprite = Sprite.new
   @sprite.visible = false
   @sprite.z = 100
   @sp_ch = []
   @sp_ch[0] = Sprite.new
   refresh
end
def refresh
   self.contents.clear
   for i in @sp_ch
     i.visible = false
   end
   @sprite.visible = false
   if FileTest.exist?(DIR+"Save#{@index}.rxdata")
     @sprite.visible = true
     if FileTest.exist?(DIR+"Save#{@index}.jpg")
       @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
     else
       self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
     end
     @sprite.x = 206
     @sprite.y = 94
     @sprite.zoom_x = 0.6
     @sprite.zoom_y = 0.6
     file = File.open(DIR+"Save#{@index}.rxdata", "r")
     @time_stamp = file.mtime
     @characters = Marshal.load(file)
     @frame_count = Marshal.load(file)
     @game_system = Marshal.load(file)
     @game_switches = Marshal.load(file)
     @game_variables = Marshal.load(file)
     @total_sec = @frame_count / Graphics.frame_rate
     file.close
     for i in [email protected]
       bitmap = RPG::Cache.character(@characters[0], @characters[1])
       cw = bitmap.rect.width / 4
       ch = bitmap.rect.height / 4
       src_rect = Rect.new(0, 0, cw, ch)
       x = i*30
       y = 320
       self.contents.blt(x, y, bitmap, src_rect)
     end
     # 描绘游戏时间
     hour = @total_sec / 60 / 60
     min = @total_sec / 60 % 60
     sec = @total_sec % 60
     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 326, 420, 32, time_string, 2)
     # 描绘时间标记
     self.contents.font.color = normal_color
     time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
     self.contents.draw_text(4, 346, 420, 32, time_string, 2)###356
   else
     self.contents.draw_text(32,32,420,32,"这个存档是空的")
   end

end
def dispose
   super
   @sprite.dispose
   @backsp.dispose
   for i in @sp_ch
     i.dispose
   end
end
end


class Window_File2 < Window_Base
attr_accessor :index
def initialize(index = 0)
   @backsp = Sprite.new
  # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
   @backsp.z = 100
   super(160,0,480,480)
   #这行可以不用
   self.contents = Bitmap.new(width - 32, height - 32)
   #去框##
   self.opacity=0
   ##
   @index = index
   #这里我要说明一句,之所以用sprite是为了放缩图片
   @sprite = Sprite.new
   @sprite.visible = false
   @sprite.z = 100
   @sp_ch = []
   @sp_ch[0] = Sprite.new
   refresh
end
def refresh
   self.contents.clear
   for i in @sp_ch
     i.visible = false
   end
   @sprite.visible = false
   if FileTest.exist?(DIR+"Save#{@index}.rxdata")
     @sprite.visible = true
     if FileTest.exist?(DIR+"Save#{@index}.jpg")
       @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
     else
       self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
     end
     @sprite.x = 176
     @sprite.y = 30
     @sprite.zoom_x = 0.7
     @sprite.zoom_y = 0.7
     file = File.open(DIR+"Save#{@index}.rxdata", "r")
     @time_stamp = file.mtime
     @characters = Marshal.load(file)
     @frame_count = Marshal.load(file)
     @game_system = Marshal.load(file)
     @game_switches = Marshal.load(file)
     @game_variables = Marshal.load(file)
     @total_sec = @frame_count / Graphics.frame_rate
     file.close
     for i in [email protected]
       bitmap = RPG::Cache.character(@characters[0], @characters[1])
       cw = bitmap.rect.width / 4
       ch = bitmap.rect.height / 4
       src_rect = Rect.new(0, 0, cw, ch)
       x = i*30
       self.contents.blt(x, 440 - ch, bitmap, src_rect)
     end
     # 描绘游戏时间
     hour = @total_sec / 60 / 60
     min = @total_sec / 60 % 60
     sec = @total_sec % 60
     time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
     self.contents.font.color = normal_color
     self.contents.draw_text(4, 390, 420, 32, time_string, 2)
     # 描绘时间标记
     self.contents.font.color = normal_color
     time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
     self.contents.draw_text(4, 420, 420, 32, time_string, 2)
   else
     self.contents.draw_text(32,32,420,32,"这个存档是空的")
   end

end
def dispose
   super
   @sprite.dispose
   @backsp.dispose
   for i in @sp_ch
     i.dispose
   end
end
end



$打开自动存档用的开关编号 = 999
$自动存档位置 = 0
$按下F5之后的自动存档的音效 = "Audio/SE/存档"
$按下F5之后禁止存档时候的音效 = "Audio/Se/】警告"
DIR = "Save/"
$打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
$按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
$按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
class Scene_Map
alias auto_update update
def update
auto_update
#——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
#——注意在不可存档的时候是无效的
if Input.trigger?(Input::F5)
  unless $game_system.map_interpreter.running?
  if $game_system.save_disabled
    Audio.se_play($按下F5之后禁止存档时候的音效)
    $game_temp.common_event_id = 977
  else
    Audio.se_play($按下F5之后的自动存档的音效)
    $game_temp.common_event_id = 977
    auto_save
  end
  end
end
#——当BOSS战之前打开一下定义的开关,即可自动存档
if $game_switches[$打开自动存档用的开关编号] == true
  $game_switches[$打开自动存档用的开关编号] = false
  $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  auto_save
end
end
def auto_save
#——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
# 写入存档数据
Screen::shot
    file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
    auto_save_data(file)
    if FileTest.exist?( DIR+"shot.jpg")
      File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
    end
    file.close
end
def auto_save_data(file)
#——以下定义内容和Scene_Save的write_save_data(file)完全一样
#——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
# 生成描绘存档文件用的角色图形
characters = []
for i in 0...$game_party.actors.size
  actor = $game_party.actors
  characters.push([actor.character_name, actor.character_hue, actor])
end
# 写入描绘存档文件用的角色数据
Marshal.dump(characters, file)
# 写入测量游戏时间用画面计数
Marshal.dump(Graphics.frame_count, file)
# 增加 1 次存档次数
$game_system.save_count += 1
# 保存魔法编号
# (将编辑器保存的值以随机值替换)
$game_system.magic_number = $data_system.magic_number
# 写入各种游戏对像
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, 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







DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹


module Screen  
@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l

p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
module_function
def shot(file = "shot", typ = 1)
   # to add the right extension...
   if typ == 0
     typname = ".bmp"
   elsif typ == 1
     typname = ".jpg"
   elsif typ == 2
     typname = ".png"
   end   
   file_index = 0   
   dir = "Save/"   
   # make the filename....
   file_name = dir + file.to_s + typname.to_s   
   # make the screenshot.... Attention dont change anything from here on....
   @screen.call(0,0,640,480,file_name,handel,typ)
end
# find the game window...
def handel
   game_name = "\0" * 256
   @readini.call('Game','Title','',game_name,255,".\\Game.ini")
   game_name.delete!("\0")
   return @findwindow.call('RGSS Player',game_name)
end
end


class Scene_Menu
alias shotsave_main main
def main
   if @menu_index == 0
     Screen::shot
   end   
   shotsave_main
end
end

class Interpreter
#--------------------------------------------------------------------------
# ● 调用存档画面
#--------------------------------------------------------------------------
def command_352
   # 设置战斗中断标志
   $game_temp.battle_abort = true
   # 设置调用存档标志
   $game_temp.save_calling = true
   # 推进索引
   @index += 1
   # 结束
   Screen::shot
   return false
end
end

#==============================================================================
# ■ Scene_Load
#------------------------------------------------------------------------------
#  处理读档画面的类。
#==============================================================================

class Scene_Load
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
   # 再生成临时对像
   $game_temp = Game_Temp.new
   # 选择存档时间最新的文件
   $game_temp.last_file_index = 0
   latest_time = Time.at(0)
   for i in 0..51
     filename = DIR+"Save#{i}.rxdata"
     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
end  
def main
   #生成背景#
   ##生成菜单背景##
    @dff_save= Sprite.new
    @dff_save.bitmap = Bitmap.new("Graphics/Pictures/System/load")
   ##
   @command_window = Window_Command.new(160,["  快速存档","  进度一","  进度二",
   "  进度三","  进度四","  进度五","  进度六","  进度七","  进度八","  进度九","  进度十",
   "  进度十一","  进度十二","  进度十三","  进度十四","  进度十五","  进度十六",
   "  进度十七","  进度十八","  进度十九","  进度二十","  进度二一","  进度二二",
   "  进度二三","  进度二四","  进度二五","  进度二六","  进度二七","  进度二八",
   "  进度二九","  进度三十"])
   @command_window.y = 1
   @command_window.height = 480
   @command_window.index = $game_temp.last_file_index
   @content_window = Window_File2.new($game_temp.last_file_index)
   #去框##
   @command_window.opacity = 0
   ##   
   # 执行过渡
   Graphics.transition
   # 主循环
   loop do
     # 刷新游戏画面
     Graphics.update
     # 刷新输入信息
     Input.update
     # 刷新画面
     update
     # 如果画面被切换的话就中断循环
     if $scene != self
       break
     end
   end
   # 准备过渡
   Graphics.freeze
   @command_window.dispose
   @content_window.dispose
   @dff_save.dispose
   @dff_save.bitmap.dispose
end
def update
   @command_window.update
   if @command_window.index != @content_window.index
     @content_window.index = @command_window.index
     @content_window.refresh
   end   
   #——————下面这一部分是原装脚本——————#
   if Input.trigger?(Input::B)  
   # 演奏取消 SE
   $game_system.se_play($data_system.cancel_se)
   # 切换到标题画面
   $scene = Scene_Title.new
   #$scene = Scene_Map.new
   end   
   #———————————————————————#   
   if Input.trigger?(Input::C)
     # 文件不存在的情况下
     unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
       # 演奏冻结 SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 演奏读档 SE
     $game_system.se_play($data_system.load_se)
     # 写入存档数据
     file = File.open(DIR+"Save#{@command_window.index}.rxdata", "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
   #———————————————————————#
end
#--------------------------------------------------------------------------
# ● 写入存档数据
#     file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def read_save_data(file)
   # 读取描绘存档文件用的角色数据
   characters = 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
end
end

#==============================================================================
#  Window_LoadCommand
#------------------------------------------------------------------------------
#  存取档画面选择按钮窗口
#==============================================================================

class Window_LoadCommand < Window_Selectable
#--------------------------------------------------------------------------
#  初始化对象
#--------------------------------------------------------------------------
def initialize
super(320, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.color = normal_color
#去框#
self.opacity=0
##
@item_max = 2
@column_max = 2
@commands = ["存储", "读取"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
#  刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
   draw_item(i)
end
end
#--------------------------------------------------------------------------
#  描画按钮文字
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 160
self.contents.draw_text(x, 0, 144, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ● 项目无效化
#     index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
   draw_item(index, disabled_color)
end

end

#==============================================================================
#  Scene_Loadsave
#------------------------------------------------------------------------------
# 处理存取档画面的类。
#==============================================================================

class Scene_Loadsave
#--------------------------------------------------------------------------
# ● 初始化对像
#     $last_savefile_index : 记录光标位置
#--------------------------------------------------------------------------
def initialize
   $last_savefile_index = 0 if $last_savefile_index == nil
   # 再生成临时对像
   $game_temp = Game_Temp.new
   # 选择存档时间最新的文件
   $game_temp.last_file_index = 0
   latest_time = Time.at(0)
   for i in 0..51
     filename =  DIR+"Save#{i}.rxdata"
     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
end
#--------------------------------------------------------------------------
#  主处理
#--------------------------------------------------------------------------
def main         
   ##生成菜单背景##
    @dff_save= Sprite.new
    @dff_save.bitmap = Bitmap.new("Graphics/Pictures/System/saveload")
   ##
   @savestate = 0
   # 生成窗口
   @help_window = Window_LoadHelp.new
   @help_window.set_text("请选择.")
   @option_window = Window_LoadCommand.new
   @option_window.index = $last_savefile_index
   ########################################################
   @command_window = Window_Command.new(160,["  快速存档","   进度一","   进度二",
   "   进度三","   进度四","   进度五","   进度六","   进度七","   进度八","   进度九","   进度十",
   "  进度十一","  进度十二","  进度十三","  进度十四","  进度十五","  进度十六",
   "  进度十七","  进度十八","  进度十九","  进度二十","  进度二一","  进度二二",
   "  进度二三","  进度二四","  进度二五","  进度二六","  进度二七","  进度二八",
   "  进度二九","  进度三十"])
     @command_window.y = 64
     @command_window.height = 378
     @command_window.index = $game_temp.last_file_index
     @content_window = Window_File.new($game_temp.last_file_index)
     @command_window.active = false
     #去框##
     @command_window.opacity = 0
     ##
     ###############覆盖存档
       @confirm_window = Window_Base.new(120, 188, 400, 64)
       @confirm_window.contents = Bitmap.new(368, 32)

       @confirm_window.contents.font.color = Color.new(255,255,255,255)

       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.z = 1500
       @yes_no_window.index = 1
       @yes_no_window.x = 270
       @yes_no_window.y = 252
       @yes_no_window.z = 1500
       @confirm_window.visible = false
       @yes_no_window.visible = false
       @yes_no_window.active = false

   # 执行过渡
   Graphics.transition
   # 主循环
   loop do
     # 刷新游戏画面
     Graphics.update
     # 刷新输入信息
     Input.update
     # 刷新画面
     update
     # 如果画面被切换的话就中断循环
     if $scene != self
       break
     end
   end
   # 准备过渡
   Graphics.freeze
   # 释放窗口
   @command_window.dispose
   @content_window.dispose
   @confirm_window.dispose
   @yes_no_window.dispose
   @help_window.dispose
   @option_window.dispose
   @dff_save.dispose
   @dff_save.bitmap.dispose
end

#--------------------------------------------------------------------------
#  ● 刷新画面
#--------------------------------------------------------------------------
def update
   # 刷新窗口
   @help_window.update
   @option_window.update
#   @content_window.update
   @command_window.update
   if @yes_no_window.active
       confirm_update
       return
   end
   @content_window.index = @command_window.index
   @content_window.refresh
   case @savestate
   when 0
       if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       # 返回地图
       if $menu_call == false
       # 切换到地图画面
       $scene = Scene_Map.new
         return
       end
       # 切换到菜单画面
       $menu_call = false
       $scene = Scene_Map.new
    end
     if Input.trigger?(Input::C)
       case @option_window.index
       when 1
         @command_window.active = true
         @option_window.active = false
         $game_system.se_play($data_system.decision_se)
         @help_window.set_text("请选择一个文件进行读取.")
         @savestate  = 1
         return
       when 0

         @command_window.active = true
         @option_window.active = false
         $game_system.se_play($data_system.decision_se)
         @help_window.set_text("请选择一个文件进行存储.")
         @savestate = 2
         
         return
       return
       end
     end
   when 1,2
     if Input.trigger?(Input::C)
       if @savestate == 1
         $menu_call = false
         load_file
         return
       else
         # 禁止存档的情况下
         if $game_system.save_disabled
           @help_window.set_text("当前地图禁止存档.")
           # 演奏冻结 SE
           $game_system.se_play($data_system.buzzer_se)
           return
         end
        $game_system.se_play($data_system.decision_se)
        $last_savefile_index = @option_window.index

        save_file
         return
       end
     end
     # 取消
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @command_window.active = false
       @help_window.set_text("请选择.")
       @savestate = 0
       @option_window.active = true
       return
     end
     
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @savestate = 2
       @command_window.active = true

       return
     end
   end
end
#--------------------------------------------------------------------------
# 建立记录文件索引
#--------------------------------------------------------------------------

#--------------------------------------------------------------------------
#  读取记录文件
#     filename  : 被读取文件
#--------------------------------------------------------------------------
def load_file
     # 文件不存在的情况下
     unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
       # 演奏冻结 SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 演奏读档 SE
     $game_system.se_play($data_system.load_se)
     # 写入存档数据
     file = File.open( DIR+"Save#{@command_window.index}.rxdata", "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
     $game_temp.common_event_id = 923
end
#--------------------------------------------------------------------------
# ● 读取存档数据
#     file : 读取用文件对像 (已经打开)
#--------------------------------------------------------------------------
def read_save_data(file)
   # 读取描绘存档文件用的角色数据
   characters = 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
end
#--------------------------------------------------------------------------
# ● 写入存档文件
#--------------------------------------------------------------------------
def save_file
   if Input.trigger?(Input::C)
     unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
       # 演奏冻结 SE
       # 演奏存档 SE
         $game_system.se_play($data_system.save_se)
         # 写入存档数据
         file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
         write_save_data(file)
         if FileTest.exist?( DIR+"shot.jpg")
           File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
         end
         file.close
         $game_temp.last_file_index = @command_window.index
         # 如果被事件调用
         if $game_temp.save_calling
           # 清除存档调用标志
           $game_temp.save_calling = false
           @confirm_window.dispose
           # 切换到地图画面
           $scene = Scene_Map.new   
           return
         end
       # 切换到菜单画面
         $scene = Scene_Map.new
     end
     @yes_no_window.active = true
     @command_window.active = false            
   end
   #———————————————————————#     
end
#-------------------------------------------------------------------
def confirm_update
   @command_index = @command_window.index
   @confirm_window.visible = true
   @confirm_window.z = 1500
   @yes_no_window.visible = true
   @yes_no_window.active = true
   @yes_no_window.z = 1500
   @yes_no_window.update
   if Input.trigger?(Input::C)
     if @yes_no_window.index == 0
         #######################################################
         # 演奏存档 SE
         $game_system.se_play($data_system.save_se)
         # 写入存档数据
         file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
         write_save_data(file)
         if FileTest.exist?( DIR+"shot.jpg")
           File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
         end
         file.close
         $game_temp.last_file_index = @command_window.index
         # 如果被事件调用
         if $game_temp.save_calling
           # 清除存档调用标志
           $game_temp.save_calling = false
           @confirm_window.dispose
           @content_window.dispose
           # 切换到地图画面
           $scene = Scene_Map.new
           return
         end
       # 切换到菜单画面
         $scene = Scene_Map.new      
       else
       @yes_no_window.visible = false
       @confirm_window.visible = false
       $game_system.se_play($data_system.cancel_se)
       @yes_no_window.active = false
       @command_window.active = true
       end
   end
   if Input.trigger?(Input::B)
     @yes_no_window.visible = false
     @confirm_window.visible = false
     $game_system.se_play($data_system.cancel_se)
     @yes_no_window.active = false
     @command_window.active = true
   end
end
#--------------------------------------------------------------------------
# ● 写入存档数据
#     file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def write_save_data(file)
   # 生成描绘存档文件用的角色图形
   characters = []
   for i in 0...$game_party.actors.size
     actor = $game_party.actors
     characters.push([actor.character_name, actor.character_hue, actor])
   end
   # 写入描绘存档文件用的角色数据
   Marshal.dump(characters, file)
   # 写入测量游戏时间用画面计数
   Marshal.dump(Graphics.frame_count, file)
   # 增加 1 次存档次数
   $game_system.save_count += 1
   # 保存魔法编号
   # (将编辑器保存的值以随机值替换)
   $game_system.magic_number = $data_system.magic_number
   # 写入各种游戏对像
   Marshal.dump($game_system, file)
   Marshal.dump($game_switches, file)
   Marshal.dump($game_variables, file)
   Marshal.dump($game_self_switches, file)
   Marshal.dump($game_screen, 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_LoadHelp
#------------------------------------------------------------------------------
#  存取档画面帮助信息的显示窗口。
#==============================================================================

class Window_LoadHelp < Window_Base
#--------------------------------------------------------------------------
#  初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
#去框#
self.opacity=0
##
end
#--------------------------------------------------------------------------
#  刷新文本
#--------------------------------------------------------------------------
def set_text(text, align = 1)
if text != @text or align != @align
   self.contents.clear
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
   @text = text
   @align = align
   @actor = nil
end
self.visible = true
end
end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 11:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表