赞 | 2 |
VIP | 0 |
好人卡 | 0 |
积分 | 42 |
经验 | 13328 |
最后登录 | 2024-8-10 |
在线时间 | 258 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 4169
- 在线时间
- 258 小时
- 注册时间
- 2013-10-13
- 帖子
- 815
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
class Scene_Bank
def main
@bank_window=Window_Bank.new
@gold_window=Window_Gold.new
@command_window=Window_Command.new(192,["存钱","取钱","取消"])
@command_window.x=0
@command_window.y=64
@number_window=Window_Number.new
@number_window.active=false
@command_window_1=Window_Command.new(192,["确定","取消"])
@command_window_1.x=192
@command_window_1.y=64
Graphics.transition
loop do
Graphics.update
Input.update
update
if self != $scene
break
end
end
Graphics.freeze
@bank_window.dispose
@gold_window.dispose
@command_window.dispose
@number_window.dispose
@command_window_1.dispose
end
def update
@command_window.update
@number_window.update
@command_window_1.update
if @command_window.active
update_command
return
end
if @number_window.active
update_number
return
end
if @command_window_1.active
update_command_1
return
end
end
def update_command
if Input.trigger?(Input::B)
$scene = Scene_Map.new
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
@command_window.active = false
@number_window.active = true
@command_window_1.active=false
when 1
@command_window.active = false
@number_window.active = true
@command_window_1.active=false
when 2
$scene=Scene_Map.new
end
end
end
def update_number
if Input.trigger?(Input::B)
@command_window.active = true
@number_window.active = false
@command_window_1.active=false
end
if Input.trigger?(Input::C)
@command_window.active = false
@number_window.active = false
@command_window_1.active=true
end
end
def update_command_1
if Input.trigger?(Input::B)
@command_window.active = false
@number_window.active = true
@command_window_1.active=false
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
@command_window_1=Window_Command.new(192,
["确定存入#{@number_window.number}","取消"])
@command_window_1.x=192
@command_window_1.y=64
case @command_window_1.index
when 0
$game_party.lose_gold(@number_window.number)
@gold_window.refresh
$game_party.gain_gold_1(@number_window.number)
@bank_window.refresh
when 1
$scene=self
end
when 1
@command_window_1=Window_Command.new(192,
["确定取出#{@number_window.number}","取消"])
case @command_window_1.index
when 0
$game_party.lose_gold_1(@number_window.number)
@bank_window.refresh
$game_party.gain_gold(@number_window.number)
@gold_window.refresh
when 1
$scene=self
end
when 2
$scene=Scene_Map.new
end
@command_window.active = true
@number_window.active = false
@command_window_1.active=false
end
end
end
class Window_Bank < Window_Base
def initialize
super(160,0,480,64)
self.contents=Bitmap.new(width-32,height-32)
refresh
end
def refresh
self.contents.clear
cw=self.contents.text_size($data_system.words.gold).width
self.contents.draw_text(0,0,480-32-cw,32,$game_party.gold_1.to_s)
self.contents.draw_text(480-32-cw,0,cw,32,$data_system.words.gold,2)
end
end
class Window_Number<Window_Base
def initialize
super(0,64+32*4,192,64)
self.contents = Bitmap.new(width - 32, height - 32)
@number = 0
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 24, 32, @number.to_s, 2)
self.cursor_rect.set(0, 0, 32, 32)
end
def update
super
if self.active
# 光标右 (+1)
if Input.repeat?(Input::RIGHT)
@number += 1
refresh
end
# 光标左 (-1)
if Input.repeat?(Input::LEFT) and @number > 0
@number -= 1
refresh
end
# 光标上 (+10)
if Input.repeat?(Input::UP)
@number = @number + 10
refresh
end
# 光标下 (-10)
if Input.repeat?(Input::DOWN) and @number > 0
@number = @number - 10
refresh
end
end
end
def number
return @number
end
end
class Game_Party
attr_reader :gold_1
alias bank_initialize initialize
def initialize
bank_initialize
@gold_1=0
end
def gain_gold_1(n)
@gold_1 = @gold_1 + n
end
def lose_gold_1(n)
@gold_1 = @gold_1 - n
end
end |
|