¡Bienvenido a Universo Maker!
¿Es esta la primera vez que visitas el foro? Si es así te recomendamos que te registres para tener completo acceso a todas las áreas y secciones del foro, así también podrás participar activamente en la comunidad. Si ya tienes una cuenta, conectate cuanto antes.
Iniciar Sesión Registrarme

No estás conectado. Conéctate o registrate

Ver el tema anterior Ver el tema siguiente Ir abajo Mensaje [Página 1 de 1.]

#1 [VX Ace] Simple Menu el Mar Ene 10, 2012 11:39 pm

Faye Valentine

avatar
Nombre: Simple Menu
Autor:Nicke

Descripcion: Pues este es un menú bastante simple pero bonito.

Screenshot:







Script:

Código:

#==============================================================================
#  Simple Menu
#  Author: Nicke
#  Created: 29/12/2011
#  Edited: 05/01/2012
#  Version: 1.1a
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
#
# A simple menu script featuring a few functions.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["NICKE-SIMPLE-MENU"] = true

module NICKE
  module MENU
        #--------------------------------------------------------------------------#
        # * Settings
        #--------------------------------------------------------------------------#
        # MENU_FONT = [ name, size, color, bold, shadow ]
        MENU_COLOR = Color.new(255,255,100) # Default: (255,255,255) White.
        MENU_FONT = [["Calibri"], 24, MENU_COLOR, true, true]

        # MENU_WINDOW [ width, x, y, z, opacity]
        MENU_WINDOW = [160, 0, 0, 200, 255]

        # MENU_ALIGNMENT = 0 (left), 1 (center), 2 (right)
        MENU_ALIGNMENT = 0 # Default: 0.

        # Menu list, when adding a new command make sure you add the
        # appropriated method to it on under line 370.
        # You also don't need to specify a icon if you don't need it.
        # MENU_LIST: ID = ['Title', :symbol, :command, icon_index ]
        MENU_LIST = []
        MENU_LIST[0] = ['Item',  :item,          :command_item,        264]
        MENU_LIST[1] = ['Skills', :skill,        :command_personal, 112]
        MENU_LIST[2] = ['Equip',  :equip,        :command_personal, 170]
        MENU_LIST[3] = ['Status', :status,      :command_personal, 122]
        MENU_LIST[4] = ['Party',  :formation, :command_formation,121]
        MENU_LIST[5] = ['Save',  :save,          :command_save,        233]
        MENU_LIST[6] = ['Quit',  :game_end,  :command_game_end, 1]

        # 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(1,:add) # To add id 1 to menu list.
        # menu_scene(3,:del) # To remove id 3 from menu list.
        #
        # In a conditional branch do like this:
        # menu_id?(5) # Returns true if id 5 is in the list.
        #
        # To add/delete every menu item to the list use this method in a script call:
        # menu_scene_all(type = :add/:del)
        #
        # MENU_CUSTOM = true/false
        MENU_CUSTOM = true

        # The text to be disabled if no menu items is available.
        # MENU_EMPTY = ""
        MENU_EMPTY = "Menu not available at this point."

        # Disable all of the icons if you don't need them.
        # ICON_ENABLE = true/false
        ICON_ENABLE = true

        # Gold window.
        # nil to disable the icon.
        # GOLD = [ x, y, z, opacity, icon_index, enabled ]
        GOLD = [0, 368, 101, 255, 361, true]

        # Status window.
        # If you disable status window you can't use formation command.
        # So that command can be removed/commented in MENU_LIST if so.
        # STATUS = [ x, y, z, opacity, enabled ]
        STATUS = [160, 0, 100, 255, false]

        # Transition, nil to use default.
        # TRANSITION [ SPEED, TRANSITION, OPACITY ]
        # TRANSITION = [20, "Graphics/Transitions/1", 50]
        TRANSITION = nil

        # Menu background image (System folder)
        # Note: You might want to decrease the opacity as well as arrange
        # the windows so that you can properly see the background.
        # Set to nil to use default.
        BACK = nil

        # Note: Not active if menu background is in use.
        # Background type:
        # 0 = normal blur (default)
        # 1 = radial blur
        # 2 = hue change
        # 3 = custom color
        # 4 = custom gradient
        # BACK_TYPE = [ type, opacity, enabled ]
        BACK_TYPE = [1, 255, true]
        # BACK_RADIAL_BLUR = 0-360, 2-100
        BACK_RADIAL_BLUR = [10, 10]
        # BACK_HUE = 0-360
        BACK_HUE = 30
        # BACK_COLOR = 0-255 (Red, Green, Blue, Alpha)
        BACK_COLOR = Color.new(255,0,255,128)
        # BACK_GRADIENT = [ Color1, Color2, Vertical ]
        BACK_GRADIENT = [Color.new(0,0,250,128), Color.new(255,0,0,128), true]

  end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Game_System
