Neko Fondateur
Messages : 184 Date d'inscription : 14/07/2013 Age : 25 Localisation : Ici, la plupart du temps.
| Sujet: [ACE] VictorJ / Menu Simple Mar 16 Juil - 16:58 | |
| Voilà un menu fait pas VictorJ. Ce script vous permet de modifier à votre guise l'interface du menu. Screenshot :Script : - Code:
-
#============================================================================== # Simple Menu by VitorJ (http://vjrgss.blogspot.com/) #-Funcao----------------------------------------------------------------------- # Modifica o menu padrao. #-Nome do mapa----------------------------------------------------------------- # O nome que aparecera na area de nome do mapa sera o nome escolhido para # exibicao, caso nao tenha um, ele ira procurar o seguinte comando na nota do # mapa: <mname>Nome do Mapa</mname> # Onde o nome do mapa deve ser posto, nao e necessario estar entre aspas. #============================================================================== module VJSM Icons = [] #Icones para as opcoes Icons[0] = 261 #Item Icons[1] = 116 #Habilidade Icons[2] = 164 #Equipamento Icons[3] = 121 #Status Icons[4] = 12 #Formaзгo Icons[5] = 117 #Salvar Icons[6] = 1 #Sair ## Next = "Next" #Proximo level Gold_Icon = 361 #Icone do gold PlayTime_Icon = 280 #Icone do tempo de jogo Map_Icon = 231 #Icone do mapa atual File = "Arquivo" #Opзгo de file end
class Window_MenuStatus < Window_Selectable attr_reader :pending_index def initialize(x, y) super(x, y, window_width, window_height) @pending_index = -1 refresh end def window_width Graphics.width end def window_height Graphics.height - 96 end def item_max $game_party.members.size end def col_max return 2 end def item_height (height - standard_padding * 2) / 2 end def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) draw_actor_name(actor, rect.x+1, rect.y+1) draw_actor_face(actor, rect.x+1, rect.y+1 + line_height, enabled) draw_actor_class(actor, rect.x+1, (rect.y+rect.height) - (line_height+1)) draw_actor_level(actor, rect.x+98+16, rect.y+1) draw_exp_info(actor, rect.x+98+16, rect.y + line_height) draw_actor_hp(actor, rect.x+98+16, rect.y + line_height * 2) draw_actor_mp(actor, rect.x+98+16, rect.y + line_height * 3) draw_actor_icons(actor, rect.x+98+16, rect.y + line_height * 4) end def draw_actor_icons(actor, x, y, width = 128) icons = (actor.state_icons + actor.buff_icons) i = 0 icons.each do |icon| ix = x+(i*24) iy = y+(0) if i >= 5 ix = x+((i-5)*24) iy = y+(24) end draw_icon(icon, ix, iy) i+= 1 end end def draw_exp_info(actor, x, y) s2 = actor.max_level? ? "-------" : actor.next_level_exp - actor.exp s_next = VJSM::Next change_color(system_color) draw_text(x, y, 128, line_height, s_next) change_color(normal_color) draw_text(x, y, 128, line_height, s2, 2) end def draw_item_background(index) if index == @pending_index contents.fill_rect(item_rect(index), pending_color) end end def process_ok super $game_party.menu_actor = $game_party.members[index] end def select_last select($game_party.menu_actor.index || 0) end def pending_index=(index) last_pending_index = @pending_index @pending_index = index redraw_item(@pending_index) redraw_item(last_pending_index) end end class Window_NewMenuStatus < Window_Base def initialize(actor) super(0, 0, Graphics.width - 160, 120) @actor = actor refresh end def set_actor(actor) return if actor == @actor @actor = actor refresh end def refresh contents.clear actor = @actor enabled = $game_party.battle_members.include?(actor) draw_actor_face(actor,1, 1, enabled) draw_actor_simple_status(actor, 108, line_height / 2) end end class Window_Time < Window_Base def initialize(x,y) super(x, y, Graphics.width/3, 48) refresh end def update refresh end def refresh contents.clear playtime = $game_system.playtime_s draw_icon(VJSM::PlayTime_Icon, 0, 0) change_color(normal_color) draw_text(0, 0, self.contents.width, line_height, playtime, 2) end end class Window_MenuGold < Window_Base def initialize(x,y) super(x, y, Graphics.width/3, 48) refresh end def refresh contents.clear gold = $game_party.gold draw_icon(VJSM::Gold_Icon, 0, 0) change_color(normal_color) draw_text(0, 0, self.contents.width, line_height, gold, 2) end end class Window_MenuMapName < Window_Base def initialize(x,y) super(x, y, (Graphics.width/3)*2, 48) refresh end def refresh contents.clear if $game_map.display_name.empty? map_a = load_data(sprintf("Data/Map%03d.rvdata2", $game_map.map_id)) note = map_a.note.split("\r\n") text = "Nome da mapa nгo definido" note.each do |thing| if thing.include?("<mname>") text = thing text.slice!("<mname>") text.slice!("</mname>") end end map = text else map = $game_map.display_name end change_color(normal_color) draw_icon(VJSM::Map_Icon, 0, 0) draw_text(0, 0, self.contents.width, line_height, map, 2) end end class Window_Command_Name < Window_Base def initialize(text,w=171) super(0, 0, w, 48) @text = text refresh end def refresh contents.clear draw_text(0, 0, self.contents.width, self.contents.height, @text, 1) end def set_text(text) return if text == @text @text = text refresh end end class Window_MenuFile < Window_Command def initialize super(0, 0) update_placement end def window_width return 160 end def update_placement self.x = (Graphics.width - width) / 2 self.y = (Graphics.height - height) / 2 end def make_command_list add_command(Vocab::save, :save, save_enabled) add_command(Vocab::continue, :continue) add_command(Vocab::cancel, :cancel) end def save_enabled !$game_system.save_disabled end end class Window_MenuCommand < Window_Command def self.init_command_position @@last_command_symbol = nil end def initialize super(0, 0) select_last end def item_rect(index) rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * item_width rect.y = index / col_max * item_height rect end def item_width return 24 end def window_width return 192 end def window_height return 48 end def col_max return 8 end def visible_line_number item_max end def make_command_list add_main_commands add_formation_command add_original_commands add_save_command add_game_end_command end def draw_item(index) x = item_rect(index).x y = item_rect(index).y draw_icon(VJSM::Icons[index], x, y, command_enabled?(index)) end def add_main_commands add_command(Vocab::item, :item, main_commands_enabled) add_command(Vocab::skill, :skill, main_commands_enabled) add_command(Vocab::equip, :equip, main_commands_enabled) add_command(Vocab::status, :status, main_commands_enabled) end def add_formation_command add_command(Vocab::formation, :formation, formation_enabled) end def get_name(index) return command_name(index) end def add_original_commands end def add_save_command add_command(VJSM::File, :file) end def add_game_end_command add_command(Vocab::game_end, :game_end) end def main_commands_enabled $game_party.exists end def formation_enabled $game_party.members.size >= 2 && !$game_system.formation_disabled end def save_enabled !$game_system.save_disabled end def process_ok @@last_command_symbol = current_symbol super end def select_last select_symbol(@@last_command_symbol) end end class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # * Inicializaзгo do processo #-------------------------------------------------------------------------- def start super create_command_window create_gold_window create_status_window create_time_window create_map_window end #-------------------------------------------------------------------------- # * Criaзгo da janela de comando #-------------------------------------------------------------------------- def create_command_window @command_window = Window_MenuCommand.new @command_window.set_handler(:item, method(:command_item)) @command_window.set_handler(:skill, method(:command_personal)) @command_window.set_handler(:equip, method(:command_personal)) @command_window.set_handler(:status, method(:command_personal)) @command_window.set_handler(:formation, method(:command_formation)) @command_window.set_handler(:file, method(:command_file)) @command_window.set_handler(:game_end, method(:command_game_end)) @command_window.set_handler(:cancel, method(:return_scene)) @command_window.y = 0 @command_window.x = 0 @command_name = Window_Command_Name.new(@command_window.get_name(@command_window.index)) @command_name.y = @command_window.y @command_name.x = @command_window.x + @command_window.width @menu_file = Window_MenuFile.new @menu_file.set_handler(:save, method(:command_save)) @menu_file.set_handler(:continue, method(:command_continue)) @menu_file.set_handler(:cancel, method(:command_cancel)) @menu_file.visible = false @menu_file.active = false end #-------------------------------------------------------------------------- # * Criaзгo da janela de dinheiro #-------------------------------------------------------------------------- def create_gold_window x = @command_name.x + @command_name.width y = @command_name.y @gold_window = Window_MenuGold.new(x,y) end #-------------------------------------------------------------------------- # * Criaзгo da janela de atributos #-------------------------------------------------------------------------- def create_status_window x = @command_window.x y = @command_window.y + @command_window.height @status_window = Window_MenuStatus.new(x, y) end def create_time_window y = @status_window.y + @status_window.height x = 0 @window_time = Window_Time.new(x,y) end def create_map_window y = @window_time.y x = @window_time.x + @window_time.width @window_map = Window_MenuMapName.new(x,y) end def update update_basic @command_name.set_text(@command_window.get_name(@command_window.index)) end #-------------------------------------------------------------------------- # * Comando [Item] #-------------------------------------------------------------------------- def command_item SceneManager.call(Scene_Item) end #-------------------------------------------------------------------------- # * Comando [Habilidade] [Equipamentos] [Atributos] #-------------------------------------------------------------------------- def command_personal @status_window.select_last @status_window.activate @status_window.set_handler(:ok, method(:on_personal_ok)) @status_window.set_handler(:cancel, method(:on_personal_cancel)) end #-------------------------------------------------------------------------- # * Comando [Formaзгo] #-------------------------------------------------------------------------- def command_formation @status_window.select_last @status_window.activate @status_window.set_handler(:ok, method(:on_formation_ok)) @status_window.set_handler(:cancel, method(:on_formation_cancel)) end #-------------------------------------------------------------------------- # * Comando [Salvar] #-------------------------------------------------------------------------- def command_save SceneManager.call(Scene_Save) end def command_file @menu_file.visible = true @menu_file.index = 0 @menu_file.activate @menu_file.z = @status_window.z + 1 end def command_cancel @menu_file.unselect @menu_file.visible = false @menu_file.active = false @menu_file.z = @status_window.z - 1 @command_window.active = true end def command_continue SceneManager.call(Scene_Load) end #-------------------------------------------------------------------------- # * Comando [Fim do Jogo] #-------------------------------------------------------------------------- def command_game_end SceneManager.call(Scene_End) end #-------------------------------------------------------------------------- # * Comandos individuais [Confirmaзгo] #-------------------------------------------------------------------------- def on_personal_ok case @command_window.current_symbol when :skill SceneManager.call(Scene_Skill) when :equip SceneManager.call(Scene_Equip) when :status SceneManager.call(Scene_Status) end end #-------------------------------------------------------------------------- # * Comandos individuais [Cancelamento] #-------------------------------------------------------------------------- def on_personal_cancel @status_window.unselect @command_window.activate end #-------------------------------------------------------------------------- # * Mudanзa de Ordem [Confirmaзгo] #-------------------------------------------------------------------------- def on_formation_ok if @status_window.pending_index >= 0 $game_party.swap_order(@status_window.index, @status_window.pending_index) @status_window.pending_index = -1 @status_window.redraw_item(@status_window.index) else @status_window.pending_index = @status_window.index end @status_window.activate end #-------------------------------------------------------------------------- # * Mudanзa de Ordem [Cancelamento] #-------------------------------------------------------------------------- def on_formation_cancel if @status_window.pending_index >= 0 @status_window.pending_index = -1 @status_window.activate else @status_window.unselect @command_window.activate end end end
| |
|