Mian 위에 새로운 항목을 생성하여 이것을 넣습니다.
$game_special_elements = {}
$imported = {}
$data_states = load_data("Data/States.rxdata")
$data_system = load_data("Data/System.rxdata")
그리고 Main 위에 또다른 항목을 생성하여 이것을 넣습니다.
발동하려면, 이벤트를 삽입하고, 스크립트를 넣습니다. 내용은 call_depository 입니다.
#==============================================================================
# ★ 커스터마이즈(customize) 항목 ★
#==============================================================================
class Window_DepositoryCommand < Window_Selectable
# ◆操作ウィンドウのコマンド名
DEPOSITORY_COMMAND = [
"입금", # お金を預ける
"출금", # お金を引き出す
"아이템보관", # アイテムを預ける
"아이템찾기" # アイテムを引き出す
]
# ◆操作ウィンドウのヘルプ
DEPOSITORY_HELP = [
"돈을 맡깁니다 최대 10억 까지 가능합니다", # お金を預ける
"돈을 찾습니다", # お金を引き出す
"아이템을 맡깁니다", # アイテムを預ける
"아이템을 찾습니다" # アイテムを引き出す
]
end
class Window_DepositoryGold < Window_Base
# ◆金額指定の桁?
GOLD_DIGITS = 10
end
class Scene_Depository
# ◆ゴ?ルドを預ける際のメッセ?ジ(ヘルプウィンドウ)
DEPOSIT_GOLD = "돈을 얼마나 입금합니까?"
# ◆ゴ?ルドを引き出す際のメッセ?ジ(ヘルプウィンドウ)
WDEPOSIT_GOLD = "돈을 얼마나 출금합니까?"
# ◆アイテムを預ける際のメッセ?ジ(個?ウィンドウ)
DEPOSIT_ITEM = "아이템을 몇개 맡깁니까?"
# ◆アイテムを引き出す際のメッセ?ジ(個?ウィンドウ)
WDEPOSIT_ITEM = "아이템을 몇개 찾습니까?"
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#--------------------------------------------------------------------------
# ● 預かり所呼び出し
#--------------------------------------------------------------------------
def call_depository
# プレイヤ?の姿勢を矯正
$game_player.straighten
# 預かり所?面に切り替え
$scene = Scene_Depository.new
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# パ?ティを扱うクラスです。ゴ?ルドやアイテムなどの情報が含まれます。このク
# ラスのインスタンスは $game_party で?照されます。
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_Depository initialize
def initialize
# 元の?理を?行
initialize_KGC_Depository
@deposit_gold = 0
@deposit_item = []
@deposit_weapon = []
@deposit_armor = []
end
#--------------------------------------------------------------------------
# ● 預けた金取得
#--------------------------------------------------------------------------
def deposit_gold
@deposit_gold = 0 if @deposit_gold == nil
return @deposit_gold
end
#--------------------------------------------------------------------------
# ● 預けた金?加
# number : ?加量
#--------------------------------------------------------------------------
def gain_deposit_gold(number)
@deposit_gold = 0 if @deposit_gold == nil
@deposit_gold += number
end
#--------------------------------------------------------------------------
# ● 預けた金減少
# number : 減少量
#--------------------------------------------------------------------------
def lose_deposit_gold(number)
self.gain_deposit_gold(-number)
end
#--------------------------------------------------------------------------
# ● 預けたアイテム取得
# id : ID
#--------------------------------------------------------------------------
def deposit_item_number(id)
@deposit_item = [] if @deposit_item == nil
return @deposit_item[id] != nil ? @deposit_item[id] : 0
end
#--------------------------------------------------------------------------
# ● 預けたアイテム?加
# id : ID
# number : 個?
#--------------------------------------------------------------------------
def gain_deposit_item(id, number)
@deposit_item = [] if @deposit_item == nil
@deposit_item[id] = 0 if @deposit_item[id] == nil
@deposit_item[id] += number
end
#--------------------------------------------------------------------------
# ● 預けたアイテム減少
# id : ID
# number : 個?
#--------------------------------------------------------------------------
def lose_deposit_item(id, number)
self.gain_deposit_item(id, -number)
end
#--------------------------------------------------------------------------
# ● 預けた武器取得
# id : ID
#--------------------------------------------------------------------------
def deposit_weapon_number(id)
@deposit_weapon = [] if @deposit_weapon == nil
return @deposit_weapon[id] != nil ? @deposit_weapon[id] : 0
end
#--------------------------------------------------------------------------
# ● 預けた武器?加
# id : ID
# number : 個?
#--------------------------------------------------------------------------
def gain_deposit_weapon(id, number)
@deposit_weapon = [] if @deposit_weapon == nil
@deposit_weapon[id] = 0 if @deposit_weapon[id] == nil
@deposit_weapon[id] += number
end
#--------------------------------------------------------------------------
# ● 預けた武器減少
# id : ID
# number : 個?
#--------------------------------------------------------------------------
def lose_deposit_weapon(id, number)
self.gain_deposit_weapon(id, -number)
end
#--------------------------------------------------------------------------
# ● 預けた防具取得
# id : ID
#--------------------------------------------------------------------------
def deposit_armor_number(id)
@deposit_armor = [] if @deposit_armor == nil
return @deposit_armor[id] != nil ? @deposit_armor[id] : 0
end
#--------------------------------------------------------------------------
# ● 預けた防具?加
# id : ID
# number : 個?
#--------------------------------------------------------------------------
def gain_deposit_armor(id, number)
@deposit_armor = [] if @deposit_armor == nil
@deposit_armor[id] = 0 if @deposit_armor[id] == nil
@deposit_armor[id] += number
end
#--------------------------------------------------------------------------
# ● 預けた防具減少
# id : ID
# number : 個?
#--------------------------------------------------------------------------
def lose_deposit_armor(id, number)
self.gain_deposit_armor(id, -number)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_DepositoryCommand
#------------------------------------------------------------------------------
# 預かり所?面で、操作を選?するウィンドウです。
#==============================================================================
class Window_DepositoryCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 64)
self.y = 128 if $imported["HelpExtension"]
self.contents = Bitmap.new(width - 32, height - 32)
# コマンド一?を作成
@commands = DEPOSITORY_COMMAND
@item_max = @commands.size
@column_max = @commands.size
@item_width = (width - 32) / @commands.size
self.back_opacity = 160
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
for i in 0...@commands.size
rect = Rect.new(@item_width * i, 0, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(rect, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
# ● カ?ソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if index != -1
self.cursor_rect.set(@item_width * index, 0, @item_width, 32)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(DEPOSITORY_HELP[self.index])
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_DepositoryGold
#------------------------------------------------------------------------------
# 預かり所?面で、金額を入力するウィンドウです。
#==============================================================================
class Window_DepositoryGold < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 352)
if $imported["HelpExtension"]
self.y = 192
self.height = 288
end
@digits_max = GOLD_DIGITS
# ?字の幅からカ?ソルの幅を計算 (0~9 は等幅と?定)
dummy_bitmap = Bitmap.new(32, 32)
@cursor_width = dummy_bitmap.text_size("0").width + 8
dummy_bitmap.dispose
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
self.active = false
self.visible = false
@cursor_position = 0
@max = 0
@price = 0
@index = 0
end
#--------------------------------------------------------------------------
# ● 入力された金額の取得
#--------------------------------------------------------------------------
def price
return @price
end
#--------------------------------------------------------------------------
# ● 金額の設定
# np : 新しい金額
#--------------------------------------------------------------------------
def price=(np)
@price = [[np, 0].max, @max].min
redraw_price
end
#--------------------------------------------------------------------------
# ● リセット
# type : 形式
#--------------------------------------------------------------------------
def reset(type)
@price = 0
@index = @digits_max - 1
refresh(type)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
# type : 形式
#--------------------------------------------------------------------------
def refresh(type)
# 金額を描?
self.contents.clear
domination = $data_system.words.gold
cx = contents.text_size(domination).width
@cursor_position = 332 - cx - @cursor_width * @digits_max
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 608, 32, "골드")
self.contents.draw_text(0, 64, 608, 32, "예금잔고")
if type == 0
self.contents.draw_text(0, 128, 608, 32, "맡기는 금액")
@max = $game_party.gold
else
self.contents.draw_text(0, 128, 608, 32, "꺼내는 금액")
@max = [10 ** @digits_max - $game_party.gold - 1, $game_party.deposit_gold].min
end
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 326 - cx, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(332 - cx, 32, cx, 32, domination, 2)
self.contents.font.color = normal_color
self.contents.draw_text(4, 96, 326 - cx, 32, $game_party.deposit_gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(332 - cx, 96, cx, 32, domination, 2)
redraw_price
end
#--------------------------------------------------------------------------
# ● 金額再描?
#--------------------------------------------------------------------------
def redraw_price
domination = $data_system.words.gold
cx = contents.text_size(domination).width
self.contents.fill_rect(0, 160, 608, 32, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
text = sprintf("%0#{@digits_max}d", self.price)
for i in 0...text.length
x = @cursor_position + (i - 1) * @cursor_width
self.contents.draw_text(x, 160, 32, 32, text[i, 1], 2)
end
self.contents.font.color = system_color
self.contents.draw_text(332 - cx, 160, cx, 32, domination, 2)
end
#--------------------------------------------------------------------------
# ● カ?ソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
x = @cursor_position + @index * @cursor_width
self.cursor_rect.set(x, 160, @cursor_width, 32)
end
#--------------------------------------------------------------------------
# ● フレ?ム更新
#--------------------------------------------------------------------------
def update
super
return unless self.active
# 方向ボタンの上か下が押された場合
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
# 現在の位の?字を取得し、いったん 0 にする
place = 10 ** (@digits_max - 1 - @index)
n = self.price / place % 10
self.price -= n * place
# 上なら +1、下なら -1
n = (n + 1) % 10 if Input.repeat?(Input::UP)
n = (n + 9) % 10 if Input.repeat?(Input::DOWN)
# 現在の位の?字を再設定
self.price += n * place
end
# カ?ソル右
if Input.repeat?(Input::RIGHT)
if @digits_max >= 2
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % @digits_max
end
end
# カ?ソル左
if Input.repeat?(Input::LEFT)
if @digits_max >= 2
$game_system.se_play($data_system.cursor_se)
@index = (@index + @digits_max - 1) % @digits_max
end
end
update_cursor_rect
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_DepositoryItem
#------------------------------------------------------------------------------
# 預かり所?面で、預けたアイテムの一?を表示するウィンドウです。
#==============================================================================
class Window_DepositoryItem < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 352)
if $imported["HelpExtension"]
self.y = 192
self.height = 288
end
self.back_opacity = 160
self.active = false
self.visible = false
@column_max = 2
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
# type : 形式
#--------------------------------------------------------------------------
def refresh(type)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
self.index = 0
# アイテム?武器?防具を追加
if type == 0
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
else
for i in 1...$data_items.size
if $game_party.deposit_item_number(i) > 0
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.deposit_weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.deposit_armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# 項目?が 0 でなければビットマップを作成し、全項目を描?
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i, type)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描?
# index : 項目番?
# type : 形式
#--------------------------------------------------------------------------
def draw_item(index, type)
item = @data[index]
case item
when RPG::Item
number = type == 0 ? $game_party.item_number(item.id) :
$game_party.deposit_item_number(item.id)
when RPG::Weapon
number = type == 0 ? $game_party.weapon_number(item.id) :
$game_party.deposit_weapon_number(item.id)
when RPG::Armor
number = type == 0 ? $game_party.armor_number(item.id) :
$game_party.deposit_armor_number(item.id)
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_DepositoryNumber
#------------------------------------------------------------------------------
# 預かり所で使用する、?値入力用のウィンドウです。
#==============================================================================
class Window_DepositoryNumber < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@digits_max = 2
@number = 0
# ?字の幅からカ?ソルの幅を計算 (0~9 は等幅と?定)
dummy_bitmap = Bitmap.new(32, 32)
@cursor_width = dummy_bitmap.text_size("0").width + 8
dummy_bitmap.dispose
@default_size = @cursor_width * @digits_max + 32
super(0, 0, @default_size, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 1000
self.back_opacity = 160
self.active = false
self.visible = false
@index = 0
@item = nil
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● アイテムの設定
# item : アイテム
#--------------------------------------------------------------------------
def item=(item)
@item = item
end
#--------------------------------------------------------------------------
# ● ?値の取得
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● ?値の設定
# number : 新しい?値
#--------------------------------------------------------------------------
def number=(number)
@number = [[number, 0].max, @max].min
refresh
end
#--------------------------------------------------------------------------
# ● カ?ソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(@index * @cursor_width, 32, @cursor_width, 32)
end
#--------------------------------------------------------------------------
# ● リセット
#--------------------------------------------------------------------------
def reset(type)
@number = 0
@index = @digits_max - 1
if type == 0
case @item
when RPG::Item
@max = $game_party.item_number(@item.id)
dep = $game_party.deposit_item_number(@item.id)
when RPG::Weapon
@max = $game_party.weapon_number(@item.id)
dep = $game_party.deposit_weapon_number(@item.id)
when RPG::Armor
@max = $game_party.armor_number(@item.id)
dep = $game_party.deposit_armor_number(@item.id)
end
# 預けている個?を描?
self.contents.fill_rect(0, 64, width - 32, 32, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(0, 64, width - 32, 32, "가지고 있는 수:#{dep}")
else
case @item
when RPG::Item
@max = [$game_party.deposit_item_number(@item.id),
10 ** @digits_max - $game_party.item_number(@item.id) - 1].min
having = $game_party.item_number(@item.id)
when RPG::Weapon
@max = [$game_party.deposit_weapon_number(@item.id),
10 ** @digits_max - $game_party.weapon_number(@item.id) - 1].min
having = $game_party.weapon_number(@item.id)
when RPG::Armor
@max = [$game_party.deposit_armor_number(@item.id),
10 ** @digits_max - $game_party.armor_number(@item.id) - 1].min
having = $game_party.armor_number(@item.id)
end
# 所持?を描?
self.contents.fill_rect(0, 64, width - 32, 32, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(0, 64, width - 32, 32, "보관소에 맡긴 수:#{having}")
end
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.fill_rect(0, 32, width - 32, 32, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
s = sprintf("%0*d", @digits_max, @number)
for i in 0...@digits_max
self.contents.draw_text(i * @cursor_width + 4, 32, 32, 32, s[i,1])
end
end
#--------------------------------------------------------------------------
# ● 文字列設定
# string : 設定文字列
#--------------------------------------------------------------------------
def set_text(string = " ")
self.resize(self.contents.text_size(string).width + 40)
self.contents.fill_rect(0, 0, width - 32, 32, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, width - 32, 32, string, 1)
refresh
centering
end
#--------------------------------------------------------------------------
# ● サイズ?更
# nw : 新しい幅
#--------------------------------------------------------------------------
def resize(nw)
self.width = nw
buf = self.contents.dup
self.contents.dispose
self.contents = Bitmap.new(nw - 32, 96)
self.contents.blt(0, 0, buf, buf.rect)
buf.dispose
end
#--------------------------------------------------------------------------
# ● 中央移動
#--------------------------------------------------------------------------
def centering
self.x = 320 - self.width / 2
self.y = 240 - self.height / 2
end
#--------------------------------------------------------------------------
# ● フレ?ム更新
#--------------------------------------------------------------------------
def update
super
return unless self.active
# 方向ボタンの上か下が押された場合
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
# 現在の位の?字を取得し、いったん 0 にする
place = 10 ** (@digits_max - 1 - @index)
n = self.number / place % 10
self.number -= n * place
# 上なら +1、下なら -1
n = (n + 1) % 10 if Input.repeat?(Input::UP)
n = (n + 9) % 10 if Input.repeat?(Input::DOWN)
# 現在の位の?字を再設定
self.number += n * place
refresh
end
# カ?ソル右
if Input.repeat?(Input::RIGHT)
if @digits_max >= 2
$game_system.se_play($data_system.cursor_se)
@index = (@index + 1) % @digits_max
end
end
# カ?ソル左
if Input.repeat?(Input::LEFT)
if @digits_max >= 2
$game_system.se_play($data_system.cursor_se)
@index = (@index + @digits_max - 1) % @digits_max
end
end
update_cursor_rect
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Depository
#------------------------------------------------------------------------------
# 預かり所?面の?理を行うクラスです。
#==============================================================================
class Scene_Depository
#--------------------------------------------------------------------------
# ● メイン?理
#--------------------------------------------------------------------------
def main
# スプライトセット作成
@spriteset = Spriteset_Map.new
# 各種ウィンドウを作成
if $imported["HelpExtension"]
@dummy_window = Window_Base.new(0, 192, 640, 288)
@help_window = Window_HelpExtension.new
else
@dummy_window = Window_Base.new(0, 128, 640, 352)
@help_window = Window_Help.new
end
@dummy_window.back_opacity = 160
@help_window.back_opacity = 160
@command_window = Window_DepositoryCommand.new
@gold_window = Window_DepositoryGold.new
@item_window = Window_DepositoryItem.new
@number_window = Window_DepositoryNumber.new
# ヘルプウィンドウを?連付け
@command_window.help_window = @help_window
@item_window.help_window = @help_window
# トランジション?行
Graphics.transition
# メインル?プ
loop do
# ゲ?ム?面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレ?ム更新
update
# ?面が切り替わったらル?プを中?
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# 解放
@spriteset.dispose
@dummy_window.dispose
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@item_window.dispose
@number_window.dispose
end
#--------------------------------------------------------------------------
# ● フレ?ム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@dummy_window.update
@help_window.update
@command_window.update
@gold_window.update
@item_window.update
@number_window.update
# コマンドウィンドウがアクティブの場合: update_command を呼ぶ
if @command_window.active
update_command
return
end
# ゴ?ルドウィンドウがアクティブの場合: update_gold を呼ぶ
if @gold_window.active
update_gold
return
end
# アイテムウィンドウがアクティブの場合: update_item を呼ぶ
if @item_window.active
update_item
return
end
# 個?ウィンドウがアクティブの場合: update_number を呼ぶ
if @number_window.active
update_number
return
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_command
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ?面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# カ?ソル位置で分岐
case @command_window.index
when 0
# ゴ?ルドウィンドウに切り替え
@gold_window.active = true
@gold_window.visible = true
@gold_window.reset(0)
@help_window.set_text(DEPOSIT_GOLD)
when 1
# ゴ?ルドウィンドウに切り替え
@gold_window.active = true
@gold_window.visible = true
@gold_window.reset(1)
@help_window.set_text(WDEPOSIT_GOLD)
when 2
# アイテムウィンドウに切り替え
@item_window.active = true
@item_window.visible = true
@item_window.refresh(0)
when 3
# アイテムウィンドウに切り替え
@item_window.active = true
@item_window.visible = true
@item_window.refresh(1)
end
@command_window.active = false
# ダミ?ウィンドウ消去
@dummy_window.visible = false
return
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (ゴ?ルドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_gold
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# コマンドウィンドウに切り替え
@command_window.active = true
@gold_window.active = false
@gold_window.visible = false
@dummy_window.visible = true
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 入力した金額を取得
price = @gold_window.price
# 金額が 0 の場合
if price == 0
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# コマンドウィンドウに切り替え
@command_window.active = true
@gold_window.active = false
@gold_window.visible = false
@dummy_window.visible = true
return
end
# ショップ SE を演奏
$game_system.se_play($data_system.shop_se)
# カ?ソル位置で分岐
case @command_window.index
when 0 # 預ける
$game_party.lose_gold(price)
$game_party.gain_deposit_gold(price)
when 1 # 引き出す
$game_party.gain_gold(price)
$game_party.lose_deposit_gold(price)
end
# ゴ?ルドウィンドウをリセット
@gold_window.reset(@command_window.index)
return
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_item
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# コマンドウィンドウに切り替え
@command_window.active = true
@item_window.active = false
@item_window.visible = false
@dummy_window.visible = true
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 選?アイテムを取得
@item = @item_window.item
# 空欄の場合
if @item == nil
# ブザ? SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 個?ウィンドウのアイテムを設定
@number_window.item = @item
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# カ?ソル位置で分岐
case @command_window.index
when 2 # 預ける
@number_window.set_text(DEPOSIT_ITEM)
when 3 # 引き出す
@number_window.set_text(WDEPOSIT_ITEM)
end
# 個?ウィンドウをリセット
@number_window.reset(@command_window.index - 2)
# 個?ウィンドウに切り替え
@item_window.active = false
@number_window.active = true
@number_window.visible = true
return
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (個?ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_number
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテムウィンドウに切り替え
@item_window.active = true
@number_window.active = false
@number_window.visible = false
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
number = @number_window.number
# カ?ソル位置で分岐
case @command_window.index
when 2 # 預ける
case @item
when RPG::Item
$game_party.lose_item(@item.id, number)
$game_party.gain_deposit_item(@item.id, number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, number)
$game_party.gain_deposit_weapon(@item.id, number)
when RPG::Armor
$game_party.lose_armor(@item.id, number)
$game_party.gain_deposit_armor(@item.id, number)
end
when 3 # 引き出す
case @item
when RPG::Item
$game_party.gain_item(@item.id, number)
$game_party.lose_deposit_item(@item.id, number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, number)
$game_party.lose_deposit_weapon(@item.id, number)
when RPG::Armor
$game_party.gain_armor(@item.id, number)
$game_party.lose_deposit_armor(@item.id, number)
end
end
# アイテムウィンドウをリフレッシュ
@item_window.refresh(@command_window.index - 2)
# アイテムウィンドウに切り替え
@item_window.active = true
@number_window.active = false
@number_window.visible = false
return
end
end
end
[출처] RPGXP - 창고 스크랩트