Project1
标题:
不知道 我这个窗口 有问题不 用起来便扭
[打印本页]
作者:
z2z4
时间:
2013-7-22 07:22
标题:
不知道 我这个窗口 有问题不 用起来便扭
class Window_MapZ < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640 ,480) #(-9, -9, 660 ,500)
refresh
end
#--------------------------------------------------------------------------
# ● 绘制值槽
# rate : 比率(1.0 为满值)
# color1 : 渐变色的左端
# color2 : 渐变色的右端
#--------------------------------------------------------------------------
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x, gauge_y, width, 30, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, 30, color1, color2)
end
#--------------------------------------------------------------------------
# ● 刷新 contents.width
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_pict_name = "界面01" # 要顯示的圖片名
contents.blt(0, 0, Cache.picture(draw_pict_name), contents.rect)
color1 = text_color(Freya::VariableColor1)
color2 = text_color(Freya::VariableColor2)
if $game_variables[Freya::MaxWindowVariableID] != 0
rate = $game_variables[Freya::WindowVariableID].to_f / $game_variables[Freya::MaxWindowVariableID]
draw_gauge(70, 355, 360, rate, color1, color2) #制作血槽
text = "#{$game_variables[Freya::WindowVariableID]}/#{$game_variables[Freya::MaxWindowVariableID]}"
draw_text(500,355,50,30 ,text, 2)
else
draw_text(contents.rect, $game_variables[Freya::WindowVariableID], 2)
end
draw_text(50,20,150,30, $game_system.variable_show_text,3) #事件脚本的调用
change_color(text_color(3))
self.contents.draw_text(360,187,50,32,$game_variables[$variables_a_id].to_s,3)
self.contents.draw_text(360,215,50,32,$game_variables[$variables_a_id].to_s,3)
self.contents.draw_text(360,240,50,32,$game_variables[$variables_a_id].to_s,3)
self.contents.draw_text(360,268,50,32,$game_variables[$variables_a_id].to_s,3)
change_color(text_color(3))
self.contents.draw_text(505,187,50,32,$game_variables[$variables_aa_id].to_s,3)
self.contents.draw_text(505,215,50,32,$game_variables[$variables_aa_id].to_s,3)
self.contents.draw_text(505,240,50,32,$game_variables[$variables_aa_id].to_s,3)
self.contents.draw_text(505,268,50,32,$game_variables[$variables_aa_id].to_s,3)
change_color(text_color(0))
end
end
复制代码
还有 如何调用场景 最好 我用过好几个方法 都卡帧
作者:
DeathKing
时间:
2013-7-22 12:19
不要每帧都调用refresh。如果数据有变动,再调用refresh重绘画面。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1