Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Default menu screen to DSi System
- &beta
- =end
- Ligni.register(:dsi_menu, "dax", 0.1, [[:dsi, "dax"]]) {
- #==============================================================================
- # ** Window_MenuStatus
- #------------------------------------------------------------------------------
- # Esta janela exibe os parâmetros dos membros do grupo na tela de menu.
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- def initialize(x, y, ih=nil)
- super(x, y, window_width, window_height)
- @pending_index = -1
- @ih = ih
- refresh
- end
- def window_width
- DS.screen.width
- end
- #--------------------------------------------------------------------------
- # * Aquisição da altura da janela
- #--------------------------------------------------------------------------
- def window_height
- DS.screen.height
- end
- #--------------------------------------------------------------------------
- # * Aquisição de altura do item
- #--------------------------------------------------------------------------
- def item_height
- return @ih.nil? ? (height - standard_padding * 2) / 4 : @ih
- end
- #--------------------------------------------------------------------------
- # * Desenho de um item
- # index : índice do item
- #--------------------------------------------------------------------------
- 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_face(actor, rect.x + 1, rect.y + 2, enabled, 96, 96, 0.45)
- contents.font.size = 16
- draw_text(rect.x + 50, rect.y - 2, 96, 24, actor.name.to_s)
- draw_actor_level(actor, rect.x + 196, rect.y - 2)
- draw_actor_hp(actor, rect.x + 50, rect.y+16, 48)
- draw_actor_mp(actor, rect.x + 112, rect.y+16, 48)
- draw_actor_icons(actor, rect.x + 160, rect.y+16)
- end
- end
- # menu
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Adição dos comandos principais
- #--------------------------------------------------------------------------
- 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)
- end
- end
- # [Menu]
- class Scene_Menu < Scene_MenuBase
- # start
- def start
- Window_MenuCommand::init_command_position
- $game_system.default_background = DS::SETUP[:MENU][:BACKGROUND]
- super
- create_command_window
- create_status_window
- create_gold_window
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de dinheiro
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 0
- end
- 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(:formation, method(:command_formation))
- @command_window.set_handler(:save, method(:command_save))
- @command_window.set_handler(:game_end, method(:command_game_end))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.height = 164
- @command_window.position(1)
- @command_window.y = DS.screen.height + ( (DS.screen.height - @command_window.height) / 2 )
- @command_window.z = DS.screen.z + 2
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de atributos
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_MenuStatus.new(0, 0)
- @status_window.z = DS.screen.z + 1
- @status_window.y = DS.screen.height
- @status_window.visible = false
- end
- def command_personal
- Graphics.wait(5)
- @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
- def command_save
- SceneManager.call(Scene_DSSave)
- end
- # terminate
- def terminate
- super
- end
- # update
- def update
- super
- @status_window.visible = @status_window.active
- @command_window.visible = !@status_window.visible
- end
- end
- # [End]
- class Scene_End
- #--------------------------------------------------------------------------
- # * Criação da janela de comando
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_GameEnd.new
- @command_window.set_handler(:to_title, method(:command_to_title))
- @command_window.set_handler(:shutdown, method(:command_shutdown))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.position(1)
- @command_window.y = DS.screen.height + ( (DS.screen.height - @command_window.height) / 2 )
- @command_window.z = DS.screen.z + 2
- end
- end
- #==============================================================================
- # ** Window_Gold
- #------------------------------------------------------------------------------
- # Esta janela exibe a quantia de dinheiro.
- #==============================================================================
- class Window_Gold < Window_Base
- #--------------------------------------------------------------------------
- # * Aquisição da largura da janela
- #--------------------------------------------------------------------------
- def window_width
- return DS.screen.width
- end
- #--------------------------------------------------------------------------
- # * Renovação
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- contents.draw_icon(361, 0, 0)
- contents.draw_text(28, -12, 96, self.height, sprintf("%d %s", value, currency_unit))
- contents.draw_text(-28, -12, self.width, self.height, $game_map.display_name.to_s, 2)
- end
- end
- Ligni.remove(:Window_ItemCategory)
- class Window_ItemCategory < Window_Command
- #--------------------------------------------------------------------------
- # * Variáveis públicas
- #--------------------------------------------------------------------------
- attr_reader :item_window
- #--------------------------------------------------------------------------
- # * Inicialização do objeto
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- self.z = DS.screen.z + 100
- end
- #--------------------------------------------------------------------------
- # * Aquisição da largura da janela
- #--------------------------------------------------------------------------
- def window_width
- 164
- end
- #--------------------------------------------------------------------------
- # * Aquisição do número de colunas
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # * Atualização da tela
- #--------------------------------------------------------------------------
- def update
- super
- @item_window.category = current_symbol if @item_window
- end
- #--------------------------------------------------------------------------
- # * Criação da lista de comandos
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::item, :item)
- add_command(Vocab::weapon, :weapon)
- add_command(Vocab::armor, :armor)
- add_command(Vocab::key_item, :key_item)
- end
- #--------------------------------------------------------------------------
- # * Definição da janela de itens
- # item_window : janela de itens
- #--------------------------------------------------------------------------
- def item_window=(item_window)
- @item_window = item_window
- update
- end
- end
- # item
- class Scene_Item < Scene_ItemBase
- alias :ds_start :start
- def start
- ds_start
- @help_window.visible = @item_window.visible = !@actor_window.visible
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de categorias
- #--------------------------------------------------------------------------
- def create_category_window
- @category_window = Window_ItemCategory.new
- @category_window.position(1)
- @category_window.y = DS.screen.height + ( (DS.screen.height - @category_window.height) / 2 )
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- @help_window.z = DS.screen.z + 1
- @category_window.z = DS.screen.z + 1
- @help_window.y = DS.screen.height - @help_window.height
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de itens
- #--------------------------------------------------------------------------
- def create_item_window
- @item_window = Window_ItemList.new(0, 0, Graphics.width, DS.screen.height-@help_window.height)
- @item_window.z = DS.screen.z + 1
- @item_window.help_window = @help_window
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @category_window.item_window = @item_window
- end
- def update
- super
- @help_window.visible = @item_window.visible = !@actor_window.visible
- end
- end
- class Window_SkillStatus < Window_Base
- #--------------------------------------------------------------------------
- # * Inicialização do objeto
- # x : coordenada X
- # y : coordenada Y
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x, y, window_width, fitting_height(2))
- @actor = nil
- end
- #--------------------------------------------------------------------------
- # * Aquisição da largura da janela
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width
- end
- #--------------------------------------------------------------------------
- # * Renovação
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- return unless @actor
- draw_actor_face(@actor, 1, 2, true, 96, 96, 0.45)
- contents.font.size = 16
- draw_text(50, 2, 96, 24, @actor.name.to_s)
- draw_actor_level(@actor, 196, 2)
- draw_actor_hp(@actor, 50, 16, 48)
- draw_actor_mp(@actor, 112, 16, 48)
- draw_actor_icons(@actor, 160, 16)
- end
- end
- # [ Skill ]
- class Scene_Skill < Scene_ItemBase
- alias :ds_start :start
- def start
- ds_start
- @help_window.visible = @item_window.active
- @status_window.visible = !@help_window.visible
- @command_window.visible = !@actor_window.visible
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de comando
- #--------------------------------------------------------------------------
- def create_command_window
- wy = @help_window.height
- @command_window = Window_SkillCommand.new(0, wy)
- @command_window.help_window = @help_window
- @command_window.actor = @actor
- @command_window.set_handler(:skill, method(:command_skill))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- @command_window.z = DS.screen.z + 1
- @command_window.position 1
- @command_window.y = DS.screen.height + ( (DS.screen.height - @command_window.height) / 2 )
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de atributos
- #--------------------------------------------------------------------------
- def create_status_window
- y = DS.screen.height - @help_window.height
- @status_window = Window_SkillStatus.new(0, y)
- @status_window.actor = @actor
- @status_window.visible = false
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de itens
- #--------------------------------------------------------------------------
- def create_item_window
- @item_window = Window_SkillList.new(0, 0, Graphics.width, DS.screen.height-@help_window.height)
- @item_window.actor = @actor
- @item_window.help_window = @help_window
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @command_window.skill_window = @item_window
- @item_window.z = DS.screen.z + 1
- @help_window.y = DS.screen.height - @help_window.height
- @actor_window.z = @item_window.z
- @actor_window.y = DS.screen.height
- end
- def update
- super
- @help_window.visible = @item_window.active
- @status_window.visible = !@help_window.visible
- @command_window.visible = !@actor_window.visible
- end
- end
- # [equip command]
- Ligni.remove(:Window_EquipCommand)
- class Window_EquipCommand < Window_Command
- #--------------------------------------------------------------------------
- # * Inicialização do objeto
- # x : coordenada X
- # y : coordenada Y
- # width : largura
- #--------------------------------------------------------------------------
- def initialize(x, y, width)
- @window_width = width
- super(x, y)
- end
- #--------------------------------------------------------------------------
- # * Aquisição da largura da janela
- #--------------------------------------------------------------------------
- def window_width
- @window_width
- end
- #--------------------------------------------------------------------------
- # * Criação da lista de comandos
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::equip2, :equip)
- add_command(Vocab::optimize, :optimize)
- add_command(Vocab::clear, :clear)
- end
- end
- # [Equip]
- class Scene_Equip < Scene_MenuBase
- alias :ds_start :start
- def start
- ds_start
- @slot_window.visible = !@item_window.active
- @help_window.visible = @item_window.active
- @status_window.visible = @help_window.visible
- @item_window.visible = @item_window.active
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de atributos
- #--------------------------------------------------------------------------
- def create_status_window
- @status_window = Window_EquipStatus.new(0, @help_window.height)
- @status_window.z = DS.screen.z+1
- @status_window.actor = @actor
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de comando
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_EquipCommand.new(0, 0, 164)
- @command_window.position 1
- @command_window.y = DS.screen.height + ( (DS.screen.height - @command_window.height) / 2 )
- @command_window.z = DS.screen.z + 1
- @command_window.help_window = @help_window
- @command_window.set_handler(:equip, method(:command_equip))
- @command_window.set_handler(:optimize, method(:command_optimize))
- @command_window.set_handler(:clear, method(:command_clear))
- @command_window.set_handler(:cancel, method(:return_scene))
- @command_window.set_handler(:pagedown, method(:next_actor))
- @command_window.set_handler(:pageup, method(:prev_actor))
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de slots
- #--------------------------------------------------------------------------
- def create_slot_window
- @slot_window = Window_EquipSlot.new(0, 0, DS.screen.width)
- @slot_window.z = DS.screen.z + 1
- @slot_window.help_window = @help_window
- @slot_window.status_window = @status_window
- @slot_window.actor = @actor
- @slot_window.set_handler(:ok, method(:on_slot_ok))
- @slot_window.set_handler(:cancel, method(:on_slot_cancel))
- end
- #--------------------------------------------------------------------------
- # * Criação da janela de item
- #--------------------------------------------------------------------------
- def create_item_window
- @item_window = Window_EquipItem.new(0, DS.screen.height, DS.screen.width, DS.screen.height)
- @item_window.z = DS.screen.z + 1
- @item_window.help_window = @help_window
- @item_window.status_window = @status_window
- @item_window.actor = @actor
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @slot_window.item_window = @item_window
- end
- def update
- super
- @slot_window.visible = !@item_window.active
- @help_window.visible = @item_window.active
- @status_window.visible = @help_window.visible
- @item_window.visible = @item_window.active
- end
- end
- # file
- class Window_File < Window_Command
- #--------------------------------------------------------------------------
- # * Aquisição da altura da janela
- #--------------------------------------------------------------------------
- def window_height
- fitting_height(4)
- end
- #--------------------------------------------------------------------------
- # * Aquisição da largura da janela
- #--------------------------------------------------------------------------
- def window_width
- return 164
- end
- #--------------------------------------------------------------------------
- # * Criação da lista de comandos
- #--------------------------------------------------------------------------
- def make_command_list
- (0..DataManager.savefile_max).each { |index|
- next if index.nil?
- text = FileTest.exist?(sprintf("Save%02d.rvdata2", index + 1)) ? "Saved [%02d]" : "Save [%02d]"
- add_command(sprintf(text, index), :file)
- }
- end
- end
- # [save]
- class Scene_DSSave < Scene_MenuBase
- def start
- super
- @window_save = Window_File.new(0, 0)
- @window_save.z = DS.screen.z + 1
- @window_save.position(1)
- @window_save.y = DS.screen.height + ( (DS.screen.height - @window_save.height) / 2 )
- @window_save.set_handler(:file, method(:save))
- @window_save.set_handler(:cancel, method(:return_scene))
- end
- def save
- if DataManager.save_game(@window_save.index)
- Sound.play_save
- return_scene
- end
- end
- def update
- super
- end
- end
- # [load]
- class Scene_DSLoad < Scene_MenuBase
- def start
- super
- @window_save = Window_File.new(0, 0)
- @window_save.z = DS.screen.z + 1
- @window_save.position(1)
- @window_save.y = DS.screen.height + ( (DS.screen.height - @window_save.height) / 2 )
- @window_save.set_handler(:file, method(:load))
- @window_save.set_handler(:cancel, method(:return_scene))
- end
- def load
- if DataManager.load_game(@window_save.index)
- Sound.play_load
- fadeout_all
- $game_system.on_after_load
- SceneManager.goto(Scene_Map)
- else
- Sound.play_buzzer
- end
- end
- end
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement