Project1

标题: 关于Window的dispose,为什么dispose之后还显示0 0 [打印本页]

作者: 皮卡星    时间: 2011-11-1 18:07
标题: 关于Window的dispose,为什么dispose之后还显示0 0
本帖最后由 皮卡星 于 2011-11-4 00:01 编辑

唔,就是一个hud……
  1. class Goods_Window < Window_Base
  2.   def initialize
  3.     super(0,0,544,88)
  4.     self.opacity = 0
  5.     update
  6.   end
  7.   def update
  8.     if $game_switches[Saba::WAGoods::HIDE_SWITCH]
  9.       self.visible = false
  10.     else
  11.       self.visible = true
  12.     end
  13.     actor = $game_party.members[0]
  14.     draw_actor_hp_menu(actor, 0, 0,"HP")
  15.   end
  16.   def draw_actor_hp_menu(actor, x, y,file)
  17.     bar = Cache.system("goods_bar")   
  18.     cw = bar.width  * actor.hp / actor.maxhp
  19.     ch = bar.height
  20.     src_rect = Rect.new(0, 0, cw, ch)
  21.     self.contents.blt(x + 437, y - ch + 17, bar, src_rect)
  22.   end
  23. end
  24. class Scene_Map < Scene_Base
  25.   alias goods_hud_start start
  26.   def start
  27.     goods_hud_start
  28.     @GOODS_HUD = Goods_Window.new
  29.   end
  30.   alias goods_hud_terminate terminate
  31.   def terminate
  32.     goods_hud_terminate
  33.     @GOODS_HUD.dispose
  34.   end
  35.   alias goods_hud_update update
  36.   def update
  37.     goods_hud_update
  38.     @GOODS_HUD.update
  39.   end
  40. end
复制代码
嗯,如上……
  1. alias goods_hud_terminate terminate
  2.   def terminate
  3.     goods_hud_terminate
  4.     @GOODS_HUD.dispose
  5.   end
复制代码
请问……明明有.dispose……但是到了其他Scene还显示0 0
如下:
地图显示正常:

菜单里……还留着……囧……:


于是求解决方法dsu_plus_rewardpost_czw
作者: feizhaodan    时间: 2011-11-1 18:26
在dispose之前把visible=false(←最简单方法)
或者可能是在转换场景后的create_menu_background里的Graphics.snap_to_bitmap的问题
作者: Eienshinken    时间: 2011-11-2 03:32
本帖最后由 Eienshinken 于 2011-11-2 03:33 编辑

alias goods_hud_terminate terminate
  def terminate
    @GOODS_HUD.dispose
    goods_hud_terminate
  
  end
end


作者: 黑之翅膀    时间: 2011-11-2 23:54
本帖最后由 黑之翅膀 于 2011-11-2 23:56 编辑

你都没有把那个HP隐藏,你只是把那个GOODS框隐藏了。(觉得是这样,因为看到P2还是看到一点点GOODS那个框的影子)
作者: 皮卡星    时间: 2011-11-3 00:30
黑之翅膀 发表于 2011-11-2 23:54
你都没有把那个HP隐藏,你只是把那个GOODS框隐藏了。(觉得是这样,因为看到P2还是看到一点点GOODS那个框的 ...

那个……那个蓝色的条是Goods_Bar
另一个是Goods_window……
这两个是分开来的,
不过Goods_Bar到其他的界面里还显示着……
所以说才要解决啊=。=

PS:素材有什么好研究的=-=
作者: Rion幻音    时间: 2011-11-3 09:05
测试了没这问题呀?

见右上角……
还有,脚本理有些不必要的东西我帮你修改了(上次教了你还看不懂吗= =)
  1. class Goods_Window < Window_Base
  2.   def initialize
  3.     super(0,0,544,88)
  4.     self.opacity = 0
  5.     update
  6.   end
  7.   def update
  8.     if $game_switches[Saba::WAGoods::HIDE_SWITCH]
  9.       self.visible = false
  10.     else
  11.       self.visible = true
  12.     end
  13.     actor = $game_party.members[0]
  14.     self.contents.clear
  15.     draw_actor_hp_menu(actor, 0, 0)
  16.   end
  17.   def draw_actor_hp_menu(actor, x, y)
  18.     bar = Cache.system("goods_bar")   
  19.     cw = bar.width  * actor.hp / actor.maxhp
  20.     ch = bar.height
  21.     src_rect = Rect.new(0, 0, cw, ch)
  22.     self.contents.blt(x + 437, y - ch + 17, bar, src_rect)
  23.   end
  24. end
  25. class Scene_Map < Scene_Base
  26.   alias goods_hud_start start
  27.   def start
  28.     goods_hud_start
  29.     @GOODS_HUD = Goods_Window.new
  30.   end
  31.   alias goods_hud_terminate terminate
  32.   def terminate
  33.     goods_hud_terminate
  34.     @GOODS_HUD.dispose
  35.   end
  36.   alias goods_hud_update update
  37.   def update
  38.     goods_hud_update
  39.     @GOODS_HUD.update
  40.   end
  41. end
复制代码

作者: Eienshinken    时间: 2011-11-3 15:57
没有工程 只能开了个默认的放个窗口实验.实在不能在MAP场景里去除的话你就每个场景判断一下 如果那个条不是NIL的话 就释放吧
作者: feizhaodan    时间: 2011-11-3 17:46
本帖最后由 feizhaodan 于 2011-11-3 17:59 编辑

试试在dispose之前加个Cache.clear。

作者: 皮卡星    时间: 2011-11-4 00:00
于是我还是放弃这系统算了
感谢各位
作者: 禾西    时间: 2011-11-4 01:57
重定義了吧=.=




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1