Illusionniste Lv.12
Age : 31 Inscrit le : 20/03/2009 Messages : 734
| Sujet: [VX] Nouvelle interface du magasin Jeu 25 Juin 2009 - 22:19 | |
| Bon voilà un petit script qui permet de changer le menu de magasin Auteur: Guilherme GPScreen IG: Utilisation:A insérer sous Materials - Code:
-
#============================================================================== # Gui_shop #------------------------------------------------------------------------------ # Uma nova loja com meu nome para você não esquecer de dar créditos no seu jogo #============================================================================== class Scene_Shop < Scene_Base #-------------------------------------------------------------------------- # Inicialização do processo #-------------------------------------------------------------------------- def start super create_menu_background create_command_window @help_window = Window_Help.new @help_window.active = false @help_window.visible = false @gold_window = Window_Gold.new(385, 360) @dummy_window = Window_Base.new(255, 55, 289, 305) @dummy_window.active = false @dummy_window.visible = false @buy_window = Window_ShopBuy.new(255, 55) @buy_window.width = 289 @buy_window.height = 305 @buy_window.active = false @buy_window.visible = false @buy_window.help_window = @help_window @sell_window = Window_ShopSell.new(255, 55, 289, 305) @sell_window.active = false @sell_window.visible = false @sell_window.help_window = @help_window @number_window = Window_ShopNumber.new(245, 55) @number_window.height = 305 @number_window.active = false @number_window.visible = false @status_window = Window_ShopStatus.new(0, 55) @status_window.width = 245 @status_window.height = 361 @status_window.visible = false end #-------------------------------------------------------------------------- # Fim do processo #-------------------------------------------------------------------------- def terminate super dispose_menu_background dispose_command_window @help_window.dispose @gold_window.dispose @dummy_window.dispose @buy_window.dispose @sell_window.dispose @number_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # Atualização #-------------------------------------------------------------------------- def update super update_menu_background @help_window.update @command_window.update @gold_window.update @dummy_window.update @buy_window.update @sell_window.update @number_window.update @status_window.update if @command_window.active update_command_selection elsif @buy_window.active update_buy_selection elsif @sell_window.active update_sell_selection elsif @number_window.active update_number_input end end #-------------------------------------------------------------------------- # Criação da janela de comandos #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::ShopBuy s2 = Vocab::ShopSell s3 = Vocab::ShopCancel @command_window = Window_Command.new(130, [s1, s2, s3]) @command_window.y = 360 @command_window.x = 255 @command_window.height = 57 if $game_temp.shop_purchase_only @command_window.draw_item(1, false) end end #-------------------------------------------------------------------------- # Dispose da janela de comandos #-------------------------------------------------------------------------- def dispose_command_window @command_window.dispose end #-------------------------------------------------------------------------- # Atualização da seleção de comando #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) case @command_window.index when 0 # Comprar Sound.play_decision @help_window.visible = true @command_window.active = false @dummy_window.visible = false @buy_window.active = true @buy_window.visible = true @buy_window.refresh @status_window.visible = true when 1 # Vender if $game_temp.shop_purchase_only Sound.play_buzzer else Sound.play_decision @help_window.visible = true @command_window.active = false @dummy_window.visible = false @sell_window.active = true @sell_window.visible = true @sell_window.refresh end when 2 # Sair Sound.play_decision $scene = Scene_Map.new end end end #-------------------------------------------------------------------------- # Atualização da seleção: Comprar #-------------------------------------------------------------------------- def update_buy_selection @status_window.item = @buy_window.item if Input.trigger?(Input::B) Sound.play_cancel @help_window.visible = false @command_window.active = true @dummy_window.visible = false @buy_window.active = false @buy_window.visible = false @status_window.visible = false @status_window.item = nil @help_window.set_text("") return end if Input.trigger?(Input::C) @item = @buy_window.item number = $game_party.item_number(@item) if @item == nil or @item.price > $game_party.gold or number == 99 Sound.play_buzzer else Sound.play_decision max = @item.price == 0 ? 99 : $game_party.gold / @item.price max = [max, 99 - number].min @buy_window.active = false @buy_window.visible = false @number_window.set(@item, max, @item.price) @number_window.active = true @number_window.visible = true end end end #-------------------------------------------------------------------------- # Atualizaão da seleção: Vender #-------------------------------------------------------------------------- def update_sell_selection if Input.trigger?(Input::B) Sound.play_cancel @help_window.visible = false @command_window.active = true @dummy_window.visible = false @sell_window.active = false @sell_window.visible = false @status_window.item = nil @help_window.set_text("") elsif Input.trigger?(Input::C) @item = @sell_window.item @status_window.item = @item if @item == nil or @item.price == 0 Sound.play_buzzer else Sound.play_decision max = $game_party.item_number(@item) @sell_window.active = false @sell_window.visible = false @number_window.set(@item, max, @item.price / 2) @number_window.active = true @number_window.visible = true @status_window.visible = true end end end #-------------------------------------------------------------------------- # Atualização do número inserido #-------------------------------------------------------------------------- def update_number_input if Input.trigger?(Input::B) cancel_number_input elsif Input.trigger?(Input::C) decide_number_input end end #-------------------------------------------------------------------------- # Cancelamento do número inserido #-------------------------------------------------------------------------- def cancel_number_input Sound.play_cancel @number_window.active = false @number_window.visible = false case @command_window.index when 0 # Comprando @buy_window.active = true @buy_window.visible = true when 1 # Vendendo @sell_window.active = true @sell_window.visible = true @status_window.visible = false end end #-------------------------------------------------------------------------- # Decisão do número inserido #-------------------------------------------------------------------------- def decide_number_input Sound.play_shop @number_window.active = false @number_window.visible = false case @command_window.index when 0 # Comprando $game_party.lose_gold(@number_window.number * @item.price) $game_party.gain_item(@item, @number_window.number) @gold_window.refresh @buy_window.refresh @status_window.refresh @buy_window.active = true @buy_window.visible = true when 1 # Vendendo $game_party.gain_gold(@number_window.number * (@item.price / 2)) $game_party.lose_item(@item, @number_window.number) @gold_window.refresh @sell_window.refresh @status_window.refresh @sell_window.active = true @sell_window.visible = true @status_window.visible = false end end end |
|
Illusionniste Lv.12
Age : 28 Inscrit le : 29/03/2008 Messages : 673
| Sujet: Re: [VX] Nouvelle interface du magasin Ven 26 Juin 2009 - 5:29 | |
| Ouah ! Très joli ! Merci beaucoup du partage =D |
|
Mage Lv.11
Age : 29 Inscrit le : 21/03/2009 Messages : 508
| Sujet: Re: [VX] Nouvelle interface du magasin Ven 26 Juin 2009 - 6:29 | |
| |
|
Seigneur Lv.18
Age : 29 Avertissements : 3 Inscrit le : 20/12/2008 Messages : 2292
| Sujet: Re: [VX] Nouvelle interface du magasin Ven 26 Juin 2009 - 12:58 | |
| Merci du partage ^^ |
|
Maître du destin
Age : 28 Inscrit le : 05/11/2008 Messages : 2955
| Sujet: Re: [VX] Nouvelle interface du magasin Ven 26 Juin 2009 - 13:50 | |
| C'est très clean, merci pour le script! |
|
| Sujet: Re: [VX] Nouvelle interface du magasin | |
| |
|