Project1
标题:
一个与RTAB工程冲突的问题
[打印本页]
作者:
zero2
时间:
2007-7-10 11:55
标题:
一个与RTAB工程冲突的问题
一个与RTAB工程冲突的问题
如何让这个工程与RTAB兼容,还有里面的电子时钟如何呼出显示,以及如何让时钟显示的时间为玩家电脑系统时间?
此工程下载地址:
http://rpg.blue/upload_program/files/完美昼夜时间系统.rar
作者:
zero2
时间:
2007-7-10 11:55
标题:
一个与RTAB工程冲突的问题
一个与RTAB工程冲突的问题
如何让这个工程与RTAB兼容,还有里面的电子时钟如何呼出显示,以及如何让时钟显示的时间为玩家电脑系统时间?
此工程下载地址:
http://rpg.blue/upload_program/files/完美昼夜时间系统.rar
作者:
雪流星
时间:
2007-7-10 18:40
临时作出来的
座标调整的不是很好
只能显示玩家电脑的时间
试试看吧
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
复制代码
作者:
zero2
时间:
2007-7-11 05:55
先谢了……但是
怎么判定到了某时间,才可开启的事件?例如8点开门的商店。
还有,最好加入SDK中的太阳影子效果。
作者:
雪流星
时间:
2007-7-11 06:24
就是那些作息开关吧!
在上面的腳本 end # end def refresh 前面加上
#时段控制
$game_variables[$hour] = @time.hour #注意是"."
case $game_variables[$hour]
when 8
$game_variables[$time_range] = 1 #上午
when 12
$game_variables[$time_range] = 2 #中午
when 13
$game_variables[$time_range] = 3 #下午
when 17
$game_variables[$time_range] = 4 #傍晚
when 19
$game_variables[$time_range] = 5 #晚上
end
复制代码
在 $real_time_format = 8 下面加上
$hour = 2 #小时的变量ID
$time_range = 3 #纪录时段的变量ID
复制代码
其他的如假日、周末等触类庞通即可
PS. 个人比较喜欢用变量^^
作者:
zero2
时间:
2007-7-11 07:32
{/cy}非常感谢LZ!!{/qiang}
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1