Pomógł: 1 raz Dołączył: 20 Sie 2012 Posty: 51 Skąd: Włocławek
Wysłany: Sro 29 Sie, 2012 04:36
Menu z Ikonkami!
~ XaiL System - Icon Menu ~
Krótki opis:
Skrypt dodaje nam ładne, estetyczne menu wykonane z ikonek, polecam!
Autor:
Nicke
Tłumaczenie:
Saskio
Kompatybilność:
RPG Maker VX Ace
Skrypt:
Spoiler:
Kod:
#==============================================================================
# XaiL System - Icon Menu
# Autor: Nicke
# Stworzone: 07/04/2012
# Edytowane: 06/05/2012
# Tłumaczenie: Saskio
# Specjalnie dla Ultimateam.pl
# Wersja: 1.0c
#==============================================================================
# Instrukcja
# -----------------------------------------------------------------------------
# Aby zainstalować ten skrypt, należy otworzyć Edytor Skryptów i wkleić
# go w wolny slot poniżej 'Materials' ale nad 'Main'. Pamiętaj o zapisie!
#
# Skrypt dodaje miłe dla oka menu stworzone z ikon (Można zobaczyć na "skrinie"
#
# *** Jedynie dla RPGMaker Vx Ace. ***
#==============================================================================
($imported ||= {})["XAIL-XS-ICON_MENU"] = true
# Położenie okna [x, y, z, krycie]
MENU_WINDOW = [0, 0, 200, 255]
# Wycentrowanie menu.
# Notka: Jeśli jest 'true' położenie x, y, z nie ma znaczenia.
# Menu w Centrum = true/false
MENU_CENTER = true
# Czy używać windowskin do menu?
# 'nil' aby wyłączyć
# 'string' aby włączyć
MENU_SKIN = nil
# Lista menu - 'ikonki' (może być nil) i 'domyślne sceny' są opcjonalne.
# MENU_LIST:
# ID = ['Tytuł', Opis, :symbol, :komenda, ikonki, aktywne?, domyślna scena ]
MENU_LIST = []
MENU_LIST[0] = ["Ekwipunek", "Zmień swój ekwipunek", :equip, :command_equip, 170, true]
MENU_LIST[1] = ["Umiejętności", "Zarządzaj swoimi umiejętnościami", :skill, :command_skill, 112, true]
MENU_LIST[2] = ["Przedmioty", "Przeglądaj posiadane przedmioty", :item, :command_item, 264, true]
MENU_LIST[3] = ["Statystyki", "Zobacz aktualne statystyki", :status, :command_status, 122, true]
MENU_LIST[4] = ["Zapisz", "Zapisz swoje postępy", :save, :command_save, 233, true]
MENU_LIST[5] = ["Wczytaj", "Wczytaj zapisaną grę", :load, :command_custom, 230, true, Scene_Load]
MENU_LIST[6] = ["Wyjdź", "Wyjdź z programu", :game_end, :command_game_end, 1, true]
MENU_LIST[7] = ["Ekran Tytułowy", "Wróć do Ekranu Tytułowego", :title, :command_custom, 12, true, Scene_Title]
#==============================================================================================================#
#Tego nie tłumaczę, bo uważam, że nie jest to potrzebne, jeśli ktoś chce to użyć, musi sam sobie potłumaczyć :D#
#==============================================================================================================#
# If MENU_CUSTOM is true you will have to add the commands yourself
# ingame, which can be useful for certain quest related stuff or if you
# want to disable commands temporarly.
# To add/delete a command ingame follow these instructions:
#
# In a Call Script do like this:
# menu_scene(2,:add) # To add id 2 to menu list.
# menu_scene(3,:del) # To remove id 3 from menu list.
#
# In a conditional branch do like this to check if a id is active:
# menu_active?(5) # Returns true if id 5 is enabled.
#
# To set a id to be enabled do like this:
# menu_active(1, true) # Set id 1 to be enabled.
#
# To add/delete every menu item to the list use this method:
# menu_scene_all(type = :add/:del)
#
# MENU_CUSTOM = true/false
MENU_CUSTOM = false
# The text to be displayed if no menu items is available.
# MENU_EMPTY = ""
MENU_EMPTY = "The menu is not available at this point."
#=================================================================================================================
# Czas animacji okna pomocy. 0 = brak animacji.
# Występuje jedynie, gdy MENU_COMMANDS jest aktywne
# ANIMATE_TIMER = number
ANIMATE_TIMER = 10
# Okno pomocy.
# Położenie = [x, y, z, krycie, włączone]
HELP = [0, 0, 200, 255, true]
end
end
# *** Nie edytuj niżej, chyba, że wiesz co robisz! ***
#==============================================================================#
# ** Game_System
#==============================================================================#
class Game_System
attr_accessor :menu_list
alias xail_icon_menu_sys_initialize initialize unless $@
def initialize(*args, &block)
xail_icon_menu_sys_initialize(*args, &block)
@menu_list = []
end
end
#==============================================================================#
# ** Game_Interpreter
#==============================================================================#
class Game_Interpreter
def menu_scene(id, type)
# // Method to add a item to the list.
case type
when :add # // Add menu id.
unless $game_system.menu_list.include?(XAIL::ICON_MENU::MENU_LIST[id])
$game_system.menu_list.push(XAIL::ICON_MENU::MENU_LIST[id])
end unless XAIL::ICON_MENU::MENU_LIST[id].nil?
when :del # // Remove menu id.
unless XAIL::ICON_MENU::MENU_LIST[id].nil?
$game_system.menu_list.delete(XAIL::ICON_MENU::MENU_LIST[id])
end
end
end
def menu_active?(id)
# // Method to check if id is eanbled.
return if $game_system.menu_list[id].nil?
return $game_system.menu_list[id][5]
end
def menu_active(id, enabled)
# // Method to enable id.
$game_system.menu_list[id][5] = enabled
end
def menu_scene_all(type = :add)
# // Method to add or delete all of the id's to the menu list.
id = 0
while id < XAIL::ICON_MENU::MENU_LIST.size
case type
when :add
menu_scene(id, :add)
else
menu_scene(id, :del)
end
id += 1
end
end
end
#==============================================================================
# ** Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
alias xail_icon_menu_window_width_cmd window_width
def window_width(*args, &block)
# // Method to return the width.
xail_icon_menu_window_width_cmd(*args, &block)
return 48 if get_menu.size == 1
return 74 if get_menu.size == 2
return 32 * get_menu.size
end
alias xail_icon_menu_window_height_cmd window_height
def window_height(*args, &block)
# // Method to return the height.
xail_icon_menu_window_height_cmd(*args, &block)
return fitting_height(1)
end
alias xail_icon_menu_col_max_cmd col_max
def col_max(*args, &block)
# // Method to determine col max.
xail_icon_menu_col_max_cmd(*args, &block)
return get_menu.size
end
alias xail_icon_menu_item_max_cmd item_max
def item_max(*args, &block)
xail_icon_menu_item_max_cmd(*args, &block)
return get_menu.size
end
alias xail_icon_menu_spacing_cmd spacing
def spacing(*args, &block)
# // Method to determine spacing.
xail_icon_menu_spacing_cmd(*args, &block)
return 0
end
alias xail_icon_menu_contents_width_cmd contents_width
def contents_width(*args, &block)
# // Method to determine contents width.
xail_icon_menu_contents_width_cmd(*args, &block)
(item_width + spacing) * item_max - spacing
end
alias xail_icon_menu_contents_height_cmd contents_height
def contents_height(*args, &block)
# // Method to determine contents height.
xail_icon_menu_contents_height_cmd(*args, &block)
item_height
end
def get_menu
# // Method to get the menu list.
if XAIL::ICON_MENU::MENU_CUSTOM
return @menu_list = $game_system.menu_list
else
return @menu_list = XAIL::ICON_MENU::MENU_LIST
end
end
def draw_menu_icon(icon_index, x, y, enabled = true)
# // Method to draw icon.
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
contents.blt(x, y, bitmap, rect, enabled ? 255 : 20)
end
def draw_item(index)
# // Method override to draw the command item.
x = (get_menu.size < 5) ? 0 : 2
for i in get_menu
icon = i[4] unless i[4].nil?
draw_menu_icon(icon, x, 0, i[5])
x += item_width
end
end
def make_command_list
# // Method override to add the commands.
for i in get_menu
case i[2]
when :save
add_command(i[0], i[2], save_enabled, i[6])
else
add_command(i[0], i[2], i[5], i[6])
end
end
end
end
#==============================================================================#
# ** Window_Gold
#==============================================================================#
class Window_Gold < Window_Base
alias xail_icon_menu_wingold_refresh refresh
def refresh(*args, &block)
contents.clear
# // Refresh method override, draw a icon and the value.
unless XAIL::ICON_MENU::GOLD[4].nil?
draw_icon(XAIL::ICON_MENU::GOLD[4], 116, -2)
draw_currency_value(value, currency_unit, -10, 0, contents.width - 8)
else
xail_icon_menu_wingold_refresh(*args, &block)
end
end
end
#==============================================================================#
# ** Window_Weight
#==============================================================================#
class Window_Weight < Window_Base
def initialize
# // Method to initialize.
super(0, 0, window_width, fitting_height(1))
refresh
end
def window_width
# // Method to return the width.
return 160
end
def refresh
# // Method to refresh.
contents.clear
draw_weight
end
end
#==============================================================================#
# ** Window_Help
#==============================================================================#
class Window_Icon_Help < Window_Help
attr_accessor :index
alias xail_icon_menu_winhelp_init initialize
def initialize(*args, &block)
xail_icon_menu_winhelp_init(*args, &block)
@menu_list = get_menu
@index = nil
end
def get_menu
# // Method to get the menu list.
if XAIL::ICON_MENU::MENU_CUSTOM
@menu_list = $game_system.menu_list
else
@menu_list = XAIL::ICON_MENU::MENU_LIST
end
end
alias xail_icon_menu_winhelp_set_text set_text
def set_text(text, enabled)
# // Method to set a new the tp text to the window.
xail_icon_menu_winhelp_set_text(text)
if text != @text
menu_color(XAIL::ICON_MENU::MENU_FONT[2], enabled)
@text = text
refresh
end
end
def refresh
# // Refresh help contents.
contents.clear
draw_help_text
end
def draw_help_text
# // Method to draw the help text.
contents.font.name = XAIL::ICON_MENU::MENU_FONT[0]
contents.font.size = XAIL::ICON_MENU::MENU_FONT[1]
menu_color(XAIL::ICON_MENU::MENU_FONT[2], menu_enabled?(@index))
contents.font.bold = XAIL::ICON_MENU::MENU_FONT[3]
contents.font.shadow = XAIL::ICON_MENU::MENU_FONT[4]
# // Draw title and description for the menu.
draw_help_ex(0, -4, @text)
reset_font_settings
end
def draw_help_ex(x, y, text)
# // Special method to draw a text.
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
def menu_enabled?(index)
# // Method to check if menu item is enabled.
return get_menu[index][5]
end
def menu_color(color, enabled = true)
# // Method to set the color and alpha if not enabled.
contents.font.color.set(color)
contents.font.color.alpha = 150 unless enabled
end
end
#==============================================================================#
# ** Scene_MenuBase
#------------------------------------------------------------------------------
# New Scene :: Scene_MenuBase
#==============================================================================#
class Scene_MenuBase < Scene_Base
alias xail_icon_menubase_start start
def start(*args, &block)
# // Method to start the scene
xail_icon_menubase_start(*args, &block)
@menu_list = get_menu
end
alias xail_icon_menubase_post_start post_start
def post_start(*args, &block)
# // Method to post_start the scene.
xail_icon_menubase_post_start(*args, &block)
perform_transition unless @menu_list.empty?
end
def get_menu
# // Method to get the menu list.
if XAIL::ICON_MENU::MENU_CUSTOM
return @menu_list = $game_system.menu_list
else
return @menu_list = XAIL::ICON_MENU::MENU_LIST
end
end
alias xail_icon_menubase_terminate terminate
def terminate(*args, &block)
# // Method to terminate the scene.
xail_icon_menubase_terminate(*args, &block)
dispose_help
end
def dispose_help
# // Dispose help window.
@help_window.dispose unless @help_window.nil?
@help_window = nil
end
def create_background
# // Method to create custom background.
@background_sprite = Sprite.new
if XAIL::ICON_MENU::BACK.nil?
@background_sprite.bitmap = SceneManager.background_bitmap
if XAIL::ICON_MENU::BACK_TYPE[2]
source = SceneManager.background_bitmap
bitmap = Bitmap.new(Graphics.width, Graphics.height)
bitmap.stretch_blt(bitmap.rect, source, source.rect) unless SceneManager.scene_is?(Scene_Load)
case XAIL::ICON_MENU::BACK_TYPE[0]
when 0 ; bitmap.blur # // Default
when 1 ; bitmap.radial_blur(XAIL::ICON_MENU::BACK_RADIAL_BLUR[0], XAIL::ICON_MENU::BACK_RADIAL_BLUR[0])
when 2 ; bitmap.hue_change(XAIL::ICON_MENU::BACK_HUE)
when 3 ; bitmap.fill_rect(bitmap.rect, XAIL::ICON_MENU::BACK_COLOR)
when 4 ; bitmap.gradient_fill_rect(bitmap.rect, XAIL::ICON_MENU::BACK_GRADIENT[0],
XAIL::MENU::BACK_GRADIENT[1], XAIL::ICON_MENU::BACK_GRADIENT[2])
end
@background_sprite.opacity = XAIL::ICON_MENU::BACK_TYPE[1]
@background_sprite.bitmap = bitmap
end
else
@background_sprite.bitmap = Cache.system(XAIL::ICON_MENU::BACK)
end
end
alias xail_icon_menubase_transition perform_transition
def perform_transition(*args, &block)
# // Method to create the transition.
if XAIL::ICON_MENU::TRANSITION.nil?
xail_icon_menubase_transition(*args, &block)
else
Graphics.transition(XAIL::ICON_MENU::TRANSITION[0],XAIL::ICON_MENU::TRANSITION[1],XAIL::ICON_MENU::TRANSITION[2])
end
end
end
#==============================================================================#
# ** Scene_Menu
#------------------------------------------------------------------------------
# New Scene :: Scene_Menu
#==============================================================================#
class Scene_Menu < Scene_MenuBase
def start
super
# // Method to start the scene.
@menu_list = get_menu
return command_map if @menu_list.empty?
@anim_timer = XAIL::ICON_MENU::ANIMATE_TIMER
create_menu_command_window
if XAIL::ICON_MENU::HELP[4]
create_menu_help_window
help_update(@command_window.index)
end
create_menu_gold_window if XAIL::ICON_MENU::GOLD[5]
create_menu_weight_window if XAIL::ICON_MENU::WEIGHT[5] and $imported["XAIL-INVENTORY-WEIGHT"]
end
def create_menu_command_window
# // Method to create the command window.
@command_window = Window_MenuCommand.new
@command_window.windowskin = Cache.system(XAIL::ICON_MENU::MENU_SKIN) unless XAIL::ICON_MENU::MENU_SKIN.nil?
if XAIL::ICON_MENU::MENU_CENTER
@command_window.x = (Graphics.width - @command_window.width) / 2
@command_window.y = (Graphics.height - @command_window.height) / 2
else
@command_window.x = XAIL::ICON_MENU::MENU_WINDOW[1]
@command_window.y = XAIL::ICON_MENU::MENU_WINDOW[2]
end
@command_window.z = XAIL::ICON_MENU::MENU_WINDOW[2]
@command_window.opacity = XAIL::ICON_MENU::MENU_WINDOW[3]
for i in @menu_list
@command_window.set_handler(i[2], method(i[3]))
end
@command_window.set_handler(:cancel, method(:return_scene))
end
def get_menu
# // Method to get the menu list.
if XAIL::ICON_MENU::MENU_CUSTOM
return @menu_list = $game_system.menu_list
else
return @menu_list = XAIL::ICON_MENU::MENU_LIST
end
end
alias xail_upd_icon_menu_index_change update
def update(*args, &block)
# // Method for updating the scene.
xail_upd_icon_menu_index_change(*args, &block)
if XAIL::ICON_MENU::HELP[4]
old_index = @help_window.index
if old_index != @command_window.index
# // Animate the help window.
help_animate
# // Update help window.
help_update(@command_window.index)
# // Reset animate for the help window.
help_animate_reset
end
end
end
def help_animate
# // Method to animate help window.
for i in 1..@anim_timer
break if scene_changing?
update_basic
@help_window.contents_opacity = 255 - i * (255 / @anim_timer * 2)
end
end
def help_animate_reset
# // Method to reset animation.
for i in 1..@anim_timer
break if scene_changing?
update_basic
@help_window.contents_opacity = i * (255 / @anim_timer * 2)
end
end
def help_update(index)
# // If index changes update help window text.
icon = get_menu[index][4]
title = '\i[' + icon.to_s + ']' + get_menu[index][0]
desc = '\c[0]' + get_menu[index][1]
text = "#{title}\n#{desc}"
enabled = get_menu[index][5]
@help_window.index = index
@help_window.set_text(text, enabled)
end
def command_status
# // command_status (Don't remove)
SceneManager.call(Scene_Status)
end
def command_skill
# // command_skill (Don't remove)
SceneManager.call(Scene_Skill)
end
def command_equip
# // command_equip (Don't remove)
SceneManager.call(Scene_Equip)
end
def command_custom
# // Method to call a custom command.
SceneManager.call(@command_window.current_ext)
end
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
Screeny:
Spoiler:
Dodatkowe informacje: Instrukcja:
1.Wklej skrypt nad 'Main' w edytorze skryptów.
2.Dalsza instrukcja znajduje się w treści skryptu!
Skrypt nie potrzebuje żadnych dodatkowych grafik!
________________________ Praca uszlachetnia, lenistwo uszczęśliwia.
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum