lunariafantasia/Scripts/XY_.rb
2024-01-12 03:12:38 -06:00

69 lines
2.6 KiB
Ruby

#==============================================================================
# ■ Window_Selectable
#------------------------------------------------------------------------------
#  カーソルの移動やスクロールの機能を持つウィンドウクラスです。
#==============================================================================
#class Window_XYChange < Window_Selectable
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# ○ XとYのハンドリング処理の追加
#--------------------------------------------------------------------------
alias xy_process_handling process_handling
def process_handling
xy_process_handling #super
return unless open? && active
return process_x if x_enabled? && Input.trigger?(:X)
return process_y if y_enabled? && Input.trigger?(:Y)
end
#--------------------------------------------------------------------------
# ○ Xの有効状態を取得
#--------------------------------------------------------------------------
def x_enabled?
handle?(:x_change)
end
#--------------------------------------------------------------------------
# ○ Yの有効状態を取得
#--------------------------------------------------------------------------
def y_enabled?
handle?(:y_change)
end
#--------------------------------------------------------------------------
# ○ Xボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_x
if current_item_enabled?
Sound.play_cursor
Input.update
deactivate
call_x_handler
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ○ Xハンドラの呼び出し
#--------------------------------------------------------------------------
def call_x_handler
call_handler(:x_change)
end
#--------------------------------------------------------------------------
# ○ Yボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_y
if current_item_enabled?
Sound.play_cursor
Input.update
deactivate
call_y_handler
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# ○ Yハンドラの呼び出し
#--------------------------------------------------------------------------
def call_y_handler
call_handler(:y_change)
end
end