Project1
标题:
截图存档 VX化
[打印本页]
作者:
趙雲
时间:
2008-4-1 09:31
标题:
截图存档 VX化
去掉了XP版的一些功能
挺简陋的,可以自己添加描绘一些其他东西。
只是加工,版权归原作者。
截图:
脚本:
#==============================================================================
# 本脚本来自www.66RPG.com,转载和使用请保留此信息
#===============================================================================
BBS_66RPG_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
#-----------------------------------------------------------------------------
# here comes the stuff...
# i add here the stuff for automatic change of the number for the screenshot
# so it wont overrite the old one...
# if you want to change so stuff change them in this line below
# or you can change them in your command line... like
# Screen::shot("screenshot", 2)
# this change the name and the type of the screenshot
# (0 = bmp, 1 = jpg and 2 = png)
# ----------------------------------------------------------------------------
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,544,416,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
#==============================================================================
# ■ Window_SaveFile
#------------------------------------------------------------------------------
# 显示存档以及读档画面、保存文件的窗口。
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :filename # 文件名
attr_reader :file_exist # 文件存在标志
attr_reader :time_stamp # 时间标记
attr_reader :selected # 选择状态
attr_reader :sprite # 图片
attr_reader :pic_window
#--------------------------------------------------------------------------
# ● 初始化对像
# file_index : 存档文件的索引 (0~3)
# filename : 文件名
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 56 + file_index % 4 * 90, 160, 90)
@file_index = file_index
@filename = filename
load_gamedata
@sprite = Sprite_Base.new
@sprite.visible = false
@sprite.z = 100
@pic_window = Window_SavePic.new(filename)
refresh
@selected = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@sprite.visible = @file_index == $game_temp.last_file_index
@pic_window.visible = @sprite.visible
@pic_window.refresh
name = Vocab::File + " #{@file_index + 1}"
@name_width = contents.text_size("Save#{@file_index + 1}.rvdata").width
if @file_exist
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@file_index + 1}.jpg")
@sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@file_index + 1}.jpg")
end
@sprite.x = 176
@sprite.y = 60
@sprite.zoom_x = 0.65
@sprite.zoom_y = 0.65
self.contents.draw_text(0,0,128,WLH,name)
else
self.contents.draw_text(0,0,128,WLH,"空")
end
end
def dispose
super
@sprite.dispose
@pic_window.dispose
end
end
class Window_SavePic < Window_Base
def initialize(filename)
super(160,52,384,364)
@filename = filename
self.visible = false
load_gamedata
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
if @file_exist
draw_party_characters(128, 308)
draw_playtime(0, 308, contents.width - 4, 2)
end
end
#--------------------------------------------------------------------------
# ● 队伍角色的描画
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_party_characters(x, y)
for i in
[email protected]
name = @characters[i][0]
index = @characters[i][1]
draw_character(name, index, x + i * 48, y)
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:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width, WLH, time_string, 2)
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)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
end
#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
# 处理文件的类。
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● 返回前一个画面
#--------------------------------------------------------------------------
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Map.new
end
end
alias old_write_save_data write_save_data
def write_save_data(file)
if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@index+ 1}.jpg")
end
old_write_save_data(file)
end
#--------------------------------------------------------------------------
# ● 刷新存档文件选项
#--------------------------------------------------------------------------
def update_savefile_selection
if Input.trigger?(Input::C)
determine_savefile
elsif Input.trigger?(Input::B)
Sound.play_cancel
return_scene
else
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if @index != last_index
Sound.play_cursor
@savefile_windows[last_index].selected = false
@savefile_windows[@index].selected = true
@savefile_windows[last_index].sprite.visible = false
@savefile_windows.each{|i|i.pic_window.visible = false}
@savefile_windows[@index].sprite.visible = true
@savefile_windows[@index].pic_window.visible = true
@savefile_windows[@index].pic_window.refresh
end
end
end
end
class Scene_Map
#--------------------------------------------------------------------------
# ● 按取消按钮的菜单呼叫判定
#--------------------------------------------------------------------------
def update_call_menu
if Input.trigger?(Input::B)
return if $game_map.interpreter.running? # 事件执行中?
return if $game_system.menu_disabled # 菜单禁止中?
$game_temp.menu_beep = true # SE 演奏标志设定
Screen::shot
$game_temp.next_scene = "menu"
end
end
end
class Interpreter
#--------------------------------------------------------------------------
# ● 调用存档画面
#--------------------------------------------------------------------------
def command_352
$game_temp.next_scene = "save"
@index += 1
Screen::shot
return false
end
end
复制代码
范例:
http://rpg.blue/upload_program/files/截图存档VX_87442191.rar
作者:
雪流星
时间:
2008-4-1 09:41
乾脆再加强一点,把存读档合一吧
PS:这不是应该发在技术区吗?
作者:
趙雲
时间:
2008-4-1 09:47
嗯,有空再更新吧。
作者:
越前リョーマ
时间:
2008-4-3 02:54
希望再美观一点。
作者:
八云紫
时间:
2008-4-3 02:59
为什么我下完后,测试存档的时候,截图是黑的??{/pz}{/pz}{/pz}
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1