Project1
标题: 菜單頭像問題~ [打印本页]
作者: 亂堂和樹 时间: 2012-4-22 12:16
标题: 菜單頭像問題~
本帖最后由 iisnow 于 2012-4-22 12:29 编辑
菜單旁的角色單~
請問頭像要怎麼分割?
例如像
這樣子分割~
(因為在嘗試做10人左右的隊伍...)
Window_MenuStatus一定要在這裡做腳本嗎=口="
可以的話..我想說盡量別動到...
(別的腳本也是在用這個分類..)
另外就是~選單可以換成自己的圖片嗎?
可以的話~要怎麼做呢?
請大哥大姐們~幫忙=w=+
雖然嘗試有用下面這個腳本~嘗試了一下左邊選單變成圖片
但似乎不好用啊...(應該說不知道怎麼使用)
【改】自MOG菜單腳本- #==============================================================================
- # MOG VX- Menu Yui 1.5
- #==============================================================================
- # By Moghunter
- # [url]http://www.atelier-rgss.com/[/url]
- #==============================================================================
- # 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 = 36)
- count = 0
- for state in actor.states
- plus_x = (24 * actor.states.size / 2)
- draw_icon(state.icon_index, x + 240 * count - plus_x, y)
- count += 1
- break if (24 * count > width - 24)
- end
- end
- end
- def draw_actor_graphic(actor, x, y)
- draw_character(actor.character_name, actor.character_index, x, y)
- 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_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
- #--------------------------------------------------------------------------
- # ● update
- #--------------------------------------------------------------------------
- # def update
- # super
- # if Graphics.frame_count / Graphics.frame_rate != @total_sec
- # refresh
- # 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.new(180,0)
- @status_window.opacity =255
- #@status_window = Window_MenuStatus_Yui.new(180, 60)
- @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 += 0
- @status_window.x += 0
- # @status_window.contents_opacity -= 15
- @menu_select.x += 0
- @menu_select.opacity -= 0
- @menu_com.x -= 0
- @menu_com.opacity -= 0
- @menu_layout.oy += 0
- @menu_layout.opacity -= 0
- @menu_layout2.y += 0
- @menu_layout2.opacity -= 0
- @gold_window.y -= 7
- @gold_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
- @mapname_window.dispose
- super
- end
- #--------------------------------------------------------------------------
- # ● update
- #--------------------------------------------------------------------------
- def update
- super
- update_slide
- @command_window.update
- @gold_window.update
- @status_window.update
- @mapname_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 += 60
- if @start_slide == false
- if @status_window.active
- @menu_com.opacity -= 0 if @menu_com.opacity > 150
- @menu_com.x -= 0 if @menu_com.x > -100
- # @status_window.x -= 5 if @status_window.x > 50
- else
- @menu_com.opacity += 0
- @menu_com.x += 0 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 += 0
- @menu_com.opacity += 0
- @menu_layout.oy -= 70
- @menu_layout.opacity += 10
- @menu_layout2.y -= 70
- @menu_layout2.opacity += 10
- @gold_window.y += 70
- @gold_window.contents_opacity += 10
- @mapname_window.y -= 70
- @mapname_window.contents_opacity += 10
- else
- # @status_window.x =
- # @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 = 0
- @gold_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 = [184,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 = false#true
复制代码