赞 | 5 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 620
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023
|
交货
还有什麽要求或修改写出来
我明天起来再修改
- class Scene_Map < Scene_Base
- alias time_system_start start
- alias time_system_terminate terminate
- alias time_system_update update
- def start
- time_system_start
- @time_window = Window_Base.new(0, 0, 292, 56)
- update_time
- end
- def terminate
- time_system_terminate
- @time_window.dispose
- end
- def update
- @time_window.update
- time_system_update
- # 每分钟刷新一次时间计算
- update_time if Graphics.frame_count%18 == 0
- end
- def update_time
- @min ||= @hour ||= @day ||= @month ||= @year ||= 1
- @min += 1 if Graphics.frame_count%18 == 0
- @hour += 1 if @min%60 == 0
- if @hour%24 == 0
- @day += 1
- @change_weather = true
- end
- @month += 1 if @day%31 == 0
- @year += 1 if @month%12 == 0
- # 计算时段与色调
- case (@hour%24)
- when 3...7 # 清晨
- @phase = 0
- tone = Tone.new(-48, -48, -48)
- when 7...13 # 早上
- @phase = 1
- tone = Tone.new(0, 0, 0)
- when 13...19 # 傍晚
- @phase = 2
- tone = Tone.new(-32, -96, -96)
- else # 晚上
- @phase = 3
- tone = Tone.new(-128, -128, -32)
- end
-
- @weather_type = 0
- case (@month%12)
- when 2..4 # 春
- @season = 0
- if rand(10) < 5 and @change_weather
- @weather_type = 1
- @change_weather = false
- end
- when 5..7 # 夏
- @season = 1
- if rand(10) < 3 and @change_weather
- @weather_type = 1
- @change_weather = false
- end
- when 8..10 # 秋
- @season = 2
- if rand(10) < 4 and @change_weather
- @weather_type = 2
- @change_weather = false
- end
- else # 冬
- @season = 3
- if rand(10) < 7 and @change_weather
- @weather_type = 3
- @change_weather = false
- end
- end
- power = rand(2)+ rand(4) + rand(5) # 乱数生成强度
-
- # 开关控制色调、天气不显示
- if $game_switches[1] == false
- $game_map.screen.start_tone_change(tone, 120)
- $game_map.screen.weather(@weather_type, power, 120)
- end
-
- $game_variables[1] = @min%60 # 分
- $game_variables[2] = @hour%24 # 时
- $game_variables[3] = @phase # 时段
- $game_variables[4] = @day%31 # 日
- $game_variables[5] = @weather # 天气
- $game_variables[6] = @month%12 # 月
- $game_variables[7] = @season # 季节
- $game_variables[8] = @year # 年
-
- update_time_window
- end
- def update_time_window
- @time_window.contents.clear
- ssn_string = ["春", "夏", "秋", "冬"][@season]
- wea_string = ["晴", "雨", "风", "雪"][@weather_type]
- time_string = sprintf("%02d年%02d月%02d日 %02d:%02d ", @year, @month%12, @day%31, @hour%24, @min%60)
- time_string += "#{ssn_string} #{wea_string}"
- @time_window.contents.draw_text(0, 0, 260, 24, time_string)
- end
- end
复制代码 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|