赞 | 5 |
VIP | 0 |
好人卡 | 2 |
积分 | 36 |
经验 | 24079 |
最后登录 | 2024-11-22 |
在线时间 | 1891 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3606
- 在线时间
- 1891 小时
- 注册时间
- 2010-6-19
- 帖子
- 1211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 黑米馒头 于 2022-5-17 09:22 编辑
下面这个脚本里面的宠物资质成长这些是在图片窗口显示的,如何改成在状态窗口显示,我想直接调用窗口的时候显示出这些数值
我试着调用数值
把
@BaBy.bitmap.draw_text(405,24,67,20,@actor.aptitude_atk.to_s,1)
改成
self.contents.draw_text(405,24,67,20,@actor.aptitude_atk.to_s,1)
可是好像找不到角色对应的宠物索引,在窗口里显示不出来数值
class Window_Status_Baby < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) super(100, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 0, 96) draw_actor_level(@actor, 96, 32) self.contents.draw_text(405,24,67,20,@actor.aptitude_atk.to_s,1) end end
class Window_Status_Baby < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(100, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 0, 96)
draw_actor_level(@actor, 96, 32)
self.contents.draw_text(405,24,67,20,@actor.aptitude_atk.to_s,1)
end
end
在图片里显示数值
如何改成在窗口显示数值,类似这样,一个可以单独调出的窗口
#============================================================================== # ■ 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
#==============================================================================
# ■ 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
|
|