Va-nu-pieds Lv.4
Inscrit le : 26/02/2011 Messages : 72
| Sujet: MOG - V 1.5 Menu principal Mer 2 Mar 2011 - 19:25 | |
| Voici un script créer par Moghunter CARACTERISTIQUES mise en page du menu principal en images. UTILISATION 1 - Créez un dossier nommé Menu (Graphics / Menus) 2 - Dans ce dossier doit contenir les fichiers suivants. 3 - Vous aurez besoin du fichier dans le dossier Number_01.png Graphics / Système - Spoiler:
#============================================================================== # MOG VX- Menu Yui 1.5 #============================================================================== # By Moghunter # http://www.atelier-rgss.com/ #============================================================================== # Menu animado com layout em pictures. #============================================================================== # # Update # 2010/12/23 -> v1.5 - Novas animações e melhor codificação. # #============================================================================== # 1 - Crie uma pasta com o nome Graphics/Menus. # 2 - Nesta pasta devem conter os seguintes arquivos. # # Background.png # Menu_Actor_Parameter.png # Menu_Command.png # Menu_HPSP.png # Menu_Layout.png # Menu_Layout2.png # Menu_Select.png # # 3 - Será necessário ter a imagem Number_02.png na pasta Graphics/System. # #==============================================================================
#============================================================================== # ■ Cache #============================================================================== module Cache def self.menu(filename) load_bitmap("Graphics/Menus/", filename) end end
#============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index) #-------------------------------------------------------------------------- # X - Posição na horizontal # Y - Posição na vertical # VALUE - Valor Numérico # FILE_NAME - Nome do arquivo # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita # SPACE - Espaço entre os números. # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter. # FRAME_INDEX - Definição do quadro a ser utilizado. #-------------------------------------------------------------------------- def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0) number_image = Cache.system(file_name) frame_max = 1 if frame_max < 1 frame_index = frame_max -1 if frame_index > frame_max -1 align = 2 if align > 2 cw = number_image.width / 10 ch = number_image.height / frame_max h = ch * frame_index number = value.abs.to_s.split(//) case align when 0 plus_x = (-cw + space) * number.size when 1 plus_x = (-cw + space) * number.size plus_x /= 2 when 2 plus_x = 0 end for r in 0..number.size - 1 number_abs = number[r].to_i number_rect = Rect.new(cw * number_abs, h, cw, ch) self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect) end number_image.dispose end #-------------------------------------------------------------------------- # ● draw_menu_parameter #-------------------------------------------------------------------------- def draw_menu_parameter( x, y) image = Cache.menu("Menu_Actor_Parameter") cw = image.width ch = image.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - (cw / 2), y - (ch / 2) - 25, image, src_rect) image.dispose end #-------------------------------------------------------------------------- # ● draw_meter #-------------------------------------------------------------------------- def draw_meter( x, y,name,value1,value2,frames_max,frame_index) image = Cache.menu(name) cw = image.width * value1 / value2 ch = image.height / frames_max h = ch * frame_index src_rect = Rect.new(0, h, cw, ch) self.contents.blt(x , y , image, src_rect) image.dispose end #-------------------------------------------------------------------------- # ● draw_actor_state2 #-------------------------------------------------------------------------- def draw_actor_state2(actor, x, y, width = 96) count = 0 for state in actor.states plus_x = (24 * actor.states.size / 2) draw_icon(state.icon_index, x + 24 * count - plus_x, y) count += 1 break if (24 * count > width - 24) end end end
#============================================================================== # ■ Game_Map #============================================================================== class Game_Map #-------------------------------------------------------------------------- # ● mpname #-------------------------------------------------------------------------- def mpname $mpname = load_data("Data/MapInfos.rvdata") $mpname[@map_id].name end end
#============================================================================== # ■ Window_Selectable_Menu #============================================================================== class Window_Selectable_Menu < Window_Base attr_reader :item_max attr_reader :column_max attr_reader :index #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(x, y, width, height, spacing = 32) @item_max = 1 @column_max = 1 @index = -1 @spacing = spacing super(x, y, width, height) end #-------------------------------------------------------------------------- # ● create_contents #-------------------------------------------------------------------------- def create_contents self.contents.dispose self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max) end #-------------------------------------------------------------------------- # ● index #-------------------------------------------------------------------------- def index=(index) @index = index end #-------------------------------------------------------------------------- # ● row_max #-------------------------------------------------------------------------- def row_max return (@item_max + @column_max - 1) / @column_max end #-------------------------------------------------------------------------- # ● top_row #-------------------------------------------------------------------------- def top_row return self.oy / WLH end #-------------------------------------------------------------------------- # ● top_row #-------------------------------------------------------------------------- def top_row=(row) row = 0 if row < 0 row = row_max - 1 if row > row_max - 1 self.oy = row * WLH end #-------------------------------------------------------------------------- # ● page_row_max #-------------------------------------------------------------------------- def page_row_max return (self.height - 32) / WLH end #-------------------------------------------------------------------------- # ● page_item_max #-------------------------------------------------------------------------- def page_item_max return page_row_max * @column_max end #-------------------------------------------------------------------------- # ● bottom_row #-------------------------------------------------------------------------- def bottom_row return top_row + page_row_max - 1 end #-------------------------------------------------------------------------- # ● bottom_row=(row) #-------------------------------------------------------------------------- def bottom_row=(row) self.top_row = row - (page_row_max - 1) end #-------------------------------------------------------------------------- # ● cursor_movable? #-------------------------------------------------------------------------- def cursor_movable? return false if (not visible or not active) return false if (index < 0 or index > @item_max or @item_max == 0) return false if (@opening or @closing) return true end #-------------------------------------------------------------------------- # ● cursor_down #-------------------------------------------------------------------------- def cursor_down(wrap = false) if (@index < @item_max - @column_max) or (wrap and @column_max == 1) @index = (@index + @column_max) % @item_max end end #-------------------------------------------------------------------------- # ● cursor_up #-------------------------------------------------------------------------- def cursor_up(wrap = false) if (@index >= @column_max) or (wrap and @column_max == 1) @index = (@index - @column_max + @item_max) % @item_max end end #-------------------------------------------------------------------------- # ● cursor_right #-------------------------------------------------------------------------- def cursor_right(wrap = false) if (@column_max >= 2) and (@index < @item_max - 1 or (wrap and page_row_max == 1)) @index = (@index + 1) % @item_max end end #-------------------------------------------------------------------------- # ● cursor_left #-------------------------------------------------------------------------- def cursor_left(wrap = false) if (@column_max >= 2) and (@index > 0 or (wrap and page_row_max == 1)) @index = (@index - 1 + @item_max) % @item_max end end #-------------------------------------------------------------------------- # ● update #-------------------------------------------------------------------------- def update super if cursor_movable? last_index = @index if Input.repeat?(Input::DOWN) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) cursor_up(Input.trigger?(Input::UP)) end if Input.repeat?(Input::RIGHT) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::LEFT) cursor_up(Input.trigger?(Input::UP)) end
if @index != last_index Sound.play_cursor end end end end
#============================================================================== # ■ Window_MenuStatus_Yui #============================================================================== class Window_MenuStatus_Yui < Window_Selectable_Menu #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 480, 300) refresh self.opacity = 0 self.contents_opacity = 0 self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.members.size p1 = [85,110] p2 = [165,210] p3 = [265,110] p4 = [365,210] for actor in $game_party.members case actor.index when 0 draw_menu_parameter(p1[0], p1[1]) draw_actor_graphic(actor, p1[0], p1[1]) draw_picture_number(p1[0] + 45 ,p1[1] - 82,actor.hp,"Number_01",0,0,3,0) draw_picture_number(p1[0] + 83 ,p1[1] - 61,actor.mp,"Number_01",0,0,3,0) draw_picture_number(p1[0] - 38 ,p1[1] - 55,actor.level,"Number_01",1,0,3,1) draw_actor_state2(actor,p1[0] ,p1[1]) draw_meter(p1[0] - 27,p1[1] - 63,"Menu_HPSP",actor.hp,actor.maxhp,2,0) draw_meter(p1[0] + 10,p1[1] - 42,"Menu_HPSP",actor.mp,actor.maxmp,2,1) draw_actor_name(actor, p1[0] + 30, p1[1] - 25) when 1 draw_menu_parameter(p2[0], p2[1]) draw_actor_graphic(actor, p2[0], p2[1]) draw_picture_number(p2[0] + 45 ,p2[1] - 82,actor.hp,"Number_01",0,0,3,0) draw_picture_number(p2[0] + 83 ,p2[1] - 61,actor.mp,"Number_01",0,0,3,0) draw_picture_number(p2[0] - 38 ,p2[1] - 55,actor.level,"Number_01",1,0,3,1) draw_actor_state2(actor,p2[0] ,p2[1]) draw_meter(p2[0] - 27,p2[1] - 63,"Menu_HPSP",actor.hp,actor.maxhp,2,0) draw_meter(p2[0] + 10,p2[1] - 42,"Menu_HPSP",actor.mp,actor.maxmp,2,1) draw_actor_name(actor, p2[0] - 90, p2[1] - 25) when 2 draw_menu_parameter(p3[0], p3[1]) draw_actor_graphic(actor, p3[0], p3[1]) draw_picture_number(p3[0] + 45 ,p3[1] - 82,actor.hp,"Number_01",0,0,3,0) draw_picture_number(p3[0] + 83 ,p3[1] - 61,actor.mp,"Number_01",0,0,3,0) draw_picture_number(p3[0] - 38 ,p3[1] - 55,actor.level,"Number_01",1,0,3,1) draw_actor_state2(actor,p3[0] ,p3[1]) draw_meter(p3[0] - 27,p3[1] - 63,"Menu_HPSP",actor.hp,actor.maxhp,2,0) draw_meter(p3[0] + 10,p3[1] - 42,"Menu_HPSP",actor.mp,actor.maxmp,2,1) draw_actor_name(actor, p3[0] + 30, p3[1] - 25) when 3 draw_menu_parameter(p4[0], p4[1]) draw_actor_graphic(actor, p4[0], p4[1]) draw_picture_number(p4[0] + 45 ,p4[1] - 82,actor.hp,"Number_01",0,0,3,0) draw_picture_number(p4[0] + 83 ,p4[1] - 61,actor.mp,"Number_01",0,0,3,0) draw_picture_number(p4[0] - 38 ,p4[1] - 55,actor.level,"Number_01",1,0,3,1) draw_actor_state2(actor,p4[0] ,p4[1]) draw_meter(p4[0] - 27,p4[1] - 63,"Menu_HPSP",actor.hp,actor.maxhp,2,0) draw_meter(p4[0] + 10,p4[1] - 42,"Menu_HPSP",actor.mp,actor.maxmp,2,1) draw_actor_name(actor, p4[0] - 90, p4[1] - 25) end end end #-------------------------------------------------------------------------- # ● update_cursor #-------------------------------------------------------------------------- def update_cursor end end #============================================================================== # ■ Window_Mapname #============================================================================== class Window_Mapname < Window_Base #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 160, WLH + 32) self.opacity = 0 self.contents_opacity = 0 self.contents.font.bold = true self.contents.font.size = 16 refresh end #-------------------------------------------------------------------------- # ● refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, 120, 32, $game_map.mpname.to_s, 1) end end #============================================================================== # ■ Window_Gold_Menu #============================================================================== class Window_Gold_Menu < Window_Base #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 190, WLH + 32) self.opacity = 0 self.contents_opacity = 0 refresh end #-------------------------------------------------------------------------- # ● refresh #-------------------------------------------------------------------------- def refresh self.contents.clear gold = $game_party.gold draw_picture_number( 70, 0 ,gold, "Number_01",1,0,3,0) end end
#============================================================================== # ■ Window_Time_Menu #============================================================================== class Window_Time_Menu < Window_Base #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 240, WLH + 32) self.opacity = 0 self.contents_opacity = 0 refresh end #-------------------------------------------------------------------------- # ● refresh #-------------------------------------------------------------------------- def refresh self.contents.clear @total_sec = Graphics.frame_count / Graphics.frame_rate hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 plus_x = -130 draw_picture_number(plus_x + x + 18 * 0, 0,0, "Number_01",0,0,3,1) if hour < 10 draw_picture_number(plus_x + x + 18 * 1, 0 ,hour, "Number_01",0,0,3,1) draw_picture_number(plus_x + x + 18 * 3, 0 ,0, "Number_01",0,0,3,1) if min < 10 draw_picture_number(plus_x + x + 18 * 4, 0 ,min, "Number_01",0,0,3,1) draw_picture_number(plus_x + x + 18 * 6, 0 ,0, "Number_01",0,0,3,1) if sec < 10 draw_picture_number(plus_x + x + 18 * 7, 0 ,sec , "Number_01",0,0,3,1) end #-------------------------------------------------------------------------- # ● update #-------------------------------------------------------------------------- def update super if Graphics.frame_count / Graphics.frame_rate != @total_sec refresh end end end
#============================================================================== # ■ Scene_Menu #============================================================================== class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # ● initialize #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # ● perform_transition #-------------------------------------------------------------------------- def perform_transition Graphics.transition(10, "Graphics/System/BattleStart", 80) end #-------------------------------------------------------------------------- # ● start #-------------------------------------------------------------------------- def start super create_command_window create_layout @start_slide = true @gold_window = Window_Gold_Menu.new(185,-50) @status_window = Window_MenuStatus_Yui.new(180, 60) @playtime_window = Window_Time_Menu.new(165, -102) @mapname_window = Window_Mapname.new(195,460) end
#-------------------------------------------------------------------------- # ● create_layout #-------------------------------------------------------------------------- def create_layout @pre_index = @command_window.index @menu_back = Plane.new @menu_back.bitmap = Cache.menu("Background") @menu_layout = Sprite.new @menu_layout.bitmap = Cache.menu("Menu_Layout") @menu_layout.oy = 100 @menu_layout.opacity = 244 @menu_layout2 = Sprite.new @menu_layout2.bitmap = Cache.menu("Menu_Layout2") @menu_layout2.y = 404 @menu_layout2.opacity = 0 @menu_select = Sprite.new @menu_select.bitmap = Cache.menu("Menu_Select") @menu_select.visible = false @select_blink_time = 0 @menu_image = Cache.menu("Menu_Command") @menu_bitmap = Bitmap.new(@menu_image.width,@menu_image.height) @menu_width = @menu_image.width / 6 @menu_height = @menu_image.height @menu_src_rect = Rect.new(@menu_width * @menu_index, 0, @menu_width, @menu_height) @menu_bitmap.blt(0,0, @menu_image, @menu_src_rect) @menu_com = Sprite.new @menu_com.bitmap = @menu_bitmap @menu_com.y = 105 @menu_com.x = -100 @menu_com.opacity = 0 end #-------------------------------------------------------------------------- # ● pre_terminate #-------------------------------------------------------------------------- def pre_terminate for i in 0..15 @menu_back.ox += 1 @status_window.x += 7 @status_window.contents_opacity -= 15 @menu_select.x += 7 @menu_select.opacity -= 15 @menu_com.x -= 7 @menu_com.opacity -= 15 @menu_layout.oy += 7 @menu_layout.opacity -= 15 @menu_layout2.y += 7 @menu_layout2.opacity -= 15 @gold_window.y -= 7 @gold_window.contents_opacity -= 15 @playtime_window.y -= 7 @playtime_window.contents_opacity -= 15 @mapname_window.y += 7 @mapname_window.contents_opacity -= 15 Graphics.update end super end #-------------------------------------------------------------------------- # ● terminate #-------------------------------------------------------------------------- def terminate @menu_back.bitmap.dispose @menu_back.dispose @menu_layout.bitmap.dispose @menu_layout.dispose @menu_layout2.bitmap.dispose @menu_layout2.dispose @menu_bitmap.dispose @menu_com.bitmap.dispose @menu_com.dispose @menu_select.bitmap.dispose @menu_select.dispose @command_window.dispose @gold_window.dispose @status_window.dispose @playtime_window.dispose @mapname_window.dispose super end #-------------------------------------------------------------------------- # ● update #-------------------------------------------------------------------------- def update super update_slide @command_window.update @gold_window.update @status_window.update @mapname_window.update @playtime_window.update refresh_command_image update_select if @command_window.active update_command_selection elsif @status_window.active update_actor_selection end end #-------------------------------------------------------------------------- # ● update_slide #-------------------------------------------------------------------------- def update_slide @menu_back.ox += 1 if @start_slide == false if @status_window.active @menu_com.opacity -= 5 if @menu_com.opacity > 150 @menu_com.x -= 10 if @menu_com.x > -100 @status_window.x -= 5 if @status_window.x > 50 else @menu_com.opacity += 5 @menu_com.x += 10 if @menu_com.x < 0 @status_window.x += 5 if @status_window.x < 80 end else if @menu_layout.oy > 0 @status_window.x -= 7 @status_window.contents_opacity += 10 @menu_com.x += 7 @menu_com.opacity += 10 @menu_layout.oy -= 7 @menu_layout.opacity += 10 @menu_layout2.y -= 7 @menu_layout2.opacity += 10 @gold_window.y += 7 @gold_window.contents_opacity += 10 @playtime_window.y += 7 @playtime_window.contents_opacity += 10 @mapname_window.y -= 7 @mapname_window.contents_opacity += 10 else @status_window.x = 80 @status_window.contents_opacity = 255 @menu_com.x = 0 @menu_com.opacity = 255 @menu_layout.oy = 0 @menu_layout.opacity = 255 @menu_layout2.y = 304 @menu_layout2.opacity = 255 @gold_window.y = 50 @gold_window.contents_opacity = 255 @playtime_window.y = 2 @playtime_window.contents_opacity = 255 @mapname_window.y = 360 @mapname_window.contents_opacity = 255 @start_slide = false end end end #-------------------------------------------------------------------------- # ● update_select #-------------------------------------------------------------------------- def update_select if @status_window.active update_select_blink @menu_select.visible = true @menu_select.opacity += 15 case @status_window.index when 0 sel = [84,155] when 1 sel = [164,255] when 2 sel = [264,155] else sel = [364,255] end @menu_select.x = sel[0] @menu_select.y = sel[1] else @menu_select.visible = false @menu_select.opacity = 0 @select_blink_time = 0 end end #-------------------------------------------------------------------------- # ● update_select_blink #-------------------------------------------------------------------------- def update_select_blink @select_blink_time -= 3 case @select_blink_time when 1..100 @menu_select.zoom_y += 0.01 when 101..200 @menu_select.zoom_y -= 0.01 else @select_blink_time = 200 @menu_select.zoom_y = 1.00 end end #-------------------------------------------------------------------------- # ● refresh_command_image #-------------------------------------------------------------------------- def refresh_command_image return if @pre_index == @command_window.index @pre_index = @command_window @menu_com.bitmap.clear @menu_src_rect = Rect.new(@menu_width * @command_window.index, 0, @menu_width, @menu_height) @menu_bitmap.blt(0,0, @menu_image, @menu_src_rect) end #-------------------------------------------------------------------------- # ● create_command_window #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::item s2 = Vocab::skill s3 = Vocab::equip s4 = Vocab::status s5 = Vocab::save s6 = Vocab::game_end @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.openness = 0 @command_window.open @command_window.opacity = 0 @command_window.contents_opacity = 0 if $game_system.save_disabled @command_window.draw_item(4, false) end end #-------------------------------------------------------------------------- # ● update_command_selection #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) if $game_party.members.size == 0 and @command_window.index < 4 Sound.play_buzzer return elsif $game_system.save_disabled and @command_window.index == 4 Sound.play_buzzer return end Sound.play_decision case @command_window.index when 0 $scene = Scene_Item.new when 1,2,3 start_actor_selection when 4 $scene = Scene_File.new(true, false, false) when 5 $scene = Scene_End.new end end end #-------------------------------------------------------------------------- # ● start_actor_selection #-------------------------------------------------------------------------- def start_actor_selection @command_window.active = false @status_window.active = true if $game_party.last_actor_index < @status_window.item_max @status_window.index = $game_party.last_actor_index else @status_window.index = 0 end end #-------------------------------------------------------------------------- # ● end_actor_selection #-------------------------------------------------------------------------- def end_actor_selection @command_window.active = true @status_window.active = false @status_window.index = -1 end #-------------------------------------------------------------------------- # ● update_actor_selection #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::B) Sound.play_cancel end_actor_selection elsif Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision case @command_window.index when 1 $scene = Scene_Skill.new(@status_window.index) when 2 $scene = Scene_Equip.new(@status_window.index) when 3 $scene = Scene_Status.new(@status_window.index) end end end end
$mog_rgssvx_menu_yui = true
Si possible quelqu'un peut me le faire j'ai déjà fait le dossier menu dans la section graphic Mais j'ai une erreur à la ligne 466 après je sais pas si il y en à encore car je ne sais pas voir(j'ai déjà essayer d'apprendre mais je ne comprend rien). Merci d'avance. |
|