| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 1 |  
| 经验 | 1716 |  
| 最后登录 | 2015-7-27 |  
| 在线时间 | 175 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间175 小时注册时间2011-12-28帖子93 | 
| 
本帖最后由 z12508186 于 2012-2-7 16:04 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 废话不多说,先上效果图。
 
   这是从RMXP中移植过来的。
 
 在脚本"Window_Gold"中的第13行。将fitting_height(1)中的1改成2(不然不够高度显示)
 再来就是从第18行下面插入以下代码即可。复制代码    super(0, 0, window_width, fitting_height(2))#金钱与时间窗口的高度
小白初试的改脚本。。。轻拍!复制代码    self.contents.font.color = system_color          #显示“游戏时间”这几个字的颜色
    self.contents.draw_text(4, 12, 120, 32, "游戏时间") #()中分别显示“游戏时间”这几个字的位置
    @total_sec = Graphics.frame_count / Graphics.frame_rate #游戏时间的取得
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)    #游戏时间的显示方式
    self.contents.font.color = normal_color                #显示“游戏时间”的颜色
    self.contents.draw_text(4, 27, 120, 32, text, 2)  #()中分别显示“游戏时间”的位置
 谢谢“星尘泪”的提醒。。已更正。。但后来又发现了更大的问题。。就是使用以上脚本会导致在商店买东西时。。显示金钱时也会把时间显示出来。。显示错位。。哈
 新图如下:
 
   这是显示系统当前时间(也就是时钟功能。。哈。。全屏时也不怕玩过头了)
 之后是游戏时间复制代码  #==============================================================================
# ■ Window_Timer
#------------------------------------------------------------------------------
#  显示系统当前时间的窗口
#==============================================================================
class Window_Timer < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(3))
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 120, 32, "当前时间") #显示文本位置,我没有细调。。
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    t = Time.now
    $game_variables[204] = t.wday  # 星期
    $game_variables[208] = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][$game_variables[204]]
    text = sprintf("%02d:%02d:%02d", t.hour, t.min, t.sec) 
    text2 = sprintf("%02d.%02d.%02d", t.year, t.month, t.day) 
    text3 = sprintf($game_variables[208]) 
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 20, 110, 32, text2, 2)
    self.contents.draw_text(-25, 40, 110, 32, text3, 2)
    self.contents.draw_text(-3, 60, 110, 32, text, 2)
  end
  #--------------------------------------------------------------------------
  # ● 打开窗口
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end
再之后是如何将上面的窗口创建出来并打开啦:复制代码#encoding:utf-8
#==============================================================================
# ■ Window_PlayTime
#------------------------------------------------------------------------------
#  显示游戏时间的窗口
#==============================================================================
class Window_PlayTime < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(2))#游戏时间窗口的高度
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 160 #游戏时间窗口的宽度
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 120, 32, "游戏时间")
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 20, 120, 32, text, 2)
  end
  #--------------------------------------------------------------------------
  # ● 打开窗口
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end
在Scene_Menu的第17行下插入再看看上面几行代码就不能发现。这是创建新的窗口用的。。当然。。这只是开头。。它还必须引用下面的代码:
 在“生成金钱窗口”下添加上面的内容即可。。。嘿嘿。。复制代码  #--------------------------------------------------------------------------
  # ● 生成金钱窗口
  #--------------------------------------------------------------------------
  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = Graphics.height - @gold_window.height
  end
  #--------------------------------------------------------------------------
  # ● 生成游戏时间窗口
  #--------------------------------------------------------------------------
  def create_playtime_window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = Graphics.height - @gold_window.height - @playtime_window.height
  end
   #--------------------------------------------------------------------------
  # ● 生成系统时间窗口
  #--------------------------------------------------------------------------
  def create_timer_window
    @timer_window = Window_Timer.new
    @timer_window.x = 0
    @timer_window.y = Graphics.height - @gold_window.height - @playtime_window.height - @timer_window.height
  end
 | 
 评分
查看全部评分
 |