Project1
标题: 把时间脚本改成24 小时的 [打印本页]
作者: xx小虾米xx 时间: 2012-3-9 08:29
标题: 把时间脚本改成24 小时的
本帖最后由 xx小虾米xx 于 2012-3-9 04:53 编辑
这脚本只有十二小时。。。。超过12就过1天。。。。这脚本里的24小时是电脑现实时间。。。。我想写24小时的游戏。。。帮忙看看
我想游戏时间计算大概要改一下。。帮忙看看。。拜托
我写在
脚本的大概重点我有在文字后面加颜色了
#================================================================================#
#****Window_Time #
#--------------------------------------------------------------------------------#
# 显示时间的窗口类 #
#================================================================================#
class Window_Time < Window_Base
#----------------------#
#*初始化对象 #
#----------------------#
def initialize
#更新窗口坐标
$game_variables[$time_window_pattern] = $default_pattern
@pattern_now = $default_pattern
time_date_window_update
#设定窗口
super($time_date_X, $time_date_Y, $time_date_W, $time_date_H)
self.contents = Bitmap.new($time_date_W - 32, $time_date_H - 32)
#self.contents.font.name = (["标楷体"]) #防错用
self.opacity = $time_window_opacity
#开关初始化 -- 预设防错的 不喜欢再用事件初始化
$game_switches[$time_date_running] = true #时间功能开启
$game_switches[$time_date_tone] = true #色调功能开启
$game_switches[$hide_window] = false #隐藏功能关闭
$game_switches[$real_time_format] = true #真实时间12小时制
$game_switches[$time_date_weather] = true #天气功能开启
$game_switches[$time_map_region] = true #区域功能开启
#变数归零
$weather_hour = nil
$weather_type_rand = 0
$hour_count = 0
$weather_hour = 0
$game_variables[$week] = 1
@id = $game_map.map_id
for i in [$min, $hour, $day, $month, $year]
if $game_variables == 0
$game_variables = 1
i+=1
end # end if
end # end for
#刷新窗口
refresh
end # end def initialize
#----------------------#
#*刷新 #
#----------------------#
def refresh
self.contents.clear
self.contents.font.size = $time_window_font_size
self.contents.font.color = game_date
#计算时间
if $game_switches[$time_date_running] == true
@total_sec = Graphics.frame_count
if @total_sec % $min_rate ==0
$game_variables[$min] += 1
end
if $game_variables[$min] >= $hour_rate + 1
$game_variables[$min] = 1
$game_variables[$hour] += 1
$hour_count += 1
end
if $game_variables[$hour] >= $day_rate + 1
$game_variables[$hour] = 1
$game_variables[$day] += 1
$game_variables[$week] += 1
if $game_variables[$week] == 8
$game_variables[$week] = 1
end
end
if $game_variables[$day] >= $month_rate + 1
$game_variables[$day] = 1
$game_variables[$month] += 1
end
if $game_variables[$month] >= $year_rate + 1
$game_variables[$month] = 1
$game_variables[$year] += 1
end
end
#判断是否在室内
newid = $game_map.map_id #获取地图ID
if newid != @id
@id = newid
end
$mapnames = load_data("Data/MapInfos.rxdata") #读取地图名称
map_name = $mapnames[@id].name
if map_name.include?("内") or map_name.include?(",IN")
#如果地图名称包含"内"或",IN"
$game_switches[$time_date_weather] = false #则不显示天气
$weather_hour = 0
$weather_type = 99 #99是让窗口不会显示天气
#应该不会有人定义99种天气吧
$game_variables[$time_map_region] = 98
end
time_date_window_update #窗口文字坐标调整
print_date #显示文字
get_season_weather #计算季节天气机率
show_festival #显示节日
get_region_weather #计算区域天气机率
if $game_switches[$time_date_weather] == true #天气功能开关为ON时
#如果天气需要归零
if $hour_count >= $weather_hour or $weather_hour == 0
$hour_count = 0 #天气持续时间归零
$weather_type_rand = rand(100) + 1 #随机数生成天气类型
$weather_power = rand(9) + 1 #随机数生成天气强度
$weather_hour = rand($weather_hour_max) + 1 #随机数出现天气时间
$weather_dur = 50
else
$weather_1_min = 1 #天气一最低机率
$weather_1_max = $weather_1_rate #天气一最高机率
$weather_2_min = $weather_1_max + 1 #天气二最低机率
$weather_2_max = $weather_2_min + $weather_2_rate #天气二最高机率
$weather_3_min = $weather_2_max + 1 #天气三最低机率
$weather_3_max = $weather_3_min + $weather_3_rate #天气三最高机率
$weather_4_min = $weather_3_max + 1 #天气四最低机率
$weather_4_max = $weather_4_min + $weather_4_rate #天气四最高机率
if $weather_1_rate != 0
if $weather_type_rand >= $weather_1_min and $weather_type_rand <=$weather_1_max
$weather_type = 0 #无
end
end
if $weather_2_rate != 0
if $weather_type_rand >= $weather_2_min and $weather_type_rand <=$weather_2_max
$weather_type = 1 #雨
end
end
if $weather_3_rate != 0
if $weather_type_rand >= $weather_3_min and $weather_type_rand <=$weather_3_max
$weather_type = 2 #风
end
end
if $weather_4_rate != 0
if $weather_type_rand >= $weather_4_min and $weather_type_rand <=$weather_4_max
$weather_type = 3 #雪
end
end
#播放天气BGS
#Audio.bgs_play("文件名",音量,节奏速度)
case $weather_type #当天气
when 0
Audio.bgs_stop
when 1 #是雨的情况下
Audio.bgs_play("Audio/BGS/005-Rain01", 60)
when 2 #是风的情况下
Audio.bgs_play("Audio/BGS/001-Wind01", 70)
when 3 #是雪的情况下
Audio.bgs_play("Audio/BGS/003-Wind03", 80)
end# end case
end # end if
$weather_dur = 50
else #如果天气开关为off
$weather_type, $weather_power, $weather_dur = [0,0,0]#将天气回复为无
end # end if
$game_screen.weather($weather_type, $weather_power, $weather_dur) #显示天气
if $game_switches[$time_date_tone] == true #如果色调开关为on
get_tone #显示色调
$game_screen.start_tone_change(Tone.new($tone_R, $tone_G, $tone_B, $tone_K), 50)
else #如果为off
#色调回复正常
$game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 1)
end # end if
#当人物走到窗口坐标时移动时间窗口
if $game_player.screen_x >= ($time_date_X - 16) && $game_player.screen_x <= ($time_date_X + $time_date_W + 16)
if $game_player.screen_y >= ($time_date_Y - 16) && $game_player.screen_y <= ($time_date_Y + $time_date_H + 16)
# +/- 16 像素是调整手感
self.x = $time_date_XM
self.y = $time_date_YM
time_date_screen_moved = true #避免与自动隐藏功能互相冲突
case $hide_direction #将隐藏方向改为相反的方向
when 2
$hide_direction = 8
when 4
$hide_direction = 6
when 6
$hide_direction = 4
when 8
$hide_direction = 2
end # end case
else #窗口回到原位
self.x = $time_date_X
self.y = $time_date_Y
time_date_screen_moved = false #避免与自动隐藏功能互相冲突
end # end if
else #窗口回到原位
self.x = $time_date_X
self.y = $time_date_Y
time_date_screen_moved = false #避免与自动隐藏功能互相冲突
end # end if
mouse_x, mouse_y = [-1, -1] #没使用鼠标脚本时防错
#如果使用鼠标脚本的话就取消注释
#如果不使用鼠标脚本的话就注释掉,否则会报错
#mouse_x, mouse_y = Mouse.get_mouse_pos #获得鼠标位置
#当按住A键时
#显示现实时间
if Input.press?(Input::A)
show_real_time
end # end if
#当鼠标移动到窗口时位置 或是按下Z键时
#显示已自动隐藏的时间窗口
if $game_switches[$hide_window] == true
case $hide_direction #调整隐藏方向
when 2
self.y = $time_date_Y + $time_date_H - $hide_window_width
when 4
self.x = -($time_date_W) + $hide_window_width
when 6
self.x = $time_date_X + $time_date_W - $hide_window_width
when 8
self.y = -($time_date_H) + $hide_window_width
end # end case
if Input.press?(Input::Z) or (mouse_x >= $time_date_X && mouse_x <= ($time_date_X + $time_date_W)) && (mouse_y >= $time_date_Y and mouse_y <= ($time_date_Y + $time_date_H))
if time_date_screen_moved == false #避免与自动移动功能互相冲突
self.x = $time_date_X
self.y = $time_date_Y
else
self.x = $time_date_XM
self.y = $time_date_YM
end
end # end if
else
if time_date_screen_moved == false #避免与自动移动功能互相冲突
self.x = $time_date_X
self.y = $time_date_Y
end
end # end if
#更新窗口坐标等
if $game_variables[$time_window_pattern] != @pattern_now
time_date_window_update
self.x = $time_date_X
self.y = $time_date_Y
self.z = $time_window_z
self.width = $time_date_W
self.height = $time_date_H
self.contents = Bitmap.new($time_date_W - 32, $time_date_H - 32)
@pattern_now = $game_variables[$time_window_pattern]
end
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
#================================================================================#
#****Window_Time #
#--------------------------------------------------------------------------------#
# 显示时间的窗口类 #
#================================================================================#
class Window_Time < Window_Base
def show_real_time
@time = Time.now
@time_hour = @time.hour # 用来计算十二小时制的 注意 . 和 _ 的差别
#text = sprintf("%02d年%02d月%02d日 [ ] %02d:%002d ", @time.year, @time.month, @time.day, @time_hour, @time.min)
self.contents.clear
self.contents.font.color = real_date
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($APM_x, $APM_y, 128, 32, text)
self.contents.draw_text($year_x, $year_y, 128, $year_font_size + 14, @time.year.to_s + "年")
self.contents.draw_text($month_x, $month_y, 128, $month_font_size + 14, @time.month.to_s + "月")
self.contents.draw_text($day_x, $day_y, 128, $day_font_size + 14, @time.day.to_s + "日")
self.contents.draw_text($hour_x , $hour_y, 128, $hour_font_size + 14, @time_hour.to_s)
self.contents.draw_text($hour_x + 26, $hour_y - 3, 128, $hour_font_size + 14, ":")
@time_min = sprintf("%02d", @time.min.to_s)
self.contents.draw_text($min_x - 3, $min_y, 128, $min_font_size + 14, @time_min)
#!!!!注意!!!!
#这里是真实时间的星期名称,
#若是要改变游戏时间的星期名称,请到第二部分282行
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($week_x, $week_y, 128, $week_font_size + 14, weektxt)
end# end def show_real_time
def get_season_weather
# 用季节区分天气类型出现机率
# 春天
case $game_variables[$season]
when 1
$weather_1_rate = $spring_none
$weather_2_rate = $spring_rain
$weather_3_rate = $spring_wind
$weather_4_rate = $spring_snow
# 夏天
when 2
$weather_1_rate = $summer_none
$weather_2_rate = $summer_rain
$weather_3_rate = $summer_wind
$weather_4_rate = $summer_snow
# 秋天
when 3
$weather_1_rate = $autumn_none
$weather_2_rate = $autumn_rain
$weather_3_rate = $autumn_wind
$weather_4_rate = $autumn_snow
# 冬天
when 4
$weather_1_rate = $winter_none
$weather_2_rate = $winter_rain
$weather_3_rate = $winter_wind
$weather_4_rate = $winter_snow
end # end case
end #end definition
end
脚本2
=begin
之所以分两段脚本是因为......
这个脚本时在太长了
要修改的时后恐怕找不到正确的地方
所以...要修改的文字, 要自定义的地方都在这里了
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#除了在这格解释的行, 其他的尽量别动,除非你会改
#1. 显示节日在477 行设定月份和日期及节日名即可.
# 节日可以设置天气, 此天气会覆盖随机数出现的天气.
#2. 改年, 月, 日, 时, 刻等行的紫色字的时候,如果字数超过默认的数目,
# 请在同一分歧内添加如: $month_space = ?? 范例请看"十一月"的注释.
#3. 请注意在修改星期名称的时候, 本脚本内有三处, 一是默认用28星宿代替星期名
# 二是真实时间的星期名称, 三才是显示非默认星期名称的地方 在 行
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
=end
#================================================================================#
#****Variable Self Define #
#--------------------------------------------------------------------------------#
# 自定义的变量 #
#================================================================================#
#窗口自定义
$time_date_running = 4 #自定义的时间功能开关
$time_date_weather = 5 #自定义的天气功能开关
$time_date_tone = 6 #自定义的色调功能开关
$hide_window = 7 #自定义的隐藏窗口功能开关
$real_time_format = 8 #真实时间的模式开关编号
$time_window_pattern = 9 #时间窗口的样式变量ID
$time_map_region = 10 #自定义的地图局部变量ID
$time_window_opacity = 255 #时间窗口不透明度
$time_window_z = 3000 #时间窗口高度
$time_window_font_size = 18 #时间窗口字号,建议不要动,否则版面要重排
$default_pattern = 0 #默认的窗口样式
$weather_hour_max = 5 #天气持续最长时间
$hide_window_width = 8 #隐藏窗口残留宽度
#自定义的时间换算率
$min_rate = 2400 #换算为一刻的祯数
$hour_rate = 5 #换算为一时的刻数
$day_rate = 12 #换算为一日的时数
$month_rate = 28 #换算为一月的日数
$year_rate = 12 #换算为一年的月数
#自定义的时间变量, 默认2, 3, 4, 5, 6, 7, 8为刻,时,日,月,年,星期,季节
#用变量是为了能在游戏中任意改变时间
$min = 2 #定义[刻]
$hour = 3 #定义[时]
$day = 4 #定义[日]
$month = 5 #定义[月]
$year = 6 #定义[年]
$week = 7 #定义[星]
$season = 8 #定义[季节]
#自定义的天气比例百分比,总和最好是100
$spring_none = 50 #春天天气为[无]的比例
$spring_rain = 22 #春天天气为[雨]的比例
$spring_wind = 25 #春天天气为[风]的比例
$spring_snow = 3 #春天天气为[雪]的比例
$summer_none = 35 #夏天天气为[无]的比例
$summer_rain = 35 #夏天天气为[雨]的比例
$summer_wind = 30 #夏天天气为[风]的比例
$summer_snow = 0 #夏天天气为[雪]的比例
#这项其实设为0就好了,之所以还弄个变量
#是为了让版面看起来整齐....还有也许有
#人会像要让异世界的夏天下雪 =_="
$autumn_none = 50 #秋天天气为[无]的比例
$autumn_rain = 12 #秋天天气为[雨]的比例
$autumn_wind = 35 #秋天天气为[风]的比例
$autumn_snow = 3 #秋天天气为[雪]的比例
$winter_none = 35 #冬天天气为[无]的比例
$winter_rain = 15 #冬天天气为[雨]的比例
$winter_wind = 15 #冬天天气为[风]的比例
$winter_snow = 35 #冬天天气为[雪]的比例
#自定义字型颜色,这是让想要时间窗口色彩丰富一点的人设计的
def game_date #游戏内的时间颜色
return Color.new(0, 0, 0, 255)
end
def real_date #现实的时间颜色
return Color.new(127, 127, 0, 255)
end
def year_color #描写[年]的颜色
return Color.new(0, 0, 0, 255)
end
def month_color #描写[月]的颜色
return Color.new(0, 0, 0, 255)
end
def day_color #描写[日]的颜色
return Color.new(0, 0, 0, 255)
end
def week_color #描写[星期]的颜色
return Color.new(0, 0, 0, 255)
end
def hour_color #描写[时]的颜色
return Color.new(0, 0, 0, 255)
end
def min_color #描写[刻]的颜色
return Color.new(0, 0, 0, 255)
end
def fes_color #描写[节日]的颜色
return Color.new(0, 0, 0, 255)
end
def weather_color #描写[天气]的颜色
return Color.new(0, 0, 0, 255)
end
def region_color #描写[区域]的颜色
return Color.new(0, 0, 0, 255)
end
#预设的时间排版间隔, 排版用, 建议别动, 除非要自己重新排版
$year_space =74 #[年]的间隔
$month_space = 38 #[月]的间隔
$day_space = 38 #[日]的间隔
$hour_space = 38 #[时]的间隔
$min_space = 38 #[刻]的间隔
#================================================================================#
# ■ Window_Time #
#--------------------------------------------------------------------------------#
# 显示时间的窗口类 #
#================================================================================#
class Window_Time < Window_Base
def print_date
#定义显示[年]
self.contents.font.color = year_color
self.contents.font.size = $year_font_size
case $game_variables[$year]
when 1
yeartxt = "江湖一年"
when 2
yeartxt = "江湖二年"
when 3
yeartxt = "江湖三年"
when 4
yeartxt = "江湖四年"
end
self.contents.draw_text($year_x, $year_y, 128, $year_font_size + 14, yeartxt)
#其实根本不需要那么多,一年就要跑很久了
#定义显示[月]
self.contents.font.color = month_color
self.contents.font.size = $month_font_size
#$month_x = $year_x + $year_space
case $game_variables[$month]
when 1
monthtxt = "正月" #一月
$game_variables[$season] = 4
when 2
monthtxt = "杏月" #二月
$game_variables[$season] = 1
when 3
monthtxt = "桃月" #三月
$game_variables[$season] = 1
when 4
monthtxt = "槐月" #四月
$game_variables[$season] = 1
when 5
monthtxt = "榴月" #五月
$game_variables[$season] = 2
when 6
monthtxt = "荷月" #六月
$game_variables[$season] = 2
when 7
monthtxt = "桐月" #七月
$game_variables[$season] = 2
when 8
monthtxt = "桂月" #八月
$game_variables[$season] = 3
when 9
monthtxt = "菊月" #九月
$game_variables[$season] = 3
when 10
monthtxt = "梅月" #十月
$game_variables[$season] = 3
when 11
monthtxt = "葭月" #十一月
$game_variables[$season] = 4
$month_space = 54 # 如果打[十一月]的话, 间隔须为 54
when 12
monthtxt = "腊月" #十二月
$game_variables[$season] = 4
end
self.contents.draw_text($month_x, $month_y, 128, $month_font_size + 14, monthtxt)
#定义显示[季节]
self.contents.font.size = $season_font_size
case $game_variables[$season]
when 1
self.contents.font.color = Color.new (0, 160, 75, 255)
seasontxt = "春"
when 2
self.contents.font.color = Color.new (255, 50, 50, 255)
seasontxt = "夏"
when 3
self.contents.font.color = Color.new (250, 240, 130, 255)
seasontxt = "秋"
when 4
self.contents.font.color = Color.new (40, 140, 200, 255)
seasontxt = "冬"
end
self.contents.draw_text($season_x, $season_y, 120, $season_font_size + 14, seasontxt)
#定义显示[日]
self.contents.font.color = day_color
self.contents.font.size = $day_font_size
#$day_x = $month_x + $month_space
case $game_variables[$day]
when 1
daytxt = "初一"
when 2
daytxt = "初二"
when 3
daytxt = "初三"
when 4
daytxt = "初四"
when 5
daytxt = "初五"
when 6
daytxt = "初六"
when 7
daytxt = "初七"
when 8
daytxt = "初八"
when 9
daytxt = "初九"
when 10
daytxt = "初十"
when 11
daytxt = "十一"
when 12
daytxt = "十二"
when 13
daytxt = "十三"
when 14
daytxt = "十四"
when 15
daytxt = "十五"
when 16
daytxt = "十六"
when 17
daytxt = "十七"
when 18
daytxt = "十八"
when 19
daytxt = "十九"
when 20
daytxt = "二十"
when 21
daytxt = "二一"
when 22
daytxt = "二二"
when 23
daytxt = "二三"
when 24
daytxt = "二四"
when 25
daytxt = "二五"
when 26
daytxt = "二六"
when 27
daytxt = "二七"
when 28
daytxt = "二八"
end
self.contents.draw_text($day_x, $day_y, 120, $day_font_size + 14, daytxt)
#定义显示[星期]
self.contents.font.color = week_color
self.contents.font.size = $week_font_size
if $game_variables[$time_window_pattern] != $default_pattern
case $game_variables[$week]
when 1
weektxt = "星期一"
when 2
weektxt = "星期二"
when 3
weektxt = "星期三"
when 4
weektxt = "星期四"
when 5
weektxt = "星期五"
when 6
weektxt = "星期六"
when 7
weektxt = "星期日"
end
self.contents.draw_text($week_x, $week_y, 128, $week_font_size + 14, weektxt)
end
#定义显示[时]
self.contents.font.color = hour_color
self.contents.font.size = $hour_font_size
#$hour_x = $day_x + $day_space
case $game_variables[$hour]
when 1
hourtxt = "子时"#11pm ~ 1am
when 2
hourtxt = "丑时"#1am ~ 3am
when 3
hourtxt = "寅时"#3am ~ 5am
when 4
hourtxt = "卯时"#5am ~ 7am
when 5
hourtxt = "辰时"#7am ~ 9am
when 6
hourtxt = "巳时"#9am ~ 11am
when 7
hourtxt = "午时"#11am ~ 1pm
when 8
hourtxt = "未时"#1pm ~ 3pm
when 9
hourtxt = "申时"#3pm ~ 5pm
when 10
hourtxt = "酉时"#5pm ~ 7pm
when 11
hourtxt = "戌时"#7pm ~ 9pm
when 12
hourtxt = "亥时"#9pm ~ 11pm
end
self.contents.draw_text($hour_x, $hour_y, 128, $hour_font_size + 14, hourtxt)
#定义显示[刻]
self.contents.font.color = min_color
self.contents.font.size = $min_font_size
#$min_x = $hour_x + $hour_space
case $game_variables[$min]
when 1
mintxt = "初刻"
when 2
mintxt = "二刻"
when 3
mintxt = "三刻"
when 4
mintxt = "四刻"
when 5
mintxt = "五刻"
end
self.contents.draw_text($min_x, $min_y, 128, $min_font_size + 14, mintxt)
#定义显示[天气]
self.contents.font.color = weather_color
self.contents.font.size = $weather_font_size
case $weather_type
when 0
weathertxt = "晴"
self.contents.font.color = Color.new(130, 202, 156)
when 1
weathertxt = "雨"
self.contents.font.color = Color.new(109, 205, 187)
when 2
weathertxt = "风"
self.contents.font.color = Color.new(120, 200, 240)
when 3
weathertxt = "雪"
self.contents.font.color = Color.new(255, 255, 255)
else
weathertxt = ""
end
self.contents.draw_text($weather_x, $weather_y, 128, $weather_font_size + 14, weathertxt)
#定义显示[星]
#!!!!注意!!!!
#这里是默认的二十八星宿代替星期名称.
#如果要修改游戏内星期名称, 请到???行.
#呵呵,因为太长了所以丢到后面来写了^^
case ($game_variables[$day] % 7) #色彩按七耀显示
when 1
self.contents.font.color = Color.new (0, 160, 75, 255) # 木
when 2
self.contents.font.color = Color.new (250, 240, 130, 255) # 金
when 3
self.contents.font.color = Color.new (225, 178, 0, 255) # 土
when 4
self.contents.font.color = Color.new (255, 255, 40, 255) # 日
when 5
self.contents.font.color = Color.new (255, 255, 150, 255) # 月
when 6
self.contents.font.color = Color.new (255, 50, 50, 255) # 火
when 0
self.contents.font.color = Color.new (40, 140, 200, 255) # 水
end
if $game_variables[$time_window_pattern] == $default_pattern
case $game_variables[$day]
when 1
weektxt = "角木蛟"
when 2
weektxt = "亢金龙"
when 3
weektxt = "氐土貉"
when 4
weektxt = "房日兔"
when 5
weektxt = "心月狐"
when 6
weektxt = "尾火虎"
when 7
weektxt = "箕水豹"
when 8
weektxt = "斗木獬"
when 9
weektxt = "牛金牛"
when 10
weektxt = "女土蝠"
when 11
weektxt = "虚日鼠"
when 12
weektxt = "危月燕"
when 13
weektxt = "室火猪"
when 14
weektxt = "壁水貐"
when 15
weektxt = "奎木狼"
when 16
weektxt = "娄金狗"
when 17
weektxt = "胃土雉"
when 18
weektxt = "昴日鸡"
when 19
weektxt = "毕月乌"
when 20
weektxt = "觜火猴"
when 21
weektxt = "参水猿"
when 22
weektxt = "井木犴"
when 23
weektxt = "鬼金羊"
when 24
weektxt = "柳土獐"
when 25
weektxt = "星日马"
when 26
weektxt = "张月鹿"
when 27
weektxt = "翼火蛇"
when 28
weektxt = "轸水蚓"
end
self.contents.draw_text($week_x, $week_y, 128, $week_font_size + 14, weektxt)
end
end
def get_tone
case $game_variables[$season]
#春天的时间色调
when 1
case $game_variables[$hour]
when 1
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
when 3
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#凌晨
when 4
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 40]#天刚亮
when 5
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 6
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 68, 44, 204]#日正当中
end
when 7
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 9
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 17, -17, 204]#日斜西
end
when 10
$tone_R, $tone_G, $tone_B, $tone_K = [68, 0, -17, 204]#黄昏
when 11
if $game_variables[$min] < 3
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#天刚黑
elsif $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
end
end #end case
#夏天的时间色调
when 2
case $game_variables[$hour]
when 1
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
when 3
if $game_variables[$min] < 3
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#凌晨
elsif $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 40]#天刚亮
end
when 4
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
end
when 6
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 68, 44, 204]#日正当中
end
when 7
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 10
if $game_variables[$min] == 4
$tone_R, $tone_G, $tone_B, $tone_K = [68, 0, -17, 204]#黄昏
elsif $game_variables[$min] < 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 17, -17, 204]#日斜西
end
when 11
if $game_variables[$min] < 3
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#天刚黑
elsif $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
end
end #end case
#秋天的时间色调
when 3
case $game_variables[$hour]
when 1
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
when 2
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#凌晨
when 4
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 40]#天刚亮
when 5
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 6
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 68, 44, 204]#日正当中
end
when 7
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 9
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 17, -17, 204]#日斜西
end
when 10
$tone_R, $tone_G, $tone_B, $tone_K = [68, 0, -17, 204]#黄昏
when 11
if $game_variables[$min] < 3
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#天刚黑
elsif $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
end
end #end case
when 4
#冬天的时间色调
case $game_variables[$hour]
when 1
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
when 2
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#凌晨
when 4
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 40]#天刚亮
end
when 5
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 6
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 68, 44, 204]#日正当中
end
when 7
$tone_R, $tone_G, $tone_B, $tone_K = [0, 0, 0, 0]#天全亮
when 9
if $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [68, 17, -17, 204]#日斜西
end
when 10
$tone_R, $tone_G, $tone_B, $tone_K = [68, 0, -17, 204]#黄昏
when 11
if $game_variables[$min] < 3
$tone_R, $tone_G, $tone_B, $tone_K = [-51, -51, -51, 170]#天刚黑
elsif $game_variables[$min] >= 3
$tone_R, $tone_G, $tone_B, $tone_K = [-187, -153, -102, 119]#午夜
end
end #end case
end # end case
end
def get_region_weather
self.contents.font.color = region_color
# 用地图区域区分天气类型出现机率
case $game_variables[$time_map_region]
# 1 为雪地 2 为沙漠 3 为山区 4 为海边 5 为湿地
# 第一个变数为晴天 第二个为雨 第三个为风 第四个为雪
when 0
regiontxt = ""
when 1
$weather_1_rate = 20
$weather_2_rate = 5
$weather_3_rate = 5
$weather_4_rate = 70
regiontxt = "雪地"
self.contents.font.color = Color.new(255, 255, 255)
when 2
$weather_1_rate = 30
$weather_2_rate = 2
$weather_3_rate = 68
$weather_4_rate = 0
regiontxt = "沙漠"
self.contents.font.color = Color.new(255, 247, 153)
when 3
$weather_1_rate = 30
$weather_2_rate = 30
$weather_3_rate = 30
$weather_4_rate = 10
regiontxt = "山区"
self.contents.font.color = Color.new(0, 195, 95)
when 4
$weather_1_rate = 40
$weather_2_rate = 25
$weather_3_rate = 45
$weather_4_rate = 30
regiontxt = "海边"
self.contents.font.color = Color.new(90, 155, 225)
when 5
$weather_1_rate = 40
$weather_2_rate = 55
$weather_3_rate = 25
$weather_4_rate = 20
regiontxt = "湿地"
self.contents.font.color = Color.new(100, 155, 55)
when 98 #这是多加一种天气消失的方法
$weather_1_rate = 100
$weather_2_rate = 0
$weather_3_rate = 0
$weather_4_rate = 0
regiontxt = "室内" #显示颜色为设定好的region色
when 99
$weather_1_rate = 100
$weather_2_rate = 0
$weather_3_rate = 0
$weather_4_rate = 0
regiontxt = "平原" #显示颜色为设定好的region色
end # end case
self.contents.draw_text($region_x, $region_y, 128, $region_font_size + 14, regiontxt)
end # end definition
def time_date_window_update
#防错误
if $game_variables[$time_window_pattern] < 0
$game_variables[$time_window_pattern] = 0
end # end if
#自定义日期窗口排版样式
case $game_variables[$time_window_pattern]
when 0
# x 坐标
$year_x = 4 #年的 x 坐标
$month_x = $year_x + $year_space #月的 x 坐标
$day_x = $month_x + $month_space #日的 x 坐标
$hour_x = $day_x + $day_space #时的 x 坐标
$min_x = $hour_x + $hour_space #刻的 x 坐标
$fes_x = $min_x + $min_space #节日的 x 坐标
$season_x = 450 #季节的 x 坐标
$week_x = 480 #星期的 x 坐标
$weather_x = 538 #天气的 x 坐标
$region_x = 320 #地形的X坐标
$APM_x = $min_x + 32 #真实时间AM/PM X座标
# y 坐标
$year_y = -5 #年的 y 坐标
$month_y = -5 #月的 y 坐标
$day_y = -5 #日的 y 坐标
$hour_y = -5 #时的 y 坐标
$min_y = -5 #刻的 y 坐标
$fes_y = -5 #节日的 y 坐标
$season_y = -5 #季节的 y 坐标
$week_y = -5 #星期的 y 坐标
$weather_y = -5 #天气的 y 坐标
$region_y = -5 #地形的 y 坐标
$APM_y = $min_y #真实时间AM/PM y座标
#字号
$year_font_size = $time_window_font_size #年的文字大小
$month_font_size = $time_window_font_size #月的文字大小
$day_font_size = $time_window_font_size #日的文字大小
$hour_font_size = $time_window_font_size #时的文字大小
$min_font_size = $time_window_font_size #刻的文字大小
$fes_font_size = $time_window_font_size #节日的文字大小
$season_font_size = $time_window_font_size #季节的文字大小
$week_font_size = $time_window_font_size #星期的文字大小
$weather_font_size = $time_window_font_size #天气的文字大小
$region_font_size = $time_window_font_size #天气的文字大小
$time_date_X = 0 #时间窗口X坐标
$time_date_Y = 425 #时间窗口Y坐标
$time_date_W = 640 #时间窗口宽度
$time_date_H = 55 #时间窗口高度
$time_date_XM = 0 #时间窗口移动后X坐标
$time_date_YM = 0 #时间窗口移动后Y坐标
$hide_direction = 2 #时间窗口隐藏方向 -- 下
when 1
# x 坐标
$year_x = 56 #年的 x 坐标
$month_x = $year_x + $year_space #月的 x 坐标
$day_x = $month_x + $month_space #日的 x 坐标
$hour_x = 56 #时的 x 坐标
$min_x = $hour_x + $hour_space #刻的 x 坐标
$fes_x = $min_x + $min_space + 3 #节日的 x 坐标
$season_x = 4 #季节的 x 坐标
$week_x = -2 #星期的 x 坐标
$weather_x = $week_x + 65 #天气的 x 坐标
$region_x = $weather_x +65 #地形的X坐标
$APM_x = $min_x + 32 #真实时间AM/PM X座标
# y 坐标
$year_y = -5 #年的 y 坐标
$month_y = $year_y #月的 y 坐标
$day_y = $year_y #日的 y 坐标
$hour_y = 17 #时的 y 坐标
$min_y = $hour_y #刻的 y 坐标
$fes_y = $hour_y #节日的 y 坐标
$season_y = $year_y #季节的 y 坐标
$week_y = 39 #星期的 y 坐标
$weather_y = $week_y #天气的 y 坐标
$region_y = $week_y #地形的 y 坐标
$APM_y = $min_y #真实时间AM/PM y座标
#字号
$year_font_size = 18 #年的文字大小
$month_font_size = 18 #月的文字大小
$day_font_size = 18 #日的文字大小
$hour_font_size = 18 #时的文字大小
$min_font_size = 18 #刻的文字大小
$fes_font_size = 18 #节日的文字大小
$season_font_size = 40 #季节的文字大小
$week_font_size = 18 #星期的文字大小
$weather_font_size = 18 #天气的文字大小
$region_font_size = 18 #天气的文字大小
#窗口样式
$time_date_X = 0 #时间窗口X坐标
$time_date_Y = 0 #时间窗口Y坐标
$time_date_W = 250 #时间窗口宽度
$time_date_H = 95 #时间窗口高度
$time_date_XM = 320 #时间窗口移动后X坐标
$time_date_YM = 0 #时间窗口移动后Y坐标
$time_window_opacity = 255 #时间窗口不透明度
$hide_direction = 8 #时间窗口隐藏方向 -- 上
when 2
# x 坐标
$year_x = 4 #年的 x 坐标
$month_x = 4 #月的 x 坐标
$day_x = 20 #日的 x 坐标
$hour_x = 4 #时的 x 坐标
$min_x = $hour_x + $hour_space #刻的 x 坐标
$fes_x = 4 #节日的 x 坐标
$season_x = 60 #季节的 x 坐标
$week_x = 14 #星期的 x 坐标
$weather_x = 30 #天气的 x 坐标
$region_x = 14 #地形的X坐标
$APM_x = $min_x + 18 #真实时间AM/PM X座标
# y 坐标
$year_y = -5 #年的 y 坐标
$month_y = 20 #月的 y 坐标
$day_y = 41 #日的 y 坐标
$hour_y = 121 #时的 y 坐标
$min_y = $hour_y #刻的 y 坐标
$fes_y = 66 #节日的 y 坐标
$season_y = $month_y #季节的 y 坐标
$week_y = 93 #星期的 y 坐标
$weather_y = 181 #天气的 y 坐标
$region_y = 148 #地形的 y 坐标
$APM_y = $min_y #真实时间AM/PM y座标
#字号
$year_font_size = 18 #年的文字大小
$month_font_size = 18 #月的文字大小
$day_font_size = 18 #日的文字大小
$hour_font_size = 18 #时的文字大小
$min_font_size = 18 #刻的文字大小
$fes_font_size = 18 #节日的文字大小
$season_font_size = 22 #季节的文字大小
$week_font_size = 18 #星期的文字大小
$weather_font_size = 18 #天气的文字大小
$region_font_size = 18 #天气的文字大小
#窗口样式
$time_date_X = 520 #时间窗口X坐标
$time_date_Y = 0 #时间窗口Y坐标
$time_date_W = 120 #时间窗口宽度
$time_date_H = 240 #时间窗口高度
$time_date_XM = 0 #时间窗口移动后X坐标
$time_date_YM = 0 #时间窗口移动后Y坐标
$time_window_opacity = 255 #时间窗口不透明度
$game_switches[$hide_window] = true #隐藏功能关闭
#注意!! 加了以上那行脚本, 就无法关闭隐藏功能
#如果还想让隐藏功能在游戏中自由开关的话, 请用事件初始化
$hide_direction = 6 #时间窗口隐藏方向 -- 右
#可以一直加 when下去
end # end case
end # end def time_date_window_update
def show_festival
#$game_screen.start_tone_change(Tone.new(R,G,B,A),祯数) 色调
#$game_screen.weather(type, power, duration) 天气
#--------------------------------------------------------------------------
# ● 设定天气
# type : 类型 0 无 1 下雨 2 刮风 3 下雪
# power : 强度 1~9
# duration : 时间 10~200 祯数
#--------------------------------------------------------------------------
#定义[节日/节气]
#$fes_x = $min_x + $min_space
# 月份
# 日期
self.contents.font.color = fes_color
case $game_variables[$month]
when 1
case $game_variables[$day]
when 6
festxt = "[小寒]"
when 21
festxt = "[大寒]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 2
case $game_variables[$day]
when 5
festxt = "[立春]"
when 19
festxt = "[雨水]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 3
case $game_variables[$day]
when 5
festxt = "[惊蛰]"
when 20
festxt = "[春分]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 4
case $game_variables[$day]
when 5
festxt = "[清明]"
when 20
festxt = "[谷雨]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 5
case $game_variables[$day]
when 5
festxt = "[立夏]"
#festxt = "[端午]"
when 21
festxt = "[小满]"
else
festxt = "[无节日]"
festxt != ""
end # end case day
# 月份
# 日期
when 6
case $game_variables[$day]
when 6
festxt = "[芒种]"
when 21
festxt = "[夏至]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 7
case $game_variables[$day]
when 7
festxt = "[小暑]"
when 23
festxt = "[大暑]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 8
case $game_variables[$day]
when 7
festxt = "[立秋]"
when 15
festxt = "[中秋]"
$weather_type, $weather_power, $weather_dur = [0,0,0]
when 23
festxt = "[处暑]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 9
case $game_variables[$day]
when 8
festxt = "[白露]"
when 23
festxt = "[秋分]"
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 10
case $game_variables[$day]
when 8
festxt = "[寒露]"
$weather_type, $weather_power, $weather_dur = [3,1,20]#雪
when 23
festxt = "[霜降]"
$weather_type, $weather_power, $weather_dur = [3,2,20]#雪
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 11
case $game_variables[$day]
when 7
festxt = "[立冬]"
$weather_type, $weather_power, $weather_dur = [3,6,20]#雪
when 22
festxt = "[小雪]"
$weather_type, $weather_power, $weather_dur = [3,7,20]#雪
else
festxt = "[无节日]"
end # end case day
# 月份
# 日期
when 12
case $game_variables[$day]
when 7
festxt = "[大雪]"
$weather_type, $weather_power, $weather_dur = [3,9,20]#雪
when 21
festxt = "[冬至]"
$weather_type, $weather_power, $weather_dur = [3,8,20]#雪
else
festxt = "[无节日]"
end # end case day
end# end case month
#--------------------------复制贴上在此线之上即可-------------------------------
self.contents.draw_text($fes_x, $fes_y, 128, $fes_font_size + 14, festxt)
end # end def show_festival
end #end class
我是这样写的
把他加多加几句。。。。
#定义显示[时]
self.contents.font.color = hour_color
self.contents.font.size = $hour_font_size
#$hour_x = $day_x + $day_space
case $game_variables[$hour]
when 1
hourtxt = "01:"#1pm ~ 1am
when 2
hourtxt = "02:"#1am ~ 3am
when 3
hourtxt = "03:"#3am ~ 5am
when 4
hourtxt = "04:"#5am ~ 7am
when 5
hourtxt = "05"#7am ~ 9am
when 6
hourtxt = "06:"#9am ~ 11am
when 7
hourtxt = "07:"#11am ~ 1pm
when 8
hourtxt = "08:"#1pm ~ 3pm
when 9
hourtxt = "09:"#3pm ~ 5pm
when 10
hourtxt = "10:"#5pm ~ 7pm
when 11
hourtxt = "11:"#7pm ~ 9pm
when 12
hourtxt = "12:"#9pm ~ 11pm
when 13
hourtxt = "13:"#11pm ~ 1am
when 14
hourtxt = "14:"#1am ~ 3am
when 15
hourtxt = "15"#3am ~ 5am
when 16
hourtxt = "16"#5am ~ 7am
when 17
hourtxt = "辰时"#7am ~ 9am
when 18
hourtxt = "巳时"#9am ~ 11am
when 19
hourtxt = "午时"#11am ~ 1pm
when 20
hourtxt = "未时"#1pm ~ 3pm
when 21
hourtxt = "申时"#3pm ~ 5pm
when 22
hourtxt = "酉时"#5pm ~ 7pm
when 23
hourtxt = "戌时"#7pm ~ 9pm
when 24
hourtxt = "亥时"#9pm ~ 11pm