Mr0 Administrateur
Nombre de messages : 457 Age : 29 Localisation : France Point faible : Informatique, jeux vidos Date d'inscription : 14/02/2007
| Sujet: Menu tournant Jeu 17 Juil - 6:38 | |
| Auteur : MakirouAru Fonction : Permet de faire un menu tournant autour du hros (voir screen) Image(s) : Image n1 Ressource(s) : Aucune Dmo : Aucune Remarque : Test et fonctionnel. On ne voit pas la somme d'argent. Nombre de scripts : 1 Installation : Copiez le code, ouvrez l'diteur de script ( F11 ) et crez en un nouveau au dessus de 'Main'. Nommez ce script " Ring_Menu " et collez le code. Utilisation : Aucune Code : - Code:
-
#============================================================================== # Window_RingMenu #============================================================================== #============================================================================== # Edited by MakirouAru #============================================================================== class Window_RingMenu < Window_Base #-------------------------------------------------------------------------- # NX萔 #-------------------------------------------------------------------------- STARTUP_FRAMES = 20 # Aj[Ṽt[ MOVING_FRAMES = 5 # Õt[ RING_R = 64 # O̔a ICON_ITEM = RPG::Cache.icon("034-Item03") # uACevj[̃ACR ICON_SKILL = RPG::Cache.icon("044-Skill01") # uXLvj[̃ACR ICON_EQUIP = RPG::Cache.icon("001-Weapon01") # uvj[̃ACR ICON_STATUS = RPG::Cache.icon("050-Skill07") # uXe[^Xvj[̃ACR ICON_SAVE = RPG::Cache.icon("038-Item07") # uZ[uvj[̃ACR ICON_EXIT = RPG::Cache.icon("046-Skill03") # uIvj[̃ACR ICON_DISABLE= RPG::Cache.icon("") # gp֎~ڂɕtACR SE_STARTUP = "056-Right02" # j[JƂɖ炷SE MODE_START = 1 # X^[gAbvAj[V MODE_WAIT = 2 # ҋ@ MODE_MOVER = 3 # v]Aj[V MODE_MOVEL = 4 # v]Aj[V #-------------------------------------------------------------------------- # ANZT #-------------------------------------------------------------------------- attr_accessor :index #-------------------------------------------------------------------------- # IuWFNg #-------------------------------------------------------------------------- def initialize( center_x, center_y ) super(0, 0, 640, 480) self.contents = Bitmap.new(width-32, height-32) self.contents.font.name = "Arial" self.opacity = 0 self.back_opacity = 0 s1 = "Objets" s2 = "Comptences" s3 = "Equipement" s4 = "Etats" s5 = "Sauvegarder" s6 = "Quitter" @commands = [ s1, s2, s3, s4, s5, s6 ] @item_max = 6 @index = 0 @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ] @disabled = [ false, false, false, false, false, false ] @cx = center_x - 16 @cy = center_y - 16 setup_move_start refresh end #-------------------------------------------------------------------------- # t[XV #-------------------------------------------------------------------------- def update super refresh end #-------------------------------------------------------------------------- # ʍĕ` #-------------------------------------------------------------------------- def refresh self.contents.clear # ACR` case @mode when MODE_START refresh_start when MODE_WAIT refresh_wait when MODE_MOVER refresh_move(1) when MODE_MOVEL refresh_move(0) end # ANeBuȃR}h\ rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32) self.contents.draw_text(rect, @commands[@index],1) end #-------------------------------------------------------------------------- # ʍĕ`() #-------------------------------------------------------------------------- def refresh_start d1 = 2.0 * Math::PI / @item_max d2 = 1.0 * Math::PI / STARTUP_FRAMES r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES for i in [url=http://gamerpro.exprimetoi.net/mailto:0...@item_max]0...@item_max[/url] j = i - @index d = d1 * j + d2 * @steps x = @cx + ( r * Math.sin( d ) ).to_i y = @cy - ( r * Math.cos( d ) ).to_i draw_item(x, y, i) end @steps -= 1 if @steps < 1 @mode = MODE_WAIT end end #-------------------------------------------------------------------------- # ʍĕ`([url=http://gamerpro.exprimetoi.net/mailto:ҋ@]ҋ@[/url]) #-------------------------------------------------------------------------- def refresh_wait d = 2.0 * Math::PI / @item_max for i in [url=http://gamerpro.exprimetoi.net/mailto:0...@item_max]0...@item_max[/url] j = i - @index x = @cx + ( RING_R * Math.sin( d * j ) ).to_i y = @cy - ( RING_R * Math.cos( d * j ) ).to_i draw_item(x, y, i) end end #-------------------------------------------------------------------------- # ʍĕ`(]) # mode : 0=v 1=v #-------------------------------------------------------------------------- def refresh_move( mode ) d1 = 2.0 * Math::PI / @item_max d2 = d1 / MOVING_FRAMES d2 *= -1 if mode != 0 for i in [url=http://gamerpro.exprimetoi.net/mailto:0...@item_max]0...@item_max[/url] j = i - @index d = d1 * j + d2 * @steps x = @cx + ( RING_R * Math.sin( d ) ).to_i y = @cy - ( RING_R * Math.cos( d ) ).to_i draw_item(x, y, i) end @steps -= 1 if @steps < 1 @mode = MODE_WAIT end end #-------------------------------------------------------------------------- # ڂ̕` # x : # y : # i : ڔԍ #-------------------------------------------------------------------------- def draw_item(x, y, i) #p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s rect = Rect.new(0, 0, @items[i].width, @items[i].height) if @index == i self.contents.blt( x, y, @items[i], rect ) if @disabled[@index] self.contents.blt( x, y, ICON_DISABLE, rect ) end else self.contents.blt( x, y, @items[i], rect, 128 ) if @disabled[@index] self.contents.blt( x, y, ICON_DISABLE, rect, 128 ) end end end #-------------------------------------------------------------------------- # ڂɂ # index : ڔԍ #-------------------------------------------------------------------------- def disable_item(index) @disabled[index] = true end #-------------------------------------------------------------------------- # Aj[V̏ #-------------------------------------------------------------------------- def setup_move_start @mode = MODE_START @steps = STARTUP_FRAMES if SE_STARTUP != nil and SE_STARTUP != "" Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100) end end #-------------------------------------------------------------------------- # ]Aj[V̏ #-------------------------------------------------------------------------- def setup_move_move(mode) if mode == MODE_MOVER @index -= 1 @index = @items.size - 1 if @index < 0 elsif mode == MODE_MOVEL @index += 1 @index = 0 if @index >= @items.size else return end @mode = mode @steps = MOVING_FRAMES end #-------------------------------------------------------------------------- # Aj[Vǂ #-------------------------------------------------------------------------- def animation? return @mode != MODE_WAIT end end #============================================================================== # Window_MenuStatus #------------------------------------------------------------------------------ # [url=http://gamerpro.exprimetoi.net/mailto:@j[ʂŃp[eBo[̃Xe[^X\EBhEłB]@j[ʂŃp[eBo[̃Xe[^X\EBhEłB[/url] #==============================================================================
class Window_RingMenuStatus < Window_Selectable #-------------------------------------------------------------------------- # IuWFNg #-------------------------------------------------------------------------- def initialize super(204, 64, 232, 352) self.contents = Bitmap.new(width - 32, height - 32) refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # tbV #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.name = "Arial" @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = 80 y = 80 * i actor = $game_party.actors[i] draw_actor_graphic(actor, x - 40, y + 80) draw_actor_name(actor, x, y + 24) end end #-------------------------------------------------------------------------- # J[\̋`XV #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 80, self.width - 32, 80) end end end #============================================================================== # # Scene_RingMenu # Scene_Menu #------------------------------------------------------------------------------ # [url=http://gamerpro.exprimetoi.net/mailto:@j[ʂ̏sNXłB]@j[ʂ̏sNXłB[/url] #============================================================================== #class Scene_RingMenu class Scene_Menu #-------------------------------------------------------------------------- # IuWFNg # menu_index : R}h̃J[\ʒu #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # C #-------------------------------------------------------------------------- def main # XvCgZbg쐬 @spriteset = Spriteset_Map.new # R}hEBhE쐬 px = $game_player.screen_x - 15 py = $game_player.screen_y - 24 @command_window = Window_RingMenu.new(px,py) @command_window.index = @menu_index # p[eBl 0 l̏ꍇ if $game_party.actors.size == 0 # ACeAXLAAXe[^X @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end @command_window.z = 100 # Z[u֎~̏ꍇ if $game_system.save_disabled # Z[uɂ @command_window.disable_item(4) end # Xe[^XEBhE쐬 @status_window = Window_RingMenuStatus.new @status_window.x = 160 @status_window.y = 0 @status_window.z = 200 @status_window.visible = false # gWVs Graphics.transition # C[v loop do # Q[ʂXV Graphics.update # ͏XV Input.update # t[XV update # ʂւ烋[v𒆒f if $scene != self break end end # gWV Graphics.freeze # XvCgZbg @spriteset.dispose # EBhE @command_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # t[XV #-------------------------------------------------------------------------- def update # EBhEXV @command_window.update @status_window.update # R}hEBhEANeBȕꍇ: update_command Ă if @command_window.active update_command return end # Xe[^XEBhEANeBȕꍇ: update_status Ă if @status_window.active update_status return end end #-------------------------------------------------------------------------- # t[XV (R}hEBhEANeBȕꍇ) #-------------------------------------------------------------------------- def update_command # B {^ꂽꍇ if Input.trigger?(Input::B) # LZ SE t $game_system.se_play($data_system.cancel_se) # }bvʂɐւ $scene = Scene_Map.new return end # C {^ꂽꍇ if Input.trigger?(Input::C) # p[eBl 0 lŁAZ[uAQ[IȊÕR}h̏ꍇ if $game_party.actors.size == 0 and @command_window.index < 4 # uU[ SE t $game_system.se_play($data_system.buzzer_se) return end # R}hEBhẼJ[\ʒuŕ case @command_window.index when 0 # ACe # SE t $game_system.se_play($data_system.decision_se) # ACeʂɐւ $scene = Scene_Item.new when 1 # XL # SE t $game_system.se_play($data_system.decision_se) # Xe[^XEBhEANeBuɂ @command_window.active = false @status_window.active = true @status_window.visible = true @status_window.index = 0 when 2 # # SE t $game_system.se_play($data_system.decision_se) # Xe[^XEBhEANeBuɂ @command_window.active = false @status_window.active = true @status_window.visible = true @status_window.index = 0 when 3 # Xe[^X # SE t $game_system.se_play($data_system.decision_se) # Xe[^XEBhEANeBuɂ @command_window.active = false @status_window.active = true @status_window.visible = true @status_window.index = 0 when 4 # Z[u # Z[u֎~̏ꍇ if $game_system.save_disabled # uU[ SE t $game_system.se_play($data_system.buzzer_se) return end # SE t $game_system.se_play($data_system.decision_se) # Z[uʂɐւ $scene = Scene_Save.new when 5 # Q[I # SE t $game_system.se_play($data_system.decision_se) # Q[Iʂɐւ $scene = Scene_End.new end return end # Aj[VȂJ[\̏sȂ return if @command_window.animation? # or {^ꂽꍇ if Input.press?(Input::UP) or Input.press?(Input::LEFT) $game_system.se_play($data_system.cursor_se) @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL) return end # or {^ꂽꍇ if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) @command_window.setup_move_move(Window_RingMenu::MODE_MOVER) return end end #-------------------------------------------------------------------------- # t[XV (Xe[^XEBhEANeBȕꍇ) #-------------------------------------------------------------------------- def update_status # B {^ꂽꍇ if Input.trigger?(Input::B) # LZ SE t $game_system.se_play($data_system.cancel_se) # R}hEBhEANeBuɂ @command_window.active = true @status_window.active = false @status_window.visible = false @status_window.index = -1 return end # C {^ꂽꍇ if Input.trigger?(Input::C) # R}hEBhẼJ[\ʒuŕ case @command_window.index when 1 # XL # ̃AN^[̍s 2 ȏ̏ꍇ if $game_party.actors[@status_window.index].restriction >= 2 # uU[ SE t $game_system.se_play($data_system.buzzer_se) return end # SE t $game_system.se_play($data_system.decision_se) # XLʂɐւ $scene = Scene_Skill.new(@status_window.index) when 2 # # SE t $game_system.se_play($data_system.decision_se) # ʂɐւ $scene = Scene_Equip.new(@status_window.index) when 3 # Xe[^X # SE t $game_system.se_play($data_system.decision_se) # Xe[^Xʂɐւ $scene = Scene_Status.new(@status_window.index) end return end end end - Spoiler:
Personellement je l'adore.
| |
|