赞 | 18 |
VIP | 0 |
好人卡 | 0 |
积分 | 38 |
经验 | 22733 |
最后登录 | 2024-6-1 |
在线时间 | 741 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3770
- 在线时间
- 741 小时
- 注册时间
- 2016-6-2
- 帖子
- 211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 David_Exmachina 于 2017-10-3 15:40 编辑
如题,由于论坛搬迁后提高了素材要求,
所以我想知道这些脚本是谁写的。
制作人员名单
#============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #============================================================================== #—————————————————————————————————————— # Scene_Credit 制作人员名单 #—————————————————————————————————————— #——使用注意:默认会返回地图,如果需要返回开头,请将本脚本中的 #return_scene = Scene_Map.new改为return_scene = Scene_Title.new class Scene_Credit CREDIT=<<_END_ -----Cast------ 制作工具:RPG Maker XP 先帝创业未半而中道崩殂 今天下三分,益州疲弊 此诚危急存亡之秋也 然侍卫之臣不懈于内,忠志之士忘身于外者 盖追先帝之殊遇,欲报之于陛下也 诚宜开张圣听,以光先帝遗德,恢弘志士之气 不宜妄自菲薄,引喻失义,以塞忠谏之路也 宫中府中,俱为一体,陟罚臧否,不宜异同 若有作奸犯科及为忠善者 宜付有司论其刑赏,以昭陛下平明之理 不宜偏私,使内外异法也。 侍中侍郎郭攸之、费祎、董允等 此皆良实,志虑忠纯,是以先帝简拔以遗陛下 愚以为宫中之事,事无大小,悉以咨之,然后施行 必能裨补阙漏,有所广益。 _END_ end class Scene_Credit def initialize(return_scene = nil) @sprite = Sprite.new @sprite.bitmap = Bitmap.new("Graphics/Pictures/1") @sprite.x = 0 @sprite.y = 0 if return_scene.nil? return_scene = Scene_Map.new end @return_scene = return_scene end def scene_start credit_lines = CREDIT.split(/\n/) credit_bitmap = Bitmap.new(640,32 * credit_lines.size) credit_lines.each_index do |i| line = credit_lines[i] credit_bitmap.draw_text(0,i * 32,640,32,line,1) end @credit_sprite = Sprite.new(Viewport.new(0,50,640,380)) @credit_sprite.bitmap = credit_bitmap @credit_sprite.oy = -430 @frame_index = 0 @last_flag = false end def scene_end @credit_sprite.dispose @sprite.dispose end def last? return (@frame_index >= @credit_sprite.bitmap.height + 480) end def last if not @last_flag Audio.bgm_fade(10000) @last_flag = true @last_count = 0 else @last_count += 1 end if @last_count >= 300 $scene = @return_scene end end def update @frame_index += 1 return if cancel? last if last? @credit_sprite.oy += 1 end def cancel? if Input.trigger?(Input::B) $scene = @return_scene return true end return false end def main scene_start # 过渡 Graphics.transition # 主循环 loop do Graphics.update Input.update update if $scene != self break end end # 准备过渡 Graphics.freeze scene_end end end #============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#——————————————————————————————————————
# Scene_Credit 制作人员名单
#——————————————————————————————————————
#——使用注意:默认会返回地图,如果需要返回开头,请将本脚本中的
#return_scene = Scene_Map.new改为return_scene = Scene_Title.new
class Scene_Credit
CREDIT=<<_END_
-----Cast------
制作工具:RPG Maker XP
先帝创业未半而中道崩殂
今天下三分,益州疲弊
此诚危急存亡之秋也
然侍卫之臣不懈于内,忠志之士忘身于外者
盖追先帝之殊遇,欲报之于陛下也
诚宜开张圣听,以光先帝遗德,恢弘志士之气
不宜妄自菲薄,引喻失义,以塞忠谏之路也
宫中府中,俱为一体,陟罚臧否,不宜异同
若有作奸犯科及为忠善者
宜付有司论其刑赏,以昭陛下平明之理
不宜偏私,使内外异法也。
侍中侍郎郭攸之、费祎、董允等
此皆良实,志虑忠纯,是以先帝简拔以遗陛下
愚以为宫中之事,事无大小,悉以咨之,然后施行
必能裨补阙漏,有所广益。
_END_
end
class Scene_Credit
def initialize(return_scene = nil)
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new("Graphics/Pictures/1")
@sprite.x = 0
@sprite.y = 0
if return_scene.nil?
return_scene = Scene_Map.new
end
@return_scene = return_scene
end
def scene_start
credit_lines = CREDIT.split(/\n/)
credit_bitmap = Bitmap.new(640,32 * credit_lines.size)
credit_lines.each_index do |i|
line = credit_lines[i]
credit_bitmap.draw_text(0,i * 32,640,32,line,1)
end
@credit_sprite = Sprite.new(Viewport.new(0,50,640,380))
@credit_sprite.bitmap = credit_bitmap
@credit_sprite.oy = -430
@frame_index = 0
@last_flag = false
end
def scene_end
@credit_sprite.dispose
@sprite.dispose
end
def last?
return (@frame_index >= @credit_sprite.bitmap.height + 480)
end
def last
if not @last_flag
Audio.bgm_fade(10000)
@last_flag = true
@last_count = 0
else
@last_count += 1
end
if @last_count >= 300
$scene = @return_scene
end
end
def update
@frame_index += 1
return if cancel?
last if last?
@credit_sprite.oy += 1
end
def cancel?
if Input.trigger?(Input::B)
$scene = @return_scene
return true
end
return false
end
def main
scene_start
# 过渡
Graphics.transition
# 主循环
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
scene_end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
截图存档
#============================================================================== # 本脚本来自[url]www.66RPG.com[/url],转载和使用请保留此信息 #=============================================================================== BBS_66RPG_DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹 # 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。 # 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找): # for i in 0..3 # if FileTest.exist?("Save#{i+1}.rxdata") # 请自行把0..3改为0..最大进度号,比如0..9 # "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata" # 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本” #=============================================================================== 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,640,480,file_name,get_window_handle,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 Window_File < Window_Base attr_accessor :index def initialize(index = 0) @backsp = Sprite.new @backsp.bitmap = Bitmap.new("Graphics/Pictures/存盘背景.jpg") @backsp.z = 99 super(160,0,480,368) self.back_opacity = 80 #这行可以不用 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?(BBS_66RPG_DIR+"Save#{@index}.rxdata") @sprite.visible = true if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg") @sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg") else self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?") end @sprite.x = 176 @sprite.y = 16 @sprite.zoom_x = 0.7 @sprite.zoom_y = 0.7 file = File.open(BBS_66RPG_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 [url=mailto:0...@characters.size]0...@characters.size[/url] @sp_ch[i] = Sprite.new @sp_ch[i].visible = true @sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4]) @sp_ch[i].x = 180 + i* 100 @sp_ch[i].y = 310 - @sp_ch[i].bitmap.height @sp_ch[i].z = 101 @sp_ch[i].opacity = 80 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(32, 60, 410, 70, time_string, 2) # 描绘时间标记 self.contents.font.color = normal_color time_string = @time_stamp.strftime("%Y/%m/%d %H:%M") self.contents.draw_text(32, 40, 410, 50, time_string, 2) case self.index when $game_temp.last_file_index self.contents.draw_text(20,20,410,20,"最近的进度") end else self.contents.draw_text(20,20,410,20,"这个进度是空的") end end def dispose super @sprite.dispose @backsp.dispose for i in @sp_ch i.dispose end end end class Scene_Save def main @screen = Spriteset_Map.new @command_window = Window_Command.new(160,["进度一","进度二","进度三","进度四","进度五","进度六"]) @command_window.contents.font.size = 24 @command_window.contents.font.bold = true @command_window.y = 96 @command_window.index = $game_temp.last_file_index @command_window.opacity = 0 @command_window.windowskin = nil @content_window = Window_File.new($game_temp.last_file_index) # 执行过渡 Graphics.transition # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果画面被切换的话就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze @screen.dispose @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) $game_system.se_play($data_system.cancel_se) if $game_temp.save_calling $game_temp.save_calling = false $scene = Scene_Map.new return end $scene = Scene_Menu.new(4) end #———————————————————————# if Input.trigger?(Input::C) # 演奏存档 SE $game_system.se_play($data_system.save_se) # 写入存档数据 file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb") write_save_data(file) if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg") File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_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 # 切换到地图画面 $scene = Scene_Map.new return end # 切换到菜单画面 $scene = Scene_Map.new 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.id, actor.battler_name, actor.battler_hue]) 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($data_skills, file) 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) Marshal.dump($pet_array, file) end end 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..5 filename = BBS_66RPG_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,["进度一","进度二","进度三","进度四","进度五","进度六"]) for i in 0..5 filename = BBS_66RPG_DIR+"Save#{i}.rxdata" if !FileTest.exist?(filename) @command_window.disable_item(i) end end @command_window.contents.font.size = 24 @command_window.contents.font.bold = true @command_window.y = 96 @command_window.opacity = 0 @command_window.index = $game_temp.last_file_index @content_window = Window_File.new($game_temp.last_file_index) @command_window.windowskin = nil # 执行过渡 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?(BBS_66RPG_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(BBS_66RPG_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) # 读取各种游戏对像 $data_skills = 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) $pet_array = 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 class Scene_Menu alias bbs_66rpg_shotsave_main main def main if $menu_save Screen::shot $menu_save = false end bbs_66rpg_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 #============================================================================== # 本脚本来自[url=http://www.66RPG.com]www.66RPG.com[/url],使用和转载请保留此信息 #==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],转载和使用请保留此信息
#===============================================================================
BBS_66RPG_DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹
# 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。
# 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
# for i in 0..3
# if FileTest.exist?("Save#{i+1}.rxdata")
# 请自行把0..3改为0..最大进度号,比如0..9
# "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"
# 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本”
#===============================================================================
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,640,480,file_name,get_window_handle,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 Window_File < Window_Base
attr_accessor :index
def initialize(index = 0)
@backsp = Sprite.new
@backsp.bitmap = Bitmap.new("Graphics/Pictures/存盘背景.jpg")
@backsp.z = 99
super(160,0,480,368)
self.back_opacity = 80
#这行可以不用
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?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
@sprite.visible = true
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
@sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
else
self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
end
@sprite.x = 176
@sprite.y = 16
@sprite.zoom_x = 0.7
@sprite.zoom_y = 0.7
file = File.open(BBS_66RPG_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 [url=mailto:0...@characters.size]0...@characters.size[/url]
@sp_ch[i] = Sprite.new
@sp_ch[i].visible = true
@sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
@sp_ch[i].x = 180 + i* 100
@sp_ch[i].y = 310 - @sp_ch[i].bitmap.height
@sp_ch[i].z = 101
@sp_ch[i].opacity = 80
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(32, 60, 410, 70, time_string, 2)
# 描绘时间标记
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(32, 40, 410, 50, time_string, 2)
case self.index
when $game_temp.last_file_index
self.contents.draw_text(20,20,410,20,"最近的进度")
end
else
self.contents.draw_text(20,20,410,20,"这个进度是空的")
end
end
def dispose
super
@sprite.dispose
@backsp.dispose
for i in @sp_ch
i.dispose
end
end
end
class Scene_Save
def main
@screen = Spriteset_Map.new
@command_window = Window_Command.new(160,["进度一","进度二","进度三","进度四","进度五","进度六"])
@command_window.contents.font.size = 24
@command_window.contents.font.bold = true
@command_window.y = 96
@command_window.index = $game_temp.last_file_index
@command_window.opacity = 0
@command_window.windowskin = nil
@content_window = Window_File.new($game_temp.last_file_index)
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
@screen.dispose
@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)
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new(4)
end
#———————————————————————#
if Input.trigger?(Input::C)
# 演奏存档 SE
$game_system.se_play($data_system.save_se)
# 写入存档数据
file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
write_save_data(file)
if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_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
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 切换到菜单画面
$scene = Scene_Map.new
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.id, actor.battler_name, actor.battler_hue])
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($data_skills, file)
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)
Marshal.dump($pet_array, file)
end
end
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..5
filename = BBS_66RPG_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,["进度一","进度二","进度三","进度四","进度五","进度六"])
for i in 0..5
filename = BBS_66RPG_DIR+"Save#{i}.rxdata"
if !FileTest.exist?(filename)
@command_window.disable_item(i)
end
end
@command_window.contents.font.size = 24
@command_window.contents.font.bold = true
@command_window.y = 96
@command_window.opacity = 0
@command_window.index = $game_temp.last_file_index
@content_window = Window_File.new($game_temp.last_file_index)
@command_window.windowskin = nil
# 执行过渡
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?(BBS_66RPG_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(BBS_66RPG_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)
# 读取各种游戏对像
$data_skills = 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)
$pet_array = 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
class Scene_Menu
alias bbs_66rpg_shotsave_main main
def main
if $menu_save
Screen::shot
$menu_save = false
end
bbs_66rpg_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
#==============================================================================
# 本脚本来自[url=http://www.66RPG.com]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
物品分类
# ———————————————————————————————————— # 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息 # ———————————————————————————————————— #============================================================================== # ■ Harts_Window_ItemTitle #------------------------------------------------------------------------------ # アイテム画面で、タイトルを表示するウィンドウ。 #============================================================================== class Harts_Window_ItemTitle < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1) end end #============================================================================== # ■ Harts_Window_ItemCommand #------------------------------------------------------------------------------ # アイテムの種別選択を行うウィンドウです。 #============================================================================== class Harts_Window_ItemCommand < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 64, 160, 288) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 8 @commands = ["常规物品", "战斗物品", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"] refresh self.index = 0 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 # color : 文字色 #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color y = index * 32 self.contents.draw_text(4, y, 128, 32, @commands[index]) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help case self.index when 0 @text = @commands[0] when 1 @text = @commands[1] when 2 @text = @commands[2] when 3 @text = @commands[3] when 4 @text = @commands[4] when 5 @text = @commands[5] when 6 @text = @commands[6] when 7 @text = @commands[7] end @help_window.set_text(@text) end end #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ # アイテム画面で、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Harts_Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(160, 0, 480, 416) refresh self.index = 0 end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] end #-------------------------------------------------------------------------- # ● アイテム一覧設定 # command : 選択中のコマンド #-------------------------------------------------------------------------- def set_item(command) refresh case command when 0 for i in 1...$data_items.size if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0 @data.push($data_items[i]) end end when 1 for i in 1...$data_items.size if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0) @data.push($data_items[i]) end end when 2 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end when 3 for i in 1...$data_armors.size if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 4 for i in 1...$data_armors.size if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 5 for i in 1...$data_armors.size if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 6 for i in 1...$data_armors.size if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 7 for i in 1...$data_items.size if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0 @data.push($data_items[i]) end end end # 項目数が 0 でなければビットマップを作成し、全項目を描画 @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.clear for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # ● 種類別アイテム数の取得 #-------------------------------------------------------------------------- def item_number return @item_max end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 y = index * 32 bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 400, y, 16, 32, ":", 1) self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #============================================================================== # ■ Harts_Scene_Item #------------------------------------------------------------------------------ # アイテム画面の処理を行うクラスです。再定義 #============================================================================== class Scene_Item #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- include OPACITY_66RPG def main create_screen # タイトルウィンドウを作成 @itemtitle_window = Harts_Window_ItemTitle.new #コマンドウィンドウを作成 @itemcommand_window = Harts_Window_ItemCommand.new @command_index = @itemcommand_window.index #アイテムウィンドウを作成 @itemlist_window = Harts_Window_ItemList.new @itemlist_window.active = false #ヘルプウィンドウを作成 @help_window = Window_Help.new @help_window.x = 0 @help_window.y = 416 # ヘルプウィンドウを関連付け @itemcommand_window.help_window = @help_window @itemlist_window.help_window = @help_window # ターゲットウィンドウを作成 (不可視?非アクティブに設定) @target_window = Window_Target.new @target_window.visible = false @target_window.active = false # アイテムウィンドウ内容表示 @itemlist_window.set_item(@command_index) # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # フレーム更新 update # 画面が切り替わったらループを中断 if $scene != self break end end # トランジション準備 Graphics.freeze # ウィンドウを解放 @itemtitle_window.dispose @itemcommand_window.dispose @itemlist_window.dispose @help_window.dispose @target_window.dispose dispose_screen end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @itemtitle_window.update @itemcommand_window.update @itemlist_window.update @help_window.update @target_window.update if @command_index != @itemcommand_window.index @command_index = @itemcommand_window.index @itemlist_window.set_item(@command_index) end # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ if @itemcommand_window.active update_itemcommand return end # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ if @itemlist_window.active update_itemlist return end # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ if @target_window.active update_target return end end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_itemcommand # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # メニュー画面に切り替え $scene = Scene_Menu.new(0) return end # C ボタンが押された場合 if Input.trigger?(Input::C) # 選択中のコマンドのアイテムがない場合 if @itemlist_window.item_number == 0 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アイテムウィンドウをアクティブにする @itemcommand_window.active = false @itemlist_window.active = true @itemlist_window.index = 0 return end end #-------------------------------------------------------------------------- # ● フレーム更新 (アイテムウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_itemlist # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アイテムウィンドウをアクティブにする @itemcommand_window.active = true @itemlist_window.active = false @itemlist_window.index = 0 @itemcommand_window.index = @command_index return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムウィンドウで現在選択されているデータを取得 @item = @itemlist_window.item # 使用アイテムではない場合 unless @item.is_a?(RPG::Item) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 使用できない場合 unless $game_party.item_can_use?(@item.id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 効果範囲が味方の場合 if @item.scope >= 3 # ターゲットウィンドウをアクティブ化 @itemlist_window.active = false @target_window.x = 304 @target_window.visible = true @target_window.active = true # 効果範囲 (単体/全体) に応じてカーソル位置を設定 if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end # 効果範囲が味方以外の場合 else # コモンイベント ID が有効の場合 if @item.common_event_id > 0 # コモンイベント呼び出し予約 $game_temp.common_event_id = @item.common_event_id # アイテムの使用時 SE を演奏 $game_system.se_play(@item.menu_se) # 消耗品の場合 if @item.consumable # 使用したアイテムを 1 減らす $game_party.lose_item(@item.id, 1) # アイテムウィンドウの項目を再描画 @itemlist_window.draw_item(@itemlist_window.index) end # マップ画面に切り替え $scene = Scene_Map.new return end end return end end #-------------------------------------------------------------------------- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_target # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アイテム切れなどで使用できなくなった場合 unless $game_party.item_can_use?(@item.id) # アイテムウィンドウの内容を再作成 @itemlist_window.refresh end # ターゲットウィンドウを消去 @itemlist_window.active = true @target_window.visible = false @target_window.active = false @itemlist_window.set_item(@command_index) return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムを使い切った場合 if $game_party.item_number(@item.id) == 0 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # ターゲットが全体の場合 if @target_window.index == -1 # パーティ全体にアイテムの使用効果を適用 used = false for i in $game_party.actors used |= i.item_effect(@item) end end # ターゲットが単体の場合 if @target_window.index >= 0 # ターゲットのアクターにアイテムの使用効果を適用 target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end # アイテムを使った場合 if used # アイテムの使用時 SE を演奏 $game_system.se_play(@item.menu_se) # 消耗品の場合 if @item.consumable # 使用したアイテムを 1 減らす $game_party.lose_item(@item.id, 1) # アイテムウィンドウの項目を再描画 @itemlist_window.draw_item(@itemlist_window.index) @itemlist_window.set_item(@command_index) end # ターゲットウィンドウの内容を再作成 @target_window.refresh # 全滅の場合 if $game_party.all_dead? # ゲームオーバー画面に切り替え $scene = Scene_Gameover.new return end # コモンイベント ID が有効の場合 if @item.common_event_id > 0 # コモンイベント呼び出し予約 $game_temp.common_event_id = @item.common_event_id # マップ画面に切り替え $scene = Scene_Map.new return end end # アイテムを使わなかった場合 unless used # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) end return end end end
# ————————————————————————————————————
# 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Harts_Window_ItemTitle
#------------------------------------------------------------------------------
# アイテム画面で、タイトルを表示するウィンドウ。
#==============================================================================
class Harts_Window_ItemTitle < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
end
end
#==============================================================================
# ■ Harts_Window_ItemCommand
#------------------------------------------------------------------------------
# アイテムの種別選択を行うウィンドウです。
#==============================================================================
class Harts_Window_ItemCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 160, 288)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 8
@commands = ["常规物品", "战斗物品", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
y = index * 32
self.contents.draw_text(4, y, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@text = @commands[0]
when 1
@text = @commands[1]
when 2
@text = @commands[2]
when 3
@text = @commands[3]
when 4
@text = @commands[4]
when 5
@text = @commands[5]
when 6
@text = @commands[6]
when 7
@text = @commands[7]
end
@help_window.set_text(@text)
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Harts_Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 416)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
end
#--------------------------------------------------------------------------
# ● アイテム一覧設定
# command : 選択中のコマンド
#--------------------------------------------------------------------------
def set_item(command)
refresh
case command
when 0
for i in 1...$data_items.size
if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
when 1
for i in 1...$data_items.size
if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
@data.push($data_items[i])
end
end
when 2
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
when 3
for i in 1...$data_armors.size
if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 4
for i in 1...$data_armors.size
if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 5
for i in 1...$data_armors.size
if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 6
for i in 1...$data_armors.size
if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 7
for i in 1...$data_items.size
if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 種類別アイテム数の取得
#--------------------------------------------------------------------------
def item_number
return @item_max
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Harts_Scene_Item
#------------------------------------------------------------------------------
# アイテム画面の処理を行うクラスです。再定義
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
include OPACITY_66RPG
def main
create_screen
# タイトルウィンドウを作成
@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作成
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window.index
#アイテムウィンドウを作成
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window.active = false
#ヘルプウィンドウを作成
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = 416
# ヘルプウィンドウを関連付け
@itemcommand_window.help_window = @help_window
@itemlist_window.help_window = @help_window
# ターゲットウィンドウを作成 (不可視?非アクティブに設定)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# アイテムウィンドウ内容表示
@itemlist_window.set_item(@command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@itemtitle_window.dispose
@itemcommand_window.dispose
@itemlist_window.dispose
@help_window.dispose
@target_window.dispose
dispose_screen
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@itemtitle_window.update
@itemcommand_window.update
@itemlist_window.update
@help_window.update
@target_window.update
if @command_index != @itemcommand_window.index
@command_index = @itemcommand_window.index
@itemlist_window.set_item(@command_index)
end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
if @itemcommand_window.active
update_itemcommand
return
end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
if @itemlist_window.active
update_itemlist
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$scene = Scene_Menu.new(0)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 選択中のコマンドのアイテムがない場合
if @itemlist_window.item_number == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = false
@itemlist_window.active = true
@itemlist_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = true
@itemlist_window.active = false
@itemlist_window.index = 0
@itemcommand_window.index = @command_index
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @itemlist_window.item
# 使用アイテムではない場合
unless @item.is_a?(RPG::Item)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 効果範囲が味方の場合
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window.active = false
@target_window.x = 304
@target_window.visible = true
@target_window.active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# 効果範囲が味方以外の場合
else
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
end
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_target
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# アイテムウィンドウの内容を再作成
@itemlist_window.refresh
end
# ターゲットウィンドウを消去
@itemlist_window.active = true
@target_window.visible = false
@target_window.active = false
@itemlist_window.set_item(@command_index)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを使い切った場合
if $game_party.item_number(@item.id) == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットが全体の場合
if @target_window.index == -1
# パーティ全体にアイテムの使用効果を適用
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ターゲットが単体の場合
if @target_window.index >= 0
# ターゲットのアクターにアイテムの使用効果を適用
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# アイテムを使った場合
if used
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
@itemlist_window.set_item(@command_index)
end
# ターゲットウィンドウの内容を再作成
@target_window.refresh
# 全滅の場合
if $game_party.all_dead?
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
|
|