查看: 5532|回复: 19

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

[复制链接]
梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
发表于 2019-9-8 11:18:30 | 显示全部楼层 |阅读模式
悬赏47星屑已解决
本帖最后由 VIPArcher 于 2019-9-9 00:39 编辑

想在Yanfly大佬的存档脚本的基础上加个是否覆盖存档的存档提示-(已经搜了站内有关存档提示的脚本&扒下以前玩的游戏的存档提示的脚本(它们没用Yanfly大佬的存档脚本),但都跟这个冲突)[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - 存档系统 v1.03
# -- 最后更新: 2012.07.22
# -- 使用难度: 普通
# -- 需要脚本: 无
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-SaveEngine"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.22 - Fixed: Location Drawing.
# 2012.01.23 - Anti-crash method added for removed maps.
# 2011.12.26 - Compatibility Update: New Game+
# 2011.12.26 - Started Script and Finished.
#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
# 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
#
# 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
# 需要你重新读档并再次存档。
#
#==============================================================================
# ▼ 安装方式
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
# 脚本页/槽中.记得保存你的工程以使脚本生效.
#
#==============================================================================
# ▼ 兼容性
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
#
#==============================================================================

module YEA
  module SAVE
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 存档文件窗口设置 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    MAX_FILES = 16         # 最大存档数. 默认: 16
    SLOT_NAME = "Save %s"  # 存档文件文本.
   
    # These are the icons
    SAVE_ICON  = 368       # 已存档的图标
    EMPTY_ICON = 375       # 未存档的图标
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 指令窗口设置 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    ACTION_LOAD   = "载入"           # 载入的文本.
    ACTION_SAVE   = "存档"           # 存档的文本.
    ACTION_DELETE = "删除"           # 删除的文本.
    DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.
   
    # 在帮助窗口中显示的文本.
    SELECT_HELP = "请选择一个存档文件."
    LOAD_HELP   = "从已保存数据中载入."
    SAVE_HELP   = "保存当前游戏数据."
    DELETE_HELP = "删除全部已保存数据."
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 游戏状态窗口文本 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
    PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
    TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
    TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
    LOCATION   = "地点: "          # 地点的文本.
   
    # 在数组中填入你想要显示变量数值的变量ID,0为不显示
    COLUMN1_VARIABLES = [381, 390, 495]
    COLUMN2_VARIABLES = [707, 5, 6]
   
  end # SAVE
end # YEA

#==============================================================================
# ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
# 所以编辑了后果自负。
#==============================================================================

#==============================================================================
# ■ Icon
#==============================================================================

module Icon
  
  #--------------------------------------------------------------------------
  # self.save_icon
  #--------------------------------------------------------------------------
  def self.save_icon; return YEA::SAVE::SAVE_ICON; end
  
  #--------------------------------------------------------------------------
  # self.empty_icon
  #--------------------------------------------------------------------------
  def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
   
end # Icon

#==============================================================================
# ■ Numeric
#==============================================================================

class Numeric
  
  #--------------------------------------------------------------------------
  # new method: group_digits
  #--------------------------------------------------------------------------
  unless $imported["YEA-CoreEngine"]
  def group; return self.to_s; end
  end # $imported["YEA-CoreEngine"]
   
end # Numeric

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # overwrite method: savefile_max
  #--------------------------------------------------------------------------
  def self.savefile_max
    return YEA::SAVE::MAX_FILES
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: self.make_save_header
  #--------------------------------------------------------------------------
  def self.make_save_header
    header = {}
    header[:characters]    = $game_party.characters_for_savefile
    header[:playtime_s]    = $game_system.playtime_s
    header[:system]        = Marshal.load(Marshal.dump($game_system))
    header[:timer]         = Marshal.load(Marshal.dump($game_timer))
    header[:message]       = Marshal.load(Marshal.dump($game_message))
    header[:switches]      = Marshal.load(Marshal.dump($game_switches))
    header[:variables]     = Marshal.load(Marshal.dump($game_variables))
    header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
    header[:actors]        = Marshal.load(Marshal.dump($game_actors))
    header[:party]         = Marshal.load(Marshal.dump($game_party))
    header[:troop]         = Marshal.load(Marshal.dump($game_troop))
    header[:map]           = Marshal.load(Marshal.dump($game_map))
    header[:player]        = Marshal.load(Marshal.dump($game_player))
    header
  end
  
end # DataManager

#==============================================================================
# ■ Window_MenuCommand
#==============================================================================

class Window_MenuCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # overwrite method: save_enabled
  #--------------------------------------------------------------------------
  def save_enabled; return true; end
  
end # Window_MenuCommand

#==============================================================================
# ■ Window_FileList
#==============================================================================

class Window_FileList < Window_Selectable
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy)
    super(dx, dy, 128, Graphics.height - dy)
    refresh
    activate
    select(SceneManager.scene.first_savefile_index)
  end
  
  #--------------------------------------------------------------------------
  # item_max
  #--------------------------------------------------------------------------
  def item_max; return DataManager.savefile_max; end
  
  #--------------------------------------------------------------------------
  # current_item_enabled?
  #--------------------------------------------------------------------------
  def current_item_enabled?
    header = DataManager.load_header(index)
    return false if header.nil? && SceneManager.scene_is?(Scene_Load)
    return true
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    create_contents
    draw_all_items
  end
  
  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    header = DataManager.load_header(index)
    enabled = !header.nil?
    rect = item_rect(index)
    rect.width -= 4
    draw_icon(save_icon?(header), rect.x, rect.y, enabled)
    change_color(normal_color, enabled)
    text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
    draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  end
  
  #--------------------------------------------------------------------------
  # save_icon?
  #--------------------------------------------------------------------------
  def save_icon?(header)
    return Icon.empty_icon if header.nil?
    return Icon.save_icon
  end
  
