Code:
# VX Windowskin Scriptlet
# by Kyonides-Arkanthos alias Kyonides, Shadowball
# 03.12.2010
# Script Call: RPGWindow.skin = 'File'
# Scene Script Call: $scene = Scene_SetWindowskin.new
module RPGWindow
def self.skin=(filename)
@filename = filename
@windowskin = filename.is_a?(String) ? Cache.system(filename) : filename
end
def self.skin; @windowskin end
def self.name; @filename end
end
class Window_Base
Windowskin = Cache.system('Window')
def initialize(x, y, width, height)
super()
self.windowskin = RPGWindow.skin.nil? ? Windowskin : RPGWindow.skin
self.x, self.y, self.z = x, y, 100
self.width, self.height = width, height
self.back_opacity, self.openness = 200, 255
create_contents
@opening, @closing = false, false
end
alias :kyon_skin_win_base_up :update
def update
if !RPGWindow.skin.nil? and self.windowskin != RPGWindow.skin
self.windowskin = RPGWindow.skin
end
kyon_skin_win_base_up
end
end
# Array Add-on - original de Kyonides-Arkanthos
class Array
def now; return if @pos.nil?; return self[@pos] end
def now=(value); @pos = value end
def index_now; return !@pos.nil? ? @pos : 0 ; end
def next
@pos = (@pos.nil? or @pos == self.size-1) ? 0 : @pos+1
return self[@pos]
end
alias :succ :next
def previous
@pos = (@pos.nil? or @pos == 0) ? self.size-1 : @pos-1
return self[@pos]
end
alias :prev :previous
end
class Scene_SetWindowskin < Scene_Base
WINDOWSKINS = ['Window', 'Window Black', 'Window Gray']
def start
@spriteset = Spriteset_Map.new
@help_window = Window_Help.new
@help_window.set_text('Escoja un Windowskin',1)
WINDOWSKINS.now = WINDOWSKINS.index(RPGWindow.name)
RPGWindow.skin = WINDOWSKINS.now
@name_window = Window_Help.new
@name_window.y = 64
@name_window.set_text(windowskin_name,1)
end
def terminate
@help_window.dispose
@name_window.dispose
@spriteset.dispose
end
def windowskin_name
@name_index = RPGWindow.name + " #{WINDOWSKINS.index_now+1} / " +
WINDOWSKINS.size.to_s
end
def update
@help_window.update
@name_window.update
if windowskin_name != @name
@name_window.set_text(windowskin_name,1)
@name = @name_index
end
if Input.trigger? Input::B
Sound.play_cancel
$scene = Scene_Map.new
return
elsif Input.trigger? Input::LEFT
Sound.play_decision
RPGWindow.skin = WINDOWSKINS.prev
elsif Input.trigger? Input::RIGHT
Sound.play_decision
RPGWindow.skin = WINDOWSKINS.next
end
end
end