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

Project1

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

[已经解决] 请问如何在“截图存取档”中显示章节名?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
60 小时
注册时间
2009-7-16
帖子
199
跳转到指定楼层
1
发表于 2010-8-10 12:23:07 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题,如何在“截图存取档“界面中加入章节名的显示?
想做个章节游戏,求解!

如图,如何在红框处显示章节名?



原脚本如下:
  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. class Window_File < Window_Base
  29. attr_accessor :index
  30. def initialize(index = 0)
  31.    @backsp = Sprite.new
  32.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  33.    @backsp.z = 100
  34.    super(160,64,480,416)
  35.    #这行可以不用
  36.    self.contents = Bitmap.new(width - 32, height - 32)
  37.    @index = index
  38.    #这里我要说明一句,之所以用sprite是为了放缩图片
  39.    @sprite = Sprite.new
  40.    @sprite.visible = false
  41.    @sprite.z = 100
  42.    @sp_ch = []
  43.    @sp_ch[0] = Sprite.new
  44.    refresh
  45. end
  46. def refresh
  47.    self.contents.clear
  48.    for i in @sp_ch
  49.      i.visible = false
  50.    end
  51.    @sprite.visible = false
  52.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  53.      @sprite.visible = true
  54.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  55.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  56.      else
  57.        self.contents.draw_text(32,64,400,32,"截图出现问题!")
  58.      end
  59.      @sprite.x = 290
  60.      @sprite.y = 96
  61.      @sprite.z = 998
  62.      @sprite.zoom_x = 0.5
  63.      @sprite.zoom_y = 0.5
  64.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  65.      @time_stamp = file.mtime
  66.      @characters = Marshal.load(file)
  67.      @frame_count = Marshal.load(file)
  68.      @game_system = Marshal.load(file)
  69.      @game_switches = Marshal.load(file)
  70.      @game_variables = Marshal.load(file)
  71.      @total_sec = @frame_count / Graphics.frame_rate
  72.      file.close
  73.      for i in [email protected]
  74.        @sp_ch[i] = Sprite.new
  75.        @sp_ch[i].visible = true
  76.        testname = @characters[i][2].name+"_f"
  77.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  78.        @sp_ch[i].zoom_x = 0.8
  79.        @sp_ch[i].zoom_y = 0.8
  80.        @sp_ch[i].x = 180        
  81.        @sp_ch[i].y = 96 + i*90
  82.        @sp_ch[i].z = 101
  83.      end
  84.      # 描绘游戏时间
  85.      hour = @total_sec / 60 / 60
  86.      min = @total_sec / 60 % 60
  87.      sec = @total_sec % 60
  88.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  89.      self.contents.font.color = normal_color
  90.      self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  91.      # 描绘时间标记
  92.      self.contents.font.color = normal_color
  93.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  94.      self.contents.draw_text(4, 356, 420, 32, time_string, 2)
  95.    else
  96.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  97.    end

  98. end
  99. def dispose
  100.    super
  101.    @sprite.dispose
  102.    @backsp.dispose
  103.    for i in @sp_ch
  104.      i.dispose
  105.    end
  106. end
  107. end


  108. class Window_File2 < Window_Base
  109. attr_accessor :index
  110. def initialize(index = 0)
  111.    @backsp = Sprite.new
  112.   # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  113.    @backsp.z = 100
  114.    super(160,0,480,480)
  115.    #这行可以不用
  116.    self.contents = Bitmap.new(width - 32, height - 32)
  117.    @index = index
  118.    #这里我要说明一句,之所以用sprite是为了放缩图片
  119.    @sprite = Sprite.new
  120.    @sprite.visible = false
  121.    @sprite.z = 100
  122.    @sp_ch = []
  123.    @sp_ch[0] = Sprite.new
  124.    refresh
  125. end
  126. def refresh
  127.    self.contents.clear
  128.    for i in @sp_ch
  129.      i.visible = false
  130.    end
  131.    @sprite.visible = false
  132.    if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  133.      @sprite.visible = true
  134.      if FileTest.exist?(DIR+"Save#{@index}.jpg")
  135.        @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  136.      else
  137.        self.contents.draw_text(32,64,400,32,"截图出现问题!")
  138.      end
  139.      @sprite.x = 290
  140.      @sprite.y = 32
  141.      @sprite.z = 998
  142.      @sprite.zoom_x = 0.5
  143.      @sprite.zoom_y = 0.5
  144.      file = File.open(DIR+"Save#{@index}.rxdata", "r")
  145.      @time_stamp = file.mtime
  146.      @characters = Marshal.load(file)
  147.      @frame_count = Marshal.load(file)
  148.      @game_system = Marshal.load(file)
  149.      @game_switches = Marshal.load(file)
  150.      @game_variables = Marshal.load(file)
  151.      @total_sec = @frame_count / Graphics.frame_rate
  152.      file.close
  153.      for i in [email protected]
  154.        @sp_ch[i] = Sprite.new
  155.        @sp_ch[i].visible = true
  156.        testname = @characters[i][2].name+"_f" #修改
  157.        @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  158.        @sp_ch[i].x = 180        
  159.        @sp_ch[i].y = 24 + i*110
  160.        @sp_ch[i].z = 101
  161.      end
  162.      # 描绘游戏时间
  163.      hour = @total_sec / 60 / 60
  164.      min = @total_sec / 60 % 60
  165.      sec = @total_sec % 60
  166.      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  167.      self.contents.font.color = normal_color
  168.      self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  169.      # 描绘时间标记
  170.      self.contents.font.color = normal_color
  171.      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  172.      self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  173.    else
  174.      self.contents.draw_text(32,32,420,32,"这个存档是空的")
  175.    end

  176. end
  177. def dispose
  178.    super
  179.    @sprite.dispose
  180.    @backsp.dispose
  181.    for i in @sp_ch
  182.      i.dispose
  183.    end
  184. end
  185. end



  186. $打开自动存档用的开关编号 = 999
  187. $自动存档位置 = 1
  188. $按下F5之后的自动存档的音效 = "Audio/SE/系统存档"
  189. $按下F5之后禁止存档时候的音效 = "Audio/Se/系统错误"
  190. DIR = "Save/"
  191. $打开自动存档开关之后调用的公共事件 = 0 #——默认未定义
  192. $按下F5之后可以存档调用的公共事件 = 0 #——默认未定义
  193. $按下F5之后禁止存档调用的公共事件 = 0 #——默认未定义
  194. class Scene_Map
  195. alias auto_update update
  196. def update
  197. auto_update
  198. #——按下F5的时候自动存档,可以修改为F5,F6,F7,F8,也可以修改成默认按键但是不推荐。
  199. #——注意在不可存档的时候是无效的
  200. if Input.trigger?(Input::F5)
  201.   unless $game_system.map_interpreter.running?
  202.   if $game_system.save_disabled
  203.     Audio.se_play($按下F5之后禁止存档时候的音效)
  204.     $game_temp.common_event_id = $按下F5之后禁止存档调用的公共事件
  205.   else
  206.     Audio.se_play($按下F5之后的自动存档的音效)
  207.     $game_temp.common_event_id = $按下F5之后可以存档调用的公共事件
  208.     auto_save
  209.   end
  210.   end
  211. end
  212. #——当BOSS战之前打开一下定义的开关,即可自动存档
  213. if $game_switches[$打开自动存档用的开关编号] == true
  214.   $game_switches[$打开自动存档用的开关编号] = false
  215.   $game_temp.common_event_id = $打开自动存档开关之后调用的公共事件
  216.   auto_save
  217. end
  218. end
  219. def auto_save
  220. #——这里定义了储存的文件,如果不希望用Save4可以自己修改编号
  221. # 写入存档数据
  222. Screen::shot
  223.     file = File.open( DIR+"Save#{$自动存档位置}.rxdata", "wb")
  224.     auto_save_data(file)
  225.     if FileTest.exist?( DIR+"shot.jpg")
  226.       File.rename( DIR+"shot.jpg", DIR+"Save#{$自动存档位置}.jpg")
  227.     end
  228.     file.close
  229. end
  230. def auto_save_data(file)
  231. #——以下定义内容和Scene_Save的write_save_data(file)完全一样
  232. #——如果你修改过该存档方法,不要忘记用你修改的覆盖这部分内容。
  233. # 生成描绘存档文件用的角色图形
  234. characters = []
  235. for i in 0...$game_party.actors.size
  236.   actor = $game_party.actors[i]
  237.   characters.push([actor.character_name, actor.character_hue, actor])
  238. end
  239. # 写入描绘存档文件用的角色数据
  240. Marshal.dump(characters, file)
  241. # 写入测量游戏时间用画面计数
  242. Marshal.dump(Graphics.frame_count, file)
  243. # 增加 1 次存档次数
  244. $game_system.save_count += 1
  245. # 保存魔法编号
  246. # (将编辑器保存的值以随机值替换)
  247. $game_system.magic_number = $data_system.magic_number
  248. # 写入各种游戏对像
  249. Marshal.dump($game_system, file)
  250. Marshal.dump($game_switches, file)
  251. Marshal.dump($game_variables, file)
  252. Marshal.dump($game_self_switches, file)
  253. Marshal.dump($game_screen, file)
  254. Marshal.dump($game_actors, file)
  255. Marshal.dump($game_party, file)
  256. Marshal.dump($game_troop, file)
  257. Marshal.dump($game_map, file)
  258. Marshal.dump($game_player, file)
  259. end
  260. end







  261. DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹


  262. module Screen  
  263. @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  264. @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l

  265. p), 'l'
  266. @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  267. module_function
  268. def shot(file = "shot", typ = 1)
  269.    # to add the right extension...
  270.    if typ == 0
  271.      typname = ".bmp"
  272.    elsif typ == 1
  273.      typname = ".jpg"
  274.    elsif typ == 2
  275.      typname = ".png"
  276.    end   
  277.    file_index = 0   
  278.    dir = "Save/"   
  279.    # make the filename....
  280.    file_name = dir + file.to_s + typname.to_s   
  281.    # make the screenshot.... Attention dont change anything from here on....
  282.    @screen.call(0,0,640,480,file_name,handel,typ)
  283. end
  284. # find the game window...
  285. def handel
  286.    game_name = "\0" * 256
  287.    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  288.    game_name.delete!("\0")
  289.    return @findwindow.call('RGSS Player',game_name)
  290. end
  291. end


  292. class Scene_Menu
  293. alias shotsave_main main
  294. def main
  295.    if @menu_index == 0
  296.      Screen::shot
  297.    end   
  298.    shotsave_main
  299. end
  300. end

  301. class Interpreter
  302. #--------------------------------------------------------------------------
  303. # ● 调用存档画面
  304. #--------------------------------------------------------------------------
  305. def command_352
  306.    # 设置战斗中断标志
  307.    $game_temp.battle_abort = true
  308.    # 设置调用存档标志
  309.    $game_temp.save_calling = true
  310.    # 推进索引
  311.    @index += 1
  312.    # 结束
  313.    Screen::shot
  314.    return false
  315. end
  316. end

  317. #==============================================================================
  318. # ■ Scene_Load
  319. #------------------------------------------------------------------------------
  320. #  处理读档画面的类。
  321. #==============================================================================

  322. class Scene_Load
  323. #--------------------------------------------------------------------------
  324. # ● 初始化对像
  325. #--------------------------------------------------------------------------
  326. def initialize
  327.    # 再生成临时对像
  328.    $game_temp = Game_Temp.new
  329.    # 选择存档时间最新的文件
  330.    $game_temp.last_file_index = 0
  331.    latest_time = Time.at(0)
  332.    for i in 0..51
  333.      filename = DIR+"Save#{i}.rxdata"
  334.      if FileTest.exist?(filename)
  335.        file = File.open(filename, "r")
  336.        if file.mtime > latest_time
  337.          latest_time = file.mtime
  338.          $game_temp.last_file_index = i
  339.        end
  340.        file.close
  341.      end
  342.    end
  343. end  
  344. def main
  345.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  346.    "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  347.    "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  348.    "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  349.    "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  350.    "进度二九","进度三十"])
  351.    @command_window.y = 0
  352.    @command_window.height = 480
  353.    @command_window.index = $game_temp.last_file_index
  354.    @content_window = Window_File2.new($game_temp.last_file_index)
  355.    # 执行过渡
  356.    Graphics.transition
  357.    # 主循环
  358.    loop do
  359.      # 刷新游戏画面
  360.      Graphics.update
  361.      # 刷新输入信息
  362.      Input.update
  363.      # 刷新画面
  364.      update
  365.      # 如果画面被切换的话就中断循环
  366.      if $scene != self
  367.        break
  368.      end
  369.    end
  370.    # 准备过渡
  371.    Graphics.freeze
  372.    @command_window.dispose
  373.    @content_window.dispose
  374. end
  375. def update
  376.    @command_window.update
  377.    if @command_window.index != @content_window.index
  378.      @content_window.index = @command_window.index
  379.      @content_window.refresh
  380.    end   
  381.    #——————下面这一部分是原装脚本——————#
  382.    if Input.trigger?(Input::B)  
  383.    # 演奏取消 SE
  384.    $game_system.se_play($data_system.cancel_se)
  385.    # 切换到标题画面
  386.    $scene = Scene_Title.new
  387.    end   
  388.    #———————————————————————#   
  389.    if Input.trigger?(Input::C)
  390.      # 文件不存在的情况下
  391.      unless FileTest.exist?(DIR+"Save#{@command_window.index}.rxdata")
  392.        # 演奏冻结 SE
  393.        $game_system.se_play($data_system.buzzer_se)
  394.        return
  395.      end
  396.      # 演奏读档 SE
  397.      $game_system.se_play($data_system.load_se)
  398.      # 写入存档数据
  399.      file = File.open(DIR+"Save#{@command_window.index}.rxdata",

  400. "rb")
  401.      read_save_data(file)
  402.      file.close
  403.      # 还原 BGM、BGS
  404.      $game_system.bgm_play($game_system.playing_bgm)
  405.      $game_system.bgs_play($game_system.playing_bgs)
  406.      # 刷新地图 (执行并行事件)
  407.      $game_map.update
  408.      # 切换到地图画面
  409.      $scene = Scene_Map.new
  410.    end
  411.    #———————————————————————#
  412. end
  413. #--------------------------------------------------------------------------
  414. # ● 写入存档数据
  415. #     file : 写入用文件对像 (已经打开)
  416. #--------------------------------------------------------------------------
  417. def read_save_data(file)
  418.    # 读取描绘存档文件用的角色数据
  419.    characters = Marshal.load(file)
  420.    # 读取测量游戏时间用画面计数
  421.    Graphics.frame_count = Marshal.load(file)
  422.    # 读取各种游戏对像
  423.    $game_system        = Marshal.load(file)
  424.    $game_switches      = Marshal.load(file)
  425.    $game_variables     = Marshal.load(file)
  426.    $game_self_switches = Marshal.load(file)
  427.    $game_screen        = Marshal.load(file)
  428.    $game_actors        = Marshal.load(file)
  429.    $game_party         = Marshal.load(file)
  430.    $game_troop         = Marshal.load(file)
  431.    $game_map           = Marshal.load(file)
  432.    $game_player        = Marshal.load(file)
  433.    # 魔法编号与保存时有差异的情况下
  434.    # (加入编辑器的编辑过的数据)
  435.    if $game_system.magic_number != $data_system.magic_number
  436.      # 重新装载地图
  437.      $game_map.setup($game_map.map_id)
  438.      $game_player.center($game_player.x, $game_player.y)
  439.    end
  440.    # 刷新同伴成员
  441.    $game_party.refresh
  442. end
  443. end

  444. #==============================================================================
  445. #  Window_LoadCommand
  446. #------------------------------------------------------------------------------
  447. #  存取档画面选择按钮窗口
  448. #==============================================================================

  449. class Window_LoadCommand < Window_Selectable
  450. #--------------------------------------------------------------------------
  451. #  初始化对象
  452. #--------------------------------------------------------------------------
  453. def initialize
  454. super(320, 0, 320, 64)
  455. self.contents = Bitmap.new(width - 32, height - 32)
  456. self.contents.font.color = normal_color
  457. @item_max = 2
  458. @column_max = 2
  459. @commands = ["读取", "存储"]
  460. refresh
  461. self.index = 0
  462. end
  463. #--------------------------------------------------------------------------
  464. #  刷新
  465. #--------------------------------------------------------------------------
  466. def refresh
  467. self.contents.clear
  468. for i in 0...@item_max
  469.    draw_item(i)
  470. end
  471. end
  472. #--------------------------------------------------------------------------
  473. #  描画按钮文字
  474. #--------------------------------------------------------------------------
  475. def draw_item(index)
  476. x = 4 + index * 160
  477. self.contents.draw_text(x, 0, 144, 32, @commands[index])
  478. end
  479. #--------------------------------------------------------------------------
  480. # ● 项目无效化
  481. #     index : 项目编号
  482. #--------------------------------------------------------------------------
  483. def disable_item(index)
  484.    draw_item(index, disabled_color)
  485. end

  486. end

  487. #==============================================================================
  488. #  Scene_Loadsave
  489. #------------------------------------------------------------------------------
  490. # 处理存取档画面的类。
  491. #==============================================================================

  492. class Scene_Loadsave
  493. #--------------------------------------------------------------------------
  494. # ● 初始化对像
  495. #     $last_savefile_index : 记录光标位置
  496. #--------------------------------------------------------------------------
  497. def initialize
  498.    $last_savefile_index = 0 if $last_savefile_index == nil
  499.    # 再生成临时对像
  500.    $game_temp = Game_Temp.new
  501.    # 选择存档时间最新的文件
  502.    $game_temp.last_file_index = 0
  503.    latest_time = Time.at(0)
  504.    for i in 0..51
  505.      filename =  DIR+"Save#{i}.rxdata"
  506.      if FileTest.exist?(filename)
  507.        file = File.open(filename, "r")
  508.        if file.mtime > latest_time
  509.          latest_time = file.mtime
  510.          $game_temp.last_file_index = i
  511.        end
  512.        file.close
  513.      end
  514.    end
  515. end
  516. #--------------------------------------------------------------------------
  517. #  主处理
  518. #--------------------------------------------------------------------------
  519. def main         

  520.    @savestate = 0
  521.    # 生成窗口
  522.    @help_window = Window_LoadHelp.new
  523.    @help_window.set_text("请选择.")
  524.    @option_window = Window_LoadCommand.new
  525.    @option_window.index = $last_savefile_index
  526.    ########################################################
  527.    @command_window = Window_Command.new(160,["自动存档","快速存档","进度二",
  528.      "进度三","进度四","进度五","进度六","进度七","进度八","进度九","进度十",
  529.      "进度十一","进度十二","进度十三","进度十四","进度十五","进度十六",
  530.      "进度十七","进度十八","进度十九","进度二十","进度二一","进度二二",
  531.      "进度二三","进度二四","进度二五","进度二六","进度二七","进度二八",
  532.      "进度二九","进度三十"])
  533.      @command_window.y = 64
  534.      @command_window.height = 416
  535.      @command_window.index = $game_temp.last_file_index
  536.      @content_window = Window_File.new($game_temp.last_file_index)
  537.      @command_window.active = false
  538.        ###############覆盖存档
  539.        @confirm_window = Window_Base.new(120, 188, 400, 64)
  540.        @confirm_window.contents = Bitmap.new(368, 32)

  541.        @confirm_window.contents.font.color = Color.new(255,255,255,255)

  542.        string = "确定要覆盖这个进度吗?"
  543.        @confirm_window.contents.font.name = "经典细隶书简"
  544.        @confirm_window.contents.font.size = 24
  545.        @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  546.        @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  547.        @confirm_window.z = 1500
  548.        @yes_no_window.index = 1
  549.        @yes_no_window.x = 270
  550.        @yes_no_window.y = 252
  551.        @yes_no_window.z = 1500
  552.        @confirm_window.visible = false
  553.        @yes_no_window.visible = false
  554.        @yes_no_window.active = false

  555.    # 执行过渡
  556.    Graphics.transition
  557.    # 主循环
  558.    loop do
  559.      # 刷新游戏画面
  560.      Graphics.update
  561.      # 刷新输入信息
  562.      Input.update
  563.      # 刷新画面
  564.      update
  565.      # 如果画面被切换的话就中断循环
  566.      if $scene != self
  567.        break
  568.      end
  569.    end
  570.    # 准备过渡
  571.    Graphics.freeze
  572.    # 释放窗口
  573.    @command_window.dispose
  574.    @content_window.dispose
  575.    @confirm_window.dispose
  576.    @yes_no_window.dispose
  577.    @help_window.dispose
  578.    @option_window.dispose
  579. end

  580. #--------------------------------------------------------------------------
  581. #  ● 刷新画面
  582. #--------------------------------------------------------------------------
  583. def update
  584.    # 刷新窗口
  585.    @help_window.update
  586.    @option_window.update
  587. #   @content_window.update
  588.    @command_window.update
  589.    if @yes_no_window.active
  590.        confirm_update
  591.        return
  592.    end
  593.    @content_window.index = @command_window.index
  594.    @content_window.refresh
  595.    case @savestate
  596.    when 0
  597.        if Input.trigger?(Input::B)
  598.        $game_system.se_play($data_system.cancel_se)
  599.        # 返回地图
  600.        if $menu_call == false
  601.        # 切换到地图画面
  602.        $scene = Scene_Map.new
  603.          return
  604.        end
  605.        # 切换到菜单画面
  606.        $menu_call = false
  607.        $scene = Scene_Map.new
  608.     end
  609.      if Input.trigger?(Input::C)
  610.        case @option_window.index
  611.        when 0
  612.          @command_window.active = true
  613.          @option_window.active = false
  614.          $game_system.se_play($data_system.decision_se)
  615.          @help_window.set_text("请选择一个文件进行读取.")
  616.          @savestate  = 1
  617.          return
  618.        when 1
  619.          @command_window.active = true
  620.          @option_window.active = false
  621.          $game_system.se_play($data_system.decision_se)
  622.          @help_window.set_text("请选择一个文件进行存储.")
  623.          @savestate = 2
  624.          
  625.          return
  626.        return
  627.        end
  628.      end
  629.    when 1,2
  630.      if Input.trigger?(Input::C)
  631.        if @savestate == 1
  632.          $menu_call = false
  633.          load_file
  634.          return
  635.        else
  636.          # 禁止存档的情况下
  637.          if $game_system.save_disabled
  638.            @help_window.set_text("抱歉,这里禁止存储.")
  639.            # 演奏冻结 SE
  640.            $game_system.se_play($data_system.buzzer_se)
  641.            return
  642.          end
  643.         $game_system.se_play($data_system.decision_se)
  644.         $last_savefile_index = @option_window.index

  645.         save_file
  646.          return
  647.        end
  648.      end
  649.      # 取消
  650.      if Input.trigger?(Input::B)
  651.        $game_system.se_play($data_system.cancel_se)
  652.        @command_window.active = false
  653.        @help_window.set_text("请选择.")
  654.        @savestate = 0
  655.        @option_window.active = true
  656.        return
  657.      end
  658.      
  659.      if Input.trigger?(Input::B)
  660.        $game_system.se_play($data_system.cancel_se)
  661.        @savestate = 2
  662.        @command_window.active = true

  663.        return
  664.      end
  665.    end
  666. end
  667. #--------------------------------------------------------------------------
  668. # 建立记录文件索引
  669. #--------------------------------------------------------------------------

  670. #--------------------------------------------------------------------------
  671. #  读取记录文件
  672. #     filename  : 被读取文件
  673. #--------------------------------------------------------------------------
  674. def load_file
  675.      # 文件不存在的情况下
  676.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  677.        # 演奏冻结 SE
  678.        $game_system.se_play($data_system.buzzer_se)
  679.        return
  680.      end
  681.      # 演奏读档 SE
  682.      $game_system.se_play($data_system.load_se)
  683.      # 写入存档数据
  684.      file = File.open( DIR+"Save#{@command_window.index}.rxdata", "rb")
  685.      read_save_data(file)
  686.      file.close
  687.      # 还原 BGM、BGS
  688.      $game_system.bgm_play($game_system.playing_bgm)
  689.      $game_system.bgs_play($game_system.playing_bgs)
  690.      # 刷新地图 (执行并行事件)
  691.      $game_map.update
  692.      # 切换到地图画面
  693.      $scene = Scene_Map.new
  694. end
  695. #--------------------------------------------------------------------------
  696. # ● 读取存档数据
  697. #     file : 读取用文件对像 (已经打开)
  698. #--------------------------------------------------------------------------
  699. def read_save_data(file)
  700.    # 读取描绘存档文件用的角色数据
  701.    characters = Marshal.load(file)
  702.    # 读取测量游戏时间用画面计数
  703.    Graphics.frame_count = Marshal.load(file)
  704.    # 读取各种游戏对像
  705.    $game_system        = Marshal.load(file)
  706.    $game_switches      = Marshal.load(file)
  707.    $game_variables     = Marshal.load(file)
  708.    $game_self_switches = Marshal.load(file)
  709.    $game_screen        = Marshal.load(file)
  710.    $game_actors        = Marshal.load(file)
  711.    $game_party         = Marshal.load(file)
  712.    $game_troop         = Marshal.load(file)
  713.    $game_map           = Marshal.load(file)
  714.    $game_player        = Marshal.load(file)
  715.    # 魔法编号与保存时有差异的情况下
  716.    # (加入编辑器的编辑过的数据)
  717.    if $game_system.magic_number != $data_system.magic_number
  718.      # 重新装载地图
  719.      $game_map.setup($game_map.map_id)
  720.      $game_player.center($game_player.x, $game_player.y)
  721.    end
  722.    # 刷新同伴成员
  723.    $game_party.refresh
  724. end
  725. #--------------------------------------------------------------------------
  726. # ● 写入存档文件
  727. #--------------------------------------------------------------------------
  728. def save_file
  729.    if Input.trigger?(Input::C)
  730.      unless FileTest.exist?( DIR+"Save#{@command_window.index}.rxdata")
  731.        # 演奏冻结 SE
  732.        # 演奏存档 SE
  733.          $game_system.se_play($data_system.save_se)
  734.          # 写入存档数据
  735.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  736.          write_save_data(file)
  737.          if FileTest.exist?( DIR+"shot.jpg")
  738.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  739.          end
  740.          file.close
  741.          $game_temp.last_file_index = @command_window.index
  742.          # 如果被事件调用
  743.          if $game_temp.save_calling
  744.            # 清除存档调用标志
  745.            $game_temp.save_calling = false
  746.            @confirm_window.dispose
  747.            # 切换到地图画面
  748.            $scene = Scene_Map.new   
  749.            return
  750.          end
  751.        # 切换到菜单画面
  752.          $scene = Scene_Map.new  
  753.      end
  754.      @yes_no_window.active = true
  755.      @command_window.active = false            
  756.    end
  757.    #———————————————————————#     
  758. end
  759. #-------------------------------------------------------------------
  760. def confirm_update
  761.    @command_index = @command_window.index
  762.    @confirm_window.visible = true
  763.    @confirm_window.z = 1500
  764.    @yes_no_window.visible = true
  765.    @yes_no_window.active = true
  766.    @yes_no_window.z = 1500
  767.    @yes_no_window.update
  768.    if Input.trigger?(Input::C)
  769.      if @yes_no_window.index == 0
  770.          #######################################################
  771.          # 演奏存档 SE
  772.          $game_system.se_play($data_system.save_se)
  773.          # 写入存档数据
  774.          file = File.open( DIR+"Save#{@command_window.index}.rxdata", "wb")
  775.          write_save_data(file)
  776.          if FileTest.exist?( DIR+"shot.jpg")
  777.            File.rename( DIR+"shot.jpg",  DIR+"Save#{@command_window.index}.jpg")
  778.          end
  779.          file.close
  780.          $game_temp.last_file_index = @command_window.index
  781.          # 如果被事件调用
  782.          if $game_temp.save_calling
  783.            # 清除存档调用标志
  784.            $game_temp.save_calling = false
  785.            @confirm_window.dispose
  786.            @content_window.dispose
  787.            # 切换到地图画面
  788.            $scene = Scene_Map.new
  789.    
  790.            return
  791.          end
  792.        # 切换到菜单画面
  793.          $scene = Scene_Map.new        
  794.        else
  795.        @yes_no_window.visible = false
  796.        @confirm_window.visible = false
  797.        $game_system.se_play($data_system.cancel_se)
  798.        @yes_no_window.active = false
  799.        @command_window.active = true
  800.        end
  801.    end
  802.    if Input.trigger?(Input::B)
  803.      @yes_no_window.visible = false
  804.      @confirm_window.visible = false
  805.      $game_system.se_play($data_system.cancel_se)
  806.      @yes_no_window.active = false
  807.      @command_window.active = true
  808.    end
  809. end
  810. #--------------------------------------------------------------------------
  811. # ● 写入存档数据
  812. #     file : 写入用文件对像 (已经打开)
  813. #--------------------------------------------------------------------------
  814. def write_save_data(file)
  815.    # 生成描绘存档文件用的角色图形
  816.    characters = []
  817.    for i in 0...$game_party.actors.size
  818.      actor = $game_party.actors[i]
  819.      characters.push([actor.character_name, actor.character_hue, actor])
  820.    end
  821.    # 写入描绘存档文件用的角色数据
  822.    Marshal.dump(characters, file)
  823.    # 写入测量游戏时间用画面计数
  824.    Marshal.dump(Graphics.frame_count, file)
  825.    # 增加 1 次存档次数
  826.    $game_system.save_count += 1
  827.    # 保存魔法编号
  828.    # (将编辑器保存的值以随机值替换)
  829.    $game_system.magic_number = $data_system.magic_number
  830.    # 写入各种游戏对像
  831.    Marshal.dump($game_system, file)
  832.    Marshal.dump($game_switches, file)
  833.    Marshal.dump($game_variables, file)
  834.    Marshal.dump($game_self_switches, file)
  835.    Marshal.dump($game_screen, file)
  836.    Marshal.dump($game_actors, file)
  837.    Marshal.dump($game_party, file)
  838.    Marshal.dump($game_troop, file)
  839.    Marshal.dump($game_map, file)
  840.    Marshal.dump($game_player, file)
  841. end
  842. end

  843. #==============================================================================
  844. # ■ Window_LoadHelp
  845. #------------------------------------------------------------------------------
  846. #  存取档画面帮助信息的显示窗口。
  847. #==============================================================================

  848. class Window_LoadHelp < Window_Base
  849. #--------------------------------------------------------------------------
  850. #  初始化对象
  851. #--------------------------------------------------------------------------
  852. def initialize
  853. super(0, 0, 320, 64)
  854. self.contents = Bitmap.new(width - 32, height - 32)
  855. end
  856. #--------------------------------------------------------------------------
  857. #  刷新文本
  858. #--------------------------------------------------------------------------
  859. def set_text(text, align = 1)
  860. if text != @text or align != @align
  861.    self.contents.clear
  862.    self.contents.font.color = normal_color
  863.    self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  864.    @text = text
  865.    @align = align
  866.    @actor = nil
  867. end
  868. self.visible = true
  869. end
  870. end
