查看: 2073|回复: 1

[已经解决] 小问题请教:filename何用?及at

[复制链接]
梦石
0
星屑
49
在线时间
157 小时
注册时间
2013-8-14
回帖
155
发表于 2013-8-29 16:28:45 | 显示全部楼层 |阅读模式

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

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

×
Window_SaveFile
[pre lang="ruby" line="13"]  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     file_index : 存档文件的索引 (0~3)
  #     filename   : 文件名
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(0, 64 + file_index % 4 * 104, 640, 104)
    self.contents = Bitmap.new(width - 32, height - 32)
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.rxdata"
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@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
[/pre]


问题 :
1. def initialize(file_index, filename) 的参数filename 到处找不着引用他的地方...请问设置filename 参数有啥用?...
2. 请问@time_stamp = Time.at(0) 的at(0) 的意思


另外...
Scene_File
[pre lang="ruby" line="15"]  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    # 生成帮助窗口
    @help_window = Window_Help.new
    @help_window.set_text(@help_text)
    # 生成存档文件查
    @savefile_windows = []
    for i in 0..3
      @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
    end
[/pre]
filename 参数是make_filename(i)
梦石
0
星屑
122
在线时间
552 小时
注册时间
2012-8-18
回帖
1392
发表于 2013-8-29 16:36:29 | 显示全部楼层
filename看样子是没用……orz
至于Time.at 这个F1里面没有 需要参考 http://www.kuqin.com/rubycndocument/index.html 的内部类-Time
QQ截图20130829163146.png

点评

谢了  发表于 2013-8-29 18:22

评分

参与人数 2星屑 +112 收起 理由
︶ㄣ牛排ぶ + 100 认可答案
orzfly + 12 无脑儿塞糖

查看全部评分

我要填坑!我要背单词!我要学日语!我要每天锻炼!
好吧呵呵= =
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部