设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1638|回复: 0
打印 上一主题 下一主题

[RMVA发布] 日历功能追加(已汉化)

[复制链接]

Lv1.梦旅人

梦石
0
星屑
76
在线时间
59 小时
注册时间
2012-5-15
帖子
5
跳转到指定楼层
1
发表于 2016-8-13 23:03:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
最近在网上查找日历系统时发现了两个较好的脚本,这两个脚本不是出自同一位作者的。其中较新的是“BMSP日历系统”,较旧的是“日历功能追加”。不过这两个日历系统都不算完美,新的日历系统都是以相同天数为一个月,而旧的日历系统“时间暂停开关”只是虚设的。

两个日历系统脚本对比之下,还是决定先汉化“日历功能追加”并修正“时间暂停开关”。这样“日历功能追加”中的所有开关及变量指令就全了,其中包含隐藏日历窗口的开关、色调不变化的开关、天气效果无效化的开关、天气效果音暂停的开关等等。

以下便是汉化好的脚本,由于日文水平有限,翻译错误请谅解!

  1. =begin  =======================================================================
  2.   ☆ 日历功能追加  原by 白雪レイカ
  3. -------------------------------------------------------------------------------
  4.   在项目中加入「时间」的概念。
  5.   根据时间段切换背景音乐和画面色调,每个季节随机变化天气。
  6.   主要的数据都有赋予变量,可以使用它做事件分支。
  7. -------------------------------------------------------------------------------
  8.   ◆使用方法
  9.     基本的设定项目都可自定义写入,但是有一部分说明是必要的部分。
  10.    
  11.     ○关于时间段的情况。
  12.        3:00 ~  5:59 => 凌晨 (:early_morning)
  13.        6:00 ~ 10:59 => 早晨 (:morning)
  14.       11:00 ~ 15:59 => 白天 (:noon)
  15.       16:00 ~ 18:59 => 傍晚 (:evening)
  16.       19:00 ~ 22:59 => 夜晚 (:night)
  17.       23:00 ~  2:59 => 深夜 (:midnight)
  18.       
  19.     ○每个时间段的背景音乐切换
  20.       地图设置中的「自动切换背景音乐」开启时才有效。
  21.       在地图的备注栏上填写以下代码:<凌晨(或early)文件名, 音量, 音调>
  22.       以上是凌晨的背景音乐设定,其余可对应不同时间段设定背景音乐,
  23.       凌晨(或early)、早晨(或morning)、白天(或noon)、傍晚(或evening)、
  24.       夜晚(或night)、深夜(或mid),文件扩展名可以省略(例如 Town1)。
  25.       
  26.     ○在事件中设置时间
  27.         用事件指令「脚本」来实行
  28.       
  29.         set_time(hour, min)
  30.           # 将时间设定为 hour:min 。
  31.           # 根据这一方法,天数不会推进。
  32.         
  33.         set_date(month, date, day)
  34.           # 将日历设定为 month月 date日 day星期 。
  35.           # 因为会完全无视星期的推进,所以不建议使用。
  36.           # 星期用以下标志来设定。
  37.          
  38.           # 星期日 => :Sun  星期一 => :Mon  星期二 => :Tue
  39.           # 星期三 => :Wed  星期四 => :Thr  星期五 => :Fri
  40.           # 星期六 => :Sat
  41.          
  42.         set_year(year)
  43.           # 将日历设定为 year年 。
  44.           # 同上,不建议使用。
  45.         
  46.         shift_date(date)
  47.           # 让日历按 date 日推进。
  48.           # 包含这星期也能好好的调整。
  49.          
  50.         shift_month(month)
  51.           # 让日历按 month 月推进,向推进到月1日的设定。
  52.            
  53.          shift_year(year)
  54.           # 让日历按指定 year 年数推进。
  55.           # 与 shift_month 不同的日期不会更改。
  56.          
  57.         shift_date_to(month, date[, year])
  58.           # 让日历按指定的 year年 month月 date日 推进。
  59.           # 省略了 year 的场合当前的年份不变。
  60.           # 要设定的日期早于当前日期,将返回到那天为止的时间卷。
  61.            
  62.          set_weather(weather)
  63.           # 设定天气。
  64.           # 用以下(weather)标志指定。
  65.          
  66.           # 晴 => :fine  雨 => :rain   雪 => :snow
  67.           # 雷 => :thunder 暴风雨 => :storm  晴(夜) => :star
  68.           # 暴风雪 => :s_storm
  69.          
  70.   ◆使用条件
  71.     修改·重新发布等自由使用。
  72.     重新发布时请先向作者明示。
  73.     如果发现错误,请及时报告。
  74. =end
  75. #==============================================================================
  76. # ■ 设定项目
  77. #==============================================================================
  78. module WhiteSnow
  79.   # ↓↓ 最初设定从此开始 ↓↓
  80.   INITAL_MIN = 30    # 游戏开始时的「分」的值
  81.   INITAL_HOUR = 6    # 游戏开始时的「時」的值
  82.   INITAL_DATE = 1    # 游戏开始时的「日」的值
  83.   INITAL_DAY = :Sun    # 游戏开始时的「星期」的值
  84.   INITAL_MONTH = 7    # 游戏开始时的「月」的值
  85.   INITAL_YEAR = 2018    # 游戏开始时的「年」的值
  86.   # ↑↑ 最初设定到此为止 ↑↑
  87.   
  88.   TIME_COUNT_FORBID_SID = 101    # 禁止时间流逝的开关ID
  89.   TONE_CHANGE_FORBID_SID = 102    # 禁止根据时间流逝更变画面色调的开关ID
  90.   WEATHER_EFFECT_FORBID_SID = 103    # 使天气效果无效化的开关ID
  91.   CALENDER_WINDOW_HIDE_SID = 104    # 隐藏日期窗口的开关ID
  92.     # 只会隐藏日期窗口,不会阻止时间的流逝
  93.   INSIDE_FLAG_SID = 105    # 位于室内标志的开关ID
  94.     # 色调变化和天气效果的影响皆无效化,但天气效果音依然存在
  95.   WEATHER_BGS_ENABLE = true    # 确认是否启用天气效果音(true用、false不用)
  96.   INSIDE_BGS_TYPE = 1    # 室内标志或天气效果无效的开关打开时的天气效果音类型
  97.     # 使用天气效果音功能时才有效,其中0为静音、1为音量60%、2为逐步渐隐。
  98.   WEATHER_BGS_DISABLE = 106    # 天气效果音功能停止开关
  99.     # 这个开关ID为ON时,不播放天气效果音(只是暂时禁用天气效果音功能)。
  100.     # 但只有这个开关,不会停止当前播放的天气效果音,需与室内标志开关一起使用。
  101.     # 此外,这个开关为OFF状态时停止的天气效果音便能再次播放。
  102.    
  103.   MIN_STORE_VID = 101    # 获取当前「分」值的变量ID
  104.   HOUR_STORE_VID = 102    # 获取当前「时」值的变量ID
  105.   TIME_ZONE_STORE_VID = 103    # 获取当前「时间段」值的变量ID
  106.     # 其中凌晨为0、早晨为1、白天为2、傍晚为3、夜晚为4、深夜为5。
  107.   DAY_STORE_VID = 104    # 获取当前「星期」值的变量ID
  108.     # 其中星期日为0、星期一为1、依此类推到星期六为6。
  109.   DATE_STORE_VID = 105    # 获取当前「日」值的变量ID
  110.   MONTH_STORE_VID = 106    # 获取当前「月」值的变量ID
  111.   YEAR_STORE_VID = 107    # 获取当前「年」值的变量ID
  112.   SEASON_STORE_VID = 108    # 获取当前「季节」的变量ID
  113.     # 其中春为0、夏为1、秋为2、冬为3。
  114.   WEATHER_STORE_VID = 109    # 获取当前「天气」的变量ID
  115.     # 其中晴为0、雨为1、雪为2、雷为3、暴风雨为4、晴(夜)为5、暴风雪为6。
  116.    
  117.     # 按照R红, G绿, B蓝, Dark灰的顺序指定。
  118.   EARLY_MORNING_SCREEN_TONE = [15, 10, 0, 0]    # 凌晨的画面色调
  119.   MORNING_SCREEN_TONE = [0, 0, 0, 0]    # 早晨的画面色调
  120.   NOON_SCREEN_TONE = [15, 15, 15, 0]    # 白天的画面色调
  121.   AFTERNOON_SCREEN_TONE = [32, -8, -32, 16]    # 傍晚的画面色调
  122.   NIGHT_SCREEN_TONE = [-64, -64, -16, 32]    # 夜晚的画面色调
  123.   MIDNIGHT_SCREEN_TONE = [-72, -72, -20, 48]    # 深夜的画面色调
  124.    
  125.     # 每月的天数表,基本不需要更改。
  126.   DAYS_TABLE = {0 => 31, 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30,
  127.                 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31}
  128.    
  129.     # 以下天气列表,设定例:
  130.     # WEATHER = {:icon => 天气图标索引,
  131.     #            :weather => [天气效果的种类,强度]},
  132.     #            :bgs => ["文件名", 音量, 音调](nil为不设定),
  133.     # 天气效果的种类  :none表示「无」、:rain表示「雨」、
  134.     #                :storm表示「暴风雨」、:snow表示「雪」。
  135.    
  136.   FINE = {:icon => 12, :weather => [:none, 0],    # 天气:晴
  137.           :bgs => nil}
  138.   RAIN = {:icon => 13, :weather => [:rain, 5],    # 天气:雨
  139.           :bgs => ["Rain", 50, 90]}
  140.   SNOW = {:icon => 14, :weather => [:snow, 4],    # 天气:雪
  141.           :bgs => nil}
  142.   THUNDER = {:icon => 15, :weather => [:storm, 4],    # 天气:雷
  143.              :bgs => ["Storm", 60, 75],
  144.              :flash => [255, 255, 200, 180, 12],
  145.              :se => ["Thunder9", 80, 95]}
  146.     # 雷效果用的设定项目
  147.     # :flash => [(闪光颜色)R, G, B, Alpha, 闪光长度]
  148.     # :se => 闪光后响起的效果音
  149.   STORM = {:icon => 16, :weather => [:storm, 8],    # 天气:暴风雨
  150.            :bgs => ["Storm", 70, 100]}
  151.   STAR = {:icon => 17, :weather => [:none, 0],    # 天气:晴(夜)
  152.           :bgs => nil}
  153.   S_STORM = {:icon => 18, :weather => [:snow, 9],    # 天气:暴风雪
  154.              :bgs => ["Wind", 70, 95]}
  155. end
  156.   
  157. #==============================================================================
  158. # ■ Calender
  159. #------------------------------------------------------------------------------
  160. #  日历类。
  161. #==============================================================================
  162. class Calender
  163.   #--------------------------------------------------------------------------
  164.   # ● 公共实例变量
  165.   #--------------------------------------------------------------------------
  166.   attr_accessor :count
  167.   attr_accessor :min
  168.   attr_accessor :hour
  169.   attr_accessor :date
  170.   attr_accessor :day
  171.   attr_accessor :month
  172.   attr_accessor :season
  173.   attr_accessor :year
  174.   attr_accessor :weather
  175.   attr_accessor :weather_count
  176.   attr_accessor :time_zone
  177.   attr_reader   :interpreter
  178.   attr_accessor :thunder_count
  179.   #--------------------------------------------------------------------------
  180.   # ● 对象初始化
  181.   #--------------------------------------------------------------------------
  182.   def initialize
  183.     @count = 0
  184.     @weather = :fine
  185.     @interpreter = Game_Interpreter.new
  186.     init_calender
  187.     change_weather
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● 日历初始化
  191.   #--------------------------------------------------------------------------
  192.   def init_calender
  193.     [url=home.php?mod=space&uid=25749]@min[/url]    = WhiteSnow::INITAL_MIN
  194.     @hour   = WhiteSnow::INITAL_HOUR
  195.     @date   = WhiteSnow::INITAL_DATE
  196.     [url=home.php?mod=space&uid=11519]@day[/url]    = WhiteSnow::INITAL_DAY
  197.     [url=home.php?mod=space&uid=26122]@Month[/url]  = WhiteSnow::INITAL_MONTH
  198.     @year   = WhiteSnow::INITAL_YEAR
  199.     get_time_zone
  200.    
  201.     $game_variables[WhiteSnow::MIN_STORE_VID] = @min
  202.     $game_variables[WhiteSnow::HOUR_STORE_VID] = @hour
  203.     $game_variables[WhiteSnow::DATE_STORE_VID] = @date
  204.    
  205.     case @month #月份
  206.     when 1..2
  207.       [url=home.php?mod=space&uid=31546]@season[/url] = :Winter #冬天
  208.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 3
  209.     when 3..5
  210.       @season = :Spring #春天
  211.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 0
  212.     when 6..8
  213.       @season = :Summer #夏天
  214.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 1
  215.     when 9..11
  216.       @season = :Autumn #秋天
  217.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 2
  218.     when 12
  219.       @season = :Winter #冬天
  220.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 3
  221.     end
  222.    
  223.     case @day #星期
  224.     when :Sun #星期日
  225.       $game_variables[WhiteSnow::DAY_STORE_VID] = 0
  226.     when :Mon #星期一
  227.       $game_variables[WhiteSnow::DAY_STORE_VID] = 1
  228.     when :Tue #星期二
  229.       $game_variables[WhiteSnow::DAY_STORE_VID] = 2
  230.     when :Wed #星期三
  231.       $game_variables[WhiteSnow::DAY_STORE_VID] = 3
  232.     when :Thr #星期四
  233.       $game_variables[WhiteSnow::DAY_STORE_VID] = 4
  234.     when :Fri #星期五
  235.       $game_variables[WhiteSnow::DAY_STORE_VID] = 5
  236.     when :Sat #星期六
  237.       $game_variables[WhiteSnow::DAY_STORE_VID] = 6
  238.     end
  239.     $game_variables[WhiteSnow::MONTH_STORE_VID] = @month
  240.     $game_variables[WhiteSnow::YEAR_STORE_VID] = @year
  241.     change_tone_by_calender
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● 获得时间带
  245.   #--------------------------------------------------------------------------
  246.   def get_time_zone
  247.     case @hour
  248.     when 0..2
  249.       @time_zone = :midnight #深夜
  250.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 5
  251.     when 3..5
  252.       @time_zone = :early_morning #凌晨
  253.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 0
  254.     when 6..10
  255.       @time_zone = :morning #早晨
  256.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 1
  257.     when 11..15
  258.       @time_zone = :noon #白天
  259.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 2
  260.     when 16..18
  261.       @time_zone = :evening #傍晚
  262.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 3
  263.     when 19..22
  264.       @time_zone = :night #夜晚
  265.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 4
  266.     when 23..24
  267.       @time_zone = :midnight #深夜
  268.       $game_variables[WhiteSnow::TIME_ZONE_STORE_VID] = 5
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 获取天气计数
  273.   #--------------------------------------------------------------------------
  274.   def randomize_weather_count
  275.     @weather_count = p_ex_rand(40, 100) + (109 - p_ex_rand(40, 110)) + 90
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 更改画面色调
  279.   #--------------------------------------------------------------------------
  280.   def change_tone_by_calender(dur = 60)
  281.     return if $game_switches[WhiteSnow::TONE_CHANGE_FORBID_SID]
  282.     return if $game_switches[WhiteSnow::INSIDE_FLAG_SID]
  283.     case @time_zone
  284.     when :early_morning #凌晨
  285.       tone = WhiteSnow::EARLY_MORNING_SCREEN_TONE
  286.       @interpreter.change_tone(tone[0], tone[1], tone[2], tone[3], dur)
  287.     when :morning #早晨
  288.       tone = WhiteSnow::MORNING_SCREEN_TONE
  289.       @interpreter.change_tone(tone[0], tone[1], tone[2], tone[3], dur)
  290.     when :noon #白天
  291.       tone = WhiteSnow::NOON_SCREEN_TONE
  292.       @interpreter.change_tone(tone[0], tone[1], tone[2], tone[3], dur)
  293.     when :evening #傍晚
  294.       tone = WhiteSnow::AFTERNOON_SCREEN_TONE
  295.       @interpreter.change_tone(tone[0], tone[1], tone[2], tone[3], dur)
  296.     when :night #夜晚
  297.       tone = WhiteSnow::NIGHT_SCREEN_TONE
  298.       @interpreter.change_tone(tone[0], tone[1], tone[2], tone[3], dur)
  299.     when :midnight #深夜
  300.       tone = WhiteSnow::MIDNIGHT_SCREEN_TONE
  301.       @interpreter.change_tone(tone[0], tone[1], tone[2], tone[3], dur)
  302.     end
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 更改天气
  306.   #--------------------------------------------------------------------------
  307.   def change_weather
  308.     srand
  309.     p_weather = @weather
  310.     case @month
  311.     when 1
  312.       case rand
  313.       when 0...0.2
  314.         if @hour >= 3 and @hour < 18
  315.           @weather = :fine
  316.         else
  317.           @weather = :star
  318.         end
  319.       when 0.2...0.8
  320.         @weather = :snow
  321.       when 0.8...1
  322.         @weather = :s_storm
  323.       end
  324.     when 2
  325.       case rand
  326.       when 0...0.3
  327.         if @hour >= 3 and @hour < 18
  328.           @weather = :fine
  329.         else
  330.           @weather = :star
  331.         end
  332.       when 0.3...0.8
  333.         @weather = :snow
  334.       when 0.8...0.9
  335.         @weather = :rain
  336.       when 0.9...1
  337.         @weather = :s_storm
  338.       end
  339.     when 3..4
  340.       case rand
  341.       when 0...0.8
  342.         if @hour >= 3 and @hour < 18
  343.           @weather = :fine
  344.         else
  345.           @weather = :star
  346.         end
  347.       when 0.8...0.9
  348.         @weather = :rain
  349.       when 0.9...1
  350.         @weather = :storm
  351.       end
  352.     when 5
  353.       case rand
  354.       when 0...0.7
  355.         if @hour >= 3 and @hour < 18
  356.           @weather = :fine
  357.         else
  358.           @weather = :star
  359.         end
  360.       when 0.7...0.8
  361.         @weather = :rain
  362.       when 0.8...0.9
  363.         @weather = :thunder
  364.       when 0.9...1
  365.         @weather = :storm
  366.       end
  367.     when 6
  368.       case rand
  369.       when 0...0.4
  370.         if @hour >= 3 and @hour < 18
  371.           @weather = :fine
  372.         else
  373.           @weather = :star
  374.         end
  375.       when 0.4...0.8
  376.         @weather = :rain
  377.       when 0.8...0.9
  378.         @weather = :thunder
  379.       when 0.9...1
  380.         @weather = :storm
  381.       end
  382.     when 7..8
  383.       case rand
  384.       when 0...0.6
  385.         if @hour >= 3 and @hour < 18
  386.           @weather = :fine
  387.         else
  388.           @weather = :star
  389.         end
  390.       when 0.6...0.7
  391.         @weather = :rain
  392.       when 0.7...0.9
  393.         @weather = :storm
  394.       when 0.9...1
  395.         @weather = :thunder
  396.       end
  397.     when 9..10
  398.       case rand
  399.       when 0...0.6
  400.         if @hour >= 3 and @hour < 18
  401.           @weather = :fine
  402.         else
  403.           @weather = :star
  404.         end
  405.       when 0.6...0.8
  406.         @weather = :storm
  407.       when 0.8...0.9
  408.         @weather = :rain
  409.       when 0.9...1
  410.         @weather = :thunder
  411.       end
  412.     when 11
  413.       if @date < 25
  414.         case rand
  415.         when 0...0.7
  416.           if @hour >= 3 and @hour < 18
  417.             @weather = :fine
  418.           else
  419.             @weather = :star
  420.           end
  421.         when 0.7...0.8
  422.           @weather = :storm
  423.         when 0.8...0.9
  424.           @weather = :rain
  425.         when 0.9...1
  426.           @weather = :thunder
  427.         end
  428.       else
  429.         case rand
  430.         when 0...0.6
  431.           if @hour >= 3 and @hour < 18
  432.             @weather = :fine
  433.           else
  434.             @weather = :star
  435.           end
  436.         when 0.6...0.7
  437.           @weather = :storm
  438.         when 0.7...0.8
  439.           @weather = :rain
  440.         when 0.8...0.9
  441.           @weather = :thunder
  442.         when 0.9...1
  443.           @weather = :snow
  444.         end
  445.       end
  446.     when 12
  447.       case rand
  448.       when 0...0.2
  449.         if @hour >= 3 and @hour < 18
  450.           @weather = :fine
  451.         else
  452.           @weather = :star
  453.         end
  454.       when 0.2...0.8
  455.         @weather = :snow
  456.       when 0.8...1
  457.         @weather = :s_storm
  458.       end
  459.     end
  460.     if @weather != p_weather
  461.       RPG::BGS.fade(10)
  462.       perform_weather_effect
  463.     end
  464.     randomize_weather_count
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● 天气效果
  468.   #--------------------------------------------------------------------------
  469.   def perform_weather_effect(dur = 30)
  470.     return unless SceneManager.scene_is?(Scene_Map)
  471.     return if $game_switches[WhiteSnow::WEATHER_EFFECT_FORBID_SID]
  472.     return if $game_switches[WhiteSnow::INSIDE_FLAG_SID]
  473.     case @weather
  474.     when :fine
  475.       weather = WhiteSnow::FINE
  476.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  477.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  478.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  479.         bgs.play
  480.       end
  481.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 0
  482.       
  483.     when :rain
  484.       weather = WhiteSnow::RAIN
  485.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  486.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  487.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  488.         bgs.play
  489.       end
  490.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 1
  491.       
  492.     when :snow
  493.       weather = WhiteSnow::SNOW
  494.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  495.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  496.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  497.         bgs.play
  498.       end
  499.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 2
  500.       
  501.     when :thunder
  502.       weather = WhiteSnow::THUNDER
  503.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  504.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  505.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  506.         bgs.play
  507.       end
  508.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 3
  509.       
  510.     when :storm
  511.       weather = WhiteSnow::STORM
  512.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  513.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  514.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  515.         bgs.play
  516.       end
  517.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 4
  518.       
  519.     when :star
  520.       weather = WhiteSnow::STAR
  521.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  522.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  523.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  524.         bgs.play
  525.       end
  526.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 5
  527.       
  528.     when :s_storm
  529.       weather = WhiteSnow::S_STORM
  530.       @interpreter.change_weather(weather[:weather][0], weather[:weather][1], dur)
  531.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  532.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1], weather[:bgs][2])
  533.         bgs.play
  534.       end
  535.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 6
  536.     end
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 室内BGS的演奏
  540.   #--------------------------------------------------------------------------
  541.   def play_inside_bgs
  542.     case @weather
  543.     when :fine
  544.       weather = WhiteSnow::FINE
  545.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  546.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.6, weather[:bgs][2])
  547.         bgs.play
  548.       end
  549.       
  550.     when :rain
  551.       weather = WhiteSnow::RAIN
  552.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  553.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.7, weather[:bgs][2])
  554.         bgs.play
  555.       end
  556.       
  557.     when :snow
  558.       weather = WhiteSnow::SNOW
  559.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  560.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.7, weather[:bgs][2])
  561.         bgs.play
  562.       end
  563.       
  564.     when :thunder
  565.       weather = WhiteSnow::THUNDER
  566.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  567.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.7, weather[:bgs][2])
  568.         bgs.play
  569.       end
  570.       
  571.     when :storm
  572.       weather = WhiteSnow::STORM
  573.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  574.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.7, weather[:bgs][2])
  575.         bgs.play
  576.       end
  577.       
  578.     when :star
  579.       weather = WhiteSnow::STAR
  580.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  581.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.7, weather[:bgs][2])
  582.         bgs.play
  583.       end
  584.       
  585.     when :s_storm
  586.       weather = WhiteSnow::S_STORM
  587.       if weather[:bgs] and WhiteSnow::WEATHER_BGS_ENABLE and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  588.         bgs = RPG::BGS.new(weather[:bgs][0], weather[:bgs][1] * 0.7, weather[:bgs][2])
  589.         bgs.play
  590.       end
  591.     end
  592.   end
  593.   #--------------------------------------------------------------------------
  594.   # ● 天气「雷」效果的执行
  595.   #--------------------------------------------------------------------------
  596.   def perform_thunder_effect(r, g, b, alpha, dur)
  597.     @interpreter.perform_flash(r, g, b, alpha, dur)
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # ● 更新星期
  601.   #--------------------------------------------------------------------------
  602.   def shift_day
  603.     case @day
  604.     when :Sun #星期日
  605.       @day = :Mon
  606.       $game_variables[WhiteSnow::DAY_STORE_VID] = 1
  607.     when :Mon #星期一
  608.       @day = :Tue
  609.       $game_variables[WhiteSnow::DAY_STORE_VID] = 2
  610.     when :Tue #星期二
  611.       @day = :Wed
  612.       $game_variables[WhiteSnow::DAY_STORE_VID] = 3
  613.     when :Wed #星期三
  614.       @day = :Thr
  615.       $game_variables[WhiteSnow::DAY_STORE_VID] = 4
  616.     when :Thr #星期四
  617.       @day = :Fri
  618.       $game_variables[WhiteSnow::DAY_STORE_VID] = 5
  619.     when :Fri #星期五
  620.       @day = :Sat
  621.       $game_variables[WhiteSnow::DAY_STORE_VID] = 6
  622.     when :Sat #星期六
  623.       @day = :Sun
  624.       $game_variables[WhiteSnow::DAY_STORE_VID] = 0
  625.     end
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # ● 返回星期
  629.   #--------------------------------------------------------------------------
  630.   def back_day
  631.     case @day
  632.     when :Sun #星期日
  633.       @day = :Sat
  634.       $game_variables[WhiteSnow::DAY_STORE_VID] = 1
  635.     when :Sat #星期六
  636.       @day = :Fri
  637.       $game_variables[WhiteSnow::DAY_STORE_VID] = 2
  638.     when :Fri #星期五
  639.       @day = :Thr
  640.       $game_variables[WhiteSnow::DAY_STORE_VID] = 3
  641.     when :Thr #星期四
  642.       @day = :Wed
  643.       $game_variables[WhiteSnow::DAY_STORE_VID] = 4
  644.     when :Wed #星期三
  645.       @day = :Tue
  646.       $game_variables[WhiteSnow::DAY_STORE_VID] = 5
  647.     when :Tue #星期二
  648.       @day = :Mon
  649.       $game_variables[WhiteSnow::DAY_STORE_VID] = 6
  650.     when :Mon #星期一
  651.       @day = :Sun
  652.       $game_variables[WhiteSnow::DAY_STORE_VID] = 0
  653.     end
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # ● 更新月份
  657.   #--------------------------------------------------------------------------
  658.   def shift_month
  659.     case @month
  660.     when 1
  661.       return unless @date > 31
  662.       @month += 1
  663.       @date = 1
  664.     when 2
  665.       return unless @date > 28
  666.       @month += 1
  667.       @season = :Spring #春天
  668.       @date = 1
  669.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 0
  670.     when 3
  671.       return unless @date > 31
  672.       @month += 1
  673.       @date = 1
  674.     when 4
  675.       return unless @date > 30
  676.       @month += 1
  677.       @date = 1
  678.     when 5
  679.       return unless @date > 31
  680.       @month += 1
  681.       @season = :Summer #夏天
  682.       @date = 1
  683.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 1
  684.     when 6
  685.       return unless @date > 30
  686.       @month += 1
  687.       @date = 1
  688.     when 7
  689.       return unless @date > 31
  690.       @month += 1
  691.       @date = 1
  692.     when 8
  693.       return unless @date > 31
  694.       @month += 1
  695.       @season = :Autumn #秋天
  696.       @date = 1
  697.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 2
  698.     when 9
  699.       return unless @date > 30
  700.       @month += 1
  701.       @date = 1
  702.     when 10
  703.       return unless @date > 31
  704.       @month += 1
  705.       @date = 1
  706.     when 11
  707.       return unless @date > 30
  708.       @month += 1
  709.       @season = :Winter #冬天
  710.       @date = 1
  711.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 3
  712.     when 12
  713.       return unless @date > 31
  714.       @year += 1
  715.       @month = 1
  716.       @date = 1
  717.       $game_variables[WhiteSnow::YEAR_STORE_VID] = @year
  718.     end
  719.     $game_variables[WhiteSnow::DATE_STORE_VID] = @date
  720.     $game_variables[WhiteSnow::MONTH_STORE_VID] = @month
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ● 返回月份
  724.   #--------------------------------------------------------------------------
  725.   def back_month
  726.     return unless @date < 1
  727.     case @month
  728.     when 1
  729.       @month = 12
  730.       @date = 31
  731.       @year -= 1
  732.       $game_variables[WhiteSnow::YEAR_STORE_VID] = @year
  733.     when 2
  734.       @month -= 1
  735.       @date = 31
  736.     when 3
  737.       @month -= 1
  738.       @date = 28
  739.       @season = :Winter #冬天
  740.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 3
  741.     when 4
  742.       @month -= 1
  743.       @date = 31
  744.     when 5
  745.       @month -= 1
  746.       @date = 30
  747.     when 6
  748.       @month -= 1
  749.       @date = 31
  750.       @season = :Spring #春天
  751.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 0
  752.     when 7
  753.       @month -= 1
  754.       @date = 30
  755.     when 8
  756.       @month -= 1
  757.       @date = 31
  758.     when 9
  759.       @month -= 1
  760.       @date = 31
  761.       @season = :Summer #夏天
  762.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 1
  763.     when 10
  764.       @month -= 1
  765.       @date = 30
  766.     when 11
  767.       @month -= 1
  768.       @date = 31
  769.     when 12
  770.       @month -= 1
  771.       @date = 30
  772.       @season = :Autumn #秋天
  773.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 2
  774.     end
  775.     $game_variables[WhiteSnow::DATE_STORE_VID] = @date
  776.     $game_variables[WhiteSnow::MONTH_STORE_VID] = @month
  777.   end
  778.   #--------------------------------------------------------------------------
  779.   # ● 推进日期
  780.   #--------------------------------------------------------------------------
  781.   def shift_date
  782.     @date += 1
  783.     shift_day
  784.     shift_month
  785.     $game_variables[WhiteSnow::HOUR_STORE_VID] = @hour
  786.     $game_variables[WhiteSnow::DATE_STORE_VID] = @date
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # ● 返回日期
  790.   #--------------------------------------------------------------------------
  791.   def back_date
  792.     @date += 1
  793.     back_day
  794.     back_month
  795.     $game_variables[WhiteSnow::HOUR_STORE_VID] = @hour
  796.     $game_variables[WhiteSnow::DATE_STORE_VID] = @date
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # ● 查找指定日期和当前日期的时间之差
  800.   #--------------------------------------------------------------------------
  801.   def days_dif(y, m, d)
  802.     table = WhiteSnow::DAYS_TABLE
  803.     dy_n = (@year - 1) * 365
  804.     dy_s = (y - 1) * 365
  805.     dm_n = 0 ; 1.upto(@month - 1){|n| dm_n += table[n]} unless @month == 1
  806.     dm_s = 0 ; 1.upto(m - 1){|n| dm_s += table[n]} unless m == 1
  807.     d_n = @date - 1
  808.     d_s = d - 1
  809.     n = dy_n + dm_n + d_n
  810.     s = dy_s + dm_s + d_s
  811.     return s - n
  812.   end
  813. end

  814. #==============================================================================
  815. # ■ Window_Calender
  816. #------------------------------------------------------------------------------
  817. #  显示日历内容的窗口。
  818. #==============================================================================
  819. class Window_Calender < Window_Base
  820.   #--------------------------------------------------------------------------
  821.   # ● 对象初始化 #改动过
  822.   #--------------------------------------------------------------------------
  823.   def initialize(x = Graphics.width - 240, y = 0, w = 240)
  824.     super(x, y, w, fitting_height(2))
  825.     refresh
  826.   end
  827.   #--------------------------------------------------------------------------
  828.   # ● 框架更新
  829.   #--------------------------------------------------------------------------
  830.   def update
  831.     self.visible = false if $game_switches[WhiteSnow::CALENDER_WINDOW_HIDE_SID]
  832.     self.visible = true if !$game_switches[WhiteSnow::CALENDER_WINDOW_HIDE_SID]
  833.     super
  834.     refresh if $calender.count == 0
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # ● 刷新
  838.   #--------------------------------------------------------------------------
  839.   def refresh
  840.     contents.clear
  841.     draw_year_date
  842.     draw_season_time
  843.     draw_weather_icon
  844.   end
  845.   #--------------------------------------------------------------------------
  846.   # ● 绘制年份·月份·日期
  847.   #--------------------------------------------------------------------------
  848.   def draw_year_date
  849.     w = contents_width
  850.     h = line_height
  851.     month = $calender.month
  852.     if (0..9).to_a.include?(month)
  853.       month = "0" + month.to_s
  854.     else
  855.       month = month.to_s
  856.     end
  857.     date = $calender.date
  858.     if (0..9).to_a.include?(date)
  859.       date = "0" + date.to_s
  860.     else
  861.       date = date.to_s
  862.     end
  863.     draw_text(0, 0, contents_width, line_height, "#{$calender.year}" + "年" + month + "月" + date + "日")
  864.   end
  865.   #--------------------------------------------------------------------------
  866.   # ● 绘制季节·星期·時·分
  867.   #--------------------------------------------------------------------------
  868.   def draw_season_time
  869.     w = contents_width
  870.     h = line_height
  871.     season = $calender.season.to_s
  872.     season.gsub!("Spring"){"春"}
  873.     season.gsub!("Summer"){"夏"}
  874.     season.gsub!("Autumn"){"秋"}
  875.     season.gsub!("Winter"){"冬"}
  876.     day = $calender.day.to_s
  877.     day.gsub!("Sun"){"\\c[2]星期日\\c[0]"}
  878.     day.gsub!("Mon"){"星期一"}
  879.     day.gsub!("Tue"){"星期二"}
  880.     day.gsub!("Wed"){"星期三"}
  881.     day.gsub!("Thr"){"星期四"}
  882.     day.gsub!("Fri"){"星期五"}
  883.     day.gsub!("Sat"){"星期六"}
  884.     hour = "#{$calender.hour}"
  885.     min = $calender.min
  886.     if (0..9).to_a.include?(min)
  887.       min = "0" + min.to_s
  888.     else
  889.       min = min.to_s
  890.     end
  891.     draw_text(-80, h, contents_width , line_height , season, 1)
  892.     draw_text_ex(46, h, "(" + day + ")")
  893.     draw_text(-6, h, w, h, hour + ":" + min, 2)
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ● 绘制天气图标
  897.   #--------------------------------------------------------------------------
  898.   def draw_weather_icon
  899.     case $calender.weather
  900.     when :fine
  901.       icon_index = WhiteSnow::FINE[:icon]
  902.     when :rain
  903.       icon_index = WhiteSnow::RAIN[:icon]
  904.     when :snow
  905.       icon_index = WhiteSnow::SNOW[:icon]
  906.     when :thunder
  907.       icon_index = WhiteSnow::THUNDER[:icon]
  908.     when :storm
  909.       icon_index = WhiteSnow::STORM[:icon]
  910.     when :star
  911.       icon_index = WhiteSnow::STAR[:icon]
  912.     when :s_storm
  913.       icon_index = WhiteSnow::S_STORM[:icon]
  914.     end
  915.     draw_icon(icon_index, contents_width - 30, 0)
  916.   end
  917. end

  918. #==============================================================================
  919. # ■ Window_MenuCalender
  920. #------------------------------------------------------------------------------
  921. #  显示日历内容的窗口(菜单画面用)。
  922. #==============================================================================
  923. class Window_MenuCalender < Window_Base
  924.   #--------------------------------------------------------------------------
  925.   # ● 对象初始化
  926.   #--------------------------------------------------------------------------
  927.   def initialize(x = Graphics.width - 220, y = 0, w = 220)
  928.     super(x, y, w, fitting_height(3))
  929.     refresh
  930.   end
  931.   #--------------------------------------------------------------------------
  932.   # ● 刷新
  933.   #--------------------------------------------------------------------------
  934.   def refresh
  935.     contents.clear
  936.     draw_year_date
  937.     draw_season_time
  938.     draw_weather_icon
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ● 绘制年份·月份·日期
  942.   #--------------------------------------------------------------------------
  943.   def draw_year_date
  944.     month = $calender.month
  945.     if (0..9).to_a.include?(month)
  946.       month = "0" + month.to_s
  947.     else
  948.       month = month.to_s
  949.     end
  950.     date = $calender.date
  951.     if (0..9).to_a.include?(date)
  952.       date = "0" + date.to_s
  953.     else
  954.       date = date.to_s
  955.     end
  956.     draw_text(0, 0, contents_width, line_height, "#{$calender.year}" + "年" + month + "月" + date + "日")
  957.   end
  958.   #--------------------------------------------------------------------------
  959.   # ● 绘制季节·星期
  960.   #--------------------------------------------------------------------------
  961.   def draw_season_time
  962.     w = contents_width
  963.     h = line_height
  964.     season = $calender.season.to_s
  965.     season.gsub!("Spring"){"春"}
  966.     season.gsub!("Summer"){"夏"}
  967.     season.gsub!("Autumn"){"秋"}
  968.     season.gsub!("Winter"){"冬"}
  969.     day = $calender.day.to_s
  970.     day.gsub!("Sun"){"\\c[2]星期日\\c[0]"}
  971.     day.gsub!("Mon"){"星期一"}
  972.     day.gsub!("Tue"){"星期二"}
  973.     day.gsub!("Wed"){"星期三"}
  974.     day.gsub!("Thr"){"星期四"}
  975.     day.gsub!("Fri"){"星期五"}
  976.     day.gsub!("Sat"){"星期六"}
  977.     hour = "#{$calender.hour}"
  978.     min = $calender.min
  979.     if (0..9).to_a.include?(min)
  980.       min = "0" + min.to_s
  981.     else
  982.       min = min.to_s
  983.     end
  984.     draw_text(-80, h, contents_width + 12, line_height, season, 1)
  985.     draw_text_ex(46, h, "(" + day + ")")
  986.     draw_text(-12, h * 2, w, h, hour + ":" + min, 2)
  987.   end
  988.   #--------------------------------------------------------------------------
  989.   # ● 绘制天气图标
  990.   #--------------------------------------------------------------------------
  991.   def draw_weather_icon
  992.     case $calender.weather
  993.     when :fine
  994.       icon_index = WhiteSnow::FINE[:icon]
  995.     when :rain
  996.       icon_index = WhiteSnow::RAIN[:icon]
  997.     when :snow
  998.       icon_index = WhiteSnow::SNOW[:icon]
  999.     when :thunder
  1000.       icon_index = WhiteSnow::THUNDER[:icon]
  1001.     when :storm
  1002.       icon_index = WhiteSnow::STORM[:icon]
  1003.     when :star
  1004.       icon_index = WhiteSnow::STAR[:icon]
  1005.     when :s_storm
  1006.       icon_index = WhiteSnow::S_STORM[:icon]
  1007.     end
  1008.     draw_icon(icon_index, contents_width - 30, 0)
  1009.   end
  1010. end

  1011. #==============================================================================
  1012. # ■ Scene_Map
  1013. #------------------------------------------------------------------------------
  1014. #  进行地图画面处理的一个类。
  1015. #==============================================================================
  1016. class Scene_Map < Scene_Base
  1017.   #--------------------------------------------------------------------------
  1018.   # ● 创建所有窗口
  1019.   #--------------------------------------------------------------------------
  1020.   alias calender_create_all_windows create_all_windows
  1021.   def create_all_windows
  1022.     calender_create_all_windows
  1023.     create_calender_window
  1024.   end
  1025.   #--------------------------------------------------------------------------
  1026.   # ● 创建日期显示窗口
  1027.   #--------------------------------------------------------------------------
  1028.   def create_calender_window
  1029.     @calender_window = Window_Calender.new
  1030.   end
  1031. end

  1032. #==============================================================================
  1033. # ■ Scene_Base
  1034. #------------------------------------------------------------------------------
  1035. #  游戏中所有 Scene 类(场景类)的父类。
  1036. #==============================================================================
  1037. class Scene_Base
  1038.   #--------------------------------------------------------------------------
  1039.   # ● 框架更新(基本)
  1040.   #--------------------------------------------------------------------------
  1041.   alias calender_update_basic update_basic
  1042.   def update_basic
  1043.     calender_update_basic
  1044.     update_calender
  1045.   end
  1046.   #--------------------------------------------------------------------------
  1047.   # ● 更新时间
  1048.   #--------------------------------------------------------------------------
  1049.   def update_calender
  1050.     return if $game_switches[WhiteSnow::TIME_COUNT_FORBID_SID]
  1051.     return unless SceneManager.scene_is?(Scene_Map)
  1052.     return if $game_switches[10]
  1053.     $calender.count += 1
  1054.     if $calender.weather == :thunder and !($game_switches[WhiteSnow::WEATHER_EFFECT_FORBID_SID] or $game_switches[WhiteSnow::INSIDE_FLAG_SID])
  1055.       $calender.thunder_count ||= [Graphics.frame_rate * 5 + (rand * Graphics.frame_rate * 10).floor, false]
  1056.       $calender.thunder_count[0] -= 1
  1057.       if $calender.thunder_count[1]
  1058.         if $calender.thunder_count[0] == 0
  1059.           se = RPG::SE.new(WhiteSnow::THUNDER[:se][0], WhiteSnow::THUNDER[:se][1], WhiteSnow::THUNDER[:se][2])
  1060.           se.play
  1061.           $calender.thunder_count = nil
  1062.         end
  1063.       elsif $calender.thunder_count[0] < 12 + rand(43)
  1064.         flash = WhiteSnow::THUNDER[:flash]
  1065.         $calender.perform_thunder_effect(flash[0], flash[1], flash[2], flash[3], flash[4])
  1066.         $calender.thunder_count[1] = true
  1067.       end
  1068.     else
  1069.       $calender.thunder_count = nil
  1070.     end
  1071.     if $calender.count % Graphics.frame_rate == 0
  1072.       $calender.min += 1
  1073.       $calender.count = 0
  1074.       $game_variables[WhiteSnow::MIN_STORE_VID] = $calender.min
  1075.       $calender.weather_count -= 1
  1076.       $calender.change_weather if $calender.weather_count <= 0
  1077.     end
  1078.     if $calender.min == 60
  1079.       $calender.hour += 1
  1080.       $calender.min = 0
  1081.       if $calender.hour >= 3 and $calender.hour < 19
  1082.         $calender.weather = :fine if $calender.weather == :star
  1083.       else
  1084.         $calender.weather = :star if $calender.weather == :fine
  1085.       end
  1086.       $calender.get_time_zone
  1087.       $calender.change_tone_by_calender
  1088.       $game_map.autoplay
  1089.       $game_variables[WhiteSnow::MIN_STORE_VID] = $calender.min
  1090.       $game_variables[WhiteSnow::HOUR_STORE_VID] = $calender.hour
  1091.     end
  1092.     if $calender.hour == 24
  1093.       $calender.hour = 0
  1094.       $calender.shift_date
  1095.     end
  1096.   end
  1097. end

  1098. #==============================================================================
  1099. # ■ Scene_Menu
  1100. #------------------------------------------------------------------------------
  1101. #  进行菜单画面处理的场景类。
  1102. #==============================================================================
  1103. class Scene_Menu
  1104.   #--------------------------------------------------------------------------
  1105.   # ● 开始处理
  1106.   #--------------------------------------------------------------------------
  1107.   alias calender_start start
  1108.   def start
  1109.     calender_start
  1110.     create_calender_window
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # ● 日期窗口生成
  1114.   #--------------------------------------------------------------------------
  1115.   def create_calender_window
  1116.     x = 0
  1117.     w = @gold_window.width
  1118.     @calender_window = Window_MenuCalender.new(x, 0, w)
  1119.     @calender_window.y = Graphics.height - @gold_window.height - @calender_window.height
  1120.   end
  1121. end

  1122. #==============================================================================
  1123. # ■ DataManager
  1124. #------------------------------------------------------------------------------
  1125. #  数据库和游戏实例的管理器。所有在游戏中使用的全局变量都在这里初始化。
  1126. #==============================================================================
  1127. module DataManager
  1128.   #--------------------------------------------------------------------------
  1129.   # ● 别名用具体方法
  1130.   #--------------------------------------------------------------------------
  1131.   class << self
  1132.     alias :calender_create_game_objects :create_game_objects
  1133.     alias :calender_extract_save_contents :extract_save_contents
  1134.   end
  1135.   #--------------------------------------------------------------------------
  1136.   # ● 创建各种游戏对象
  1137.   #--------------------------------------------------------------------------
  1138.   def self.create_game_objects
  1139.     calender_create_game_objects
  1140.     $calender = Calender.new
  1141.   end
  1142.   #--------------------------------------------------------------------------
  1143.   # ● 存档内容生成(重新定义)
  1144.   #--------------------------------------------------------------------------
  1145.   def self.make_save_contents
  1146.     contents = {}
  1147.     contents[:system]           = $game_system
  1148.     contents[:timer]            = $game_timer
  1149.     contents[:message]          = $game_message
  1150.     contents[:switches]         = $game_switches
  1151.     contents[:variables]        = $game_variables
  1152.     contents[:self_switches]    = $game_self_switches
  1153.     contents[:actors]           = $game_actors
  1154.     contents[:party]            = $game_party
  1155.     contents[:troop]            = $game_troop
  1156.     contents[:map]              = $game_map
  1157.     contents[:player]           = $game_player
  1158.     contents[:calender]         = $calender
  1159.     contents
  1160.   end
  1161.   #--------------------------------------------------------------------------
  1162.   # ● 存档内容生成
  1163.   #--------------------------------------------------------------------------
  1164.   def self.extract_save_contents(contents)
  1165.     calender_extract_save_contents(contents)
  1166.     $calender = contents[:calender]
  1167.   end
  1168. end

  1169. #==============================================================================
  1170. # ■ Game_Interpreter
  1171. #------------------------------------------------------------------------------
  1172. #  事件指令的解释器。本类在 Game_Map、Game_Troop、Game_Event 类的内部使用。
  1173. #==============================================================================
  1174. class Game_Interpreter
  1175.   #--------------------------------------------------------------------------
  1176.   # ● 更改画面色调(参数指定)
  1177.   #--------------------------------------------------------------------------
  1178.   def change_tone(r, g, b, gray = 0, dur = 60)
  1179.     tone = Tone.new(r, g, b, gray)
  1180.     screen.start_tone_change(tone, dur)
  1181.   end
  1182.   #--------------------------------------------------------------------------
  1183.   # ● 更改天气(参数指定)
  1184.   #--------------------------------------------------------------------------
  1185.   def change_weather(type, power, dur = 30)
  1186.     return if $game_party.in_battle
  1187.     screen.change_weather(type, power, dur)
  1188.   end
  1189.   #--------------------------------------------------------------------------
  1190.   # ● 设定时间
  1191.   #--------------------------------------------------------------------------
  1192.   def set_time(hour, min)
  1193.     hour = 23 if hour > 23
  1194.     hour = 0 if hour < 0
  1195.     min = 59 if min > 59
  1196.     min = 0 if min < 0
  1197.     $calender.hour = hour
  1198.     $calender.min = min
  1199.     $calender.get_time_zone
  1200.     $game_variables[WhiteSnow::MIN_STORE_VID] = $calender.min
  1201.     $game_variables[WhiteSnow::HOUR_STORE_VID] = $calender.hour
  1202.     $game_variables[WhiteSnow::DATE_STORE_VID] = $calender.date
  1203.     $game_map.autoplay
  1204.     $calender.change_weather
  1205.     $calender.change_tone_by_calender
  1206.     if $calender.hour >= 3 and $calender.hour < 19
  1207.       $calender.weather = :fine if $calender.weather == :star
  1208.     else
  1209.       $calender.weather = :star if $calender.weather == :fine
  1210.     end
  1211.   end
  1212.   #--------------------------------------------------------------------------
  1213.   # ● 设定日期
  1214.   #--------------------------------------------------------------------------
  1215.   def set_date(month, date, day)
  1216.     $calender.month = month
  1217.     $calender.date = date
  1218.     $calender.day = day
  1219.     $game_variables[WhiteSnow::MIN_STORE_VID] = $calender.month
  1220.     $game_variables[WhiteSnow::DATE_STORE_VID] = $calender.date
  1221.     case $calender.day
  1222.     when :Sun
  1223.       $game_variables[WhiteSnow::DAY_STORE_VID] = 0
  1224.     when :Mon
  1225.       $game_variables[WhiteSnow::DAY_STORE_VID] = 1
  1226.     when :Tue
  1227.       $game_variables[WhiteSnow::DAY_STORE_VID] = 2
  1228.     when :Wed
  1229.       $game_variables[WhiteSnow::DAY_STORE_VID] = 3
  1230.     when :Thr
  1231.       $game_variables[WhiteSnow::DAY_STORE_VID] = 4
  1232.     when :Fri
  1233.       $game_variables[WhiteSnow::DAY_STORE_VID] = 5
  1234.     when :Sat
  1235.       $game_variables[WhiteSnow::DAY_STORE_VID] = 6
  1236.     end
  1237.    
  1238.     case $calender.month
  1239.     when 1..2
  1240.       $calender.season = :Winter
  1241.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 3
  1242.     when 3..5
  1243.       $calender.season = :Spring
  1244.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 0
  1245.     when 6..8
  1246.       $calender.season = :Summer
  1247.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 1
  1248.     when 9..11
  1249.       $calender.season = :Autumn
  1250.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 2
  1251.     when 12
  1252.       $calender.season = :Winter
  1253.       $game_variables[WhiteSnow::SEASON_STORE_VID] = 3
  1254.     end
  1255.     $calender.change_weather
  1256.   end
  1257.   #--------------------------------------------------------------------------
  1258.   # ● 设定年份
  1259.   #--------------------------------------------------------------------------
  1260.   def set_year(year)
  1261.     $calender.year = year
  1262.     $game_variables[WhiteSnow::YEAR_STORE_VID] = year
  1263.     $calender.change_weather
  1264.   end
  1265.   #--------------------------------------------------------------------------
  1266.   # ● 设定天气
  1267.   #--------------------------------------------------------------------------
  1268.   def set_weather(weather)
  1269.     $calender.weather = weather
  1270.     $calender.randomize_weather_count
  1271.     $calender.perform_weather_effect
  1272.     case weather
  1273.     when :fine
  1274.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 0
  1275.     when :rain
  1276.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 1
  1277.     when :snow
  1278.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 2
  1279.     when :thunder
  1280.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 3
  1281.     when :storm
  1282.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 4
  1283.     when :star
  1284.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 5
  1285.     when :s_storm
  1286.       $game_variables[WhiteSnow::WEATHER_STORE_VID] = 6
  1287.     end
  1288.   end
  1289.   #--------------------------------------------------------------------------
  1290.   # ● 产生天气效果
  1291.   #--------------------------------------------------------------------------
  1292.   def perform_weather_effect
  1293.     $calender.perform_weather_effect
  1294.   end
  1295.   #--------------------------------------------------------------------------
  1296.   # ● 画面闪烁(参数指定)
  1297.   #--------------------------------------------------------------------------
  1298.   def perform_flash(r, g, b, alpha, dur = 12)
  1299.     color = Color.new(r, g, b, alpha)
  1300.     screen.start_flash(color, dur)
  1301.   end
  1302.   #--------------------------------------------------------------------------
  1303.   # ● 推进日期
  1304.   #--------------------------------------------------------------------------
  1305.   def shift_date(num)
  1306.     num.times{$calender.shift_date}
  1307.     $calender.change_weather
  1308.   end
  1309.   #--------------------------------------------------------------------------
  1310.   # ● 推进月份
  1311.   #--------------------------------------------------------------------------
  1312.   def shift_month(num)
  1313.     table = WhiteSnow::DAYS_TABLE
  1314.     days = table[$calender.month] - $calender.date + 1
  1315.     for i in 1..num
  1316.       days += table[($calender.month + i) % 12]
  1317.     end
  1318.     days.times{$calender.shift_date}
  1319.     $calender.change_weather
  1320.   end
  1321.   #--------------------------------------------------------------------------
  1322.   # ● 推进年份
  1323.   #--------------------------------------------------------------------------
  1324.   def shift_year(num)
  1325.     (num * 365).times{$calender.shift_date}
  1326.     $calender.change_weather
  1327.   end
  1328.   #--------------------------------------------------------------------------
  1329.   # ● 推进到指定日期前日
  1330.   #--------------------------------------------------------------------------
  1331.   def shift_date_to(m, d, y = -1)
  1332.     y = $calender.year if y == -1
  1333.     if $calender.days_dif(y, m, d) > 0
  1334.       $calender.days_dif(y, m, d).times{$calender.shift_date}
  1335.     else
  1336.       $calender.days_dif(y, m, d).abs.times{$calender.back_date}
  1337.     end
  1338.     $calender.change_weather
  1339.   end
  1340. end

  1341. #==============================================================================
  1342. # ■ SceneManager
  1343. #------------------------------------------------------------------------------
  1344. #  场景切换的管理器。例如从主要菜单调用道具画面,还可以处理返回上一个场景。
  1345. #==============================================================================
  1346. module SceneManager
  1347.   #--------------------------------------------------------------------------
  1348.   # ● 别名用具体方法
  1349.   #--------------------------------------------------------------------------
  1350.   class << self
  1351.     alias :calender_goto   :goto
  1352.     alias :calender_call   :call
  1353.     alias :calender_return :return
  1354.   end
  1355.   #--------------------------------------------------------------------------
  1356.   # ● 直接跳转
  1357.   #--------------------------------------------------------------------------
  1358.   def self.goto(scene_class)
  1359.     calender_goto(scene_class)
  1360.     if scene_class == Scene_Map
  1361.       $calender.perform_weather_effect
  1362.       $calender.change_tone_by_calender
  1363.     end
  1364.   end
  1365.   #--------------------------------------------------------------------------
  1366.   # ● 调用
  1367.   #--------------------------------------------------------------------------
  1368.   def self.call(scene_class)
  1369.     calender_call(scene_class)
  1370.     if scene_class == Scene_Map
  1371.       $calender.perform_weather_effect
  1372.       $calender.change_tone_by_calender
  1373.     end
  1374.   end
  1375.   #--------------------------------------------------------------------------
  1376.   # ● 返回到调用前
  1377.   #--------------------------------------------------------------------------
  1378.   def self.return
  1379.     calender_return
  1380.     if @scene.class == Scene_Map
  1381.       $calender.perform_weather_effect
  1382.       $calender.change_tone_by_calender
  1383.     end
  1384.   end
  1385. end

  1386. #==============================================================================
  1387. # ■ Game_Switches
  1388. #------------------------------------------------------------------------------
  1389. #  处理开关的类。本质上是套了个壳的 Array 。本类的实例请参考 $game_switches 。
  1390. #==============================================================================
  1391. class Game_Switches
  1392.   #--------------------------------------------------------------------------
  1393.   # ● 开关设置(重新定义)
  1394.   #     value : ON (true) / OFF (false)
  1395.   #--------------------------------------------------------------------------
  1396.   def []=(switch_id, value)
  1397.     @data[switch_id] = value
  1398.     on_change
  1399.     if switch_id == WhiteSnow::TONE_CHANGE_FORBID_SID or switch_id == WhiteSnow::INSIDE_FLAG_SID
  1400.       case value
  1401.       when true
  1402.         $calender.interpreter.change_tone(0, 0, 0, 0, 0)
  1403.       when false
  1404.         $calender.change_tone_by_calender(0)
  1405.       end
  1406.     end
  1407.     if switch_id == WhiteSnow::WEATHER_EFFECT_FORBID_SID or switch_id == WhiteSnow::INSIDE_FLAG_SID
  1408.       case value
  1409.       when true
  1410.         $calender.interpreter.change_weather(:none, 0, 0)
  1411.         RPG::BGS.stop if (WhiteSnow::WEATHER_BGS_ENABLE and [0, 1].include?(WhiteSnow::INSIDE_BGS_TYPE)) or $game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  1412.         $calender.play_inside_bgs if WhiteSnow::WEATHER_BGS_ENABLE and WhiteSnow::INSIDE_BGS_TYPE == 1 and !$game_switches[WhiteSnow::WEATHER_BGS_DISABLE]
  1413.       when false
  1414.         $calender.perform_weather_effect(0)
  1415.       end
  1416.     end
  1417.   end
  1418. end

  1419. #==============================================================================
  1420. # ■ Game_Player
  1421. #------------------------------------------------------------------------------
  1422. #  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
  1423. #   本类的实例请参考 $game_player 。
  1424. #==============================================================================
  1425. class Game_Player
  1426.   #--------------------------------------------------------------------------
  1427.   # ● 场所移动的执行
  1428.   #--------------------------------------------------------------------------
  1429.   alias calender_perform_transfer perform_transfer
  1430.   def perform_transfer
  1431.     if transfer?
  1432.       $calender.perform_weather_effect(0)
  1433.       $calender.change_tone_by_calender(0)
  1434.     end
  1435.     calender_perform_transfer
  1436.   end
  1437. end

  1438. #==============================================================================
  1439. # ■ RPG::Map
  1440. #------------------------------------------------------------------------------
  1441. #  地图的数据类。
  1442. #==============================================================================
  1443. class RPG::Map
  1444.   #--------------------------------------------------------------------------
  1445.   # ● 地图BGM
  1446.   #--------------------------------------------------------------------------
  1447.   def bgm
  1448.     bgm = Hash.new(@bgm)
  1449.     @note.each_line do |line|
  1450.       case line
  1451.       when /<(?:凌晨|early)\s*(.+)\s*\,\s*(\d+)\s*\,\s*(\d+)>/
  1452.         bgm[:early_morning] = RPG::BGM.new($1, $2.to_i, $3.to_i)
  1453.       when /<(?:早晨|morning)\s*(.+)\s*\,\s*(\d+)\s*\,\s*(\d+)>/
  1454.         bgm[:morning] = RPG::BGM.new($1, $2.to_i, $3.to_i)
  1455.       when /<(?:白天|noon)\s*(.+)\s*\,\s*(\d+)\s*\,\s*(\d+)>/
  1456.         bgm[:noon] = RPG::BGM.new($1, $2.to_i, $3.to_i)
  1457.       when /<(?:傍晚|evening)\s*(.+)\s*\,\s*(\d+)\s*\,\s*(\d+)>/
  1458.         bgm[:evening] = RPG::BGM.new($1, $2.to_i, $3.to_i)
  1459.       when /<(?:夜晚|night)\s*(.+)\s*\,\s*(\d+)\s*\,\s*(\d+)>/
  1460.         bgm[:night] = RPG::BGM.new($1, $2.to_i, $3.to_i)
  1461.       when /<(?:深夜|mid)\s*(.+)\s*\,\s*(\d+)\s*\,\s*(\d+)>/
  1462.         bgm[:midnight] = RPG::BGM.new($1, $2.to_i, $3.to_i)
  1463.       end
  1464.     end
  1465.     return bgm
  1466.   end
  1467. end

  1468. #==============================================================================
  1469. # ■ Game_Map
  1470. #------------------------------------------------------------------------------
  1471. #  管理地图的类。拥有卷动地图以及判断通行度的功能。本类的实例请参考 $game_map 。
  1472. #==============================================================================
  1473. class Game_Map
  1474.   #--------------------------------------------------------------------------
  1475.   # ● BGM / BGS 自动切换(重新定义)
  1476.   #--------------------------------------------------------------------------
  1477.   def autoplay
  1478.     case $calender.time_zone
  1479.     when :early_morning #凌晨
  1480.       @map.bgm[:early_morning].play if @map.autoplay_bgm
  1481.     when :morning #早晨
  1482.       @map.bgm[:morning].play if @map.autoplay_bgm
  1483.     when :noon #白天
  1484.       @map.bgm[:noon].play if @map.autoplay_bgm
  1485.     when :evening #傍晚
  1486.       @map.bgm[:evening].play if @map.autoplay_bgm
  1487.     when :night #夜晚
  1488.       @map.bgm[:night].play if @map.autoplay_bgm
  1489.     when :midnight #深夜
  1490.       @map.bgm[:midnight].play if @map.autoplay_bgm
  1491.     end
  1492.     @map.bgs.play if @map.autoplay_bgs
  1493.   end
  1494. end

  1495. module Kernel
  1496.   #--------------------------------------------------------------------------
  1497.   # ● 生成平均随机数
  1498.   #--------------------------------------------------------------------------
  1499.   def p_ex_rand(rate, n = 0)
  1500.     srand
  1501.     rate = 99 if rate == 100
  1502.     if n == 0
  1503.       r = 1 - rand ** (1 - rate * 0.01)
  1504.       if r == 1
  1505.         return 0
  1506.       else
  1507.         return r
  1508.       end
  1509.     else
  1510.       num = n.truncate
  1511.       r = 1 - rand ** (1 - rate * 0.01)
  1512.       r = 0 if r == 1
  1513.       return (r * num).floor
  1514.     end
  1515.   end
  1516. end
复制代码


让“时间暂停开关”生效的方法只是在 class Scene_Base → def update_calender(更新时间) 下增加了一行
    return if $game_switches[WhiteSnow::TIME_COUNT_FORBID_SID]
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-3 02:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表