Project1
标题: 释放窗口时出错 已解决 [打印本页]
作者: 飞翔的小鸟3 时间: 2017-10-4 01:09
标题: 释放窗口时出错 已解决
本帖最后由 飞翔的小鸟3 于 2017-10-4 19:49 编辑
之前问过一个帖子,类似问题,原因是我自己释放一次,然后在Scene_Base自动释放一次,导致错误
这次是指向Window_Selectable,他或者他的父类是否有一样的自动释放的代码?我找不到啊。
然后,有一个奇怪的问题,我是按同一个键打开关闭血条,按一两次不会出错,要按多次才会出错。这很奇怪。
第一个问题解决了,图片pass掉
血量窗口:
class Blood_rect < Window_Selectable
def initialize
super(436,-12,124,49)
end
def open_rect
$blood_rect.opacity = 0
a = Color.new(255,0,0)
$blood_rect.contents.clear
$blood_rect.contents.fill_rect(0,0,$game_variables[14],25,a)
end
def close_rect
$blood_rect.contents.clear
$blood_rect.contents.dispose
$blood_rect.dispose
end
end
class Blood_rect < Window_Selectable
def initialize
super(436,-12,124,49)
end
def open_rect
$blood_rect.opacity = 0
a = Color.new(255,0,0)
$blood_rect.contents.clear
$blood_rect.contents.fill_rect(0,0,$game_variables[14],25,a)
end
def close_rect
$blood_rect.contents.clear
$blood_rect.contents.dispose
$blood_rect.dispose
end
end
这个可以不用管他,用来调出血条的快捷调用窗口
class Window_shortcut < Window_Command
def initialize
super(0,250)
make_command_list
command_window
activate
item_max
process_cursor_move
end
def make_command_list
add_command("开启/关闭残血量", :blood_volume)
add_command("开启/关闭残弹量", :Bomb_residue)
add_command("更换武器", :change_weapon)
end
def command_window
set_handler(:blood_volume, method(:run_blood_volume))
set_handler(:Bomb_residue, method(:run_Bomb_residue))
set_handler(:change_weapon, method(:run_change_weapon))
end
def run_blood_volume
activate
$var2 ||= 0
$var2 = ($var2 == 0 ? 1 : 0 )
if $var2 == 1
$game_switches[38] = true
else $var2 == 0
$game_switches[39] = true
end
end
def run_Bomb_residue
end
def run_change_weapon
end
def item_max
return 3
end
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_down (Kboard.keyboard(0x32)) if Kboard.keyboard(0x32)
cursor_up (Kboard.keyboard(0x31)) if Kboard.keyboard(0x31)
Sound.play_cursor if @index != last_index
end
end
class Window_shortcut < Window_Command
def initialize
super(0,250)
make_command_list
command_window
activate
item_max
process_cursor_move
end
def make_command_list
add_command("开启/关闭残血量", :blood_volume)
add_command("开启/关闭残弹量", :Bomb_residue)
add_command("更换武器", :change_weapon)
end
def command_window
set_handler(:blood_volume, method(:run_blood_volume))
set_handler(:Bomb_residue, method(:run_Bomb_residue))
set_handler(:change_weapon, method(:run_change_weapon))
end
def run_blood_volume
activate
$var2 ||= 0
$var2 = ($var2 == 0 ? 1 : 0 )
if $var2 == 1
$game_switches[38] = true
else $var2 == 0
$game_switches[39] = true
end
end
def run_Bomb_residue
end
def run_change_weapon
end
def item_max
return 3
end
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_down (Kboard.keyboard(0x32)) if Kboard.keyboard(0x32)
cursor_up (Kboard.keyboard(0x31)) if Kboard.keyboard(0x31)
Sound.play_cursor if @index != last_index
end
end
作者: 张咚咚 时间: 2017-10-4 08:46
本帖最后由 张咚咚 于 2017-10-4 13:11 编辑
这是什么写法,类里直接用self不久行了,而且不知为什么感觉这种写法很有bug的感觉。。
算了,对于会出错的地方你直接加上这一句判断就可以简单暴力的解决了...
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |