| 赞 | 5 |
| VIP | |
| 好人卡 | |
| 积分 | 73 |
| 经验 | |
| 最后登录 | 2026-11-1 |
| 在线时间 | 1244 小时 |
- 梦石
- 0
- 星屑
- 7306
- 在线时间
- 1244 小时
- 注册时间
- 2015-8-15
- 回帖
- 473
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 金芒芒 于 2022-11-22 11:02 编辑
- #==============================================================================
- # ■ Window_Status
- #------------------------------------------------------------------------------
- # 人物状态窗口。
- #==============================================================================
- class Window_Status < Window_Base
- CLASS_ON = false #状态条开启与不开启
- attr_reader :actor
- def actor
- return @actor
- end
- def actor=(actor)
- @actor = actor
- end
-
- def blue_color
- return Color.new(141,157,180)
- end
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor = $game_party.actors[0])
- @back = Sprite.new
- @back.bitmap = RPG::Cache.menu("Status")
- @actor = actor
- @new_p = [nil]
- @new_maxhp = nil
- @new_maxsp = nil
- #super(origin_x+320, origin_y+130, 122+64, 480
- super(origin_x+320, origin_y+130, 1200, 700)
- self.contents = Bitmap.new(width-32, height-32)
- #self.windowskin = RPG::Cache.windowskin("")
- self.opacity = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 活动窗口用原始x y坐标
- #--------------------------------------------------------------------------
- def origin_x
- return 220
- end
- def origin_y
- return 64
- end
- #--------------------------------------------------------------------------
- # ● 一些方法的重载
- #--------------------------------------------------------------------------
- def dispose
- @back.dispose
- super
- end
- def x=(x)
- @back.x = x-origin_x
- super(x-16)
- end
- def x
- return super+16
- end
- def y=(y)
- @back.y = y
- super(y)
- end
- def z=(z)
- @back.z=z-5
- super(z)
- end
- def visible=(visible)
- @back.visible=visible
- super(visible)
- end
- def contents_opacity=(opacity)
- @back.opacity=opacity
- super(opacity)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh(actor = @actor)
- @actor = actor
- self.contents.clear
-
- @new_maxhp = nil
- @new_maxsp = nil
- for i in 0 ... @new_p.size
- @new_p[i] = nil
- end
- draw_actor_name(16, 96-32)
- if CLASS_ON #显示职业的情况
- draw_actor_level(12,126-32)#描绘等级
- draw_actor_class(12,126-32+14)#描绘职业
- draw_actor_hsp(12,126-32+28, 0,@new_maxhp )#描绘hp
- # draw_actor_hsp(12,126-32+42,1,@new_maxsp )#描绘sp
- # draw_actor_cp(12,126-32+56)#描绘cp
- else
- draw_actor_level(12,126-32)#描绘等级
- draw_actor_hsp(380,240-32+4+16,0,@new_maxhp )#描绘hp
- # draw_actor_hsp(12, 126-32+4+32,1,@new_maxsp )#描绘sp
- # draw_actor_cp(12,126-32+4+48)#描绘cp
- end
- #描绘各种属性
- for i in 0 ...8
- draw_actor_parameters(380, 128-32+4+i*16, i,@new_p[i] )
- end
- draw_actor_state(actor, 12, 208-32+12+i*16)
- #描绘经验
- draw_actor_exp(12, 368-32)
- end
- #--------------------------------------------------------------------------
- # ● 描绘能力值
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # type : 能力值种类 (0~6)
- #--------------------------------------------------------------------------
- def draw_actor_parameters( x, y, type=0, new=nil )
- self.contents.fill_rect(x, y, 122, 14, Color.new(0, 0, 0, 0))
- @color = Color.new(0,0,0)
- @color = normal_color
- up_color = system_color
- down_color = knockout_color
- ud = RPG::Cache.menu_icon("null")
- case type
- when 0
- word = $data_system.words.atk
- old = @actor.atk
- when 1
- word = $data_system.words.pdef
- old = @actor.pdef
- when 2
- word = $data_system.words.mdef
- old = @actor.mdef
- when 3
- word = $data_system.words.str
- old = @actor.str
- when 4
- word = $data_system.words.dex
- old = @actor.dex
- when 5
- word = $data_system.words.agi
- old = @actor.agi
- when 6
- word = $data_system.words.int
- old = @actor.int
- when 7
- word = "AGL"
- old = @actor.eva
- end
- if new != nil
- @color = normal_color
- if new > old
- @color = up_color
- ud = RPG::Cache.menu_icon("up")
- end
- if new < old
- @color = down_color
- ud = RPG::Cache.menu_icon("down")
- end
- value = new
- else
- @color= normal_color
- value = old
- end
-
- self.contents.font.size = 12
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1, 20, self.contents.font.size, word)
- self.contents.font.color = blue_color
- self.contents.draw_text(x, y, 20, self.contents.font.size, word)
-
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1, 66, self.contents.font.size, value.to_s, 2)
- self.contents.font.color = @color
- self.contents.draw_text(x, y, 66, self.contents.font.size, value.to_s, 2)
- self.contents.blt(x+66, y, ud, Rect.new(0,0,12, 12) )
- end
- #--------------------------------------------------------------------------
- # ● 描绘hsp
- #--------------------------------------------------------------------------
- def draw_actor_hsp(x, y, type=0, new=nil)
- self.contents.fill_rect(x, y, 122, 14, Color.new(0, 0, 0, 0))
- case type
- when 0
- word = $data_system.words.hp
- hsp = @actor.hp
- mhsp = @actor.maxhp
- # when 1
- # word = $data_system.words.sp
- # hsp = @actor.sp
- # mhsp = @actor.maxsp
- end
- ud = RPG::Cache.menu_icon("null")
- # 描绘字符串 "HP"
- self.contents.font.size = 12
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1, 24, self.contents.font.size, word)
- self.contents.font.color = title_color
- self.contents.draw_text(x, y, 24, self.contents.font.size, word)
- # 描绘 HP
- # self.contents.font.color = black_color
- # self.contents.draw_text(x+1, y+1, 52, self.contents.font.size, hsp.to_s, 2)
- # self.contents.font.color = hsp == 0 ? knockout_color :
- # (hsp <= mhsp / 4 ? crisis_color : normal_color)
- # self.contents.draw_text(x, y, 52, self.contents.font.size, hsp.to_s, 2)
- # 描绘 MaxHP
- # self.contents.font.color = black_color
- # self.contents.draw_text(x + 52+1, y+1, 12, self.contents.font.size, "/")
- # self.contents.font.color = normal_color
- # self.contents.draw_text(x + 52, y, 12, self.contents.font.size, "/")
-
- up_color = system_color
- down_color = knockout_color
- if new != nil
- @color = normal_color
- if new > mhsp
- @color= up_color
- ud = RPG::Cache.menu_icon("up")
- end
- if new < mhsp
- @color = down_color
- ud = RPG::Cache.menu_icon("down")
- end
- hp_value = new
- else
- @color = normal_color
- hp_value = mhsp
- end
- self.contents.font.color = black_color
- self.contents.draw_text(x+64-6+1, y+1, 32,self.contents.font.size, hp_value.to_s,2)
- self.contents.font.color = @color
- self.contents.draw_text(x+64-6, y, 32,self.contents.font.size, hp_value.to_s,2)
- self.contents.blt(x+96-6, y, ud, Rect.new(0,0,24, 24) )
- end
- #--------------------------------------------------------------------------
- # ● 描绘名字
- #--------------------------------------------------------------------------
- def draw_actor_name(x, y)
- self.contents.font.size = 18
- self.contents.font.color = black_color
- self.contents.draw_text(x+76, y+1, 90, 18, @actor.name,1)
- self.contents.font.color = normal_color
- self.contents.draw_text(x+75, y, 90, 18, @actor.name,1)
- end
- #--------------------------------------------------------------------------
- # ● 描绘等级 126 12
- #--------------------------------------------------------------------------
- def draw_actor_level( x, y)
- self.contents.font.size = 20
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y, 32, self.contents.font.size, "等级")
- self.contents.font.color = title_color
- self.contents.draw_text(x+10, y+275, 32, self.contents.font.size, "等级")#Level
-
- self.contents.font.size = 20
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y, 86, self.contents.font.size, @actor.level.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y+275, 86, self.contents.font.size, @actor.level.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 描绘职业
- #--------------------------------------------------------------------------
- def draw_actor_class( x, y)
- self.contents.font.size = 14
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1, 32, self.contents.font.size, "Class")
- self.contents.font.color = title_color
- self.contents.draw_text(x, y, 32, self.contents.font.size, "Class")
- self.contents.font.size = 12
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1+2, 88, self.contents.font.size, actor.class_name, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y+2, 88, self.contents.font.size, actor.class_name, 2)
- end
- #--------------------------------------------------------------------------
- # ● 描绘CP
- #--------------------------------------------------------------------------
- # def draw_actor_cp( x, y)
- # 描绘字符串 "CP"
- # self.contents.font.size = 12
- # self.contents.font.color = black_color
- # self.contents.draw_text(x+1, y+1, 32, self.contents.font.size, "CP")
- # self.contents.font.color = title_color
- # self.contents.draw_text(x, y, 32, self.contents.font.size, "CP")
- # self.contents.font.color = black_color
- # self.contents.draw_text(x+1, y+1, 90, self.contents.font.size, actor.cp_store.to_s, 2)
- # self.contents.font.color = normal_color
- # self.contents.draw_text(x, y, 90, self.contents.font.size, actor.cp_store.to_s, 2)
- # end
- #--------------------------------------------------------------------------
- # ● 描绘经验值
- #--------------------------------------------------------------------------
- def draw_actor_exp(x, y)
- self.contents.font.size = 12
-
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1, 32, self.contents.font.size, "EXP")
- self.contents.font.color = title_color
- self.contents.draw_text(x, y, 32, self.contents.font.size, "EXP")
-
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+1, 96, self.contents.font.size, @actor.exp.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 96, self.contents.font.size, @actor.exp.to_s, 2)
-
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+14+1, 32, self.contents.font.size, "NEXT")
- self.contents.font.color = title_color
- self.contents.draw_text(x, y+14, 32, self.contents.font.size, "NEXT")
- self.contents.font.color = black_color
- self.contents.draw_text(x+1, y+14+1, 96, self.contents.font.size, @actor.next_exp_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y+14, 96, self.contents.font.size, @actor.next_exp_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 设定属性变化
- #--------------------------------------------------------------------------
- def set_parameters(atk=nil,pdef=nil,mdef=nil,str=nil,dex=nil,agi=nil,int=nil,maxhp=nil,maxsp=nil, eva = nil )
- if @new_p[0] != atk
- @new_p[0]= atk
- draw_actor_parameters(28, 208-32+4+0*16, 0,@new_p[0] )
- end
- if @new_p[1] != pdef
- @new_p[1] = pdef
- draw_actor_parameters(28, 208-32+4+1*16, 1,@new_p[1] )
- end
- if @new_p[2] != mdef
- @new_p[2] = mdef
- draw_actor_parameters(28, 208-32+4+2*16, 2,@new_p[2] )
- end
- if @new_p[3] != str
- @new_p[3] = str
- draw_actor_parameters(28, 208-32+4+3*16, 3,@new_p[3] )
- end
- if @new_p[4] != dex
- @new_p[4] = dex
- draw_actor_parameters(28, 208-32+4+4*16, 4,@new_p[4] )
- end
- if @new_p[5] != agi
- @new_p[5] = agi
- draw_actor_parameters(28, 208-32+4+5*16, 5,@new_p[5] )
- end
- if @new_p[6] != int
- @new_p[6] = int
- draw_actor_parameters(28, 208-32+4+6*16, 6,@new_p[6] )
- end
- #回避修正
- if @new_p[7] != eva
- @new_p[7] = eva
- draw_actor_parameters(28, 208-32+4+7*16, 7,@new_p[7] )
- end
- if @new_maxhp != maxhp
- @new_maxhp = maxhp
- if CLASS_ON #显示职业的情况
- draw_actor_hsp(12,126-32+28, 0,@new_maxhp )#描绘hp
- else
- draw_actor_hsp(12, 126-32+4+16,0,@new_maxhp )#描绘hp
- end
- end
- # if @new_maxsp != maxsp
- # @new_maxsp = maxsp
- # if CLASS_ON #显示职业的情况
- # draw_actor_hsp(12,126-32+42,1,@new_maxsp )#描绘sp
- # else
- # draw_actor_hsp(12, 126-32+4+32,1,@new_maxsp )#描绘sp
- # end
- # end
- end
-
- end
复制代码 |
-
|