#----------------------------------------------------------------------------
# あらすじ - KGC_Outline 貪藻矢射妥←カスタム by 貪藻矢射妥←
#----------------------------------------------------------------------------
# 原作: ◆ あらすじ - KGC_Outline ◆
# ◇ Last update : 2007/05/28 ◇
# 原作者: TOMY様
# HP: Kamesoft
# アドレス: http://ytomy.sakura.ne.jp/
#
# 改造内容:
# ・インタープリターに関数を追加することで、呼び出し関数名を省略化
#
# スクリプトから以下を行うことで以下の操作ができます
# あらすじの有効/無効を設定する
# outline_enabled(n) # 有効
# outline_disabled(n) # 無効
#
# 指定したあらすじ(に相当するシナリオ?)の完了状態を設定
# outline_completed(n) # 完了
# outline_uncompleted(n) # 未完了
#==============================================================================
# 変更点
# 2024:06:01
# ・スクリプト中で使用されてる文字列の定義化追加
#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================
module KGC
# ◆あらすじ画面背景透過
OLINE_BACK_TRANSPARENT = true
# ◆スクロール速度【単位:px】
OLINE_SCROLL_SPEED = 8
# ◆通し番号を描画
OLINE_SERIAL_NUMBER = false
# ◆通し番号の桁数
OLINE_SERIAL_NUMBER_DIGITS = 3
# ◆無効なあらすじのタイトル
OLINE_DISABLED_TITLE = "- - - - - - - -"
# ◆無効なあらすじは表示しない
OLINE_HIDE_DISABLED = true
# ◆完了記号
OLINE_COMPLETION_SYMBOL = "★"
# ◆未完記号
OLINE_INCOMPLETION_SYMBOL = Vocab::BLANK_WORD
# ◆あらすじ内容
# ≪["タイトル", ["本文", ...]], ...≫
# 本文は、配列の各要素が1行に相当。
# **** 制御コマンド についてはRUBY_SYSを参照してください ****
OLINE_CONTENTS = [
########## No.000 ##########
["始めにお読みください", ##### Title
##### Main Contents #####
["君はこのあらすじを読んでもいいし、読み飛ばしてもいい",
"ただ、読み飛ばした場合の動作は保証できません。",
"信じるか信じないかはあなた次第です。"]
],
########## No.001 ##########
["ちょいさ〜", ##### Title
##### Main Contents #####
["昔々あるところにアリー・アル・アルシェスという傭兵がおりました。",
"",
"アルシェス「槍は一流でも使い手は二流のようだな!」",
"アルシェス「えぇ?バジルさんよぉ!」",
"",
"バジル「お前が、その在り方が、傭兵であるものかッ!」",
"",
"アルシェス「ところがぎっちょんッ!」"]
],
########## No.002 ##########
["ああっと!", ##### Title
##### Main Contents #####
[""]
],
] # -- Don't delete this line! --
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["Outline"] = true
#--------------------------------------------------------------------------
# ● あらすじ画面呼び出し
#--------------------------------------------------------------------------
def call_outline
# プレイヤーの姿勢を矯正
$game_player.straighten
# あらすじ画面に切り替え
$scene = Scene_Outline.new(true)
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Module - KGC_Outline
#==============================================================================
module KGC::Outline
#--------------------------------------------------------------------------
# ● あらすじ有効化
# index : あらすじ番号
# value : 有効状態 (true | false)
#--------------------------------------------------------------------------
def self.set_enabled(index, value = true)
if $game_system.outline_enable == nil
$game_system.outline_enable = []
end
$game_system.outline_enable[index] = value
end
#--------------------------------------------------------------------------
# ● あらすじ完了
# index : あらすじ番号
# value : 完了状態 (true | false)
#--------------------------------------------------------------------------
def self.set_completed(index, value = true)
if $game_system.outline_complete == nil
$game_system.outline_complete = []
end
$game_system.outline_complete[index] = value
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :outline_enable, :outline_complete
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_Outline initialize
def initialize
initialize_KGC_Outline
@outline_enable = []
@outline_complete = []
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_OutlineList
#------------------------------------------------------------------------------
# あらすじ一覧を表示するウィンドウです。
#==============================================================================
class Window_OutlineList < Window_Selectable
include DIAMOND
include RUBY_SYS
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(80, 40, 480, 400)
self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
self.index = 0
self.z = 1000
refresh
end
#--------------------------------------------------------------------------
# ● 選択あらすじ内容
#--------------------------------------------------------------------------
def outline
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.dispose if self.contents != nil
@data = []
@data_index = []
# リスト作成
$game_system.outline_enable = [] if $game_system.outline_enable == nil
$game_system.outline_complete = [] if $game_system.outline_complete == nil
KGC::OLINE_CONTENTS.each_with_index { |oline, i|
if $game_system.outline_enable[i]
@data << OutlineList_Info.new(oline[0], oline[1], i)
elsif !KGC::OLINE_HIDE_DISABLED
@data << OutlineList_Info.new(KGC::OLINE_DISABLED_TITLE, nil, i)
end
}
# リスト描画
@item_max = [@data.size, 1].max
self.contents = Bitmap.new(self.width - 32, 32 * @item_max)
if @data.size == 0
@data << OutlineList_Info.new
else
@data.each_index { |i| draw_item(i) }
end
end
#--------------------------------------------------------------------------
# ● 項目描画
#--------------------------------------------------------------------------
def draw_item(index)
self.contents.fill_rect(0, 32 * index, self.width - 32, 32, Color.new(0, 0, 0, 0))
# タイトル生成
text = ($game_system.outline_complete[@data[index].index] ?
KGC::OLINE_COMPLETION_SYMBOL : KGC::OLINE_INCOMPLETION_SYMBOL) +
(KGC::OLINE_SERIAL_NUMBER ? sprintf("%0*d : ",
KGC::OLINE_SERIAL_NUMBER_DIGITS, @data[index].index + 1) : "") +
@data[index].title
# 描画色設定
draw_color = $game_system.outline_enable[@data[index].index] ?
normal_color : disabled_color
draw_shadow_text([0, 32 * index], transfer(text), draw_color)
end
end
#==============================================================================
# ■ OutlineList_Info
#------------------------------------------------------------------------------
# あらすじ一覧の情報を保持するクラスです。
#==============================================================================
class OutlineList_Info
attr_accessor :title, :contents, :index
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(title = "", contents = nil, index = 0)
@title = title
@contents = contents
@index = index
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_OutlineTitle
#------------------------------------------------------------------------------
# あらすじの題名を表示するウィンドウです。
#==============================================================================
class Window_OutlineTitle < Window_Base
include DIAMOND
include RUBY_SYS
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
end
#--------------------------------------------------------------------------
# ● リフレッシュ
# text : 表示する文字列
#--------------------------------------------------------------------------
def refresh(text)
self.contents.clear
draw_shadow_text([0, 0], transfer(text), normal_color, 1)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Outline
#------------------------------------------------------------------------------
# あらすじ(の内容)を表示するウィンドウです。
#==============================================================================
class Window_Outline < Window_Base
include DIAMOND
include RUBY_SYS
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
self.active = false
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
# oline : あらすじ
#--------------------------------------------------------------------------
def refresh(oline = nil)
self.oy = 0
self.contents.dispose if self.contents != nil
return if oline == nil
# 本文を描画
self.contents = Bitmap.new(self.width - 32, 32 * oline.size)
oline.each_with_index { |line ,i|
next if line == nil
text = transfer(line)
draw_shadow_text([0, i * 32], text)
}
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
# スクロール
if self.active
scroll_max = [self.contents.height - (self.height - 32), 0].max
if Input.press?(Input::UP)
self.oy = [self.oy - KGC::OLINE_SCROLL_SPEED, 0].max
elsif Input.press?(Input::DOWN)
self.oy = [self.oy + KGC::OLINE_SCROLL_SPEED, scroll_max].min
elsif Input.repeat?(Input::L)
self.oy = [self.oy - (self.height - 32), 0].max
elsif Input.repeat?(Input::R)
self.oy = [self.oy + (self.height - 32), scroll_max].min
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Outline
#------------------------------------------------------------------------------
# あらすじ画面の処理を行うクラスです。
#==============================================================================
class Scene_Outline
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# map_call : マップからの呼び出しフラグ
#--------------------------------------------------------------------------
def initialize(map_call = false)
@map_call = map_call
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# スプライトセットを作成
@spriteset = Spriteset_Map.new if KGC::OLINE_BACK_TRANSPARENT
# ウィンドウを作成
@list_window = Window_OutlineList.new
@title_window = Window_OutlineTitle.new
@content_window = Window_Outline.new
# トランジション実行
Graphics.transition
# メインループ
loop {
Graphics.update
Input.update
update
if $scene != self
break
end
}
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@list_window.dispose
@title_window.dispose
@content_window.dispose
@spriteset.dispose if KGC::OLINE_BACK_TRANSPARENT
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウ更新
@list_window.update
@title_window.update
@content_window.update
# アクティブウィンドウ操作
if @list_window.active
update_list
elsif @content_window.active
update_content
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (リスト)
#--------------------------------------------------------------------------
def update_list
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
Sound.play_cancel
if @map_call
# マップ画面に切り替え
$scene = Scene_Map.new
else
# メニュー画面に切り替え
if $imported["MenuAlter"]
index = KGC::MA_COMMANDS.index(12)
if index != nil
$scene = Scene_Menu.new(index)
else
$scene = Scene_Menu.new
end
else # 通常の場合
$scene = Scene_Menu.new
end # $imported["MenuAlter"]
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
outline = @list_window.outline
# 閲覧できない場合
if outline.contents == nil
# ブザー SE を演奏
Sound.play_buzzer
return
end
# 決定 SE を演奏
Sound.play_ok
# あらすじを更新
@title_window.refresh(outline.title)
@content_window.refresh(outline.contents)
# ウィンドウ切り替え
@list_window.deactivate
@list_window.z = 0
@content_window.activate
@content_window.z = 1000
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (本文)
#--------------------------------------------------------------------------
def update_content
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
Sound.play_cancel
# ウィンドウ切り替え
@list_window.activate
@list_window.z = 1000
@content_window.deactivate
@content_window.z = 0
return
end
end
end
class Interpreter
#--------------------------------------------------------------------------
# ● あらすじの有効化
#--------------------------------------------------------------------------
def outline_enabled(n)
if n.is_a?(Numeric)
KGC::Outline.set_enabled(n, true)
else
p "数値以外が設定されました。"
end
end
#--------------------------------------------------------------------------
# ● あらすじの無効化
#--------------------------------------------------------------------------
def outline_disabled(n)
if n.is_a?(Numeric)
KGC::Outline.set_enabled(n, false)
else
p "数値以外が設定されました。"
end
end
#--------------------------------------------------------------------------
# ● あらすじの完了化
#--------------------------------------------------------------------------
def outline_completed(n)
if n.is_a?(Numeric)
KGC::Outline.set_completed(n, true)
else
p "数値以外が設定されました。"
end
end
#--------------------------------------------------------------------------
# ● あらすじの未完了化
#--------------------------------------------------------------------------
def outline_uncompleted(n)
if n.is_a?(Numeric)
KGC::Outline.set_completed(n, false)
else
p "数値以外が設定されました。"
end
end
end
|