=begin
脚本使用方法:
一. 多货币:
1. 在 93 行里定义货币的类型;
2. 在 98 行里定义要显示的货币类型;
二. 银行 和 仓库
没什么好说的, 只是在脚本开头定义用语,还有一些文件名什么的。
三. 图片
图片尽量使用 160 * 304 ,大于也可以,脚本用自动截取这个部分。
在游戏中替换图片的话,使用:
$game_system.bank_loli_bitmap = "文件名"
增加 远景图 :
$game_system.back_bank_bitmap = "文件名"
四. 脚本的调用
1. 可以在事件里写上 : $scene = Scene_Byz_Bank.new
也可以在脚本里使用。
2. 多货币的使用
除了上面说的意外, 可以在游戏中使用:
$game_system.currrncysize = 一个数组
来改变货币的显示种类。
默认的货币操作都是有一个当前活动的货币种类的,要改变的话,就使用:
$game_system.nowcurrency = 货币种类的序号
普通的加减金钱都是一样的,要增加其他种类的金钱的话,使用:
$game_party.gain_gold(n, currency)
n 数量
currency 货币种类的序号,不填的话,就是默认对当前活动的货币
减少的话,就是 $game_party.lose_gold(n, currency) , 参数意义同上
3. 银行
使用 $game_party.gain_bank_gold(数组) 来启动银行的利息计算。
(注意,数组的长度就是 循环计算的次数,数组元素就是每次计算的利率)
五 数字的移动速度
脚本 42 行设定 速度,
注意:这里设定的数值的整数倍最好是 数字图片高度,不然会有莫名其妙的事
情发生
=end
#==============================================================================
#==============================================================================
#
# ■ [vx]多货币的银行和仓库
#------------------------------------------------------------------------------
# by 八云 紫
# 转载时,请注明 本脚本来着 66RPG,
#==============================================================================
#==============================================================================
#==============================================================================
# ■ Byz_Vocab
#------------------------------------------------------------------------------
# 定义系统用语和信息的模块。
#==============================================================================
module Byz_Vocab
#------ 总菜单 ---------
BANK = "银行"
WAREHOUSE = "仓库"
#------ 银行 ---------
BANK_SAVING = "存钱"
BANK_TAKING = "取钱"
BANK_EXCHANGE = "兑换"
MONEY_INSUFF = "您的钱不足"
PROMPTS = "帐户信息"
#------ 仓库 ---------
WAREHOUSE_SAVING = "存东西"
WAREHOUSE_TAKING = "取东西"
#------ 共通 ---------
CANCEN = "取消"
NAME1 = "欢迎"
NAME2 = "银行"
NAME3 = "仓库"
# 箭头文件名字, 放到 Graphics\Pictures 目录下。
ARROW = "Correct_R"
ARROW_TWO = "Cursor"
# 数字文件名字, 放到 Graphics\System 目录下。
NUMBER = "Number-"
# 存物品的时候的价格
PRICES = 10
# 数字移动速度(注意:这里设定的数值的整数倍最好是 数字图片高度)
SPEED = 1
end
#==============================================================================
# ■ RPG
#==============================================================================
module RPG
#--------------------------------------------------------------------------
# ● 物品
#--------------------------------------------------------------------------
class Item < UsableItem
def price
return (@price / Currency::Currencies[$game_system.nowcurrency][1]).to_i
end
def price=(value)
@price = value
end
end
#--------------------------------------------------------------------------
# ● 武器 Interest rate
#--------------------------------------------------------------------------
class Weapon < BaseItem
def price
return (@price / Currency::Currencies[$game_system.nowcurrency][1]).to_i
end
def price=(value)
@price = value
end
end
#--------------------------------------------------------------------------
# ● 防具
#--------------------------------------------------------------------------
class Armor < BaseItem
def price
return (@price / Currency::Currencies[$game_system.nowcurrency][1]).to_i
end
def price=(value)
@price = value
end
end
end
#==============================================================================
# ■ Vocab
#------------------------------------------------------------------------------
# 定义系统用语和信息的模块。利用定量直接定义Message。
# 使用全局变量 $data_system 取得用语资料。
#==============================================================================
module Vocab
# G (货币单位)
def self.gold
return Currency::Currencies[$game_system.nowcurrency][0]
end
end
#==============================================================================
# ■ Currency
#------------------------------------------------------------------------------
# 保存货币信息的模块
#==============================================================================
module Currency
Currencies = []
# 货币种类设置。 参数一为货币名称,参数二为该货币与0号货币的比值。
Currencies[0] = ["金币", 1 ] # 1 RMB = 1 RMB
Currencies[1] = ["凡仙币" , 1 ] # 1 USD = 7 RMB
Currencies[2] = ["金砖" , 10000 ] # 1 EUR = 10 RMB
Currencies[3] = ["金箱" , 1000000 ] # 1 EUR = 0.001 RMB
CURRENCIES_SHOW = [0,1,2,3] # 要显示的货币代号
end
class Bitmap
#--------------------------------------------------------------------------
# ● 描绘直线
# x1,y1,x2,y2: 直线两端的坐标
# width: 宽度
# color: 颜色
#--------------------------------------------------------------------------
def drawline(x1, y1, x2, y2, width, color)
x1 = x1.to_f
y1 = y1.to_f
x2 = x2.to_f
y2 = y2.to_f
width = width.to_f
k = (y2 - y1) / (x2 - x1)
if k.abs > 1
drawline_x(x1, y1, x2, y2, width, color)
else
drawline_y(x1, y1, x2, y2, width, color)
end
end
def drawline_x(x1, y1, x2, y2, width, color)
l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (y1 - y2)
length = l.abs * 2
k = (x2 - x1) / (y2 - y1) #x=ky+b
b = x1 - k * y1
if l > 0
for ty in y2.to_i..y1.to_i
tx = ty * k + b
fill_rect(tx - l, ty, length, 1, color)
end
else
for ty in y1.to_i..y2.to_i
tx = ty * k + b
fill_rect(tx + l, ty, length, 1, color)
end
end
end
def drawline_y(x1, y1, x2, y2, width, color)
l = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 * width / (x1 - x2)
height = l.abs * 2
k = (y2 - y1) / (x2 - x1) #y=kx+b
b = y1 - k * x1
if l > 0
for tx in x2.to_i..x1.to_i
ty = tx * k + b
fill_rect(tx, ty - l, 1, height, color)
end
else
for tx in x1.to_i..x2.to_i
ty = tx * k + b
fill_rect(tx, ty + l, 1, height, color)
end
end
end
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# 处理系统附属数据的类。也可执行诸如 BGM 管理、交通工具之类的功能。本类的实
# 例请参考 $game_system 。
#==============================================================================
class Game_System
attr_accessor :nowcurrency # 当前货币类型
attr_accessor :currrncysize # 货币长度
attr_accessor :bank_loli_bitmap
attr_accessor :back_bank_bitmap
attr_accessor :prices # 存物品的收费价格
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias old_initialize initialize
def initialize
old_initialize
@nowcurrency = 0
@bank_loli_bitmap = "MM_Pic1"
@back_bank_bitmap = "back"
@prices = Byz_Vocab::PRICES
@currrncysize = Currency::CURRENCIES_SHOW
end
#--------------------------------------------------------------------------
# ● 兑换货币
#--------------------------------------------------------------------------
def convert_currency(source, dest, value)
$game_party.lose_gold(value, source)
$game_party.gain_gold((value * Currency::Currencies[source][1] / Currency::Currencies[dest][1]).to_i, dest)
return Integer(value * Currency::Currencies[source][1] / Currency::Currencies[dest][1])
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 处理队伍的类。包含金钱以及物品的信息。
# 这个类的实例请参考 $game_party 。
#==============================================================================
class Game_Party < Game_Unit
attr_accessor :warehouse_gold # 银行金钱
attr_accessor :warehouse # 仓库
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias initialize_currency initialize
def initialize
initialize_currency
@gold = []
for i in 0...Currency::Currencies.size
@gold = 0
end
@warehouse_gold = []
for i in 0...Currency::Currencies.size
@warehouse_gold = 0
end
@warehouse_item = {} # 仓库物品
@warehouse_weapon = {} # 仓库武器
@warehouse_armor = {} # 仓库防具
@warehouse = [@warehouse_item, @warehouse_weapon, @warehouse_armor]
end
def gain_bank_gold(array)
for i in array
$game_system.currrncysize.each{|index|
@warehouse_gold[index] += ((@warehouse_gold[index]).to_f * array[index]).to_i}
end
end
#--------------------------------------------------------------------------
# ● 增加金钱(减少)
# n : 金额
#--------------------------------------------------------------------------
def gain_gold(n, currency = -1)
currency = $game_system.nowcurrency if currency == -1
#~ @gold[currency] = [[@gold[currency] + n, 0].max, 999999999].min
@gold[currency] = [@gold[currency] + n, 0].max
end
#--------------------------------------------------------------------------
# ● 减少金钱
# n : 金额
#--------------------------------------------------------------------------
def lose_gold(n, currency = -1)
gain_gold(-n, currency)
end
#--------------------------------------------------------------------------
# ● 货币接口
#--------------------------------------------------------------------------
def gold(currency = -1)
currency = $game_system.nowcurrency if currency == -1
return @gold[currency]
end
end
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# 执行事件命令的解释器。本类在 Game_System 类
# 与 Game_Event 类的内部使用。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 脚本 (choose_currency)
#--------------------------------------------------------------------------
def choose_currency
@choose = []
for i in 0...Currency::Currencies.size
@choose=Currency::Currencies[0]
end
Graphics.update
returnval=-1
@command_window = Window_Command.new(320,@choose)
@command_window.x = 112
@command_window.y = 128
@command_window.height=160
@command_window.opacity = 0
@command_window.z=9999
for i in 0...32
@command_window.opacity = 8 * i
@command_window.update
Graphics.update
end
loop do
@command_window.update
Graphics.update
Input.update
if Input.trigger?(Input::C)
returnval = @command_window.index
break
end
if Input.trigger?(Input::B)
returnval = -1
break
end
end
for i in 0...32
@command_window.opacity = 256 - (8 * i)
@command_window.update
Graphics.update
end
@command_window.dispose
Graphics.update
Input.update
return returnval
end
end
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
# 显示金钱的窗口。
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
# x : 窗口的X坐标
# y : 窗口的Y坐标
#--------------------------------------------------------------------------
def initialize(x, y)
if $scene.is_a?(Scene_Menu)
super(0, 416 - (WLH * $game_system.currrncysize.size + 32), 160, WLH * $game_system.currrncysize.size + 32)
elsif $scene.is_a?(Scene_Byz_Bank)
super(384, 416 - (WLH * $game_system.currrncysize.size + 32), 160, WLH * $game_system.currrncysize.size + 32)
else
super(x, y, 160, WLH + 32)
end
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_Byz_Bank)
j = 0
for i in $game_system.currrncysize
draw_currency_item($game_party.gold(i), 4, j * WLH, 120, i)
j += 1
end
else
draw_currency_value($game_party.gold, 4, 0, 120)
end
end
def draw_currency_item(value, x, y, width, currency)
cx = contents.text_size(Currency::Currencies[currency][0]).width
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width-cx-2, WLH, value, 2)
self.contents.font.color = system_color
self.contents.font.color = text_color(2) if currency == $game_system.nowcurrency
self.contents.draw_text(x, y, width, WLH, Currency::Currencies[currency][0], 2)
end
end
#==============================================================================
# ■ Window_Bank_Gold
#==============================================================================
class Window_Bank_Gold < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 111, 384, 305)
@column_max = 1
@item_max = $game_system.currrncysize.size
self.index = -1
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
j = 0
self.contents.draw_text(2, 2, 330, WLH, Byz_Vocab::PROMPTS)
self.contents.drawline(4, 35, 380, 35, 2, Color.new(248, 44, 255, 200))
for i in $game_system.currrncysize
$game_party.warehouse_gold = 0 if nil == $game_party.warehouse_gold
draw_currency_item($game_party.warehouse_gold, 0, j * WLH + 40, 120, i)
j += 1
end
end
def draw_currency_item(value, x, y, width, currency)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 330, WLH, value, 2)
self.contents.font.color = system_color
self.contents.font.color = text_color(2) if currency == $game_system.nowcurrency
self.contents.draw_text(x, y, width, WLH, Currency::Currencies[currency][0])
end
#--------------------------------------------------------------------------
# ● 获取项目要描画的矩形
# index : 项目编号
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH + 40
return rect
end
end
#==============================================================================
# ■ Window_Warehouse
#==============================================================================
class Window_Warehouse < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
# kind : 0 物品 bool :0 背包
# : 1 武器 :1 仓库
# :2 防具
#--------------------------------------------------------------------------
def initialize(kind, bool)
super(100, 110, 285, 202)
@kind = kind
@bool = bool
@column_max = 1
@help_window = Window_Help.new
@last_kind = @kind + 1
self.index = 0
@last_index = self.index + 1
@data = []
refresh
end
#--------------------------------------------------------------------------
# ● 写入 kind
#--------------------------------------------------------------------------
def kind=(index)
@kind = index
refresh
end
#--------------------------------------------------------------------------
# ● 获取 obj
#--------------------------------------------------------------------------
def check
if @data[self.index] == nil
return nil
else
return @data[self.index].id
end
end
#--------------------------------------------------------------------------
# ● 刷新开关
#--------------------------------------------------------------------------
def refresh_bool
@last_index = self.index + 1
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if @bool == 1
dates = []
dates.clear
@data.clear
$game_party.warehouse[@kind].each_key {|key|
next if $game_party.warehouse[@kind][key] == nil
dates.push(key)}
if dates.size == 0
@data.clear
end
dates.sort!
if @kind == 0
dates.each{|index| @data.push($data_items[index])}
elsif @kind == 1
dates.each{|index| @data.push($data_weapons[index])}
elsif @kind == 2
dates.each{|index| @data.push($data_armors[index])}
end
@item_max = @data.size
@item_max = 300 if @item_max > 300
else
@data.clear
for item in $game_party.items
if @kind == 0
@data.push(item) if item.is_a?(RPG::Item)
elsif @kind == 1
@data.push(item) if item.is_a?(RPG::Weapon)
elsif @kind == 2
@data.push(item) if item.is_a?(RPG::Armor)
end
end
@item_max = @data.size
@item_max = 300 if @item_max > 300
end
return if 0 == @item_max
self.contents.clear
create_contents
if @data.size != 0
@data.each_index{|index| draw_item(index)}
end
end
def update
super
if @last_index != self.index or @last_kind != @kind
item_index = check
if item_index != nil
if @kind == 0
set_item($data_items[item_index])
elsif @kind == 1
set_item($data_weapons[item_index])
elsif @kind == 2
set_item($data_armors[item_index])
end
else
self.contents.clear
end
refresh
@last_index = self.index
@last_kind = @kind
end
end
def dispose
super
@help_window.dispose
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
item = @data[index]
self.contents.clear_rect(rect)
if item != nil
if @bool == 1
number = $game_party.warehouse[@kind][@data[index].id]
else
number = $game_party.item_number(item)
end
rect.width -= 4
draw_item_name(item, rect.x, rect.y, true)
self.contents.draw_text(rect, sprintf("%10d", number), 2)
else
self.contents.clear
end
end
def set_item(item)
@help_window.set_text(item)
#修正窗口位置
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
end
end
#==============================================================================
# ■ Window_Byz_Help 物品帮助
#==============================================================================
class Window_Byz_Help < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 312, 544, 104)
end
def clear
self.contents.clear
end
#--------------------------------------------------------------------------
# ● 文字设定
# item : 物品
#--------------------------------------------------------------------------
def set_item(item)
if item.nil?
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 512, 24, $game_temp.shop_word)
@item = nil
return
end
if item != @item
@item = item
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 512, 24, @item.description)
if @item.is_a?(RPG::Item)
# 物品范围描述
scope = "[对象] : "
case @item.scope
when 0; scope += "无"
when 1; scope += "敌单体"
when 2; scope += "敌全体"
when 3; scope += "敌单体 连续"
when 4; scope += "敌单体 随机"
when 5; scope += "敌二体 随机"
when 6; scope += "敌三体 随机"
when 7; scope += "我方单体"
when 8; scope += "我方全体"
when 9; scope += "我方单体 (阵亡)"
when 10; scope += "我方全体 (阵亡)"
when 11; scope += "使用者"
end
self.contents.draw_text(0, 24, 512, 24, scope)
# 物品范围描述结束
# 物品恢复效果描述
effection = "[效果] : "
if @item.hp_recovery_rate > 0
effection += "#{Vocab.hp}+#{@item.hp_recovery_rate}% "
elsif @item.hp_recovery_rate < 0
effection += "#{Vocab.hp}-#{@item.hp_recovery_rate}% "
elsif @item.hp_recovery > 0
effection += "#{Vocab.hp}+#{@item.hp_recovery} "
elsif @item.hp_recovery < 0
effection += "#{Vocab.hp}-#{@item.hp_recovery} "
end
if @item.mp_recovery_rate > 0
effection += "#{Vocab.mp}+#{@item.mp_recovery_rate}% "
elsif @item.mp_recovery_rate < 0
effection += "#{Vocab.mp}-#{@item.mp_recovery_rate}% "
elsif @item.mp_recovery > 0
effection += "#{Vocab.mp}+#{@item.mp_recovery} "
elsif @item.mp_recovery < 0
effection += "#{Vocab.mp}-#{@item.mp_recovery} "
end
effection += "伤害#{@item.base_damage} " if @item.base_damage != 0
case @item.parameter_type
when 1
effection += "最大#{Vocab.hp}+#{@item.parameter_points}"
when 2
effection += "最大#{Vocab.mp}+#{@item.parameter_points}"
when 3
effection += "#{Vocab.atk}+#{@item.parameter_points}"
when 4
effection += "#{Vocab.def}+#{@item.parameter_points}"
when 5
effection += "#{Vocab.spi}+#{@item.parameter_points}"
when 6
effection += "#{Vocab.agi}+#{@item.parameter_points}"
end
self.contents.draw_text(0, 48, 512, 24, effection)
# 物品恢复效果描述结束
else
# 武器防具可装备人员描述
equip = "[可装备] : "
for actor in $game_party.members
if actor.equippable?(@item)
equip += "、" if equip != "[可装备] : "
equip += actor.name
end
end
equip += "无" if equip == "[可装备] : "
self.contents.draw_text(0, 24, 512, 24, equip)
# 武器防具可装备人员描述结束
# 武器防具攻防增减描述
effection = "[属性] : "
if @item.atk != 0
effection += "攻击力+#{@item.atk} "
end
if @item.def != 0
effection += "防御力+#{@item.def} "
end
if @item.spi != 0
effection += "精神力+#{@item.spi} "
end
if @item.agi != 0
effection += "敏捷性+#{@item.agi} "
end
# 武器防具攻防增减描述结束
if @item.is_a?(RPG::Armor)
# 防具特殊属性描述
if @item.prevent_critical
effection += "防止会心一击 "
end
if @item.half_mp_cost
effection += "消费MP减半 "
end
if @item.double_exp_gain
effection += "双倍经验 "
end
if @item.auto_hp_recover
effection += "自动恢复HP "
end
# 防具特殊属性描述结束
else
# 武器特殊属性描述
if @item.two_handed
effection += "双手持 "
end
if @item.fast_attack
effection += "先发制人 "
end
if @item.dual_attack
effection += "连击 "
end
if @item.critical_bonus
effection += "频发会心一击 "
end
# 武器特殊属性描述结束
end
unless @item.element_set.empty?
# 武器防具属性描述(左边那一栏需要打勾的)
effection += @item.is_a?(RPG::Armor) ? " [防具状态] : " : " [武器属性] : "
for state in @item.element_set
effection += $data_system.elements[state] + " "
end
# 武器防具属性描述结束
end
unless @item.state_set.empty?
# 武器防具状态描述(右边那一栏需要打勾的)
effection += @item.is_a?(RPG::Armor) ? " [无效化属性] : " : " [附加状态] : "
for state in @item.state_set
effection += $data_states[state].name + " "
end
# 武器防具状态描述结束
end
self.contents.draw_text(0, 48, 512, 24, effection)
end
end
end
end
#==============================================================================
# ■ Window_Byz_Name 标题名字
#==============================================================================
class Window_Byz_Name < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 56)
self.contents.draw_text(-10, -5, 190, 32, Byz_Vocab::NAME1, 1)
end
#--------------------------------------------------------------------------
# ● 设置
#--------------------------------------------------------------------------
def set(string)
self.contents.clear
self.contents.draw_text(-10, -5, 190, 32, string, 1)
end
end
#==============================================================================
# ■ Window_Byz_NumberInput
#------------------------------------------------------------------------------
# 信息窗口内部使用、输入数值的窗口。
#==============================================================================
class Window_Byz_NumberInput < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# digits_max : 行数
#--------------------------------------------------------------------------
def initialize(x, y, w, h)
super(x, y, w, h)
@w = w
@x = x
@y = y
@h = h
@digits_max = 8
@number = []
@index = 2
@refresh_bool = true
@bitmap = Bitmap.new("Graphics/System/#{Byz_Vocab::NUMBER}")
self.active = false
@viewport = Viewport.new(x+16, y+[email protected] - 20, w-32, @bitmap.height + 10)
@viewport.z = 9999
@sprite_number = []
for i in 0...@digits_max
@number = 0
@sprite_number = Sprite.new(@viewport)
@sprite_number.bitmap = @bitmap
@sprite_number.visible = false
end
refresh
update_cursor
end
#--------------------------------------------------------------------------
# ● 获取行数
#--------------------------------------------------------------------------
def digits_max
return @digits_max
end
#--------------------------------------------------------------------------
# ● 设置行数
# digits_max : 新行数
#--------------------------------------------------------------------------
def digits_max=(digits_max)
@digits_max = digits_max
refresh
end
#--------------------------------------------------------------------------
# ● 获取数值
#--------------------------------------------------------------------------
def number
n = 0
@number.each_index{|i| n += @number * 10 ** i}
return n
end
#--------------------------------------------------------------------------
# ● 设置数值
# number : 新数值
#--------------------------------------------------------------------------
def number=(number)
n = [number, 0].max
@index = 0
@number = dew(n)
refresh
end
#--------------------------------------------------------------------------
# ● 设置光标
#--------------------------------------------------------------------------
def index=(number)
@index = ([number, -1].max) % @digits_max
refresh
end
#--------------------------------------------------------------------------
# ● 光标向右移动
# wrap : 允许跳过
#--------------------------------------------------------------------------
def cursor_right(wrap)
if @index < @digits_max - 1 or wrap
@index = (@index + 1) % @digits_max
end
end
#--------------------------------------------------------------------------
# ● 光标向左移动
# wrap : 允许跳过
#--------------------------------------------------------------------------
def cursor_left(wrap)
if @index > 0 or wrap
@index = (@index + @digits_max - 1) % @digits_max
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
if self.active
n = @number[@index]
if Input.repeat?(Input::UP)
@number[@index] += 1
@number[@index] = 0 if n == 9
move_sprite(@sprite_number[@index], true)
end
if Input.repeat?(Input::DOWN)
@number[@index] -= 1
move_sprite(@sprite_number[@index], false)
end
refresh
last_index = @index
if Input.repeat?(Input::RIGHT)
cursor_left(Input.trigger?(Input::LEFT))
end
if Input.repeat?(Input::LEFT)
cursor_right(Input.trigger?(Input::RIGHT))
end
if @index != last_index
Sound.play_cursor
end
update_cursor
end
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if @refresh_bool
create_contents
self.contents.draw_text(0, 0, @w, WLH, "请输入数字:", 1)
self.contents.drawline(0, WLH * 2 + 5, @w, WLH * 2 + 5, 2, Color.new(248, 44, 255, 200))
@refresh_bool = false
end
for i in 0...@digits_max
show_sprite(@number, @sprite_number, @w - 32 - (i+1) * @bitmap.width / 10 - 8, 0)
end
end
#--------------------------------------------------------------------------
# ● 更新光标
#--------------------------------------------------------------------------
def update_cursor
self.cursor_rect.set(@w - 32 - (@index + 1) * @bitmap.width / 10 - 9, 80, @bitmap.width / 10, @bitmap.height)
end
#--------------------------------------------------------------------------
# ● 显示 Sprite
#--------------------------------------------------------------------------
def show_sprite(numbers, sprite, x, y)
sprite.src_rect.set(@bitmap.width / 10 * numbers, 0, @bitmap.width / 10, @bitmap.height)
sprite.x = x
sprite.y = y
sprite.visible = true
end
#--------------------------------------------------------------------------
# ● 移动 Sprite
# bool: 旋转方向
# true 向上
# false 向下
#--------------------------------------------------------------------------
def move_sprite(sprite, bool)
old_sprite = Sprite.new(@viewport)
old_sprite.visible = false
old_sprite.bitmap = @bitmap
old_sprite.x = sprite.x
old_sprite.y = 0
if bool
old_sprite.src_rect.x = sprite.src_rect.x + @bitmap.width / 10
old_sprite.src_rect.x = 0 if old_sprite.src_rect.x >= @bitmap.width
old_sprite.src_rect.x = 9 * @bitmap.width / 10 if old_sprite.src_rect.x < 0
old_sprite.src_rect.width = @bitmap.width / 10
old_sprite.oy = [email protected]
old_sprite.visible = true
for i in 0..(@bitmap.height / Byz_Vocab::SPEED)
old_sprite.oy += Byz_Vocab::SPEED
old_sprite.oy = 0 if old_sprite.oy > 0
sprite.oy += Byz_Vocab::SPEED
Graphics.update
end
@number[@index] = 0 if @number[@index] > 9
@number[@index] = 9 if @number[@index] < 0
show_sprite(@number[@index], sprite, sprite.x, sprite.y)
sprite.oy = 0
else
old_sprite.src_rect.x = sprite.src_rect.x - @bitmap.width / 10
old_sprite.src_rect.x = 9 * @bitmap.width / 10 if old_sprite.src_rect.x < 0
old_sprite.src_rect.x = 0 if old_sprite.src_rect.x > @bitmap.width
old_sprite.src_rect.width = @bitmap.width / 10
old_sprite.oy = @bitmap.height
old_sprite.visible = true
for i in 0..(@bitmap.height / Byz_Vocab::SPEED)
old_sprite.oy -= Byz_Vocab::SPEED
old_sprite.oy = 0 if old_sprite.oy < 0
sprite.oy -= Byz_Vocab::SPEED
Graphics.update
end
@number[@index] = 0 if @number[@index] > 9
@number[@index] = 9 if @number[@index] < 0
show_sprite(@number[@index], sprite, sprite.x, sprite.y)
sprite.oy = 0
end
old_sprite.dispose
end
#--------------------------------------------------------------------------
# ● 位拆分
#--------------------------------------------------------------------------
def dew(x)
return unless x.is_a?(Integer)
de = []
i = x % 10
while x >= 10
i = x % 10
de.push(i)
x /= 10
end
de.push(x)
return de
end
def dispose_sprite
@sprite_number.each_index{|i|
@sprite_number.visible = false
@sprite_number.bitmap.dispose
@sprite_number.dispose
}
@viewport.dispose
end
end
#==============================================================================
# ■ Window_ByzNumber
#==============================================================================
class Window_ByzNumber < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 304, 130)
@item = nil
@max = 1
@price = 0
@number = 1
end
#--------------------------------------------------------------------------
# ● 物品、最大个数、价格设定
#--------------------------------------------------------------------------
def set(item, max, price)
@item = item
@max = max
@price = price
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ● 取得数量
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● 取得总价格
#--------------------------------------------------------------------------
def price
return @price * @number
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
y = 5
self.contents.clear
draw_item_name(@item, 0, y)
self.contents.font.color = normal_color
self.contents.draw_text(212, y, 20, WLH, "×")
self.contents.draw_text(248, y, 20, WLH, @number, 2)
self.cursor_rect.set(244, y, 28, WLH)
self.contents.draw_text(0, y + WLH * 2, 100, WLH, "所需金钱")
draw_currency_value(@price * @number, 4, y + WLH * 2, 264)
self.contents.draw_text(0, y + WLH * 3, 100, WLH, "现有金钱")
draw_currency_value($game_party.gold, 4, y + WLH * 3, 264)
end
#--------------------------------------------------------------------------
# ● 更新(再定义)
#--------------------------------------------------------------------------
def update
super
if self.active
last_number = @number
if Input.repeat?(Input::RIGHT) and @number < @max
@number += 1
end
if Input.repeat?(Input::LEFT) and @number > 1
@number -= 1
end
if Input.repeat?(Input::UP) and @number < @max
@number = [@number + 10, @max].min
end
if Input.repeat?(Input::DOWN) and @number > 1
@number = [@number - 10, 1].max
end
if @number != last_number
Sound.play_cursor
refresh
end
end
end
end
#==========================================================================
# Scene_Byz_Bank
#==========================================================================
class Scene_Byz_Bank < Scene_Base
#======== 初始化 ========
def initialize
@command = []
@currency_exchanges_1 = -1 # 需要兑换的货币种类
@currency_exchanges_2 = -1
@numbers = 0
@command_number = []
@command_numbers = []
@type = -1 # 窗口刷新标志
@command_type = -1 # 刷新类型
end
#======== 主题 ========
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_menu_command
create_bank_command
create_name
@gold_window = Window_Gold.new(444, 514 - $game_system.currrncysize.size * 24)
draw_loli_bitmap if $game_system.bank_loli_bitmap != ""
draw_back_bitmap if $game_system.back_bank_bitmap != ""
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
dispose_loli_bitmap if $game_system.bank_loli_bitmap != ""
dispose_back_bitmap if $game_system.back_bank_bitmap != ""
@menu_command_window.dispose
@bank_command_window.dispose
@warehouse_obj_command_window.dispose if @warehouse_obj_command_window != nil
@name_window.dispose
@gold_window.dispose
@bank_gold_window.dispose if @bank_gold_window != nil
@inputnumber_window.dispose if @inputnumber_window != nil
@currency_command_first_window.dispose unless @currency_command_first_window == nil
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
super
@menu_command_window.update
if @command_type == 0
@bank_command_window.update
@bank_gold_window.update if @bank_gold_window != nil
@inputnumber_window.update if @inputnumber_window != nil #and @inputnumber_window.visible
@warehouse_obj_window.update if @warehouse_obj_window != nil
@currency_command_first_window.update if @currency_command_first_window != nil and @currency_command_first_window.visible
@currency_command_second_window.update if @currency_command_second_window != nil and @currency_command_second_window.visible
if @bank_gold_window != nil and @bank_gold_window.active
update_bank_gold_window
elsif @inputnumber_window != nil and @inputnumber_window.visible
input_number(@type)
elsif @currency_command_second_window != nil #and @currency_command_second_window.visible and @currency_command_second_window.active
update_currency_command_second
elsif @currency_command_first_window != nil #and @currency_command_first_window.visible
update_currency_command_first(@type)
elsif @bank_command_window.active
update_bank_command
end
elsif @command_type == 1
@warehouse_command_window.update if @warehouse_command_window != nil and @warehouse_command_window.active
@warehouse_window.update if @warehouse_window != nil and @warehouse_window.active
@warehouse_input.update if @warehouse_input != nil
if @warehouse_command_window.active
update_warehouse_command
elsif @warehouse_input != nil
update_warehouse_input(@type)
elsif @warehouse_window != nil and @warehouse_window.active
update_warehouse_window
end
elsif @command_type == -1
if @menu_command_window.active
update_menu_command
end
end
end
#======== //end主题 ========
#======== 创建 ========
#--------------------------------------------------------------------------
# ● 创建总菜单
#--------------------------------------------------------------------------
def create_menu_command
s1 = Byz_Vocab::BANK
s2 = Byz_Vocab::WAREHOUSE
s3 = Byz_Vocab::CANCEN
@menu_command_window = Window_Command.new(344,[s1, s2, s3], 3)
@menu_command_window.x = 200
@menu_command_window.y = 0
@menu_command_window.active = true
@menu_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● 创建银行选项
#--------------------------------------------------------------------------
def create_bank_command
s1 = Byz_Vocab::BANK_SAVING
s2 = Byz_Vocab::BANK_TAKING
s3 = Byz_Vocab::BANK_EXCHANGE
s4 = Byz_Vocab::CANCEN
@bank_command_window = Window_Command.new(384,[s1, s2, s3, s4], 4)
@bank_command_window.x = 0
@bank_command_window.y = 55
@bank_command_window.index = -1
@bank_command_window.active = false
@bank_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 创建仓库选项
#--------------------------------------------------------------------------
def create_warehouse_command
s1 = Byz_Vocab::WAREHOUSE_SAVING
s2 = Byz_Vocab::WAREHOUSE_TAKING
s3 = Byz_Vocab::CANCEN
@warehouse_command_window = Window_Command.new(384,[s1, s2, s3], 3)
@warehouse_command_window.x = 0
@warehouse_command_window.y = 55
@warehouse_command_window.index = -1
@warehouse_command_window.active = true
@warehouse_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● 创建仓库子选项
#--------------------------------------------------------------------------
def create_warehouse_type
@warehouse_obj_command_window = Window_Base.new(0,110, 100, 130)
@warehouse_obj_command_window.visible = true
@warehouse_obj_command_window_index = 0
@warehouse_obj_command_window.contents.draw_text(-5, -27, 78, 100, "物品", 1)
@warehouse_obj_command_window.contents.draw_text(-5, 0, 78, 100, "武器", 1)
@warehouse_obj_command_window.contents.draw_text(-5, 27, 78, 100, "防具", 1)
end
#--------------------------------------------------------------------------
# ● 创建银行名字
#--------------------------------------------------------------------------
def create_name
@name_window = Window_Byz_Name.new
end
#--------------------------------------------------------------------------
# ● 创建货币选择窗口1(兑换货币)
#--------------------------------------------------------------------------
def create_currency_command_first
@command.clear
@command_number.clear
for i in $game_system.currrncysize
next if 0 == $game_party.gold(i)
@command.push(Currency::Currencies[0])
@command_number.push(i)
end
if 0 == @command.size
show_window(Byz_Vocab::MONEY_INSUFF)
@bank_command_window.active = true
@bank_command_window.index = 0
return
end
@command.push(Byz_Vocab::CANCEN)
@currency_command_first_window = Window_Command.new(172, @command)
@currency_command_first_window.index = 0
@currency_command_first_window.x = 50
@currency_command_first_window.y = 100
@currency_command_first_window.visible = true
end
#--------------------------------------------------------------------------
# ● 创建货币选择窗口2(兑换货币)
#--------------------------------------------------------------------------
def create_currency_command_second
commands = []
for i in $game_system.currrncysize
next if @currency_exchanges_1 == i
commands.push(Currency::Currencies[0])
@command_numbers.push(i)
end
commands.push(Byz_Vocab::CANCEN)
@currency_command_second_window = Window_Command.new(172, commands)
@currency_command_second_window.x = 260
@currency_command_second_window.y = 100
@currency_command_second_window.visible = true
end
#--------------------------------------------------------------------------
# ● 创建数字输入窗口
#--------------------------------------------------------------------------
def create_inputnumber_window(bool = false)
@inputnumber_window = Window_Byz_NumberInput.new(50, 230, 375, 140)
@inputnumber_window.visible = true
@inputnumber_window.active = true
@inputnumber_window.index = 0
if bool
@inputnumber_window.contents.draw_text(0, 23, @inputnumber_window.width, 32,
"汇率:" + Currency::Currencies[@currency_exchanges_1][0] + "→" + Currency::Currencies[@currency_exchanges_2][0])
@inputnumber_window.contents.draw_text(0, 23, @inputnumber_window.width - 40, 32, sprintf("%.2f",
Currency::Currencies[@currency_exchanges_1][1].to_f / Currency::Currencies[@currency_exchanges_2][1]), 2)
end
end
#--------------------------------------------------------------------------
# ● 显示LOLI图片
#--------------------------------------------------------------------------
def draw_loli_bitmap
@bitmap_viewport = Viewport.new(384, 55, 544 - @bank_command_window.x, 416 - @gold_window.height - 55)
@loli_bitmap = Sprite.new(@bitmap_viewport)
@loli_bitmap.bitmap = Bitmap.new("Graphics/Pictures/#{$game_system.bank_loli_bitmap}")
@bitmap_viewport.z = 1
end
#--------------------------------------------------------------------------
# ● 显示背景图片
#--------------------------------------------------------------------------
def draw_back_bitmap
@back_bitmap = Sprite.new
@back_bitmap.bitmap = Bitmap.new("Graphics/Pictures/#{$game_system.back_bank_bitmap}")
@back_bitmap.x = @back_bitmap.y = 0
@back_bitmap.z = 0
end
#--------------------------------------------------------------------------
# ● 显示箭头图片
#--------------------------------------------------------------------------
def show_arrow
@arrow = Sprite.new
@arrow.bitmap = Bitmap.new("Graphics/Pictures/#{Byz_Vocab::ARROW}")
@arrow.x = 225
@arrow.y = 130
@arrow.z = 500
end
#--------------------------------------------------------------------------
# ● 显示箭头图片
#--------------------------------------------------------------------------
def show_arrow_two
@arrow_two = Sprite.new
@arrow_two.bitmap = Bitmap.new("Graphics/Pictures/#{Byz_Vocab::ARROW_TWO}")
@arrow_two.x = 0
@arrow_two.y = 130
@arrow_two.z = 500
end
#--------------------------------------------------------------------------
# ● 显示提示窗口
#--------------------------------------------------------------------------
def show_window(string)
re = string.split(//)
w = Window_Base.new(150, 100, re.size * 32 + 64, 64)
w.contents = Bitmap.new(w.width - 32, w.height - 32)
w.contents.font.color = w.text_color(2)
w.contents.draw_text(0, -15, w.width, w.height, string)
for i in 0..10
w.open
w.update
Graphics.update
end
for i in 0..30
Graphics.update
end
for i in 0..20
w.close
w.update
Graphics.update
end
w.dispose
end
#======== //end创建 ========
#======== 更新 ========
#--------------------------------------------------------------------------
# ● 总菜单更新
#--------------------------------------------------------------------------
def update_menu_command
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
Sound.play_decision
case @menu_command_window.index
when 0
@command_type = 0
menu_to_bank
when 1
@command_type = 1
create_warehouse_command
menu_to_warehouse
when 2
$scene = Scene_Map.new
end
end
end
#--------------------------------------------------------------------------
# ● 银行选项更新
#--------------------------------------------------------------------------
def update_bank_command
if Input.trigger?(Input::B)
Sound.play_cancel
@bank_command_window.index = -1
@bank_command_window.visible = false
@menu_command_window.index = 0
@menu_command_window.active = true
@bank_gold_window.dispose
@bank_gold_window = nil
@command_type = -1
@name_window.set(Byz_Vocab::NAME1)
elsif Input.trigger?(Input::C)
Sound.play_decision
case @bank_command_window.index
when 0
@bank_command_window.index = -1
@bank_command_window.active = false
create_currency_command_first
@type = 0
when 1
@bank_gold_window.index = 0
@bank_gold_window.active = true
@bank_command_window.index = -1
@bank_command_window.active = false
when 2
bank_command_to_currency_command
@type = 2
when 3
@bank_command_window.index = -1
@bank_command_window.active = false
@bank_command_window.visible = false
@menu_command_window.index = 0
@menu_command_window.active = true
@bank_gold_window.dispose
@bank_gold_window = nil
@command_type = -1
@name_window.set(Byz_Vocab::NAME1)
end
end
end
#--------------------------------------------------------------------------
# ● 货币种类窗口更新1
# type : 0 存钱 ; 1 取钱 ; 2 兑换
#--------------------------------------------------------------------------
def update_currency_command_first(type)
return if type == -1
if Input.trigger?(Input::B)
Sound.play_cancel
@currency_command_first_window.dispose
@currency_command_first_window = nil
@bank_command_window.index = type
@bank_command_window.active = true
elsif Input.trigger?(Input::C)
Sound.play_decision
case type
when 0
if @currency_command_first_window.index < @command_number.size
@currency_exchanges_1 = @command_number[@currency_command_first_window.index]
@currency_command_first_window.index = -1
@currency_command_first_window.active = false
@type = 0
create_inputnumber_window
else
@currency_command_first_window.dispose
@currency_command_first_window = nil
@bank_command_window.index = 0
@bank_command_window.active = true
end
when 1
when 2
if @currency_command_first_window.index < @command_number.size
@currency_exchanges_1 = @command_number[@currency_command_first_window.index]
show_arrow
create_currency_command_second
@currency_command_first_window.index = -1
@currency_command_second_window.index = 0
else
@currency_command_first_window.dispose
@currency_command_first_window = nil
currency_command_to_bank_command
end
end
end
end
#--------------------------------------------------------------------------
# ● 货币种类窗口更新2
#--------------------------------------------------------------------------
def update_currency_command_second
if Input.trigger?(Input::B)
Sound.play_cancel
@currency_command_first_window.index = 0
@currency_command_first_window.visible = true
@currency_command_second_window.dispose
@currency_command_second_window = nil
@currency_exchanges_1 = -1
@arrow.bitmap.dispose
@arrow.dispose
elsif Input.trigger?(Input::C)
Sound.play_decision
if @currency_command_second_window.index < $game_system.currrncysize.size - 1
@currency_exchanges_2 = @command_numbers[@currency_command_second_window.index]
@currency_command_second_window.active = false
@type = 2
create_inputnumber_window(true)
else
@currency_command_first_window.index = 0
@currency_command_first_window.visible = true
@currency_command_second_window.dispose
@currency_command_second_window = nil
@currency_exchanges_1 = -1
@arrow.bitmap.dispose
@arrow.dispose
end
end
end
#--------------------------------------------------------------------------
# ● 数值输入处理
# type: 0 存钱 1 取钱 2 兑换场合
#--------------------------------------------------------------------------
def input_number(type)
return if type == -1
case type
when 0
if Input.trigger?(Input::C)
Sound.play_decision
@numbers = @inputnumber_window.number
if @numbers <= $game_party.gold(@currency_exchanges_1)
$game_party.lose_gold(@numbers, @currency_exchanges_1)
$game_party.warehouse_gold[@currency_exchanges_1] += @numbers
@bank_gold_window.refresh
@gold_window.refresh
show_window("存钱成功")
inputnumber_to_command(0)
else
show_window("金钱不足")
end
elsif Input.trigger?(Input::B)
@inputnumber_window.dispose_sprite
@inputnumber_window.dispose
@inputnumber_window = nil
@currency_command_first_window.index = 0
@currency_command_first_window.active = true
end
when 1
if Input.trigger?(Input::C)
Sound.play_decision
@numbers = @inputnumber_window.number
if @numbers <= $game_party.warehouse_gold[@currency_exchanges_1]
$game_party.warehouse_gold[@currency_exchanges_1] -= @numbers
$game_party.gain_gold(@numbers, @currency_exchanges_1)
@bank_gold_window.refresh
@gold_window.refresh
show_window("取款成功")
inputnumber_to_command(1)
else
show_window("金钱不足")
end
elsif Input.trigger?(Input::B)
@inputnumber_window.visible = false
@inputnumber_window.index = -1
@inputnumber_window.dispose_sprite
@inputnumber_window.dispose
@inputnumber_window = nil
@bank_gold_window.index = 0
@bank_gold_window.active = true
end
when 2
if Input.trigger?(Input::C)
Sound.play_decision
@numbers = @inputnumber_window.number #####
if @numbers <= $game_party.gold(@currency_exchanges_1)
$game_system.convert_currency(@currency_exchanges_1,@currency_exchanges_2,@numbers)
inputnumber_to_command(2)
@gold_window.refresh
show_window("兑换成功")
else
show_window("金钱不足,兑换失败")
end
elsif Input.trigger?(Input::B)
@inputnumber_window.visible = false
@inputnumber_window.index = -1
@inputnumber_window.dispose_sprite
@inputnumber_window.dispose
@inputnumber_window = nil
@currency_command_second_window.index = 0
@currency_command_second_window.active = true
end
end
end
#--------------------------------------------------------------------------
# ● 金钱窗口刷新
#--------------------------------------------------------------------------
def update_bank_gold_window
if Input.trigger?(Input::B)
@bank_gold_window.index = -1
@bank_gold_window.active = false
@bank_command_window.index = 1
@bank_command_window.active = true
elsif Input.trigger?(Input::C)
if $game_party.warehouse_gold[$game_system.currrncysize[@bank_gold_window.index]] != 0
Sound.play_decision
@currency_exchanges_1 = $game_system.currrncysize[@bank_gold_window.index]
@bank_gold_window.index = -1
@bank_gold_window.active = false
@type = 1
create_inputnumber_window
else
@bank_gold_window.index = -1
@bank_gold_window.active = false
@bank_command_window.index = 1
@bank_command_window.active = true
end
end
end
#--------------------------------------------------------------------------
# ● 仓库总窗口刷新
#--------------------------------------------------------------------------
def update_warehouse_command
if Input.trigger?(Input::B)
@command_type = -1
@warehouse_command_window.dispose
@warehouse_command_window = nil
@menu_command_window.index = 1
@menu_command_window.active = true
@name_window.set(Byz_Vocab::NAME1)
elsif Input.trigger?(Input::C)
Sound.play_decision
case @warehouse_command_window.index
when 0
create_warehouse_type
show_arrow_two
@warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, 0)
@warehouse_window.active = true
@gold_window.dispose if @gold_window != nil
@bitmap_viewport.rect.set(384, 55, 544 - @bank_command_window.x, 257)
@type = 0
@warehouse_command_window.active = false
@warehouse_command_window.index = -1
when 1
create_warehouse_type
show_arrow_two
@warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, 1)
@warehouse_window.active = true
@gold_window.dispose if @gold_window != nil
@bitmap_viewport.rect.set(384, 55, 544 - @bank_command_window.x, 257)
@type = 1
@warehouse_command_window.active = false
@warehouse_command_window.index = -1
when 2
@command_type = -1
@warehouse_command_window.dispose
@warehouse_command_window = nil
@menu_command_window.index = 1
@menu_command_window.active = true
@name_window.set(Byz_Vocab::NAME1)
end
end
end
#--------------------------------------------------------------------------
# ● 物品窗口刷新
#--------------------------------------------------------------------------
def update_warehouse_window
if Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
Sound.play_decision
@warehouse_obj_command_window_index += 1
@warehouse_obj_command_window_index %= 3
@warehouse_window.kind = @warehouse_obj_command_window_index
@warehouse_window.index = 0
@arrow_two.y = 130 + @warehouse_obj_command_window_index * 32
elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
Sound.play_decision
@warehouse_obj_command_window_index -= 1
@warehouse_obj_command_window_index %= 3
@warehouse_window.kind = @warehouse_obj_command_window_index
@item_index = @warehouse_window.check
@warehouse_window.index = 0
@arrow_two.y = 130 + @warehouse_obj_command_window_index * 32
elsif Input.trigger?(Input::C)
Sound.play_decision
@item_index = @warehouse_window.check
@last_index = @warehouse_window.index
if @item_index == nil
return
end
@warehouse_window.active = false
@warehouse_input = Window_ByzNumber.new(100, 100)
@warehouse_input.active = true
if @type == 0
price = Byz_Vocab::PRICES
if @warehouse_obj_command_window_index == 0
@warehouse_input.set($data_items[@item_index], $game_party.item_number($data_items[@item_index]), price)
elsif @warehouse_obj_command_window_index == 1
@warehouse_input.set($data_weapons[@item_index], $game_party.item_number($data_weapons[@item_index]), price)
elsif @warehouse_obj_command_window_index == 2
@warehouse_input.set($data_armors[@item_index], $game_party.item_number($data_armors[@item_index]), price)
end
else
if @warehouse_obj_command_window_index == 0
@warehouse_input.set($data_items[@item_index], $game_party.warehouse[0][@item_index], 0)
elsif @warehouse_obj_command_window_index == 1
@warehouse_input.set($data_weapons[@item_index], $game_party.warehouse[1][@item_index], 0)
elsif @warehouse_obj_command_window_index == 2
@warehouse_input.set($data_armors[@item_index], $game_party.warehouse[2][@item_index], 0)
end
end
elsif Input.trigger?(Input::B)
@warehouse_obj_command_window.dispose
@warehouse_obj_command_window = nil
@arrow_two.bitmap.dispose
@arrow_two.dispose
@warehouse_window.dispose
@warehouse_window = nil
@warehouse_command_window.index = @type
@warehouse_command_window.active = true
@gold_window = Window_Gold.new(444, 514 - $game_system.currrncysize.size * 24)
@bitmap_viewport.rect.set(384, 55, 544 - @bank_command_window.x, 416 - @gold_window.height - 55)
end
end
def update_warehouse_input(type)
if Input.trigger?(Input::B)
@warehouse_obj_command_window.dispose
@warehouse_obj_command_window = nil
@arrow_two.bitmap.dispose
@arrow_two.dispose
create_warehouse_type
show_arrow_two
@warehouse_window.dispose
@warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, @type)
@warehouse_window.active = true
@warehouse_window.index = @last_index
@bitmap_viewport.rect.set(384, 55, 544 - @bank_command_window.x, 257)
@warehouse_input.dispose if @warehouse_input != nil
@warehouse_input = nil
@warehouse_window.active = true
elsif Input.trigger?(Input::C)
Sound.play_decision
@item_index = @warehouse_window.check
if @item_index == nil
return
end
@numbers = @warehouse_input.number
price = @warehouse_input.price
if type == 0
if @warehouse_obj_command_window_index == 0
if price < $game_party.gold
$game_party.lose_item($data_items[@item_index], @numbers)
if $game_party.warehouse[0][@item_index] == nil
$game_party.warehouse[0][@item_index] = 0
end
$game_party.lose_gold(@warehouse_input.price)
$game_party.warehouse[0][@item_index] += @numbers
@warehouse_window.refresh_bool
input_to_command
else
show_window("金钱不足")
return
end
elsif @warehouse_obj_command_window_index == 1
if price < $game_party.gold
$game_party.lose_item($data_weapons[@item_index], @numbers)
if $game_party.warehouse[1][@item_index] == nil
$game_party.warehouse[1][@item_index] = 0
end
$game_party.lose_gold(@warehouse_input.price)
$game_party.warehouse[1][@item_index] += @numbers
@warehouse_window.refresh_bool
input_to_command
else
show_window("金钱不足")
return
end
elsif @warehouse_obj_command_window_index == 2
if price < $game_party.gold
$game_party.lose_item($data_armors[@item_index], @numbers)
if $game_party.warehouse[2][@item_index] == nil
$game_party.warehouse[2][@item_index] = 0
end
$game_party.lose_gold(@warehouse_input.price)
$game_party.warehouse[2][@item_index] += @numbers
@warehouse_window.refresh_bool
input_to_command
else
show_window("金钱不足")
return
end
end
else
if @warehouse_obj_command_window_index == 0
if $game_party.warehouse[0][@item_index] == nil
input_to_command
return
end
if $game_party.warehouse[0][@item_index] <= @numbers
@numbers = $game_party.warehouse[0][@item_index]
$game_party.warehouse[0][@item_index] = nil
else
$game_party.warehouse[0][@item_index] -= @numbers
end
$game_party.gain_item($data_items[@item_index], @numbers)
@warehouse_window.refresh_bool
input_to_command
elsif @warehouse_obj_command_window_index == 1
if $game_party.warehouse[1][@item_index] == nil
@warehouse_window.refresh_bool
input_to_command
return
end
if $game_party.warehouse[1][@item_index] <= @numbers
@numbers = $game_party.warehouse[1][@item_index]
$game_party.warehouse[1][@item_index] = nil
else
$game_party.warehouse[1][@item_index] -= @numbers
end
$game_party.gain_item($data_weapons[@item_index], @numbers)
@warehouse_window.refresh_bool
input_to_command
elsif @warehouse_obj_command_window_index == 2
if $game_party.warehouse[2][@item_index] == nil
@warehouse_window.refresh_bool
input_to_command
return
end
if $game_party.warehouse[2][@item_index] <= @numbers
@numbers = $game_party.warehouse[2][@item_index]
$game_party.warehouse[2][@item_index] = nil
else
$game_party.warehouse[2][@item_index] -= @numbers
end
$game_party.gain_item($data_armors[@item_index], @numbers)
@warehouse_window.refresh_bool
input_to_command
end
end
end
end
#======== //end更新 ========
#======== 切换 ========
#--------------------------------------------------------------------------
# ● 总菜单 -> 银行选项
#--------------------------------------------------------------------------
def menu_to_bank
@menu_command_window.active = false
@menu_command_window.index = -1
@bank_command_window.index = 0
@bank_gold_window = Window_Bank_Gold.new
@bank_gold_window.active = false
@bank_command_window.active = true
@bank_command_window.visible = true
@name_window.set(Byz_Vocab::NAME2)
end
#--------------------------------------------------------------------------
# ● 总菜单 -> 仓库选项
#--------------------------------------------------------------------------
def menu_to_warehouse
@menu_command_window.active = false
@menu_command_window.index = -1
@warehouse_command_window.index = 0
@warehouse_command_window.active = true
@warehouse_command_window.visible = true
@name_window.set(Byz_Vocab::NAME3)
end
#--------------------------------------------------------------------------
# ● 存款 -> 货币选择
#--------------------------------------------------------------------------
def bank_command_to_currency_command
create_currency_command_first
@bank_command_window.index = -1 unless @currency_command_first_window == nil
end
#--------------------------------------------------------------------------
# ● 货币选择 -> 存款
#--------------------------------------------------------------------------
def currency_command_to_bank_command
@old_command = @command_number
@command_number.clear
@bank_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● 数字输入 ->
# 0. 存钱 -> 银行选项
# 1. 取钱 -> 银行选项
# 2. 兑换 -> 银行选项
#--------------------------------------------------------------------------
def inputnumber_to_command(type)
return if @inputnumber_window == nil
case type
when 0
@inputnumber_window.dispose_sprite
@inputnumber_window.dispose
@inputnumber_window = nil
@currency_command_first_window.dispose
@currency_command_first_window = nil
@bank_command_window.active = true
@bank_command_window.visible = true
@bank_command_window.index = 0
when 1
@inputnumber_window.dispose_sprite
@inputnumber_window.dispose
@inputnumber_window = nil
@bank_command_window.active = true
@bank_command_window.visible = true
@bank_command_window.index = 0
when 2
@inputnumber_window.dispose_sprite
@inputnumber_window.dispose
@inputnumber_window = nil
@arrow.bitmap.dispose
@arrow.dispose
@currency_command_first_window.dispose
@currency_command_first_window = nil
@currency_command_second_window.dispose
@currency_command_second_window = nil
@bank_command_window.active = true
@bank_command_window.visible = true
@bank_command_window.index = 2
end
end
def input_to_command
@warehouse_input.dispose
@warehouse_input = nil
@warehouse_window.refresh
@warehouse_window.active = true
end
#======== //end切换 ========
#======== 释放 ========
#--------------------------------------------------------------------------
# ● 释放LOLI图片
#--------------------------------------------------------------------------
def dispose_loli_bitmap
@loli_bitmap.bitmap.dispose
@loli_bitmap.dispose
end
#--------------------------------------------------------------------------
# ● 释放背景图片
#--------------------------------------------------------------------------
def dispose_back_bitmap
@back_bitmap.bitmap.dispose
@back_bitmap.dispose
end
#======== //end释放 ========
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |