Код:
	#====================================================================
# : Window_PlayTime
#------------------------------------------------------------------------------
#  Это окно показывает игорвое время в экране меню
#====================================================================
class Window_GameTime < Window_Base
    attr_reader   :year
    attr_reader   :month
    attr_reader   :day
    attr_reader   :hour
    attr_reader   :min
    attr_reader   :startsec
    Graphics.frame_rate = 60
    $tspeed  = 1            # от 1 - до 60  1- медленно 60 - быстро
    $year    = 2013         # Стартовый год игры
    $month   = 07           # Стартовый месяц игры
    $day     = 17           # Стартовый день игры
    $hour    = 20           # Стартовый час игры
    $min     = 15           # Стартовая минута игры
    $startsec = 0
  #--------------------------------------------------------------------------
  # * Инициализация объектов
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, fitting_height(2))
    @month = ["Января", "Февраля", "Марта", "Апреля", "Мая", "Июня",
              "Июля","Августа","Сентября","Октября","Ноября","Декабря"]
    # Стартовая дата (Год, Месяц, День, Час, Минута)
    date_start($year, $month, $day, $hour, $min)
    # Лимиты (Месяцев в году, Дней в месяце, Часов в дне, Минут в часе, Секунд в минуте)
    
    # Если не установлено то (12, 30,  24, 60, 60)
    date_limit()
    if $tspeed > 60 
      $tspeed = 60
    elsif $tspeed < 1
      $tspeed = 1
    end
    errors          
  end
  #--------------------------------------------------------------------------
  # * Стартовая дата при запуске игры
  #--------------------------------------------------------------------------  
  def date_start(year, mon, day, hour, min)
    @year = year
    @mon  = mon
    @mday = day
    @hour = hour
    @min  = min
  end
  #--------------------------------------------------------------------------
  # * Димиты временных данных
  #--------------------------------------------------------------------------  
  def date_limit(mon = 12, day = 30, hour = 24, min = 60, sec =60)
    @my = mon
    @dm = day
    @hd = hour
    @mh = min
    @sm = sec / $tspeed
  end
  #--------------------------------------------------------------------------
  # * Получение длинны окна
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Обработка возможных ошибок
  # В случае если введенное значение больше допустимого, 
  # программа самостоятельно исправит ошибку.
  #--------------------------------------------------------------------------
  def errors
    if @min >= @mh        # Проверка стартовой минуты
      @hour += @min / @mh
      @min = @min % @mh
    end
    if @hour >= @hd       # Проверка стартового часа
      @mday += @hour / @hd
      @hour = @hour % @hd
    end
    if @mday > @dm        # Проверка стартового дня
      @mon += @mday / @dm
      @mday = @mday % @dm
    end
    if @mon > @my         # Проверка ставтового месяца
      @year += @mon / @my
      @mon = @mon % @my
    end
  end
  #--------------------------------------------------------------------------
  # * Обновление
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @total_sec = Graphics.frame_count / (Graphics.frame_rate / 60) - $startsec
    year    = @total_sec / @sm / @mh / @hd / @dm / @my + @year.to_f
    mon     = @total_sec / @sm / @mh / @hd / @dm % @my + @mon.to_f 
    mday    = @total_sec / @sm / @mh / @hd % @dm + @mday.to_f
    hour    = @total_sec / @sm / @mh % @hd + @hour.to_f
    min     = @total_sec / @sm % @mh + @min.to_f
    sec     = @total_sec % @sm
    if min.to_i >= @mh
      hour += min.to_i / @mh
      min = min.to_i % @mh
    end
    if hour.to_i >= @hd
      mday += hour.to_i / @hd
      hour = hour.to_i % @hd
    end
    if mday.to_i > @dm
      mon += mday.to_i / @dm
      mday = mday.to_i % @dm
    end
    if mon.to_i > @my
      year += mon.to_i / @my
      mon = mon.to_i % @my
    end
    month_name = @month[mon.to_i-1]
    change_color(normal_color)
    self.contents.font.size = 28
    text = sprintf("%02d:%02d", hour, min)
    draw_text(4, 0 , width, line_height, text, 1)
    change_color(system_color)
    self.contents.font.size = 16
    self.contents.font.bold = true
    text = sprintf("%02d %02s %04d", mday, month_name, year)
    draw_text(4, 0 + 24 , width - 16 , line_height , text, 1)
  end
  #--------------------------------------------------------------------------
  # * Открытие Окна
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
  #--------------------------------------------------------------------------
  # * Дополнение
  #--------------------------------------------------------------------------
  def update
    super
    if Graphics.frame_count / (Graphics.frame_rate / 60)- $startsec != @total_sec
      refresh
    end
  end
end
#====================================================================
# ** DataManager
#====================================================================
module DataManager
  #--------------------------------------------------------------------------
  # * Создать содержание сохранения
  #--------------------------------------------------------------------------
  def self.make_save_contents
    contents = {}
    contents[:system]         = $game_system
    contents[:timer]          = $game_timer
    contents[:message]        = $game_message
    contents[:switches]       = $game_switches
    contents[:variables]      = $game_variables
    contents[:self_switches]  = $game_self_switches
    contents[:actors]         = $game_actors
    contents[:party]          = $game_party
    contents[:troop]          = $game_troop
    contents[:map]            = $game_map
    contents[:player]         = $game_player
    # Переменные даты
    contents[:year]           = $year
    contents[:month]          = $month 
    contents[:day]            = $day
    contents[:hour]           = $hour
    contents[:min]            = $min
    contents[:startsec]       = $startsec
    # Переменные даты
    contents
  end
  #--------------------------------------------------------------------------
  # * Извлечь содержание созранения
  #--------------------------------------------------------------------------
  def self.extract_save_contents(contents)
    $game_system        = contents[:system]
    $game_timer         = contents[:timer]
    $game_message       = contents[:message]
    $game_switches      = contents[:switches]
    $game_variables     = contents[:variables]
    $game_self_switches = contents[:self_switches]
    $game_actors        = contents[:actors]
    $game_party         = contents[:party]
    $game_troop         = contents[:troop]
    $game_map           = contents[:map]
    $game_player        = contents[:player]
    # Переменные даты
    $year               = contents[:year]
    $month              = contents[:month]
    $day                = contents[:day]
    $hour               = contents[:hour]
    $min                = contents[:min]
    $startsec           = contents[:startsec]
    # Переменные даты
  end
end
#====================================================================
# ** Game_Interpreter
#====================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Изменение стартовой даты
  #--------------------------------------------------------------------------
  def date_change (year, mon, day, hour, min)
    $year    = year.to_i
    $month   = mon.to_i
    $day     = day.to_i
    $hour    = hour.to_i
    $min     = min.to_i
    $startsec = Graphics.frame_count / (Graphics.frame_rate / 60)
  end
end
#====================================================================
# ** Scene_Menu
#====================================================================
class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Процес Запуска
  #--------------------------------------------------------------------------
  def start
    super
    create_command_window
    create_gold_window
    create_status_window
    create_gametime_window
  end
  #--------------------------------------------------------------------------
  # * Create PlayTime Window
  #--------------------------------------------------------------------------
  def create_gametime_window
    @gametime_window = Window_GameTime.new
    @gametime_window.x = 0
    @gametime_window.y = Graphics.height - @gold_window.height - @gametime_window.height
  end
end
 
Социальные закладки