赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 163587 |
最后登录 | 2020-5-5 |
在线时间 | 41 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 41 小时
- 注册时间
- 2008-3-5
- 帖子
- 2072
|
- class Actor_show
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- @actor = $game_party.actors[0]
- @hp = @actor.hp
- @sp = @actor.sp
- @exp = @actor.now_exp
- @states = @actor.states
- @parameter = []
- @sprite = Sprite.new
- @long = 40 ; @long_t = [@actor.name.size * 7, 78].min
- @sprite.bitmap = Bitmap.new(@long+@long_t+2,@long*2+18)
- #Mess_Text.visible = true
- #Mess_Text.ini
- steup
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def steup
- refresh(0)
- #if !$scene.is_a?(Scene_Key)
- # @key_window = Window_KeyCommand.new
- # @key_window.refresh($game_party.actors[0])
- #end
- #if !$scene.is_a?(Scene_Item_Key)
- # @item_window = Window_Item_KeyCommand.new
- # @item_window.refresh($game_party.actors[0])
- #end
- end
- def visible=(val)
- #@key_window.visible = val if !@key_window.nil?
- #@item_window.visible = val if !@item_window.nil?
- @parameter.each{|pict|pict.visible = val}
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- #Mess_Text.dispose
- #Mess_Text.visible = false
- #@key_window.dispose if !@key_window.nil?
- #@item_window.dispose if !@item_window.nil?
- @sprite.bitmap.dispose
- @sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 描绘状态
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # width : 描画目标的宽
- #--------------------------------------------------------------------------
- def draw_actor_state(actor, x, y, width = 120)
- pos = 0
- for i in @actor.states
- if $data_states[i].name == "战斗不能"
- next
- end
- bitmap = RPG::Cache.icon($data_states[i].name)
- @parameter[5].bitmap.blt(x+pos*bitmap.width, y, bitmap, Rect.new(0,0,bitmap.width,bitmap.height))
- pos += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新数值变化
- #--------------------------------------------------------------------------
- def refresh(type)
- @sprite.bitmap.clear
- if $game_variables[5] > 1
- @sprite.x = $game_player.screen_x - (@long+@long_t)/2
- @sprite.y = $game_player.screen_y - @long*2
- @sprite.z = 9000
-
- @sprite.bitmap.fill_rect(@long_t/2+0,@long*2+ 4,@long+2,6,Color.new(255,255,255,255))
- @sprite.bitmap.fill_rect(@long_t/2+1,@long*2+ 5,@long, 4,Color.new(20,20,20,255))
- w = @actor.hp * @long / @actor.maxhp
- w_man = @actor.hp_man * @long / @actor.maxhp
- @sprite.bitmap.fill_rect(@long_t/2+1,@long*2+ 5,w_man,4,Color.new(150,0,0,160))
- @sprite.bitmap.fill_rect(@long_t/2+1,@long*2+ 5,w, 4,Color.new(255,20,20,255))
-
- @sprite.bitmap.fill_rect(@long_t/2+0,@long*2+12,@long+2,6,Color.new(255,255,255,255))
- @sprite.bitmap.fill_rect(@long_t/2+1,@long*2+13,@long, 4,Color.new(20,20,20,255))
- u = @actor.sp * @long / @actor.maxsp
- u_man = @actor.sp_man * @long / @actor.maxsp
- @sprite.bitmap.fill_rect(@long_t/2+1,@long*2+13,u_man,4,Color.new(0,0,155,160))
- @sprite.bitmap.fill_rect(@long_t/2+1,@long*2+13,u, 4,Color.new(20,20,255,255))
- if $game_variables[5] > 0
- @sprite.bitmap.font.size = 12
- @sprite.bitmap.font.color.set(100, 300, 0,255)
- @sprite.bitmap.draw_text((@long+@[email protected]*6)/2,0,@actor.nicheng.size*6,20,@actor.nicheng,1)
- @sprite.bitmap.font.size = 14
- #设置名字颜色随状态更改
- hong = 1.0*w/@long ; x = hong > 0.5 ? 1 : 4 ; y = x == 1 ? 1 : 0
- @sprite.bitmap.font.color.set(255, 155*y+100*x*hong, 255*hong, 255)
- # 中毒的颜色#
- @sprite.bitmap.draw_text((@long+@[email protected]*6)/2,16,@actor.name.size*6,20,@actor.name,1)
- #@sprite.bitmap.draw_text((@long+@[email protected]*6)/2,23,@actor.name.size*6,20,hong.to_s,1)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- Mess_Text.update
- #if $refresh["states"]
- # refresh(3)
- # $refresh["states"] = false
- #end
- #if $refresh["item"]
- # @item_window.refresh(@actor)
- # $refresh["item"] = false
- #end
- #if $refresh["skill"]
- # @key_window.refresh(@actor)
- # $refresh["skill"] = false
- #end
- if @actor.states.size > 0
- for i in @actor.states
- if @actor.states_time[i] > 0
- @actor.states_time[i] -= 1
- end
- if @actor.states_time[i] <= 0
- @actor.remove_state(i)
- end
- end
- if @actor.states.size > 0 and Graphics.frame_count%10 == 0
- $game_party.check_map_slip_damage
- end
- end
- if Input.trigger?(Input::CTRL)
- Mess_Text.clear
- return
- end
- if Input.trigger?(Input::SHIFT)
- Mess_Text.visible = !Mess_Text.visible
- return
- end
- #=begin
- if $game_player.moving?
- refresh(0)
- end
- if @hp != $game_party.actors[0].hp
- if @hp > $game_party.actors[0].hp
- @hp -= 1
- end
- if @hp < $game_party.actors[0].hp
- @hp += 1
- end
- refresh(0)
- end
- if @sp != $game_party.actors[0].sp
- if @sp > $game_party.actors[0].sp
- @sp -= 1
- end
- if @sp < $game_party.actors[0].sp
- @sp += 1
- end
- refresh(1)
- end
- if @exp != $game_party.actors[0].now_exp
- if @exp > $game_party.actors[0].now_exp
- @exp -= 1
- end
- if @exp < $game_party.actors[0].now_exp
- @exp += 1
- end
- refresh(2)
- end
- #=end
- end
- end
复制代码
这个我写的,给你参考吧 |
|