赞 0
VIP 0
好人卡 4
积分 1
经验 15395
最后登录 2016-5-1
在线时间 381 小时
Lv1.梦旅人
梦石 0
星屑 50
在线时间 381 小时
注册时间 2012-8-13
帖子 113
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
刚做了一个在地图上显示状态的窗口,在scene_map里也添加了显示和刷新的判定。现在的问题是,数据变更以后窗口里的数字会自动刷新,但是绘制的几个状态槽就直接消失了。希望大家帮我看看是怎么回事?窗口代码如下:
class Window_Mapstatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
@t = $game_variables [ 24 ]
super ( 27 , 0 , 800 , 46 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
self .contents .font .size = 18
self .contents .font .color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self .contents .clear
self .contents .font .color = system_color
self .contents .font .size = 18
draw_stamina_bar( x+20 ,y,110 ,12 )
draw_hunger_bar( x+220 ,y,110 ,12 )
draw_mood_bar( x+420 ,y,110 ,12 )
draw_social_bar( x+620 ,y,110 ,12 )
self .contents .draw_text ( 50 ,-10 ,110 ,32 , $game_variables [ 86 ] .to_s )
self .contents .draw_text ( 250 ,-10 ,110 ,32 , $game_variables [ 87 ] .to_s )
self .contents .draw_text ( 450 ,-10 ,110 ,32 , $game_variables [ 88 ] .to_s )
self .contents .draw_text ( 650 ,-10 ,110 ,32 , $game_variables [ 89 ] .to_s )
end
#--------------------------------------------------------------------------
# ● 描绘体力槽
#--------------------------------------------------------------------------
def draw_stamina_bar( x, y, width = 110 , height = 4 )
stamina = $game_variables [ 86 ]
w = width * stamina / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
#--------------------------------------------------------------------------
# ● 描绘饱食槽
#--------------------------------------------------------------------------
def draw_hunger_bar( x, y, width = 110 , height = 4 )
hunger = $game_variables [ 87 ]
w = width * hunger / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
#--------------------------------------------------------------------------
# ● 描绘愉悦槽
#--------------------------------------------------------------------------
def draw_mood_bar( x, y, width = 110 , height = 4 )
mood = $game_variables [ 88 ]
w = width * mood / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
#--------------------------------------------------------------------------
# ● 描绘社交槽
#--------------------------------------------------------------------------
def draw_social_bar( x, y, width = 110 , height = 4 )
social = $game_variables [ 89 ]
w = width * social / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
end
class Window_Mapstatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
@t = $game_variables [ 24 ]
super ( 27 , 0 , 800 , 46 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
self .contents .font .size = 18
self .contents .font .color = normal_color
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self .contents .clear
self .contents .font .color = system_color
self .contents .font .size = 18
draw_stamina_bar( x+20 ,y,110 ,12 )
draw_hunger_bar( x+220 ,y,110 ,12 )
draw_mood_bar( x+420 ,y,110 ,12 )
draw_social_bar( x+620 ,y,110 ,12 )
self .contents .draw_text ( 50 ,-10 ,110 ,32 , $game_variables [ 86 ] .to_s )
self .contents .draw_text ( 250 ,-10 ,110 ,32 , $game_variables [ 87 ] .to_s )
self .contents .draw_text ( 450 ,-10 ,110 ,32 , $game_variables [ 88 ] .to_s )
self .contents .draw_text ( 650 ,-10 ,110 ,32 , $game_variables [ 89 ] .to_s )
end
#--------------------------------------------------------------------------
# ● 描绘体力槽
#--------------------------------------------------------------------------
def draw_stamina_bar( x, y, width = 110 , height = 4 )
stamina = $game_variables [ 86 ]
w = width * stamina / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
#--------------------------------------------------------------------------
# ● 描绘饱食槽
#--------------------------------------------------------------------------
def draw_hunger_bar( x, y, width = 110 , height = 4 )
hunger = $game_variables [ 87 ]
w = width * hunger / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
#--------------------------------------------------------------------------
# ● 描绘愉悦槽
#--------------------------------------------------------------------------
def draw_mood_bar( x, y, width = 110 , height = 4 )
mood = $game_variables [ 88 ]
w = width * mood / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
#--------------------------------------------------------------------------
# ● 描绘社交槽
#--------------------------------------------------------------------------
def draw_social_bar( x, y, width = 110 , height = 4 )
social = $game_variables [ 89 ]
w = width * social / 100
hp_color_1 = Color.new ( 255 , 195 , 195 , 192 )
hp_color_2 = Color.new ( 195 , 180 , 255 , 192 )
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
x -= 1
y += ( height/4 ) .floor
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .ceil , hp_color_2)
x -= 1
y += ( height/4 ) .ceil
draw_line( x, y, x + w, y, hp_color_1, ( height/4 ) .floor , hp_color_2)
end
end