Project1
标题:
请问如何显示状态回合数?
[打印本页]
作者:
存档不能
时间:
2013-9-18 08:39
标题:
请问如何显示状态回合数?
请问如何将默认的状态显示(即“[正常]”这样的文字)改成显示该状态的剩余回合数?
作者:
芯☆淡茹水
时间:
2013-9-18 08:39
初制品。由于要显示的状态文字较多,缩小了字体大小。
#==============================================================================
class Game_Battler
attr_accessor :states_turn
end
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("[]").width
if battler.is_a?(Game_Actor)
text = []
txt = ""
if battler.states != []
txt_1 = "回合后,"
txt_2 = "% 几率解除。"
for i in battler.states_turn.keys.clone
if $data_states[i].rating >= 1
txt = $data_states[i].name
txt = "[" + txt + "] " + battler.states_turn[i].to_s + txt_1
txt = txt + $data_states[i].auto_release_prob.to_s + txt_2
text.push(txt)
end
end
end
if text == []
if need_normal
text.push("[正常]")
end
end
else
text = ""
for i in battler.states
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
# 状态名空的字符串是 "[正常]" 的情况下
if text == ""
if need_normal
text = "[正常]"
end
else
# 加上括号
text = "[" + text + "]"
end
end
return text
end
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 120)
text = make_battler_state_text(actor, width, true)
self.contents.font.size = 16
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
for i in 0...text.size
txt = text[i]
y = i * 24 + y
self.contents.draw_text(x, y, width, 32, txt)
end
self.contents.font.size = 22
end
end
复制代码
未命名_副本.jpg
(103.23 KB, 下载次数: 28)
下载附件
保存到相册
2013-9-18 09:42 上传
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1