赞 | 0 |
VIP | 12 |
好人卡 | 42 |
积分 | 7 |
经验 | 44348 |
最后登录 | 2024-4-1 |
在线时间 | 791 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 690
- 在线时间
- 791 小时
- 注册时间
- 2011-10-20
- 帖子
- 2394
|
BY my self:- #==============================================================================
- # ■ Window_massage
- #------------------------------------------------------------------------------
- # 显示message and use item 的窗口。
- #==============================================================================
- class Window_xy < Window_Base#
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 300, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.x = 640 - 170
- self.y = 0
- @hp = $game_party.actors[0].hp
- @maxhp = $game_party.actors[0].maxhp
- @sp = $game_party.actors[0].sp
- @maxsp = $game_party.actors[0].maxsp
- @exp = $game_party.actors[0].exp
- @gold = $game_party.gold
- @power = $pp_power
- @pp_size = $pp_size
- @yongqi = $game_variables[10]
- @kuaijie_s = false
-
- @Bsp = 0
- @Bhp = 0
- new_sprite
- refresh
- end
- def new_sprite
- @sprite = []
- hp = Sprite.new
- hp.bitmap = Bitmap.new('Graphics/Pictures/HP1_2.png')
- hp.x = self.x + 16
- hp.y = self.y + 18
- hp.z = 10
- hp.zoom_x = @hp.to_f / $game_party.actors[0].maxhp.to_i.to_f
- hp2 = Sprite.new
- hp2.bitmap = Bitmap.new('Graphics/Pictures/HP1.png')
- hp2.x = self.x + 11
- hp2.y = self.y + 16
- hp2.z = 9
- sp = Sprite.new
- sp.bitmap = Bitmap.new('Graphics/Pictures/HP1_2.png')
- sp.tone = Tone.new(0,0,255)
- sp.x = self.x + 16
- sp.y = self.y + 18+28
- sp.z = 10
- sp.zoom_x = @sp.to_f / $game_party.actors[0].maxsp.to_i.to_f
- sp2 = Sprite.new
- sp2.bitmap = Bitmap.new('Graphics/Pictures/HP1.png')
- sp2.tone = Tone.new(0,0,255)
- sp2.x = self.x + 11
- sp2.y = self.y + 16+28
- sp2.z = 9
- @sprite = [hp,sp,hp2,sp2]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @sprite.each{|s|s.visible = true}
- if $game_switches #确定开关是否打开,可以自己改变开关
- if @hp != $game_party.actors[0].hp or @maxhp != $game_party.actors[0].maxhp
- @Bhp = @hp
- end
- if @sp != $game_party.actors[0].sp or @maxsp != $game_party.actors[0].maxsp
- @Bsp = @sp
- end
- @hp = $game_party.actors[0].hp
- @maxhp = $game_party.actors[0].maxhp
- @sp = $game_party.actors[0].sp
- @maxsp = $game_party.actors[0].maxsp
- @exp = $game_party.actors[0].exp
- @gold = $game_party.gold
- @items_size = $game_party.items.size
- @power = $pp_power
- @yongqi = $game_variables[10]
- self.contents.clear #清除以前的东西
- self.contents.font.size = 12
- self.contents.font.name = "宋体"
- self.contents.font.color = system_color#颜色,暗蓝色
- draw_actor_hp($game_party.actors[0], 0, 0, width = 144)
- draw_actor_sp($game_party.actors[0], 0, 14+16, width = 144)
- draw_actor_level($game_party.actors[0], 0, 28+16)
- draw_actor_exp($game_party.actors[0], 0, 42+16)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 56+16, 116, 32, "GOLD:#{@gold.to_s}",2)
- self.contents.draw_text(0, 70+16, 156, 32, "泡泡威力:#{@power.to_s}",2)
- self.contents.draw_text(0, 84+16, 156, 32, "泡泡数量:#{$pp_size.to_s}",2)
- self.contents.draw_text(0, 98+16, 156, 32, "勇气:#{@yongqi.to_s}",2)
- if $kuaijie_s == true
- discription_item_self
- else
- discription_item
- end
- end
- end
- def discription_item
- x,y,t = -28,140,0
- self.contents.font.size = 10
- @itemtable = {};time = 0
- for item in $game_party.items
- next if $game_party.item_number(item[0]) == 0#持有 == 0
- next if $data_items[item[0]].occasion == 3 #无法使用
- t += 1
- t >= 7 ? (t = 0;y += 44) : x = 28*(t-1)
- if draw_item_name2($data_items[item[0]], x, y) == false
- x -= 28
- else
- time+=1;@itemtable[time] = item[0]
- end
- end
- end
- def discription_item_self
- x,y,t = -28,140,0
- self.contents.font.size = 10
- @itemtable = {};time = 0
- for item in $kuaijie
- next if $game_party.item_number(item.id) == 0#持有 == 0
- t += 1
- t >= 7 ? (t = 0;y += 44) : x = 28*(t-1)
- if draw_item_name2(item, x, y) == false
- x -= 28
- else
- time+=1;@itemtable[time] = item.id
- end
- end
- end
- def use_item(id)#id指顺序ID1-9
- item = ($data_items[@itemtable[id]] rescue 0)
- return if item == 0#不含有的物品。
- # 如果物品用完的情况下
- if $game_party.item_number(item.id) == 0
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- used = $game_party.actors[0].item_effect(item)
- use_ok?(used,item)
-
- end
-
- def use_ok?(used,item)
- # 使用物品的情况下
- @item = item
- if used
- # 演奏物品使用时的 SE
- $game_system.se_play(@item.menu_se)
- # 消耗品的情况下
- $game_player.animation_id = item.animation1_id
- if @item.consumable
- # 使用的物品数减 1
- $game_party.lose_item(@item.id, 1)
- # 再描绘物品窗口的项目
- refresh
- end
- # 全灭的情况下
- if $game_party.all_dead?
- # 切换到游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 公共事件 ID 有效的情况下
- if @item.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = @item.common_event_id
- # 切换到地图画面
- $game_map.need_refresh = true
- return
- end
- end
- # 无法使用物品的情况下
- unless used
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- def change_hp
- @Bhp += (($game_party.actors[0].hp.to_i - @Bhp).to_f / 40)#增减hp
- @sprite[0].zoom_x = (@Bhp.to_f / $game_party.actors[0].maxhp.to_i.to_f)
- @Bhp = 0 if (@Bhp - $game_party.actors[0].hp).abs <= 10
- end
- def change_sp
- @Bsp += (($game_party.actors[0].sp.to_i - @Bsp).to_f / 40)#增减hp
- @sprite[1].zoom_x = (@Bsp.to_f / $game_party.actors[0].maxsp.to_i.to_f)
- @Bsp = 0 if (@Bsp - $game_party.actors[0].sp).abs <= 10
- end
- #--------------------------------------------------------------------------
- # ● 判断文字刷新。节约内存用
- #--------------------------------------------------------------------------
- def judge
- for input in 1..9
- use_item(input) if eval("Kboard.trigger?($R_Key_#{input})")
- end
- change_hp if @Bhp != 0
- change_sp if @Bsp != 0
- #return false unless Input.trigger?(Input::C)
- return 'hp' if @hp != $game_party.actors[0].hp
- return true if $pp_power != @power
- return 'maxhp' if @maxhp != $game_party.actors[0].maxhp
- return "sp" if @sp != $game_party.actors[0].sp
- return 'maxhp' if @maxsp != $game_party.actors[0].maxsp
- return true if @exp != $game_party.actors[0].exp
- return true if @gold != $game_party.gold
- return true if @items_size != $game_party.items.size
- return true if @yongqi != $game_variables[10]
- return false
- end
- def dispose
- @sprite.each{|s|s.visible = false}
- self.contents.dispose if self.contents != nil
- end
- def visible_to_f
- self.visible = false
- @sprite.each{|s|s.visible = false}
- end
- end
- class Scene_Map
- alias xy_66rpg_main main
- def main
- $xy_window = Window_xy.new
- $xy_window.opacity = 0
- xy_66rpg_main
- $xy_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- alias xy_66rpg_update update
- def update
- xy_66rpg_update
- if $game_switches[2] == false
- $xy_window.visible = true
- if $xy_window.judge
- $xy_window.refresh
- end
- #@mess8_window.refresh if @mess8_window.judge
-
- else
- #@mess8_window.visible = false
- $xy_window.visible_to_f
- end
- end
- end
复制代码 添加进入脚本即可,有很多功能。。。。 |
|