#==============================================================================
# ■ 游戏日历 - By 影 2013.8
# V 1.0(未完成)
# 在设定区进行设定便可以操作这个脚本的功能。
# 战斗中、菜单中都不会进行计时,只有玩家在地图活动时才会计算
#==============================================================================
module MoVTime
#============================================================================
# ■ 设定区A - 基础设定
#============================================================================
MoVTimeWinOn = true
#MoVTimeOn - 是否在菜单内显示日历
MoVTimeCalOn = true
#MoVTimeCalOn - 是否在地图上显示日历
VTIcon = 234
#VTIcon - 时间前的图标 设为0则不显示
Chro = "公元"
#Chro - 设定纪元法的名称
Sta_Year = 2013
Sta_Month = 8
Sta_Day = 30
Sta_Hour = 10
Sta_Min = 0
#以上设置游戏起始日期时间
Sta_WDay = 6
#Sta_WDay - 游戏起什么时候 0代表周期的第一天
VTYV = 81
VTMV = 82
VTDV = 83
VTHV = 84
VTIV = 85
#设定占用变量,脚本需要此变量,但是无法通过改变此变量来改变时间
#============================================================================
# ■ 设定区A结束
#============================================================================
end
module MoChro
#============================================================================
# ■ 设定区B - 高级设定
#============================================================================
DayNight = true
#是否有白昼和黑夜等各时段的区分
Seasons = false
#是否有季节变换
VTSpe = 6
#VTSpe - 游戏时间进行速度,代表经过多少帧后游戏内部经过一分钟,现实中1秒60帧
VTYearM = 12
#VTYearM - 游戏中一年多少月
VTMonthD = 30
#VTMonth - 游戏中一月多少天
VTDayH = 24
#VTDayH - 游戏中一天几小时
VTHourM = 60
#VTHourM - 游戏中一小时几分钟
VTWeeks = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]
#VTWeeks - 设定周期日子的名称,有意向的话也可以把所谓“星期”改为其他的周期
#比如八天为一个周期
Dawn = 240
Morn = 360
Noon = 660
Aft = 900
SunSet = 1080
Night = 1260
Dark = 60
#设置一天各时段的开始时间,1440为一天的长度,240是早上四点(240/1440*24)
#从上到下:黎明 上午 中午 下午 黄昏 晚上 深夜
DawnT = Tone.new(-75,-75,0,50)
MornT = Tone.new(0,0,0,0)
NoonT = Tone.new(45,45,0,-25)
AftT = Tone.new(0,0,0,0)
SunSetT = Tone.new(-50,-50,0,25)
NightT = Tone.new(-75,-100,0,75)
DarkT = Tone.new(-125,-125,0,125)
#设置各时段的色调
InDoors = [2,3,84,86]
#InDoors - 填写室内地图ID 室内地图不会受昼夜影响
SeasonSta = 3
#SeasonSta - 春天开始的月份
#============================================================================
# ■ 设定区B结束
#============================================================================
end
#============================================================================
#============================================================================
# ■ 以下关键部分,因修改此部分造成的一切后果本人概不负责
#============================================================================
#============================================================================
module VTData
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def self.initialize
isettime(MoVTime::Sta_Hour,MoVTime::Sta_Min,MoChro::VTDayH,MoChro::VTHourM)
isetdate(MoVTime::Sta_Year,MoVTime::Sta_Month,MoVTime::Sta_Day,
MoChro::VTYearM,MoChro::VTMonthD)
isetwday(MoVTime::Sta_WDay)
$vtpause = false
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def self.updata
if SceneManager::scene_is?(Scene_Map) == true
if $vtpause == false then
$vtime += 1 if Graphics.frame_count % MoChro::VTSpe == 0
end
end
if $vtime == 1440
$vtime = 0
$vday += 1
end
VTData::vtshows(MoVTime::VTIV,MoVTime::VTHV,MoVTime::VTDV,MoVTime::VTMV,
MoVTime::VTYV,MoChro::VTHourM,MoChro::VTMonthD,MoChro::VTYearM)
if MoChro::DayNight == true
cdaynight
end
if MoChro::Seasons == true
cseasons
end
end
#--------------------------------------------------------------------------
# ● 初始化设置时间
#--------------------------------------------------------------------------
def self.isettime(hour,min,dayh,hourm)
$vtime = (hour / dayh + min / hourm / dayh) * 1440
end
#--------------------------------------------------------------------------
# ● 初始化设置日期
#--------------------------------------------------------------------------
def self.isetdate(y,m,d,ym,md)
$vday = (y - 1) * ym * md + (m - 1) * md + d - 1
end
#--------------------------------------------------------------------------
# ● 初始化设置周期
#--------------------------------------------------------------------------
def self.isetwday(wd)
$vwday = wd
end
#--------------------------------------------------------------------------
# ● 处理日期时间
#--------------------------------------------------------------------------
def self.vtshows(i,h,d,m,y,hm,md,ym)
$game_variables[i] = format("%02d",$vtime % hm)
$game_variables[h] = $vtime / hm
if ($vday % md + 1) == 0
$game_variables[d]
else
$game_variables[d] = $vday % md + 1
end
if ($vday / md % ym + 1) == 0
$game_variables[m] = 1
else
$game_variables[m] = $vday / md % ym + 1
end
$game_variables[y] = $vday / md / ym + 1
end
#--------------------------------------------------------------------------
# ● 切换昼夜时段
#--------------------------------------------------------------------------
def self.cdaynight(tint = 60)
if SceneManager::scene_is?(Scene_Map) == false
return end
end
for i in MoChro::InDoors
if $game_map.map_id == i
$game_map.screen.start_tone_change(Tone.new(0,0,0,0),0)
return
end
end
case $vtime
when MoChro::Dawn .. MoChro::Morn
$game_map.screen.start_tone_change(MoChro::DawnT, tint)
when MoChro::Morn .. MoChro::Noon
$game_map.screen.start_tone_change(MoChro::MornT, tint)
when MoChro::Noon .. MoChro::Aft
$game_map.screen.start_tone_change(MoChro::NoonT, tint)
when MoChro::Aft .. MoChro::SunSet
$game_map.screen.start_tone_change(MoChro::AftT, tint)
when MoChro::SunSet .. MoChro::Night
$game_map.screen.start_tone_change(MoChro::SunSetT, tint)
when MoChro::Night .. 1440
$game_map.screen.start_tone_change(MoChro::NightT, tint)
when 0 .. MoChro::Dark
$game_map.screen.start_tone_change(MoChro::NightT, tint)
when MoChro::Dark .. MoChro::Dawn
$game_map.screen.start_tone_change(MoChro::DarkT, tint)
end
end
#--------------------------------------------------------------------------
# ● 切换季节
#--------------------------------------------------------------------------
def self.cseasons
end
#==============================================================================
# ■ Window_MoVTime
#------------------------------------------------------------------------------
# 菜单画面中,显示当前游戏内部虚拟时间的窗口
#==============================================================================
class Window_MoVTime < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0,0,160,110)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
contents.clear
date = $game_variables[MoVTime::VTYV].to_s + "年" +
$game_variables[MoVTime::VTMV].to_s + "月" +
$game_variables[MoVTime::VTDV].to_s + "日"
time = $game_variables[MoVTime::VTHV].to_s + ":" +
$game_variables[MoVTime::VTIV].to_s
if MoVTime::VTIcon != 0
draw_icon(MoVTime::VTIcon,0,0,enabled = true)
draw_text(0,0,130,25,MoVTime::Chro + date,2)
draw_text(0,30,130,25,MoChro::VTWeeks[$vwday] + time,1)
else
draw_text(0,0,130,25,MoVTime::Chro + date,2)
draw_text(0,30,130,25,MoChro::VTWeeks[$vwday] + time,1)
end
end
end
#==============================================================================
# ■ Window_MoVCh
#------------------------------------------------------------------------------
# 地图画面中,显示当前游戏内部虚拟时间的窗口
#==============================================================================
class Window_MoVCh < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0,0,544,48)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
contents.clear
date = $game_variables[MoVTime::VTYV].to_s + "年" +
$game_variables[MoVTime::VTMV].to_s + "月" +
$game_variables[MoVTime::VTDV].to_s + "日"
time = $game_variables[MoVTime::VTHV].to_s + ":" +
$game_variables[MoVTime::VTIV].to_s
if MoVTime::VTIcon != 0
draw_icon(MoVTime::VTIcon,0,0,enabled = true)
draw_text(30,0,400,25,MoVTime::Chro + date + " " +
MoChro::VTWeeks[$vwday])
draw_text(450,0,160,25,time)
else
draw_text(0,0,400,25,MoVTime::Chro + date + " " +
MoChro::VTWeeks[$vwday])
draw_text(450,0,160,25,time)
end
end
end
#==============================================================================
# ■ DataManager
#------------------------------------------------------------------------------
# 数据库和游戏实例的管理器。所有在游戏中使用的全局变量都在这里初始化。
#==============================================================================
module DataManager
class << self
alias mo_make_save_contents make_save_contents
alias mo_extract_save_contents extract_save_contents
end
def self.make_save_contents
contents = mo_make_save_contents
contents[:vtime] = $vtime
contents
end
def self.extract_save_contents(contents)
mo_extract_save_contents(contents)
$vtime = contents[:vtime]
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图画面
#==============================================================================
class Scene_Map < Scene_Base
alias mo_post_transfer post_transfer
alias mo_create_all_windows create_all_windows
alias mo_update_m update
def post_transfer
VTData::cdaynight(0)
mo_post_transfer
end
def create_all_windows
mo_create_all_windows
if MoVTime::MoVTimeCalOn == true
@vtchr = Window_MoVCh.new
end
end
def update
mo_update_m
if @vtchr.nil? == false
@vtchr.update
end
end
end
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# 菜单画面
#==============================================================================
class Scene_Menu < Scene_MenuBase
alias mostart start
def start
mostart
if MoVTime::MoVTimeWinOn == true
creat_movtime_window
end
end
def creat_movtime_window
@movtime = Window_MoVTime.new
@movtime.x = 0
@movtime.y = @gold_window.y - 110
@movtime.width = @gold_window.width
@movtime.height = 110
end
end
#==============================================================================
# ■ Scene_Base
#------------------------------------------------------------------------------
# 游戏中所有 Scene 类(场景类)的父类
#==============================================================================
class Scene_Base
alias mo_update update
def update
mo_update
VTData::updata
end
end
VTData::initialize