赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 552 |
最后登录 | 2012-4-11 |
在线时间 | 73 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 73 小时
- 注册时间
- 2010-8-2
- 帖子
- 148
|
---------------------------
天剑传:方剑军·陈
---------------------------
脚本 'Window_SaveFile' 的 61 行 发生了 NoMethodError。
undefined method `character_name' for ["方剑", 0]:Array
---------------------------
确定
---------------------------
脚本发上:- #==============================================================================
- # ■ Window_SaveFile
- #------------------------------------------------------------------------------
- # 显示存档以及读档画面、保存文件的窗口。
- #==============================================================================
- class Window_SaveFile < Window_Base
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :filename # 文件名
- attr_reader :selected # 选择状态
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # file_index : 存档文件的索引 (0~3)
- # filename : 文件名
- #--------------------------------------------------------------------------
- def initialize(file_index, filename)
- super(file_index % 4 * (640/4), 0, 640/4, 480-64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- @file_index = file_index
- @filename = "Save/Save#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- @hash = load_data("Save/Savelist.inf")
- @data = @hash[@filename]
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- # 描绘文件编号
- self.contents.font.color = normal_color
- if @file_index != 3
- name = "回忆 #{@file_index + 1}"
- self.contents.draw_text(20, 16, 600, 32, name)
- else
- name = "自动存档"
- self.contents.draw_text(18, 16, 600, 32, name)
- end
- @name_width = contents.text_size(name).width
- # 存档文件存在的情况下
- if @file_exist
- # 描绘角色
- for i in [email protected]
- bitmap = RPG::Cache.character(@characters[i].character_name, @characters[i].character_hue)
- cw = bitmap.rect.width / 4
- ch = bitmap.rect.height / 4
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(16 + i * 48, 96 - ch, bitmap, src_rect)
-
- bitmap = RPG::Cache.battler(@characters[i].battler_name, @characters[i].battler_hue)
- cw = bitmap.rect.width
- ch = bitmap.rect.height
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(16, 64, bitmap, src_rect)
- end
- # 描绘游戏时间
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- self.contents.font.size = 16
- self.contents.draw_text(8, 224, 180, 16, "#{@characters[0].name}", 0)
- self.contents.draw_text(8, 240, 180, 16, "lv.#{@characters[0].level.to_s}", 0)
- hp_and_sp
- time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.draw_text(8, 256+32, 180, 16, time_string, 0)
- time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
- self.contents.draw_text(8, 256+48, 180, 16, time_string, 0)
- self.contents.draw_text(8, 256+64, 180, 16, "杀敌数 : #{@game_system.enemy_cun}", 0)
- self.contents.draw_text(8, 256+64+16, 256, 16, "完成任务 : #{@game_system.over_mess.keys.size}", 0)
- end
- end
- def hp_and_sp
- cw = @characters[0].hp*118/@characters[0].maxhp
- self.contents.fill_rect(8,265,120,10,Color.new(255,255,255))
- for i in 0..7
- self.contents.fill_rect(9,266+i,118,1,Color.new(163-(i*16),128-(i*16),128-(i*16)))
- end
- for i in 0..7
- self.contents.fill_rect(9,266+i,cw,1,Color.new(255-(i*16),128-(i*16),128-(i*16)))
- end
- cw = @characters[0].sp*118/@characters[0].maxsp
- self.contents.fill_rect(8,278,120,10,Color.new(255,255,255))
- for i in 0..7
- self.contents.fill_rect(9,279+i,118,1,Color.new(128-(i*16),128-(i*16),163-(i*16)))
- end
- for i in 0..7
- self.contents.fill_rect(9,279+i,cw,1,Color.new(128-(i*16),128-(i*16),255-(i*16)))
- end
- self.contents.draw_text(8, 256, 180, 16, "hp.#{@characters[0].hp.to_s}/#{@characters[0].maxhp.to_s}", 0)
- self.contents.draw_text(8, 256+16, 180, 16, "sp.#{@characters[0].sp.to_s}/#{@characters[0].maxsp.to_s}", 0)
- end
- #--------------------------------------------------------------------------
- # ● 设置选择状态
- # selected : 新的选择状态 (true=选择 false=不选择)
- #--------------------------------------------------------------------------
- def selected=(selected)
- @selected = selected
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @selected
- self.cursor_rect.set(16, 16, @name_width+8, 32)
- else
- self.cursor_rect.empty
- end
- end
- end
复制代码 |
|