查看: 2259|回复: 2

[已经解决] 存档菜单修改脚本出问题

[复制链接]
梦石
0
星屑
1608
在线时间
19 小时
注册时间
2015-11-8
回帖
2
发表于 2016-1-4 19:55:54 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2016-1-6 09:30 编辑
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-20 セーブ画面-改2 [Ver.1.1.0]        by Claimh
  3. #------------------------------------------------------------------------------
  4. #  セーブ画面の表示を改変します。
  5. #  (注)導入前のセーブデータは使えません
  6. #------------------------------------------------------------------------------
  7. #・ミッション名の更新
  8. # $game_party.mission = "あらすじ"
  9. #==============================================================================

  10. #==============================================================================
  11. # ■ SaveActor  : セーブファイル用のダミーアクター
  12. #==============================================================================
  13. class SaveActor
  14.   #--------------------------------------------------------------------------
  15.   # ● 公開インスタンス変数
  16.   #--------------------------------------------------------------------------
  17.   attr_reader :name
  18.   attr_reader :level
  19.   attr_reader :hp
  20.   attr_reader :mp
  21.   attr_reader :mhp
  22.   attr_reader :mmp
  23.   attr_reader :face_name
  24.   attr_reader :face_index
  25.   #--------------------------------------------------------------------------
  26.   # ● オブジェクト初期化
  27.   #--------------------------------------------------------------------------
  28.   def initialize(actor)
  29.     @name = actor.name
  30.     @level = actor.level
  31.     @hp = actor.hp; @mhp = actor.mhp
  32.     @mp = actor.mp; [url=home.php?mod=space&uid=474067]@MMP[/url] = actor.mmp
  33.     @face_name = actor.face_name
  34.     @face_index = actor.face_index
  35.     [url=home.php?mod=space&uid=89503]@deAd[/url] = actor.dead?
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 戦闘不能判定
  39.   #--------------------------------------------------------------------------
  40.   def dead?
  41.     @dead
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # ● HP の割合を取得
  45.   #--------------------------------------------------------------------------
  46.   def hp_rate
  47.     @hp.to_f / @mhp
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● MP の割合を取得
  51.   #--------------------------------------------------------------------------
  52.   def mp_rate
  53.     @mmp > 0 ? @mp.to_f / @mmp : 0
  54.   end
  55. end

  56. #==============================================================================
  57. # ■ Game_Party
  58. #==============================================================================
  59. class Game_Party < Game_Unit
  60.   #--------------------------------------------------------------------------
  61.   # ● 公開インスタンス変数
  62.   #--------------------------------------------------------------------------
  63.   attr_accessor :mission                  # ミッション(ファイル画面表示用)
  64.   #--------------------------------------------------------------------------
  65.   # ● オブジェクト初期化
  66.   #--------------------------------------------------------------------------
  67.   alias initialize_save initialize
  68.   def initialize
  69.     initialize_save
  70.     @mission = ""
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● セーブファイル表示用の顔グラフィック画像情報
  74.   #--------------------------------------------------------------------------
  75.   def member_for_savefile
  76.     members.collect { |actor| SaveActor.new(actor) }
  77.   end
  78. end

  79. #==============================================================================
  80. # ■ DataManager
  81. #==============================================================================
  82. class << DataManager
  83.   #--------------------------------------------------------------------------
  84.   # ● セーブヘッダの作成
  85.   #--------------------------------------------------------------------------
  86.   alias make_save_header_faces make_save_header
  87.   def make_save_header
  88.     header = make_save_header_faces
  89.     header[:map_name] = $game_map.display_name
  90.     header[:actors]   = $game_party.member_for_savefile
  91.     header[:mission]  = $game_party.mission
  92.     header[:gold]     = $game_party.gold
  93.     header
  94.   end
  95. end


  96. #==============================================================================
  97. # ■ Window_SaveFile
  98. #==============================================================================
  99. class Window_SaveFile < Window_Base
  100.   #--------------------------------------------------------------------------
  101.   # ● オブジェクト初期化 [再定義]
  102.   #     index : セーブファイルのインデックス
  103.   #--------------------------------------------------------------------------
  104.   def initialize(height, index)
  105.     super(0, index * height, window_width, height)
  106.     @file_index = index
  107.     refresh
  108.     @selected = false
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● ウィンドウ幅
  112.   #--------------------------------------------------------------------------
  113.   def window_width
  114.     return 134
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● リフレッシュ [再定義]
  118.   #--------------------------------------------------------------------------
  119.   def refresh
  120.     contents.clear
  121.     change_color(normal_color)
  122.     name = Vocab::File + " #{@file_index + 1}"
  123.     draw_text(4, 0, 200, line_height, name)
  124.     @name_width = text_size(name).width
  125.   end
  126. end

  127. #==============================================================================
  128. # ■ Window_SaveFile
  129. #==============================================================================
  130. class Window_SaveInfo < Window_Selectable
  131.   #--------------------------------------------------------------------------
  132.   # ● オブジェクト初期化
  133.   #--------------------------------------------------------------------------
  134.   def initialize(x, h)
  135.     @actors = []
  136.     super(x, h, Graphics.width - x, Graphics.height - h)
  137.     self.file_index = index
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 項目の高さを取得
  141.   #--------------------------------------------------------------------------
  142.   def item_height
  143.     (contents_height - (line_height * 2)) / row_num
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● ウィンドウ内容の高さを計算
  147.   #--------------------------------------------------------------------------
  148.   def contents_height
  149.     height - standard_padding * 2
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 列数の取得
  153.   #--------------------------------------------------------------------------
  154.   def row_num
  155.     return 3
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 桁数の取得
  159.   #--------------------------------------------------------------------------
  160.   def col_max
  161.     return 2
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 下端パディングの更新
  165.   #--------------------------------------------------------------------------
  166.   def update_padding_bottom
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● 横に項目が並ぶときの空白の幅を取得
  170.   #--------------------------------------------------------------------------
  171.   def spacing
  172.     return 16
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ● 項目数の取得
  176.   #--------------------------------------------------------------------------
  177.   def item_max
  178.     return [@actors.size, 6].min
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● データ参照
  182.   #--------------------------------------------------------------------------
  183.   def data(header, symbol, default)
  184.     (header.nil? or header[symbol].nil?) ? default : header[symbol]
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● ファイル変更
  188.   #--------------------------------------------------------------------------
  189.   def file_index=(index)
  190.     return if @file_index == index
  191.     @file_index = index
  192.     header = DataManager.load_header(@file_index)
  193.     @actors   = data(header, :actors, [])
  194.     @map_name = data(header, :map_name, "")
  195.     @playtime = data(header, :playtime_s, "00:00:00")
  196.     @mission  = data(header, :mission, "")
  197.     @gold     = data(header, :gold, 0)
  198.     create_contents
  199.     refresh
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● リフレッシュ
  203.   #--------------------------------------------------------------------------
  204.   def refresh
  205.     super
  206.     if @actors.empty? or @actors.nil?
  207.       draw_text(0, 0, contents_width, contents_height, "- empty -", 1)
  208.       return
  209.     end
  210.     draw_text(0, 0, contents_width, line_height, @map_name)
  211.     draw_playtime(contents_width - 128, 0, 128)
  212.     draw_text_ex(0, line_height, @mission)
  213.     draw_gold(contents_width - 128, line_height, 128)
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 項目の描画
  217.   #--------------------------------------------------------------------------
  218.   def draw_item(index)
  219.     return if @actors.empty? or @actors.nil?
  220.     actor = @actors[index]
  221.     rect = item_rect(index)
  222.     rect.y += line_height * 2
  223.     draw_actor_face(actor, rect.x, rect.y, !actor.dead?)
  224.     draw_actor_name(actor,  rect.x + 100, rect.y+line_height*0)
  225.     draw_actor_level(actor, rect.x + 100, rect.y+line_height*1)
  226.     w = [124, rect.width - 100].min
  227.     draw_actor_hp(actor,   rect.x + 100, rect.y+line_height*2, w)
  228.     draw_actor_mp(actor,   rect.x + 100, rect.y+line_height*3, w)
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● プレイ時間の描画
  232.   #--------------------------------------------------------------------------
  233.   def draw_playtime(x, y, width)
  234.     change_color(system_color)
  235.     contents.font.size -= 8
  236.     draw_text(x, y+4, width, line_height, "TIME")
  237.     contents.font.size += 8
  238.     change_color(normal_color)
  239.     draw_text(x, y, width, line_height, @playtime, 2)
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 所持金の描画
  243.   #--------------------------------------------------------------------------
  244.   def draw_gold(x, y, width)
  245.     draw_currency_value(@gold, Vocab::currency_unit, x, y, width)
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● 水平線の描画
  249.   #--------------------------------------------------------------------------
  250.   def draw_horz_line(y)
  251.     line_y = y + line_height / 2 - 1
  252.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 水平線の色を取得
  256.   #--------------------------------------------------------------------------
  257.   def line_color
  258.     color = normal_color
  259.     color.alpha = 48
  260.     color
  261.   end
  262. end

  263. #==============================================================================
  264. # ■ Scene_File
  265. #==============================================================================
  266. class Scene_File < Scene_MenuBase
  267.   #--------------------------------------------------------------------------
  268.   # ● セーブファイルウィンドウの作成
  269.   #--------------------------------------------------------------------------
  270.   alias create_savefile_windows_save create_savefile_windows
  271.   def create_savefile_windows
  272.     create_savefile_windows_save
  273.     @info_window = Window_SaveInfo.new(@savefile_windows[0].window_width, @help_window.height)
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● 選択状態の初期化
  277.   #--------------------------------------------------------------------------
  278.   alias init_selection_save init_selection
  279.   def init_selection
  280.     init_selection_save
  281.     @info_window.file_index = @index
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ● 画面内に表示するセーブファイル数を取得
  285.   #--------------------------------------------------------------------------
  286.   def visible_max
  287.     return @savefile_viewport.rect.height / @help_window.height
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● カーソルの更新
  291.   #--------------------------------------------------------------------------
  292.   alias update_cursor_save update_cursor
  293.   def update_cursor
  294.     update_cursor_save
  295.     @info_window.file_index = @index
  296.   end
  297. end
复制代码
梦石
0
星屑
1608
在线时间
19 小时
注册时间
2015-11-8
回帖
2
 楼主| 发表于 2016-1-4 19:57:30 | 显示全部楼层
回复

使用道具 举报

梦石
0
星屑
1608
在线时间
19 小时
注册时间
2015-11-8
回帖
2
 楼主| 发表于 2016-1-4 20:04:33 | 显示全部楼层
我刚刚解决了
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部