赞 | 0 |
VIP | 5 |
好人卡 | 14 |
积分 | 15 |
经验 | 110639 |
最后登录 | 2015-10-15 |
在线时间 | 1157 小时 |
Lv3.寻梦者 小柯的徒弟
- 梦石
- 0
- 星屑
- 1535
- 在线时间
- 1157 小时
- 注册时间
- 2008-5-24
- 帖子
- 3085
|
- class Window_ShopStatus_Vb < Window_Base
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, 202, 32, "")
- self.contents.draw_text(0, 34, 202, 32, "")
- end
- end
- class Window_ShopCommand_Vb < Window_Selectable_Vb
- def initialize
- super(0, 64, 480, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item_max = 3
- @column_max = 3
- @commands = ["存入物品", "取出物品", " 离开"]
- refresh
- self.index = 0
- end
- end
- class Scene_Shop_Vb
- def update_sell
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 窗口状态转向初期模式
- @command_window.active = true
- @dummy_window.visible = true
- @sell_window.active = false
- @sell_window.visible = false
- @status_window.visible = true
- @status_window.item = nil
- # 删除帮助文本
- @help_window.set_text("")
- return
- end
- # 按下 C 键的情况下
- if Input.repeat?(Input::C)
- # 获取物品
- @item = @sell_window.item
- # 物品无效的情况下、或者价格为 0 (不能卖出) 的情况下
- if @item == nil# or @item.price == 0
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 获取物品的所持数
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- # 最大卖出个数 = 物品的所持数
- # 窗口状态转向个数输入模式
- @sell_window.active = false
- @sell_window.visible = false
- @status_window.visible = true
- # 卖出处理
- # $game_party.lose_gold(@number_window.number)
- temp = 0
- case @item
- when RPG::Item
- $game_party.lose_item(@item.id, @number_window.number)
- when RPG::Weapon
- $game_party.lose_weapon(@item.id, @number_window.number)
- temp = 1
- when RPG::Armor
- $game_party.lose_armor(@item.id, @number_window.number)
- temp = 2
- end
- # 刷新各窗口
- goods_del(temp,@item.id,-@number_window.number)
- @buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
- @buy_window.active = false
- @buy_window.visible = false
- @buy_window.help_window = @help_window
- @gold_window.refresh
- @sell_window.refresh
- @status_window.refresh
- # 窗口状态转向卖出模式
- @sell_window.active = true
- @sell_window.visible = true
- end
- end
- def update_buy
- # 设置状态窗口的物品
- @status_window.item = @buy_window.item
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 窗口状态转向初期模式
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = true
- @status_window.item = nil
- # 删除帮助文本
- @help_window.set_text("")
- return
- end
- # 按下 C 键的情况下
- if Input.repeat?(Input::C)
- # 获取物品
- @item = @buy_window.item
- # 物品无效的情况下、或者价格在所持金以上的情况下
- if @item == nil# or @item.price > $game_party.gold
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 获取物品所持数
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- # 如果已经拥有了 99 个情况下
- if number == 99
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 计算可以最多购买的数量
- max = @item.price == 0 ? 99 : $game_party.gold / @item.price
- max = [[max, 99 - number].min,@buy_window.item_number].min
- # 窗口状态转向数值输入模式
- @buy_window.active = false
- @buy_window.visible = false
- # 购买处理
- temp = 0
- case @item
- when RPG::Item
- $game_party.gain_item(@item.id, @number_window.number)
- when RPG::Weapon
- $game_party.gain_weapon(@item.id, @number_window.number)
- temp = 1
- when RPG::Armor
- $game_party.gain_armor(@item.id, @number_window.number)
- temp = 2
- end
- goods_del(temp,@item.id,@number_window.number)
- # 刷新各窗口
- @buy_window = Window_ShopBuy_Vb.new($game_system.goods[@shop_now])
- @buy_window.help_window = @help_window
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- # 窗口状态转向购买模式
- @buy_window.active = true
- @buy_window.visible = true
- end
- end
- end
复制代码 放到Main脚本前,不需删除原脚本。 |
|