O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

Gab OnScreen Shop

Iniciado por Raizen, 18/12/2012 às 19:49

[box class=titlebg2]
Gab OnScreen Shop
[/box]

[box class=catbg]Introdução:[/box]
[box class=randomquote]Fazendo um pedido do [user]-Leon.[/user]. Faz com que o menu de shop apareça no mapa (que estará animado, dependendo da configuração), além de ter um novo visual. É baseado On Screen Shop, do Woratana.[/box]

[box class=catbg]Características:[/box]
[box class=randomquote]- Simples
- Customizável
- Plug 'n Play
[/box]

[box class=catbg]Screenshots:[/box]
[box class=randomquote]

Spoiler
[close]
Spoiler
[close]
Spoiler
[close]
Spoiler
[close]
Spoiler
[close]
Spoiler
[close]
[/box]

[box class=catbg]Como usar:[/box]
[box class=randomquote]- Coloque o script acima do Main
- Configure; no começo do script
[/box]

[box class=catbg]Script:[/box]
[box class=randomquote]
#===========================================================================
# Gab! On Screen Shop
#-------------------------------------------------------------------------
# Autor: Gab!
# Data:  10/10/12
#-------------------------------------------------------------------------
# Cria o shop no mapa, alterando também seu visual
#===========================================================================

class Scene_Shop
  #===========================================================================
  # ** CONFIGURAÇÃO
  #===========================================================================
  
  USE_SPRITESET = true # Usar mapa real como fundo? (Animado)
  
  #===========================================================================
  # ** FIM DA CONFIGURAÇÃO
  #===========================================================================

  if (USE_SPRITESET)
    alias gab_onscreen_shop_update update
    
    def update(*args)
      @spriteset.update
      gab_onscreen_shop_update(*args)
    end
    
    def create_background
      @spriteset = Spriteset_Map.new
    end
    
    def dispose_background
      @spriteset.dispose
    end
  end
  
  def create_help_window
    @help_window = Window_Help.new
    @help_window.viewport = @viewport
    @help_window.hide
  end
  
  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.viewport = @viewport
    
    @gold_window.x = Graphics.width - @gold_window.width - 32
    @gold_window.y = Graphics.height - @gold_window.height - 32
  end
  
  def create_command_window
    @command_window = Window_ShopCommand.new(125, @purchase_only)
    @command_window.viewport = @viewport
    
    @command_window.x = 32
    @command_window.y = Graphics.height - @command_window.height - 32
    
    @command_window.set_handler(:buy,    method(:command_buy))
    @command_window.set_handler(:sell,   method(:command_sell))
    @command_window.set_handler(:cancel, method(:return_scene))
  end
  
  def create_sell_window
    wy = @category_window.y + @category_window.height
    wh = (Graphics.height - wy) / 2
    @sell_window = Window_ShopSell.new(0, wy, Graphics.width, wh)
    @sell_window.viewport = @viewport
    @sell_window.help_window = @help_window
    @sell_window.hide
    @sell_window.set_handler(:ok,     method(:on_sell_ok))
    @sell_window.set_handler(:cancel, method(:on_sell_cancel))
    @category_window.item_window = @sell_window
  end
  
  def create_dummy_window
    wy = @help_window.y + @help_window.height
    wh = (Graphics.height - wy) / 2
    @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
    @dummy_window.viewport = @viewport
    @dummy_window.hide
  end
  
  def command_buy
    @help_window.show
    activate_buy_window
  end
  
  def command_sell
    @help_window.show
    @category_window.show.activate
    @sell_window.show
    @sell_window.unselect
    @sell_window.refresh
  end
  
  def on_buy_cancel
    @command_window.activate
    @buy_window.hide
    @status_window.hide
    @status_window.item = nil
    @help_window.clear
    @help_window.hide
  end
  
  def on_category_cancel
    @command_window.activate
    @help_window.hide
    @category_window.hide
    @sell_window.hide
  end
end

Object.send(:remove_const, :Window_ShopCommand)
class Window_ShopCommand < Window_Command
  
  def initialize(window_width, purchase_only)
    @window_width = window_width
    @purchase_only = purchase_only
    super(0, 0)
  end
  
  def window_width
    @window_width
  end
  
  def col_max
    return 1
  end
  
  def make_command_list
    add_command(Vocab::ShopBuy,    :buy)
    add_command(Vocab::ShopSell,   :sell,   !@purchase_only)
    add_command(Vocab::ShopCancel, :cancel)
  end
end

[/box]

[box class=catbg]Créditos e Considerações finais:[/box]
[box class=randomquote][user]Gab![/user] - Criação do Script
Qualquer dúvida de como usar, procurem-me no msn (gab.teles@hotmail.com) ou por PM.
[/box]