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

Project1

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

[已经过期] 截图存档脚本和图片标题菜单脚本的冲突问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
94
在线时间
157 小时
注册时间
2006-7-2
帖子
299
跳转到指定楼层
1
发表于 2014-8-27 15:08:56 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 gkl0510 于 2014-8-27 15:11 编辑

前两天下了一个截图存档的脚本,根据脚本里的要求对于scene menu脚本里的已经做了修改
存档读档都没有问题,

如果进入了存读档界面按esc退出就会报错


(进入游戏后退出存读档界面不会报错,在标题菜单里会报错
怀疑是我用了图片标题菜单脚本冲突了。)

由于是脚本盲,完全一头雾水,还望解救

截图存档脚本
RUBY 代码复制
  1. ###使用说明
  2. #使用前请复制sceneshot.dll到游戏文件下,并新建文件夹Save
  3. #将此文本插入main前面
  4. #游戏前显示头像的文件名为:人物角色名_f,请自行建立几张做测试,不然找不到图片会报错
  5. #自动存档按钮F5 存入档位0(也就是自动存档那栏)
  6. #使用前,请在菜单脚本:scene_menu里面,
  7. #     when 4 # 存档
  8. #     # 禁止存档的情况下
  9. #     if $game_system.save_disabled
  10. #       # 演奏冻结 SE
  11. #       $game_system.se_play($data_system.buzzer_se)
  12. #       return
  13. #     end
  14. #     # 演奏确定 SE
  15. #     $game_system.se_play($data_system.decision_se)
  16. #     # 切换到存档画面
  17. #     $scene = Scene_Save.new <--这行
  18. #替换为:   $scene = Scene_Loadsave.new
  19. #另,在原scene_title里,48行左右
  20. #    for i in 0..3
  21. #          for i in 0..3
  22. #     if FileTest.exist?("Save#{i+1}.rxdata")
  23. ###################改成if FileTest.exist?("Save/Save#{i+1}.rxdata")
  24. #        @continue_enabled = true
  25. #      end
  26. #    end
  27. #否则继续游戏时会检测不到存档
  28.  
  29. class Window_File < Window_Base
  30. attr_accessor :index
  31. def initialize(index = 0)
  32.    @backsp = Sprite.new
  33.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  34.    @backsp.z = 100
  35.    super(160,64,480,416)
  36.    #这行可以不用
  37.    self.contents = Bitmap.new(width - 32, height - 32)
  38.    #去框##
  39.    self.opacity=0
  40.    ##
  41.    @index = index
  42.    #这里我要说明一句,之所以用sprite是为了放缩图片
  43.    @sprite = Sprite.new
  44.    @sprite.visible = false
  45.    @sprite.z = 100
  46.    @sp_ch = []
  47.    @sp_ch[0] = Sprite.new
  48.    refresh
  49. end
  50. def refresh
  51.    self.contents.clear
  52.    for i in @sp_ch
  53.      i.visible = false
  54.    end
  55.    @sprite.visible = false
  56.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  57.      @sprite.visible = true
  58.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  59.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  60.      else
  61.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  62.      end
  63.      @sprite.x = 206
  64.      @sprite.y = 94
  65.      @sprite.zoom_x = 0.6
  66.      @sprite.zoom_y = 0.6
  67.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  68.      @time_stamp = file.mtime
  69.      @characters = Marshal.load(file)
  70.      @frame_count = Marshal.load(file)
  71.      @game_system = Marshal.load(file)
  72.      @game_switches = Marshal.load(file)
  73.      @game_variables = Marshal.load(file)
  74.      @total_sec = @frame_count / Graphics.frame_rate
  75.      file.close
  76.      for i in [email]0...@characters.size[/email]
  77.        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  78.        cw = bitmap.rect.width / 4
  79.        ch = bitmap.rect.height / 4
  80.        src_rect = Rect.new(0, 0, cw, ch)
  81.        x = i*100
  82.        y = 320
  83.        self.contents.blt(x, y, bitmap, src_rect)
  84.      end
  85.      # 描绘游戏时间
  86.      hour = @total_sec / 60 / 60
  87.      min = @total_sec / 60 % 60
  88.      sec = @total_sec % 60
  89.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  90.      self.contents.font.color = normal_color
  91.      self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  92.      # 描绘时间标记
  93.      self.contents.font.color = normal_color
  94.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  95.      self.contents.draw_text(4, 346, 420, 32, time_string, 2)###356
  96.    else
  97.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  98.    end
  99.  
  100. end
  101. def dispose
  102.    super
  103.    @sprite.dispose
  104.    @backsp.dispose
  105.    for i in @sp_ch
  106.      i.dispose
  107.    end
  108. end
  109. end
  110.  
  111.  
  112. class Window_File2 < Window_Base
  113. attr_accessor :index
  114. def initialize(index = 0)
  115.    @backsp = Sprite.new
  116.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  117.    @backsp.z = 100
  118.    super(160,0,480,480)
  119.    #这行可以不用
  120.    self.contents = Bitmap.new(width - 32, height - 32)
  121.    #去框##
  122.    self.opacity=0
  123.    ##
  124.    @index = index
  125.    #这里我要说明一句,之所以用sprite是为了放缩图片
  126.    @sprite = Sprite.new
  127.    @sprite.visible = false
  128.    @sprite.z = 100
  129.    @sp_ch = []
  130.    @sp_ch[0] = Sprite.new
  131.    refresh
  132. end
  133. def refresh
  134.    self.contents.clear
  135.    for i in @sp_ch
  136.      i.visible = false
  137.    end
  138.    @sprite.visible = false
  139.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  140.      @sprite.visible = true
  141.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  142.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  143.      else
  144.        self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  145.      end
  146.      @sprite.x = 176
  147.      @sprite.y = 30
  148.      @sprite.zoom_x = 0.7
  149.      @sprite.zoom_y = 0.7
  150.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  151.      @time_stamp = file.mtime
  152.      @characters = Marshal.load(file)
  153.      @frame_count = Marshal.load(file)
  154.      @game_system = Marshal.load(file)
  155.      @game_switches = Marshal.load(file)
  156.      @game_variables = Marshal.load(file)
  157.      @total_sec = @frame_count / Graphics.frame_rate
  158.      file.close
  159.      for i in [email]0...@characters.size[/email]
  160.        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  161.        cw = bitmap.rect.width / 4
  162.        ch = bitmap.rect.height / 4
  163.        src_rect = Rect.new(0, 0, cw, ch)
  164.        x = i*100
  165.        self.contents.blt(x, 440 - ch, bitmap, src_rect)
  166.      end
  167.      # 描绘游戏时间
  168.      hour = @total_sec / 60 / 60
  169.      min = @total_sec / 60 % 60
  170.      sec = @total_sec % 60
  171.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  172.      self.contents.font.color = normal_color
  173.      self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  174.      # 描绘时间标记
  175.      self.contents.font.color = normal_color
  176.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  177.      self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  178.    else
  179.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  180.    end
  181.  
  182. end
  183. def dispose
  184.    super
  185.    @sprite.dispose
  186.    @backsp.dispose
  187.    for i in @sp_ch
  188.      i.dispose
  189.    end
  190. end
  191. end
  192.  
  193.  
  194.  
  195. $打开自动存档用的开关编号 = 999
  196. $自动存档位置 = 1
  197. $按下F5之后的自动存档的音效 = "Audio/SE/存档"
  198. $按下F5之后禁止存档时候的音效 = "Audio/Se/错误"
  199. DIR = "Save/"
  200. $打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
  201. $按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
  202. $按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
  203. class Scene_Map
  204. alias auto_update update
  205. def update
  206. auto_update
  207. #——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
  208. #——注意在不可存档的时候是无效的
  209. if Input.trigger?(Input::F5)
  210.   unless $game_system.map_interpreter.running?
  211.   if $game_system.save_disabled
  212.     Audio.se_play($按下F5之后禁止存档时候的音效)
  213.     $game_temp.common_event_id = $按下F5之后禁止存档调用的公共事件
  214.   else
  215.     Audio.se_play($按下F5之后的自动存档的音效)
  216.     $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
  217.     auto_save
  218.   end
  219.   end
  220. end
  221. #——当BOSS战之前打开一下定义的开关,即可自动存档
  222. if $game_switches[$打开自动存档用的开关编号] == true
  223.   $game_switches[$打开自动存档用的开关编号] = false
  224.   $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  225.   auto_save
  226. end
  227. end
  228. def auto_save
  229. #——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
  230. # 写入存档数据
  231. Screen::shot
  232.     file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
  233.     auto_save_data(file)
  234.     if FileTest.exist?( DIR+"shot.jpg")
  235.       File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
  236.     end
  237.     file.close
  238. end
  239. def auto_save_data(file)
  240. #——以下定义内容和Scene_Save的write_save_data(file)完全一样
  241. #——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
  242. # 生成描绘存档文件用的角色图形
  243. characters = []
  244. for i in 0...$game_party.actors.size
  245.   actor = $game_party.actors[i]
  246.   characters.push([actor.character_name, actor.character_hue, actor])
  247. end
  248. # 写入描绘存档文件用的角色数据
  249. Marshal.dump(characters, file)
  250. # 写入测量游戏时间用画面计数
  251. Marshal.dump(Graphics.frame_count, file)
  252. # 增加 1 次存档次数
  253. $game_system.save_count += 1
  254. # 保存魔法编号
  255. # (将编辑器保存的值以随机值替换)
  256. $game_system.magic_number = $data_system.magic_number
  257. # 写入各种游戏对像
  258. Marshal.dump($game_system, file)
  259. Marshal.dump($game_switches, file)
  260. Marshal.dump($game_variables, file)
  261. Marshal.dump($game_self_switches, file)
  262. Marshal.dump($game_screen, file)
  263. Marshal.dump($game_actors, file)
  264. Marshal.dump($game_party, file)
  265. Marshal.dump($game_troop, file)
  266. Marshal.dump($game_map, file)
  267. Marshal.dump($game_player, file)
  268. end
  269. end
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277. DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹
  278.  
  279.  
  280. module Screen  
  281. @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  282. @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l
  283.  
  284. p), 'l'
  285. @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  286. module_function
  287. def shot(file = "shot", typ = 1)
  288.    # to add the right extension...
  289.    if typ == 0
  290.      typname = ".bmp"
  291.    elsif typ == 1
  292.      typname = ".jpg"
  293.    elsif typ == 2
  294.      typname = ".png"
  295.    end   
  296.    file_index = 0   
  297.    dir = "Save/"   
  298.    # make the filename....
  299.    file_name = dir + file.to_s + typname.to_s   
  300.    # make the screenshot.... Attention dont change anything from here on....
  301.    @screen.call(0,0,640,480,file_name,handel,typ)
  302. end
  303. # find the game window...
  304. def handel
  305.    game_name = "\0" * 256
  306.    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  307.    game_name.delete!("\0")
  308.    return @findwindow.call('RGSS Player',game_name)
  309. end
  310. end
  311.  
  312.  
  313. class Scene_Menu
  314. alias shotsave_main main
  315. def main
  316.    if @menu_index == 0
  317.      Screen::shot
  318.    end   
  319.    shotsave_main
  320. end
  321. end
  322.  
  323. class Interpreter
  324. #--------------------------------------------------------------------------
  325. # ● 调用存档画面
  326. #--------------------------------------------------------------------------
  327. def command_352
  328.    # 设置战斗中断标志
  329.    $game_temp.battle_abort = true
  330.    # 设置调用存档标志
  331.    $game_temp.save_calling = true
  332.    # 推进索引
  333.    @index += 1
  334.    # 结束
  335.    Screen::shot
  336.    return false
  337. end
  338. end
  339.  
  340. #==============================================================================
  341. # ■ Scene_Load
  342. #------------------------------------------------------------------------------
  343. #  处理读档画面的类。
  344. #==============================================================================
  345.  
  346. class Scene_Load
  347. #--------------------------------------------------------------------------
  348. # ● 初始化对像
  349. #--------------------------------------------------------------------------
  350. def initialize
  351.    # 再生成临时对像
  352.    $game_temp = Game_Temp.new
  353.    # 选择存档时间最新的文件
  354.    $game_temp.last_file_index = 0
  355.    latest_time = Time.at(0)
  356.    for i in 0..51
  357.      filename = DIR+"Save#{i}.rxdata"
  358.      if FileTest.exist?(filename)
  359.        file = File.open(filename, "r")
  360.        if file.mtime > latest_time
  361.          latest_time = file.mtime
  362.          $game_temp.last_file_index = i
  363.        end
  364.        file.close
  365.      end
  366.    end
  367. end  
  368. def main
  369.    #生成背景#
  370.    ##生成菜单背景##
  371.     @dff_save= Sprite.new
  372.     @dff_save.bitmap = Bitmap.new("Graphics/Pictures/System/load")
  373.    ##
  374.    @command_window = Window_Command.new(160,["  自动存档","  快速存档","  进度二",
  375.    "  进度三","  进度四","  进度五","  进度六","  进度七","  进度八","  进度九","  进度十",
  376.    "  进度十一","  进度十二","  进度十三","  进度十四","  进度十五","  进度十六",
  377.    "  进度十七","  进度十八","  进度十九","  进度二十","  进度二一","  进度二二",
  378.    "  进度二三","  进度二四","  进度二五","  进度二六","  进度二七","  进度二八",
  379.    "  进度二九","  进度三十"])
  380.    @command_window.y = 1
  381.    @command_window.height = 480
  382.    @command_window.index = $game_temp.last_file_index
  383.    @content_window = Window_File2.new($game_temp.last_file_index)
  384.    #去框##
  385.    @command_window.opacity = 0
  386.    ##   
  387.    # 执行过渡
  388.    Graphics.transition
  389.    # 主循环
  390.    loop do
  391.      # 刷新游戏画面
  392.      Graphics.update
  393.      # 刷新输入信息
  394.      Input.update
  395.      # 刷新画面
  396.      update
  397.      # 如果画面被切换的话就中断循环
  398.      if $scene != self
  399.        break
  400.      end
  401.    end
  402.    # 准备过渡
  403.    Graphics.freeze
  404.    @command_window.dispose
  405.    @content_window.dispose
  406.    @dff_save.dispose
  407.    @dff_save.bitmap.dispose
  408. end
  409. def update
  410.    @command_window.update
  411.    if @command_window.index != @content_window.index
  412.      @content_window.index = @command_window.index
  413.      @content_window.refresh
  414.    end   
  415.    #——————下面这一部分是原装脚本——————#
  416.    if Input.trigger?(Input::B)  
  417.    # 演奏取消 SE
  418.    $game_system.se_play($data_system.cancel_se)
  419.    # 切换到标题画面
  420.    #####$scene = Scene_Title.new
  421.    $scene = Scene_Map.new
  422.    end   
  423.    #———————————————————————#   
  424.    if Input.trigger?(Input::C)
  425.      # 文件不存在的情况下
  426.      unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  427.        # 演奏冻结 SE
  428.        $game_system.se_play($data_system.buzzer_se)
  429.        return
  430.      end
  431.      # 演奏读档 SE
  432.      $game_system.se_play($data_system.load_se)
  433.      # 写入存档数据
  434.      file = File.open(DIR+"Save#{@command_window.index}.rxdata", "rb")
  435.      read_save_data(file)
  436.      file.close
  437.      # 还原 BGM、BGS
  438.      $game_system.bgm_play($game_system.playing_bgm)
  439.      $game_system.bgs_play($game_system.playing_bgs)
  440.      # 刷新地图 (执行并行事件)
  441.      $game_map.update
  442.      # 切换到地图画面
  443.      $scene = Scene_Map.new
  444.    end
  445.    #———————————————————————#
  446. end
  447. #--------------------------------------------------------------------------
  448. # ● 写入存档数据
  449. #     file : 写入用文件对像 (已经打开)
  450. #--------------------------------------------------------------------------
  451. def read_save_data(file)
  452.    # 读取描绘存档文件用的角色数据
  453.    characters = Marshal.load(file)
  454.    # 读取测量游戏时间用画面计数
  455.    Graphics.frame_count = Marshal.load(file)
  456.    # 读取各种游戏对像
  457.    $game_system        = Marshal.load(file)
  458.    $game_switches      = Marshal.load(file)
  459.    $game_variables     = Marshal.load(file)
  460.    $game_self_switches = Marshal.load(file)
  461.    $game_screen        = Marshal.load(file)
  462.    $game_actors        = Marshal.load(file)
  463.    $game_party         = Marshal.load(file)
  464.    $game_troop         = Marshal.load(file)
  465.    $game_map           = Marshal.load(file)
  466.    $game_player        = Marshal.load(file)
  467.    # 魔法编号与保存时有差异的情况下
  468.    # (加入编辑器的编辑过的数据)
  469.    if $game_system.magic_number != $data_system.magic_number
  470.      # 重新装载地图
  471.      $game_map.setup($game_map.map_id)
  472.      $game_player.center($game_player.x, $game_player.y)
  473.    end
  474.    # 刷新同伴成员
  475.    $game_party.refresh
  476. end
  477. end
  478.  
  479. #==============================================================================
  480. #  Window_LoadCommand
  481. #------------------------------------------------------------------------------
  482. #  存取档画面选择按钮窗口
  483. #==============================================================================
  484.  
  485. class Window_LoadCommand < Window_Selectable
  486. #--------------------------------------------------------------------------
  487. #  初始化对象
  488. #--------------------------------------------------------------------------
  489. def initialize
  490. super(320, 0, 320, 64)
  491. self.contents = Bitmap.new(width - 32, height - 32)
  492. self.contents.font.color = normal_color
  493. #去框#
  494. self.opacity=0
  495. ##
  496. @item_max = 2
  497. @column_max = 2
  498. @commands = ["存储", "读取"]
  499. refresh
  500. self.index = 0
  501. end
  502. #--------------------------------------------------------------------------
  503. #  刷新
  504. #--------------------------------------------------------------------------
  505. def refresh
  506. self.contents.clear
  507. for i in 0...@item_max
  508.    draw_item(i)
  509. end
  510. end
  511. #--------------------------------------------------------------------------
  512. #  描画按钮文字
  513. #--------------------------------------------------------------------------
  514. def draw_item(index)
  515. x = 4 + index * 160
  516. self.contents.draw_text(x, 0, 144, 32, @commands[index])
  517. end
  518. #--------------------------------------------------------------------------
  519. # ● 项目无效化
  520. #     index : 项目编号
  521. #--------------------------------------------------------------------------
  522. def disable_item(index)
  523.    draw_item(index, disabled_color)
  524. end
  525.  
  526. end
  527.  
  528. #==============================================================================
  529. #  Scene_Loadsave
  530. #------------------------------------------------------------------------------
  531. # 处理存取档画面的类。
  532. #==============================================================================
  533.  
  534. class Scene_Loadsave
  535. #--------------------------------------------------------------------------
  536. # ● 初始化对像
  537. #     $last_savefile_index : 记录光标位置
  538. #--------------------------------------------------------------------------
  539. def initialize
  540.    $last_savefile_index = 0 if $last_savefile_index == nil
  541.    # 再生成临时对像
  542.    $game_temp = Game_Temp.new
  543.    # 选择存档时间最新的文件
  544.    $game_temp.last_file_index = 0
  545.    latest_time = Time.at(0)
  546.    for i in 0..51
  547.      filename =  DIR+"Save#{i}.rxdata"
  548.      if FileTest.exist?(filename)
  549.        file = File.open(filename, "r")
  550.        if file.mtime > latest_time
  551.          latest_time = file.mtime
  552.          $game_temp.last_file_index = i
  553.        end
  554.        file.close
  555.      end
  556.    end
  557. end
  558. #--------------------------------------------------------------------------
  559. #  主处理
  560. #--------------------------------------------------------------------------
  561. def main         
  562.    ##生成菜单背景##
  563.     @dff_save= Sprite.new
  564.     @dff_save.bitmap = Bitmap.new("Graphics/Pictures/System/saveload")
  565.    ##
  566.    @savestate = 0
  567.    # 生成窗口
  568.    @help_window = Window_LoadHelp.new
  569.    @help_window.set_text("请选择.")
  570.    @option_window = Window_LoadCommand.new
  571.    @option_window.index = $last_savefile_index
  572.    ########################################################
  573.    @command_window = Window_Command.new(160,["  自动存档","  快速存档","   进度二",
  574.    "   进度三","   进度四","   进度五","   进度六","   进度七","   进度八","   进度九","   进度十",
  575.    "  进度十一","  进度十二","  进度十三","  进度十四","  进度十五","  进度十六",
  576.    "  进度十七","  进度十八","  进度十九","  进度二十","  进度二一","  进度二二",
  577.    "  进度二三","  进度二四","  进度二五","  进度二六","  进度二七","  进度二八",
  578.    "  进度二九","  进度三十"])
  579.      @command_window.y = 64
  580.      @command_window.height = 378
  581.      @command_window.index = $game_temp.last_file_index
  582.      @content_window = Window_File.new($game_temp.last_file_index)
  583.      @command_window.active = false
  584.      #去框##
  585.      @command_window.opacity = 0
  586.      ##
  587.      ###############覆盖存档
  588.        @confirm_window = Window_Base.new(120, 188, 400, 64)
  589.        @confirm_window.contents = Bitmap.new(368, 32)
  590.  
  591.        @confirm_window.contents.font.color = Color.new(255,255,255,255)
  592.  
  593.        string = "确定要覆盖这个进度吗?"
  594.        @confirm_window.contents.font.name = "黑体"
  595.        @confirm_window.contents.font.size = 24
  596.        @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  597.        @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  598.        @confirm_window.z = 1500
  599.        @yes_no_window.index = 1
  600.        @yes_no_window.x = 270
  601.        @yes_no_window.y = 252
  602.        @yes_no_window.z = 1500
  603.        @confirm_window.visible = false
  604.        @yes_no_window.visible = false
  605.        @yes_no_window.active = false
  606.  
  607.    # 执行过渡
  608.    Graphics.transition
  609.    # 主循环
  610.    loop do
  611.      # 刷新游戏画面
  612.      Graphics.update
  613.      # 刷新输入信息
  614.      Input.update
  615.      # 刷新画面
  616.      update
  617.      # 如果画面被切换的话就中断循环
  618.      if $scene != self
  619.        break
  620.      end
  621.    end
  622.    # 准备过渡
  623.    Graphics.freeze
  624.    # 释放窗口
  625.    @command_window.dispose
  626.    @content_window.dispose
  627.    @confirm_window.dispose
  628.    @yes_no_window.dispose
  629.    @help_window.dispose
  630.    @option_window.dispose
  631.    @dff_save.dispose
  632.    @dff_save.bitmap.dispose
  633. end
  634.  
  635. #--------------------------------------------------------------------------
  636. #  ● 刷新画面
  637. #--------------------------------------------------------------------------
  638. def update
  639.    # 刷新窗口
  640.    @help_window.update
  641.    @option_window.update
  642. #   @content_window.update
  643.    @command_window.update
  644.    if @yes_no_window.active
  645.        confirm_update
  646.        return
  647.    end
  648.    @content_window.index = @command_window.index
  649.    @content_window.refresh
  650.    case @savestate
  651.    when 0
  652.        if Input.trigger?(Input::B)
  653.        $game_system.se_play($data_system.cancel_se)
  654.        # 返回地图
  655.        if $menu_call == false
  656.        # 切换到地图画面
  657.        $scene = Scene_Map.new
  658.          return
  659.        end
  660.        # 切换到菜单画面
  661.        $menu_call = false
  662.        $scene = Scene_Menu.new(5)
  663.     end
  664.      if Input.trigger?(Input::C)
  665.        case @option_window.index
  666.        when 1
  667.          @command_window.active = true
  668.          @option_window.active = false
  669.          $game_system.se_play($data_system.decision_se)
  670.          @help_window.set_text("请选择一个文件进行读取.")
  671.          @savestate  = 1
  672.          return
  673.        when 0
  674.  
  675.          @command_window.active = true
  676.          @option_window.active = false
  677.          $game_system.se_play($data_system.decision_se)
  678.          @help_window.set_text("请选择一个文件进行存储.")
  679.          @savestate = 2
  680.  
  681.          return
  682.        return
  683.        end
  684.      end
  685.    when 1,2
  686.      if Input.trigger?(Input::C)
  687.        if @savestate == 1
  688.          $menu_call = false
  689.          load_file
  690.          return
  691.        else
  692.          # 禁止存档的情况下
  693.          if $game_system.save_disabled
  694.            @help_window.set_text("抱歉,这里禁止存储.")
  695.            # 演奏冻结 SE
  696.            $game_system.se_play($data_system.buzzer_se)
  697.            return
  698.          end
  699.         $game_system.se_play($data_system.decision_se)
  700.         $last_savefile_index = @option_window.index
  701.  
  702.         save_file
  703.          return
  704.        end
  705.      end
  706.      # 取消
  707.      if Input.trigger?(Input::B)
  708.        $game_system.se_play($data_system.cancel_se)
  709.        @command_window.active = false
  710.        @help_window.set_text("请选择.")
  711.        @savestate = 0
  712.        @option_window.active = true
  713.        return
  714.      end
  715.  
  716.      if Input.trigger?(Input::B)
  717.        $game_system.se_play($data_system.cancel_se)
  718.        @savestate = 2
  719.        @command_window.active = true
  720.  
  721.        return
  722.      end
  723.    end
  724. end
  725. #--------------------------------------------------------------------------
  726. # 建立记录文件索引
  727. #--------------------------------------------------------------------------
  728.  
  729. #--------------------------------------------------------------------------
  730. #  读取记录文件
  731. #     filename  : 被读取文件
  732. #--------------------------------------------------------------------------
  733. def load_file
  734.      # 文件不存在的情况下
  735.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  736.        # 演奏冻结 SE
  737.        $game_system.se_play($data_system.buzzer_se)
  738.        return
  739.      end
  740.      # 演奏读档 SE
  741.      $game_system.se_play($data_system.load_se)
  742.      # 写入存档数据
  743.      file = File.open( DIR+"Save#{@command_window.index}.rxdata", "rb")
  744.      read_save_data(file)
  745.      file.close
  746.      # 还原 BGM、BGS
  747.      $game_system.bgm_play($game_system.playing_bgm)
  748.      $game_system.bgs_play($game_system.playing_bgs)
  749.      # 刷新地图 (执行并行事件)
  750.      $game_map.update
  751.      # 切换到地图画面
  752.      $scene = Scene_Map.new
  753. end
  754. #--------------------------------------------------------------------------
  755. # ● 读取存档数据
  756. #     file : 读取用文件对像 (已经打开)
  757. #--------------------------------------------------------------------------
  758. def read_save_data(file)
  759.    # 读取描绘存档文件用的角色数据
  760.    characters = Marshal.load(file)
  761.    # 读取测量游戏时间用画面计数
  762.    Graphics.frame_count = Marshal.load(file)
  763.    # 读取各种游戏对像
  764.    $game_system        = Marshal.load(file)
  765.    $game_switches      = Marshal.load(file)
  766.    $game_variables     = Marshal.load(file)
  767.    $game_self_switches = Marshal.load(file)
  768.    $game_screen        = Marshal.load(file)
  769.    $game_actors        = Marshal.load(file)
  770.    $game_party         = Marshal.load(file)
  771.    $game_troop         = Marshal.load(file)
  772.    $game_map           = Marshal.load(file)
  773.    $game_player        = Marshal.load(file)
  774.    # 魔法编号与保存时有差异的情况下
  775.    # (加入编辑器的编辑过的数据)
  776.    if $game_system.magic_number != $data_system.magic_number
  777.      # 重新装载地图
  778.      $game_map.setup($game_map.map_id)
  779.      $game_player.center($game_player.x, $game_player.y)
  780.    end
  781.    # 刷新同伴成员
  782.    $game_party.refresh
  783. end
  784. #--------------------------------------------------------------------------
  785. # ● 写入存档文件
  786. #--------------------------------------------------------------------------
  787. def save_file
  788.    if Input.trigger?(Input::C)
  789.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  790.        # 演奏冻结 SE
  791.        # 演奏存档 SE
  792.          $game_system.se_play($data_system.save_se)
  793.          # 写入存档数据
  794.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  795.          write_save_data(file)
  796.          if FileTest.exist?( DIR+"shot.jpg")
  797.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  798.          end
  799.          file.close
  800.          $game_temp.last_file_index = @command_window.index
  801.          # 如果被事件调用
  802.          if $game_temp.save_calling
  803.            # 清除存档调用标志
  804.            $game_temp.save_calling = false
  805.            @confirm_window.dispose
  806.            # 切换到地图画面
  807.            $scene = Scene_Map.new   
  808.            return
  809.          end
  810.        # 切换到菜单画面
  811.          $scene = Scene_Menu.new(5)
  812.      end
  813.      @yes_no_window.active = true
  814.      @command_window.active = false            
  815.    end
  816.    #———————————————————————#     
  817. end
  818. #-------------------------------------------------------------------
  819. def confirm_update
  820.    @command_index = @command_window.index
  821.    @confirm_window.visible = true
  822.    @confirm_window.z = 1500
  823.    @yes_no_window.visible = true
  824.    @yes_no_window.active = true
  825.    @yes_no_window.z = 1500
  826.    @yes_no_window.update
  827.    if Input.trigger?(Input::C)
  828.      if @yes_no_window.index == 0
  829.          #######################################################
  830.          # 演奏存档 SE
  831.          $game_system.se_play($data_system.save_se)
  832.          # 写入存档数据
  833.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  834.          write_save_data(file)
  835.          if FileTest.exist?( DIR+"shot.jpg")
  836.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  837.          end
  838.          file.close
  839.          $game_temp.last_file_index = @command_window.index
  840.          # 如果被事件调用
  841.          if $game_temp.save_calling
  842.            # 清除存档调用标志
  843.            $game_temp.save_calling = false
  844.            @confirm_window.dispose
  845.            @content_window.dispose
  846.            # 切换到地图画面
  847.            $scene = Scene_Map.new
  848.            return
  849.          end
  850.        # 切换到菜单画面
  851.          $scene = Scene_Menu.new(5)      
  852.        else
  853.        @yes_no_window.visible = false
  854.        @confirm_window.visible = false
  855.        $game_system.se_play($data_system.cancel_se)
  856.        @yes_no_window.active = false
  857.        @command_window.active = true
  858.        end
  859.    end
  860.    if Input.trigger?(Input::B)
  861.      @yes_no_window.visible = false
  862.      @confirm_window.visible = false
  863.      $game_system.se_play($data_system.cancel_se)
  864.      @yes_no_window.active = false
  865.      @command_window.active = true
  866.    end
  867. end
  868. #--------------------------------------------------------------------------
  869. # ● 写入存档数据
  870. #     file : 写入用文件对像 (已经打开)
  871. #--------------------------------------------------------------------------
  872. def write_save_data(file)
  873.    # 生成描绘存档文件用的角色图形
  874.    characters = []
  875.    for i in 0...$game_party.actors.size
  876.      actor = $game_party.actors[i]
  877.      characters.push([actor.character_name, actor.character_hue, actor])
  878.    end
  879.    # 写入描绘存档文件用的角色数据
  880.    Marshal.dump(characters, file)
  881.    # 写入测量游戏时间用画面计数
  882.    Marshal.dump(Graphics.frame_count, file)
  883.    # 增加 1 次存档次数
  884.    $game_system.save_count += 1
  885.    # 保存魔法编号
  886.    # (将编辑器保存的值以随机值替换)
  887.    $game_system.magic_number = $data_system.magic_number
  888.    # 写入各种游戏对像
  889.    Marshal.dump($game_system, file)
  890.    Marshal.dump($game_switches, file)
  891.    Marshal.dump($game_variables, file)
  892.    Marshal.dump($game_self_switches, file)
  893.    Marshal.dump($game_screen, file)
  894.    Marshal.dump($game_actors, file)
  895.    Marshal.dump($game_party, file)
  896.    Marshal.dump($game_troop, file)
  897.    Marshal.dump($game_map, file)
  898.    Marshal.dump($game_player, file)
  899. end
  900. end
  901.  
  902. #==============================================================================
  903. # ■ Window_LoadHelp
  904. #------------------------------------------------------------------------------
  905. #  存取档画面帮助信息的显示窗口。
  906. #==============================================================================
  907.  
  908. class Window_LoadHelp < Window_Base
  909. #--------------------------------------------------------------------------
  910. #  初始化对象
  911. #--------------------------------------------------------------------------
  912. def initialize
  913. super(0, 0, 320, 64)
  914. self.contents = Bitmap.new(width - 32, height - 32)
  915. #去框#
  916. self.opacity=0
  917. ##
  918. end
  919. #--------------------------------------------------------------------------
  920. #  刷新文本
  921. #--------------------------------------------------------------------------
  922. def set_text(text, align = 1)
  923. if text != @text or align != @align
  924.    self.contents.clear
  925.    self.contents.font.color = normal_color
  926.    self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  927.    @text = text
  928.    @align = align
  929.    @actor = nil
  930. end
  931. self.visible = true
  932. end
  933. end




图片标题菜单脚本
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ 图片标题菜单1.0
  6. # Scene_Title
  7. #------------------------------------------------------------------------------
  8. # 作者:chaochao
  9. # [url]http://zhuchao.go1.icpcn.com[/url]
  10. #==============================================================================
  11. class Scene_Title
  12.   def main
  13.     if $BTEST
  14.       battle_test
  15.       return
  16.     end
  17.     $data_actors = load_data("Data/Actors.rxdata")
  18.     $data_classes = load_data("Data/Classes.rxdata")
  19.     $data_skills = load_data("Data/Skills.rxdata")
  20.     $data_items = load_data("Data/Items.rxdata")
  21.     $data_weapons = load_data("Data/Weapons.rxdata")
  22.     $data_armors = load_data("Data/Armors.rxdata")
  23.     $data_enemies = load_data("Data/Enemies.rxdata")
  24.     $data_troops = load_data("Data/Troops.rxdata")
  25.     $data_states = load_data("Data/States.rxdata")
  26.     $data_animations = load_data("Data/Animations.rxdata")
  27.     $data_tilesets = load_data("Data/Tilesets.rxdata")
  28.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  29.     $data_system = load_data("Data/System.rxdata")
  30.     $game_system = Game_System.new
  31.     # 生成标题图形
  32.     @sprite = [Sprite.new]
  33.     for i in 0..6
  34.       @sprite[i] = Sprite.new
  35.       @sprite[i].opacity = 0
  36.     end
  37.     @sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
  38.     @sprite[0].opacity = 0
  39.     #开始游戏的图片
  40.     @sprite[1].bitmap = Bitmap.new("Graphics/Titles/start-1.png")
  41.     @sprite[2].bitmap = Bitmap.new("Graphics/Titles/start-2.png")
  42.     #继续游戏的图片
  43.     @sprite[3].bitmap = Bitmap.new("Graphics/Titles/continue-1.png")
  44.     @sprite[4].bitmap = Bitmap.new("Graphics/Titles/continue-2.png")
  45.     #结束游戏的图片
  46.     @sprite[5].bitmap = Bitmap.new("Graphics/Titles/exit-1.png")
  47.     @sprite[6].bitmap = Bitmap.new("Graphics/Titles/exit-2.png")
  48.     #图片位置
  49.     for i in 1..6
  50.       x=330
  51.       y=(i+1)/2*35+260
  52.       @sprite[i].x =x
  53.       @sprite[i].y =y
  54.     end
  55.     @continue_enabled = false
  56.     for i in 0..3
  57.       if FileTest.exist?("Save#{i+1}.rxdata")
  58.         @continue_enabled = true
  59.       end
  60.     end
  61.     if @continue_enabled
  62.       @command_index = 1
  63.     else
  64.       @command_index = 0
  65.       @sprite[3].tone = Tone.new(0, 0, 0, 255)
  66.       @sprite[4].tone = Tone.new(0, 0, 0, 255)
  67.     end
  68.     $game_system.bgm_play($data_system.title_bgm)
  69.     Audio.me_stop
  70.     Audio.bgs_stop
  71.     Graphics.transition
  72.     loop do
  73.       Graphics.update
  74.       #淡出背景圖形
  75.       if @sprite[0].opacity <= 255
  76.         @sprite[0].opacity += 15
  77.       end
  78.       Input.update
  79.       update
  80.       if $scene != self
  81.         break
  82.       end
  83.     end
  84.     Graphics.freeze
  85.     # 釋放圖形
  86.     for i in 0..6
  87.       @sprite[i].bitmap.dispose
  88.       @sprite[i].dispose
  89.     end
  90.   end
  91.   def update
  92.   chaochaocommandchaochao
  93.   if Input.trigger?(Input::C)
  94.     case @command_index
  95.       when 0
  96.         command_new_game
  97.       when 1
  98.         command_continue
  99.       when 2
  100.         command_shutdown
  101.       end
  102.     end
  103.   end
  104.   def chaochaocommandchaochao
  105.     if Input.trigger?(Input::UP)
  106.       @command_index -= 1
  107.       if @command_index < 0
  108.         @command_index = 2
  109.       end
  110.       $game_system.se_play($data_system.cursor_se)
  111.     end
  112.     if Input.trigger?(Input::DOWN)
  113.       @command_index += 1
  114.       if @command_index > 2
  115.         @command_index = 0
  116.       end
  117.       $game_system.se_play($data_system.cursor_se)
  118.     end
  119.     case @command_index
  120.     when 0
  121.       if @sprite[1].opacity >= 0
  122.         @sprite[1].opacity -= 30
  123.       end
  124.       if @sprite[2].opacity <= 240
  125.         @sprite[2].opacity += 30
  126.       end
  127.       if @sprite[3].opacity <= 210
  128.         @sprite[3].opacity += 30
  129.       end
  130.       if @sprite[4].opacity >= 0
  131.         @sprite[4].opacity -= 30
  132.       end
  133.       if @sprite[5].opacity <= 210
  134.         @sprite[5].opacity += 30
  135.       end
  136.       if @sprite[6].opacity >= 0
  137.         @sprite[6].opacity -= 30
  138.       end
  139.     when 1
  140.       if @sprite[1].opacity <= 210
  141.         @sprite[1].opacity += 30
  142.       end
  143.       if @sprite[2].opacity >= 0
  144.         @sprite[2].opacity -= 30
  145.       end
  146.       if @sprite[3].opacity >= 0
  147.         @sprite[3].opacity -= 30
  148.       end
  149.       if @sprite[4].opacity <= 240
  150.         @sprite[4].opacity += 30
  151.       end
  152.       if @sprite[5].opacity <= 210
  153.         @sprite[5].opacity += 30
  154.       end
  155.       if @sprite[6].opacity >= 0
  156.         @sprite[6].opacity -= 30
  157.       end
  158.     when 2
  159.       if @sprite[1].opacity <= 210
  160.         @sprite[1].opacity += 30
  161.       end
  162.       if @sprite[2].opacity >= 0
  163.         @sprite[2].opacity -= 30
  164.       end
  165.       if @sprite[3].opacity <= 210
  166.         @sprite[3].opacity += 30
  167.       end
  168.       if @sprite[4].opacity >= 0
  169.         @sprite[4].opacity -= 30
  170.       end
  171.       if @sprite[5].opacity >= 0
  172.         @sprite[5].opacity -= 30
  173.       end
  174.       if @sprite[6].opacity <= 240
  175.         @sprite[6].opacity += 30
  176.       end
  177.     end
  178.   end
  179. end
  180. #==============================================================================
  181. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  182. #==============================================================================
甘泉幻想物语 试玩版4.0
https://rpg.blue/forum.php?mod=viewthread&tid=369490&page=1&extra=#pid2534710
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-10-1 06:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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