赞 | 16 |
VIP | 0 |
好人卡 | 0 |
积分 | 14 |
经验 | 0 |
最后登录 | 2023-11-7 |
在线时间 | 50 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1433
- 在线时间
- 50 小时
- 注册时间
- 2020-2-16
- 帖子
- 103
|
class Window_Skilled < Window_Selectable
def initialize(actor)
super(320, 128, 320, 352)
@actor = actor
refresh
self.index = -1
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...$game_variables[@actor.id * 10].size
skill = $game_variables[@actor.id * 10][i]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(self.width - 32, @item_max * 32 + 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
新的被遗忘的技能窗口
在Scene_Skill 的 main 里加入这个窗口
@skilled_window = Window_Skilled.new(@actor)
在update_command 里面写入
if Input.trigger?(Input::CTRL)
$game_system.se_play($data_system.cursor_se)
skill = @skill_window.skill
@actor.forget_skill(skill.id)
@skill_window.refresh
$game_variables[@actor.id * 10].push(skill)
@skilled_window.refresh
return
end
目前做了遗忘的技能,如何从遗忘技能中拿出来,留个你自己解决吧 |
|