加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 美丽晨露 于 2013-11-24 22:27 编辑
class Sprite_States_Icon < Sprite def initialize(actor, x, y, view_area) super(view_area) @back = Sprite.new(view_area) @back.bitmap = Cache.system("Statebox.png") @back.opacity = 128 [url=home.php?mod=space&uid=95897]@actor[/url] = actor @states = [] self.bitmap = Bitmap.new(24 * 4, 24) self.x = x self.y = y @back.x = x @back.y = y @back.z = 200 update end def update return if @states == @actor.states self.bitmap.clear count = 0 @states = @actor.states for state in @actor.states draw_icon(state.icon_index, x + 24 * count, y) count += 1 break if (24 * count > width - 24) end end def draw_icon(icon_index, x, y, enabled = true) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 96) self.bitmap.blt(0, 0, bitmap, rect, enabled ? 255 : 128) end
class Sprite_States_Icon < Sprite
def initialize(actor, x, y, view_area)
super(view_area)
@back = Sprite.new(view_area)
@back.bitmap = Cache.system("Statebox.png")
@back.opacity = 128
[url=home.php?mod=space&uid=95897]@actor[/url] = actor
@states = []
self.bitmap = Bitmap.new(24 * 4, 24)
self.x = x
self.y = y
@back.x = x
@back.y = y
@back.z = 200
update
end
def update
return if @states == @actor.states
self.bitmap.clear
count = 0
@states = @actor.states
for state in @actor.states
draw_icon(state.icon_index, x + 24 * count, y)
count += 1
break if (24 * count > width - 24)
end
end
def draw_icon(icon_index, x, y, enabled = true)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 96)
self.bitmap.blt(0, 0, bitmap, rect, enabled ? 255 : 128)
end
这个是某一个脚本内显示状态的脚本,可是我怎么改都只能显示一个状态。
要不就是改出排列是竖着的状态显示,而且显示的状态图标也不正确。
请问要怎么修改才能达到横着最大排列四个状态,而且是显示正确的哟。
|