Код:
=begin
###############################################################################
# #
# Аддон к Extended Settings #
# #
###############################################################################
Автор: Денис Кузнецов (http://vk.com/id8137201)
Группа ВК: https://vk.com/scriptsrpgmakervxace
Зависимости:
Game Time (Время/Дата) by Denis Kyznetsov (версия 6.0)
Extended_Settings (Глобальные настройки) by Denis Kyznetsov (версия 2.0)
Необязательная зависимость: Game Weather (Погода) by Denis Kyznetsov (версия 3.0)
Установка: разместить ниже зависимостей
У данного скрипта нет никаких настроек. Установите и используйте.
=end
$Extended_Settings_Command_List.push({ :command_name => "Время/Дата", :command_symbol => :den_kyz_game_time_settings_command_symbol,
:method => :den_kyz_game_time_extended_settings_method, :enabled => true, :author => "Денис Кузнецов", :version => "2.0", :date => "17.10.15",
:description => "Настройка скрипта Время/Дата и\nПогода для VX ACE" })
module Game_Time_Extended_Settings
MAIN_COMMAND_LIST = ["Время/Дата", "Погода"]
GAME_TIME_COMMAND_LIST = ["Время", "Дата", "Освещение", "Скорость времени", "Обновление времени"]
GAME_WEATHER_COMMAND_LIST = ["Изменить погоду", "Остановить погоду", "Лимит погоды", "Сила погоды", "Погода в бою"]
GAME_TIME_CLOCK = {
:x => Graphics.width * 2 / 5,
:y => 0,
:width => Graphics.width * 3 / 5,
:height => 72,
:custom_clock_time => ["Час", ":", "Минуты"]
}
end # module Game_Time_Extended_Settings
class Extended_Settings_Scene < Scene_Base
def den_kyz_game_time_extended_settings_method
SceneManager.call(Game_Time_Extended_Settings_Scene) if $imported["DenKyz_Game_Time"]
end
end # class Extended_Settings_Scene < Scene_Base
class Game_Time_Extended_Settings_Scene < Scene_Base
include Game_Time_Settings
def start
super
create_main_command_window
create_info_window
create_control_command_window
create_game_time_window
end
def create_main_command_window
@create_main_command_window = Game_Time_Extended_Settings_Main_Command_Window.new
@create_main_command_window.set_handler(:cancel, method(:return_scene))
@create_main_command_window.set_handler(:ok, method(:activate_control_window))
end
def create_info_window
dispose_info_window
@create_info_window = Game_Time_Extended_Settings_Info_Window.new(@create_main_command_window)
end
def create_control_command_window
@create_control_command_window = Game_Time_Extended_Settings_Control_Command_Window.new(@create_main_command_window)
@create_control_command_window.deactivate
@create_control_command_window.set_handler(:cancel, method(:deactivate_control_window))
@create_control_command_window.set_handler(:ok, method(:activate_process_window))
end
def create_process_command_window
dispose_process_command_window
@create_process_command_window = Game_Time_Extended_Settings_Process_Command_Window.new(@create_main_command_window, @create_control_command_window)
@create_process_command_window.set_handler(:cancel, method(:deactivate_process_command_window))
@create_process_command_window.set_handler(:change_game_time, method(:change_game_time))
@create_process_command_window.set_handler(:change_game_date, method(:change_game_date))
@create_process_command_window.set_handler(:use_khas_day_light, method(:change_use_khas_day_light))
@create_process_command_window.set_handler(:static_light_hour, method(:change_static_light_hour))
@create_process_command_window.set_handler(:time_speed, method(:change_time_speed))
@create_process_command_window.set_handler(:time_update, method(:change_time_update))
@create_process_command_window.set_handler(:change_game_weather_type, method(:change_game_weather_type))
@create_process_command_window.set_handler(:stop_game_weather, method(:stop_game_weather))
@create_process_command_window.set_handler(:change_game_weather_limit, method(:change_game_weather_limit))
@create_process_command_window.set_handler(:change_game_weather_power, method(:change_game_weather_power))
@create_process_command_window.set_handler(:change_game_weather_in_battle, method(:change_game_weather_in_battle))
end
def create_game_time_window
@create_game_time_window = Game_Time_Window.new(Game_Time_Extended_Settings::GAME_TIME_CLOCK)
end
def activate_control_window
@create_main_command_window.deactivate
@create_control_command_window.activate
end
def deactivate_control_window
@create_main_command_window.activate
@create_control_command_window.select(0)
@create_control_command_window.deactivate
end
def activate_process_window
dispose_info_window
@create_control_command_window.deactivate
create_process_command_window
end
def deactivate_process_command_window
if @create_process_command_window.layer == 0
@create_control_command_window.activate
create_info_window
dispose_process_command_window
else
@create_process_command_window.layer = 0
end
end
def dispose_info_window
return if @create_info_window.nil?
@create_info_window.dispose
@create_info_window = nil
end
def dispose_process_command_window
return if @create_process_command_window.nil?
@create_process_command_window.dispose
@create_process_command_window = nil
end
def change_game_time
sec = @create_process_command_window.sec
min = @create_process_command_window.min
hour = @create_process_command_window.hour
day = $Game_Time.day
dayweek = $Game_Time.dayweek + 1
month = $Game_Time.month + 1
year = $Game_Time.year
$Game_Time.set_time(sec, min, hour, day, dayweek, month, year)
deactivate_process_command_window
end
def change_game_date
sec = $Game_Time.sec
min = $Game_Time.min
hour = $Game_Time.hour
day = @create_process_command_window.day
dayweek = @create_process_command_window.dayweek + 1
month = @create_process_command_window.month + 1
year = @create_process_command_window.year
$Game_Time.set_time(sec, min, hour, day, dayweek, month, year)
deactivate_process_command_window
end
def change_use_khas_day_light
Game_Time_Functions.setup_use_khas_day_light(@create_process_command_window.use_khas_day_light)
@create_process_command_window.layer = 1
end
def change_static_light_hour
$Game_Time_Tint.static_light_hour = @create_process_command_window.static_light_hour
deactivate_process_command_window
deactivate_process_command_window if GAME_TIME_KHAS_LIGHT && GAME_TIME_KHAS_LIGHT_SWITCH != -1
end
def change_time_speed
$Game_Time.time_speed = @create_process_command_window.time_speed
deactivate_process_command_window
end
def change_time_update
$Game_Time.time_update = @create_process_command_window.time_update
deactivate_process_command_window
end
def change_game_weather_type
$Game_Weather.weather[@create_process_command_window.game_weather_cursor].type = @create_process_command_window.game_weather_type
deactivate_process_command_window
end
def stop_game_weather
$Game_Weather.dispose_weather($Game_Weather.weather[@create_process_command_window.game_weather_cursor])
deactivate_process_command_window
end
def change_game_weather_limit
$GAME_WEATHER_LIMIT = @create_process_command_window.game_weather_limit
deactivate_process_command_window
end
def change_game_weather_power
$GAME_WEATHER_POWER = @create_process_command_window.game_weather_power
deactivate_process_command_window
end
def change_game_weather_in_battle
$GAME_WEATHER_IN_BATTLE = @create_process_command_window.game_weather_in_battle
deactivate_process_command_window
end
end # class Game_Time_Extended_Settings_Scene < Scene_Base
class Game_Time_Extended_Settings_Main_Command_Window < Window_Command
include Game_Time_Extended_Settings
def initialize
super(0, 0)
end
def window_width
Graphics.width * 2 / 5
end
def window_height
line_height * 3
end
def make_command_list
MAIN_COMMAND_LIST.each do |index|
add_command(index, :ok)
end
end
end # class Game_Time_Settings_Command_Window < Window_Command
class Game_Time_Extended_Settings_Info_Window < Window_Base
def initialize(create_main_command_window)
@create_main_command_window = create_main_command_window
super(Graphics.width * 2 / 5, 72, Graphics.width * 3 / 5, Graphics.height - 72)
end
def update
return if @create_main_command_window_last_index == @create_main_command_window.index
@create_main_command_window_last_index = @create_main_command_window.index
contents.clear
case @create_main_command_window.index
when 0
text = "Здесь можно изменить время и\nдату, а также управлять\nосвещением, скоростью времени\nи обновлением времени"
when 1
text = "Здесь можно изменять настройки погоды\nизменять текущую погоду,\nуправлять лимитом, силой и\nбитвой"
end
draw_text_ex(0, contents_height / 3, text)
end
end # class Game_Time_Extended_Settings_Info_Window < Window_Base
class Game_Time_Extended_Settings_Control_Command_Window < Window_Command
include Game_Time_Extended_Settings
def initialize(create_main_command_window)
@create_main_command_window = create_main_command_window
super(0, line_height * 3)
end
def window_width
Graphics.width * 2 / 5
end
def window_height
Graphics.height - line_height * 3
end
def make_command_list
command_list = []
case @create_main_command_window.index
when 0
command_list = GAME_TIME_COMMAND_LIST
when 1
command_list = GAME_WEATHER_COMMAND_LIST if $imported["DenKyz_Game_Weather"]
end
command_list.each do |index|
add_command(index, :ok)
end
end
def update
super
# если мы перемещаемся по окну команд, то обновляем окно контроля
return if @create_main_command_window_last_index == @create_main_command_window.index
@create_main_command_window_last_index = @create_main_command_window.index
refresh
end
end # class Game_Time_Extended_Settings_Control_Command_Window < Window_Command
class Game_Time_Extended_Settings_Process_Command_Window < Window_Command
include Game_Date_Settings, Game_Time_Settings
attr_reader :layer
attr_reader :sec
attr_reader :min
attr_reader :hour
attr_reader :day
attr_reader :dayweek
attr_reader :month
attr_reader :year
attr_reader :use_khas_day_light
attr_reader :static_light_hour
attr_reader :time_speed
attr_reader :time_update
attr_reader :game_weather_cursor
attr_reader :game_weather_type
attr_reader :game_weather_limit
attr_reader :game_weather_power
attr_reader :game_weather_in_battle
def initialize(create_main_command_window, create_control_command_window)
@create_main_command_window = create_main_command_window
@create_control_command_window = create_control_command_window
@layer = 0 # какой уровень команд отображать
setup_all_variables
super(Graphics.width * 2 / 5, line_height * 3)
end
def setup_all_variables
@sec = $Game_Time.sec
@min = $Game_Time.min
@hour = $Game_Time.hour
@day = $Game_Time.day
@dayweek = $Game_Time.dayweek % GAME_TIME_DAYS_WEEK.size
@month = $Game_Time.month
@year = $Game_Time.year
@use_khas_day_light = $GAME_TIME_USE_KHAS_DAY_LIGHT
@static_light_hour = $Game_Time_Tint.static_light_hour
@time_speed = $Game_Time.time_speed
@time_update = $Game_Time.time_update
if $imported["DenKyz_Game_Weather"]
@game_weather_cursor = 0
@game_weather_type = 0
@game_weather_type = $Game_Weather.weather[@game_weather_cursor].type if $Game_Weather.weather != []
@game_weather_limit = $GAME_WEATHER_LIMIT
@game_weather_power = $GAME_WEATHER_POWER
@game_weather_in_battle = $GAME_WEATHER_IN_BATTLE
end
end
def layer=(layer)
@layer = layer
refresh
activate
end
def alignment
1
end
def window_width
Graphics.width * 3 / 5
end
def window_height
Graphics.height - line_height * 3
end
def item_rect(index)
rect = Rect.new
rect.width = item_width / 2
rect.height = item_height
rect.x = contents_width - rect.width
rect.y = index / col_max * item_height
rect.y += line_height if @layer == 0 && @create_main_command_window.index == 0 && @create_control_command_window.index == 2 && GAME_TIME_KHAS_LIGHT && GAME_TIME_KHAS_LIGHT_SWITCH != -1
rect.y += line_height if @layer == 0 && @create_main_command_window.index == 1 && @create_control_command_window.index == 4
rect
end
def make_command_list
case @create_main_command_window.index
when 0
case @create_control_command_window.index
when 0
add_command(@hour.to_s, :change_game_time)
add_command(@min.to_s, :change_game_time)
add_command(@sec.to_s, :change_game_time)
when 1
add_command(@day.to_s, :change_game_date)
add_command(GAME_TIME_DAYS_WEEK[@dayweek], :change_game_date)
add_command(GAME_TIME_MONTHS[@month], :change_game_date)
add_command(@year.to_s, :change_game_date)
when 2
if @layer == 0 && GAME_TIME_KHAS_LIGHT && GAME_TIME_KHAS_LIGHT_SWITCH != -1
add_command(@use_khas_day_light ? "Да" : "Нет", :use_khas_day_light)
else
add_command(@static_light_hour.to_s, :static_light_hour)
end
when 3
add_command(@time_speed.to_s, :time_speed)
when 4
add_command(@time_update ? "Да" : "Нет", :time_update)
end
when 1
case @create_control_command_window.index
when 0
return if $Game_Weather.weather == []
add_command($Game_Weather.weather[@game_weather_cursor].name, :change_game_weather_type)
add_command($Game_Weather.weather[@game_weather_cursor].power.to_s, :change_game_weather_type, false)
add_command(@game_weather_type.to_s, :change_game_weather_type)
when 1
return if $Game_Weather.weather == []
add_command($Game_Weather.weather[@game_weather_cursor].name, :stop_game_weather)
add_command($Game_Weather.weather[@game_weather_cursor].power.to_s, :stop_game_weather, false)
add_command(@game_weather_type.to_s, :stop_game_weather, false)
when 2
add_command(@game_weather_limit.to_s, :change_game_weather_limit)
when 3
add_command(@game_weather_power.to_s, :change_game_weather_power)
when 4
add_command(@game_weather_in_battle ? "Вкл." : "Выкл.", :change_game_weather_in_battle)
end
end
end
def refresh
super
case @create_main_command_window.index
when 0
case @create_control_command_window.index
when 0
draw_text_ex(0, 0, "Часы")
draw_text_ex(0, line_height, "Минуты")
draw_text_ex(0, line_height * 2, "Секунды")
when 1
draw_text_ex(0, 0, "День")
draw_text_ex(0, line_height, "День недели")
draw_text_ex(0, line_height * 2, "Месяц")
draw_text_ex(0, line_height * 3, "Год")
when 2
if @layer == 0 && GAME_TIME_KHAS_LIGHT && GAME_TIME_KHAS_LIGHT_SWITCH != -1
draw_text_ex(0, 0, "Использовать переключатель\nсвета Khas ?")
else
draw_text_ex(0, 0, "Час освещения")
draw_text_ex(0, line_height, "-1, чтобы не устанавливать")
end
when 3
draw_text_ex(0, 0, "Скорость")
when 4
draw_text_ex(0, 0, "Обновление")
end
when 1
case @create_control_command_window.index
when 0..1
draw_text_ex(0, 0, "Имя погоды")
draw_text_ex(0, line_height, "Сила погоды")
draw_text_ex(0, line_height * 2, "Тип погоды")
when 2
draw_text_ex(0, 0, "Лимит погоды")
when 3
draw_text_ex(0, 0, "Сила погоды")
when 4
draw_text_ex(0, 0, "Использовать отображение\nпогоды в бою ?")
end
end
end
def cursor_right(wrap = false)
case @create_main_command_window.index
when 0
case @create_control_command_window.index
when 0
increase_time
when 1
increase_date
when 2
if @layer == 0 && GAME_TIME_KHAS_LIGHT && GAME_TIME_KHAS_LIGHT_SWITCH != -1
change_use_khas_day_light
else
increase_light_hour
end
when 3
increase_time_speed
when 4
change_time_update
end
when 1
case @create_control_command_window.index
when 0
increase_game_weather_cursor if index == 0
increase_game_weather_type if index == 2
when 1
increase_game_weather_cursor
when 2
increase_game_weather_limit
when 3
increase_game_weather_power
when 4
change_game_weather_in_battle
end
end
refresh
end
def cursor_left(wrap = false)
case @create_main_command_window.index
when 0
case @create_control_command_window.index
when 0
decrease_time
when 1
decrease_date
when 2
if @layer == 0 && GAME_TIME_KHAS_LIGHT && GAME_TIME_KHAS_LIGHT_SWITCH != -1
change_use_khas_day_light
else
decrease_light_hour
end
when 3
decrease_time_speed
when 4
change_time_update
end
when 1
case @create_control_command_window.index
when 0
decrease_game_weather_cursor if index == 0
decrease_game_weather_type if index == 2
when 1
decrease_game_weather_cursor
when 2
decrease_game_weather_limit
when 3
decrease_game_weather_power
when 4
change_game_weather_in_battle
end
end
refresh
end
def cursor_pagedown
5.times { cursor_right }
end
def cursor_pageup
5.times { cursor_left }
end
def increase_time
case index
when 0
@hour += 1
@hour = @hour % GAME_TIME_HOURS_IN_DAY
when 1
@min += 1
@min = @min % GAME_TIME_MINUTES_IN_HOUR
when 2
@sec += 1
@sec = @sec % GAME_TIME_SECONDS_IN_MINUTE
end
end
def decrease_time
case index
when 0
@hour -= 1
@hour = GAME_TIME_HOURS_IN_DAY - 1 if @hour < 0
when 1
@min -= 1
@min = GAME_TIME_MINUTES_IN_HOUR - 1 if @min < 0
when 2
@sec -= 1
@sec = GAME_TIME_SECONDS_IN_MINUTE - 1 if @sec < 0
end
end
def increase_date
case index
when 0
@day += 1
@day = @day % (GAME_TIME_DAYS[@month] + 1)
@day = 1 if @day == 0
when 1
@dayweek += 1
@dayweek = @dayweek % GAME_TIME_DAYS_WEEK.size
when 2
@month += 1
@month = @month % GAME_TIME_MONTHS.size
when 3
@year += 1
end
end
def decrease_date
case index
when 0
@day -= 1
@day = GAME_TIME_DAYS[@month] if @day < 1
when 1
@dayweek -= 1
@dayweek = GAME_TIME_DAYS_WEEK.size - 1 if @dayweek < 0
when 2
@month -= 1
@month = GAME_TIME_MONTHS.size - 1 if @month < 0
when 3
@year -= 1
@year = 0 if @year < 0
end
end
def change_use_khas_day_light
@use_khas_day_light = !@use_khas_day_light
end
def increase_light_hour
@static_light_hour += 1
@static_light_hour = -1 if @static_light_hour == GAME_TIME_HOURS_IN_DAY
end
def decrease_light_hour
@static_light_hour -= 1
@static_light_hour = GAME_TIME_HOURS_IN_DAY - 1 if @static_light_hour < -1
end
def increase_time_speed
@time_speed += 1
@time_speed = [1, @time_speed % 121].max
end
def decrease_time_speed
@time_speed -= 1
@time_speed = 120 if @time_speed < 1
end
def change_time_update
@time_update = !@time_update
end
def increase_game_weather_cursor
@game_weather_cursor += 1
@game_weather_cursor = @game_weather_cursor % $Game_Weather.weather.size
@game_weather_type = $Game_Weather.weather[@game_weather_cursor].type
end
def decrease_game_weather_cursor
@game_weather_cursor -= 1
@game_weather_cursor = @game_weather_cursor % $Game_Weather.weather.size
@game_weather_type = $Game_Weather.weather[@game_weather_cursor].type
end
def increase_game_weather_type
@game_weather_type += 1
@game_weather_type = @game_weather_type % (17 + Game_Weather_Settings::GAME_WEATHER_CUSTOM_TYPES.size)
end
def decrease_game_weather_type
@game_weather_type -= 1
@game_weather_type = @game_weather_type % (17 + Game_Weather_Settings::GAME_WEATHER_CUSTOM_TYPES.size)
end
def increase_game_weather_limit
@game_weather_limit += 1
end
def decrease_game_weather_limit
@game_weather_limit -= 1
@game_weather_limit = 1 if @game_weather_limit < 1
end
def increase_game_weather_power
@game_weather_power += 1
end
def decrease_game_weather_power
@game_weather_power -= 1
@game_weather_power = 0 if @game_weather_power < 0
end
def change_game_weather_in_battle
@game_weather_in_battle = !@game_weather_in_battle
end
end # class Game_Time_Extended_Settings_Process_Command_Window < Window_Command
Социальные закладки