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

Project1

 找回密码
 注册会员
搜索
Project1 查看内容

存档位无限扩展

2005-11-28 00:00| 发布者: 柳柳| 查看: 6389| 评论: 0|原作者: 66RPG

摘要:    作者 SailCat  版本与更新  2005年11月  相关网址 点此进入讨论贴  范例工程   脚本功能 存档位无限扩展。 使用方法 使用方法: 替代系统脚本Scene_File全
 

 作者

SailCat

 版本与更新

 2005年11月

 相关网址

点此进入讨论贴

 范例工程

 



脚本功能

存档位无限扩展。

使用方法

使用方法: 替代系统脚本Scene_File全部内容
冲突可能: 截图存档等其他的存档加强插件

设定: 常量 MaxPages,这个设存档的最大页数,必须是大于1的正数,实际的存档位为设定值的4倍(每页4个存档)
范例里设为 MaxPages = 4,则一共是16个存档,恰好是PS游戏的记忆卡存档数,你可以把它改大,多大都可以....我测试了一下MaxPage = 100的情况,游戏刷新速度没有明显减慢(当然了,我优化了只刷新当前的活动窗口)

操作: 按上下键移动一个存档,按左右或LR键翻页

相关截图


 

 脚本内容

#==============================================================================
# 本脚本来自www.66rpg.com,转载和使用请保留此信息 #==============================================================================

#==============================================================================
# ■ Scene_File
#------------------------------------------------------------------------------
#  存档画面及读档画面的超级类。
#   脚本优化: SailCat
#==============================================================================

class Scene_File
 #--------------------------------------------------------------------------
 # ● 常量 (存档页数)
 #--------------------------------------------------------------------------
 MaxPages = 25
 #--------------------------------------------------------------------------
 # ● 初始化对像
 #     help_text : 帮助窗口显示的字符串
 #--------------------------------------------------------------------------
 def initialize(help_text)
   @help_text = help_text
   @slots = MaxPages * 4
 end
 #--------------------------------------------------------------------------
 # ● 主处理
 #--------------------------------------------------------------------------
 def main
   # 生成帮助窗口
   @help_window = Window_Help.new
   @help_window.set_text(@help_text)
   @file_index = $game_temp.last_file_index
   # 生成存档文件窗口
   @savefile_windows = []
   # 选择最后操作的文件
   for i in @file_index / 4 * 4..@file_index / 4 * 4 + 3
     load_window(i)
     @savefile_windows[i].visible = true
   end
   @savefile_windows[@file_index].selected = true
   # 执行过渡
   Graphics.transition
   # 主循环
   loop do
     # 刷新游戏画面
     Graphics.update
     # 刷新输入信息
     Input.update
     # 刷新画面
     update
     # 如果画面被切换的话就中断循环
     if $scene != self
       break
     end
   end
   # 准备过渡
   Graphics.freeze
   # 释放窗口
   @help_window.dispose
   for i in @savefile_windows
     i.dispose
   end
 end
 #--------------------------------------------------------------------------
 # ● 刷新画面
 #--------------------------------------------------------------------------
 def update
   # 刷新窗口
   @help_window.update
   for i in @savefile_windows
     i.update if i.visible
   end
   # 按下 C 键的情况下
   if Input.trigger?(Input::C)
     # 调用过程 on_decision (定义继承目标)
     on_decision(make_filename(@file_index))
     $game_temp.last_file_index = @file_index
     return
   end
   # 按下 B 键的情况下
   if Input.trigger?(Input::B)
     # 调用过程 on_cancel (定义继承目标)
     on_cancel
     return
   end
   # 按下方向键下的情况下
   if Input.repeat?(Input::DOWN)
     # 演奏光标 SE
     $game_system.se_play($data_system.cursor_se)
     # 光标向下移动
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + 1) % @slots
     # 翻到下一页的情况下
     if @file_index % 4 == 0
       for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3
         @savefile_windows[(index + @slots - 4) % @slots].visible = false
         load_window(index)
         @savefile_windows[index].visible = true
       end
     end
     @savefile_windows[@file_index].selected = true
     return
   end
   # 按下方向键上的情况下
   if Input.repeat?(Input::UP)
     # 演奏光标 SE
     $game_system.se_play($data_system.cursor_se)
     # 光标向上移动
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + @slots - 1) % @slots
     # 翻到上一页的情况下
     if @file_index % 4 == 3
       for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3
         @savefile_windows[(index + 4) % @slots].visible = false
         load_window(index)
         @savefile_windows[index].visible = true
       end
     end
     @savefile_windows[@file_index].selected = true
     return
   end
   # 按下方向键左或者 L 的情况下
   if Input.repeat?(Input::LEFT) or Input.trigger?(Input::L)
     # 演奏光标 SE
     $game_system.se_play($data_system.cursor_se)
     # 前翻一页
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + @slots - 4) % @slots
     for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3
       @savefile_windows[(index + 4) % @slots].visible = false
       load_window(index)
       @savefile_windows[index].visible = true
     end
     @savefile_windows[@file_index].selected = true
     return
   end
   # 按下方向键右或者 R 的情况下
   if Input.repeat?(Input::RIGHT) or Input.trigger?(Input::R)
     # 演奏光标 SE
     $game_system.se_play($data_system.cursor_se)
     # 前翻一页
     @savefile_windows[@file_index].selected = false
     @file_index = (@file_index + 4) % @slots
     for index in @file_index / 4 * 4..@file_index / 4 * 4 + 3
       @savefile_windows[(index + @slots - 4) % @slots].visible = false
       load_window(index)
       @savefile_windows[index].visible = true
     end
     @savefile_windows[@file_index].selected = true
     return
   end
 end
 #--------------------------------------------------------------------------
 # ● 生成文件名
 #     file_index : 文件名的索引 (0~n)
 #--------------------------------------------------------------------------
 def make_filename(file_index)
   return "Save#{file_index + 1}.rxdata"
 end
 #--------------------------------------------------------------------------
 # ● 载入当前页存档
 #     避免因存档位过多造成的卡壳现象
 #--------------------------------------------------------------------------
 def load_window(i)
   if @savefile_windows[i] != nil
     return
   else
     @savefile_windows[i] = Window_SaveFile.new(i, make_filename(i))
   end
 end
end

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================


 

脚本使用的通用说明

约定:本脚本来源于网络,任何人不得随意将本脚本应用于商业用途,如需转载,必须保留所有版权信息,如果是国内作者,最好征求作者同意——否则发生任何后果,66RPG不予负责。使用此脚本表示您默认接受上述约定。

说明:不同脚本之间、尤其是不同作者脚本之间会有冲突,本站会对已知脚本冲突进行简单说明。测试新脚本请下载本站提供的测试文件或者新建工程测试。脚本不要贪多,否则可能会互相冲突对您的游戏造成未知的影响。如果脚本内或者本站内提供了解释,请务必完全看完解释后再使用,如有问题,请到论坛讨论。


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

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

GMT+8, 2024-5-6 05:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部