| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 1 |  
| 经验 | 3214 |  
| 最后登录 | 2013-12-31 |  
| 在线时间 | 54 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间54 小时注册时间2013-1-3帖子128 | 
4楼
 
 
 楼主|
发表于 2013-6-23 19:00:35
|
只看该作者 
| 本帖最后由 asdwds 于 2013-6-23 19:08 编辑 
 Sion 发表于 2013-6-23 16:16 ![]() 存地图名读取的时候展开保存跟绘制脸图就修改下面的两个方法吧:
 each_with_index 和 [:map_name]的[]未定义报错,请问是为什么?
 
 #==============================================================================
 # ■ Game_Party
 #------------------------------------------------------------------------------
 #  管理队伍的类。保存有金钱及物品的信息。本类的实例请参考 $game_party 。
 #==============================================================================
 #--------------------------------------------------------------------------
 # ● 存档文件显示用的角色图
 #--------------------------------------------------------------------------
 def faces_for_savefile
 battle_members.collect do |actor|
 [actor.face_name, actor.face_index]
 end
 end
 #==============================================================================
 # ■ Window_SaveFile
 #==============================================================================
 class Window_SaveFile < Window_Base
 #--------------------------------------------------------------------------
 # ● 刷新
 #--------------------------------------------------------------------------
 def refresh
 contents.clear
 change_color(normal_color)
 name = Vocab::File + " #{@file_index + 1}"
 draw_text(4, 0, 200, line_height, name)
 @name_width = text_size(name).width
 draw_playtime(0, 34, contents.width - 4, 2)
 draw_party_faces(100, -10)
 map_name = DataManager.load_header(@file_index)[:map_name]#说[]错误
 draw_text(320-16, 0, 200, 32, map_name, 2)
 end
 #--------------------------------------------------------------------------
 # ● 画角色图
 #--------------------------------------------------------------------------
 def draw_party_faces(x, y)
 header = DataManager.load_header(@file_index)
 return unless header
 header[:faces].each_with_index do |data, i| #each_with_index 报错
 draw_character(data[0], data[1], x + i * 48, y)
 end
 end
 
 end
 #==============================================================================
 # ■ DataManager
 #------------------------------------------------------------------------------
 #  数据库和游戏实例的管理器。所有在游戏中使用的全局变量都在这里初始化。
 #==============================================================================
 module DataManager
 #--------------------------------------------------------------------------
 # ● 生成存档的头数据
 #--------------------------------------------------------------------------
 def self.make_save_header
 header = {}
 header[:characters] = $game_party.characters_for_savefile
 header[:playtime_s] = $game_system.playtime_s
 header[:faces] = $game_party.faces_for_savefile
 header[:map_name] = $game_map.display_name
 header
 end
 end
 | 
 |