end # Window_FileList

#==============================================================================
# ■ Window_FileStatus
#==============================================================================

class Window_FileStatus < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy, file_window)
    super(dx, dy, Graphics.width - dx, Graphics.height - dy)
    @file_window = file_window
    @current_index = @file_window.index
    refresh
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return if @file_window.index < 0
    return if @current_index == @file_window.index
    @current_index = @file_window.index
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    reset_font_settings
    @header = DataManager.load_header(@file_window.index)
    if @header.nil?
      draw_empty
    else
      draw_save_contents
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_empty
  #--------------------------------------------------------------------------
  def draw_empty
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(0, 0, contents.width, contents.height)
    contents.fill_rect(rect, colour)
    text = YEA::SAVE::EMPTY_TEXT
    change_color(system_color)
    draw_text(rect, text, 1)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_slot
  #--------------------------------------------------------------------------
  def draw_save_slot(dx, dy, dw)
    reset_font_settings
    change_color(system_color)
    text = sprintf(YEA::SAVE::SLOT_NAME, "")
    draw_text(dx, dy, dw, line_height, text)
    cx = text_size(text).width
    change_color(normal_color)
    draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_playtime
  #--------------------------------------------------------------------------
  def draw_save_playtime(dx, dy, dw)
    return if @header[:playtime_s].nil?
    reset_font_settings
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
    change_color(normal_color)
    draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_total_saves
  #--------------------------------------------------------------------------
  def draw_save_total_saves(dx, dy, dw)
    return if @header[:system].nil?
    reset_font_settings
    change_color(system_color)
    text = YEA::SAVE::TOTAL_SAVE
    draw_text(dx, dy, dw, line_height, text)
    cx = text_size(text).width
    change_color(normal_color)
    draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_gold
  #--------------------------------------------------------------------------
  def draw_save_gold(dx, dy, dw)
    return if @header[:party].nil?
    reset_font_settings
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
    text = Vocab::currency_unit
    draw_text(dx, dy, dw, line_height, text, 2)
    cx = text_size(text).width
    change_color(normal_color)
    text = @header[:party].gold.group
    draw_text(dx, dy, dw-cx, line_height, text, 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_location
  #--------------------------------------------------------------------------
  def draw_save_location(dx, dy, dw)
    return if @header[:map].nil?
    reset_font_settings
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
    change_color(normal_color)
    cx = text_size(YEA::SAVE::LOCATION).width
    return if $data_mapinfos[@header[:map].map_id].nil?
    text = @header[:map].display_name
    text = $data_mapinfos[@header[:map].map_id].name if text == ""
    draw_text(dx+cx, dy, dw-cx, line_height, text)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_characters
  #--------------------------------------------------------------------------
  def draw_save_characters(dx, dy)
    return if @header[:party].nil?
    reset_font_settings
    make_font_smaller
    dw = (contents.width - dx) / @header[:party].max_battle_members
    dx += dw/2
    for member in @header[:party].battle_members
      next if member.nil?
      member = @header[:actors][member.id]
      change_color(normal_color)
      draw_actor_graphic(member, dx, dy)
      text = member.name
      draw_text(dx-dw/2, dy, dw, line_height, text, 1)
      text = member.level.group
      draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
      cx = text_size(text).width
      change_color(system_color)
      text = Vocab::level_a
      draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
      dx += dw
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_save_column1
  #--------------------------------------------------------------------------
  def draw_save_column1(dx, dy, dw)
    data = YEA::SAVE::COLUMN1_VARIABLES
    draw_column_data(data, dx, dy, dw)
  end
  
  #--------------------------------------------------------------------------
  # draw_save_column2
  #--------------------------------------------------------------------------
  def draw_save_column2(dx, dy, dw)
    data = YEA::SAVE::COLUMN2_VARIABLES
    draw_column_data(data, dx, dy, dw)
  end
  
  #--------------------------------------------------------------------------
  # draw_column_data
  #--------------------------------------------------------------------------
  def draw_column_data(data, dx, dy, dw)
    return if @header[:variables].nil?
    reset_font_settings
    for variable_id in data
      next if $data_system.variables[variable_id].nil?
      change_color(system_color)
      name = $data_system.variables[variable_id]
      draw_text(dx, dy, dw, line_height, name, 0)
      value = @header[:variables][variable_id].group
      change_color(normal_color)
      draw_text(dx, dy, dw, line_height, value, 2)
      dy += line_height
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_save_contents
  #--------------------------------------------------------------------------
  def draw_save_contents
    draw_save_slot(4, 0, contents.width/2-8)
    draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
    draw_save_total_saves(4, line_height, contents.width/2-8)
    draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
    draw_save_location(4, line_height*2, contents.width-8)
    draw_save_characters(0, line_height*5 + line_height/3)
    draw_save_column1(16, line_height*7, contents.width/2-48)
    draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  end
  
end # Window_FileStatus

#==============================================================================
# ■ Window_FileAction
#==============================================================================

class Window_FileAction < Window_HorzCommand
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy, file_window)
    @file_window = file_window
    super(dx, dy)
    deactivate
    unselect
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; Graphics.width - 128; end
  
  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max; return 3; end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return if @file_window.index < 0
    return if @current_index == @file_window.index
    @current_index = @file_window.index
    refresh
  end
  
  #--------------------------------------------------------------------------
  # make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    @header = DataManager.load_header(@file_window.index)
    add_load_command
    add_save_command
    add_delete_command
  end
  
  #--------------------------------------------------------------------------
  # add_load_command
  #--------------------------------------------------------------------------
  def add_load_command
    add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  end
  
  #--------------------------------------------------------------------------
  # load_enabled?
  #--------------------------------------------------------------------------
  def load_enabled?
    return false if @header.nil?
    return true
  end
  
  #--------------------------------------------------------------------------
  # add_save_command
  #--------------------------------------------------------------------------
  def add_save_command
    add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  end
  
  #--------------------------------------------------------------------------
  # save_enabled?
  #--------------------------------------------------------------------------
  def save_enabled?
    return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
    return false if SceneManager.scene_is?(Scene_Load)
    return false if $game_system.save_disabled
    return true
  end
  
  #--------------------------------------------------------------------------
  # add_delete_command
  #--------------------------------------------------------------------------
  def add_delete_command
    add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  end
  
  #--------------------------------------------------------------------------
  # delete_enabled?
  #--------------------------------------------------------------------------
  def delete_enabled?
    return false if @header.nil?
    return true
  end
  
  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  def update_help
    case current_symbol
    when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
    when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
    when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
    end
  end
  
