Project1

标题: 自己写的变量窗口不能刷新? [打印本页]

作者: 纳尔德    时间: 2011-6-29 17:29
标题: 自己写的变量窗口不能刷新?

我自己制作了变量脚本,大大们看看哪里出错,
为什么用后而且在Scene_Map里也dispose和update了
为什么+了变量1的值后不改变,需要按一下菜单X键.再按一次X键才刷新了一下.


一下是变量窗口
  1. class Window_rl < Window_Base
  2.   #--------------------------------------------------------------------------
  3.   # ● 初始化窗口
  4.   #--------------------------------------------------------------------------
  5.   def initialize
  6.     super(-5, -8, 200, 90)
  7.     self.contents = Bitmap.new(width - 32, height - 32)
  8.     self.back_opacity = 0
  9.     self.opacity = 0
  10.     refresh
  11.   end
  12.   #--------------------------------------------------------------------------
  13.   # ● 刷新
  14.   #--------------------------------------------------------------------------
  15.   def refresh
  16.     self.contents.clear

  17.     self.contents.font.size = 18
  18.     self.contents.font.color = Color.new(255, 255, 255, 255)
  19.     self.contents.draw_text(2, -29 ,64,72, $game_variables[1].to_s, 1)
  20.     self.contents.draw_text(72,-29 ,64,72, $game_variables[2].to_s, 1)
  21.     self.contents.draw_text(128,-29 ,64,72, $game_variables[3].to_s, 1)

  22.   end
  23. end
复制代码
dsu_plus_rewardpost_czw
作者: Wind2010    时间: 2011-6-29 18:23
刷新数据应该用refresh,但建议不要经常刷新,可以这样:
  1. if @bianliang_1 != $game_variables[1] or @bianliang_2 != $game_variables[2] or @bianliang_3 != $game_variables[3]
  2.   @bianliang_1 = $game_variables[1]
  3.   @bianliang_2 = $game_variables[2]
  4.   @bianliang_3 = $game_variables[3]
  5.   @窗口.refresh
  6. end
复制代码
这样的话就不会频繁刷新了




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