Project1

标题: 游戏时间改为系统时间 [打印本页]

作者: wyffaddy    时间: 2008-6-20 04:43
标题: 游戏时间改为系统时间
从主战找到了一个脚本,我把它演变成菜单里的游戏时间了。
下面切入正题:
先吧Window_PlayTime的脚本覆盖

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Window_PlayTime
  6. #------------------------------------------------------------------------------
  7. #  菜单画面显示游戏时间的窗口。
  8. #==============================================================================

  9. class Window_PlayTime < Window_Base
  10.   #--------------------------------------------------------------------------
  11.   # ● 初始化对像
  12.   #--------------------------------------------------------------------------
  13.   def initialize
  14.     super(0, 0, 160, 128 )
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 刷新
  20.   #--------------------------------------------------------------------------
  21.   def refresh
  22.     self.contents.clear
  23.     self.contents.font.color = system_color
  24.     self.contents.draw_text(4, -4, 120, 32, "当前时间")
  25.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  26.     t = Time.now
  27. $game_variables[204] = t.wday  # 星期
  28. $game_variables[208] = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][$game_variables[204]]
  29. text = sprintf("%02d:%02d:%02d", t.hour, t.min, t.sec)
  30. text2 = sprintf("%02d.%02d.%02d", t.year, t.month, t.day)
  31. text3 = sprintf($game_variables[208])
  32. self.contents.font.color = normal_color
  33.     self.contents.draw_text(4, 24, 110, 32, text2, 2)
  34.     self.contents.draw_text(-25, 48, 110, 32, text3, 2)
  35.     self.contents.draw_text(-3, 72, 110, 32, text, 2)
  36.     end
  37.   #--------------------------------------------------------------------------
  38.   # ● 刷新画面
  39.   #--------------------------------------------------------------------------
  40.   def update
  41.     super
  42.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  43.       refresh
  44.     end
  45.   end
  46. end
  47. #==============================================================================
  48. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  49. #==============================================================================
复制代码

好了,然后进入Window_Steps
在第12行
    super(0, 0, 160, 96)
改为
    super(0, 0, 160, 64)

在第24行
    self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
改为
    self.contents.draw_text(4, 0, 120, 32, $game_party.steps.to_s, 2)

最后
在Scene_Menu里面
将48行的
    @steps_window.y = 320
改为
    @steps_window.y = 352
大功告成!


作者: 火鸡三毛老大    时间: 2008-6-20 04:59
XP好像很久之前就有了....
作者: wyffaddy    时间: 2008-6-20 05:06
什么意思?
我弄的是系统时间,
不是游戏时间。
你的话有些深奥……
作者: 劍之飛龍☆    时间: 2008-6-20 05:11
虽然早就知道了,但还是顶下
作者: wyffaddy    时间: 2008-6-20 05:22
说真的,我是第一次该脚本,就怕改的出错了改不会来了。我记忆力不好呀{/gg}。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1