赞 | 1 |
VIP | 7 |
好人卡 | 9 |
积分 | 1 |
经验 | 7021 |
最后登录 | 2014-11-30 |
在线时间 | 140 小时 |
Lv1.梦旅人 小黑
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 140 小时
- 注册时间
- 2011-8-23
- 帖子
- 536
|
- #==============================================================================
- #==============================================================================
- #
- # ■ [vx]仓库
- #------------------------------------------------------------------------------
- # by 八云 紫
- # 转载时,请注明 本脚本来着 66RPG
- #==============================================================================
- #==============================================================================
- #==============================================================================
- # ■ Byz_Vocab
- #------------------------------------------------------------------------------
- # 定义系统用语和信息的模块。
- #==============================================================================
- module Byz_Vocab
- #------ 仓库 ---------
- WAREHOUSE_SAVING = "存东西"
- WAREHOUSE_TAKING = "取东西"
- CANCEN = "取消"
- # 箭头文件名字, 放到 Graphics\Pictures 目录下。
- ARROW_TWO = "Cursor"
- # 存物品的时候的价格
- PRICES = 10
- 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 :bank_loli_bitmap
- attr_accessor :back_bank_bitmap
- attr_accessor :prices # 存物品的收费价格
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- alias old_initialize initialize
- def initialize
- old_initialize
- @bank_loli_bitmap = "MM_Pic1"
- @back_bank_bitmap = "back"
- @prices = Byz_Vocab::PRICES
- end
- end
- #==============================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # 处理队伍的类。包含金钱以及物品的信息。
- # 这个类的实例请参考 $game_party 。
- #==============================================================================
- class Game_Party < Game_Unit
- attr_accessor :warehouse # 仓库
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- alias initialize_currency initialize
- def initialize
- initialize_currency
- @warehouse_item = {} # 仓库物品
- @warehouse_weapon = {} # 仓库武器
- @warehouse_armor = {} # 仓库防具
- @warehouse = [@warehouse_item, @warehouse_weapon, @warehouse_armor]
- 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_Byz_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
- 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
- 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
- @help_window.set_item($data_items[item_index])
- elsif @kind == 1
- @help_window.set_item($data_weapons[item_index])
- elsif @kind == 2
- @help_window.set_item($data_armors[item_index])
- end
- else
- @help_window.clear
- 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
- 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, 384, 56)
- self.contents.draw_text(-10, -5, 384, 32, "欢迎", 1)
- end
- #--------------------------------------------------------------------------
- # ● 设置
- #--------------------------------------------------------------------------
- def set(string)
- self.contents.clear
- self.contents.draw_text(-10, -5, 384, 32, string, 1)
- 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 # 窗口刷新标志
- end
- #======== 主题 ========
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- create_name
- create_warehouse_command
- @gold_window = Window_Gold.new(384, 0)
- 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 != ""
- @warehouse_obj_command_window.dispose if @warehouse_obj_command_window != nil
- @name_window.dispose
- @gold_window.dispose
- @warehouse_command_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- super
- @warehouse_command_window.update if @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
- end
- #======== //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 = 0
- @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
- #--------------------------------------------------------------------------
- # ● 显示LOLI图片
- #--------------------------------------------------------------------------
- def draw_loli_bitmap
- @bitmap_viewport = Viewport.new(384, 55, 544, 416)
- @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_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_warehouse_command
- if Input.trigger?(Input::B)
- $scene = Scene_Map.new
- 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
- @bitmap_viewport.rect.set(384, 55, 544, 257)
- @type = 0
- @warehouse_command_window.active = false
- @warehouse_command_window.index = -1
- @name_window.set("存物品")
- when 1
- create_warehouse_type
- show_arrow_two
- @warehouse_window = Window_Warehouse.new(@warehouse_obj_command_window_index, 1)
- @warehouse_window.active = true
- @bitmap_viewport.rect.set(384, 55, 544, 257)
- @type = 1
- @warehouse_command_window.active = false
- @warehouse_command_window.index = -1
- @name_window.set("取物品")
- when 2
- $scene = Scene_Map.new
- 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
- @bitmap_viewport.rect.set(384, 55, 544, 416)
- @name_window.set("欢迎")
- 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
- @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
- @gold_window.refresh
- 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
- @gold_window.refresh
- 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
- @gold_window.refresh
- 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
- @gold_window.refresh
- 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
- @gold_window.refresh
- 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
- @gold_window.refresh
- input_to_command
- end
- end
- end
- 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
复制代码 |
|