设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1867|回复: 4
打印 上一主题 下一主题

[已经解决] 请问如何使画面窗口显示实时更新

[复制链接]

Lv2.观梦者

梦石
0
星屑
350
在线时间
35 小时
注册时间
2017-8-30
帖子
12
跳转到指定楼层
1
发表于 2018-2-15 17:19:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
这样的话可以显示遇怪的剩余步数,但是只有打开并关闭菜单或者战斗后才能刷新数字。请问怎么能在地图上行走的情况下实时刷新数字
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_Douzhi
  3. #------------------------------------------------------------------------------
  4. #  菜单画面显示剩余遇敌步数的窗口。
  5. #==============================================================================
  6.  
  7. class Window_Yudi <  Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(0, 0, 160, 96)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.   refresh
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 刷新
  18.   #--------------------------------------------------------------------------
  19.   def refresh
  20.     self.contents.clear
  21.     self.contents.font.color = system_color
  22.     self.contents.draw_text(4, 0, 120, 32, "剩余步数:")
  23.     self.contents.font.color = normal_color
  24.     self.contents.draw_text(4, 32, 120, 32, $game_player.encounter_count.to_s, 2)
  25.   end
  26. end

Lv2.观梦者

梦石
0
星屑
350
在线时间
35 小时
注册时间
2017-8-30
帖子
12
2
 楼主| 发表于 2018-2-16 20:13:10 | 只看该作者
已成功自己解决
在scene_map下使用了if做了些修改

点评

嗯...话说是怎么判断的呢?  发表于 2018-2-16 20:58
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
1
星屑
23984
在线时间
3339 小时
注册时间
2011-7-8
帖子
3926

开拓者

3
发表于 2018-2-16 21:15:40 | 只看该作者
频繁绘制文字(draw_text)会导致帧率明显下降,要记得判断文字内容没有发生变化的情况下跳过绘制。
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
350
在线时间
35 小时
注册时间
2017-8-30
帖子
12
4
 楼主| 发表于 2018-2-17 11:05:16 | 只看该作者
先把98号变量等于遇敌剩余步数 $game_variables[98]=$game_player.encounter_count
然后把下面的$game_player.encounter_count.to_s更改为$game_variables[98]to_s #意义不明 貌似直接用会报错
然后把scene map里的刷新窗口的@窗口.update更改为
if $game_variables[98] != @record98 and $game_variables[98] != nil
    @record98 = $game_variables[98]
    @窗口.update
    end
另外可以添加开关开启或者关闭窗口
  1. #==============================================================================
  2. # ■ Window_Yudi
  3. #------------------------------------------------------------------------------
  4. #  菜单画面显示剩余遇敌步数的窗口。
  5. #==============================================================================

  6. class Window_Yudi <  Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(0, 0, 160, 96)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.   update
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 刷新
  17.   #--------------------------------------------------------------------------
  18.   def update
  19.     if $game_switches[505] == true
  20.     $game_variables[98]=$game_player.encounter_count
  21.     self.contents.clear
  22.     self.contents.font.color = system_color
  23.     self.contents.draw_text(4, 0, 120, 32, "遇敌步数:")
  24.     self.contents.font.color = normal_color
  25.     self.contents.draw_text(4, 32, 120, 32, $game_variables[98].to_s, 2)
  26.     self.opacity = 0
  27.     self.z=999999
  28.   else
  29.   self.opacity = 0
  30. end
  31. end
  32. end
复制代码

评分

参与人数 2星屑 +25 +2 收起 理由
RyanBern + 25 + 1 赞自行解决问题
文雅夕露 + 1

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-21 14:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表