module SUI
module OPTION
# ボイス再生ボリューム変更時のサンプルボイス
# 指定したボイスからランダムで1つ、新しいボリュームで再生されます。
# サンプルボイスがいらない場合は空にしてください。
SAMPLE = [
#ファイル名
# "sample_voice01",
# "sample_voice02",
"Cat",
"Crow",
"Dog",
]
# ボイスファイルの保存場所
#VOICE_DIR = "Audio/SE/Voice/"
VOICE_DIR = "Audio/SE/"
end
end
#==============================================================================
# 設定完了
#==============================================================================
class Window_Option < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 430, 330)
self.openness = 0
self.x = Graphics.width / 2 - self.width / 2
self.y = Graphics.height / 2 - self.height / 2 + line_height / 2 + padding
self.z = 160
[url=home.php?mod=space&uid=401263]@line[/url] = 0
set_index
refresh
update_cursor
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
contents.font.color = normal_color
contents.draw_text(0, 0 * rows_height, contents.width, line_height, "背景音量")
contents.draw_text(0, 1 * rows_height, contents.width, line_height, "语音音量")
contents.draw_text(0, 2 * rows_height, contents.width, line_height, "角色语音开关")
contents.draw_text(0, 3 * rows_height, contents.width, line_height, "文字表示速度")
contents.draw_text(0, 4 * rows_height, contents.width, line_height, "队列行进开关")
draw_command_10(0)
draw_command_10(1)
draw_command_2(2)
draw_command_3(3)
draw_command_2(4)
end
#--------------------------------------------------------------------------
# ● 行の高さ(2行分)
#--------------------------------------------------------------------------
def rows_height
60
end
#--------------------------------------------------------------------------
# ● 文字の描画
#--------------------------------------------------------------------------
def draw_text2(x, y, w, text, blue = false)
contents.font.color = blue ? system_color : normal_color
contents.font.color.alpha = blue ? 255 : 128
draw_text(x, y, w, line_height, text)
end
#--------------------------------------------------------------------------
# ● 10コマンドの描画
#--------------------------------------------------------------------------
def draw_command_10(row)
y = rows_height * row + line_height
10.times do |i|
x = 30 + 36 * i - ((i == 9) ? 2 : 0)
draw_text2(x, y, 30, ((i + 1) * 10).to_s, (i == @index[row]))
end
end
#--------------------------------------------------------------------------
# ● 10コマンドの矩形を取得
#--------------------------------------------------------------------------
def item_rect_10
rect = Rect.new
rect.x = 30 - 9 + 36 * @index[@line]
rect.y = rows_height * [url=home.php?mod=space&uid=401263]@line[/url] + line_height
rect.width = 30 + 8
rect.height = line_height
rect
end
#--------------------------------------------------------------------------
# ● 2コマンドの描画
#--------------------------------------------------------------------------
def draw_command_2(row)
y = rows_height * row + line_height
list = ["开启", "关闭"]
2.times do |i|
x = 30 + 100 * i
draw_text2(x, y, 40, list[i], (i == @index[row]))
end
end
#--------------------------------------------------------------------------
# ● 2コマンドの矩形を取得
#--------------------------------------------------------------------------
def item_rect_2
rect = Rect.new
rect.x = 30 - 11+ 100 * @index[@line]
rect.y = rows_height * [url=home.php?mod=space&uid=401263]@line[/url] + line_height
rect.width = 50 + 8
rect.height = line_height
rect
end
#--------------------------------------------------------------------------
# ● 3コマンドの描画
#--------------------------------------------------------------------------
def draw_command_3(row)
y = rows_height * row + line_height
list = ["缓慢", "普通", "快速"]
3.times do |i|
x = 30 + 80 * i
draw_text2(x, y, 40, list[i], (i == @index[row]))
end
end
#--------------------------------------------------------------------------
# ● 3コマンドの矩形を取得
#--------------------------------------------------------------------------
def item_rect_3
rect = Rect.new
rect.x = 30 - 11 + 80 * @index[@line]
rect.y = rows_height * @line + line_height
rect.width = 50 + 8
rect.height = line_height
rect
end
#--------------------------------------------------------------------------
# ● カーソルの更新
#--------------------------------------------------------------------------
def update_cursor
case @line
when 0, 1
cursor_rect.set(item_rect_10)
when 2, 4
cursor_rect.set(item_rect_2)
when 3
cursor_rect.set(item_rect_3)
end
Sound.play_cursor
end
#--------------------------------------------------------------------------
# ● 行の設定
#--------------------------------------------------------------------------
def line=(row)
old = @line
@line = [[@line + row, 0].max, 4].min
update_cursor if old != @line
end
#--------------------------------------------------------------------------
# ● 行の設定
#--------------------------------------------------------------------------
def index=(i)
max = 10 if( @line == 0 || @line == 1)
max = 1 if( @line == 2|| @line == 4)
max = 2 if( @line == 3)
old = @index[@line]
@index[@line] = [[@index[@line] + i, 0].max, max].min
update_cursor if old != @index[@line]
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
return unless self.openness == 255
self.line = +1 if Input.repeat?(:DOWN)
self.line = -1 if Input.repeat?(:UP)
self.index = +1 if Input.repeat?(:RIGHT)
self.index = -1 if Input.repeat?(:LEFT)
if Input.trigger?(:C)
Sound.play_use_item
case @line
when 0
$savec.set_num("bgm_vol", (@index[@line] + 0) * 10)
refresh
RPG::BGM::last.play
when 1
$savec.set_num("voice_vol", (@index[@line] + 0) * 10)
refresh
Audio.se_stop
vol = SUI::OPTION.voice_volume
return if SUI::OPTION::SAMPLE.length == 0
r = SUI::OPTION::SAMPLE[rand(SUI::OPTION::SAMPLE.length)]
Audio.se_play("#{SUI::OPTION::VOICE_DIR}#{r}", 100 * vol)
when 2
$savec.set("voice", @index[@line] == 1)
refresh
when 3
$savec.set_num("speed", @index[@line])
refresh
when 4
$savec.set("followers_move", @index[@line] == 1)
refresh
end
end
end
#--------------------------------------------------------------------------
# ● アクティブ設定
#--------------------------------------------------------------------------
def set_index
@index = []
res = $savec.get_num("bgm_vol")
res = 70 if res < 10
@index[0] = (res / 10) - 1
res = $savec.get_num("voice_vol")
res = 70 if res < 10
@index[1] = (res / 10) - 1
@index[2] = $savec.check("voice") ? 1 : 0
@index[3] = $savec.get_num("speed")
@index[3] = 1 if @index[3] == -1
@index[4] = $savec.check("followers_move") ? 1 : 0
end
end