Project1
标题:
怎样用开关来控制一个窗口的显示与关闭?
[打印本页]
作者:
maosi066rpg
时间:
2009-6-1 09:12
标题:
怎样用开关来控制一个窗口的显示与关闭?
怎样用开关来控制一个窗口的显示与关闭?
比如说下面这个脚本所显示的窗口
$variables_id = 2
$icon_index = 0
class Window_Gold < Window_Base
def initialize (x, y)
super(160, 32, 352, 192)
self.opacity = 200
self.back_opacity = 200
self.contents_opacity = 255
@icon = 0
@variable = 0
refresh
end
def refresh
self.contents.clear
draw_icon($icon_index + 219,0,0,true)
draw_icon($icon_index + 216,0,28,true)
draw_icon($icon_index + 217,0,56,true)
draw_icon($icon_index + 219,296,0,true)
draw_icon($icon_index + 216,296,28,true)
draw_icon($icon_index + 217,296,56,true)
self.contents.draw_text(16,0,64,24,$game_variables[$variables_id + 4].to_s,2)
self.contents.draw_text(16,28,64,24,$game_variables[$variables_id + 5].to_s,2)
self.contents.draw_text(16,56,64,24,$game_variables[$variables_id + 6].to_s,2)
self.contents.draw_text(220,0,64,24,$game_variables[$variables_id + 10].to_s,3)
self.contents.draw_text(220,28,64,24,$game_variables[$variables_id + 11].to_s,3)
self.contents.draw_text(220,56,64,24,$game_variables[$variables_id + 12].to_s,3)
@icon = $icon_index
@variable = $game_variables[$variables_id]
end
end
复制代码
或者这种自定义窗口
要怎样才可以用开关控制
$variables_id = 2
$icon_index = 0
class Window_Azd < Window_Base
def initialize
super(160, 32, 352, 192)
self.opacity = 150
self.back_opacity = 150
@icon = 0
@variable = 0
refresh
end
def refresh
self.contents.clear
draw_icon($icon_index + 219,0,0,true)
draw_icon($icon_index + 216,0,28,true)
draw_icon($icon_index + 217,0,56,true)
draw_icon($icon_index + 219,296,0,true)
draw_icon($icon_index + 216,296,28,true)
draw_icon($icon_index + 217,296,56,true)
self.contents.draw_text(16,0,64,24,$game_variables[$variables_id + 4].to_s,2)
self.contents.draw_text(16,28,64,24,$game_variables[$variables_id + 5].to_s,2)
self.contents.draw_text(16,56,64,24,$game_variables[$variables_id + 6].to_s,2)
self.contents.draw_text(220,0,64,24,$game_variables[$variables_id + 10].to_s,3)
self.contents.draw_text(220,28,64,24,$game_variables[$variables_id + 11].to_s,3)
self.contents.draw_text(220,56,64,24,$game_variables[$variables_id + 12].to_s,3)
@icon = $icon_index
@variable = $game_variables[$variables_id]
end
end
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@azd_window = Window_Azd.new
end
alias new_update update
def update
new_update
@azd_window.refresh
end
alias new_terminate terminate
def terminate
@azd_window.dispose
new_terminate
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1