赞 | 0 |
VIP | 4 |
好人卡 | 1 |
积分 | 1 |
经验 | 3388 |
最后登录 | 2020-5-20 |
在线时间 | 153 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 110
- 在线时间
- 153 小时
- 注册时间
- 2008-5-25
- 帖子
- 585
|
以下引用小空弟于2008-12-31 19:56:21的发言:
建议你还是开一个新Scene做这个。除非你的角色学的技能非常少,或者字体非常小
如果要显示所有技能的话,试试这个
#==============================================================================
# ■ Window_ShowSkill
#------------------------------------------------------------------------------
# 特技画面、可以使用的特技列表显示窗口。
#==============================================================================
class Window_ShowSkill < 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 = 3
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取特技
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
@data = []
for skill in $data_skills[0..50] #如果角色所有会的技能在0~50号技能的话
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_learn?(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end
class Scene_ShowSkill < Scene_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色位置
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@tree_window = Window_ShowSkill.new(0, 112, 544, 304, @actor)
@tree_window.viewport = @viewport
@tree_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@tree_window.dispose
end
#--------------------------------------------------------------------------
# ● 回到原画面
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(0) #回到的光标数
end
#--------------------------------------------------------------------------
# ● 切换至下一角色画面
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Tree.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● 切换至上一角色画面
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Tree.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@tree_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
end
end
end
调用的时候 $Scene=Scene_ShowSkill.new(0)
[本贴由作者于 2008-12-31 20:00:54 最后编辑]
此脚本有些问题………… |
|