赞 | 4 |
VIP | 17 |
好人卡 | 62 |
积分 | 14 |
经验 | 52410 |
最后登录 | 2023-8-24 |
在线时间 | 962 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1409
- 在线时间
- 962 小时
- 注册时间
- 2012-4-30
- 帖子
- 1475
|
本帖最后由 铅笔描绘的思念 于 2012-6-24 13:20 编辑
替换角色位置还有其他功能
来源:http://xrxs.at-ninja.jp/Nov10.htm- # ▽△▽ XRXSv10. MeLT【メニューレイアウトテンプレート】VX. ▽△▽
- #
- # publish 2010/ 3/ 3
- # update - 11/ 2/16a
- #
- #==============================================================================
- #
- # --- 追加シーン対応 ---
- # (↓カスタマイズポイントで呼び出し先シーンを設定する場合、
- # そのシーンは既に定義されている必要があります。
- # そのため下記のようにSceneの名だけ定義する事で対応しています。
- # 外部の追加シーン(図鑑や日記画面など)を導入する場合、
- # 下記にならって記述するか、
- # あるいはこのセクションより上にそれらの素材を導入してください。)
- #
- #==============================================================================
- class Scene_Option < Scene_Base
- end
- class Scene_MenuOption < Scene_Option
- end
- class Scene_MateiralCompose < Scene_Base
- end
- class Scene_MenuMateiralCompose < Scene_MateiralCompose
- end
- module XRXSV10
- MEMBERSORT = 101
- COMMONCALL = 102
- end
- #==============================================================================
- # カスタマイズポイント
- #==============================================================================
- module XRXSV10
- #
- # メニュー順序
- # (・順番を自由に入れ替え可能です
- # ・先頭に # のマークを付ける事でそのコマンドを消せます )
- #
- MENU_SCENES = [
- Scene_Item,
- Scene_MenuMateiralCompose,
- Scene_Equip,
- Scene_Skill,
- Scene_Status,
- MEMBERSORT,
- COMMONCALL,
- #Scene_MenuOption,
- Scene_File,
- #Scene_End,
- ]
- #
- # メニューコマンド名称ハッシュ
- # (左側が上記コマンド内容、右側がその名称を意味しています)
- #
- def self.make_menu_command_hash
- hash = {
- Scene_Item => Vocab::item,
- Scene_Skill => Vocab::skill,
- Scene_Equip => Vocab::equip,
- Scene_Status => Vocab::status,
- Scene_File => Vocab::save,
- Scene_End => Vocab::game_end,
- MEMBERSORT => "いれかえ",
- COMMONCALL => "コモンコール",
- Scene_MenuOption => "オプション",
- Scene_MenuMateiralCompose => "アイテム合成"
- }
- return hash
- end
- #
- # コモンコール(コモンイベント呼び出しコマンド)で実行するコモンイベントID
- #
- CommonCallID = 2
- #
- # コモンコールを有効にするスイッチID( 0 番を指定すると常時無効)
- #
- CommonCallDebargoSwitchID = 5
- #
- # 入れ替えを禁止するアクターID配列
- #
- MemberLock = []
- #
- # メニューインデックス自動調整を有効にする?
- #
- MenuIndexAdjusting = true
- end
- #==============================================================================
- # メニューコマンド配列取得
- #==============================================================================
- module XRXSV10
- def self.menu_scenes
- return (MENU_SCENES - ($game_switches[CommonCallDebargoSwitchID] ? [] : [COMMONCALL]))
- end
- end
- #==============================================================================
- # 元の画面 - 戻り先の設定
- #==============================================================================
- class Scene_MenuOption < Scene_Option
- def return_scene
- $scene = Scene_Menu.new(6)
- end
- end
- class Scene_MenuMateiralCompose < Scene_MateiralCompose
- def return_scene
- $scene = Scene_Menu.new(7)
- end
- end
- #==============================================================================
- # メニューフェード時間短縮 [オーバーライド]
- #==============================================================================
- class Scene_Menu < Scene_Base
- def perform_transition
- Graphics.transition(4)
- end
- end
- class Scene_Map < Scene_Base
- def perform_transition
- if Graphics.brightness == 0 # 戦闘後、ロード直後など
- fadein(10)
- else # メニューからの復帰など
- Graphics.transition(0)
- end
- end
- end
- #==============================================================================
- # ゲームデータ変更確認
- #==============================================================================
- class Game_Temp
- attr_accessor :gamedata_saved
- end
- #==============================================================================
- # アクター参照
- #==============================================================================
- class Game_Party
- attr_reader :actors
- end
- #==============================================================================
- # メニュー画面 [再定義]
- #==============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- if XRXSV10::MenuIndexAdjusting
- #
- # メニューインデックス自動調整用の基準インデックス設定
- #
- scene_class = [
- Scene_Item,
- Scene_Skill,
- Scene_Equip,
- Scene_Status,
- Scene_File,
- Scene_End,
- Scene_MenuOption,
- Scene_MenuMateiralCompose
- ][menu_index]
- if scene_class
- scene_index = XRXSV10.menu_scenes.index(scene_class)
- if scene_index
- menu_index = scene_index
- end
- end
- end
- @menu_index = menu_index
- @menu_close_count = 0
- $game_temp.gamedata_saved = false
- end
- #--------------------------------------------------------------------------
- # ● 開始処理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_command_window
- @gold_window = Window_Gold.new(0, 360)
- @status_window = Window_MenuStatus.new(160, 0)
- @status_window.slidein!
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @command_window.update
- @gold_window.update
- @status_window.update
- if @menu_close_count >= 1
- @menu_close_count -= 1
- @menuback2_sprite.opacity -= 42 if @menuback2_sprite != nil
- if @menu_close_count == 0
- $scene = Scene_Map.new
- end
- return
- end
- if @command_window.active
- update_command_selection
- elsif @status_window.active
- update_actor_selection
- end
- end
- #--------------------------------------------------------------------------
- # ● コマンドウィンドウの作成
- #--------------------------------------------------------------------------
- def create_command_window
- @command_window = Window_MenuCommand.new
- @command_window.index = @menu_index
- end
- #--------------------------------------------------------------------------
- # スライドアウト
- #--------------------------------------------------------------------------
- def slideout!
- @command_window.slideout! rescue nil
- @gold_window.slideout! rescue nil
- @status_window.slideout! rescue nil
- end
- #--------------------------------------------------------------------------
- # ● コマンド選択の更新
- #--------------------------------------------------------------------------
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @menu_close_count = 6
- @command_window.index = -1
- slideout!
- elsif Input.trigger?(Input::C)
- next_scene = XRXSV10.menu_scenes[@command_window.index]
- if $game_party.members.size == 0
- set = [Scene_Item, Scene_Skill, Scene_Equip, Scene_Status, XRXSV10::MEMBERSORT]
- if set.include?(next_scene)
- Sound.play_buzzer
- return
- end
- end
- if next_scene == Scene_File
- if $game_system.save_disabled
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- $scene = Scene_File.new(true, false, false)
- elsif next_scene == XRXSV10::COMMONCALL
- if $game_map.interpreter.running?
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- $game_temp.common_event_id = XRXSV10::CommonCallID
- @menu_close_count = 6
- @command_window.index = -1
- slideout!
- else
- Sound.play_decision
- need_target_set = [Scene_Skill, Scene_Equip, Scene_Status, XRXSV10::MEMBERSORT]
- if need_target_set.include?(next_scene)
- @command_window.decide!
- start_actor_selection
- else
- $scene = next_scene.new
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● アクター選択の更新
- #--------------------------------------------------------------------------
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @membersort_index != nil
- @status_window.index = @membersort_index
- @membersort_index = nil
- @status_window.cursor2_dispose!
- else
- end_actor_selection
- @command_window.cancel!
- end
- elsif Input.trigger?(Input::C)
- next_scene = XRXSV10.menu_scenes[@command_window.index]
- if next_scene == XRXSV10::MEMBERSORT
- actor = $game_party.members[@status_window.index]
- if XRXSV10::MemberLock.include?(actor.id)
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- if @membersort_index != nil
- member1 = $game_party.actors[@membersort_index]
- member2 = $game_party.actors[@status_window.index]
- $game_party.actors[@membersort_index] = member2
- $game_party.actors[@status_window.index] = member1
- @membersort_index = nil
- @status_window.cursor2_dispose!
- @status_window.refresh
- $game_player.refresh
- $game_temp.gamedata_saved = false
- else
- @membersort_index = @status_window.index
- @status_window.cursor2_copy!
- end
- else
- Sound.play_decision
- $game_party.last_actor_index = @status_window.index
- $scene = next_scene.new(@status_window.index)
- end
- end
- end
- end
- #==============================================================================
- # --- XRXS. ウィンドウスライディング ---
- #==============================================================================
- module XRXS_WindowSliding
- def slidable?
- return self.slidable_scenes.include?($scene.class) if self.slidable_scenes.size >= 1
- return true
- end
- def slidable_scenes
- return []
- end
- def slide_sprites
- @slide_sprites = [] if @slide_sprites == nil
- return @slide_sprites
- end
- def update
- super
- self.slide_sprites.each{|sprite| sprite.update }
- end
- def update_slide_done!
- self.slide_sprites.each{|sprite| sprite.update_slide_done! }
- end
- def slidein!(x_speed, count = 6, steps = 0)
- for i in 0...self.slide_sprites.size
- sprite = self.slide_sprites[i]
- n = count + i * steps
- sprite.slidein!(x_speed, n)
- end
- self.openness = 255
- end
- def slideout!
- self.slide_sprites.each{|sprite| sprite.slideout! }
- self.openness = 0
- end
- def hide!
- self.slide_sprites.each{|sprite| sprite.opacity = 0 }
- self.openness = 0
- end
- def dispose
- self.slide_sprites.each{|sprite| sprite.dispose }
- super
- end
- def visible=(b)
- self.slide_sprites.each{|sprite| sprite.visible = b }
- super
- end
- end
- class Window_Base < Window
- def slidable?
- return false
- end
- end
- #==============================================================================
- # --- XRXS.スライディングスプライト ---
- #==============================================================================
- module XRXSV_SpriteSliding
- def initialize(viewport = nil)
- @slidein_count = 0
- @slideout_count = 0
- @slide_x_speed = 0
- super(viewport)
- end
- def update
- super
- update_slide
- end
- def update_slide
- if @slidein_count > 0
- @slidein_count -= 1
- self.x += @slide_x_speed
- self.opacity += 48
- self.opacity = 255 if @slidein_count == 0
- elsif @slideout_count > 0
- @slideout_count -= 1
- self.x -= @slide_x_speed
- self.opacity -= 48
- if @slideout_count == 0
- self.opacity = 0
- self.x += @slide_x_speed * 6 #*
- end
- end
- end
- def update_slide_done!
- update_slide while (@slidein_count > 0 or @slideout_count > 0)
- end
- def slidein!(x_speed = 8, count = 6)
- update_slide_done!
- @slidein_count = count
- @slideout_count = 0
- @slide_x_speed = x_speed
- self.opacity = 0
- self.x -= count * x_speed
- end
- def slideout!
- update_slide_done!
- @slidein_count = 0
- @slideout_count = 6 #*
- end
- end
- class Sprite_Slidable < Sprite_Base
- include XRXSV_SpriteSliding
- end
- #==============================================================================
- # --- コンテンツスプリッター (Window用) ---
- # (複製スライドスプライト化・ウィンドウスライディングが必要)
- #==============================================================================
- module XRXSV_ContentsSplitter
- def split_height
- return 24
- end
- def contents_split!(draw_back = true)
- for sprite in self.slide_sprites
- sprite.dispose
- end
- self.slide_sprites.clear
- self.opacity = 0
- x = self.x + 16
- y = self.y + 16
- w = self.width - 32
- h = self.height - 32
- if @contents_viewport == nil
- @contents_viewport = Viewport.new(x, y, w, h)
- self.z = self.z
- end
- sprites = []
- windowskin = Cache.system("Window")
- for i in 0...@item_max
- bitmap = Bitmap.new(w, split_height)
- draw_spriteback(bitmap) if draw_back
- rect = Rect.new(0, split_height * i, w, split_height)
- bitmap.blt(0, 0, self.contents, rect)
- sprite = Sprite_Slidable.new
- sprite.bitmap = bitmap
- sprite.viewport = @contents_viewport
- sprite.x = 0
- sprite.y = i * split_height
- sprites.push(sprite)
- end
- for sprite in sprites
- self.slide_sprites.push(sprite)
- end
- self.contents.clear
- end
- def draw_spriteback(bitmap)
- rect = bitmap.rect.dup
- rect.x += 1
- rect.y += 1
- rect.width -= 2
- rect.height -= 2
- if @splitback_bitmap == nil
- @splitback_bitmap = Bitmap.new(rect.width, rect.height)
- rect2 = Rect.new(0, 0, rect.width, rect.height)
- @splitback_bitmap.stretch_blt(rect2, windowskin, Rect.new(0, 0,64,64), 120)
- @splitback_bitmap.stretch_blt(rect2, windowskin, Rect.new(0,64,64,64), 160)
- end
- bitmap.blt(rect.x, rect.y, @splitback_bitmap, @splitback_bitmap.rect)
- end
- def slidein!(x_speed = -8, count = 6, steps = 4)
- super(x_speed, count, steps)
- end
- def decide!
- self.slide_sprites.each{|sprite| sprite.update_slide_done! }
- self.slide_sprites.each{|sprite| sprite.opacity = 96 }
- self.slide_sprites[self.index].opacity = 255 if self.index >= 0 rescue nil
- end
- def cancel!
- self.slide_sprites.each{|sprite| sprite.opacity = 255 }
- end
- def x=(n)
- super
- @contents_viewport.rect.x = self.x + 16 if @contents_viewport != nil
- end
- def y=(n)
- super
- @contents_viewport.rect.y = self.y + 16 if @contents_viewport != nil
- end
- def z=(n)
- super
- @contents_viewport.z = self.z + 2 if @contents_viewport != nil
- end
- def oy=(n)
- super
- @contents_viewport.oy = n if @contents_viewport != nil
- end
- def contents_opacity=(n)
- self.slide_sprites.each{|sprite| sprite.opacity = n }
- super
- end
- def dispose
- super
- @contents_viewport.dispose if @contents_viewport != nil
- @contents_viewport = nil
- end
- end
- #==============================================================================
- # --- カーソルコピー機能 (Window_Selectableの下位クラス用) ---
- #==============================================================================
- module XRXSV_CursorCopy
- def dispose
- @cursor2_sprite.dispose if @cursor2_sprite != nil
- @contents_viewport.dispose if @contents_viewport != nil
- @contents_viewport = nil
- super
- end
- def cursor2_copy!
- if @contents_viewport == nil
- x = self.x + 16
- y = self.y + 16
- w = self.width - 32
- h = self.height - 32
- @contents_viewport = Viewport.new(x, y, w, h)
- @contents_viewport.z = self.z + 2
- @contents_viewport.oy = self.oy
- end
- if @cursor2_sprite == nil
- @cursor2_sprite = Sprite_Slidable.new(@contents_viewport)
- end
- width = self.cursor_rect.width - 2
- height = self.cursor_rect.height - 2
- @cursor2_sprite.bitmap.dispose if @cursor2_sprite.bitmap != nil
- @cursor2_sprite.bitmap = cursor2_make_cursor_bitmap(width, height)
- @cursor2_sprite.z = self.z
- @cursor2_sprite.x = self.cursor_rect.x + self.ox + 1
- @cursor2_sprite.y = self.cursor_rect.y + self.oy + 1
- end
- def cursor2_dispose!
- @cursor2_sprite.bitmap.dispose rescue nil
- end
- def cursor2_make_cursor_bitmap(width, height)
- windowskin = self.windowskin
- bitmap = Bitmap.new(width, height)
- rect = Rect.new(64, 64, 2, 2)
- bitmap.blt(0, 0, windowskin, rect)
- rect = Rect.new(94, 64, 2, 2)
- bitmap.blt(width - 2, 0, windowskin, rect)
- rect = Rect.new(64, 94, 2, 2)
- bitmap.blt(0, height - 2, windowskin, rect)
- rect = Rect.new(94, 94, 2, 2)
- bitmap.blt(width - 2, height - 2, windowskin, rect)
- rect1 = Rect.new(2, 0, width - 4, 2)
- rect2 = Rect.new(66, 64, 28, 2)
- bitmap.stretch_blt(rect1, windowskin, rect2)
- rect1 = Rect.new(2, height - 2, width - 4, 2)
- rect2 = Rect.new(66, 94, 28, 2)
- bitmap.stretch_blt(rect1, windowskin, rect2)
- rect1 = Rect.new(0, 2, 2, height - 2)
- rect2 = Rect.new(64, 66, 2, 28)
- bitmap.stretch_blt(rect1, windowskin, rect2)
- rect1 = Rect.new(width - 2, 2, 2, height - 2)
- rect2 = Rect.new(94, 66, 2, 28)
- bitmap.stretch_blt(rect1, windowskin, rect2)
- rect1 = Rect.new(2, 2, width - 4, height - 4)
- rect2 = Rect.new(66, 66, 28, 28)
- bitmap.stretch_blt(rect1, windowskin, rect2)
- return bitmap
- end
- def oy=(n)
- super
- @contents_viewport.oy = n if @contents_viewport != nil
- end
- end
- #==============================================================================
- # スライドコマンド
- #==============================================================================
- class Window_SlideCommand < Window_Command
- include XRXS_WindowSliding
- include XRXSV_ContentsSplitter
- def slidein!(x_speed = 8, count = 4, step = 4)
- super(x_speed, count, step)
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, enabled?(i))
- end
- end
- def enabled?(index)
- return true
- end
- end
- #==============================================================================
- # メニューコマンド本体
- #==============================================================================
- class Window_MenuCommand < Window_SlideCommand
- def initialize
- commands = []
- hash = XRXSV10.make_menu_command_hash
- for scene in XRXSV10.menu_scenes
- commands.push(hash[scene]) if scene
- end
- super(160, commands)
- end
- def enabled?(index)
- next_scene = XRXSV10.menu_scenes[index]
- case next_scene
- when Scene_File
- return false if $game_system.save_disabled
- when XRXSV10::COMMONCALL
- return false if $game_map.interpreter.running?
- else
- if $game_party.members.size == 0
- set = [Scene_Item, Scene_Skill, Scene_Equip, Scene_Status, XRXSV10::MEMBERSORT]
- return false if set.include?(next_scene)
- end
- end
- return true
- end
- end
- #==============================================================================
- # メニューステータスにスライド・スプリット・第二カーソル機能を追加
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- include XRXS_WindowSliding
- include XRXSV_ContentsSplitter
- include XRXSV_CursorCopy
- #--------------------------------------------------------------------------
- # ▼ HP の文字色を取得
- #--------------------------------------------------------------------------
- def hp_color(actor)
- color = super
- back_number = (Game_Party::BACKWARD_MEMBERS rescue 0)
- front_number = Game_Party::MAX_MEMBERS - back_number
- color.alpha /= 2 if actor.index.to_i >= front_number
- return color
- end
- end
- #==============================================================================
- # □ Bitmapライブラリ --- draw_hemming_text --- □
- # draw_hemming_text(x, y, width, height, str[, align, color])
- # draw_hemming_text(rect, str[, align, color])
- #==============================================================================
- class Bitmap
- def draw_hemming_text(x, y, w = 0, h = 0, text = "", align = 0, black_color = Color.new(0,0,0,255))
- if x.is_a?(Rect)
- if h.is_a?(Color)
- black_color = h
- end
- align = w
- text = y
- w = x.width
- h = x.height
- y = x.y
- x = x.x
- end
- original_font = self.font.dup
- hemming_font = Font.new
- hemming_font.color = black_color
- hemming_font.color.alpha = black_color.alpha * original_font.color.alpha / 255
- hemming_font.shadow = false
- self.font = hemming_font
- self.draw_text(x-1, y-1, w, h, text, align)
- self.draw_text(x-1, y+1, w, h, text, align)
- self.draw_text(x+1, y-1, w, h, text, align)
- self.font = original_font
- self.draw_text(x , y , w, h, text, align)
- end
- end
- #==============================================================================
- # 単体フェイス・ミニフェイスの取得
- #==============================================================================
- class Game_Actor < Game_Battler
- def face
- key = self.face_name + "-" + (self.face_index + 1).to_s
- return Cache.one_face(key)
- end
- def miniface
- key = self.face_name + "-" + (self.face_index + 1).to_s
- return Cache.miniface(key)
- end
- end
- module Cache
- def self.one_face(key)
- @one_face_cache = {} if @one_face_cache == nil
- cache = @one_face_cache[key]
- if cache == nil or cache.disposed?
- face_name = key[0, key.size - 2]
- face_index = key[key.size - 1, 1].to_i - 1
- x = (face_index % 4 * 96)
- y = (face_index / 4 * 96)
- face = Cache.face(face_name)
- cache = Bitmap.new(96,96)
- cache.blt(0, 0, face, Rect.new(x, y, 96, 96))
- @one_face_cache[key] = cache
- end
- return cache
- end
- def self.miniface(key)
- @miniface_cache = {} if @miniface_cache == nil
- cache = @miniface_cache[key]
- if cache == nil or cache.disposed?
- face = Cache.one_face(key)
- cache = Bitmap.new(48,24)
- cache.stretch_blt(cache.rect, face, Rect.new(0, 14, 96, 48))
- face.dispose
- @miniface_cache[key] = cache
- end
- return cache
- end
- def self.face_cache_clear
- @one_face_cache = {} if @one_face_cache == nil
- @one_face_cache.values.each{|cache| cache.dispose }
- @one_face_cache.clear
- Cache.miniface_cache_clear
- end
- def self.miniface_cache_clear
- @miniface_cache = {} if @miniface_cache == nil
- @miniface_cache.values.each{|cache| cache.dispose }
- @miniface_cache.clear
- end
- end
复制代码 |
|