end # Window_FileAction

#==============================================================================
# ■ Scene_File
#==============================================================================

class Scene_File < Scene_MenuBase
  
  #--------------------------------------------------------------------------
  # overwrite method: start
  #--------------------------------------------------------------------------
  def start
    super
    create_all_windows
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: terminate
  #--------------------------------------------------------------------------
  def terminate
    super
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: update
  #--------------------------------------------------------------------------
  def update
    super
  end
  
  #--------------------------------------------------------------------------
  # new method: create_all_windows
  #--------------------------------------------------------------------------
  def create_all_windows
    create_help_window
    create_file_window
    create_action_window
    create_status_window
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: create_help_window
  #--------------------------------------------------------------------------
  def create_help_window
    @help_window = Window_Help.new
    @help_window.set_text(YEA::SAVE::SELECT_HELP)
  end
  
  #--------------------------------------------------------------------------
  # new method: create_file_window
  #--------------------------------------------------------------------------
  def create_file_window
    wy = @help_window.height
    @file_window = Window_FileList.new(0, wy)
    @file_window.set_handler(:ok, method(:on_file_ok))
    @file_window.set_handler(:cancel, method(:return_scene))
  end
  
  #--------------------------------------------------------------------------
  # new method: create_action_window
  #--------------------------------------------------------------------------
  def create_action_window
    wx = @file_window.width
    wy = @help_window.height
    @action_window = Window_FileAction.new(wx, wy, @file_window)
    @action_window.help_window = @help_window
    @action_window.set_handler(:cancel, method(:on_action_cancel))
    @action_window.set_handler(:load, method(:on_action_load))
    @action_window.set_handler(:save, method(:on_action_save))
    @action_window.set_handler(:delete, method(:on_action_delete))
  end
  
  #--------------------------------------------------------------------------
  # new method: create_status_window
  #--------------------------------------------------------------------------
  def create_status_window
    wx = @action_window.x
    wy = @action_window.y + @action_window.height
    @status_window = Window_FileStatus.new(wx, wy, @file_window)
  end
  
  #--------------------------------------------------------------------------
  # new method: on_file_ok
  #--------------------------------------------------------------------------
  def on_file_ok
    @action_window.activate
    index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
    @action_window.select(index)
  end
  
  #--------------------------------------------------------------------------
  # new method: on_action_cancel
  #--------------------------------------------------------------------------
  def on_action_cancel
    @action_window.unselect
    @file_window.activate
    @help_window.set_text(YEA::SAVE::SELECT_HELP)
  end
  
  #--------------------------------------------------------------------------
  # new method: on_action_load
  #--------------------------------------------------------------------------
  def on_action_load
    if DataManager.load_game(@file_window.index)
      on_load_success
    else
      Sound.play_buzzer
    end
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: on_load_success
  #--------------------------------------------------------------------------
  def on_load_success
    Sound.play_load
    fadeout_all
    $game_system.on_after_load
    SceneManager.goto(Scene_Map)
  end
  
  #--------------------------------------------------------------------------
  # new method: on_action_save
  #--------------------------------------------------------------------------
  def on_action_save
    @action_window.activate
    if DataManager.save_game(@file_window.index)
      on_save_success
      refresh_windows
    else
      Sound.play_buzzer
    end
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: on_save_success
  #--------------------------------------------------------------------------
  def on_save_success; Sound.play_save; end
  
  #--------------------------------------------------------------------------
  # new method: on_action_delete
  #--------------------------------------------------------------------------
  def on_action_delete
    @action_window.activate
    DataManager.delete_save_file(@file_window.index)
    on_delete_success
    refresh_windows
  end
  
  #--------------------------------------------------------------------------
  # new method: on_delete_success
  #--------------------------------------------------------------------------
  def on_delete_success
    YEA::SAVE::DELETE_SOUND.play
  end
  
  #--------------------------------------------------------------------------
  # new method: refresh_windows
  #--------------------------------------------------------------------------
  def refresh_windows
    @file_window.refresh
    @action_window.refresh
    @status_window.refresh
  end
  
end # Scene_File

#==============================================================================
# ■ Scene_Save
#==============================================================================

class Scene_Save < Scene_File
  
  #--------------------------------------------------------------------------
  # overwrite method: on_savefile_ok
  #--------------------------------------------------------------------------
  def on_savefile_ok; super; end
  
  #--------------------------------------------------------------------------
  # overwrite method: on_save_success
  #--------------------------------------------------------------------------
  def on_save_success; super; end
  
end # help_window_text

#==============================================================================
# ■ Scene_Load
#==============================================================================

class Scene_Load < Scene_File
  
  #--------------------------------------------------------------------------
  # overwrite method: on_savefile_ok
  #--------------------------------------------------------------------------
  def on_savefile_ok; super; end
  
  #--------------------------------------------------------------------------
  # overwrite method: on_load_success
  #--------------------------------------------------------------------------
  def on_load_success; super; end
  
end # Scene_Load

#==============================================================================
#
# ■ End of File
#
#==============================================================================[/pre]

就是这个界面

就是这个界面

最佳答案

查看完整内容

新建工程测试通过
梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2019-9-8 11:18:31 | 显示全部楼层
222.gif
新建工程测试通过

新建文本文档.zip (4.77 KB, 下载次数: 88)
用头画头像,用脚写脚本
回复

使用道具 举报

梦石
0
星屑
9862
在线时间
580 小时
注册时间
2017-9-28
回帖
203
发表于 2019-9-9 09:22:33 | 显示全部楼层
[pre lang="ruby"]# coding: utf-8
# 请将本脚本放置于「Yanfly Engine Ace - 存档系统 v1.03」之后使用

module YEA
  module SAVE
    # 在确认窗口中显示的文本
    OVERRIDE_HELP = '是否覆盖存档?'
  end
end

class Window_Confirm < Window_Base
  attr_reader :index

  def initialize(help_text = '')
    super(0, 0, Graphics.width, fitting_height(2))
    update_placement
    self.arrows_visible = false
    self.openness = 0
    @index = 0
    @handler = {}
    set_text(help_text)
    deactivate
  end

  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height - height) / 2
  end

  def current_item
    @index == 0 ? :yes : :no
  end

  def on sym, blk
    @handler[sym] = blk
  end

  def update
    super
    update_cursor
    update_handle
  end

  def active=(active)
    super
    update_cursor_rect
  end

  def index=(index)
    @index = index
    update_cursor_rect
  end

  def update_cursor_rect
    cursor_rect.set(item_rect(@index))
  end

  def update_cursor
    return unless open? && active
    last_index = @index
    cursor_left  if Input.repeat?(:LEFT)
    cursor_right if Input.repeat?(:RIGHT)
    Sound.play_cursor if @index != last_index
  end

  def update_handle
    return unless open? && active
    process_ok     if Input.trigger?(:C)
    process_cancel if Input.trigger?(:B)
  end

  def cursor_left
    self.index = (@index - 1) % 2
  end

  def cursor_right
    self.index = (@index + 1) % 2
  end

  def process_ok
    Sound.play_ok
    Input.update
    deactivate
    handle(current_item)
  end

  def process_cancel
    Sound.play_cancel
    Input.update
    deactivate
    handle(:no)
  end

  def handle sym
    @handler[sym].call if @handler.key?(sym)
  end

  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end

  def refresh
    contents.clear
    draw_text_ex(4, 0, @text)
    %w(是 否).each_with_index do |text, i|
      contents.draw_text(item_rect(i), text, 1)
    end
  end

  def item_width
    120
  end

  def spacing
    8
  end

  def item_rect(index)
    x = contents_width - item_width * 2 - spacing
    dx = item_width + spacing
    rect = Rect.new(x + index * dx, line_height, item_width, line_height)
  end
end

class Scene_File
  alias _create_all_windows_confirm create_all_windows
  def create_all_windows
    _create_all_windows_confirm
    create_confirm_window
  end

  def create_confirm_window
    @confirm_window = Window_Confirm.new(YEA::SAVE::OVERRIDE_HELP)
    @confirm_window.on(:yes, method(:on_confirm_yes))
    @confirm_window.on(:no, method(:on_confirm_no))
  end

  alias _on_action_save_confirm on_action_save
  def on_action_save
    if DataManager.load_header(@file_window.index)
      @confirm_window.index = 0
      @confirm_window.activate.open
    else
      _on_action_save_confirm
    end
  end

  def on_confirm_yes
    _on_action_save_confirm
    @confirm_window.close
  end

  def on_confirm_no
    @confirm_window.close
    @action_window.activate
  end
end
[/pre]
喵喵喵
回复

使用道具 举报

梦石
0
星屑
487
在线时间
32 小时
注册时间
2019-8-6
回帖
18
发表于 2019-9-10 21:10:52 | 显示全部楼层
请问一下!我运行的时候第二个脚本说出错了qaq

存档"第129行:发生NameError。
undefined method 'create all windows' for class Scene File'

这么说的qaq

点评

你可能使用的不是 RMVA…… 或者别的脚本修改了 Scene_File 产生了冲突  发表于 2019-9-11 08:03
啥都不会的小菜鸡!
回复

使用道具 举报

梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
 楼主| 发表于 2019-9-12 08:17:39 | 显示全部楼层
KB.Driver 发表于 2019-9-9 09:47
新建工程测试通过

谢谢哈我刚看见,待我测试下再给金币
回复

使用道具 举报

梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
 楼主| 发表于 2019-9-12 08:39:41 | 显示全部楼层
KB.Driver 发表于 2019-9-8 11:18
新建工程测试通过

大佬已给金币,马后炮地问一下,在覆盖/取消上面加个是否覆盖此存档的陈述难吗?不难地话能告知下怎么微调脚本吗?当然你要忙或者有点难度地话就算了。

点评

不难,有时间给你加一下  发表于 2019-9-12 11:59
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2019-9-12 13:03:21 | 显示全部楼层
杰克苏 发表于 2019-9-12 08:39
大佬已给金币,马后炮地问一下,在覆盖/取消上面加个是否覆盖此存档的陈述难吗?不难地话能告知下怎么微调 ...

[pre lang="ruby"]#==============================================================================
#
# ▼ Yanfly Engine Ace - 存档系统 v1.03
# -- 最后更新: 2012.07.22
# -- 使用难度: 普通
# -- 需要脚本: 无
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-SaveEngine"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.22 - Fixed: Location Drawing.
# 2012.01.23 - Anti-crash method added for removed maps.
# 2011.12.26 - Compatibility Update: New Game+
# 2011.12.26 - Started Script and Finished.
#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本为玩家提供一个新式存档界面,可以直接在存档界面读档或删除存档。同时为玩家
# 显示更多的存档信息,例如地点、所持金钱以及其他任何你想要显示的变量。
#
# 如果你第一次使用此脚本,查看旧存档文件可能会出现丢失部分存档数据的情况,这时候
# 需要你重新读档并再次存档。
#
#==============================================================================
# ▼ 安装方式
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
# 脚本页/槽中.记得保存你的工程以使脚本生效.
#
#==============================================================================
# ▼ 兼容性
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
#
#==============================================================================

module YEA
  module SAVE

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 存档文件窗口设置 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    MAX_FILES = 16         # 最大存档数. 默认: 16
    SLOT_NAME = "Save %s"  # 存档文件文本.

    # These are the icons
    SAVE_ICON  = 368       # 已存档的图标
    EMPTY_ICON = 375       # 未存档的图标

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 指令窗口设置 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    ACTION_LOAD   = "载入"           # 载入的文本.
    ACTION_SAVE   = "存档"           # 存档的文本.
    ACTION_DELETE = "删除"           # 删除的文本.
    DELETE_SOUND  = RPG::SE.new("Collapse3", 100, 100) # 删除的音效.

    # 在帮助窗口中显示的文本.
    SELECT_HELP = "请选择一个存档文件."
    LOAD_HELP   = "从已保存数据中载入."
    SAVE_HELP   = "保存当前游戏数据."
    DELETE_HELP = "删除全部已保存数据."
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 覆盖窗口设置 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   
    ACTION_OVERLAP = "覆盖"
    ACTION_CANCEL  = "取消"
    OVERLAP_HELP   = "是否覆盖此存档?"

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - 游戏状态窗口文本 -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    EMPTY_TEXT = "无存档数据"      # 无存档数据的文本.
    PLAYTIME   = "游戏时间"        # 显示游戏时间的文本.
    TOTAL_SAVE = "存档次数: "      # 存档次数的文本.
    TOTAL_GOLD = "总金钱数: "      # 总金钱数的文本.
    LOCATION   = "地点: "          # 地点的文本.

    # 在数组中填入你想要显示变量数值的变量ID,0为不显示
    COLUMN1_VARIABLES = [381, 390, 495]
    COLUMN2_VARIABLES = [707, 5, 6]

  end # SAVE
end # YEA

#==============================================================================
# ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
# 所以编辑了后果自负。
#==============================================================================

#==============================================================================
# ■ Icon
#==============================================================================

module Icon

  #--------------------------------------------------------------------------
  # self.save_icon
  #--------------------------------------------------------------------------
  def self.save_icon; return YEA::SAVE::SAVE_ICON; end

  #--------------------------------------------------------------------------
  # self.empty_icon
  #--------------------------------------------------------------------------
  def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end

end # Icon

#==============================================================================
# ■ Numeric
#==============================================================================

class Numeric

  #--------------------------------------------------------------------------
  # new method: group_digits
  #--------------------------------------------------------------------------
  unless $imported["YEA-CoreEngine"]
  def group; return self.to_s; end
  end # $imported["YEA-CoreEngine"]

end # Numeric

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager

  #--------------------------------------------------------------------------
  # overwrite method: savefile_max
  #--------------------------------------------------------------------------
  def self.savefile_max
    return YEA::SAVE::MAX_FILES
  end

  #--------------------------------------------------------------------------
  # overwrite method: self.make_save_header
  #--------------------------------------------------------------------------
  def self.make_save_header
    header = {}
    header[:characters]    = $game_party.characters_for_savefile
    header[:playtime_s]    = $game_system.playtime_s
    header[:system]        = Marshal.load(Marshal.dump($game_system))
    header[:timer]         = Marshal.load(Marshal.dump($game_timer))
    header[:message]       = Marshal.load(Marshal.dump($game_message))
    header[:switches]      = Marshal.load(Marshal.dump($game_switches))
    header[:variables]     = Marshal.load(Marshal.dump($game_variables))
    header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
    header[:actors]        = Marshal.load(Marshal.dump($game_actors))
    header[:party]         = Marshal.load(Marshal.dump($game_party))
    header[:troop]         = Marshal.load(Marshal.dump($game_troop))
    header[:map]           = Marshal.load(Marshal.dump($game_map))
    header[:player]        = Marshal.load(Marshal.dump($game_player))
    header
  end

end # DataManager

#==============================================================================
# ■ Window_MenuCommand
#==============================================================================

class Window_MenuCommand < Window_Command

  #--------------------------------------------------------------------------
  # overwrite method: save_enabled
  #--------------------------------------------------------------------------
  def save_enabled; return true; end

end # Window_MenuCommand

#==============================================================================
# ■ Window_FileList
#==============================================================================

