想弄个在战斗中显示状态信息的东西。
先追加了类:
[pre lang="ruby" line="1"]class Window_State < Window_Base
def initialize
super(160,0,480,320)
self.opacity = 160
self.back_opacity = 160
self.contents = Bitmap.new(384,256)
end
def make_text
for i in 0..$show_state_choose.index
case $show_state_choose.commands
when "战斗不能"
a = "\\C[2]名称:战斗不能"
b = "效果:\\n因受重伤而不能行动,若战斗结束时仍然处于此状态,\\n将无法获得战斗经验。"
else
a = "aaaaaaaa"
b = "bbbbbbbb"
end
end
self.contents.draw_text(16,16,224,32,a)
self.contents.draw_text(16,48,224,32,b)
end
end
class Window_Command < Window_Selectable
attr_accessor :commands
end[/pre]
然后在Scene_Battle里添加了:
[pre lang="ruby" line="1"]def state_start
@window_help.visible = false if @window_help
@party_command_window.active = false
@party_command_window.visible = false
start_actor_select
if Input.trigger?(Input::C)
$arrow_index = @actor_arrow.actor
end_actor_select
$states = ["属性"]
for i in $arrow_index.states
$states.push($data_states.name.to_s)
end
$show_state_choose = Window_Command.new(160,$states)
$show_state_choose.opacity = 160
$show_state_choose.back_opacity = 160
$show_state_choose.active = true
$show_state_choose.height = 320
@state_window = Window_State.new
end
end
def state_do
if Input.trigger?(Input::B)
$show_state_choose.active = false
$show_state_choose.visible = false
@window_help.visible = true if @window_help
@party_command_window.active = true
@party_command_window.visible = true
@state_window.visible = false
end
@state_window.make_text
end[/pre]