|
| Auteur | Message |
---|
Hareck Paysan (niveau 4)
Messages postés : 38 Date d'inscription : 10/10/2013 Jauge LPC :
| Sujet: Ring Menu Personnalisé Jeu 10 Oct 2013 - 21:23 | |
| Bonjour! Alors voila, j'ai modifié le script "Ring Menu". J'ai supprimé l'option de sauvegarde, et viré le gameover. Tout fonctionne à merveille, SAUF un petit truc un peu gênant : Les objets (bug qui date depuis la suppression de l'option de sauvegarde, donc j'ai surement oublié quelque chose quelque part) Déjà, voici le script modifié: - Code:
-
=begin Script Criado por DouglasMF das comunidades VilaMakers Online e RPG Maker Brasil Com base no script Ring Menu feito por XRXS, Dubealex e Hypershadow180
--Inscruction-- Pour installer ce script, mettez le au dessus de Main
=end #============================================================================== # Scene_Menu #------------------------------------------------------------------------------ # Esta classe controla o conjunto de objetos que forma o RingMenu #==============================================================================
#=============================================================== # # www.rpgmakervx-fr.com # #===============================================================
class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # Initialisation #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # Initialise les objets du menu #-------------------------------------------------------------------------- def start super @spriteset = Spriteset_Map.new @gold_window = Window_Gold.new @gold_window.y = Graphics.height - @gold_window.height @gold_window.opacity = 0 $local_show = true @map_name_window = Window_MapName.new @map_name_window.open @status_window = Window_MenuStatus.new(160, 0) px = $game_player.screen_x - 16 py = $game_player.screen_y - 28 @ring_menu = Window_RingMenu_Comando.new(px,py) @status_window.z = @ring_menu.z + 20 @status_window.visible = false end #-------------------------------------------------------------------------- # Ferme les objets du menu #-------------------------------------------------------------------------- def terminate super @spriteset.dispose @ring_menu.dispose @gold_window.dispose @map_name_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # Actualise les objets du menu #-------------------------------------------------------------------------- def update super @ring_menu.update @gold_window.update @map_name_window.update @spriteset.update @status_window.update if @ring_menu.active update_command_selection elsif @status_window.active update_actor_selection end if @status_window.active $shift = 1 else $shift = 0 end end
#-------------------------------------------------------------------------- # Actualisation des commandes et sélection menu #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $local_show = false SceneManager.call(Scene_Map) elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @ring_menu.index < 4 Sound.play_buzzer return end Sound.play_ok case @ring_menu.indice when 0 SceneManager.call(Scene_Item) when 1,2,3 command_personal when 4 SceneManager.call(Scene_End) end end if Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP) Sound.play_cursor @ring_menu.girar(3) return end if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN) Sound.play_cursor @ring_menu.girar(4) return end end
#-------------------------------------------------------------------------- def command_personal @ring_menu.active = false @status_window.visible = true @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 on_personal_cancel @status_window.unselect @status_window.visible = false @ring_menu.active = true end #-------------------------------------------------------------------------- # choix perso ok #-------------------------------------------------------------------------- def on_personal_ok case @ring_menu.indice when 1 SceneManager.call(Scene_Skill) when 2 SceneManager.call(Scene_Equip) when 3 SceneManager.call(Scene_Status) end end #-------------------------------------------------------------------------- # Termine la selection du chara #-------------------------------------------------------------------------- def end_actor_selection @ring_menu.active = true @status_window.active = false @status_window.visible = false @status_window.index = -1 end #-------------------------------------------------------------------------- # Actualisation sélection chara #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) Sound.play_ok case @ring_menu.indice when 1 SceneManager.call(Scene_Skill) when 2 SceneManager.call(Scene_Equip) when 3 SceneManager.call(Scene_Status) end end end end
#============================================================================== # Window_RingMenu_Comando #------------------------------------------------------------------------------ # Cette classe crée le RingMenu #==============================================================================
class Window_RingMenu_Comando < Window_Base DurIni = 30 DurMov = 15 RaioAnel = 64 ModoIni = 1 ModoEsp = 2 ModoMD = 3 ModoME = 4 SE_Inicio = "" attr_accessor :indice #-------------------------------------------------------------------------- # Initialisation objets #-------------------------------------------------------------------------- def initialize(centro_x,centro_y) super(0, 0, 544, 416) self.opacity = 0 self.contents.font.size = 16 s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::game_end @item_name = [s1,s2,s3,s4,s5] @item_max = 5 @item_icon = [260,112,170,121,1] @item_hab = [true,true,true,true,true] @indice = 0 @cx = centro_x - 12 @cy = centro_y - 12 inicia_menu refresh end #-------------------------------------------------------------------------- # Actualisation objets #-------------------------------------------------------------------------- def update super refresh end #-------------------------------------------------------------------------- # Actualisation objets #-------------------------------------------------------------------------- def refresh self.contents.clear case @modo when ModoIni refresh_inicio when ModoEsp refresh_espera when ModoMD refresh_mover(1) when ModoME refresh_mover(0) end sw = self.contents.width rect = Rect.new((@cx - ((sw-32)/2))+12, @cy - 40, sw-32, 32) self.contents.draw_text(rect, @item_name[@indice],1) end #-------------------------------------------------------------------------- # Ouvre le menu #-------------------------------------------------------------------------- def refresh_inicio d1 = 2.0 * Math::PI / @item_max d2 = 1.0 * Math::PI / DurIni r = RaioAnel - 1.0 * RaioAnel * @passos / DurIni for i in 0...@item_max j = i - @indice d = d1 * j + d2 * @passos x = @cx + ( r * Math.sin( d ) ).to_i y = @cy - ( r * Math.cos( d ) ).to_i desenha_item(x, y, i) end @passos -= 1 if @passos < 1 @modo = ModoEsp end end #-------------------------------------------------------------------------- # Actualisation menu #-------------------------------------------------------------------------- def refresh_espera d = 2.0 * Math::PI / @item_max for i in 0...@item_max j = i - @indice x = @cx + ( RaioAnel * Math.sin( d * j ) ).to_i y = @cy - ( RaioAnel * Math.cos( d * j ) ).to_i desenha_item(x, y, i) end end #-------------------------------------------------------------------------- # Mouvement du menu #-------------------------------------------------------------------------- def refresh_mover(modo) d1 = 2.0 * Math::PI / @item_max d2 = d1 / DurMov d2 *= -1 if modo != 0 for i in 0...@item_max j = i - @indice d = d1 * j + d2 * @passos x = @cx + ( RaioAnel * Math.sin( d ) ).to_i y = @cy - ( RaioAnel * Math.cos( d ) ).to_i desenha_item(x, y, i) end @passos -= 1 if @passos < 1 @modo = ModoEsp end end #-------------------------------------------------------------------------- # Desenha o icone #-------------------------------------------------------------------------- def desenha_item(x, y, i) if @indice == i self.cursor_rect.set(x-4, y-4, 32, 32) draw_icon(@item_icon[i], x, y, @item_hab[i]) else draw_icon(@item_icon[i], x, y, @item_hab[i]) end end #-------------------------------------------------------------------------- # initialise le menu #-------------------------------------------------------------------------- def inicia_menu @modo = ModoIni @passos = DurIni if SE_Inicio != nil and SE_Inicio != "" Audio.se_play("Audio/SE/" + SE_Inicio, 50, 100) end end #-------------------------------------------------------------------------- # fait tourner le menu #-------------------------------------------------------------------------- def girar(modo) if modo == ModoMD @indice -= 1 @indice = @item_hab.size - 1 if @indice < 0 elsif modo == ModoME @indice += 1 @indice = 0 if @indice >= @item_hab.size else return end @modo = modo @passos = DurMov end end
#============================================================================== # Window_Selectable #------------------------------------------------------------------------------ # Corrige un bug au niveau du déplacement du curseur # dans la fenêtre de selection de chara #==============================================================================
class Window_Selectable < Window_Base def process_cursor_move return unless cursor_movable? last_index = @index if $shift == 1 cursor_down (Input.trigger?(:UP)) if Input.repeat?(:UP) cursor_up (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) else cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP) end cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT) cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT) cursor_pagedown if !handle?(:pagedown) && Input.trigger?(:R) cursor_pageup if !handle?(:pageup) && Input.trigger?(:L) Sound.play_cursor if @index != last_index end end #============================================================================== # Window_MapName #------------------------------------------------------------------------------ # Affiche l'emplacement avec le même style que le jeu #============================================================================== class Window_MapName < Window_Base $local_show = false def update super if $local_show == false if @show_count > 0 && $game_map.name_display update_fadein @show_count -= 1 else update_fadeout end else update_fadein end end end
#============================================================================== # ■ Window_Gold #------------------------------------------------------------------------------ # Permet d'afficher l'argent sur un fond similaire à celui de la map #==============================================================================
class Window_Gold < Window_Base
def refresh contents.clear draw_background(contents.rect) draw_currency_value(value, currency_unit, 4, 0, contents.width - end def draw_background(rect) temp_rect = rect.clone temp_rect.width /= 2 contents.gradient_fill_rect(temp_rect, Color.new(0, 0, 0, 0), Color.new(152, 99, 39, 192)) temp_rect.x = temp_rect.width contents.gradient_fill_rect(temp_rect, Color.new(152, 99, 39, 192), Color.new(0, 0, 0, 0)) end end
Et le script de base : - Code:
-
=begin Script Criado por DouglasMF das comunidades VilaMakers Online e RPG Maker Brasil Com base no script Ring Menu feito por XRXS, Dubealex e Hypershadow180
--Inscruction-- Pour installer ce script, mettez le au dessus de Main
=end #============================================================================== # Scene_Menu #------------------------------------------------------------------------------ # Esta classe controla o conjunto de objetos que forma o RingMenu #==============================================================================
#=============================================================== # # www.rpgmakervx-fr.com # #===============================================================
class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # Initialisation #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # Initialise les objets du menu #-------------------------------------------------------------------------- def start super @spriteset = Spriteset_Map.new @gold_window = Window_Gold.new @gold_window.y = Graphics.height - @gold_window.height @gold_window.opacity = 0 $local_show = true @map_name_window = Window_MapName.new @map_name_window.open @status_window = Window_MenuStatus.new(160, 0) px = $game_player.screen_x - 16 py = $game_player.screen_y - 28 @ring_menu = Window_RingMenu_Comando.new(px,py) @status_window.z = @ring_menu.z + 20 @status_window.visible = false end #-------------------------------------------------------------------------- # Ferme les objets du menu #-------------------------------------------------------------------------- def terminate super @spriteset.dispose @ring_menu.dispose @gold_window.dispose @map_name_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # Actualise les objets du menu #-------------------------------------------------------------------------- def update super @ring_menu.update @gold_window.update @map_name_window.update @spriteset.update @status_window.update if @ring_menu.active update_command_selection elsif @status_window.active update_actor_selection end if @status_window.active $shift = 1 else $shift = 0 end end
#-------------------------------------------------------------------------- # Actualisation des commandes et sélection menu #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $local_show = false SceneManager.call(Scene_Map) elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @ring_menu.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @ring_menu.index == 4 Sound.play_buzzer return end Sound.play_ok case @ring_menu.indice when 0 SceneManager.call(Scene_Item) when 1,2,3 command_personal when 4 SceneManager.call(Scene_Save) when 5 SceneManager.call(Scene_End) end end if Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP) Sound.play_cursor @ring_menu.girar(3) return end if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN) Sound.play_cursor @ring_menu.girar(4) return end end
#-------------------------------------------------------------------------- def command_personal @ring_menu.active = false @status_window.visible = true @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 on_personal_cancel @status_window.unselect @status_window.visible = false @ring_menu.active = true end #-------------------------------------------------------------------------- # choix perso ok #-------------------------------------------------------------------------- def on_personal_ok case @ring_menu.indice when 1 SceneManager.call(Scene_Skill) when 2 SceneManager.call(Scene_Equip) when 3 SceneManager.call(Scene_Status) end end #-------------------------------------------------------------------------- # Termine la selection du chara #-------------------------------------------------------------------------- def end_actor_selection @ring_menu.active = true @status_window.active = false @status_window.visible = false @status_window.index = -1 end #-------------------------------------------------------------------------- # Actualisation sélection chara #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) Sound.play_ok case @ring_menu.indice when 1 SceneManager.call(Scene_Skill) when 2 SceneManager.call(Scene_Equip) when 3 SceneManager.call(Scene_Status) end end end end
#============================================================================== # Window_RingMenu_Comando #------------------------------------------------------------------------------ # Cette classe crée le RingMenu #==============================================================================
class Window_RingMenu_Comando < Window_Base DurIni = 30 DurMov = 15 RaioAnel = 64 ModoIni = 1 ModoEsp = 2 ModoMD = 3 ModoME = 4 SE_Inicio = "" attr_accessor :indice #-------------------------------------------------------------------------- # Initialisation objets #-------------------------------------------------------------------------- def initialize(centro_x,centro_y) super(0, 0, 544, 416) self.opacity = 0 self.contents.font.size = 16 s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end @item_name = [s1,s2,s3,s4,s5,s6] @item_max = 6 @item_icon = [260,112,170,121,117,1] @item_hab = [true,true,true,true,true,true] @indice = 0 @cx = centro_x - 12 @cy = centro_y - 12 inicia_menu refresh end #-------------------------------------------------------------------------- # Actualisation objets #-------------------------------------------------------------------------- def update super refresh end #-------------------------------------------------------------------------- # Actualisation objets #-------------------------------------------------------------------------- def refresh self.contents.clear case @modo when ModoIni refresh_inicio when ModoEsp refresh_espera when ModoMD refresh_mover(1) when ModoME refresh_mover(0) end sw = self.contents.width rect = Rect.new((@cx - ((sw-32)/2))+12, @cy - 40, sw-32, 32) self.contents.draw_text(rect, @item_name[@indice],1) end #-------------------------------------------------------------------------- # Ouvre le menu #-------------------------------------------------------------------------- def refresh_inicio d1 = 2.0 * Math::PI / @item_max d2 = 1.0 * Math::PI / DurIni r = RaioAnel - 1.0 * RaioAnel * @passos / DurIni for i in 0...@item_max j = i - @indice d = d1 * j + d2 * @passos x = @cx + ( r * Math.sin( d ) ).to_i y = @cy - ( r * Math.cos( d ) ).to_i desenha_item(x, y, i) end @passos -= 1 if @passos < 1 @modo = ModoEsp end end #-------------------------------------------------------------------------- # Actualisation menu #-------------------------------------------------------------------------- def refresh_espera d = 2.0 * Math::PI / @item_max for i in 0...@item_max j = i - @indice x = @cx + ( RaioAnel * Math.sin( d * j ) ).to_i y = @cy - ( RaioAnel * Math.cos( d * j ) ).to_i desenha_item(x, y, i) end end #-------------------------------------------------------------------------- # Mouvement du menu #-------------------------------------------------------------------------- def refresh_mover(modo) d1 = 2.0 * Math::PI / @item_max d2 = d1 / DurMov d2 *= -1 if modo != 0 for i in 0...@item_max j = i - @indice d = d1 * j + d2 * @passos x = @cx + ( RaioAnel * Math.sin( d ) ).to_i y = @cy - ( RaioAnel * Math.cos( d ) ).to_i desenha_item(x, y, i) end @passos -= 1 if @passos < 1 @modo = ModoEsp end end #-------------------------------------------------------------------------- # Desenha o icone #-------------------------------------------------------------------------- def desenha_item(x, y, i) if @indice == i self.cursor_rect.set(x-4, y-4, 32, 32) draw_icon(@item_icon[i], x, y, @item_hab[i]) else draw_icon(@item_icon[i], x, y, @item_hab[i]) end end #-------------------------------------------------------------------------- # initialise le menu #-------------------------------------------------------------------------- def inicia_menu @modo = ModoIni @passos = DurIni if SE_Inicio != nil and SE_Inicio != "" Audio.se_play("Audio/SE/" + SE_Inicio, 80, 100) end end #-------------------------------------------------------------------------- # fait tourner le menu #-------------------------------------------------------------------------- def girar(modo) if modo == ModoMD @indice -= 1 @indice = @item_hab.size - 1 if @indice < 0 elsif modo == ModoME @indice += 1 @indice = 0 if @indice >= @item_hab.size else return end @modo = modo @passos = DurMov end end
#============================================================================== # Window_Selectable #------------------------------------------------------------------------------ # Corrige un bug au niveau du déplacement du curseur # dans la fenêtre de selection de chara #==============================================================================
class Window_Selectable < Window_Base def process_cursor_move return unless cursor_movable? last_index = @index if $shift == 1 cursor_down (Input.trigger?(:UP)) if Input.repeat?(:UP) cursor_up (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) else cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN) cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP) end cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT) cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT) cursor_pagedown if !handle?(:pagedown) && Input.trigger?(:R) cursor_pageup if !handle?(:pageup) && Input.trigger?(:L) Sound.play_cursor if @index != last_index end end #============================================================================== # Window_MapName #------------------------------------------------------------------------------ # Affiche l'emplacement avec le même style que le jeu #============================================================================== class Window_MapName < Window_Base $local_show = false def update super if $local_show == false if @show_count > 0 && $game_map.name_display update_fadein @show_count -= 1 else update_fadeout end else update_fadein end end end
#============================================================================== # ■ Window_Gold #------------------------------------------------------------------------------ # Permet d'afficher l'argent sur un fond similaire à celui de la map #==============================================================================
class Window_Gold < Window_Base
def refresh contents.clear draw_background(contents.rect) draw_currency_value(value, currency_unit, 4, 0, contents.width - end def draw_background(rect) temp_rect = rect.clone temp_rect.width /= 2 contents.gradient_fill_rect(temp_rect, Color.new(0, 0, 0, 0), Color.new(152, 99, 39, 192)) temp_rect.x = temp_rect.width contents.gradient_fill_rect(temp_rect, Color.new(152, 99, 39, 192), Color.new(0, 0, 0, 0)) end end
Voici exactement ce qui bug : Quand on ouvre le menu, et que l'on choisit de voir ses objets, il y a de très très grande chance exécute deux SE à très peu d'intervalle de différence, et rentre directement dans les objets plutôt que de nous laisser le choix de choisir entre objet, équipement, etc. Un screen serrait complètement inutile, donc je n'en mettrais pas. En espérant une aide, je vous remercie! |
| | | Heaven Chevalier Dragon (niveau 1)
Messages postés : 755 Date d'inscription : 01/04/2013 Jauge LPC :
| Sujet: Re: Ring Menu Personnalisé Ven 11 Oct 2013 - 7:50 | |
| Yo Hareck ! J'avais déjà essayé de t'aider sur la V4 mais, si tu arriverais à modifier ce script de "Ring Menu" qui a été fait par Zangther : - Code:
-
#============================================================================== # ** Ring Menu - RPG Maker VX ACE #------------------------------------------------------------------------------ # This is a simple ring menu. # - Core classes are in module Zangther including # - Scene_RingMenu # - Spriteset_Iconring # - Sprite_Icon # - Configuration is in the module Zangther::RingMenu::Config # - You can change fade_in and fade_out methods, they are into Zangther::RingMenu::Config::Fade # - Some edits to Scene_Map, Scene_Item, Scene_File and Scene_End are made at the end of the file in # order to make them compatible with this ring menu. # (#call_menu for Scene_Map and #return_scene for the others) #------------------------------------------------------------------------------ # Version : 1.1.3 by Zangther # If any questions, contact me at zangther@gmail.com #----------------------------------------------------------------------------- # Changelog : # v 1.1.3 : ACE version # --------------------------------------- # v 1.2 : Add actor selection for Scene_Skill, Scene_Equip and Scene_Status # v 1.1 : Cleaning # v 1.0 : Base script #----------------------------------------------------------------------------- # Special thanks to Molok, Raho, Nuki, S4suk3 and Grim from Funkywork # for advises and constant support ! [ http://funkywork.jeun.fr ] #============================================================================== module Zangther module RingMenu module Config # Menus's commands MENU_COMMAND = [ # {name: "Name", icon: ID, action: lambda {Scene}, prepare: lambda {SceneManager.scene.prepare(arguments)} } {name: "Items", icon: 261, action: lambda {Scene_Item}}, {name: "Skills", icon: 116, action: lambda {Scene_HeroMenu}, prepare: lambda {SceneManager.scene.prepare(Scene_Skill)} }, {name: "Equip", icon: 434, action: lambda {Scene_HeroMenu}, prepare: lambda {SceneManager.scene.prepare(Scene_Equip)} }, {name: "Status", icon: 121, action: lambda {Scene_HeroMenu}, prepare: lambda {SceneManager.scene.prepare(Scene_Status)} }, {name: "File", icon: 117, action: lambda {Scene_Save}}, {name: "Exit", icon: 12, action: lambda {Scene_End}} ] # Angle de base START_ANGLE = 1.5 * Math::PI # Distance DISTANCE = 50 end #============================================================================== # ** Fade #------------------------------------------------------------------------------ # Contains methods about fade in and fade out for ring menu. #============================================================================== module Fade #-------------------------------------------------------------------------- # * Fade in #-------------------------------------------------------------------------- def fade_in(distance) distance = distance.to_i total_spin dist_step = (distance - @distance) / (6.28 / @step) opa_step = 255 / (6.28 / @step) recede(distance, dist_step) change_opacity(255, opa_step) @state = :openning end #-------------------------------------------------------------------------- # * Fade out #-------------------------------------------------------------------------- def fade_out(distance) distance = distance.to_i total_spin dist_step = (distance - @distance) / (6.28 / @step) opa_step = 255 / (6.28 / @step) approach(distance, dist_step) change_opacity(0, -opa_step) @state = :closing end end #============================================================================== # ** Icon #------------------------------------------------------------------------------ # Add sevreal methods related to icons #============================================================================== module Icon #-------------------------------------------------------------------------- # * Place the sprite #-------------------------------------------------------------------------- def place(x, y, distance, angle) # Force values to numeric distance = distance.to_i angle = angle.to_f # Polar coordinations calculation self.x = x.to_i + (Math.cos(angle)*distance) self.y = y.to_i + (Math.sin(angle)*distance) update end end end #============================================================================== # ** Scene_RingMenu #------------------------------------------------------------------------------ # This scene used to be an adventurer like you, but then it took an arrow in the knee. #============================================================================== class Scene_RingMenu < Scene_MenuBase #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_background create_command_ring create_command_name end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_background dispose_command_name end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if @command_ring.closed? @command_ring.dispose change_scene else @command_ring.update update_command_name update_command_selection unless @command_ring.closing? end end private #-------------------------------------------------------------------------- # * Create Command Ring #-------------------------------------------------------------------------- def create_command_ring icons = Array.new RingMenu::Config::MENU_COMMAND.each do |command| icons.push(icon = Sprite_Icon.new) icon.bitmap = Cache.system("Iconset") index = command[:icon] x = index % 16 * 24 y = (index / 16).truncate * 24 icon.src_rect = Rect.new(x,y,24,24) end x = $game_player.screen_x - 28 y = $game_player.screen_y - 44 distance = RingMenu::Config::DISTANCE angle = RingMenu::Config::START_ANGLE @command_ring = Spriteset_Iconring.new(x, y, distance, 10, angle, icons, @index) end #-------------------------------------------------------------------------- # * Create Command Text #-------------------------------------------------------------------------- def create_command_name @command_name = Sprite.new distance = RingMenu::Config::DISTANCE width = distance * 2 @command_name.bitmap = Bitmap.new(width, 24) @command_name.x = $game_player.screen_x - distance @command_name.y = $game_player.screen_y + distance end #-------------------------------------------------------------------------- # * Update Command Selection #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel do_return elsif Input.trigger?(Input::LEFT) @command_ring.spin_left elsif Input.trigger?(Input::RIGHT) @command_ring.spin_right elsif Input.trigger?(Input::C) Sound.play_ok prepare_next_scene end end #-------------------------------------------------------------------------- # * Update Command Text #-------------------------------------------------------------------------- def update_command_name rect = @command_name.src_rect command = RingMenu::Config::MENU_COMMAND[@command_ring.index] bitmap = @command_name.bitmap bitmap.clear bitmap.draw_text(rect, command[:name], 1) end #-------------------------------------------------------------------------- # * Dispose Command Text #-------------------------------------------------------------------------- def dispose_command_name @command_name.dispose end #-------------------------------------------------------------------------- # * Prepare transition for new scene #-------------------------------------------------------------------------- def prepare_next_scene @index = @command_ring.index command = RingMenu::Config::MENU_COMMAND[@command_ring.index] @scene = command[:action].call @prepare = command.fetch(:prepare) { |el| lambda {} } @command_ring.pre_terminate end #-------------------------------------------------------------------------- # * Execute transition to new scene #-------------------------------------------------------------------------- def change_scene if @scene == :none SceneManager.return else SceneManager.call(@scene) @prepare.call end end #-------------------------------------------------------------------------- # * Load the next scene #-------------------------------------------------------------------------- def do_return @scene = :none @command_ring.pre_terminate end end #============================================================================== # ** Scene_HeroMenu #------------------------------------------------------------------------------ # Dance like it hurts, Love like you need money, Work when people are watching. #============================================================================== class Scene_HeroMenu < Scene_RingMenu #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- def prepare(scene) raise "scene must be a Class object !" unless scene.is_a?(Class) @scene = scene end private #-------------------------------------------------------------------------- # * Create Command Ring #-------------------------------------------------------------------------- def create_command_ring icons = $game_party.members.map do |actor| char = Game_Character.new char.set_graphic(actor.character_name,actor.character_index) Sprite_Character_Icon.new(char) end x = $game_player.screen_x - 16 y = $game_player.screen_y - 16 distance = RingMenu::Config::DISTANCE angle = RingMenu::Config::START_ANGLE @command_ring = Spriteset_Iconring.new(x, y, distance, 10, angle, icons) end #-------------------------------------------------------------------------- # * Create Command Text #-------------------------------------------------------------------------- def create_command_name @command_name = Sprite.new distance = RingMenu::Config::DISTANCE width = distance * 2 @command_name.bitmap = Bitmap.new(width, 24) @command_name.x = $game_player.screen_x - distance @command_name.y = $game_player.screen_y + distance end #-------------------------------------------------------------------------- # * Update Command Text #-------------------------------------------------------------------------- def update_command_name rect = @command_name.src_rect hero = $game_party.members[@command_ring.index] bitmap = @command_name.bitmap bitmap.clear bitmap.draw_text(rect, hero.name, 1) end #-------------------------------------------------------------------------- # * Load the next scene #-------------------------------------------------------------------------- def prepare_next_scene $game_party.menu_actor = $game_party.members[@command_ring.index] @command_ring.pre_terminate end #-------------------------------------------------------------------------- # * Execute transition to new scene #-------------------------------------------------------------------------- def change_scene if @scene == :none SceneManager.return else SceneManager.goto(@scene) end end end #============================================================================== # ** Sprite_Icon #------------------------------------------------------------------------------ # Just inherit from Sprite and Icon #============================================================================== class Sprite_Icon < Sprite include RingMenu::Icon end #============================================================================== # ** Sprite_Character_Icon #------------------------------------------------------------------------------ # Just inherit from Sprite_Character and Icon, changes update to prevent placement issues #============================================================================== class Sprite_Character_Icon < Sprite_Icon #-------------------------------------------------------------------------- # * Object Initialization # viewport : viewport # character : character (Game_Character) #-------------------------------------------------------------------------- def initialize(character = nil) super(nil) @character = character update end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_bitmap update_src_rect self.z = @character.screen_z end #-------------------------------------------------------------------------- # * Get tile set image that includes the designated tile # tile_id : Tile ID #-------------------------------------------------------------------------- def tileset_bitmap(tile_id) set_number = tile_id / 256 return Cache.system("TileB") if set_number == 0 return Cache.system("TileC") if set_number == 1 return Cache.system("TileD") if set_number == 2 return Cache.system("TileE") if set_number == 3 return nil end #-------------------------------------------------------------------------- # * Update Transfer Origin Bitmap #-------------------------------------------------------------------------- def update_bitmap if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_index != @character.character_index @tile_id = @character.tile_id @character_name = @character.character_name @character_index = @character.character_index if @tile_id > 0 sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32; sy = @tile_id % 256 / 8 % 16 * 32; self.bitmap = tileset_bitmap(@tile_id) self.src_rect.set(sx, sy, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = Cache.character(@character_name) sign = @character_name[/^[\!\$]./] if sign != nil and sign.include?('$') @cw = bitmap.width / 3 @ch = bitmap.height / 4 else @cw = bitmap.width / 12 @ch = bitmap.height / 8 end self.ox = @cw / 2 self.oy = @ch end end end #-------------------------------------------------------------------------- # * Update Transfer Origin Rectangle #-------------------------------------------------------------------------- def update_src_rect if @tile_id == 0 index = @character.character_index pattern = @character.pattern < 3 ? @character.pattern : 1 sx = (index % 4 * 3 + pattern) * @cw sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch self.src_rect.set(sx, sy, @cw, @ch) end end end #============================================================================== # ** Spriteset_Iconring #------------------------------------------------------------------------------ # This class manages Sprite_Icon and make then spin around a point. #============================================================================== class Spriteset_Iconring #-------------------------------------------------------------------------- # * Module inclusions #-------------------------------------------------------------------------- include RingMenu::Fade #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :x attr_reader :y attr_reader :distance attr_reader :angle attr_reader :direction attr_reader :actual_direction attr_reader :index #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- PI_2 = 6.28 #-------------------------------------------------------------------------- # * Constructor #-------------------------------------------------------------------------- def initialize(x, y, distance, speed, angle, sprites, index = 0, direction=:trigo) # Argument test sprites = Array(sprites) unless sprites.all? { |sp| (sp.is_a?(RingMenu::Icon)) } raise(ArgumentError, "sprite isn't an array of Sprite_Icons") end # Adjust numeric arguments @x = x.to_i + 16 @y = y.to_i + 16 @distance = @future_distance = 0 @speed = speed.to_i @angle = (angle.to_f - (index.to_f * (PI_2 / sprites.size))).modulo PI_2 # Settings @shift = {:trigo => 0, :antitrigo => 0} @direction = @actual_direction = direction @index = index.to_i @opacity = @future_opacity = 0 @icons = sprites @state = :closed self.step = :default fade_in(distance) update(true) end #-------------------------------------------------------------------------- # * Update # need_refresh : force refresh #-------------------------------------------------------------------------- def update(need_refresh=false) return unless @icons if moving? if spinning? reverse_direction if need_reverse? update_angle end update_distance need_refresh = true end update_opacity update_state refresh if need_refresh end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def pre_terminate fade_out(0) end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose @icons.each {|icon| icon.dispose} end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @icons.size.times do |i| icon = @icons[i] angle = @angle + ((PI_2/(@icons.size))*i) icon.place(@x,@y,@distance,angle) icon.opacity = @opacity icon.update end end #-------------------------------------------------------------------------- # * Spin #-------------------------------------------------------------------------- def spin unless spinning? number_of_icons = @icons.size @shift[@direction] += PI_2/number_of_icons if @direction == :trigo @index += 1 else @index -= 1 end @index = @index.modulo number_of_icons end end #-------------------------------------------------------------------------- # * Change direction # direction : :trigo, :antitrigo, :+, :-, :positif, :negatif #-------------------------------------------------------------------------- def change_direction(direction) case direction when :trigo, :+, :positif @direction = :trigo when :antitrigo, :-, :negatif @direction = :antitrigo end end #-------------------------------------------------------------------------- # * Change center # x,y : Entiers #-------------------------------------------------------------------------- def changer_centre(x, y) @x = x.to_i @y = y.to_i end #-------------------------------------------------------------------------- # * Définir distance #-------------------------------------------------------------------------- def angle=(angle) if angle > PI_2 || angle < 0 angle = 0 end @angle = angle.to_f end #-------------------------------------------------------------------------- # * Maj step #-------------------------------------------------------------------------- def step=(step=1) if step == :default number_of_icons = @icons.size @step = PI_2 / (number_of_icons*100) * @speed else @step = step.to_f * @speed end end #-------------------------------------------------------------------------- # * Spin right #-------------------------------------------------------------------------- def spin_right change_direction(:+) spin end #-------------------------------------------------------------------------- # * Spin right #-------------------------------------------------------------------------- def spin_left change_direction(:-) spin end #-------------------------------------------------------------------------- # * Move away from center #-------------------------------------------------------------------------- def recede(distance, step = 1) @future_distance = distance.to_i @distance_step = step.abs end #-------------------------------------------------------------------------- # * Move back to center #-------------------------------------------------------------------------- def approach(distance, step = 1) @future_distance = distance.to_i @distance_step = - step.abs end #-------------------------------------------------------------------------- # * Changes opacity #-------------------------------------------------------------------------- def change_opacity(opacity, step = 1) if opacity > 255 @future_opacity = 255 elsif opacity < 0 @future_opacity = 0 else @future_opacity = opacity.to_i end @opacity_step = step.to_i end #-------------------------------------------------------------------------- # * Is closed ? #-------------------------------------------------------------------------- def closed? @state == :closed end #-------------------------------------------------------------------------- # * Is opened ? #-------------------------------------------------------------------------- def opened? @state == :opened end #-------------------------------------------------------------------------- # * Is closing ? #-------------------------------------------------------------------------- def closing? @state == :closing end #-------------------------------------------------------------------------- # * Is openning ? #-------------------------------------------------------------------------- def openning? @state == :openning end
private #-------------------------------------------------------------------------- # * Updates angle positionning #-------------------------------------------------------------------------- def update_angle direction = @actual_direction shift = @shift[direction] step = @step > shift ? shift : @step step *= -1 if direction == :trigo temp = @angle + step if direction == :trigo && temp < 0 temp += PI_2 elsif direction == :antitrigo && temp > PI_2 temp -= PI_2 end @angle = temp @shift[direction] = shift-@step @shift[direction] = 0 if @shift[direction] < 0 end #-------------------------------------------------------------------------- # * Updates distance positionning #-------------------------------------------------------------------------- def update_distance return if @future_distance == @distance temp = @distance + @distance_step # Checks if @future_distance is between temp and @distance # If so, that's mean that @distance_step is bigger than the gap between @distance & @future_distance if (@distance..temp).include?(@future_distance) || (temp..@distance).include?(@future_distance) @distance = @future_distance else @distance += @distance_step end end #-------------------------------------------------------------------------- # * Updates opacity #-------------------------------------------------------------------------- def update_opacity shift = @future_opacity - @opacity return if shift == 0 @opacity += @opacity_step if shift > 0 @opacity = @future_opacity if @opacity > @future_opacity else @opacity = @future_opacity if @opacity < @future_opacity end end #-------------------------------------------------------------------------- # * Updates state #-------------------------------------------------------------------------- def update_state unless spinning? if @state == :closing @state = :closed elsif @state == :openning @state = :opened end end end #-------------------------------------------------------------------------- # * Reverse the direction #-------------------------------------------------------------------------- def reverse_direction @actual_direction = (@actual_direction == :trigo ? :antitrigo : :trigo) end #-------------------------------------------------------------------------- # * Need revesing direction ? #-------------------------------------------------------------------------- def need_reverse? @shift[@actual_direction] <= 0 end #-------------------------------------------------------------------------- # * Spinning #-------------------------------------------------------------------------- def spinning? @shift.any? {|key,val| val > 0} end #-------------------------------------------------------------------------- # * Moving ? #-------------------------------------------------------------------------- def moving? spinning? || (@future_distance != @distance) end #-------------------------------------------------------------------------- # * Make one complete spin #-------------------------------------------------------------------------- def total_spin @shift[@direction] += PI_2 unless spinning? end end end #============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs the map screen processing. #==============================================================================
class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # * Call Menu Screen #-------------------------------------------------------------------------- def call_menu Sound.play_ok SceneManager.call(Zangther::Scene_RingMenu) Window_MenuCommand::init_command_position end end Peut-être que les SE ne se joueront pas 2 fois :/ Sinon, j'ai pas vraiment d'idées x) Heav'n |
| | | Hareck Paysan (niveau 4)
Messages postés : 38 Date d'inscription : 10/10/2013 Jauge LPC :
| Sujet: Re: Ring Menu Personnalisé Ven 11 Oct 2013 - 10:53 | |
| Je vais essayer, on ne sais jamais. J'éditerais pour voir ce que cela donne, sinon, je posterais la version modifié, si problème il y a. |
| | | Hareck Paysan (niveau 4)
Messages postés : 38 Date d'inscription : 10/10/2013 Jauge LPC :
| Sujet: Re: Ring Menu Personnalisé Ven 11 Oct 2013 - 12:34 | |
| Aucun bug avec ce script, même si je ne l'aime pas beaucoup (enfaite, choisir son perso après avoir choisis une option sachant qu'il n'y a qu'un perso est dommage, et il n'y a pas de petit pouit quand on tourne le menu. |
| | | Heaven Chevalier Dragon (niveau 1)
Messages postés : 755 Date d'inscription : 01/04/2013 Jauge LPC :
| Sujet: Re: Ring Menu Personnalisé Ven 11 Oct 2013 - 15:29 | |
| Oki (:
Après, il faut voir, d'autres membres passeront certainement par ici ^^
Heav'n |
| | | shin Chevalier Dragon (niveau 1)
Messages postés : 726 Date d'inscription : 18/10/2011 Jauge LPC :
| Sujet: Re: Ring Menu Personnalisé Mer 16 Oct 2013 - 20:45 | |
| je vais voir ce que je peut faire |
| | | Contenu sponsorisé
| Sujet: Re: Ring Menu Personnalisé | |
| |
| | | |
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |