赞 | 451 |
VIP | 56 |
好人卡 | 75 |
积分 | 424 |
经验 | 124650 |
最后登录 | 2024-11-22 |
在线时间 | 7602 小时 |
Lv5.捕梦者 (管理员) 老黄鸡
- 梦石
- 0
- 星屑
- 42399
- 在线时间
- 7602 小时
- 注册时间
- 2009-7-6
- 帖子
- 13506
|
本帖最后由 fux2 于 2011-8-30 23:02 编辑
给你一个以前写的昼夜系统吧.
精灵的昼夜.zip
(364.44 KB, 下载次数: 56)
- # 创作 by fux2
- # 改良 by 精灵
- # 导航指令
- # mistmara(true/false) 默认:mistmara(false) # 梦魇模式开/关
- # settime(小时,分钟) 默认:settime(0,0) # 设定时间
- # show(1/0,1/0,1/0) 默认:show(1,1,1) # 显示设置(图标,描述,时间)
- # setstop(false) 默认:setstop(true) # 停止时间流动
- # setcount(数字) 默认:setcount(1) # 每秒增加多少计数,默认60,现实的1秒等于游戏的1分
- #============================================================================
- # 之所以全部用全局变量是方便在存档的时候一起存进数据
- $time_hour_now = 0 # 设定当前时针
- $time_minute_now = 0 # 设定当前分针
- $time_count = 60 # 设置时间流逝速度[初始1,每秒加1]
- $time_stop_count = 0 # 备用时间流逝速度
- $time_totalcount = 0 # 设置总时间
- $blink = false # 秒针的闪烁
- $time_icon = (($time_hour_now * 60 + $time_minute_now) / 90).to_i # 储存图标时间
- $Mistmara_mode = false # 梦魇模式开关
- $time_disrc = "凌晨" # 时间描述
- $checktime = 0 # 核对时间
- $check_tone_time = [] # 色调区间核对
- $time_stop_hour = 0 # 临时时间
- $time_stop_minute = 0 # 同上
- $time_stop_totalcount = 0 # 同上
- $showtimer = [1,1,1] # 是否显示时钟(图标,描述,时间)
-
- class Icon < Window_Base
- # 时间描述模块,前7组时间段[起始时间,结束时间],中7组时间段描述,后7组时间段色调[[R,G,B,灰],时间]
- TIME_BLOCK = [[0,5],[6,8],[9,10],[11,13],[14,16],[17,18],[19,21],[22,23],"凌晨","早上","上午","中午","下午","傍晚","晚上","深夜",[[-102,-102,17,0],120],[[-51,-51,0,0],120],[[-10,-10,20,0],120],[[0,0,0,0],120],[[17,17,0,0],120],[[0,0,-64,0],120],[[-32,-32,64,0],120],[[-68,-68,0,0],120]]
-
- def initialize
- super(540,5,200,200)
- self.opacity = 0
- self.back_opacity = 0
- self.contents_opacity = 255
- self.contents = Bitmap.new(168, 168)
- end
- # 时间更改
- def Time_Changed
- unless $time_count == 0
- if Graphics.frame_count / (Graphics.frame_rate / 2) != $checktime
- $checktime = Graphics.frame_count / (Graphics.frame_rate/ 2)
- if !$blink
- $blink = true
- if $time_totalcount + $time_count < 86400
- $time_totalcount += $time_count
- else
- $time_totalcount = ($time_totalcount + $time_count) % 86400
- end
- $time_hour_now = $time_totalcount / 3600
- $time_minute_now = ($time_totalcount % 3600) / 60
- else
- $blink = false
- end
- end
- end
- end
- # 时间状态描述
- def Get_time_disrc
- if $Mistmara_mode
- # 梦魇模式设置
- $game_screen.start_tone_change(Tone.new(-136,-170,-102,153),10 * 2)
- return "梦魇"
- else
- # 正常模式
- for i in 0..7
- if $time_hour_now >= TIME_BLOCK[i][0] && $time_hour_now <= TIME_BLOCK[i][1]
- unless $check_tone_time == i
- $game_screen.start_tone_change(Tone.new(TIME_BLOCK[i+16][0][0],TIME_BLOCK[i+16][0][1],TIME_BLOCK[i+16][0][2],TIME_BLOCK[i+16][0][3]),TIME_BLOCK[i+16][1].to_i * 2)
- end
- return TIME_BLOCK[i+8]
- end
- end
- end
- end
- # 梦魇模式
- def Mistmara_mode(statu)
- if statu == true
- $Mistmara_mode = true
- $time_stop_hour, $time_stop_minute , $time_stop_totalcount = $time_hour_now, $time_minute_now, $time_totalcount
- $blink = true
- else
- $Mistmara_mode = false
- end
- end
- # 显示时钟以及文字
- def Set_icon
- self.Time_Changed
- $time_icon = (($time_hour_now * 60 + $time_minute_now) / 90).to_i
- $time_disrc = self.Get_time_disrc
- self.contents.clear
- self.contents.font.size = 20
- if $Mistmara_mode
- bitmap = Bitmap.new("Graphics/time/time_stop.png")
- self.contents.draw_text(0,70,150,32,sprintf("%02d:%02d", $time_stop_hour, $time_stop_minute)) if $showtimer[2] == 1
- else
- bitmap = Bitmap.new("Graphics/time/time_#{$time_icon}.png")
- if $blink
- self.contents.draw_text(0,70,150,32,sprintf("%02d:%02d", $time_hour_now, $time_minute_now)) if $showtimer[2] == 1
- else
- self.contents.draw_text(0,70,150,32,sprintf("%02d %02d", $time_hour_now, $time_minute_now)) if $showtimer[2] == 1
- end
- end
- src_rect = Rect.new(0, 0, 70, 70)
- self.contents.blt(0, 0, bitmap, src_rect) if $showtimer[0] == 1
- self.contents.draw_text(5,45,150,32,"#{$time_disrc}") if $showtimer[1] == 1
- end
- end
- # 在地图描绘
- class Scene_Map
- alias fux2 main
- def main
- @icon = Icon.new
- fux2
- @icon.dispose
- end
-
- alias fux2update update
- def update
- @icon.Set_icon
- fux2update
- end
- end
- # 快捷指令
- class Interpreter
- def mistmara(statu)
- if statu == true
- Icon.new.Mistmara_mode(true)
- else
- Icon.new.Mistmara_mode(false)
- end
- return
- end
-
- def settime(hour,minute)
- $time_hour_now = hour.to_i
- $time_minute_now = minute.to_i
- $time_totalcount = hour * 3600 + minute * 60
- end
-
- def setstop(time_stop = true)
- if time_stop
- unless $time_count == 0
- $time_stop_count = $time_count
- $time_count = 0
- $blink = true
- end
- else
- $time_count = $time_stop_count
- end
- end
-
- def setcount(count)
- $time_count = count.to_i
- end
-
- def show(icon,statu,time)
- $showtimer = [icon.to_i,statu.to_i,time.to_i]
- end
-
- end
-
复制代码 |
|