Code:
# * WindowSkins XP * #
# Scripter : Kyonides
# 2024-11-15
module WindowSkin
TITLE_COMMANDS = []
TITLE_COMMANDS << "New Game"
TITLE_COMMANDS << "Continue"
TITLE_COMMANDS << "Windowskin"
TITLE_COMMANDS << "Shutdown"
MENU_POS = 0
LABEL_CHOOSE = "Choose a Windowskin"
LABEL_TEST = "Selected Windowskin"
SKINS = []
SKINS << ["Default", "001-Blue01"]
SKINS << ["Windows Vista", "Windows Vista"]
SKINS << ["", ""]
extend self
@index = MENU_POS
attr_accessor :index, :scene_class
def open_scene
if @scene_class == Scene_Title
$scene = @scene_class.new
elsif @scene_class == Scene_Menu
$scene = @scene_class.new(SCENE_MENU_POS)
else
print "Next scene class remains unconfigured."
end
end
end
class Game_System
alias :kyon_win_skin_gm_sys_init :initialize
def initialize
kyon_win_skin_gm_sys_init
windowskin_index
reset_windowskin_name
end
def windowskin_index
@windowskin_index ||= WindowSkin.index
end
def reset_windowskin_name
@windowskin_name = WindowSkin::SKINS[@windowskin_index][1]
end
attr_writer :windowskin_index
end
class Window_Base
attr_writer :windowskin_name
end
class Window_Command
def reset_commands(commands)
@item_max = commands.size
@commands = commands
self.height = @item_max * 32 + 32
self.contents.dispose
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
end
end
class Scene_Title
def reset_command_window
@command_window.reset_commands(WindowSkin::TITLE_COMMANDS)
@command_window.disable_item(1) unless @continue_enabled
@reset_commands = true
end
def update
unless @reset_commands
reset_command_window
return
end
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0
command_new_game
when 1
command_continue
when 2
command_windowskin
when 3
command_shutdown
end
end
end
def command_windowskin
WindowSkin.scene_class = $scene.class
$scene = WindowScene.new
end
end
class WindowScene
include WindowSkin
def main
start
Graphics.transition
main_loop
Graphics.freeze
dispose
end
def reset_windowskin
skin = SKINS[@index][1]
$game_system.windowskin_name = skin
end
def start
@index = $game_system.windowskin_index
reset_windowskin
options = SKINS.map {|entry| entry[0] }
@running = true
@help_window = Window_Help.new
@help_window.set_text(LABEL_CHOOSE, 1)
@command_window = Window_Command.new(180, options)
@command_window.y = 64
@command_window.index = @index
@dummy_window = Window_Base.new(220, 96, 300, 64)
bitmap = Bitmap.new(@dummy_window.width - 32, @dummy_window.height - 32)
bitmap.draw_text(bitmap.rect, LABEL_TEST, 1)
@dummy_window.contents = bitmap
end
def dispose
@dummy_window.dispose
@command_window.dispose
@help_window.dispose
end
def main_loop
while @running
Graphics.update
Input.update
update
end
end
def update
@command_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
WindowSkin.open_scene
return @running = nil
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@index = @command_window.index
WindowSkin.index = @index
reset_windowskin
@dummy_window.update
@help_window.update
end
end
end