赞 | 5 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 620
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023
|
临时作出来的
座标调整的不是很好
只能显示玩家电脑的时间
试试看吧
PS:我作的另一个时间显示系统
http://rpg.blue/viewthread.php?tid=60056
- #================================================================================#
- #****Window_Time #
- #--------------------------------------------------------------------------------#
- # 显示时间的窗口类 #
- #================================================================================#
- class Window_Time < Window_Base
- #----------------------#
- #*初始化对象 #
- #----------------------#
- def initialize
-
- $time_date_running = 7 #真实时间视窗显示/不显示
- $real_time_format = 8 #真实时间的模式开关编号
- #设定窗口
- super(0, 425, 320, 55)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 255
-
- $game_switches[$real_time_format] = true #真实时间12小时制
- $game_switches[$time_date_running] = true
-
- #刷新窗口
- refresh
- end # end def initialize
- #----------------------#
- #*刷新 #
- #----------------------#
- def refresh
- self.contents.clear
- self.contents.font.size = 18
-
- @time = Time.now
- @time_hour = @time.hour # 用来计算十二小时制的 注意 . 和 _ 的差别
-
- self.contents.clear
- self.contents.font.size = 22
-
- if $game_switches[$real_time_format] == true
- if @time_hour >= 12
- @time_hour -= 12
- text = "PM"
- else
- text = "AM"
- end # end if
- else
- text = ""
- end # end if
-
- self.contents.draw_text(224, -5, 128, 32, text)
- self.contents.draw_text(4, -5, 128, 32, @time.year.to_s + "年")
- self.contents.draw_text(78, -5, 128, 32, @time.month.to_s + "月")
- self.contents.draw_text(116, -5, 128, 32, @time.day.to_s + "日")
- self.contents.draw_text(152, -5, 128, 32, @time_hour.to_s)
- self.contents.draw_text(154 + 26, -8, 128, 32, ":")
- self.contents.draw_text(192 - 3, -5, 128, 32, @time.min.to_s)
-
- case @time.wday
- when 0
- weektxt = "周日"
- when 1
- weektxt = "周一"
- when 2
- weektxt = "周二"
- when 3
- weektxt = "周三"
- when 4
- weektxt = "周四"
- when 5
- weektxt = "周五"
- when 6
- weektxt = "周六"
- end # end case
- self.contents.draw_text(480, -5, 128, 32, weektxt)
- end # end def refresh
- #----------------------#
- #*刷新画面 #
- #----------------------#
- def update
- super
- refresh
- end # end def update
- end# end class Window_time
- #================================================================================#
- #****Scene_Map #
- #--------------------------------------------------------------------------------#
- # 处理地图画面的类别。 #
- #================================================================================#
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- alias timedate_main main
- def main
- # 产生活动区块
- @spriteset = Spriteset_Map.new
- # 产生讯息视窗
- @message_window = Window_Message.new
- # 产生时间视窗
- @time_window = Window_Time.new
- if $game_switches[$time_date_running] == false
- @time_window.visible = false
- end # end if
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 更新游戏画面
- Graphics.update
- # 更新输入讯息
- Input.update
- # 更新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end # end if
- end # end loop
- # 准备过渡
- Graphics.freeze
- # 释放活动区块
- @spriteset.dispose
- # 释放讯息视窗
- @message_window.dispose
- # 释放时间视窗
- @time_window.dispose
- # 标题画面切换中的情况下
- if $scene.is_a?(Scene_Title)
- # 淡入淡出画面
- Graphics.transition
- Graphics.freeze
- end # end if
- end # end def main
-
- alias timedate_update update
- def update
-
- #如果时间日期功能开关为OFF则不显示时间视窗
- if $game_switches[$time_date_running] == false
- @time_window.visible = false
- else
- @time_window.visible = true
- end # end if
- @time_window.refresh
- timedate_update
- end # end def update
- end #end class Scene_Map
复制代码 |
|