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

Project1

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

[已经过期] 关于这种截图存档的问题。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
196
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
跳转到指定楼层
1
 楼主| 发表于 2013-2-17 21:32:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
可以改进改进,例如头像旁加个小小的血\魔条,还有就是像VA的截图存档一样,按下F6可以对该档案进行移动、复制、删除的操作。
  1. #===============================================================
  2. # ● [VX] ◦ Neo Save System III ◦ □
  3. #--------------------------------------------------------------
  4. # ◦ by Woratana [[email protected]]
  5. # ◦ Thaiware RPG Maker Community
  6. # ◦ Released on: 15/02/2009
  7. # ◦ Version: 3.0
  8. #--------------------------------------------------------------
  9. # ◦ Log III:
  10. # - Change back to draw tilemap as screenshot. Don't need any image.
  11. # - For drawing tilemap, the characters won't show on the tilemap.
  12. #--------------------------------------------------------------
  13. # ◦ Log II:
  14. # - Screenshot DLL is not work with Vista Aero, so I remove it
  15. # and use image for each map instead of screenshot.
  16. # - Actor's level in last version (V.1) is incorrect.
  17. #--------------------------------------------------------------
  18. # ◦ Features:
  19. # - Unlimited save slots, you can choose max save slot
  20. # - You can use image for scene's background
  21. # - Choose your save file's name, and folder to store save files
  22. # - Choose to show only information you want
  23. # - Editable text for information's title
  24. # - Draw tilemap for map that player is currently in.
  25. # - Remove text you don't want from map's name (e.g. tags for special script)
  26. # - Choose map that you don't want to show its name
  27. # - Include save confirmation window before overwrite old save
  28. #=================================================================

  29. module Wora_NSS
  30.   #==========================================================================
  31.   # * START NEO SAVE SYSTEM - SETUP
  32.   #--------------------------------------------------------------------------
  33.   NSS_WINDOW_OPACITY = 255 # All windows' opacity (Lowest 0 - 255 Highest)
  34.   # You can change this to 0 in case you want to use image for background
  35.   NSS_IMAGE_BG = '' # Background image file name, it must be in folder Picture.
  36.   # use '' for no background
  37.   NSS_IMAGE_BG_OPACITY = 255 # Opacity for background image
  38.   
  39.   MAX_SAVE_SLOT = 20 # Max save slots no.
  40.   SLOT_NAME = 'SLOT {id}'
  41.   # Name of the slot (show in save slots list), use {id} for slot ID
  42.   SAVE_FILE_NAME = 'Save{id}.rvdata'
  43.   # Save file name, you can also change its file type from .rvdata to other
  44.   # use {id} for save slot ID
  45.   SAVE_PATH = '' # Path to store save file, e.g. 'Save/' or '' (for game folder)
  46.   
  47.   SAVED_SLOT_ICON = 133 # Icon Index for saved slot
  48.   EMPTY_SLOT_ICON = 141 # Icon Index for empty slot
  49.   
  50.   EMPTY_SLOT_TEXT = '-NO DATA-' # Text to show for empty slot's data
  51.   
  52.   DRAW_GOLD = true # Draw Gold
  53.   DRAW_PLAYTIME = true # Draw Playtime
  54.   DRAW_LOCATION = true # Draw location
  55.   DRAW_FACE = true # Draw Actor's face
  56.   DRAW_LEVEL = true # Draw Actor's level
  57.   DRAW_NAME = true # Draw Actor's name
  58.   
  59.   PLAYTIME_TEXT = '游戏时间: '
  60.   GOLD_TEXT = '金钱: '
  61.   LOCATION_TEXT = '地点: '
  62.   LV_TEXT = 'Lv '
  63.   
  64.   MAP_NAME_TEXT_SUB = %w{}
  65.   # Text that you want to remove from map name,
  66.   # e.g. %w{[LN] [DA]} will remove text '[LN]' and '[DA]' from map name
  67.   MAP_NO_NAME_LIST = [] # ID of Map that will not show map name, e.g. [1,2,3]
  68.   MAP_NO_NAME_NAME = '??????????' # What you will use to call map in no name list
  69.   
  70.   MAP_BORDER = Color.new(0,0,0,200) # Map image border color (R,G,B,Opacity)
  71.   FACE_BORDER = Color.new(0,0,0,200) # Face border color
  72.   
  73.   ## SAVE CONFIRMATION WINDOW ##
  74.   SFC_Text_Confirm = 'Confirm to save' # Text to confirm to save file
  75.   SFC_Text_Cancel = 'Cancel' # Text to cancel to save
  76.   SFC_Window_Width = 200 # Width of Confirmation Window
  77.   SFC_Window_X_Offset = 0 # Move Confirmation Window horizontally
  78.   SFC_Window_Y_Offset = 0 # Move Confirmation Window vertically
  79.   #----------------------------------------------------------------------
  80.   # END NEO SAVE SYSTEM - SETUP
  81.   #=========================================================================
  82. end
  83.   
  84. class Scene_File < Scene_Base
  85.   include Wora_NSS
  86.   attr_reader :window_slotdetail
  87.   #--------------------------------------------------------------------------
  88.   # * Start processing
  89.   #--------------------------------------------------------------------------
  90.   def start
  91.     super
  92.     create_menu_background
  93.     if NSS_IMAGE_BG != ''
  94.       @bg = Sprite.new
  95.       @bg.bitmap = Cache.picture(NSS_IMAGE_BG)
  96.       @bg.opacity = NSS_IMAGE_BG_OPACITY
  97.     end
  98.     @help_window = Window_Help.new
  99.     command = []
  100.     (1..MAX_SAVE_SLOT).each do |i|
  101.       command << SLOT_NAME.clone.gsub!(/\{ID\}/i) { i.to_s }
  102.     end
  103.     @window_slotdetail = Window_NSS_SlotDetail.new
  104.     @window_slotlist = Window_SlotList.new(160, command)
  105.     @window_slotlist.y = @help_window.height
  106.     @window_slotlist.height = Graphics.height - @help_window.height
  107.     @help_window.opacity = NSS_WINDOW_OPACITY
  108.     @window_slotdetail.opacity = @window_slotlist.opacity = NSS_WINDOW_OPACITY
  109.    
  110.   # Create Folder for Save file
  111.   if SAVE_PATH != ''
  112.     Dir.mkdir(SAVE_PATH) if !FileTest.directory?(SAVE_PATH)
  113.   end
  114.     if @saving
  115.       @index = $game_temp.last_file_index
  116.       @help_window.set_text(Vocab::SaveMessage)
  117.     else
  118.       @index = self.latest_file_index
  119.       @help_window.set_text(Vocab::LoadMessage)
  120.       (1..MAX_SAVE_SLOT).each do |i|
  121.         @window_slotlist.draw_item(i-1, false) if !@window_slotdetail.file_exist?(i)
  122.       end
  123.     end
  124.     @window_slotlist.index = @index
  125.     # Draw Information
  126.     @last_slot_index = @window_slotlist.index
  127.     @window_slotdetail.draw_data(@last_slot_index + 1)
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # * Termination Processing
  131.   #--------------------------------------------------------------------------
  132.   def terminate
  133.     super
  134.     dispose_menu_background
  135.     unless @bg.nil?
  136.       @bg.bitmap.dispose
  137.       @bg.dispose
  138.     end
  139.     @window_slotlist.dispose
  140.     @window_slotdetail.dispose
  141.     @help_window.dispose
  142.   end
  143.   #---------------------------------------------------
  144.     def return_scene
  145.     if @from_title
  146.       $scene = Scene_Title.new
  147.     elsif @from_event
  148.       $scene = Scene_Map.new
  149.     else
  150.       $scene = Scene_Menu.new(4)
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # * Frame Update
  155.   #--------------------------------------------------------------------------
  156.   def update
  157.     super
  158.     if !@confirm_window.nil?
  159.       @confirm_window.update
  160.       if Input.trigger?(Input::C)
  161.         if @confirm_window.index == 0
  162.           determine_savefile
  163.           @confirm_window.dispose
  164.           @confirm_window = nil
  165.         else
  166.           Sound.play_cancel
  167.           @confirm_window.dispose
  168.           @confirm_window = nil
  169.         end
  170.       elsif Input.trigger?(Input::B)
  171.       Sound.play_cancel
  172.       @confirm_window.dispose
  173.       @confirm_window = nil
  174.       end
  175.     else
  176.       update_menu_background
  177.       @window_slotlist.update
  178.       if @window_slotlist.index != @last_slot_index
  179.         @last_slot_index = @window_slotlist.index
  180.         @window_slotdetail.draw_data(@last_slot_index + 1)
  181.       end
  182.       @help_window.update
  183.       update_savefile_selection
  184.     end
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # * Update Save File Selection
  188.   #--------------------------------------------------------------------------
  189.   def update_savefile_selection
  190.     if Input.trigger?(Input::C)
  191.       if @saving and @window_slotdetail.file_exist?(@last_slot_index + 1)
  192.         Sound.play_decision
  193.         text1 = SFC_Text_Confirm
  194.         text2 = SFC_Text_Cancel
  195.         @confirm_window = Window_Command.new(SFC_Window_Width,[text1,text2])
  196.         @confirm_window.x = ((544 - @confirm_window.width) / 2) + SFC_Window_X_Offset
  197.         @confirm_window.y = ((416 - @confirm_window.height) / 2) + SFC_Window_Y_Offset
  198.       else
  199.         determine_savefile
  200.       end
  201.     elsif Input.trigger?(Input::B)
  202.       Sound.play_cancel
  203.       return_scene
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # * Execute Save
  208.   #--------------------------------------------------------------------------
  209.   def do_save
  210.     file = File.open(make_filename(@last_slot_index), "wb")
  211.     write_save_data(file)
  212.     file.close
  213.     $scene = Scene_Map.new
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # * Execute Load
  217.   #--------------------------------------------------------------------------
  218.   def do_load
  219.     file = File.open(make_filename(@last_slot_index), "rb")
  220.     read_save_data(file)
  221.     file.close
  222.     $scene = Scene_Map.new
  223.     RPG::BGM.fade(1500)
  224.     Graphics.fadeout(60)
  225.     Graphics.wait(40)
  226.     @last_bgm.play
  227.     @last_bgs.play
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # * Confirm Save File
  231.   #--------------------------------------------------------------------------
  232.   def determine_savefile
  233.     if @saving
  234.       Sound.play_save
  235.       do_save
  236.     else
  237.       if @window_slotdetail.file_exist?(@last_slot_index + 1)
  238.         Sound.play_load
  239.         do_load
  240.       else
  241.         Sound.play_buzzer
  242.         return
  243.       end
  244.     end
  245.     $game_temp.last_file_index = @last_slot_index
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # * Create Filename
  249.   #     file_index : save file index (0-3)
  250.   #--------------------------------------------------------------------------
  251.   def make_filename(file_index)
  252.     return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index + 1).to_s }
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # * Select File With Newest Timestamp
  256.   #--------------------------------------------------------------------------
  257.   def latest_file_index
  258.     latest_index = 0
  259.     latest_time = Time.at(0)
  260.     (1..MAX_SAVE_SLOT).each do |i|
  261.       file_name = make_filename(i - 1)
  262.       next if !@window_slotdetail.file_exist?(i)
  263.       file_time = File.mtime(file_name)
  264.       if file_time > latest_time
  265.         latest_time = file_time
  266.         latest_index = i - 1
  267.       end
  268.     end
  269.     return latest_index
  270.   end
  271. end

  272. class Window_SlotList < Window_Command
  273.   #--------------------------------------------------------------------------
  274.   # * Draw Item
  275.   #--------------------------------------------------------------------------
  276.   def draw_item(index, enabled = true)
  277.     rect = item_rect(index)
  278.     rect.x += 4
  279.     rect.width -= 8
  280.     icon_index = 0
  281.     self.contents.clear_rect(rect)
  282.     if $scene.window_slotdetail.file_exist?(index + 1)
  283.       icon_index = Wora_NSS::SAVED_SLOT_ICON
  284.     else
  285.       icon_index = Wora_NSS::EMPTY_SLOT_ICON
  286.     end
  287.     if !icon_index.nil?
  288.       rect.x -= 4
  289.       draw_icon(icon_index, rect.x, rect.y, enabled) # Draw Icon
  290.       rect.x += 26
  291.       rect.width -= 20
  292.     end
  293.     self.contents.clear_rect(rect)
  294.     self.contents.font.color = normal_color
  295.     self.contents.font.color.alpha = enabled ? 255 : 128
  296.     self.contents.draw_text(rect, @commands[index])
  297.   end
  298.   
  299.   def cursor_down(wrap = false)
  300.     if @index < @item_max - 1 or wrap
  301.       @index = (@index + 1) % @item_max
  302.     end
  303.   end

  304.   def cursor_up(wrap = false)
  305.     if @index > 0 or wrap
  306.       @index = (@index - 1 + @item_max) % @item_max
  307.     end
  308.   end
  309. end

  310. class Window_NSS_SlotDetail < Window_Base
  311.   include Wora_NSS
  312.   def initialize
  313.     super(160, 56, 384, 360)
  314.     @data = []
  315.     @exist_list = []
  316.     @bitmap_list = {}
  317.     @map_name = []
  318.   end
  319.   
  320.   def dispose
  321.     dispose_tilemap
  322.     super
  323.   end

  324.   def draw_data(slot_id)
  325.     contents.clear # 352, 328
  326.     dispose_tilemap
  327.     load_save_data(slot_id) if @data[slot_id].nil?
  328.     if @exist_list[slot_id]
  329.       save_data = @data[slot_id]
  330.       # DRAW SCREENSHOT~
  331.       contents.fill_rect(0,30,352,160, MAP_BORDER)
  332.       create_tilemap(save_data['gamemap'].data, save_data['gamemap'].display_x,
  333.     save_data['gamemap'].display_y)
  334.       if DRAW_GOLD
  335.         # DRAW GOLD
  336.         gold_textsize = contents.text_size(save_data['gamepar'].gold).width
  337.         goldt_textsize = contents.text_size(GOLD_TEXT).width
  338.         contents.font.color = system_color
  339.         contents.draw_text(0, 0, goldt_textsize, WLH, GOLD_TEXT)
  340.         contents.draw_text(goldt_textsize + gold_textsize,0,200,WLH, Vocab::gold)
  341.         contents.font.color = normal_color
  342.         contents.draw_text(goldt_textsize, 0, gold_textsize, WLH, save_data['gamepar'].gold)
  343.       end
  344.       if DRAW_PLAYTIME
  345.         # DRAW PLAYTIME
  346.         hour = save_data['total_sec'] / 60 / 60
  347.         min = save_data['total_sec'] / 60 % 60
  348.         sec = save_data['total_sec'] % 60
  349.         time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  350.         pt_textsize = contents.text_size(PLAYTIME_TEXT).width
  351.         ts_textsize = contents.text_size(time_string).width
  352.         contents.font.color = system_color
  353.         contents.draw_text(contents.width - ts_textsize - pt_textsize, 0,
  354.         pt_textsize, WLH, PLAYTIME_TEXT)
  355.         contents.font.color = normal_color
  356.         contents.draw_text(0, 0, contents.width, WLH, time_string, 2)
  357.       end
  358.       if DRAW_LOCATION
  359.         # DRAW LOCATION
  360.         lc_textsize = contents.text_size(LOCATION_TEXT).width
  361.         mn_textsize = contents.text_size(save_data['map_name']).width
  362.         contents.font.color = system_color
  363.         contents.draw_text(0, 190, contents.width,
  364.         WLH, LOCATION_TEXT)
  365.         contents.font.color = normal_color
  366.         contents.draw_text(lc_textsize, 190, contents.width, WLH,
  367.         save_data['map_name'])
  368.       end
  369.         # DRAW FACE & Level & Name
  370.         save_data['gamepar'].members.each_index do |i|
  371.           actor = save_data['gameactor'][save_data['gamepar'].members[i].id]
  372.           face_x_base = (i*80) + (i*8)
  373.           face_y_base = 216
  374.           lvn_y_plus = 10
  375.           lv_textsize = contents.text_size(actor.level).width
  376.           lvt_textsize = contents.text_size(LV_TEXT).width
  377.         if DRAW_FACE
  378.           # Draw Face
  379.           contents.fill_rect(face_x_base, face_y_base, 84, 84, FACE_BORDER)
  380.           draw_face(actor.face_name, actor.face_index, face_x_base + 2,
  381.           face_y_base + 2, 80)
  382.         end
  383.         if DRAW_LEVEL
  384.           # Draw Level
  385.           contents.font.color = system_color
  386.           contents.draw_text(face_x_base + 2 + 80 - lv_textsize - lvt_textsize,
  387.           face_y_base + 2 + 80 - WLH + lvn_y_plus, lvt_textsize, WLH, LV_TEXT)
  388.           contents.font.color = normal_color
  389.           contents.draw_text(face_x_base + 2 + 80 - lv_textsize,
  390.           face_y_base + 2 + 80 - WLH + lvn_y_plus, lv_textsize, WLH, actor.level)
  391.         end
  392.         if DRAW_NAME
  393.           # Draw Name
  394.           contents.draw_text(face_x_base, face_y_base + 2 + 80 + lvn_y_plus - 6, 84,
  395.           WLH, actor.name, 1)
  396.         end
  397.       end
  398.     else
  399.       contents.draw_text(0,0, contents.width, contents.height - WLH, EMPTY_SLOT_TEXT, 1)
  400.     end
  401.   end
  402.   
  403.   def load_save_data(slot_id)
  404.     file_name = make_filename(slot_id)
  405.     if file_exist?(slot_id) or FileTest.exist?(file_name)
  406.       @exist_list[slot_id] = true
  407.       @data[slot_id] = {}
  408.       # Start load data
  409.       file = File.open(file_name, "r")
  410.       @data[slot_id]['time'] = file.mtime
  411.       @data[slot_id]['char'] = Marshal.load(file)
  412.       @data[slot_id]['frame'] = Marshal.load(file)
  413.       @data[slot_id]['last_bgm'] = Marshal.load(file)
  414.       @data[slot_id]['last_bgs'] = Marshal.load(file)
  415.       @data[slot_id]['gamesys'] = Marshal.load(file)
  416.       @data[slot_id]['gamemes'] = Marshal.load(file)
  417.       @data[slot_id]['gameswi'] = Marshal.load(file)
  418.       @data[slot_id]['gamevar'] = Marshal.load(file)
  419.       @data[slot_id]['gameselfvar'] = Marshal.load(file)
  420.       @data[slot_id]['gameactor'] = Marshal.load(file)
  421.       @data[slot_id]['gamepar'] = Marshal.load(file)
  422.       @data[slot_id]['gametro'] = Marshal.load(file)
  423.       @data[slot_id]['gamemap'] = Marshal.load(file)
  424.       @data[slot_id]['total_sec'] = @data[slot_id]['frame'] / Graphics.frame_rate
  425.       @data[slot_id]['map_name'] = get_mapname(@data[slot_id]['gamemap'].map_id)
  426.       file.close
  427.     else
  428.       @exist_list[slot_id] = false
  429.       @data[slot_id] = -1
  430.     end
  431.   end

  432.   def make_filename(file_index)
  433.     return SAVE_PATH + SAVE_FILE_NAME.gsub(/\{ID\}/i) { (file_index).to_s }
  434.   end
  435.   
  436.   def file_exist?(slot_id)
  437.     return @exist_list[slot_id] if !@exist_list[slot_id].nil?
  438.     @exist_list[slot_id] = FileTest.exist?(make_filename(slot_id))
  439.     return @exist_list[slot_id]
  440.   end

  441.   def get_mapname(map_id)
  442.     if @map_data.nil?
  443.       @map_data = load_data("Data/MapInfos.rvdata")
  444.     end
  445.     if @map_name[map_id].nil?
  446.       if MAP_NO_NAME_LIST.include?(map_id)
  447.         @map_name[map_id] = MAP_NO_NAME_NAME
  448.       else
  449.         @map_name[map_id] = @map_data[map_id].name
  450.         MAP_NAME_TEXT_SUB.each_index do |i|
  451.           @map_name[map_id].sub!(MAP_NAME_TEXT_SUB[i], '')
  452.         end
  453.       end
  454.     end
  455.     return @map_name[map_id]
  456.   end
  457.   
  458.   def create_tilemap(map_data, ox, oy)
  459.     @viewport = Viewport.new(self.x + 2 + 16, self.y + 32 + 16, 348,156)
  460.     @viewport.z = self.z
  461.     @tilemap = Tilemap.new(@viewport)
  462.     @tilemap.bitmaps[0] = Cache.system("TileA1")
  463.     @tilemap.bitmaps[1] = Cache.system("TileA2")
  464.     @tilemap.bitmaps[2] = Cache.system("TileA3")
  465.     @tilemap.bitmaps[3] = Cache.system("TileA4")
  466.     @tilemap.bitmaps[4] = Cache.system("TileA5")
  467.     @tilemap.bitmaps[5] = Cache.system("TileB")
  468.     @tilemap.bitmaps[6] = Cache.system("TileC")
  469.     @tilemap.bitmaps[7] = Cache.system("TileD")
  470.     @tilemap.bitmaps[8] = Cache.system("TileE")
  471.     @tilemap.map_data = map_data
  472.     @tilemap.ox = ox / 8 + 99
  473.     @tilemap.oy = oy / 8 + 90
  474.   end
  475.   
  476.   def dispose_tilemap
  477.     unless @tilemap.nil?
  478.       @tilemap.dispose
  479.       @tilemap = nil
  480.     end
  481.   end
  482. end

  483. class Scene_Title < Scene_Base
  484.   def check_continue
  485.     file_name = Wora_NSS::SAVE_PATH + Wora_NSS::SAVE_FILE_NAME.gsub(/\{ID\}/i) { '*' }
  486.     @continue_enabled = (Dir.glob(file_name).size > 0)
  487.   end
  488. end
  489. #======================================================================
  490. # END - NEO SAVE SYSTEM by Woratana
  491. #======================================================================
复制代码

——旧坑欢迎戳
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-12-23 01:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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