赞 | 0 |
VIP | 8 |
好人卡 | 0 |
积分 | 1 |
经验 | 5594 |
最后登录 | 2017-5-24 |
在线时间 | 244 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 244 小时
- 注册时间
- 2008-1-25
- 帖子
- 312
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
{/fd}{/pz}点开GAME.EXE,读档,跳出如下错误:
但是如果我进入新游戏之后,再无论是游戏内读取或者在标题上读取,都一切正常.{/gg}
难道和换行的HELP WINDOW有关?脚本如下:
截图存取档
- ###使用说明
- #使用前请复制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/pass")
- @backsp.z = 100
- super(160,64,480,416)
- #这行可以不用
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 255
- @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 = 290
- @sprite.y = 96
- @sprite.z = 998
- @sprite.zoom_x = 0.5
- @sprite.zoom_y = 0.5
- 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]
- @sp_ch[i] = Sprite.new
- @sp_ch[i].visible = true
- testname = @characters[i][2].name+"_f"
- @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
- @sp_ch[i].zoom_x = 0.8
- @sp_ch[i].zoom_y = 0.8
- @sp_ch[i].x = 180
- @sp_ch[i].y = 96 + i*90
- @sp_ch[i].z = 101
- 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, 356, 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
- class Window_File2 < Window_Base
- attr_accessor :index
- def initialize(index = 0)
- @backsp = Sprite.new
- #@backsp.bitmap = Bitmap.new("Graphics/Pictures/pass")
- @backsp.z = 100
- super(160,0,480,480)
- #这行可以不用
- self.contents = Bitmap.new(width - 32, height - 32)
- @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 = 290
- @sprite.y = 32
- @sprite.z = 998
- @sprite.zoom_x = 0.5
- @sprite.zoom_y = 0.5
- 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]
- @sp_ch[i] = Sprite.new
- @sp_ch[i].visible = true
- testname = @characters[i][2].name+"_f" #修改
- @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
- @sp_ch[i].x = 180
- @sp_ch[i].y = 24 + i*110
- @sp_ch[i].z = 101
- 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
- $自动存档位置 = 1
- $按下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 = $按下F5之后禁止存档调用的公共事件
- else
- Audio.se_play($按下F5之后的自动存档的音效)
- $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
- 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[i]
- 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
- @command_window = Window_Command.new(160,["自动存档","快速存档","回忆二",
- "回忆三","回忆四","回忆五","回忆六","回忆七","回忆八","回忆九","回忆十",
- "回忆十一","回忆十二","回忆十三","回忆十四","回忆十五","回忆十六",
- "回忆十七","回忆十八","回忆十九","回忆二十","回忆二一","回忆二二",
- "回忆二三","回忆二四","回忆二五","回忆二六","回忆二七","回忆二八",
- "回忆二九","回忆三十"])
- @command_window.y = 0
- @command_window.height = 480
- @command_window.index = $game_temp.last_file_index
- @content_window = Window_File2.new($game_temp.last_file_index)
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面被切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- @command_window.dispose
- @content_window.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
- 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
- @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
- @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 = 416
- @command_window.index = $game_temp.last_file_index
- @content_window = Window_File.new($game_temp.last_file_index)
- @command_window.active = false
- ###############覆盖存档
- @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
- 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 0
- @command_window.active = true
- @option_window.active = false
- $game_system.se_play($data_system.decision_se)
- @help_window.set_text("请选择一个文件进行读取.")
- @savestate = 1
- return
- when 1
- @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
- 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[i]
- 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)
- 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
复制代码
换行的HELP
- #==============================================================================
- # ◎ GPRA_Window_Help
- #------------------------------------------------------------------------------
- # ◎ 特技及物品的说明、角色的状态显示的窗口加强。
- #------------------------------------------------------------------------------
- # 制作者:绿梨子红苹果
- # 个人主页:vbgm.9126.com
- # E-Mail:[email protected]
- # QQ:42378361
- #==============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(360, 60, 240, 104)
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text : 窗口显示的字符串
- # align : 对齐方式
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- # 如果文本和对齐方式的至少一方与上次的不同
- if text != @text or align != @align
- # 清空原来的文字内容
- self.contents.clear
- # 设置颜色为默认颜色
- self.contents.font.color = normal_color
- # 定义变量记录文字行数
- l=0
- # 定义数组分别记录每行文字内容
- s=["","",""]
- # 利用临时变量存储text内容
- temp=text.dup
- # 首先处理文本,将"\\n"全部替换成换行符"\n"
- temp.gsub!(/\\n/) { "\n" }
- # c 获取 1 个字 (如果不能取得文字就退出循环)
- while ((c = temp.slice!(/./m)) != nil)
- # 另起一行文字的情况下
- if c == "\n"
- # 当超过3行时(0行开始,所以这里是2)
- if l >= 2
- # 退出循环体
- break
- end
- # 否则l自增1
- l += 1
- end
- # 不是换行符的其他情况
- s[l]=s[l]+c
- end
- # 根据文字的行数进行不同的绘制
- case l
- when 0
- self.contents.draw_text(4, 32, self.width - 40, 32, s[0], align)
- when 1
- self.contents.draw_text(4, 16, self.width - 40, 32, s[0], align)
- self.contents.draw_text(4, 48, self.width - 40, 32, s[1], align)
- when 2
- self.contents.draw_text(4, 0, self.width - 40, 32, s[0], align)
- self.contents.draw_text(4, 32, self.width - 40, 32, s[1], align)
- self.contents.draw_text(4, 64, self.width - 40, 32, s[2], align)
- end
- # 保存此次绘图时的参数值
- @text = text
- @align = align
- @actor = nil
- end
- # 可见状态为真
- self.visible = true
- end
- #--------------------------------------------------------------------------
- # ● 设置角色
- # actor : 要显示状态的角色
- #--------------------------------------------------------------------------
- def set_actor(actor)
- if actor != @actor
- self.contents.clear
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置敌人
- # enemy : 要显示名字和状态的敌人
- #--------------------------------------------------------------------------
- #def set_enemy(enemy)
- #text = enemy.name
- #state_text = make_battler_state_text(enemy,false)
- #if state_text != ""
- #text += " " + state_text
- #end
- #set_text(text, 1)
- #end
- end
复制代码 版务信息:本贴由楼主自主结贴~ |
|