class Window_FileList < Window_Selectable

  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy)
    super(dx, dy, 128, Graphics.height - dy)
    refresh
    activate
    select(SceneManager.scene.first_savefile_index)
  end

  #--------------------------------------------------------------------------
  # item_max
  #--------------------------------------------------------------------------
  def item_max; return DataManager.savefile_max; end

  #--------------------------------------------------------------------------
  # current_item_enabled?
  #--------------------------------------------------------------------------
  def current_item_enabled?
    header = DataManager.load_header(index)
    return false if header.nil? && SceneManager.scene_is?(Scene_Load)
    return true
  end

  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    create_contents
    draw_all_items
  end

  #--------------------------------------------------------------------------
  # draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    header = DataManager.load_header(index)
    enabled = !header.nil?
    rect = item_rect(index)
    rect.width -= 4
    draw_icon(save_icon?(header), rect.x, rect.y, enabled)
    change_color(normal_color, enabled)
    text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
    draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
  end

  #--------------------------------------------------------------------------
  # save_icon?
  #--------------------------------------------------------------------------
  def save_icon?(header)
    return Icon.empty_icon if header.nil?
    return Icon.save_icon
  end

end # Window_FileList

#==============================================================================
# ■ Window_FileStatus
#==============================================================================

class Window_FileStatus < Window_Base

  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy, file_window)
    super(dx, dy, Graphics.width - dx, Graphics.height - dy)
    @file_window = file_window
    @current_index = @file_window.index
    refresh
  end

  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return if @file_window.index < 0
    return if @current_index == @file_window.index
    @current_index = @file_window.index
    refresh
  end

  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    reset_font_settings
    @header = DataManager.load_header(@file_window.index)
    if @header.nil?
      draw_empty
    else
      draw_save_contents
    end
  end

  #--------------------------------------------------------------------------
  # draw_empty
  #--------------------------------------------------------------------------
  def draw_empty
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(0, 0, contents.width, contents.height)
    contents.fill_rect(rect, colour)
    text = YEA::SAVE::EMPTY_TEXT
    change_color(system_color)
    draw_text(rect, text, 1)
  end

  #--------------------------------------------------------------------------
  # draw_save_slot
  #--------------------------------------------------------------------------
  def draw_save_slot(dx, dy, dw)
    reset_font_settings
    change_color(system_color)
    text = sprintf(YEA::SAVE::SLOT_NAME, "")
    draw_text(dx, dy, dw, line_height, text)
    cx = text_size(text).width
    change_color(normal_color)
    draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
  end

  #--------------------------------------------------------------------------
  # draw_save_playtime
  #--------------------------------------------------------------------------
  def draw_save_playtime(dx, dy, dw)
    return if @header[:playtime_s].nil?
    reset_font_settings
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
    change_color(normal_color)
    draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
  end

  #--------------------------------------------------------------------------
  # draw_save_total_saves
  #--------------------------------------------------------------------------
  def draw_save_total_saves(dx, dy, dw)
    return if @header[:system].nil?
    reset_font_settings
    change_color(system_color)
    text = YEA::SAVE::TOTAL_SAVE
    draw_text(dx, dy, dw, line_height, text)
    cx = text_size(text).width
    change_color(normal_color)
    draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
  end

  #--------------------------------------------------------------------------
  # draw_save_gold
  #--------------------------------------------------------------------------
  def draw_save_gold(dx, dy, dw)
    return if @header[:party].nil?
    reset_font_settings
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
    text = Vocab::currency_unit
    draw_text(dx, dy, dw, line_height, text, 2)
    cx = text_size(text).width
    change_color(normal_color)
    text = @header[:party].gold.group
    draw_text(dx, dy, dw-cx, line_height, text, 2)
  end

  #--------------------------------------------------------------------------
  # draw_save_location
  #--------------------------------------------------------------------------
  def draw_save_location(dx, dy, dw)
    return if @header[:map].nil?
    reset_font_settings
    change_color(system_color)
    draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
    change_color(normal_color)
    cx = text_size(YEA::SAVE::LOCATION).width
    return if $data_mapinfos[@header[:map].map_id].nil?
    text = @header[:map].display_name
    text = $data_mapinfos[@header[:map].map_id].name if text == ""
    draw_text(dx+cx, dy, dw-cx, line_height, text)
  end

  #--------------------------------------------------------------------------
  # draw_save_characters
  #--------------------------------------------------------------------------
  def draw_save_characters(dx, dy)
    return if @header[:party].nil?
    reset_font_settings
    make_font_smaller
    dw = (contents.width - dx) / @header[:party].max_battle_members
    dx += dw/2
    for member in @header[:party].battle_members
      next if member.nil?
      member = @header[:actors][member.id]
      change_color(normal_color)
      draw_actor_graphic(member, dx, dy)
      text = member.name
      draw_text(dx-dw/2, dy, dw, line_height, text, 1)
      text = member.level.group
      draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
      cx = text_size(text).width
      change_color(system_color)
      text = Vocab::level_a
      draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
      dx += dw
    end
  end

  #--------------------------------------------------------------------------
  # draw_save_column1
  #--------------------------------------------------------------------------
  def draw_save_column1(dx, dy, dw)
    data = YEA::SAVE::COLUMN1_VARIABLES
    draw_column_data(data, dx, dy, dw)
  end

  #--------------------------------------------------------------------------
  # draw_save_column2
  #--------------------------------------------------------------------------
  def draw_save_column2(dx, dy, dw)
    data = YEA::SAVE::COLUMN2_VARIABLES
    draw_column_data(data, dx, dy, dw)
  end

  #--------------------------------------------------------------------------
  # draw_column_data
  #--------------------------------------------------------------------------
  def draw_column_data(data, dx, dy, dw)
    return if @header[:variables].nil?
    reset_font_settings
    for variable_id in data
      next if $data_system.variables[variable_id].nil?
      change_color(system_color)
      name = $data_system.variables[variable_id]
      draw_text(dx, dy, dw, line_height, name, 0)
      value = @header[:variables][variable_id].group
      change_color(normal_color)
      draw_text(dx, dy, dw, line_height, value, 2)
      dy += line_height
    end
  end

  #--------------------------------------------------------------------------
  # draw_save_contents
  #--------------------------------------------------------------------------
  def draw_save_contents
    draw_save_slot(4, 0, contents.width/2-8)
    draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
    draw_save_total_saves(4, line_height, contents.width/2-8)
    draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
    draw_save_location(4, line_height*2, contents.width-8)
    draw_save_characters(0, line_height*5 + line_height/3)
    draw_save_column1(16, line_height*7, contents.width/2-48)
    draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
  end

