class Game_Actor
MAX_SKILL_NUM = 2
alias :rsn_learn_skill :learn_skill
def learn_skill(skill_id)
rsn_learn_skill(skill_id)
if @skills.size > MAX_SKILL_NUM
@window_rsn = Window_Forget_Skill.new(120 , 200 , 240 , 160 , self)
loop do
Graphics.update
Input.update
@window_rsn.update
break if @window_rsn.disposed?
end
end
end
end
class Window_Forget_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# width : 窗口宽度
# height : 窗口高度
# actor : 角色
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 1
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取技能
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for id in @actor.skills
@data.push($data_skills[id])
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, @item_max * 32)
self.contents.draw_text(0, 0, 120, 32, @actor.name)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
x = 4
y = index * 32
skill = @data[index]
draw_item_name(skill, x, y)
end
alias :rsn_update :update
def update
rsn_update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@actor.forget_skill(skill.id)
self.dispose
return
end
end
end