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

Project1

 找回密码
 注册会员
搜索

想在Yanfly大佬的存档脚本的基础上改一下(自娱自乐不商业)

查看数: 4623 | 评论数: 15 | 收藏 3
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2019-9-8 11:18

正文摘要:

本帖最后由 VIPArcher 于 2019-9-9 00:39 编辑 想在Yanfly大佬的存档脚本的基础上加个是否覆盖存档的存档提示-(已经搜了站内有关存档提示的脚本&扒下以前玩的游戏的存档提示的脚本(它们没用Yanfly大佬的存档脚本 ...

回复

杰克苏 发表于 2019-9-17 21:36:32
KB.Driver 发表于 2019-9-12 13:03
#==============================================================================
#
# ▼ Yanfly Eng ...

大佬,经过我花了1个钟头没整成后放弃然后画人体画的因为搞代码的原因画不下去继续搞代码之下,10多分钟就完成啦,感谢大佬改得代码以及这些天的指导!!!我是学角色设计的,如果有需要又不多的角色的话,我一定帮大佬一臂之力!!!
杰克苏 发表于 2019-9-17 20:18:00
KB.Driver 发表于 2019-9-12 13:03
#==============================================================================
#
# ▼ Yanfly Eng ...

大佬.....想问一下rect.y -= line_height和rect.y += line_height 后面输入数值有什么不同,以及y + line_height / 60 - 1里面60和1位置的数分别代表什么.....搞了一个钟头还没有成功T-T
KB.Driver 发表于 2019-9-17 15:34:31
杰克苏 发表于 2019-9-17 08:58
大佬打扰了,我将这段还未修改的绘制水平线的代码复制粘贴到大佬第二次修改的代码相比第一次修改的代码多 ...

def draw_hoz_line这段完整拷贝到Window_Overlap里面
在def draw_all_items里的draw_text(...)和super之间加一行,
写draw_horz_line(line_height)
杰克苏 发表于 2019-9-16 21:30:02
杰克苏 发表于 2019-9-12 21:38
谢谢大佬,大佬那个存档界面能改成这样的吗(就是在描述和选项中间加一根分割线)?如果可行的话有空的时候 ...

好的谢谢
574656549 发表于 2019-9-12 18:56:36
提示: 作者被禁止或删除 内容自动屏蔽
574656549 发表于 2019-9-12 18:55:44
提示: 作者被禁止或删除 内容自动屏蔽
KB.Driver 发表于 2019-9-12 13:03:21
杰克苏 发表于 2019-9-12 08:39
大佬已给金币,马后炮地问一下,在覆盖/取消上面加个是否覆盖此存档的陈述难吗?不难地话能告知下怎么微调 ...

RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - 存档系统 v1.03
  4. # -- 最后更新: 2012.07.22
  5. # -- 使用难度: 普通
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SaveEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.07.22 - Fixed: Location Drawing.
  17. # 2012.01.23 - Anti-crash method added for removed maps.
  18. # 2011.12.26 - Compatibility Update: New Game+
  19. # 2011.12.26 - Started Script and Finished.
  20. #
  21. #==============================================================================
  22. # ▼ 介绍
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
  25. # 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
  26. #
  27. # 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
  28. # 需要你重新读档并再次存档。
  29. #
  30. #==============================================================================
  31. # ▼ 安装方式
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  34. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  35. #
  36. #==============================================================================
  37. # ▼ 兼容性
  38. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  39. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  40. #
  41. #==============================================================================
  42.  
  43. module YEA
  44.   module SAVE
  45.  
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # - 存档文件窗口设置 -
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.  
  50.     MAX_FILES = 16         # 最大存档数. 默认: 16
  51.     SLOT_NAME = "Save %s"  # 存档文件文本.
  52.  
  53.     # These are the icons
  54.     SAVE_ICON  = 368       # 已存档的图标
  55.     EMPTY_ICON = 375       # 未存档的图标
  56.  
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # - 指令窗口设置 -
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.  
  61.     ACTION_LOAD   = "载入"           # 载入的文本.
  62.     ACTION_SAVE   = "存档"           # 存档的文本.
  63.     ACTION_DELETE = "删除"           # 删除的文本.
  64.     DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.
  65.  
  66.     # 在帮助窗口中显示的文本.
  67.     SELECT_HELP = "请选择一个存档文件."
  68.     LOAD_HELP   = "从已保存数据中载入."
  69.     SAVE_HELP   = "保存当前游戏数据."
  70.     DELETE_HELP = "删除全部已保存数据."
  71.  
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # - 覆盖窗口设置 -
  74.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  75.  
  76.     ACTION_OVERLAP = "覆盖"
  77.     ACTION_CANCEL  = "取消"
  78.     OVERLAP_HELP   = "是否覆盖此存档?"
  79.  
  80.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  81.     # - 游戏状态窗口文本 -
  82.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  83.  
  84.     EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
  85.     PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
  86.     TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
  87.     TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
  88.     LOCATION   = "地点: "          # 地点的文本.
  89.  
  90.     # 在数组中填入你想要显示变量数值的变量ID,0为不显示
  91.     COLUMN1_VARIABLES = [381, 390, 495]
  92.     COLUMN2_VARIABLES = [707, 5, 6]
  93.  
  94.   end # SAVE
  95. end # YEA
  96.  
  97. #==============================================================================
  98. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  99. # 所以编辑了后果自负。
  100. #==============================================================================
  101.  
  102. #==============================================================================
  103. # ■ Icon
  104. #==============================================================================
  105.  
  106. module Icon
  107.  
  108.   #--------------------------------------------------------------------------
  109.   # self.save_icon
  110.   #--------------------------------------------------------------------------
  111.   def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  112.  
  113.   #--------------------------------------------------------------------------
  114.   # self.empty_icon
  115.   #--------------------------------------------------------------------------
  116.   def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
  117.  
  118. end # Icon
  119.  
  120. #==============================================================================
  121. # ■ Numeric
  122. #==============================================================================
  123.  
  124. class Numeric
  125.  
  126.   #--------------------------------------------------------------------------
  127.   # new method: group_digits
  128.   #--------------------------------------------------------------------------
  129.   unless $imported["YEA-CoreEngine"]
  130.   def group; return self.to_s; end
  131.   end # $imported["YEA-CoreEngine"]
  132.  
  133. end # Numeric
  134.  
  135. #==============================================================================
  136. # ■ DataManager
  137. #==============================================================================
  138.  
  139. module DataManager
  140.  
  141.   #--------------------------------------------------------------------------
  142.   # overwrite method: savefile_max
  143.   #--------------------------------------------------------------------------
  144.   def self.savefile_max
  145.     return YEA::SAVE::MAX_FILES
  146.   end
  147.  
  148.   #--------------------------------------------------------------------------
  149.   # overwrite method: self.make_save_header
  150.   #--------------------------------------------------------------------------
  151.   def self.make_save_header
  152.     header = {}
  153.     header[:characters]    = $game_party.characters_for_savefile
  154.     header[:playtime_s]    = $game_system.playtime_s
  155.     header[:system]        = Marshal.load(Marshal.dump($game_system))
  156.     header[:timer]         = Marshal.load(Marshal.dump($game_timer))
  157.     header[:message]       = Marshal.load(Marshal.dump($game_message))
  158.     header[:switches]      = Marshal.load(Marshal.dump($game_switches))
  159.     header[:variables]     = Marshal.load(Marshal.dump($game_variables))
  160.     header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
  161.     header[:actors]        = Marshal.load(Marshal.dump($game_actors))
  162.     header[:party]         = Marshal.load(Marshal.dump($game_party))
  163.     header[:troop]         = Marshal.load(Marshal.dump($game_troop))
  164.     header[:map]           = Marshal.load(Marshal.dump($game_map))
  165.     header[:player]        = Marshal.load(Marshal.dump($game_player))
  166.     header
  167.   end
  168.  
  169. end # DataManager
  170.  
  171. #==============================================================================
  172. # ■ Window_MenuCommand
  173. #==============================================================================
  174.  
  175. class Window_MenuCommand < Window_Command
  176.  
  177.   #--------------------------------------------------------------------------
  178.   # overwrite method: save_enabled
  179.   #--------------------------------------------------------------------------
  180.   def save_enabled; return true; end
  181.  
  182. end # Window_MenuCommand
  183.  
  184. #==============================================================================
  185. # ■ Window_FileList
  186. #==============================================================================
  187.  
  188. class Window_FileList < Window_Selectable
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # initialize
  192.   #--------------------------------------------------------------------------
  193.   def initialize(dx, dy)
  194.     super(dx, dy, 128, Graphics.height - dy)
  195.     refresh
  196.     activate
  197.     select(SceneManager.scene.first_savefile_index)
  198.   end
  199.  
  200.   #--------------------------------------------------------------------------
  201.   # item_max
  202.   #--------------------------------------------------------------------------
  203.   def item_max; return DataManager.savefile_max; end
  204.  
  205.   #--------------------------------------------------------------------------
  206.   # current_item_enabled?
  207.   #--------------------------------------------------------------------------
  208.   def current_item_enabled?
  209.     header = DataManager.load_header(index)
  210.     return false if header.nil? && SceneManager.scene_is?(Scene_Load)
  211.     return true
  212.   end
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # refresh
  216.   #--------------------------------------------------------------------------
  217.   def refresh
  218.     create_contents
  219.     draw_all_items
  220.   end
  221.  
  222.   #--------------------------------------------------------------------------
  223.   # draw_item
  224.   #--------------------------------------------------------------------------
  225.   def draw_item(index)
  226.     header = DataManager.load_header(index)
  227.     enabled = !header.nil?
  228.     rect = item_rect(index)
  229.     rect.width -= 4
  230.     draw_icon(save_icon?(header), rect.x, rect.y, enabled)
  231.     change_color(normal_color, enabled)
  232.     text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
  233.     draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  234.   end
  235.  
  236.   #--------------------------------------------------------------------------
  237.   # save_icon?
  238.   #--------------------------------------------------------------------------
  239.   def save_icon?(header)
  240.     return Icon.empty_icon if header.nil?
  241.     return Icon.save_icon
  242.   end
  243.  
  244. end # Window_FileList
  245.  
  246. #==============================================================================
  247. # ■ Window_FileStatus
  248. #==============================================================================
  249.  
  250. class Window_FileStatus < Window_Base
  251.  
  252.   #--------------------------------------------------------------------------
  253.   # initialize
  254.   #--------------------------------------------------------------------------
  255.   def initialize(dx, dy, file_window)
  256.     super(dx, dy, Graphics.width - dx, Graphics.height - dy)
  257.     @file_window = file_window
  258.     @current_index = @file_window.index
  259.     refresh
  260.   end
  261.  
  262.   #--------------------------------------------------------------------------
  263.   # update
  264.   #--------------------------------------------------------------------------
  265.   def update
  266.     super
  267.     return if @file_window.index < 0
  268.     return if @current_index == @file_window.index
  269.     @current_index = @file_window.index
  270.     refresh
  271.   end
  272.  
  273.   #--------------------------------------------------------------------------
  274.   # refresh
  275.   #--------------------------------------------------------------------------
  276.   def refresh
  277.     contents.clear
  278.     reset_font_settings
  279.     @header = DataManager.load_header(@file_window.index)
  280.     if @header.nil?
  281.       draw_empty
  282.     else
  283.       draw_save_contents
  284.     end
  285.   end
  286.  
  287.   #--------------------------------------------------------------------------
  288.   # draw_empty
  289.   #--------------------------------------------------------------------------
  290.   def draw_empty
  291.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  292.     rect = Rect.new(0, 0, contents.width, contents.height)
  293.     contents.fill_rect(rect, colour)
  294.     text = YEA::SAVE::EMPTY_TEXT
  295.     change_color(system_color)
  296.     draw_text(rect, text, 1)
  297.   end
  298.  
  299.   #--------------------------------------------------------------------------
  300.   # draw_save_slot
  301.   #--------------------------------------------------------------------------
  302.   def draw_save_slot(dx, dy, dw)
  303.     reset_font_settings
  304.     change_color(system_color)
  305.     text = sprintf(YEA::SAVE::SLOT_NAME, "")
  306.     draw_text(dx, dy, dw, line_height, text)
  307.     cx = text_size(text).width
  308.     change_color(normal_color)
  309.     draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  310.   end
  311.  
  312.   #--------------------------------------------------------------------------
  313.   # draw_save_playtime
  314.   #--------------------------------------------------------------------------
  315.   def draw_save_playtime(dx, dy, dw)
  316.     return if @header[:playtime_s].nil?
  317.     reset_font_settings
  318.     change_color(system_color)
  319.     draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
  320.     change_color(normal_color)
  321.     draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  322.   end
  323.  
  324.   #--------------------------------------------------------------------------
  325.   # draw_save_total_saves
  326.   #--------------------------------------------------------------------------
  327.   def draw_save_total_saves(dx, dy, dw)
  328.     return if @header[:system].nil?
  329.     reset_font_settings
  330.     change_color(system_color)
  331.     text = YEA::SAVE::TOTAL_SAVE
  332.     draw_text(dx, dy, dw, line_height, text)
  333.     cx = text_size(text).width
  334.     change_color(normal_color)
  335.     draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  336.   end
  337.  
  338.   #--------------------------------------------------------------------------
  339.   # draw_save_gold
  340.   #--------------------------------------------------------------------------
  341.   def draw_save_gold(dx, dy, dw)
  342.     return if @header[:party].nil?
  343.     reset_font_settings
  344.     change_color(system_color)
  345.     draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
  346.     text = Vocab::currency_unit
  347.     draw_text(dx, dy, dw, line_height, text, 2)
  348.     cx = text_size(text).width
  349.     change_color(normal_color)
  350.     text = @header[:party].gold.group
  351.     draw_text(dx, dy, dw-cx, line_height, text, 2)
  352.   end
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # draw_save_location
  356.   #--------------------------------------------------------------------------
  357.   def draw_save_location(dx, dy, dw)
  358.     return if @header[:map].nil?
  359.     reset_font_settings
  360.     change_color(system_color)
  361.     draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
  362.     change_color(normal_color)
  363.     cx = text_size(YEA::SAVE::LOCATION).width
  364.     return if $data_mapinfos[@header[:map].map_id].nil?
  365.     text = @header[:map].display_name
  366.     text = $data_mapinfos[@header[:map].map_id].name if text == ""
  367.     draw_text(dx+cx, dy, dw-cx, line_height, text)
  368.   end
  369.  
  370.   #--------------------------------------------------------------------------
  371.   # draw_save_characters
  372.   #--------------------------------------------------------------------------
  373.   def draw_save_characters(dx, dy)
  374.     return if @header[:party].nil?
  375.     reset_font_settings
  376.     make_font_smaller
  377.     dw = (contents.width - dx) / @header[:party].max_battle_members
  378.     dx += dw/2
  379.     for member in @header[:party].battle_members
  380.       next if member.nil?
  381.       member = @header[:actors][member.id]
  382.       change_color(normal_color)
  383.       draw_actor_graphic(member, dx, dy)
  384.       text = member.name
  385.       draw_text(dx-dw/2, dy, dw, line_height, text, 1)
  386.       text = member.level.group
  387.       draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
  388.       cx = text_size(text).width
  389.       change_color(system_color)
  390.       text = Vocab::level_a
  391.       draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
  392.       dx += dw
  393.     end
  394.   end
  395.  
  396.   #--------------------------------------------------------------------------
  397.   # draw_save_column1
  398.   #--------------------------------------------------------------------------
  399.   def draw_save_column1(dx, dy, dw)
  400.     data = YEA::SAVE::COLUMN1_VARIABLES
  401.     draw_column_data(data, dx, dy, dw)
  402.   end
  403.  
  404.   #--------------------------------------------------------------------------
  405.   # draw_save_column2
  406.   #--------------------------------------------------------------------------
  407.   def draw_save_column2(dx, dy, dw)
  408.     data = YEA::SAVE::COLUMN2_VARIABLES
  409.     draw_column_data(data, dx, dy, dw)
  410.   end
  411.  
  412.   #--------------------------------------------------------------------------
  413.   # draw_column_data
  414.   #--------------------------------------------------------------------------
  415.   def draw_column_data(data, dx, dy, dw)
  416.     return if @header[:variables].nil?
  417.     reset_font_settings
  418.     for variable_id in data
  419.       next if $data_system.variables[variable_id].nil?
  420.       change_color(system_color)
  421.       name = $data_system.variables[variable_id]
  422.       draw_text(dx, dy, dw, line_height, name, 0)
  423.       value = @header[:variables][variable_id].group
  424.       change_color(normal_color)
  425.       draw_text(dx, dy, dw, line_height, value, 2)
  426.       dy += line_height
  427.     end
  428.   end
  429.  
  430.   #--------------------------------------------------------------------------
  431.   # draw_save_contents
  432.   #--------------------------------------------------------------------------
  433.   def draw_save_contents
  434.     draw_save_slot(4, 0, contents.width/2-8)
  435.     draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
  436.     draw_save_total_saves(4, line_height, contents.width/2-8)
  437.     draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
  438.     draw_save_location(4, line_height*2, contents.width-8)
  439.     draw_save_characters(0, line_height*5 + line_height/3)
  440.     draw_save_column1(16, line_height*7, contents.width/2-48)
  441.     draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  442.   end
  443.  
  444. end # Window_FileStatus
  445.  
  446. #==============================================================================
  447. # ■ Window_FileAction
  448. #==============================================================================
  449.  
  450. class Window_FileAction < Window_HorzCommand
  451.  
  452.   #--------------------------------------------------------------------------
  453.   # initialize
  454.   #--------------------------------------------------------------------------
  455.   def initialize(dx, dy, file_window)
  456.     @file_window = file_window
  457.     super(dx, dy)
  458.     deactivate
  459.     unselect
  460.   end
  461.  
  462.   #--------------------------------------------------------------------------
  463.   # window_width
  464.   #--------------------------------------------------------------------------
  465.   def window_width; Graphics.width - 128; end
  466.  
  467.   #--------------------------------------------------------------------------
  468.   # col_max
  469.   #--------------------------------------------------------------------------
  470.   def col_max; return 3; end
  471.  
  472.   #--------------------------------------------------------------------------
  473.   # update
  474.   #--------------------------------------------------------------------------
  475.   def update
  476.     super
  477.     return if @file_window.index < 0
  478.     return if @current_index == @file_window.index
  479.     @current_index = @file_window.index
  480.     refresh
  481.   end
  482.  
  483.   #--------------------------------------------------------------------------
  484.   # make_command_list
  485.   #--------------------------------------------------------------------------
  486.   def make_command_list
  487.     @header = DataManager.load_header(@file_window.index)
  488.     add_load_command
  489.     add_save_command
  490.     add_delete_command
  491.   end
  492.  
  493.   #--------------------------------------------------------------------------
  494.   # add_load_command
  495.   #--------------------------------------------------------------------------
  496.   def add_load_command
  497.     add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  498.   end
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # load_enabled?
  502.   #--------------------------------------------------------------------------
  503.   def load_enabled?
  504.     return false if @header.nil?
  505.     return true
  506.   end
  507.  
  508.   #--------------------------------------------------------------------------
  509.   # add_save_command
  510.   #--------------------------------------------------------------------------
  511.   def add_save_command
  512.     add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  513.   end
  514.  
  515.   #--------------------------------------------------------------------------
  516.   # save_enabled?
  517.   #--------------------------------------------------------------------------
  518.   def save_enabled?
  519.     return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
  520.     return false if SceneManager.scene_is?(Scene_Load)
  521.     return false if $game_system.save_disabled
  522.     return true
  523.   end
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # add_delete_command
  527.   #--------------------------------------------------------------------------
  528.   def add_delete_command
  529.     add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  530.   end
  531.  
  532.   #--------------------------------------------------------------------------
  533.   # delete_enabled?
  534.   #--------------------------------------------------------------------------
  535.   def delete_enabled?
  536.     return false if @header.nil?
  537.     return true
  538.   end
  539.  
  540.   #--------------------------------------------------------------------------
  541.   # update_help
  542.   #--------------------------------------------------------------------------
  543.   def update_help
  544.     case current_symbol
  545.     when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
  546.     when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
  547.     when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
  548.     end
  549.   end
  550.  
  551. end # Window_FileAction
  552.  
  553. #==============================================================================
  554. # ■ Scene_File
  555. #==============================================================================
  556.  
  557. class Scene_File < Scene_MenuBase
  558.  
  559.   #--------------------------------------------------------------------------
  560.   # overwrite method: start
  561.   #--------------------------------------------------------------------------
  562.   def start
  563.     super
  564.     create_all_windows
  565.   end
  566.  
  567.   #--------------------------------------------------------------------------
  568.   # overwrite method: terminate
  569.   #--------------------------------------------------------------------------
  570.   def terminate
  571.     super
  572.   end
  573.  
  574.   #--------------------------------------------------------------------------
  575.   # overwrite method: update
  576.   #--------------------------------------------------------------------------
  577.   def update
  578.     super
  579.   end
  580.  
  581.   #--------------------------------------------------------------------------
  582.   # new method: create_all_windows
  583.   #--------------------------------------------------------------------------
  584.   def create_all_windows
  585.     create_help_window
  586.     create_file_window
  587.     create_action_window
  588.     create_status_window
  589.   end
  590.  
  591.   #--------------------------------------------------------------------------
  592.   # overwrite method: create_help_window
  593.   #--------------------------------------------------------------------------
  594.   def create_help_window
  595.     @help_window = Window_Help.new
  596.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  597.   end
  598.  
  599.   #--------------------------------------------------------------------------
  600.   # new method: create_file_window
  601.   #--------------------------------------------------------------------------
  602.   def create_file_window
  603.     wy = @help_window.height
  604.     @file_window = Window_FileList.new(0, wy)
  605.     @file_window.set_handler(:ok, method(:on_file_ok))
  606.     @file_window.set_handler(:cancel, method(:return_scene))
  607.   end
  608.  
  609.   #--------------------------------------------------------------------------
  610.   # new method: create_action_window
  611.   #--------------------------------------------------------------------------
  612.   def create_action_window
  613.     wx = @file_window.width
  614.     wy = @help_window.height
  615.     @action_window = Window_FileAction.new(wx, wy, @file_window)
  616.     @action_window.help_window = @help_window
  617.     @action_window.set_handler(:cancel, method(:on_action_cancel))
  618.     @action_window.set_handler(:load, method(:on_action_load))
  619.     @action_window.set_handler(:save, method(:on_action_save))
  620.     @action_window.set_handler(:delete, method(:on_action_delete))
  621.   end
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # new method: create_status_window
  625.   #--------------------------------------------------------------------------
  626.   def create_status_window
  627.     wx = @action_window.x
  628.     wy = @action_window.y + @action_window.height
  629.     @status_window = Window_FileStatus.new(wx, wy, @file_window)
  630.   end
  631.  
  632.   #--------------------------------------------------------------------------
  633.   # new method: on_file_ok
  634.   #--------------------------------------------------------------------------
  635.   def on_file_ok
  636.     @action_window.activate
  637.     index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
  638.     @action_window.select(index)
  639.   end
  640.  
  641.   #--------------------------------------------------------------------------
  642.   # new method: on_action_cancel
  643.   #--------------------------------------------------------------------------
  644.   def on_action_cancel
  645.     @action_window.unselect
  646.     @file_window.activate
  647.     @help_window.set_text(YEA::SAVE::SELECT_HELP)
  648.   end
  649.  
  650.   #--------------------------------------------------------------------------
  651.   # new method: on_action_load
  652.   #--------------------------------------------------------------------------
  653.   def on_action_load
  654.     if DataManager.load_game(@file_window.index)
  655.       on_load_success
  656.     else
  657.       Sound.play_buzzer
  658.     end
  659.   end
  660.  
  661.   #--------------------------------------------------------------------------
  662.   # overwrite method: on_load_success
  663.   #--------------------------------------------------------------------------
  664.   def on_load_success
  665.     Sound.play_load
  666.     fadeout_all
  667.     $game_system.on_after_load
  668.     SceneManager.goto(Scene_Map)
  669.   end
  670.  
  671.   #--------------------------------------------------------------------------
  672.   # new method: on_action_save
  673.   #--------------------------------------------------------------------------
  674.   def on_action_save
  675.     @action_window.activate
  676.     if DataManager.save_game(@file_window.index)
  677.       on_save_success
  678.       refresh_windows
  679.     else
  680.       Sound.play_buzzer
  681.     end
  682.   end
  683.  
  684. #~   # 此处修改 ----------------------------------------------------------------
  685. #~   alias on_action_save_original on_action_save
  686. #~   def on_action_save
  687. #~     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
  688. #~       @action_window.deactivate
  689. #~       @overlap_window.show.open.activate
  690. #~     else
  691. #~       on_action_save_with_overlap
  692. #~     end
  693. #~   end
  694. #~   
  695. #~   def on_action_save_with_overlap
  696. #~     on_action_save_original
  697. #~     on_action_save_cancel
  698. #~   end
  699. #~   
  700. #~   def on_action_save_cancel
  701. #~     @action_window.activate
  702. #~     @overlap_window.hide.close.deactivate
  703. #~   end
  704. #~   # -------------------------------------------------------------------------  
  705.  
  706.  
  707.   #--------------------------------------------------------------------------
  708.   # overwrite method: on_save_success
  709.   #--------------------------------------------------------------------------
  710.   def on_save_success; Sound.play_save; end
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # new method: on_action_delete
  714.   #--------------------------------------------------------------------------
  715.   def on_action_delete
  716.     @action_window.activate
  717.     DataManager.delete_save_file(@file_window.index)
  718.     on_delete_success
  719.     refresh_windows
  720.   end
  721.  
  722.   #--------------------------------------------------------------------------
  723.   # new method: on_delete_success
  724.   #--------------------------------------------------------------------------
  725.   def on_delete_success
  726.     YEA::SAVE::DELETE_SOUND.play
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # new method: refresh_windows
  731.   #--------------------------------------------------------------------------
  732.   def refresh_windows
  733.     @file_window.refresh
  734.     @action_window.refresh
  735.     @status_window.refresh
  736.   end
  737.  
  738. end # Scene_File
  739.  
  740. #==============================================================================
  741. # ■ Scene_Save
  742. #==============================================================================
  743.  
  744. class Scene_Save < Scene_File
  745.  
  746.   #--------------------------------------------------------------------------
  747.   # overwrite method: on_savefile_ok
  748.   #--------------------------------------------------------------------------
  749.   def on_savefile_ok; super; end
  750.  
  751.   #--------------------------------------------------------------------------
  752.   # overwrite method: on_save_success
  753.   #--------------------------------------------------------------------------
  754.   def on_save_success; super; end
  755.  
  756. end # help_window_text
  757.  
  758. #==============================================================================
  759. # ■ Scene_Load
  760. #==============================================================================
  761.  
  762. class Scene_Load < Scene_File
  763.  
  764.   #--------------------------------------------------------------------------
  765.   # overwrite method: on_savefile_ok
  766.   #--------------------------------------------------------------------------
  767.   def on_savefile_ok; super; end
  768.  
  769.   #--------------------------------------------------------------------------
  770.   # overwrite method: on_load_success
  771.   #--------------------------------------------------------------------------
  772.   def on_load_success; super; end
  773.  
  774. end # Scene_Load
  775.  
  776. #==============================================================================
  777. #
  778. # ■ End of File
  779. #
  780. #==============================================================================
  781.  
  782. class Scene_File
  783.  
  784.   alias create_all_windows_original create_all_windows
  785.   def create_all_windows
  786.     create_all_windows_original
  787.     create_overlap_window
  788.   end
  789.  
  790.   class Window_Overlap < Window_HorzCommand
  791.     def window_width
  792.       Bitmap.new(1,1).text_size(YEA::SAVE::OVERLAP_HELP).width + 24 + 8
  793.     end
  794.     def visible_line_number; 2; end
  795.     def col_max; 2; end
  796.     def contents_height
  797.       height - standard_padding * 2
  798.     end
  799.     def item_rect(index)
  800.       rect = super
  801.       rect.y += line_height
  802.       rect
  803.     end
  804.     def draw_all_items
  805.       rect = item_rect_for_text(0)
  806.       rect.y -= line_height
  807.       rect.width = contents.width
  808.       draw_text(rect, YEA::SAVE::OVERLAP_HELP)
  809.       super
  810.     end
  811.     def make_command_list
  812.       add_command(YEA::SAVE::ACTION_OVERLAP, :overlap)
  813.       add_command(YEA::SAVE::ACTION_CANCEL , :cancel )
  814.     end
  815.   end
  816.  
  817.   def create_overlap_window
  818.     @overlap_window = Window_Overlap.new(0, 0)
  819.     @overlap_window.set_handler(:overlap, method(:on_action_save_with_overlap))
  820.     @overlap_window.set_handler(:cancel, method(:on_action_save_cancel))
  821.     @overlap_window.x = (Graphics.width - @overlap_window.width) / 2
  822.     @overlap_window.y = (Graphics.height - @overlap_window.height) / 2  
  823.     @overlap_window.hide.close.deactivate
  824.   end
  825.  
  826.   alias on_action_save_original on_action_save
  827.   def on_action_save
  828.     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
  829.       @action_window.deactivate
  830.       @overlap_window.show.open.activate
  831.     else
  832.       on_action_save_with_overlap
  833.     end
  834.   end
  835.  
  836.   def on_action_save_with_overlap
  837.     on_action_save_original
  838.     on_action_save_cancel
  839.   end
  840.  
  841.   def on_action_save_cancel
  842.     @action_window.activate
  843.     @overlap_window.hide.close.deactivate
  844.   end
  845. end


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

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

GMT+8, 2025-7-17 21:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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