end # Window_FileStatus

#==============================================================================
# ■ Window_FileAction
#==============================================================================

class Window_FileAction < Window_HorzCommand

  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy, file_window)
    @file_window = file_window
    super(dx, dy)
    deactivate
    unselect
  end

  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; Graphics.width - 128; end

  #--------------------------------------------------------------------------
  # col_max
  #--------------------------------------------------------------------------
  def col_max; return 3; end

  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return if @file_window.index < 0
    return if @current_index == @file_window.index
    @current_index = @file_window.index
    refresh
  end

  #--------------------------------------------------------------------------
  # make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    @header = DataManager.load_header(@file_window.index)
    add_load_command
    add_save_command
    add_delete_command
  end

  #--------------------------------------------------------------------------
  # add_load_command
  #--------------------------------------------------------------------------
  def add_load_command
    add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
  end

  #--------------------------------------------------------------------------
  # load_enabled?
  #--------------------------------------------------------------------------
  def load_enabled?
    return false if @header.nil?
    return true
  end

  #--------------------------------------------------------------------------
  # add_save_command
  #--------------------------------------------------------------------------
  def add_save_command
    add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
  end

  #--------------------------------------------------------------------------
  # save_enabled?
  #--------------------------------------------------------------------------
  def save_enabled?
    return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
    return false if SceneManager.scene_is?(Scene_Load)
    return false if $game_system.save_disabled
    return true
  end

  #--------------------------------------------------------------------------
  # add_delete_command
  #--------------------------------------------------------------------------
  def add_delete_command
    add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
  end

  #--------------------------------------------------------------------------
  # delete_enabled?
  #--------------------------------------------------------------------------
  def delete_enabled?
    return false if @header.nil?
    return true
  end

  #--------------------------------------------------------------------------
  # update_help
  #--------------------------------------------------------------------------
  def update_help
    case current_symbol
    when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
    when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
    when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
    end
  end

end # Window_FileAction

#==============================================================================
# ■ Scene_File
#==============================================================================

class Scene_File < Scene_MenuBase

  #--------------------------------------------------------------------------
  # overwrite method: start
  #--------------------------------------------------------------------------
  def start
    super
    create_all_windows
  end

  #--------------------------------------------------------------------------
  # overwrite method: terminate
  #--------------------------------------------------------------------------
  def terminate
    super
  end

  #--------------------------------------------------------------------------
  # overwrite method: update
  #--------------------------------------------------------------------------
  def update
    super
  end

  #--------------------------------------------------------------------------
  # new method: create_all_windows
  #--------------------------------------------------------------------------
  def create_all_windows
    create_help_window
    create_file_window
    create_action_window
    create_status_window
  end

  #--------------------------------------------------------------------------
  # overwrite method: create_help_window
  #--------------------------------------------------------------------------
  def create_help_window
    @help_window = Window_Help.new
    @help_window.set_text(YEA::SAVE::SELECT_HELP)
  end

  #--------------------------------------------------------------------------
  # new method: create_file_window
  #--------------------------------------------------------------------------
  def create_file_window
    wy = @help_window.height
    @file_window = Window_FileList.new(0, wy)
    @file_window.set_handler(:ok, method(:on_file_ok))
    @file_window.set_handler(:cancel, method(:return_scene))
  end

  #--------------------------------------------------------------------------
  # new method: create_action_window
  #--------------------------------------------------------------------------
  def create_action_window
    wx = @file_window.width
    wy = @help_window.height
    @action_window = Window_FileAction.new(wx, wy, @file_window)
    @action_window.help_window = @help_window
    @action_window.set_handler(:cancel, method(:on_action_cancel))
    @action_window.set_handler(:load, method(:on_action_load))
    @action_window.set_handler(:save, method(:on_action_save))
    @action_window.set_handler(:delete, method(:on_action_delete))
  end

  #--------------------------------------------------------------------------
  # new method: create_status_window
  #--------------------------------------------------------------------------
  def create_status_window
    wx = @action_window.x
    wy = @action_window.y + @action_window.height
    @status_window = Window_FileStatus.new(wx, wy, @file_window)
  end

  #--------------------------------------------------------------------------
  # new method: on_file_ok
  #--------------------------------------------------------------------------
  def on_file_ok
    @action_window.activate
    index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
    @action_window.select(index)
  end

  #--------------------------------------------------------------------------
  # new method: on_action_cancel
  #--------------------------------------------------------------------------
  def on_action_cancel
    @action_window.unselect
    @file_window.activate
    @help_window.set_text(YEA::SAVE::SELECT_HELP)
  end

  #--------------------------------------------------------------------------
  # new method: on_action_load
  #--------------------------------------------------------------------------
  def on_action_load
    if DataManager.load_game(@file_window.index)
      on_load_success
    else
      Sound.play_buzzer
    end
  end

  #--------------------------------------------------------------------------
  # overwrite method: on_load_success
  #--------------------------------------------------------------------------
  def on_load_success
    Sound.play_load
    fadeout_all
    $game_system.on_after_load
    SceneManager.goto(Scene_Map)
  end

  #--------------------------------------------------------------------------
  # new method: on_action_save
  #--------------------------------------------------------------------------
  def on_action_save
    @action_window.activate
    if DataManager.save_game(@file_window.index)
      on_save_success
      refresh_windows
    else
      Sound.play_buzzer
    end
  end
  
