#==============================================================================
# ■ Window_Baby_Command
#------------------------------------------------------------------------------
# 宠物界面宠物选择窗口。
#==============================================================================
class Window_Baby_Command < Window_Baby_Selectable
attr_accessor :commands
def initialize(actor = nil)
super(11,29, 110, 147)
self.opacity = 0
@actor = actor
@commands = []
if @actor != nil
refresh
end
end
def set_actor(actor)
@actor = actor
end
def refresh
if @actor != nil
run = false
numbers = 0
for i in @actor.babys
if i != 0
numbers += 1
end
end
if @commands.size != numbers
@item_max = 0
@commands = []
for i in @actor.babys
if i != 0
@item_max += 1
@commands.push($data_actors[i])
end
end
run = true
elsif @baby_id != @actor.baby
run = true
@baby_id = @actor.baby
end
if run == true
if self.contents != nil
self.contents.dispose
end
self.contents = Bitmap.new(width,@item_max*23 + 32)
self.contents.font.name = "宋体"
self.contents.font.size = 20
for i in 0...@commands.size
draw_name(i, Color.new(0, 0, 0, 255))
end
end
end
end
def draw_name(index, color)
if @commands[index].id == @actor.baby
@index = index
self.contents.font.color = Color.new(255, 255, 0, 255)
elsif $game_actors[@commands[index].id].hp0?
self.contents.font.color = Color.new(255, 0, 0, 255)
else
self.contents.font.color = color
end
self.contents.draw_text(0, index * 23, self.width, 23, @commands[index].name,0)
end
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#==============================================================================
# ■ Scene_Baby
#------------------------------------------------------------------------------
# 召唤兽管理界面
#==============================================================================
class Scene_Baby
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
#宠物界面
@BaBy = Sprite.new()
@BaBy.bitmap = RPG::Cache.windowskin("skin_baby")
@actor = $game_party.actors[0]
@command_window = Window_Baby_Command.new(@actor)
@command_window.active = true
# 执行过渡
Graphics.transition
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
if Kboard.keyboard($R_Key_F4)
Screen::shot1
Audio.se_play("Audio/SE/"+"camera",100,100)
end
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
RPG::Cache.clear
break
end
end
# 装备过渡
Graphics.freeze
@command_window.dispose
@BaBy.dispose
end
#----------------------------------------------------------------------------
# ● 绘制宝宝属性
# id : 宝宝id
#----------------------------------------------------------------------------
def draw_属性(id)
@BaBy.bitmap.dispose
@BaBy.bitmap = RPG::Cache.windowskin("skin_baby")
@BaBy.bitmap.font = Font.new("宋体",14)
@BaBy.bitmap.font.name = ["楷体","宋体"]
@BaBy.bitmap.font.color = Color.new(0,0,0,255)
@actor = $game_actors[id]
#攻击资质
@BaBy.bitmap.draw_text(405,24,67,20,@actor.aptitude_atk.to_s,1)
#防御资质
@BaBy.bitmap.draw_text(405,47,67,20,@actor.aptitude_pdef.to_s,1)
#体力资质
@BaBy.bitmap.draw_text(405,70,67,20,@actor.aptitude_hp.to_s,1)
#法力资质
@BaBy.bitmap.draw_text(405,93,67,20,@actor.aptitude_mdef.to_s,1)
#速度资质
@BaBy.bitmap.draw_text(405,116,67,20,@actor.aptitude_agi.to_s,1)
#躲避资质
@BaBy.bitmap.draw_text(405,139,67,20,@actor.aptitude_eva.to_s,1)
#寿命
@BaBy.bitmap.draw_text(405,162,67,20,"无限",1)
#成长
@BaBy.bitmap.draw_text(405,185,67,20,@actor.grow.to_s,1)
end
#----------------------------------------------------------------------------
# ● 更新画面
#----------------------------------------------------------------------------
def update
@command_window.update
#如果宠物选择索引发生变化
if @baby_index != @command_window.index
draw_属性(@command_window.commands[@command_window.index].id)
end
end
end