Project1
标题:
这个自定义脚本请看看为什么无法整队
[打印本页]
作者:
szcszc156
时间:
2015-5-21 16:48
标题:
这个自定义脚本请看看为什么无法整队
#******************************************************************************
#
# * メニュー画面改変 *
#
# for RGSS3
#
# Ver 1.00 2014.06.14
#
# 提供者:睡工房 http://hime.be/
#
#******************************************************************************
=begin
メニュー画面の見た目と機能を変更します。
要求仕様はエクセル参照
=end
#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module MENU_LAYOUT
# ステータス表示部の高さ
HEIGHT = 110
# 全ウィンドウを一時消去するボタン
BUTTON = :A
# ニックネーム表示設定
# :max … 表示可能最大文字数。長いニックネームはこの文字数でカットされ、
# 「ニックネーム~」の形式で表示されます。
NICKNAME = {:x => 0, :y => 0, :max => 6}
# 名前表示設定
NAME = {:x => 0, :y => 24, :w => 85}
# 歩行グラフィック表示設定
# :speed … 歩行アニメーションの早さ
WALK = {:x => 25, :y => 80, :speed => 15}
# ステートの表示設定
# :size … 一度に表示できるアイコンの数
# :speed … 表示できないアイコンがある場合のループするスピード
# :duration … アイコンが1個ずれる度にループを一時停止する時間
# :durationを0に設定すると常にくるくる回ります。
STATE = {:x => 50, :y => 55, :size => 3, :speed => 15, :duration => 30}
# HP・MPゲージの表示設定
HP = {:x => 85, :y => 32, :w => 40}
MP = {:x => 90, :y => 40, :w => 40}
# メニューコマンドの下地画像
# Graphics/systemフォルダに画像を保存してください。
COMMAND_BASE = "command_base"
# 1つ下のメニューコマンドのずらし量
COMMAND_MARGIN = 6
end
end
#==============================================================================
# 設定完了
#==============================================================================
class Sprite_SuiCommand < Sprite
include SUI::MENU_LAYOUT
#--------------------------------------------------------------------------
# ● クラス変数
#--------------------------------------------------------------------------
@@command_count = 0
#--------------------------------------------------------------------------
# ● コマンド選択位置の初期化(クラスメソッド)
#--------------------------------------------------------------------------
def self.reset
@@command_count = 0
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(item, viewport = nil)
super(viewport)
self.bitmap = Cache.system(COMMAND_BASE).clone
self.x -= COMMAND_MARGIN * @@command_count + 15
self.y = self.height * @@command_count
draw_command_name(item)
@offset = 0
@duration = 10 + @@command_count
@org_ox = self.width + (self.width / 5.0) * @@command_count
@speed = @org_ox / @duration
@@command_count += 1
self.ox = @org_ox + @offset
end
#--------------------------------------------------------------------------
# ○ コマンド名描画
#--------------------------------------------------------------------------
def draw_command_name(item)
self.bitmap.font.color.alpha = item[:enabled] ? 255 : 128
self.bitmap.font.size = 22
rect = self.bitmap.rect.clone
rect.width -= 5
rect.height = 22
rect.y = (self.height - rect.height) / 2
self.bitmap.draw_text(rect, item[:name], 2)
end
#--------------------------------------------------------------------------
# ○ 選択
#--------------------------------------------------------------------------
def select(flg)
@offset = flg ? -15 : 0
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @duration > 0
@org_ox -= @speed
@org_ox = 0 if @org_ox < 0
@duration -= 1
end
self.ox = @org_ox + @offset
end
end
class Window_MenuCommand < Window_Command
include SUI::MENU_LAYOUT
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias sui_layout_initialize initialize
def initialize
sui_layout_initialize
self.opacity = 0
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
super
@list.each {|item| item[:sprite].dispose if item[:sprite]}
end
#--------------------------------------------------------------------------
# ● ウィンドウの可視状態
#--------------------------------------------------------------------------
def visible=(flg)
super
@list.each {|item| item[:sprite].visible = flg if item[:sprite]}
end
#--------------------------------------------------------------------------
# ● コマンドリストのクリア
#--------------------------------------------------------------------------
alias sui_layout_clear_command_list clear_command_list
def clear_command_list
if @list
@list.each {|item| item[:sprite].dispose if item[:sprite]}
end
Sprite_SuiCommand.reset
sui_layout_clear_command_list
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
sprite = Sprite_SuiCommand.new(@list[index])
@list[index][:sprite] = sprite
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
#--------------------------------------------------------------------------
def item_rect(index)
height = Cache.system(COMMAND_BASE).height
rect = Rect.new
rect.width = 0
rect.height = height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * height - standard_padding - 5
rect
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if @list
@list.each {|item| item[:sprite].update if item[:sprite]}
end
end
#--------------------------------------------------------------------------
# ● 項目の選択
#--------------------------------------------------------------------------
def select(index)
@list[self.index][:sprite].select(false) if @list[self.index][:sprite]
super
@list[self.index][:sprite].select(true) if @list[self.index][:sprite]
end
end
class Window_SuiActorStatus < Window_Base
include SUI::MENU_LAYOUT
#--------------------------------------------------------------------------
# ● クラス変数
#--------------------------------------------------------------------------
@@count = 0
#--------------------------------------------------------------------------
# ● コマンド選択位置の初期化(クラスメソッド)
#--------------------------------------------------------------------------
def self.reset
@@count = 0
end
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, window_height)
@move_speed = 26.0 / STATE[:speed]
@first_delay = 30
@duration = 10 + @@count * 2
@org_oy = self.height + (self.height / 3.0) * @@count
@speed = @org_oy / @duration
@@count += 1
self.y = Graphics.height - self.height + @org_oy
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
Graphics.width / 4
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def window_height
HEIGHT
end
#--------------------------------------------------------------------------
# ○ 選択
#--------------------------------------------------------------------------
def select(flg)
if flg
cursor_rect.width = contents.width
cursor_rect.height = contents.height
else
cursor_rect.empty
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(actor)
contents.clear
draw_sui_nickname(actor)
draw_sui_name(actor)
draw_sui_hp_mp(actor)
draw_sui_state(actor)
@character_name = actor.character_name
@character_index = actor.character_index
@pattern = 0
@walk_duration = 0
@state_duration = 0
@state_index = 0
@offset_x = 0.0
end
#--------------------------------------------------------------------------
# ○ 二つ名の描画
#--------------------------------------------------------------------------
def draw_sui_nickname(actor)
change_color(normal_color)
text = actor.nickname
text = text[0, NICKNAME[:max]] + "~" if text.size > NICKNAME[:max]
draw_text(NICKNAME[:x], NICKNAME[:y], contents.width, line_height, text)
end
#--------------------------------------------------------------------------
# ○ 名前の描画
#--------------------------------------------------------------------------
def draw_sui_name(actor)
draw_actor_name(actor, NAME[:x], NAME[:y], NAME[:w])
end
#--------------------------------------------------------------------------
# ○ HPMPゲージの描画
#--------------------------------------------------------------------------
def draw_sui_hp_mp(actor)
y = HP[:y] - (line_height - 8)
draw_gauge(HP[:x], y, HP[:w], actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
y = MP[:y] - (line_height - 8)
draw_gauge(MP[:x], y, MP[:w], actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
end
#--------------------------------------------------------------------------
# ○ ステートの描画
#--------------------------------------------------------------------------
def draw_sui_state(actor)
contents.clear_rect(STATE[:x], STATE[:y], 26 * STATE[:size], 24)
icon = Cache.system("Iconset")
@state_size = actor.state_icons.size
@states.dispose if @states
@states = nil
actor.state_icons.each_with_index do |state, index|
@states ||= Bitmap.new(26 * actor.state_icons.size, 24)
rect = Rect.new(state % 16 * 24, state / 16 * 24, 24, 24)
@states.blt(26 * index, 0, icon, rect)
end
rect = Rect.new(0, 0, 26 * STATE[:size], 24)
contents.blt(STATE[:x], STATE[:y], @states, rect) if @states
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
update_sui_character
update_sui_state if @first_delay < 0
@first_delay -= 1
if @duration > 0
@org_oy -= @speed
@org_oy = 0 if @org_oy < 0
@duration -= 1
end
self.y = Graphics.height - self.height + @org_oy
end
#--------------------------------------------------------------------------
# ○ 歩行グラフィックの更新
#--------------------------------------------------------------------------
def update_sui_character
return unless @character_name
@walk_duration = (@walk_duration + 1) % WALK[:speed]
@pattern = (@pattern + 1) % 4 if @walk_duration == 0
draw_character(WALK[:x], WALK[:y])
end
#--------------------------------------------------------------------------
# ○ 歩行グラフィックの描画
#--------------------------------------------------------------------------
def draw_character(x, y)
return unless @character_name
bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign && sign.include?(')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = @character_index
pattern = @pattern < 3 ? @pattern : 1
src_rect = Rect.new((n%4*3+pattern)*cw, (n/4*4)*ch, cw, ch)
contents.clear_rect(x - cw / 2, y - ch, cw, ch)
contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# ○ ステートの更新
#--------------------------------------------------------------------------
def update_sui_state
return if @state_size == 0
return if @state_size <= STATE[:size]
@state_duration += 1
if @state_duration < STATE[:speed]
contents.clear_rect(STATE[:x], STATE[:y], 26 * STATE[:size], 24)
@offset_x += @move_speed
tx = 26 * STATE[:size]
sx = 26 * @state_index + @offset_x.to_int
sw = [tx, @states.width - sx].min
rect = Rect.new(sx, 0, sw, 24)
contents.blt(STATE[:x], STATE[:y], @states, rect)
if tx > sw
rect = Rect.new(0, 0, tx - sw, 24)
contents.blt(STATE[:x] + sw, STATE[:y], @states, rect)
end
end
if @state_duration >= STATE[:speed] + STATE[:duration]
@state_duration = 0
@offset_x = 0.0
@state_index = (@state_index + 1) % @state_size
end
end
end
class Window_SuiMenuStatus < Window_MenuStatus
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
create_actors_status
super(0, Graphics.height - window_height + standard_padding)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
@actors_window.each {|window| window.update }
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
@actors_window.each {|window| window.dispose }
super
end
#--------------------------------------------------------------------------
# ● ウィンドウが関連付けられているビューポート
#--------------------------------------------------------------------------
def viewport=(viewport)
super
@actors_window.each {|window| window.viewport = viewport }
end
#--------------------------------------------------------------------------
# ● ウィンドウの可視状態
#--------------------------------------------------------------------------
def visible=(flg)
super
@actors_window.each {|window| window.visible = flg}
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
(Graphics.width / 4) * $game_party.members.size
end
#--------------------------------------------------------------------------
# ● ウィンドウ高さの取得
#--------------------------------------------------------------------------
def window_height
Window_SuiActorStatus::HEIGHT + standard_padding
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
#--------------------------------------------------------------------------
def item_rect(index)
window = @actors_window[index]
rect = Rect.new
rect.y = -standard_padding
rect.x = window.x + window.width / 2 - standard_padding
rect
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
1
end
#--------------------------------------------------------------------------
# ● 項目の選択
#--------------------------------------------------------------------------
def select(index)
@actors_window[self.index].select(false) if @actors_window[self.index]
super
@actors_window[self.index].select(true) if @actors_window[self.index]
if self.viewport
if index < 4
self.viewport.ox = 0
else
self.viewport.ox = (Graphics.width / 4) * (index - 3)
end
end
call_handler(:change)
end
#--------------------------------------------------------------------------
# ● 項目の選択解除
#--------------------------------------------------------------------------
def unselect
@actors_window[self.index].select(false) if @actors_window[self.index]
super
end
#--------------------------------------------------------------------------
# ○ アクター個々のウィンドウを作成
#--------------------------------------------------------------------------
def create_actors_status
@actors_window = []
Window_SuiActorStatus.reset
$game_party.members.each_with_index do |actor, index|
window = Window_SuiActorStatus.new
window.x = window.width * index
window.refresh(actor)
@actors_window[index] = window
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.members[index]
@actors_window[index].refresh(actor)
end
#--------------------------------------------------------------------------
# ● カーソルを右に移動
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
cursor_down(wrap)
end
#--------------------------------------------------------------------------
# ● カーソルを左に移動
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
cursor_up(wrap)
end
end
class Window_SuiMenuMap < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(1))
refresh
end
#--------------------------------------------------------------------------
# ● ウィンドウ幅の取得
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ○ スライドの設定
#--------------------------------------------------------------------------
def slide_setup
@slide = true
@org_x = self.x
@duration = 10
@org_ox = self.width.to_f
@speed = @org_ox / @duration
self.x += @org_ox
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
return unless @slide
if @duration > 0
@org_ox -= @speed
@org_ox = 0 if @org_ox < 0
@duration -= 1
end
@slide = false if @duration <= 0
self.x = @org_x + @org_ox
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(4, 0, map_name)
end
#--------------------------------------------------------------------------
# ○ マップ名
#--------------------------------------------------------------------------
def map_name
$data_mapinfos[$game_map.map_id].name
end
end
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ○ スライドの設定
#--------------------------------------------------------------------------
def slide_setup
@slide = true
@org_x = self.x
@duration = 12
@org_ox = self.width + self.width / 5.0
@speed = @org_ox / @duration
self.x += @org_ox
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
return unless @slide
if @duration > 0
@org_ox -= @speed
@org_ox = 0 if @org_ox < 0
@duration -= 1
end
@slide = false if @duration <= 0
self.x = @org_x + @org_ox
end
end
class Window_VariablesView < Window_Selectable
#--------------------------------------------------------------------------
# ○ スライドの設定
#--------------------------------------------------------------------------
def slide_setup
@slide = true
@org_x = self.x
@duration = 14
@org_ox = self.width + (self.width / 5.0) * 2
@speed = @org_ox / @duration
self.x += @org_ox
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
return unless @slide
if @duration > 0
@org_ox -= @speed
@org_ox = 0 if @org_ox < 0
@duration -= 1
end
@slide = false if @duration <= 0
self.x = @org_x + @org_ox
end
end
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias sui_layout_menu_start start
def start
sui_layout_menu_start
create_map_window
layout_position
end
#--------------------------------------------------------------------------
# ● ビューポートの解放
#--------------------------------------------------------------------------
alias sui_layout_dispose_main_viewport dispose_main_viewport
def dispose_main_viewport
sui_layout_dispose_main_viewport
@status_viewport.dispose
end
#--------------------------------------------------------------------------
# ● マップ名ウィンドウの作成
#--------------------------------------------------------------------------
def create_map_window
@map_window = Window_SuiMenuMap.new
@map_window.x = Graphics.width - @gold_window.width
end
#--------------------------------------------------------------------------
# ● ステータスウィンドウの作成 ※再定義
#--------------------------------------------------------------------------
def create_status_window
@status_viewport = Viewport.new
@status_viewport.z = 500
@status_window = Window_SuiMenuStatus.new
@status_window.viewport = @status_viewport
@status_window.set_handler(:change, method(:change_spc))
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias sui_layout_update update
def update
@status_viewport.update
if Input.press?(SUI::MENU_LAYOUT::BUTTON)
@gold_window.visible = false
@map_window.visible = false
@status_window.visible = false
@command_window.visible = false
@variables_window.visible = false
Window_Base.hide_cursor_animation
Graphics.update
Input.update
else
@gold_window.visible = true
@map_window.visible = true
@status_window.visible = true
@command_window.visible = true
@variables_window.visible = true
Window_Base.show_cursor_animation
sui_layout_update
end
end
#--------------------------------------------------------------------------
# ○ 立ち絵変更
#--------------------------------------------------------------------------
def change_spc
menu = $game_party.members[@status_window.index].id
if $m[menu]
@spc.target = $m[menu]
$m[menu].x = SUI::STANDING_PICTURE::MENU_POS[menu][0]
$m[menu].y = SUI::STANDING_PICTURE::MENU_POS[menu][1]
$m[menu].z = SUI::STANDING_PICTURE::MENU_POS[menu][2]
$m[menu].zoom_x = SUI::STANDING_PICTURE::MENU_POS[menu][3]
$m[menu].zoom_y = SUI::STANDING_PICTURE::MENU_POS[menu][4]
$m[menu].show
else
@spc.target.hide
end
end
#--------------------------------------------------------------------------
# ○ 位置補正
#--------------------------------------------------------------------------
def layout_position
@gold_window.x = @map_window.x
@gold_window.y = @map_window.y + @map_window.height
if @variables_window
@variables_window.x = @map_window.x
@variables_window.y = @gold_window.y + @gold_window.height
end
@map_window.slide_setup
@gold_window.slide_setup
@variables_window.slide_setup
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1