#~   # 此处修改 ----------------------------------------------------------------
#~   alias on_action_save_original on_action_save
#~   def on_action_save
#~     if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
#~       @action_window.deactivate
#~       @overlap_window.show.open.activate
#~     else
#~       on_action_save_with_overlap
#~     end
#~   end
#~   
#~   def on_action_save_with_overlap
#~     on_action_save_original
#~     on_action_save_cancel
#~   end
#~   
#~   def on_action_save_cancel
#~     @action_window.activate
#~     @overlap_window.hide.close.deactivate
#~   end
#~   # -------------------------------------------------------------------------  
   

  #--------------------------------------------------------------------------
  # overwrite method: on_save_success
  #--------------------------------------------------------------------------
  def on_save_success; Sound.play_save; end

  #--------------------------------------------------------------------------
  # new method: on_action_delete
  #--------------------------------------------------------------------------
  def on_action_delete
    @action_window.activate
    DataManager.delete_save_file(@file_window.index)
    on_delete_success
    refresh_windows
  end

  #--------------------------------------------------------------------------
  # new method: on_delete_success
  #--------------------------------------------------------------------------
  def on_delete_success
    YEA::SAVE::DELETE_SOUND.play
  end

  #--------------------------------------------------------------------------
  # new method: refresh_windows
  #--------------------------------------------------------------------------
  def refresh_windows
    @file_window.refresh
    @action_window.refresh
    @status_window.refresh
  end

end # Scene_File

#==============================================================================
# ■ Scene_Save
#==============================================================================

class Scene_Save < Scene_File

  #--------------------------------------------------------------------------
  # overwrite method: on_savefile_ok
  #--------------------------------------------------------------------------
  def on_savefile_ok; super; end

  #--------------------------------------------------------------------------
  # overwrite method: on_save_success
  #--------------------------------------------------------------------------
  def on_save_success; super; end

end # help_window_text

#==============================================================================
# ■ Scene_Load
#==============================================================================

class Scene_Load < Scene_File

  #--------------------------------------------------------------------------
  # overwrite method: on_savefile_ok
  #--------------------------------------------------------------------------
  def on_savefile_ok; super; end

  #--------------------------------------------------------------------------
  # overwrite method: on_load_success
  #--------------------------------------------------------------------------
  def on_load_success; super; end

end # Scene_Load

#==============================================================================
#
# ■ End of File
#
#==============================================================================

class Scene_File
  
  alias create_all_windows_original create_all_windows
  def create_all_windows
    create_all_windows_original
    create_overlap_window
  end
  
  class Window_Overlap < Window_HorzCommand
    def window_width
      Bitmap.new(1,1).text_size(YEA::SAVE::OVERLAP_HELP).width + 24 + 8
    end
    def visible_line_number; 2; end
    def col_max; 2; end
    def contents_height
      height - standard_padding * 2
    end
    def item_rect(index)
      rect = super
      rect.y += line_height
      rect
    end
    def draw_all_items
      rect = item_rect_for_text(0)
      rect.y -= line_height
      rect.width = contents.width
      draw_text(rect, YEA::SAVE::OVERLAP_HELP)
      super
    end
    def make_command_list
      add_command(YEA::SAVE::ACTION_OVERLAP, :overlap)
      add_command(YEA::SAVE::ACTION_CANCEL , :cancel )
    end
  end

  def create_overlap_window
    @overlap_window = Window_Overlap.new(0, 0)
    @overlap_window.set_handler(:overlap, method(:on_action_save_with_overlap))
    @overlap_window.set_handler(:cancel, method(:on_action_save_cancel))
    @overlap_window.x = (Graphics.width - @overlap_window.width) / 2
    @overlap_window.y = (Graphics.height - @overlap_window.height) / 2  
    @overlap_window.hide.close.deactivate
  end
  
  alias on_action_save_original on_action_save
  def on_action_save
    if File.exist?(DataManager.make_filename(@file_window.index)) # 存档已经存在
      @action_window.deactivate
      @overlap_window.show.open.activate
    else
      on_action_save_with_overlap
    end
  end
  
  def on_action_save_with_overlap
    on_action_save_original
    on_action_save_cancel
  end
  
  def on_action_save_cancel
    @action_window.activate
    @overlap_window.hide.close.deactivate
  end
end[/pre]

_20190912130045.png
用头画头像,用脚写脚本
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
172
在线时间
935 小时
注册时间
2010-11-13
回帖
897
发表于 2019-9-12 18:55:44 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

头像被屏蔽
梦石
0
星屑
172
在线时间
935 小时
注册时间
2010-11-13
回帖
897
发表于 2019-9-12 18:56:36 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复

使用道具 举报

梦石
0
星屑
567
在线时间
151 小时
注册时间
2018-9-25
回帖
25
 楼主| 发表于 2019-9-12 21:38:30 | 显示全部楼层
KB.Driver 发表于 2019-9-12 13:03
#==============================================================================
#
# ▼ Yanfly Eng ...

谢谢大佬,大佬那个存档界面能改成这样的吗(就是在描述和选项中间加一根分割线)?如果可行的话有空的时候希望再麻烦一下大佬,我可以加金币(我的权限好像不能私信 )。
未标题-1.jpg

点评

自学Window_Status代码68~74行  发表于 2019-9-14 23:50
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部