复制代码
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
80
在线时间
3 小时
注册时间
2006-10-4
帖子
199
2
发表于 2010-8-10 12:32:29 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
60 小时
注册时间
2009-7-16
帖子
199
3
 楼主| 发表于 2010-8-10 13:37:00 | 只看该作者
那么具体要写什么呢?
本人脚本忙,谢谢了。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

反伸手党斗士

梦石
0
星屑
91
在线时间
1128 小时
注册时间
2009-9-10
帖子
2513

贵宾

4
发表于 2010-8-10 13:42:05 | 只看该作者
- -其实LZ完全可以参考一下别的集成脚本
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
60 小时
注册时间
2009-7-16
帖子
199
5
 楼主| 发表于 2010-8-10 15:47:50 | 只看该作者
轻顶,没人回答吗???
回复 支持 反对

使用道具 举报

Lv1.梦旅人

小小的百鬼夜行<

梦石
0
星屑
54
在线时间
579 小时
注册时间
2010-7-29
帖子
2682

贵宾

6
发表于 2010-8-10 17:56:29 | 只看该作者
根据变量判断..
在游戏到某处时加上变量1……
脚本中进行IF判断
如果变量= 某,显示某字
我什么都不知道别看着我。。。我不说了。。
某只PHP/HTML小白鼠→退屈の间


