加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 Mono_kyrin 于 2018-10-29 11:16 编辑
比如一个用来显示战斗状态窗口的Window_BattleStatus类的构造函数大概是长这样的:
class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize super(0, 320, 640, 160) self.contents = Bitmap.new(width - 32, height - 32) #........................................................................ self.windowskin = nil @sta_back = [] @sta_output = [] @states_icons = [] @state_icon_p = [] @hp_bitmap = loadbitmap("Graphics/CP/hp.png")#// HP條 @mp_bitmap = loadbitmap("Graphics/CP/mp.png")#// MP條 @ap_bitmap = loadbitmap("Graphics/CP/AP.png")#// AP條 for i in 0...$game_party.actors.size actor = $game_party.actors[i] #//Background @sta_back[i] = Sprite.new @sta_back[i].bitmap = loadbitmap("Graphics/CP/" +actor.name+"_平时.png") @sta_back[i].x = 2 + i * 155 @sta_back[i].y = 382 @sta_back[i].z = self.z + 1 #//State @states_icons[i] = Sprite.new @state_icon_p[i] = 0 @states_icons[i].x = i * 155 + 85 @states_icons[i].y = 400 @states_icons[i].z = 999 st = $game_party.actors[i].states[@state_icon_p[i]] unless st.nil? path = "Graphics/States/#{st}.png" @states_icons[i].bitmap = loadbitmap(path) end #//Bars @sta_output[i] = Sprite.new @sta_output[i].bitmap = Bitmap.new(150, 78) @sta_output[i].x = 2 + i * 155 @sta_output[i].y = 480 - 85 @sta_output[i].z = self.z + 2 @sta_output[i].bitmap.font.name = "黑体" end @level_up_flags = [false, false, false, false] #........................................................................ refresh end
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
#........................................................................
self.windowskin = nil
@sta_back = []
@sta_output = []
@states_icons = []
@state_icon_p = []
@hp_bitmap = loadbitmap("Graphics/CP/hp.png")#// HP條
@mp_bitmap = loadbitmap("Graphics/CP/mp.png")#// MP條
@ap_bitmap = loadbitmap("Graphics/CP/AP.png")#// AP條
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
#//Background
@sta_back[i] = Sprite.new
@sta_back[i].bitmap = loadbitmap("Graphics/CP/" +actor.name+"_平时.png")
@sta_back[i].x = 2 + i * 155
@sta_back[i].y = 382
@sta_back[i].z = self.z + 1
#//State
@states_icons[i] = Sprite.new
@state_icon_p[i] = 0
@states_icons[i].x = i * 155 + 85
@states_icons[i].y = 400
@states_icons[i].z = 999
st = $game_party.actors[i].states[@state_icon_p[i]]
unless st.nil?
path = "Graphics/States/#{st}.png"
@states_icons[i].bitmap = loadbitmap(path)
end
#//Bars
@sta_output[i] = Sprite.new
@sta_output[i].bitmap = Bitmap.new(150, 78)
@sta_output[i].x = 2 + i * 155
@sta_output[i].y = 480 - 85
@sta_output[i].z = self.z + 2
@sta_output[i].bitmap.font.name = "黑体"
end
@level_up_flags = [false, false, false, false]
#........................................................................
refresh
end
然后调用@status_window = Window_BattleStatus.new 方法以后,调整@status_window.visible = false, 这个窗口并没有消失是什么情况…… |