#==============================================================================
# Window_CMSOptions
#==============================================================================
class Window_CMSOptions < Window_Selectable
attr_accessor :current_font
attr_accessor :current_fontsize
attr_reader :current_skin
attr_reader :skin_name
attr_reader :font_name
attr_reader :fontsize
def initialize
@background = 'CMSFullscreen'
super(0, 512, 640, 480)
@commands = ['BGM Volume', 'SFX Volume', 'Battle BGM']
@commands.push('Battle Cam') if BlizzCFG::CAM_AVAILABLE
@commands.push('Bar Style', 'Bar Opacity') if $Blizz_Art
@commands.push('Font', 'Font Size', 'Windowskin')
get_skin_and_font
self.contents = Bitmap.new(width - 32, height - 32)
self.z, self.index = 2999, 0
@item_max = @commands.size
refresh
end
def get_option
return @commands[index]
end
def refresh
self.contents.clear
self.contents.font.name = $game_system.fontname
(0...@item_max).each {|i|
self.contents.font.color = normal_color
self.contents.fill_rect(24, 16 + i*36, 192, 32, Color.new(0, 0, 0, 0))
self.contents.draw_text(24, 16 + i*36, 192, 32, @commands[i])
draw_arrows(288, 4 + i*36)
case @commands[i]
when 'BGM Volume' then draw_volume(288, 4 + i*36)
when 'SFX Volume' then draw_volume(288, 4 + i*36, true)
when 'Battle BGM' then draw_battle_bgm(288, 4 + i*36)
when 'Battle Cam' then draw_battle_cam(288, 4 + i*36)
when 'Bar Style' then draw_style(288, 4 + i*36)
when 'Bar Opacity' then draw_opacity(288, 4 + i*36)
when 'Font' then draw_font(288, 4 + i*36)
when 'Font Size' then draw_fontsize(288, 4 + i*36)
when 'Windowskin' then draw_skin(288, 4 + i*36)
end}
end
def draw_arrows(x, y)
self.contents.draw_text(x - 32, y + 13, 32, 32, '<<')
self.contents.draw_text(x + 249, y + 13, 32, 32, '>>')
end
def draw_volume(x, y, mode = false, width = 224)
volume = (mode ? $game_system.sfx_volume.to_f : $game_system.bgm_volume.to_f)
vol = volume.to_f / 100
color1 = Color.new(20, 40, 80, 192)
color2 = Color.new(60, 120, 240, 192)
color3 = Color.new(0, 0, 80, 192)
old, $game_system.bar_opacity = $game_system.bar_opacity, 255 if $Blizz_Art
self.contents.gradient_bar(x, y, width, color1, color2, color3, vol, true)
$game_system.bar_opacity = old if $Blizz_Art
end
def draw_style(x, y, width = 224)
color1 = Color.new(80, 80, 0, 192)
color2 = Color.new(240, 240, 0, 192)
self.contents.gradient_bar(x + 32, y, width - 64, color1, color2, color1, 1, true)
end
def draw_battle_bgm(x, y, width = 224)
bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]][3]
if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x+1, y + 13+1, 224, 32, bgm, 1)
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x, y + 13, 224, 32, bgm, 1)
end
def draw_battle_cam(x, y, width = 224)
cam = ($game_variables[BlizzCFG::CAM_Variable] == 0 ? 'ON' : 'OFF')
self.contents.draw_text(x, y + 13, 224, 32, cam, 1)
end
def draw_opacity(x, y, width = 224)
alpha = case $game_system.bar_opacity
when 0 then 'No Bar'
when 1..85 then 'Light'
when 86..170 then 'Medium'
when 171..254 then 'Hard'
when 255 then 'Full'
end
self.contents.draw_text(x, y + 13, 224, 32, alpha, 1)
end
def draw_font(x, y, width = 224)
@font_name = BlizzCFG::CMS_FONTS[@current_font]
self.contents.font.name = @font_name
self.contents.draw_text(x, y + 13, 224, 32, @font_name, 1)
self.contents.font.name = $game_system.fontname
end
def draw_fontsize(x, y, widthe = 224)
@fontsize = BlizzCFG::CMS_FONT_SIZE[@current_fontsize]
self.contents.font.size = @fontsize
self.contents.draw_text(x, y + 13, 224, 32, @fontsize, 1)
self.contents.font.size = $game_system.fontsize
end
def draw_skin(x, y, width = 224)
@skin_name = BlizzCFG::CMS_SKINS[self.current_skin]
self.contents.draw_text(x, y + 13, 224, 32, @skin_name, 1)
self.contents.fill_rect(x + 48, y +428, 128, 128, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.windowskin(@skin_name)
self.contents.blt(x + 50, y + 50, bitmap, Rect.new(2, 2, 124, 124))
self.contents.blt(x + 48, y + 48, bitmap, Rect.new(128, 0, 16, 16))
self.contents.blt(x + 160, y + 48, bitmap, Rect.new(176, 0, 16, 16))
self.contents.blt(x + 48, y + 160, bitmap, Rect.new(128, 48, 16, 16))
self.contents.blt(x + 160, y + 160, bitmap, Rect.new(176, 48, 16, 16))
(2..4).each {|i|
self.contents.blt(x+i*32, y+48, bitmap, Rect.new(144, 0, 32, 16))}
(2..4).each {|i|
self.contents.blt(x+i*32, y+160, bitmap, Rect.new(144, 48, 32, 16))}
(2..4).each {|i|
self.contents.blt(x+48, y+i*32, bitmap, Rect.new(128, 16, 16, 32))}
(2..4).each {|i|
self.contents.blt(x+160, y+i*32, bitmap, Rect.new(176, 16, 16, 32))}
end
def current_skin
return (@current_skin == nil ? 0 : @current_skin)
end
def current_skin=(val)
@current_skin = (val.is_a?(Numeric) ? val : 0)
end
def get_skin_and_font
@font_name = "Arial"
@current_font = BlizzCFG::CMS_FONTS.index(@font_name)
@fontsize = 24
@current_fontsize = BlizzCFG::CMS_FONT_SIZE.index(@fontsize)
@skin_name = $game_system.windowskin_name
self.current_skin = BlizzCFG::CMS_SKINS.index(@skin_name)
end
def update_cursor_rect
if self.index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(16, @index*36 + 16, 128, 32)
end
end
end