# @sprite.z = (self.index == i) ? self.z + 2 : self.z + 1
@sprite.visible = self.visible
@sprite.update
end
#修改…………………………
if @sprite[0].active
@sprite[0].icon_name = "击-2"
else
@sprite[0].icon_name = "击-1"
end
if @sprite[1].active
@sprite[1].icon_name = "术-2"
else
@sprite[1].icon_name = "术-1"
end
if @sprite[2].active
@sprite[2].icon_name = "防-2"
else
@sprite[2].icon_name = "防-1"
end
if @sprite[3].active
@sprite[3].icon_name = "物-2"
else
@sprite[3].icon_name = "物-1"
end
if @sprite[4].active
@sprite[4].icon_name = "逃-2"
else
@sprite[4].icon_name = "逃-1"
end
if @sprite[6].active
@sprite[6].icon_name = "技-2"
else
@sprite[6].icon_name = "技-1"
end
#修改…………………………
end
# コマンドネームの更新
def com_name_update
# if move_index?
@name_sprite.name = get_com_name
# end
@name_sprite.x = 80
@name_sprite.y = 350
@name_sprite.z = 9998
@name_sprite.active = self.active
@name_sprite.visible = self.visible
@name_sprite.update
end
def get_com_name
make_name_set if @name_set.nil?
name = @name_set[self.index]
name = "" if name.nil?
return name
end
def make_name_set
@name_set = []
@name_set[1] = Momo_IconCommand::GUARD_NAME
@name_set[0] = Momo_IconCommand::SKILL_NAME
@name_set[2] = Momo_IconCommand::ATTACK_NAME
@name_set[3] = Momo_IconCommand::ITEM_NAME
@name_set[4] = Momo_IconCommand::ESCAPE_NAME
@name_set[5] = Momo_IconCommand::EBEIJING_NAME
end
def move_index?
return self.index != @last_index
end
def need_reset
@name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
end
def update_cursor_rect
# 计算光标坐标
case @index
when 0
x=87-40
y=85-40
when 1
x=89-40
y=33-40
when 3
x=42-40
y=70-40
when 2
x=59-40
y=123-40
when 4
x=117-40
y=123-40
when 6
x=134-40
y=70-40
end
# 更新国标矩形
if (x != nil) and(y !=nil)
self.cursor_rect.set(x, y, 45, 45)
end
end
end
# アイコン用スプライト
class Sprite_Icon < Sprite
attr_accessor :active
attr_accessor :icon_name
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(viewport, icon_name)
super(viewport)
@icon_name = icon_name
@last_icon = @icon_name
@count = 0
self.bitmap = RPG::Cache.icon(@icon_name)
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height / 2
@active = false
end
#------------------------------------------------------------------------
# ● 解放
#------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#------------------------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------------------
def update
super
if @icon_name != @last_icon
@last_icon = @icon_name
self.bitmap = RPG::Cache.icon(@icon_name)
end
if @active
@count += 1
case Momo_IconCommand::SELECT_TYPE
when 0
icon_flash
when 1
icon_zoom
end
@count = 0 if @count == 20
else
icon_reset
end
end
def icon_flash
if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 2
self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
end
end
def icon_zoom
case @count
when 1..10
zoom = 1.0 + @count / 10.0
when 11..20
zoom = 2.0 - (@count - 10) / 10.0
end
self.zoom_x = zoom
self.zoom_y = zoom
end
def icon_reset
@count = 0
self.zoom_x = 1.0
self.zoom_y = 1.0
end
end
# コマンドネーム用スプライト
class Sprite_Comm_Name < Sprite
attr_accessor :active
attr_accessor :name
attr_accessor :need_reset
#------------------------------------------------------------------------
# ● オブジェクト初期化
#------------------------------------------------------------------------
def initialize(viewport, name)
super(viewport)
@name = name
@last_name = nil
@count = 0
@x_plus = 0
@opa_plus = 0
@need_reset = false
@active = false
self.bitmap = Bitmap.new(160, 32)
end
#------------------------------------------------------------------------
# ● 解放
#------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#------------------------------------------------------------------------
# ● フレーム更新
#------------------------------------------------------------------------
def update
super
if @active
if need_reset?
@need_reset = false
@last_name = @name
text_reset
end
move_text if Momo_IconCommand::COM_NAME_MOVE
end
end
def move_text
@count += 1
@x_plus = [@count * 8, 80].min
self.x = self.x - 80 + @x_plus
self.opacity = @count * 25
end
def text_reset
@count = 0
@x_plus = 0
self.bitmap.clear
self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
self.bitmap.draw_text(0, 0, 160, 32, @name)
end
def need_reset?
return (@name != @last_name or @need_reset)
end
end