设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 188|回复: 0

[转载发布] Yet Another Time System

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 23:21
  • 签到天数: 212 天

    连续签到: 1 天

    [LV.7]常住居民III

    9086

    主题

    867

    回帖

    7万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    64473
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    74456

    灌水之王

    发表于 2026-8-1 18:07:49 | 显示全部楼层 |阅读模式
    Yet Another Time System
    by Rinobi
    ​


    Yet another time system script! There's many to choose from already, and here's another one. It's super easy to use with lots of customization options to fiddle around with.

    Spoiler: CHANGE LOG

    • [03/03/2017] 1.00 Public Release
    • [03/08/2017] 1.01 Map Transition Update
    Spoiler: FEATURES

    • Crappy UI... it can be disabled.
    • Customizable time scale.
    • Customizable calendar settings.
    • Customizable seasons and weather effects.
    • Lightning flashes and sounds added to storms.
    • Day/Night tinting with automatic tint distribution for smooth transitions
    • Variable settings and script calls to integrate system into game play.
    • Plug & Play. This script functions without any additional hassle
    Spoiler: SCREENSHOTS
    Spoiler: SCRIPT
                    Code:       
    1. module RINOBI module TimeSystem # DO NOT MODIFY
    2. #==============================================================================
    3. #                          YET ANOTHER TIME SYSTEM
    4. # -----------------------------------------------------------------------------
    5. # This script adds a totally customizable time and weather system complete with
    6. # day/night cycles, seasonal weather patterns and tilesets, and much more.
    7. # The developer now has complete control over how time flows in their project.
    8. #==============================================================================
    9. # # VERSION HISTORY
    10. # -----------------------------------------------------------------------------
    11. # @ 0.60 [12/23/2015] Finished alpha version.
    12. # @ 0.61 [12/23/2015] Added lightning & thunder effects.
    13. # @ 0.62 [12/23/2015] Time process method reliability update.
    14. # @ 0.63 [12/23/2015] Added time freeze method.
    15. # @ 0.64 [12/25/2015] Updated set_weather method.
    16. # @ 0.69 [05/18/2016] Added Time Display UI
    17. # @ 0.70 [05/21/2016] Updated time_process method.
    18. # @ 1.00 [03/03/2017] Public release.
    19. # @ 1.01 [03/08/2017] Map Transition Update
    20. #==============================================================================
    21. # ** Settings Module
    22. #------------------------------------------------------------------------------
    23. # Adjust the below settings to your liking.
    24. #------------------------------------------------------------------------------
    25.   #============================================================================
    26.   # * Time Variables
    27.   # ---------------------------------------------------------------------------
    28.   # Set variable IDs to keep track of time. Modifying the chosen variables
    29.   # will not influence time passage. Please use script calls for that.
    30.   # Set to false to disable.
    31.   #============================================================================
    32.   Var_Season    = false   # Season number in order listed in Settings Module.
    33.   Var_Year      = false   # The Current Year.
    34.   Var_Month     = false   # Month number in order listed in Settings Module.
    35.   Var_Day       = false   # Day number within month.
    36.   Var_Hour      = false   # The current hour.
    37.   Var_Minute    = false   # The current minute.
    38.   Var_Second    = false   # The current second.
    39.   Var_Season_N  = false   # Current season name.
    40.   Var_Month_N   = false   # Current month name.
    41.   Var_Day_N     = false   # Current day name.
    42.   #============================================================================
    43.   # * Time Display Window (Work In Progress)
    44.   # ---------------------------------------------------------------------------
    45.   # A window displaying the current date and season.
    46.   #============================================================================
    47.   Display_Toggle = true    # Set to false to disable display window.
    48.   Display_Key = :L         # See gamepad buttons for reference.
    49.   Toggle_Key = :R          # See gamepad buttons for reference.
    50.   Window_X = 0             # The X position of the display window.
    51.   Window_Y = 0             # The Y position of the display window.
    52.   Toggle_Variable = 99     # Variable used to toggle between window options.
    53.   Display_Switch = 100     # Switch used to troggle time display.
    54.   Date_Display_Width = 276 # Width of date only display window. (does nothing)
    55.   Time_Display_Width = 186 # Width of time only display window. (does nothing)
    56.   #============================================================================
    57.   # * Start Date
    58.   # ---------------------------------------------------------------------------
    59.   # The initial date upon beginning a new game.
    60.   #============================================================================
    61.   # Year = Any integer you desire
    62.   # Month = See 'Months' settings below.
    63.   # Day = The day within the current month. See 'Months' settings below.
    64.   # Hour = A number within 'Day_Length' setting below.
    65.   # Minute = A number within 'Hour_Length' setting below.
    66.   # Second = A number within 'Minute_Length' setting below.
    67.   # ---------------------------------------------------------------------------
    68.   Start_Date = {
    69.     :Year => 2015, :Month  => 12, :Day    => 23,
    70.     :Hour =>   19, :Minute => 30, :Second =>  0,
    71.   } # StartDate
    72.   Start_Weather = 0 # Default weather upon starting a new game.
    73.   #============================================================================
    74.   # * Timescale
    75.   # ---------------------------------------------------------------------------
    76.   # The rate at which time flows.
    77.   #============================================================================
    78.   Time_Scale    = 60 # A speed multiplier for time flow.
    79.   Second_Length = 60 # Number of frames in a second.
    80.   Minute_Length = 60 # Number of seconds in a minute.
    81.   Hour_Length   = 60 # Number of minutes in an hour.
    82.   Day_Length    = 23 # Number of hours in a day.
    83.   #============================================================================
    84.   # * Battle Time
    85.   # ---------------------------------------------------------------------------
    86.   # Set the passage of time per turn in battle.
    87.   #============================================================================
    88.   # [time_unit, value]
    89.   # ---------------------------------------------------------------------------
    90.   Battle_Time = true # Set to false to disable time passage during battle.
    91.   Time_Per_Turn = ['minute', 10] # year, month, day, hour, minute, second.
    92.   #============================================================================
    93.   # * Indoor Settings
    94.   # ---------------------------------------------------------------------------
    95.   # For maps which should be unaffected or affected differently by
    96.   # Day/Night screen tints and weather patterens
    97.   #============================================================================
    98.   # Indoor_Maps = An array of map IDs to be considered indoors.
    99.   # Indoor_Tiles = An array of tileset IDs to be considered indoors.
    100.   # Indoor_Tint = The screen tone used for indoor maps
    101.   # ---------------------------------------------------------------------------
    102.   Indoor_Maps  = [0, 0, 0, 0] # ID, ID, ID, ID
    103.   Indoor_Tiles = [3, 4, 6, 7] # ID, ID, ID, ID
    104.   Indoor_Tint  = [0, 0, 0, 0] # Red, Green, Blue, Grey
    105.   #============================================================================
    106.   # * Day/Night Cycle
    107.   # ---------------------------------------------------------------------------
    108.   # Adjust the outdoor tint levels based on a range of hours below. Each hour
    109.   # of the day will be filled in automatically. See example below.
    110.   #-
    111.   # Module Setting Example
    112.   # 1 => {:Tint => [ -75,  -75, 0,  50], :Range => (  5..10)},
    113.   # 2 => {:Tint => [   0,    0, 0,   0], :Range => ( 10..10)},
    114.   #-
    115.   # Hours filled in for smooth transitions automatically
    116.   # Hour 5  [ -75,  -75, 0,  50]
    117.   # Hour 6  [ -60,  -60, 0,  40]
    118.   # Hour 7  [ -45,  -45, 0,  30]
    119.   # Hour 8  [ -30,  -30, 0,  20]
    120.   # Hour 9  [ -15,  -15, 0,  10]
    121.   # Hour 10 [   0,    0, 0,   0]
    122.   #============================================================================
    123.   Tint_Interval = 300 # Number of frames to fade from one tint to the next.
    124.   Day_Cycle = { # Add or remove lines as you see fit.
    125.     #     [Red, Green, Blue, Grey]        (Start_Hour..End_Hour)
    126.     1 => {:Tint => [ -75,  -75, 0,  50], :Range => (  5..9)}, # Dawn
    127.     2 => {:Tint => [   0,    0, 0,   0], :Range => ( 9..11)}, # Morning
    128.     3 => {:Tint => [  45,   45, 0,   0], :Range => (11..16)}, # Noon
    129.     4 => {:Tint => [   0,    0, 0,   0], :Range => (16..20)}, # Afternoon
    130.     5 => {:Tint => [ -50,  -50, 0,  25], :Range => (20..22)}, # Evening
    131.     6 => {:Tint => [ -75, -100, 0,  75], :Range => ( 22..0)}, # Night
    132.     7 => {:Tint => [-125, -125, 0, 125], :Range => (  0..5)}, # Midnight
    133.   } # <=== DO NOT REMOVE
    134.   #============================================================================
    135.   # * Week Days
    136.   # ---------------------------------------------------------------------------
    137.   # Adjust the length of one week by adding or removing week days.
    138.   # Set the names of each week day and the order in which they appear.
    139.   #============================================================================
    140.   Days = {
    141.     1 => 'Sunday',
    142.     2 => 'Monday',
    143.     3 => 'Tuesday',
    144.     4 => 'Wednesday',
    145.     5 => 'Thursday',
    146.     6 => 'Friday',
    147.     7 => 'Saturday',
    148.   } # Days
    149.   #============================================================================
    150.   # * Month Settings
    151.   # ---------------------------------------------------------------------------
    152.   # Adjust the number of months in a year by adding or removing keys. Set the
    153.   # names of each month and the order in which they appear. Set the number of
    154.   # days each month has and the season each month appears within.
    155.   #============================================================================
    156.   # Name = A string containing the name of this month.
    157.   # Days = The number of days within this month.
    158.   # Season = Which season this month is a part of.
    159.   # ---------------------------------------------------------------------------
    160.   Months = {
    161.     1 =>  {:Name => 'January'  , :Days => 31, :Season => 4},
    162.     2 =>  {:Name => 'February' , :Days => 28, :Season => 4},
    163.     3 =>  {:Name => 'March'    , :Days => 31, :Season => 1},
    164.     4 =>  {:Name => 'April'    , :Days => 30, :Season => 1},
    165.     5 =>  {:Name => 'May'      , :Days => 31, :Season => 1},
    166.     6 =>  {:Name => 'June'     , :Days => 30, :Season => 2},
    167.     7 =>  {:Name => 'July'     , :Days => 31, :Season => 2},
    168.     8 =>  {:Name => 'August'   , :Days => 31, :Season => 2},
    169.     9 =>  {:Name => 'September', :Days => 30, :Season => 3},
    170.     10 => {:Name => 'October'  , :Days => 31, :Season => 3},
    171.     11 => {:Name => 'November' , :Days => 30, :Season => 3},
    172.     12 => {:Name => 'December' , :Days => 31, :Season => 4},
    173.   } # Months
    174.   #============================================================================
    175.   # * Season Settings
    176.   # ---------------------------------------------------------------------------
    177.   # Adjust the number of seasons avaliable by adding or removing keys. Set the
    178.   # names of each season; the order in which they appear within this hash is
    179.   # unimportant. Set the tileset this season uses and the likelyhood of
    180.   # pre-specified weather patterns to occur.
    181.   #============================================================================
    182.   # Automatically adjust tilesets during seasons?
    183.   # ---------------------------------------------------------------------------
    184.   Use_Tilesets = false # Set to true or false.
    185.   # ---------------------------------------------------------------------------
    186.   # IDs of seasonal tilesets. Add all tilesets elgible for change
    187.   # during the seasons here.
    188.   # ---------------------------------------------------------------------------
    189.   Season_Tilesets = [5, 8, 9, 10]
    190.   # ---------------------------------------------------------------------------
    191.   # Name = A string containing the name of this season.
    192.   # Tileset = The tileset used while this season is active.
    193.   # Weathers = The type and likelyhood that this weather will affect the
    194.   # outdoor maps. See 'Weather Settings' below.
    195.   # ---------------------------------------------------------------------------
    196.   Seasons = {
    197.     1 => {
    198.     :Name => 'Spring',
    199.     :Tileset =>  9,
    200.     :Weathers => {
    201.       0 => {:Weight => 4}, # Clear       4/17
    202.       1 => {:Weight => 5}, # Light Rain  5/17
    203.       2 => {:Weight => 5}, # Normal Rain 5/17
    204.       3 => {:Weight => 2}, # Heavy Rain  2/17
    205.       4 => {:Weight => 1}, # Storm       1/17
    206.     }}, # Spring
    207.    
    208.     2 => {
    209.     :Name => 'Summer',
    210.     :Tileset =>  5,
    211.     :Weathers => {
    212.       0 => {:Weight => 5}, # Clear       5/15
    213.       1 => {:Weight => 1}, # Light Rain  1/15
    214.       2 => {:Weight => 2}, # Normal Rain 2/15
    215.       3 => {:Weight => 3}, # Heavy Rain  3/15
    216.       4 => {:Weight => 4}, # Storm       4/15
    217.     }}, # Summer
    218.    
    219.     3 => {
    220.     :Name => 'Autumn',
    221.     :Tileset =>  8,
    222.     :Weathers => {
    223.       0 => {:Weight => 5}, # Clear       5/12
    224.       1 => {:Weight => 1}, # Light Rain  1/12
    225.       2 => {:Weight => 1}, # Normal Rain 1/12
    226.       5 => {:Weight => 1}, # Snow        1/12
    227.       6 => {:Weight => 4}, # Windy       4/12
    228.     }}, # Autumn
    229.    
    230.     4 => {
    231.     :Name => 'Winter',
    232.     :Tileset => 10,
    233.     :Weathers => {
    234.       0 => {:Weight => 1}, # Clear       1/10
    235.       1 => {:Weight => 3}, # Light Rain  3/10
    236.       2 => {:Weight => 1}, # Normal Rain 1/10
    237.       5 => {:Weight => 5}, # Snow        5/10
    238.     }}, # Winter
    239.   } # Seasons
    240.   #============================================================================
    241.   # * Weather Settings
    242.   # ---------------------------------------------------------------------------
    243.   # Below is the selection of weathers accessible by script call or seasonal
    244.   # weather patterns. Ensure that this hash includes any weathers listed above.
    245.   #============================================================================
    246.   BGS_Indoors    = 60.00   # Percentage to reduce weather sounds while indoors.
    247.   Daily_Weather  = 50.00   # Chance per day that weather may change.
    248.   Hourly_Weather = 10.00   # Chance per hour that weather may change.
    249.   Minute_Weather =  1.00   # Chance per minute that weather may change.
    250.   Second_Weather =  0.00   # Chance per second that weather may change.
    251.   # ---------------------------------------------------------------------------
    252.   # type = :none, :rain, :storm, :snow
    253.   # power = 1 - 9, or 0 if type is set to :none
    254.   # duration = frames to fade in/out
    255.   # ---------------------------------------------------------------------------
    256.   Weathers = { # Clear, Light Rain, Rain, Heavy Rain, Storm, Snow, Windy
    257.     0 => {:Type => :none,  :Power => 0, :Duration =>   0,
    258.           :Sound => ['',        0,   0],
    259.           }, # Clear Weather / Indoors
    260.     1 => {:Type => :rain,  :Power => 4, :Duration => 600,
    261.           :Sound => ['Rain',   56, 100],
    262.           }, # Light Rain
    263.     2 => {:Type => :rain,  :Power => 9, :Duration => 600,
    264.           :Sound => ['Rain',  100, 100],
    265.           }, # Moderate Rain
    266.     3 => {:Type => :storm, :Power => 7, :Duration => 600,
    267.           :Sound => ['Storm',  70, 100],
    268.           }, # Heavy Rain / Storm
    269.     4 => {:Type => :storm, :Power => 9, :Duration => 600,
    270.           :Sound => ['Storm', 100, 100],
    271.           }, # Thunder Storm
    272.     5 => {:Type => :snow,  :Power => 9, :Duration => 600,
    273.           :Sound => ['',        0,   0],
    274.           }, # Heavy Snow
    275.     6 => {:Type => :none,  :Power => 0, :Duration => 600,
    276.           :Sound => ['Wind',  100, 100],
    277.           }, # Very Windy
    278.   } # Weather
    279.   # ---------------------------------------------------------------------------
    280.   # How often lightning strikes occur during storms
    281.   # Lower values increase the frequency of lightning strikes.
    282.   # ---------------------------------------------------------------------------
    283.   Frequency = 10
    284.   # ---------------------------------------------------------------------------
    285.   # The color of lightning flashes.
    286.   # [Red, Green, Blue, Opacity, Duration]
    287.   # ---------------------------------------------------------------------------
    288.   Flash_Lightning = [255, 255, 255, 255, 15]
    289.   # ---------------------------------------------------------------------------
    290.   # The sound effects played when lightning strikes. The sound is chosen at
    291.   # at random from the list below. Have as many or as few as you like.
    292.   # File   = Sound Effect file name as string.
    293.   # Volume = 0 - 100
    294.   # Pitch  = 0 - 200, 100 is normal.
    295.   # ---------------------------------------------------------------------------
    296.   SE_Thunder = {
    297.     1 => {:File => 'Thunder1', :Volume => 100, :Pitch =>  55},
    298.     2 => {:File => 'Thunder5', :Volume => 100, :Pitch =>  35},
    299.     3 => {:File => 'Thunder7', :Volume => 100, :Pitch =>  55},
    300.     4 => {:File => 'Thunder9', :Volume => 100, :Pitch =>  55},
    301.   } # SE_Thunder
    302. #==============================================================================
    303. # # SCRIPT CALLS
    304. # -----------------------------------------------------------------------------
    305. #
    306. #-----------------------------------------------
    307. # >> Basic Information
    308. #-----------------------------------------------
    309. # year       - Get the current year.
    310. # month      - Get the current month. (integer)
    311. # day        - Get the current day. (integer)
    312. # hour       - Get the current hour.
    313. # minute     - Get the current minute.
    314. # second     - Get the current second.
    315. # season     - Get the current season. (integer)
    316. # weather    - Get the current weather.
    317. # time_scale - Get the current time scale value.
    318. #-----------------------------------------------
    319. # >> set_weather(value)
    320. # >> set_weather(value, fast)
    321. #-----------------------------------------------
    322. # @ sets the weather to a value within the module settings below.
    323. # @ setting fast to true changes the weather instantly.
    324. #-----------------------------------------------
    325. # >> set_time(key, value)
    326. #-----------------------------------------------
    327. # @ Sets the current time to a chosen value.
    328. # @ Where key is 'year', 'month', 'day', 'hour', 'minute', 'second'
    329. # @ EX: set_time('month', 11)
    330. #-----------------------------------------------
    331. # >> add_time(key, value)
    332. #-----------------------------------------------
    333. # @ Adds to the current time.
    334. # @ Where key is 'year', 'month', 'day', 'hour', 'minute', 'second'
    335. # @ EX: add_time('hour', 8)
    336. #-----------------------------------------------
    337. # >> get_day_name
    338. # >> get_day_name(day)
    339. # >> get_day_name(day, month)
    340. #-----------------------------------------------
    341. # @ Returns the current or chosen day's name set in module settings below.
    342. #-----------------------------------------------
    343. # >> get_month_name
    344. # >> get_month_name(month_number)
    345. #-----------------------------------------------
    346. # @ Returns the current or chosen month's name set in module settings below.
    347. #-----------------------------------------------
    348. # >> set_time_scale(value)
    349. #-----------------------------------------------
    350. # @ Allows the time scale to be modified in-game. See module settings below.
    351. #-----------------------------------------------
    352. # >> time_freeze
    353. #-----------------------------------------------
    354. # @ Toggles time progression.
    355. #-----------------------------------------------
    356. # >> set_due_date(name, date)
    357. #-----------------------------------------------
    358. # @ Sets a date for later reference.
    359. # @ Where name is any string or symbol and date is an array.
    360. # @ date [year, month, day, hour, minute, second]
    361. # @ EX: set_due_date('rental', year, month, day + 3, 8)
    362. #-----------------------------------------------
    363. # >> add_due_date(name, key, date)
    364. #-----------------------------------------------
    365. # @ Instead of setting a date manually, this method adds to the current time.
    366. # @ name is any string EX: 'dinner party'.
    367. # @ key is :year, :month, :day, :hour, :minute, or :second.
    368. # @ date is an array of numbers.
    369. #
    370. # @ EX: add_due_date('paycheck!', :day, 3, 12)
    371. #   Due date in 3 days and 12 hours.
    372. #-----------------------------------------------
    373. # >> get_due_date(name)
    374. #-----------------------------------------------
    375. # @ Simply returns a date array by name.
    376. #-----------------------------------------------
    377. # >> due_date?(name)
    378. #-----------------------------------------------
    379. # @ Returns true if date has arrived or passed
    380. #-----------------------------------------------
    381. # >> indoors?
    382. #-----------------------------------------------
    383. # @ returns true if the player is inside based on module settings below.
    384. #==============================================================================
    385. # # COMPATIBILITY
    386. # -----------------------------------------------------------------------------
    387. #
    388. # Alias Methods:
    389. #-
    390. #  @ change_weather       in Game_Screen
    391. #  @ initialize           in Game_Map
    392. #  @ setup                in Game_Map
    393. #  @ update_events        in Game_Map
    394. #  @ update_sprite_storm  in Spriteset_Weather
    395. #  @ create_spriteset     in Scene_Map
    396. #  @ update               in Scene_Map
    397. #==============================================================================
    398. # # TERMS OF USE
    399. #------------------------------------------------------------------------------
    400. # 1. Preserve this header.
    401. # 2. Do not re-upload this script.
    402. # 3. Do not claim this script as your own work.
    403. # 4. Do not release modified versions of this script.
    404. # 5. Do not use this script within commercial projects.
    405. #==============================================================================
    406. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    407. # # # # # # # # # # # # # # # END OF SETTINGS # # # # # # # # # # # # # # # # #
    408. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    409. #------------------------------------------------------------------------------
    410. #           Editing beyond this point may produce unintended results
    411. #==============================================================================
    412. end end # No Touchie!
    413. #==============================================================================
    414. # ** End of Settings
    415. #------------------------------------------------------------------------------
    416. $imported = {} if $imported.nil?
    417. $imported[:RIN_RUDNWS] = true
    418. #==============================================================================
    419. # ** Game_Screen
    420. #------------------------------------------------------------------------------
    421. #  This class handles screen maintenance data, such as changes in color tone,
    422. # flashes, etc. It's used within the Game_Map and Game_Troop classes.
    423. #==============================================================================
    424. class Game_Screen
    425.   #--------------------------------------------------------------------------
    426.   # * Alias Method: change_weather
    427.   #--------------------------------------------------------------------------
    428.   alias :rinchange_weather :change_weather
    429.   def change_weather(type, power, duration)
    430.     rinchange_weather(type, power, duration)
    431.     if $game_map.indoors?
    432.       dampen = RINOBI::TimeSystem::BGS_Indoors / 100.0
    433.       file = RINOBI::TimeSystem::Weathers[$game_map.weather][:Sound][0]
    434.       volume = RINOBI::TimeSystem::Weathers[$game_map.weather][:Sound][1]
    435.       pitch = RINOBI::TimeSystem::Weathers[$game_map.weather][:Sound][2]
    436.       volume *= dampen ; RPG::BGS.new(file, volume, pitch).play
    437.     else
    438.       file = RINOBI::TimeSystem::Weathers[$game_map.weather][:Sound][0]
    439.       volume = RINOBI::TimeSystem::Weathers[$game_map.weather][:Sound][1]
    440.       pitch = RINOBI::TimeSystem::Weathers[$game_map.weather][:Sound][2]
    441.       RPG::BGS.new(file, volume, pitch).play
    442.     end
    443.   end # change_weather
    444. end # Game_Screen
    445. #==============================================================================
    446. # ** Game_Battler
    447. #------------------------------------------------------------------------------
    448. #  A battler class with methods for sprites and actions added. This class
    449. # is used as a super class of the Game_Actor class and Game_Enemy class.
    450. #==============================================================================
    451. class Game_Battler < Game_BattlerBase
    452.   alias :rinbattle_end :on_battle_end
    453.   def on_battle_end
    454.     return rinbattle_end unless RINOBI::TimeSystem::Battle_Time
    455.     btime = RINOBI::TimeSystem::Time_Per_Turn
    456.     $game_map.add_time(btime[0], $game_troop.turn_count * btime[1])
    457.     rinbattle_end
    458.   end # on_battle_end
    459. end # Game_Battler
    460. #==============================================================================
    461. # ** Game_Map
    462. #------------------------------------------------------------------------------
    463. #  This class handles maps. It includes scrolling and passage determination
    464. # functions. The instance of this class is referenced by $game_map.
    465. #==============================================================================
    466. class Game_Map
    467.   #--------------------------------------------------------------------------
    468.   # * Attributes: year, month, day, hour, minute, calendar
    469.   #--------------------------------------------------------------------------
    470.   attr_accessor :season
    471.   attr_accessor :year
    472.   attr_accessor :month
    473.   attr_accessor :day
    474.   attr_accessor :hour
    475.   attr_accessor :minute
    476.   attr_accessor :second
    477.   attr_accessor :weather
    478.   attr_accessor :calendar
    479.   attr_accessor :dates_hash
    480.   attr_accessor :time_scale
    481.   #--------------------------------------------------------------------------
    482.   # * Alias Methods: initialize, update_events, setup
    483.   #--------------------------------------------------------------------------
    484.   alias :time_init :initialize
    485.   alias :time_setup :setup
    486.   alias :time_update_events :update_events
    487.   #--------------------------------------------------------------------------
    488.   # * Alias Method: initialize
    489.   #--------------------------------------------------------------------------
    490.   def initialize
    491.     time_init ; @frame = 0
    492.     @time_scale = RINOBI::TimeSystem::Time_Scale
    493.     start_date = RINOBI::TimeSystem::Start_Date
    494.     months     = RINOBI::TimeSystem::Months
    495.     days       = RINOBI::TimeSystem::Days
    496.     @weather   = RINOBI::TimeSystem::Start_Weather
    497.     @year   = start_date[:Year]
    498.     @month  = start_date[:Month]
    499.     @day    = start_date[:Day]
    500.     @hour   = start_date[:Hour]
    501.     @minute = start_date[:Minute]
    502.     @second = start_date[:Second]
    503.     @season = months[@month][:Season]
    504.     @week   = days.count
    505.     @time_freeze = false
    506.     @dates_hash = Hash.new
    507.     generate_calendar
    508.   end # initialize
    509.   #--------------------------------------------------------------------------
    510.   # * Alias Method: setup
    511.   #--------------------------------------------------------------------------
    512.   def setup(map_id)
    513.     time_setup(map_id) ; light_cycle
    514.     set_weather(@weather, true)
    515.     return if indoors?
    516.     return unless RINOBI::TimeSystem::Use_Tilesets
    517.     return unless RINOBI::TimeSystem::Season_Tilesets.include?(@tileset_id)
    518.     change_tileset(RINOBI::TimeSystem::Seasons[season][:Tileset])
    519.   end # setup
    520.   #--------------------------------------------------------------------------
    521.   # * New Method: Generate Calendar
    522.   #--------------------------------------------------------------------------
    523.   def generate_calendar
    524.     days = RINOBI::TimeSystem::Days
    525.     @calendar = Hash.new ; m_start = 0, m_end = 0 ; month = 1 ; count = 0
    526.     while month <= RINOBI::TimeSystem::Months.count
    527.       cmonth = month
    528.       while cmonth > 0
    529.         m_end += RINOBI::TimeSystem::Months[cmonth][:Days]
    530.         cmonth -= 1
    531.       end # cmonth > 0
    532.       m_start = (1 + m_end) - RINOBI::TimeSystem::Months[month][:Days]
    533.       @calendar[month] = Hash[(m_start..m_end).map {|n|[n, days[count]]}]
    534.       @calendar[month].count.times do |s|
    535.         count = 0 unless count < @week
    536.         count += 1 ; @calendar[month][s+1] = RINOBI::TimeSystem::Days[count]
    537.       end # @calendar[month]count.times do |s|
    538.       month += 1 ; m_end = 0
    539.     end # month <= RINOBI::TimeSystem::Months.count
    540.   end
    541.   #--------------------------------------------------------------------------
    542.   # * New Methods: year, month, day, hour, minute, calendar
    543.   #--------------------------------------------------------------------------
    544.   define_method(:year)   {@year}
    545.   define_method(:month)  {@month}
    546.   define_method(:day)    {@day}
    547.   define_method(:hour)   {@hour}
    548.   define_method(:minute) {@minute}
    549.   define_method(:second) {@second}
    550.   define_method(:weather) {@weather}
    551.   define_method(:calendar) {@calendar}
    552.   define_method(:total_days) {@total_days}
    553.   define_method(:time_scale) {@time_scale}
    554.   define_method(:season) {@season = RINOBI::TimeSystem::Months[month][:Season]}
    555.   #--------------------------------------------------------------------------
    556.   # * New Method: distribute
    557.   #--------------------------------------------------------------------------
    558.   def distribute(begin_value, end_value, array_size, return_ints = false)
    559.     diff = 1.0 * (end_value - begin_value)
    560.     n = [array_size-1, 1].max
    561.     (0..(array_size-1)).map do |i|
    562.       v = begin_value + i * diff / n
    563.       return_ints ? v.round : v
    564.     end
    565.   end # distribute
    566.   #--------------------------------------------------------------------------
    567.   # * New Method: time_process
    568.   #--------------------------------------------------------------------------
    569.   def time_process
    570.     until @frame < RINOBI::TimeSystem::Second_Length
    571.       @frame -= RINOBI::TimeSystem::Second_Length
    572.       add_time("second", 1)
    573.       auto_weather if rand(100.0) < RINOBI::TimeSystem::Second_Weather
    574.     end #- Frames to Seconds
    575.     until second < RINOBI::TimeSystem::Minute_Length
    576.       @second -= RINOBI::TimeSystem::Minute_Length
    577.       add_time("minute", 1)
    578.       auto_weather if rand(100.0) < RINOBI::TimeSystem::Minute_Weather
    579.     end #- Seconds to Minutes
    580.     until minute < RINOBI::TimeSystem::Hour_Length
    581.       @minute -= RINOBI::TimeSystem::Hour_Length
    582.       add_time("hour", 1) ; light_cycle
    583.       auto_weather if rand(100.0) < RINOBI::TimeSystem::Hourly_Weather
    584.     end #- Minutes to Hours
    585.     until hour < RINOBI::TimeSystem::Day_Length
    586.       @hour -= RINOBI::TimeSystem::Day_Length
    587.       add_time("day", 1)
    588.       auto_weather if rand(100.0) < RINOBI::TimeSystem::Daily_Weather
    589.     end #- Hours to Days
    590.     until day <= RINOBI::TimeSystem::Months[month][:Days]
    591.       @day -= RINOBI::TimeSystem::Months[month][:Days]
    592.       add_time("month", 1)
    593.       until month <= RINOBI::TimeSystem::Months.count
    594.         @month -= RINOBI::TimeSystem::Months.count
    595.         add_time("year", 1)
    596.       end #- Months to Years
    597.     end #- Days to Months
    598.     until month <= RINOBI::TimeSystem::Months.count
    599.       @month -= RINOBI::TimeSystem::Months.count
    600.       add_time("year", 1)
    601.     end #- Months to Years
    602.     update_variables
    603.   end # time_process
    604.   #--------------------------------------------------------------------------
    605.   # * New Method: update_variables
    606.   #--------------------------------------------------------------------------
    607.   def update_variables
    608.     ts = RINOBI::TimeSystem
    609.     $game_variables[ts::Var_Season]   = season if ts::Var_Season
    610.     $game_variables[ts::Var_Year]     = year if ts::Var_Year
    611.     $game_variables[ts::Var_Month]    = month if ts::Var_Month
    612.     $game_variables[ts::Var_Day]      = day if ts::Var_Day
    613.     $game_variables[ts::Var_Hour]     = hour if ts::Var_Hour
    614.     $game_variables[ts::Var_Minute]   = minute if ts::Var_Minute
    615.     $game_variables[ts::Var_Second]   = second if ts::Var_Second
    616.     $game_variables[ts::Var_Season_N] = get_season_name if ts::Var_Season_N
    617.     $game_variables[ts::Var_Month_N]  = get_month_name if ts::Var_Month_N
    618.     $game_variables[ts::Var_Day_N]    = get_day_name if ts::Var_Day_N
    619.   end
    620.   #--------------------------------------------------------------------------
    621.   # * New Method: light_cycle
    622.   #--------------------------------------------------------------------------
    623.   def light_cycle
    624.     range = RINOBI::TimeSystem::Day_Cycle
    625.     range.count.times do |r|
    626.       if range[r+1][:Range].include?(hour)
    627.         return tint_level(r+1)
    628.       end
    629.     end
    630.   end # light_cycle
    631.   #--------------------------------------------------------------------------
    632.   # * New Method: tint_level
    633.   #--------------------------------------------------------------------------
    634.   def tint_level(value)
    635.     cycle = RINOBI::TimeSystem::Day_Cycle
    636.     it = RINOBI::TimeSystem::Indoor_Tint
    637.     if indoors?
    638.       return @screen.start_tone_change(Tone.new(it[0],it[1],it[2],it[3]),0)
    639.     end
    640.     tint1 = RINOBI::TimeSystem::Day_Cycle[value][:Tint]
    641.     if value == cycle.count then tint2 = RINOBI::TimeSystem::Day_Cycle[1][:Tint]
    642.     else tint2 = RINOBI::TimeSystem::Day_Cycle[value+1][:Tint] end
    643.     range = RINOBI::TimeSystem::Day_Cycle[value][:Range].to_a
    644.     t = []
    645.     t << distribute(tint1[0], tint2[0], range.count, true)
    646.     t << distribute(tint1[1], tint2[1], range.count, true)
    647.     t << distribute(tint1[2], tint2[2], range.count, true)
    648.     t << distribute(tint1[3], tint2[3], range.count, true)
    649.     r = range.index(hour)
    650.     i = RINOBI::TimeSystem::Tint_Interval
    651.     i = 0 if $game_player.transferring
    652.     screen.start_tone_change(Tone.new(t[0][r],t[1][r],t[2][r],t[3][r]),i)
    653.   end # tint_level
    654.   #--------------------------------------------------------------------------
    655.   # * New Method: auto_weather
    656.   #--------------------------------------------------------------------------
    657.   def auto_weather
    658.     weather = []
    659.     RINOBI::TimeSystem::Seasons[season][:Weathers].keys.each do |s|
    660.       RINOBI::TimeSystem::Seasons[season][:Weathers][s][:Weight].times do
    661.         index = RINOBI::TimeSystem::Seasons[season][:Weathers].keys.index(s)
    662.         weather << RINOBI::TimeSystem::Seasons[season][:Weathers].keys[index]
    663.       end #---
    664.     end #--
    665.     set_weather(weather.sample)
    666.   end # auto_weather
    667.   #--------------------------------------------------------------------------
    668.   # * New Method: calculate_date
    669.   #--------------------------------------------------------------------------
    670.   def calculate_date(value)
    671.     ts = RINOBI::TimeSystem
    672.     ts_current_month = ts::Months[month][:Days]
    673.     until value[5] < ts::Second_Length
    674.       value[5] -= ts::Second_Length
    675.       value[4] += 1
    676.     end
    677.     until value[4] < ts::Minute_Length
    678.       value[4] -= ts::Minute_Length
    679.       value[3] += 1
    680.     end
    681.     until value[3] < ts::Hour_Length
    682.       value[3] -= ts::Hour_Length
    683.       value[2] += 1
    684.     end
    685.     until value[2] < ts::Day_Length
    686.       value[2] -= ts::Day_Length
    687.       value[1] += 1
    688.     end
    689.     until value[1] < ts_current_month
    690.       value[1] -= ts_current_month
    691.       value[0] += 1
    692.     end
    693.     return value
    694.   end
    695.   #--------------------------------------------------------------------------
    696.   # * New Method: set_weather
    697.   #--------------------------------------------------------------------------
    698.   def set_weather(value, fast = false)
    699.     @weather = value
    700.     if indoors?
    701.       type = RINOBI::TimeSystem::Weathers[0][:Type]
    702.       power = RINOBI::TimeSystem::Weathers[0][:Power]
    703.       duration = RINOBI::TimeSystem::Weathers[0][:Duration]
    704.       screen.change_weather(type, power, duration)
    705.     else
    706.       type = RINOBI::TimeSystem::Weathers[value][:Type]
    707.       power = RINOBI::TimeSystem::Weathers[value][:Power]
    708.       if fast then duration = 0
    709.       else duration = RINOBI::TimeSystem::Weathers[value][:Duration] end
    710.       screen.change_weather(type, power, duration)
    711.     end
    712.   end # set_weather
    713.   #--------------------------------------------------------------------------
    714.   # * New Method: set_time
    715.   #--------------------------------------------------------------------------
    716.   def set_time(key, value)
    717.     return unless instance_variable_defined?(("@" + key).intern)
    718.     instance_variable_set(("@" + key).intern, value)
    719.   end # set_time
    720.   #--------------------------------------------------------------------------
    721.   # * New Method: add_time
    722.   #--------------------------------------------------------------------------
    723.   def add_time(key, value)
    724.     return unless instance_variable_defined?(("@" + key).intern)
    725.     current = instance_variable_get(("@" + key).intern)
    726.     instance_variable_set(("@" + key).intern, current + value)
    727.   end # add_time
    728.   #--------------------------------------------------------------------------
    729.   # * New Method: get_time
    730.   #--------------------------------------------------------------------------
    731.   def get_time(key)
    732.     return unless instance_variable_defined?(("@" + key).intern)
    733.     return instance_variable_get(("@" + key).intern)
    734.   end # get_time
    735.   #--------------------------------------------------------------------------
    736.   # * New Method: get week day
    737.   #--------------------------------------------------------------------------
    738.   def get_day_name(day = @day, month = @month)
    739.     calendar[month][day]
    740.   end # get_week_day
    741.   #--------------------------------------------------------------------------
    742.   # * New Method: get_month_name
    743.   #--------------------------------------------------------------------------
    744.   def get_month_name(month = @month)
    745.     RINOBI::TimeSystem::Months[month][:Name]
    746.   end # get_month_name
    747.   #--------------------------------------------------------------------------
    748.   # * New Method: get_season_name (necessary?)
    749.   #--------------------------------------------------------------------------
    750.   def get_season_name
    751.     seasons = RINOBI::TimeSystem::Seasons ; months = RINOBI::TimeSystem::Months
    752.     return seasons[months[get_time('month')][:Season]][:Name]
    753.   end # get_season
    754.   #--------------------------------------------------------------------------
    755.   # * New Method: set_due_date
    756.   # >> year, month, day, hour, minute, second
    757.   # >> set_due_date('dinner', year, month, day, 20, 30)
    758.   #--------------------------------------------------------------------------
    759.   def set_due_date(name, *date)
    760.     @dates_hash[name] = date
    761.   end
    762.   #--------------------------------------------------------------------------
    763.   # * New Method: add_due_date
    764.   # >> Adjusts date automatically
    765.   # >> add_due_date('holliday', :months, 2, 10)
    766.   #--------------------------------------------------------------------------
    767.   def add_due_date(name, key, *value)
    768.     case key
    769.     when :months  then value.insert(0, 0)
    770.     when :days    then value.insert(0, 0, 0) ; print value
    771.     when :hours   then value.insert(0, 0, 0, 0)
    772.     when :minutes then value.insert(0, 0, 0, 0, 0)
    773.     when :seconds then value.insert(0, 0, 0, 0, 0, 0)
    774.     end
    775.     value.push(0) until value.size > 6
    776.     set_due_date(name, calculate_date(value))
    777.   end
    778.   #--------------------------------------------------------------------------
    779.   # * New Method: get_due_date
    780.   # >> year, month, day, hour, minute, second
    781.   #--------------------------------------------------------------------------
    782.   def get_due_date(name)
    783.     @dates_hash[name]
    784.   end
    785.   #--------------------------------------------------------------------------
    786.   # * New Method: due_date (testing)
    787.   #--------------------------------------------------------------------------
    788.   def due_date?(name)
    789.     return unless @dates_hash
    790.     array = @dates_hash[name]
    791.     return true if year > array[0]
    792.     return true if year   == array[0] && month  > array[1]
    793.     return true if month  == array[1] && day    > array[2]
    794.     return true if day    == array[2] && hour   > array[3]
    795.     return true if hour   == array[3] && minute > array[4]
    796.     return true if minute == array[4] && second > array[5]
    797.     return false
    798.   end # due_date?
    799.   #--------------------------------------------------------------------------
    800.   # * New Method: freeze_time
    801.   #--------------------------------------------------------------------------
    802.   def time_freeze
    803.     @time_freeze ? @time_freeze = false : @time_freeze = true
    804.   end # freeze_time
    805.   #--------------------------------------------------------------------------
    806.   # * New Method: time_frozen?
    807.   #--------------------------------------------------------------------------
    808.   def time_frozen?
    809.     return @time_freeze
    810.   end # time_frozen?
    811.   #--------------------------------------------------------------------------
    812.   # * New Method: indoors?
    813.   #--------------------------------------------------------------------------
    814.   def indoors?
    815.     return true if RINOBI::TimeSystem::Indoor_Maps.include?(map_id)
    816.     return true if RINOBI::TimeSystem::Indoor_Tiles.include?(tileset.id)
    817.     return false
    818.   end # indoors?
    819.   #--------------------------------------------------------------------------
    820.   # * Alias Method: update_events
    821.   #--------------------------------------------------------------------------
    822.   def update_events
    823.     time_update_events
    824.     @frame += time_scale unless time_frozen?
    825.     time_process
    826.   end
    827. end # Game_Map
    828. #==============================================================================
    829. # ** Game_Player
    830. #------------------------------------------------------------------------------
    831. #  This class handles the player. It includes event starting determinants and
    832. # map scrolling functions. The instance of this class is referenced by
    833. # $game_player.
    834. #==============================================================================
    835. class Game_Player < Game_Character
    836.   attr_reader :transferring
    837. end # Game_Player
    838. #==============================================================================
    839. # ** Game_Interpreter
    840. #------------------------------------------------------------------------------
    841. #  An interpreter for executing event commands. This class is used within the
    842. # Game_Map, Game_Troop, and Game_Event classes.
    843. #==============================================================================
    844. class Game_Interpreter
    845.   #--------------------------------------------------------------------------
    846.   # * Public Instance Variables
    847.   #--------------------------------------------------------------------------
    848.   attr_reader     :year
    849.   attr_reader     :month
    850.   attr_reader     :day
    851.   attr_reader     :hour
    852.   attr_reader     :minute
    853.   attr_reader     :second
    854.   attr_reader     :season
    855.   attr_reader     :weather
    856.   attr_reader     :time_scale
    857.   #--------------------------------------------------------------------------
    858.   # * Simple Methods
    859.   #--------------------------------------------------------------------------
    860.   define_method(:year)        {$game_map.year      }
    861.   define_method(:month)       {$game_map.month     }
    862.   define_method(:day)         {$game_map.day       }
    863.   define_method(:hour)        {$game_map.hour      }
    864.   define_method(:minute)      {$game_map.minute    }
    865.   define_method(:second)      {$game_map.second    }
    866.   define_method(:season)      {$game_map.season    }
    867.   define_method(:weather)     {$game_map.weather   }
    868.   define_method(:time_scale)  {$game_map.time_scale}
    869.   #--------------------------------------------------------------------------
    870.   # * Set Weather
    871.   #--------------------------------------------------------------------------
    872.   def set_weather(value, fast = false)
    873.     $game_map.set_weather(value, fast)
    874.   end
    875.   #--------------------------------------------------------------------------
    876.   # * Set Time
    877.   #--------------------------------------------------------------------------
    878.   def set_time(key, value)
    879.     $game_map.set_time(key, value)
    880.   end
    881.   #--------------------------------------------------------------------------
    882.   # * Add Time
    883.   #--------------------------------------------------------------------------
    884.   def add_time(key, value)
    885.     $game_map.add_time(key, value)
    886.   end
    887.   #--------------------------------------------------------------------------
    888.   # * Get Time
    889.   #--------------------------------------------------------------------------
    890.   def get_time(key)
    891.     $game_map.get_time(key)
    892.   end
    893.   #--------------------------------------------------------------------------
    894.   # * Get Day Name
    895.   #--------------------------------------------------------------------------
    896.   def get_day_name(day = $game_map.day, month = $game_map.month)
    897.     $game_map.get_day_name(day, month)
    898.   end
    899.   #--------------------------------------------------------------------------
    900.   # * Get Month Name
    901.   #--------------------------------------------------------------------------
    902.   def get_month_name(month = @month)
    903.     RINOBI::TimeSystem::Months[month][:Name]
    904.   end
    905.   #--------------------------------------------------------------------------
    906.   # * Set Time Scale
    907.   #--------------------------------------------------------------------------
    908.   def set_time_scale(value)
    909.     $game_map.time_scale = value
    910.   end
    911.   #--------------------------------------------------------------------------
    912.   # * Time Freeze
    913.   #--------------------------------------------------------------------------
    914.   def time_freeze
    915.     if $game_map.time_frozen?
    916.       $game_map.time_freeze = false
    917.     else
    918.       $game_map.time_freeze = true
    919.     end
    920.   end
    921.   #--------------------------------------------------------------------------
    922.   # * Set Due Date
    923.   #--------------------------------------------------------------------------
    924.   def set_due_date(name, *date)
    925.     $game_map.set_due_date(name, *date)
    926.   end
    927.   #--------------------------------------------------------------------------
    928.   # * Add Due Date
    929.   #--------------------------------------------------------------------------
    930.   def add_due_date(name, key, *value)
    931.     $game_map.add_due_date(name, key, *value)
    932.   end
    933.   #--------------------------------------------------------------------------
    934.   # * Get Due Date
    935.   #--------------------------------------------------------------------------
    936.   def get_due_date(name)
    937.     $game_map.get_due_date(name)
    938.   end
    939.   #--------------------------------------------------------------------------
    940.   # * Check Due Date
    941.   #--------------------------------------------------------------------------
    942.   def due_date?(name)
    943.     $game_map.due_date?(name)
    944.   end
    945.   #--------------------------------------------------------------------------
    946.   # * Indoors?
    947.   #--------------------------------------------------------------------------
    948.   def indoors?
    949.     $game_map.indoors?
    950.   end
    951. end
    952. #==============================================================================
    953. # ** Spriteset_Weather
    954. #------------------------------------------------------------------------------
    955. #  A class for weather effects (rain, storm, and snow). It is used within the
    956. # Spriteset_Map class.
    957. #==============================================================================
    958. class Spriteset_Weather
    959.   #--------------------------------------------------------------------------
    960.   # * Alias Method: Update Sprite [Storm]
    961.   #--------------------------------------------------------------------------
    962.   alias :time_update_storm :update_sprite_storm
    963.   def update_sprite_storm(sprite)
    964.     time_update_storm(sprite)
    965.     return unless rand((RINOBI::TimeSystem::Frequency * 10000.0) / @power) < 1
    966.     total = RINOBI::TimeSystem::SE_Thunder.count
    967.     selection = 1 + rand(total - 1)
    968.     red     = RINOBI::TimeSystem::Flash_Lightning[0]
    969.     green   = RINOBI::TimeSystem::Flash_Lightning[1]
    970.     blue    = RINOBI::TimeSystem::Flash_Lightning[2]
    971.     opacity = RINOBI::TimeSystem::Flash_Lightning[3]
    972.     frames  = RINOBI::TimeSystem::Flash_Lightning[4]
    973.     file   = RINOBI::TimeSystem::SE_Thunder[selection][:File]
    974.     volume = RINOBI::TimeSystem::SE_Thunder[selection][:Volume]
    975.     pitch  = RINOBI::TimeSystem::SE_Thunder[selection][:Pitch]
    976.     $game_map.screen.start_flash(Color.new(red,green,blue,opacity),frames)
    977.     RPG::SE.new(file, volume, pitch).play
    978.   end # update_sprite_storm
    979. end # Spriteset_Weather
    980. #==============================================================================
    981. # ** Class: Time Window Option 1
    982. #==============================================================================
    983. class Time_Window1 < Window_Base
    984.   #--------------------------------------------------------------------------
    985.   # * New Method: Initialize
    986.   #--------------------------------------------------------------------------
    987.   def initialize
    988.     window_x = RINOBI::TimeSystem::Window_X
    989.     window_y = RINOBI::TimeSystem::Window_Y
    990.     super(window_x, window_y, window_width, fitting_height(2))
    991.     self.openness = 255
    992.     self.opacity = 255
    993.     refresh
    994.   end # initialize
    995.   #--------------------------------------------------------------------------
    996.   # * New Method: Window Width
    997.   #--------------------------------------------------------------------------
    998.   def window_width
    999.     return 276
    1000.   end # window_width
    1001.   #--------------------------------------------------------------------------
    1002.   # * New Method: Refresh
    1003.   #--------------------------------------------------------------------------
    1004.   def refresh
    1005.     contents.clear
    1006.     change_color(text_color(0))
    1007.     season = $game_map.get_season_name
    1008.     year = $game_map.get_time('year')
    1009.     month_integer = $game_map.get_time('month')
    1010.     month_string = RINOBI::TimeSystem::Months[$game_map.get_time('month')][:Name]
    1011.     day_integer = $game_map.get_time('day')
    1012.     day_string = $game_map.calendar[month_integer][day_integer]
    1013.     hour = $game_map.get_time('hour')
    1014.     minute = sprintf("%02d", $game_map.get_time('minute'))
    1015.     apm = '' ; if hour > 11 then apm = 'PM' else apm = 'AM' end
    1016.     if hour < 1  then hour += 12 end ; if hour > 12 then hour -= 12 end
    1017.     hour = sprintf("%02d", hour)
    1018.     line1 = "#{month_string} #{day_integer}, #{year}[#{season}]"
    1019.     line2 = "#{day_string}, #{hour}:#{minute}#{apm}"
    1020.     draw_text(0, 0, contents.width, line_height, line1)
    1021.     draw_text(0, 0, contents.width, fitting_height(2), line2)
    1022.   end # refresh
    1023. end # Time_Window1 < Window_Base
    1024. #==============================================================================
    1025. # ** Class: Time Window Option 2
    1026. #==============================================================================
    1027. class Time_Window2 < Window_Base
    1028.   #--------------------------------------------------------------------------
    1029.   # * New Method: Initialize
    1030.   #--------------------------------------------------------------------------
    1031.   def initialize
    1032.     window_x = RINOBI::TimeSystem::Window_X
    1033.     window_y = RINOBI::TimeSystem::Window_Y
    1034.     super(window_x, window_y, window_width, fitting_height(1))
    1035.     self.openness = 255
    1036.     self.opacity = 255
    1037.     refresh
    1038.   end # initialize
    1039.   #--------------------------------------------------------------------------
    1040.   # * New Method: Window Width
    1041.   #--------------------------------------------------------------------------
    1042.   def window_width
    1043.     return 186
    1044.   end # window_width
    1045.   #--------------------------------------------------------------------------
    1046.   # * New Method: Refresh
    1047.   #--------------------------------------------------------------------------
    1048.   def refresh
    1049.     contents.clear
    1050.     change_color(text_color(0))
    1051.     month_integer = $game_map.get_time('month')
    1052.     day_integer = $game_map.get_time('day')
    1053.     day_string = $game_map.calendar[month_integer][day_integer]
    1054.     hour = $game_map.get_time('hour')
    1055.     minute = sprintf("%02d", $game_map.get_time('minute'))
    1056.     apm = '' ; if hour > 11 then apm = 'PM' else apm = 'AM' end
    1057.     if hour < 1  then hour += 12 end ; if hour > 12 then hour -= 12 end
    1058.     hour = sprintf("%02d", hour)
    1059.     line1 = "#{day_string}, #{hour}:#{minute}#{apm}"
    1060.     draw_text(0, 0, contents.width, line_height, line1)
    1061.   end # refresh
    1062. end # Time_Window2 < Window_Base
    1063. #==============================================================================
    1064. # ** Class: Time Window Option 3
    1065. #==============================================================================
    1066. class Time_Window3 < Window_Base
    1067.   #--------------------------------------------------------------------------
    1068.   # * New Method: Initialize
    1069.   #--------------------------------------------------------------------------
    1070.   def initialize
    1071.     window_x = RINOBI::TimeSystem::Window_X
    1072.     window_y = RINOBI::TimeSystem::Window_Y
    1073.     super(window_x, window_y, window_width, fitting_height(1))
    1074.     self.openness = 255
    1075.     self.opacity = 255
    1076.     refresh
    1077.   end # initialize
    1078.   #--------------------------------------------------------------------------
    1079.   # * New Method: Window Width
    1080.   #--------------------------------------------------------------------------
    1081.   def window_width
    1082.     return 276
    1083.   end # window_width
    1084.   #--------------------------------------------------------------------------
    1085.   # * New Method: Refresh
    1086.   #--------------------------------------------------------------------------
    1087.   def refresh
    1088.     contents.clear
    1089.     change_color(text_color(0))
    1090.     season = $game_map.get_season_name
    1091.     year = $game_map.get_time('year')
    1092.     month_integer = $game_map.get_time('month')
    1093.     month_string = RINOBI::TimeSystem::Months[$game_map.get_time('month')][:Name]
    1094.     day_integer = $game_map.get_time('day')
    1095.     line1 = "#{month_string} #{day_integer}, #{year}[#{season}]"
    1096.     draw_text(0, 0, contents.width, line_height, line1)
    1097.   end # refresh
    1098. end # Time_Window3 < Window_Base
    1099. #==============================================================================
    1100. # ** Scene_Map
    1101. #------------------------------------------------------------------------------
    1102. #  This class performs the map screen processing.
    1103. #==============================================================================
    1104. class Scene_Map < Scene_Base
    1105.   #--------------------------------------------------------------------------
    1106.   # * Alias Method: Create Spriteset
    1107.   #--------------------------------------------------------------------------
    1108.   alias :time_spriteset :create_spriteset
    1109.   def create_spriteset
    1110.     time_spriteset
    1111.     create_time_hud if RINOBI::TimeSystem::Display_Toggle
    1112.   end # create_spriteset
    1113.   #--------------------------------------------------------------------------
    1114.   # * New Method: Create Intial HUD Display
    1115.   #--------------------------------------------------------------------------
    1116.   def create_time_hud
    1117.     @time_hud = Time_Window1.new
    1118.     $game_switches[RINOBI::TimeSystem::Display_Switch] = true
    1119.   end # create_time_hud
    1120.   #--------------------------------------------------------------------------
    1121.   # * New Method: Toggle Time HUD Display
    1122.   #--------------------------------------------------------------------------
    1123.   def time_hud_toggle
    1124.     if Input.trigger?(RINOBI::TimeSystem::Display_Key)
    1125.       $game_switches[RINOBI::TimeSystem::Display_Switch] ^= true
    1126.     end
    1127.   end # time_hud_toggle
    1128.   #--------------------------------------------------------------------------
    1129.   # * New Method: Toggle Time Type Display
    1130.   #--------------------------------------------------------------------------
    1131.   def time_type_toggle
    1132.     if Input.trigger?(RINOBI::TimeSystem::Toggle_Key)
    1133.       $game_variables[RINOBI::TimeSystem::Toggle_Variable] += 1
    1134.       if $game_variables[RINOBI::TimeSystem::Toggle_Variable] > 2
    1135.         $game_variables[RINOBI::TimeSystem::Toggle_Variable] = 0
    1136.       end
    1137.       adjust_time_window
    1138.     end
    1139.   end # time_type_toggle
    1140.   #--------------------------------------------------------------------------
    1141.   # * New Method: Adjust Time Window
    1142.   #--------------------------------------------------------------------------
    1143.   def adjust_time_window
    1144.     case $game_variables[RINOBI::TimeSystem::Toggle_Variable]
    1145.     when 0 then @time_hud = Time_Window1.new
    1146.     when 1 then @time_hud = Time_Window2.new
    1147.     when 2 then @time_hud = Time_Window3.new
    1148.     end
    1149.     @time_hud.refresh
    1150.   end # adjust_time_window
    1151.   #--------------------------------------------------------------------------
    1152.   # * New Method: Close Time Window
    1153.   #--------------------------------------------------------------------------
    1154.   def close_time_window
    1155.     return if $game_switches[RINOBI::TimeSystem::Display_Switch]
    1156.     @time_hud.close
    1157.   end # close_time_window
    1158.   #--------------------------------------------------------------------------
    1159.   # * New Method: Open Time Window
    1160.   #--------------------------------------------------------------------------
    1161.   def open_time_window
    1162.     return unless $game_switches[RINOBI::TimeSystem::Display_Switch]
    1163.     @time_hud.open
    1164.   end # open_time_window
    1165.   #--------------------------------------------------------------------------
    1166.   # * Alias Method: Update
    1167.   #--------------------------------------------------------------------------
    1168.   alias :time_hud_update :update
    1169.   def update
    1170.     time_hud_update
    1171.     return unless RINOBI::TimeSystem::Display_Toggle
    1172.     time_hud_toggle
    1173.     time_type_toggle
    1174.     close_time_window
    1175.     open_time_window
    1176.     return unless @track != $game_map.minute
    1177.     @time_hud.refresh
    1178.     @track = $game_map.minute
    1179.   end # update
    1180. end # Scene_Map < Scene_Base
    复制代码

    Spoiler: DOWNLOADSSpoiler: PLANNING

    • Redesign UI. It was originally designed for testing.
    • Update calendar generation. It's a mess.
    • Create calendar display. The data is there already.
    • Design a demo making use of script calls.


    本贴来自国际rpgmaker官方论坛作者:Rinobi处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/yet-another-time-system.75564/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-9-30 14:02 , Processed in 0.148988 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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