Cause I knew you were trouble when you walked in
So shame is on me now
I flow me to place i ve never been
till you put me down oh
Now Im lying on the cold hard ground
回复 支持 反对

使用道具 举报

Lv3.寻梦者

宛若

梦石
0
星屑
1568
在线时间
526 小时
注册时间
2007-8-19
帖子
1493

极短24参与开拓者

7
发表于 2010-8-10 18:42:38 | 只看该作者
  1. class Game_System
  2.   attr :chapter,true
  3.   alias diyrpg_initialize initialize
  4.   def initialize
  5.     diyrpg_initialize
  6.     @chapter = ""
  7.   end
  8. end
  9. class Window_File < Window_Base
  10.   attr_accessor :index
  11.   def initialize(index = 0)
  12.     @backsp = Sprite.new
  13.    # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  14.     @backsp.z = 100
  15.     super(160,64,480,416)
  16.     #这行可以不用
  17.     self.contents = Bitmap.new(width - 32, height - 32)
  18.     @index = index
  19.     #这里我要说明一句,之所以用sprite是为了放缩图片
  20.     @sprite = Sprite.new
  21.     @sprite.visible = false
  22.     @sprite.z = 100
  23.     @sp_ch = []
  24.     @sp_ch[0] = Sprite.new
  25.     refresh
  26.   end
  27.   def refresh
  28.     self.contents.clear
  29.     for i in @sp_ch
  30.       i.visible = false
  31.     end
  32.     @sprite.visible = false
  33.     if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  34.       @sprite.visible = true
  35.       if FileTest.exist?(DIR+"Save#{@index}.jpg")
  36.         @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  37.       else
  38.         self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  39.       end
  40.       @sprite.x = 290
  41.       @sprite.y = 96
  42.       @sprite.z = 998
  43.       @sprite.zoom_x = 0.5
  44.       @sprite.zoom_y = 0.5
  45.       file = File.open(DIR+"Save#{@index}.rxdata", "r")
  46.       @time_stamp = file.mtime
  47.       @characters = Marshal.load(file)
  48.       @frame_count = Marshal.load(file)
  49.       @game_system = Marshal.load(file)
  50.       @game_switches = Marshal.load(file)
  51.       @game_variables = Marshal.load(file)
  52.       @total_sec = @frame_count / Graphics.frame_rate
  53.       file.close
  54.       for i in [email protected]
  55.         @sp_ch[i] = Sprite.new
  56.         @sp_ch[i].visible = true
  57.         testname = @characters[i][2].name+"_f"
  58.         @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  59.         @sp_ch[i].zoom_x = 0.8
  60.         @sp_ch[i].zoom_y = 0.8
  61.         @sp_ch[i].x = 180        
  62.         @sp_ch[i].y = 96 + i*90
  63.         @sp_ch[i].z = 101
  64.       end
  65.       # 描绘游戏时间
  66.       hour = @total_sec / 60 / 60
  67.       min = @total_sec / 60 % 60
  68.       sec = @total_sec % 60
  69.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  70.       self.contents.font.color = normal_color
  71.       self.contents.draw_text(4, 326, 420, 32, time_string, 2)
  72.       self.contents.draw_text(4,390-32,420,32,@game_system.chapter,2)
  73.       # 描绘时间标记
  74.       self.contents.font.color = normal_color
  75.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  76.       self.contents.draw_text(4, 356, 420, 32, time_string, 2)
  77.     else
  78.       self.contents.draw_text(32,32,420,32,"这个存档是空的")
  79.     end

  80.   end
  81.   def dispose
  82.     super
  83.     @sprite.dispose
  84.     @backsp.dispose
  85.     for i in @sp_ch
  86.       i.dispose
  87.     end
  88.   end
  89. end


  90. class Window_File2 < Window_Base
  91.   attr_accessor :index
  92.   def initialize(index = 0)
  93.     @backsp = Sprite.new
  94.    # @backsp.bitmap = Bitmap.new("Graphics/Pictures/菜单底图.jpg")
  95.     @backsp.z = 100
  96.     super(160,0,480,480)
  97.     #这行可以不用
  98.     self.contents = Bitmap.new(width - 32, height - 32)
  99.     @index = index
  100.     #这里我要说明一句,之所以用sprite是为了放缩图片
  101.     @sprite = Sprite.new
  102.     @sprite.visible = false
  103.     @sprite.z = 100
  104.     @sp_ch = []
  105.     @sp_ch[0] = Sprite.new
  106.     refresh
  107.   end
  108.   def refresh
  109.     self.contents.clear
  110.     for i in @sp_ch
  111.       i.visible = false
  112.     end
  113.     @sprite.visible = false
  114.     if FileTest.exist?(DIR+"Save#{@index}.rxdata")
  115.       @sprite.visible = true
  116.       if FileTest.exist?(DIR+"Save#{@index}.jpg")
  117.         @sprite.bitmap = Bitmap.new(DIR+"Save#{@index}.jpg")
  118.       else
  119.         self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?

  120. ")
  121.       end
  122.       @sprite.x = 290
  123.       @sprite.y = 32
  124.       @sprite.z = 998
  125.       @sprite.zoom_x = 0.5
  126.       @sprite.zoom_y = 0.5
  127.       file = File.open(DIR+"Save#{@index}.rxdata", "r")
  128.       @time_stamp = file.mtime
  129.       @characters = Marshal.load(file)
  130.       @frame_count = Marshal.load(file)
  131.       @game_system = Marshal.load(file)
  132.       @game_switches = Marshal.load(file)
  133.       @game_variables = Marshal.load(file)
  134.       @total_sec = @frame_count / Graphics.frame_rate
  135.       file.close
  136.       for i in [email protected]
  137.         @sp_ch[i] = Sprite.new
  138.         @sp_ch[i].visible = true
  139.         testname = @characters[i][2].name+"_f"
  140.         @sp_ch[i].bitmap = Bitmap.new("Graphics/battlers/#{testname}")
  141.         @sp_ch[i].x = 180        
  142.         @sp_ch[i].y = 32 + i*110
  143.         @sp_ch[i].z = 101
  144.       end
  145.       # 描绘游戏时间
  146.       hour = @total_sec / 60 / 60
  147.       min = @total_sec / 60 % 60
  148.       sec = @total_sec % 60
  149.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  150.       self.contents.font.color = normal_color
  151.       self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  152.       self.contents.draw_text(4,390-32,420,32,@game_system.chapter,2)
  153.       # 描绘时间标记
  154.       self.contents.font.color = normal_color
  155.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  156.       self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  157.     else
  158.       self.contents.draw_text(32,32,420,32,"这个存档是空的")
  159.     end

  160.   end
  161.   def dispose
  162.     super
  163.     @sprite.dispose
  164.     @backsp.dispose
  165.     for i in @sp_ch
  166.       i.dispose
  167.     end
  168.   end
  169. end


复制代码
修改章节名:$game_system.chapter="章节名称"

评分

参与人数 1星屑 +240 收起 理由
六祈 + 240 认可答案

查看全部评分

[url=http://rpg.blue/thread-219730-1-1.html]http://unhero.sinaapp.com/wi.php[/url]
[color=Red]如你所见这是个死坑,没错这就是打我的脸用的[/color]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
60 小时
注册时间
2009-7-16
帖子
199
8
 楼主| 发表于 2010-8-10 20:27:29 | 只看该作者
额。。。
LS的脚本不知道怎么用哦。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

小小的百鬼夜行<

梦石
0
星屑
54
在线时间
579 小时
注册时间
2010-7-29
帖子
2682

贵宾

9
发表于 2010-8-11 07:52:04 | 只看该作者
应该直接在游戏里用脚本指定$game_system.chapter = 就行了吧..
某只PHP/HTML小白鼠→退屈の间


Cause I knew you were trouble when you walked in
So shame is on me now
I flow me to place i ve never been
till you put me down oh
Now Im lying on the cold hard ground
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-21 13:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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