赞 | 0 |
VIP | 3 |
好人卡 | 0 |
积分 | 1 |
经验 | 14326 |
最后登录 | 2021-12-28 |
在线时间 | 65 小时 |
Lv1.梦旅人 清纯红
- 梦石
- 0
- 星屑
- 61
- 在线时间
- 65 小时
- 注册时间
- 2009-7-23
- 帖子
- 995
|
再更换脚本
#==========================================================================
# ■ Window_Base
#--------------------------------------------------------------------------
# 遊戲中全部窗口的超級程式。
# 由 Kevin Chang 製作,發佈請保留原作者訊息。
#==========================================================================
#==============================================================================
begin
$const = 0
end
class Window_Base < Window
#------------------------------------------------------------------------
#●日夜控制系統初始控制設定
#------------------------------------------------------------------------
Ctrl_daylight_sys = 6 #日夜控制系統開關編號,預設 開關6
Ctrl_in_house = 5 #屋內/洞穴亮度恢復開關編號,預設 開關5
Ctrl_morning = 4 #晨間作息開關編號,預設 開關4
Ctrl_day = 1 #日間作息開關編號,預設 開關1
Ctrl_afternoon = 2 #午間作息開關編號,預設 開關2
Ctrl_night = 3 #夜間作息開關編號,預設 開關3
$Ctrl_Set_hour = 6 #設定起始時間(小時)之變數編號,預設 變數6
$Day_sec = 5 #時間軸秒的進制 預設為 6 進制(0~5)
$Day_min = 5 #ㄧ小時幾分鐘的進制 預設為 6 進制(0~5)
$Day_hour = 11 #每天為幾小時的進制 預設為 12 小時1天(0~11)
#------------------------------------------------------------------------
# ● 初始化對像
# x : 窗口的 X 坐標
# y : 窗口的 Y 坐標
# width : 窗口的寬
# height : 窗口的寬
#------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
#------------------------------------------------------------------------
#洞穴 屋內亮度正常化
#------------------------------------------------------------------------
def inside_normal
if $game_switches[Ctrl_in_house] == true
$game_screen.start_tone_change(Tone.new(0,0,0,0),5)
end
end
#------------------------------------------------------------------------
#---------------------------------------
#時段使用圖案代表
#---------------------------------------
def show_day #時段圖案函式
testname=$hour.to_s#將角色ID編號,轉成字串變數(to_s) 並存到testname
bitmap=Bitmap.new("Graphics/pictures/#{testname}")#取出路徑Graphics/pictures/下 testname 檔名的圖
src_rect=Rect.new(0,0,bitmap.width,bitmap.height)
self.contents.blt(20,4,bitmap,src_rect)
end
#---------------------------------------
#-----------------------------------------
#天氣變化
#-----------------------------------------
def weather_decision
if $game_switches[Ctrl_in_house] == true
$game_screen.weather(0, 3, 1)
else
w_d = rand(100)
if w_d >= 0 and w_d <= 80
$game_screen.weather(0, 3, 50) #正常(類型0正常1雨天2刮風3下雪,強度,時間/10)
else
if w_d > 80 and w_d <= 90
$game_screen.weather(1, 5, 50)#雨天
else
if w_d > 90 and w_d <= 100
$game_screen.weather(1, 10, 500)#刮風
end
end
end
end
end
#---------------------------------------
#------------各時間顏色變化---------------------
def the_time
if $scene.is_a?(Scene_Battle)
else
case $hour
when 11
#self.contents.draw_text(0, 0, 120, 32, "『夜』")
$game_screen.start_tone_change(Tone.new(-136,-136,0,136),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = true #夜間作息開關
when 0
#self.contents.draw_text(0, 0, 120, 32, "『晨』")
$game_screen.start_tone_change(Tone.new(0,0,85,85),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = true #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 1
#self.contents.draw_text(0, 0, 120, 32, "『晨』")
$game_screen.start_tone_change(Tone.new(0,0,51,68),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = true #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 2
#self.contents.draw_text(0, 0, 120, 32, "『晨』")
$game_screen.start_tone_change(Tone.new(0,0,0,40),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = true #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 3
#self.contents.draw_text(0, 0, 120, 32, "『日』")
$game_screen.start_tone_change(Tone.new(0,0,0,0),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = true #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 4
#self.contents.draw_text(0, 0, 120, 32, "『日』")
$game_screen.start_tone_change(Tone.new(50,0,0,0),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = true #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 5
#self.contents.draw_text(0, 0, 120, 32, "『日』")
$game_screen.start_tone_change(Tone.new(100,34,51,0),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = true #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 6
#self.contents.draw_text(0, 0, 120, 32, "『午』")
$game_screen.start_tone_change(Tone.new(100,34,-17,68),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = true #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 7
#self.contents.draw_text(0, 0, 120, 32, "『午』")
$game_screen.start_tone_change(Tone.new(100,34,-20,170),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = true #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 8
#self.contents.draw_text(0, 0, 120, 32, "『午』")
$game_screen.start_tone_change(Tone.new(68,0,-17,204),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = true #午間作息開關
$game_switches[Ctrl_night] = false #夜間作息開關
when 9
#self.contents.draw_text(0, 0, 120, 32, "『夜』")
$game_screen.start_tone_change(Tone.new(0,0,0,204),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = true #夜間作息開關
when 10
#self.contents.draw_text(0, 0, 120, 32, "『夜』")
$game_screen.start_tone_change(Tone.new(-51,-51,-51,170),50)
inside_normal
#show_day #設定時段圖案
weather_decision
$game_switches[Ctrl_morning] = false #晨間作息開關
$game_switches[Ctrl_day] = false #日間作息開關
$game_switches[Ctrl_afternoon] = false #午間作息開關
$game_switches[Ctrl_night] = true #夜間作息開關
end
end#end case
end
end
#==========================================================================
#==========================================================================
# ■ Window_DayLight
#--------------------------------------------------------------------------
# 顯示日夜/時間的窗口。
#==========================================================================
class Window_DayLight < Window_Base
#--------------------------------------------
#時間軸的進制
#--------------------------------------------
$sec_count = $Day_sec#5 #時間軸的進制 預設為 5 進制
$min_count = $Day_min#5 #ㄧ小時幾分鐘的進制 預設為5進制
$hour_count = $Day_hour#12 #每天為幾小時的進制 預設為12小時1天
#------------------------------------------------------------------------
# ● 初始化窗口
#------------------------------------------------------------------------
def initialize
super(0, 0, 160, 60) #(X,Y,寬,高)
self.contents = Bitmap.new(width - 32, height - 32)
$hour = 0
$set_hour = $game_variables[$Ctrl_Set_hour]
refresh
end
#------------------------------------------------------------------------
# ● 初始化對象
#------------------------------------------------------------------------
def refresh
self.contents.clear
self.back_opacity = 0 #背景透明
self.opacity = 0 #外框透明
if $hour > $hour_count #當計時時間超過實際時間
Graphics.frame_count = 0 #計時器歸零
$set_hour = 0
end
if $game_switches[Ctrl_daylight_sys] == false
@color = $game_variables[11] #設定變數11的值,來改變字時間體顏色
self.contents.font.color = text_color(@color)
@total_sec = Graphics.frame_count / Graphics.frame_rate
$hour = (@total_sec / $sec_count /$sec_count %$hour_count) + $set_hour
$min = @total_sec / $sec_count % $min_count
$sec = @total_sec % $sec_count
text = sprintf("T:%02d:%02d", $hour, $min)
#self.contents.font.color = Color.new(255,255,255,255)#設定顏色(R,G,B,亮度)
self.contents.draw_text(25, 5, 100, 20, text, 2)#(x,y寬,高,變數,字型顏色)
the_time
end
end
#------------------------------------------------------------------------
# ● 刷新
#------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
end
end
end
#--------------------------------------------------------------------------#==========================================================================
# ■ Scene_Map
#--------------------------------------------------------------------------
# 處理地圖畫面的程式。
#==========================================================================
class Scene_Map
def main
# 生成遊戲時間窗口
@daylight_window = Window_DayLight.new
@daylight_window.x = 450
@daylight_window.y = 0
Graphics.frame_count = $const
# 生成活動塊
@spriteset = Spriteset_Map.new
# 生成訊息窗口
@message_window = Window_Message.new
# 執行過渡
Graphics.transition
# 主循環
loop do
# 刷新遊戲畫面
Graphics.update
# 刷新輸入訊息
Input.update
# 刷新畫面
update
# 如果畫面切換的話就中斷循環
if $scene != self
break
end
end
# 準備過渡
Graphics.freeze
# 釋放活動塊
@spriteset.dispose
$const = Graphics.frame_count
@daylight_window.dispose #釋放時間窗口
# 釋放訊息窗口
@message_window.dispose
# 標題畫面切換中的情況下
if $scene.is_a?(Scene_Title)
# 淡入淡出畫面
Graphics.transition
Graphics.freeze
end
end
alias daylight_sys_update update
def update
@daylight_window.refresh #刷新時間顯示
daylight_sys_update
end
end |
|