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

94 lines
4.5 KiB
Ruby

#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
#  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 選択肢のセットアップ
#--------------------------------------------------------------------------
alias setup_choices_infinity setup_choices
def setup_choices(params)
unless $game_message.fake_choices.empty?
params[0].each {|s| $game_message.choices.push(s) }
$game_message.fake_choices.each{|s| $game_message.choices.push(s) }
$game_message.choice_cancel_type = params[1]
$game_message.choice_cancel_type = $game_message.fake_cancel + 1 if $game_message.fake_cancel > 0
$game_message.choice_proc = Proc.new {|n| @branch[@indent] = n; $game_message.choice_number_select(n) }
else
setup_choices_infinity(params)
end
end
#--------------------------------------------------------------------------
# ○ 無限選択肢フラグリセット ※必ず無限選択肢の分岐終わりに挿入する事
#--------------------------------------------------------------------------
def ex_choice_clear
$game_message.infinity_choce_clear
end
#--------------------------------------------------------------------------
# ○ 無限選択肢追加
#--------------------------------------------------------------------------
def ex_choice(text)
$game_message.choice_over(text)
end
#--------------------------------------------------------------------------
# ○ 無限選択肢のキャンセルタイプ
#--------------------------------------------------------------------------
def ex_choice_cancel(num)
$game_message.fake_cancel = num
end
#--------------------------------------------------------------------------
# ○ 無限選択肢の選択番号確認
#--------------------------------------------------------------------------
def ex_choice_number
$game_message.choice_number
end
end
#==============================================================================
# ■ Game_Message
#------------------------------------------------------------------------------
#  文章や選択肢などを表示するメッセージウィンドウの状態を扱うクラスです。この
# クラスのインスタンスは $game_message で参照されます。
#==============================================================================
class Game_Message
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :choice_number # 無限選択肢の分岐判定数値
attr_reader :fake_choices # 無限選択肢の選択肢格納
attr_accessor :fake_cancel # 無限選択肢のキャンセル番号
#--------------------------------------------------------------------------
# ● オブジェクト初期化 ※エイリアス
#--------------------------------------------------------------------------
alias infinity_choices_initialize initialize
def initialize
infinity_choices_initialize
infinity_choce_clear
end
#--------------------------------------------------------------------------
# ○ 無限選択肢フラグのクリア
#--------------------------------------------------------------------------
def infinity_choce_clear
@choice_number = -1
@fake_choices = []
@fake_cancel = 0
end
#--------------------------------------------------------------------------
# ○ 無限選択肢用分岐判定数値の格納
#--------------------------------------------------------------------------
def choice_number_select(num)
@choice_number = num
end
#--------------------------------------------------------------------------
# ○ 無限選択肢の設定 通常選択肢の後ろに表示される
#  通常選択肢の分岐はエディタ上で普通に設定し
#  拡張分は条件分岐のスクリプト判定で設定する
#--------------------------------------------------------------------------
def choice_over(text)
@fake_choices.push(text)
end
end