#==============================================================================#
class Game_System

  attr_accessor :menu_list
  alias nicke_menu_sys_initialize initialize unless $@
  def initialize(*args, &block)
        nicke_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?(NICKE::MENU::MENU_LIST[id])
                $game_system.menu_list.push(NICKE::MENU::MENU_LIST[id])
          end unless NICKE::MENU::MENU_LIST[id].nil?
          when :del # // Remove menu id.
          unless NICKE::MENU::MENU_LIST[id].nil?
                $game_system.menu_list.delete(NICKE::MENU::MENU_LIST[id])
          end
        end
  end

  def menu_scene_all(type = :add)
        # // Method to add or delete all of the id's to the menu list.
        id = 0
        for i in NICKE::MENU::MENU_LIST
          case type
          when :add
                menu_scene(id, :add)
          else
                menu_scene(id, :del)
          end
          id += 1
          break if id == NICKE::MENU::MENU_LIST.size
        end
  end

  def menu_id?(id)
        # // Method to check if a id is in the menu list.
        return $game_system.menu_list.include?(NICKE::MENU::MENU_LIST[id])
  end

end
#==============================================================================#
# ** Window_Icon
#==============================================================================#
class Window_Icon < Window_Base

  def initialize
        super(0, 0, window_width, Graphics.height)
        refresh
  end

  def window_width
        # // Method to return the width of MENU_WINDOW.
        return NICKE::MENU::MENU_WINDOW[0]
  end

  def refresh
        contents.clear
        draw_menu_icon if NICKE::MENU::ICON_ENABLE
  end

  def draw_menu_icon
        # // Draw all of the icons.
        count = 0
        if NICKE::MENU::MENU_CUSTOM
          @menu_list = $game_system.menu_list
        else
          @menu_list = NICKE::MENU::MENU_LIST
        end
        for i in @menu_list
          align = 0
          x = 110
          next if i[3].nil?
          case NICKE::MENU::MENU_ALIGNMENT
          when 1, 2 ; align = -110
          end
          draw_icon(i[3], x + align, 24 * count)
          count += 1
          break if (24 * count > height - 24)
        end
  end

end
#==============================================================================
# ** Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command

  def window_width
        # // Method to return the width of MENU_WINDOW.
        return NICKE::MENU::MENU_WINDOW[0]
  end

  def alignment
        # // Method to return the alignment.
        return NICKE::MENU::MENU_ALIGNMENT
  end

  def item_rect_for_text(index)
        # // Method to draw the item with text.
        contents.font.name = NICKE::MENU::MENU_FONT[0]
        contents.font.size = NICKE::MENU::MENU_FONT[1]
        contents.font.color = NICKE::MENU::MENU_FONT[2]
        contents.font.bold = NICKE::MENU::MENU_FONT[3]
        contents.font.shadow = NICKE::MENU::MENU_FONT[4]
        rect = item_rect(index)
        rect.x += 4
        rect.width -= 8
        rect
  end

  def make_command_list
        # // Method to add the commands.
        if NICKE::MENU::MENU_CUSTOM
          @menu_list = $game_system.menu_list
        else
          @menu_list = NICKE::MENU::MENU_LIST
        end
        for i in @menu_list
          case i[1]
          when :save
          add_command(i[0], i[1], save_enabled)
          when :formation
                if NICKE::MENU::STATUS[4]
                  add_command(i[0], i[1], true)
                else
                  add_command(i[0], i[1], false)
          end
          else
          add_command(i[0], i[1])
          end
        end

  end
end
#==============================================================================#
# ** Window_Gold
#==============================================================================#
class Window_Gold < Window_Base

  def refresh
        # // Refresh method override, draw a icon and the value.
        contents.clear
        if NICKE::MENU::ICON_ENABLE and !NICKE::MENU::GOLD[4].nil?
          draw_icon(NICKE::MENU::GOLD[4], 116, -2)
          draw_currency_value(value, currency_unit, -10, 0, contents.width - 8)
        else
          # // Default:
          draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
        end
  end

end
#==============================================================================#
# ** Scene_Menu
#------------------------------------------------------------------------------
#  New Scene :: Scene_Menu
#==============================================================================#
class Scene_Menu < Scene_MenuBase

  def start
        super
        if NICKE::MENU::MENU_CUSTOM
          @menu_list = $game_system.menu_list
        else
          @menu_list = NICKE::MENU::MENU_LIST
        end
        return command_map if @menu_list.empty?
        create_icon_window
        create_command_window
        create_gold_window if NICKE::MENU::GOLD[5]
        create_status_window if NICKE::MENU::STATUS[4]
  end

  def create_icon_window
        # // Method to create the icon window.
        @command_icon = Window_Icon.new
        @command_icon.x = NICKE::MENU::MENU_WINDOW[1]
        @command_icon.y = NICKE::MENU::MENU_WINDOW[2]
        @command_icon.z = 201
        @command_icon.opacity = 0
  end

  def create_command_window
        # // Method to create the command window.
        @command_window = Window_MenuCommand.new
        @command_window.x = NICKE::MENU::MENU_WINDOW[1]
        @command_window.y = NICKE::MENU::MENU_WINDOW[2]
        @command_window.z = NICKE::MENU::MENU_WINDOW[3]
        @command_window.opacity = NICKE::MENU::MENU_WINDOW[4]
        for i in @menu_list
          case i[1]
          when :status
          if !NICKE::MENU::STATUS[4]
                @command_window.set_handler(i[1], method(:command_status))
          else
                @command_window.set_handler(i[1], method(i[2]))
          end
          when :skill
          if !NICKE::MENU::STATUS[4]
                @command_window.set_handler(i[1], method(:command_skill))
          else
                @command_window.set_handler(i[1], method(i[2]))
          end
          when :equip
          if !NICKE::MENU::STATUS[4]
                @command_window.set_handler(i[1], method(:command_equip))
          else
                @command_window.set_handler(i[1], method(i[2]))
          end
          else
          @command_window.set_handler(i[1], method(i[2]))
          end
        end
        @command_window.set_handler(:cancel, method(:return_scene))
  end

  def create_message_window
        @message_window = Window_Message.new
  end

  def create_gold_window
        # // Method to create the gold window.
        @gold_window = Window_Gold.new
        @gold_window.x = NICKE::MENU::GOLD[0]
        @gold_window.y = NICKE::MENU::GOLD[1] # Default: Graphics.height - @gold_window.height
        @gold_window.z = NICKE::MENU::GOLD[2]
        @gold_window.opacity = NICKE::MENU::GOLD[3]
  end

  def create_status_window
        # // Method to create the status window.
        @status_window = Window_MenuStatus.new(NICKE::MENU::STATUS[0], NICKE::MENU::STATUS[1])
        @status_window.z = NICKE::MENU::STATUS[2]
        @status_window.opacity = NICKE::MENU::STATUS[3]
  end

  # // ########################################
  # // Add your new commands under this:
  # def command_yourname
  #  SceneManager.call(Scene_YourScene)
  # 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_map
        # // command_map (don't remove)
        create_message_window
        $game_message.texts << NICKE::MENU::MENU_EMPTY
        SceneManager.call(Scene_Map)
  end

end
#==============================================================================#
# ** Scene_MenuBase
#------------------------------------------------------------------------------
#  New Scene :: Scene_MenuBase
#==============================================================================#
class Scene_MenuBase < Scene_Base

  alias nicke_menubase_start start unless $@
  def start(*args, &block)
        nicke_menubase_start(*args, &block)
        create_menu_background
  end

  alias nicke_menubase_terminate terminate unless $@
  def terminate(*args, &block)
        nicke_menubase_terminate(*args, &block)
  end


  def create_menu_background
        # // Method to create custom background
        @menu_sprite = Sprite.new
        if NICKE::MENU::BACK.nil?
          @menu_sprite.bitmap = SceneManager.background_bitmap
          if NICKE::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 NICKE::MENU::BACK_TYPE[0]
                when 0 ; bitmap.blur # // Default
                when 1 ; bitmap.radial_blur(NICKE::MENU::BACK_RADIAL_BLUR[0], NICKE::MENU::BACK_RADIAL_BLUR[0])
                when 2 ; bitmap.hue_change(NICKE::MENU::BACK_HUE)
                when 3 ; bitmap.fill_rect(bitmap.rect, NICKE::MENU::BACK_COLOR)
                when 4 ; bitmap.gradient_fill_rect(bitmap.rect, NICKE::MENU::BACK_GRADIENT[0],
                                NICKE::MENU::BACK_GRADIENT[1], NICKE::MENU::BACK_GRADIENT[2])
                end
                @menu_sprite.opacity = NICKE::MENU::BACK_TYPE[1]
                @menu_sprite.bitmap = bitmap
          end
        else
          @menu_sprite.bitmap = Cache.system(NICKE::MENU::BACK)
        end
  end

  def perform_transition
        # // Method to create the transition.
        if NICKE::MENU::TRANSITION.nil?
          Graphics.transition(15)
        else
          Graphics.transition(NICKE::MENU::TRANSITION[0],NICKE::MENU::TRANSITION[1],NICKE::MENU::TRANSITION[2])
        end
  end

end # END OF FILE

#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#

#2 Re: [VX Ace] Simple Menu el Sáb Sep 08, 2012 1:29 pm

davidaikago

avatar
me pone:

menu not available at this point

Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

Permisos de este foro:
No puedes responder a temas en este foro.