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

Project1

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

[已经过期] 关于地图右侧状态栏无法及时刷新的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
11 小时
注册时间
2012-3-31
帖子
12
跳转到指定楼层
1
发表于 2012-8-28 16:40:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 贝多芬背多分 于 2012-8-28 20:55 编辑

我有个小游戏,mp = hp/10 ,数值在状态栏(地图右侧)显示。但是当hp减少(400→300)时,状态栏显示的mp并没有减少,改变楼层mp减少
如果我想启动
Window_PlayerInfo(负责状态栏刷新的脚本)
那么应该怎么启动这个脚本,或者刷新地图?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
11 小时
注册时间
2012-3-31
帖子
12
2
 楼主| 发表于 2012-8-28 16:45:05 | 只看该作者
  1. #==============================================================================
  2. # ■ Window_PlayerInfo
  3. #------------------------------------------------------------------------------
  4. #  地图侧面为方便查看而设立的状态窗口。
  5. #==============================================================================

  6. class Window_PlayerInfo < Window_Base
  7.   WLH = 14
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对象
  10.   #--------------------------------------------------------------------------
  11.   def initialize(x,y)
  12.     super(x, y, 192, 480)
  13.     self.opacity = 0
  14.     self.z = 200
  15.     self.contents.font.size = 14
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # ● 配置
  19.   #     actor : 角色
  20.   #--------------------------------------------------------------------------
  21.   def setup(actor)
  22.     @actor = actor
  23.     @hp = @actor.hp
  24.     @pow = @actor.mp
  25.     @atk = @actor.atk
  26.     @def = @actor.def
  27.     @spi = @actor.spi
  28.     @agi = @actor.agi
  29.     @lvl = @actor.level
  30.     @score = $game_scoretable.get_score
  31.     @k1 = $game_party.item_number($data_items[12])
  32.     @k2 = $game_party.item_number($data_items[13])
  33.     @k3 = $game_party.item_number($data_items[14])
  34.     @k4 = $game_party.item_number($data_items[15])
  35.     @k5 = $game_party.item_number($data_items[5])
  36.     @floor = $game_variables[2]
  37.     #@place = $game_variables[3]
  38.     @k6 = $game_variables[47]
  39.     @gold = $game_party.gold
  40.     @exp = @actor.exp
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 刷新
  44.   #--------------------------------------------------------------------------
  45.   def refresh
  46.     self.contents.clear
  47.     hs=$game_scoretable.get_hi_score($game_system.difficulty,$game_system.player)
  48.     s=$game_scoretable.get_score
  49.     hs=s if s > hs
  50.     draw_parameter(0,16,"HiScore",hs.to_s)
  51.     draw_parameter(0,16 + WLH,"Score",s.to_s)
  52.     draw_actor_name(@actor, 96, 56)
  53.     draw_actor_class(@actor, 96, WLH + 56)
  54.     draw_actor_face(@actor, 0, 64, 64)
  55.     draw_basic_info(0, 96)
  56.     draw_parameters(0, 96 + WLH*5)
  57.     draw_data(0, 96 + WLH*10)
  58.     @hp = @actor.hp
  59.     @pow = @actor.mp
  60.     @atk = @actor.atk
  61.     @def = @actor.def
  62.     @spi = @actor.spi
  63.     @agi = @actor.agi
  64.     @lvl = @actor.level
  65.     @score = $game_scoretable.get_score
  66.     @k1 = $game_party.item_number($data_items[12])
  67.     @k2 = $game_party.item_number($data_items[13])
  68.     @k3 = $game_party.item_number($data_items[14])
  69.     @k4 = $game_party.item_number($data_items[15])
  70.     @k5 = $game_party.item_number($data_items[5])
  71.     @k6 = $game_variables[47]
  72.     @floor = $game_variables[2]
  73.     #@place = $game_variables[3]
  74.     @gold = $game_party.gold
  75.     @exp = @actor.exp
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 描绘数值
  79.   #     x : 描绘目标 X 坐标
  80.   #     y : 描绘目标 Y 坐标
  81.   #--------------------------------------------------------------------------
  82.   def draw_parameter(x,y,name,value)
  83.     self.contents.font.color = system_color
  84.     self.contents.draw_text(x, y, 60, WLH, name)
  85.     self.contents.font.color = normal_color
  86.     self.contents.draw_text(x + 60, y, 96, WLH, value, 2)
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 描绘基本信息
  90.   #     x : 描绘目标 X 坐标
  91.   #     y : 描绘目标 Y 坐标
  92.   #--------------------------------------------------------------------------
  93.   def draw_basic_info(x, y)
  94.     draw_actor_level(@actor, 96-x, y + WLH * 0)
  95.     draw_actor_state(@actor, x, y + WLH * 1)
  96.     draw_actor_hp(@actor, x, y + WLH * 2, 160)
  97.     draw_actor_mp(@actor, x, y + WLH * 3, 160)
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 描绘能力值
  101.   #     x : 描绘目标 X 坐标
  102.   #     y : 描绘目标 Y 坐标
  103.   #--------------------------------------------------------------------------
  104.   def draw_parameters(x, y)
  105.     draw_actor_parameter(@actor, x, y + WLH * 0, 0)
  106.     draw_actor_parameter(@actor, x, y + WLH * 1, 1)
  107.     draw_actor_parameter(@actor, x, y + WLH * 2, 2)
  108.     draw_actor_parameter(@actor, x, y + WLH * 3, 3)
  109.     self.contents.font.color = text_color(24)
  110.     self.contents.draw_text(96, y + WLH * 0+6, 32, 14, "+"[email protected]_s, 0)
  111.     self.contents.font.color = normal_color
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 描绘系统数据
  115.   #     x : 描绘目标 X 坐标
  116.   #     y : 描绘目标 Y 坐标
  117.   #--------------------------------------------------------------------------
  118.   def draw_data(x, y)
  119.     draw_parameter(x, y + WLH * 0, "黄钥匙", $game_party.item_number($data_items[12]).to_s)
  120.     draw_parameter(x, y + WLH * 1, "蓝钥匙", $game_party.item_number($data_items[13]).to_s)
  121.     draw_parameter(x, y + WLH * 2, "红钥匙", $game_party.item_number($data_items[14]).to_s)
  122.     draw_parameter(x, y + WLH * 3, "绿钥匙", $game_party.item_number($data_items[15]).to_s)
  123.     draw_parameter(x, y + WLH * 4, "炸弹", $game_party.item_number($data_items[5]).to_s)
  124.     draw_parameter(x, y + WLH * 5, "金钱", $game_party.gold.to_s)
  125.     draw_parameter(x, y + WLH * 6, "经验", @actor.exp.to_s)
  126.     #draw_parameter(x, y + WLH * 7, "层数", $game_variables[2].to_s + "层")
  127.     #draw_parameter(x, y + WLH * 8, "地区", $game_variables[3].to_s)
  128.     if !AMTT::GAME_COMPATIBLE_MODE && AMTT::GAME_USE_POSITION_STRING
  129.       /(\d*):([\+-]?\d*)=(.*)/ =~ $data_mapname[$game_map.map_id].name
  130.       draw_parameter(x, y + WLH * 7, "位置", $3.to_s)
  131.     else
  132.       draw_parameter(x, y + WLH * 7, "层数", $game_variables[3].to_s + "塔" + $game_variables[2].to_s + "层")
  133.     end
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 描绘经验值信息
  137.   #     x : 描绘目标 X 坐标
  138.   #     y : 描绘目标 Y 坐标
  139.   #--------------------------------------------------------------------------
  140.   def draw_exp_info(x, y)
  141.     s1 = @actor.exp_s
  142.     s2 = @actor.next_rest_exp_s
  143.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  144.     self.contents.font.color = system_color
  145.     self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
  146.     self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
  147.     self.contents.font.color = normal_color
  148.     self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 0)
  149.     self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 0)
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 描绘装备品
  153.   #     x : 描绘目标 X 坐标
  154.   #     y : 描绘目标 Y 坐标
  155.   #--------------------------------------------------------------------------
  156.   def draw_equipments(x, y)
  157.     self.contents.font.color = system_color
  158.     self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
  159.     for i in 0..4
  160.       draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
  161.     end
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 更新画面
  165.   #--------------------------------------------------------------------------
  166.   def update
  167.     if self.visible
  168.       # 更新画面效果
  169.       self.contents_opacity = [self.contents_opacity + 4.25, 255.0].min
  170.       self.x += (448.0 - self.x) / 60.0
  171.       # 更新内容
  172.       refresh if need_refresh?
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 判断是否需要重绘
  177.   #--------------------------------------------------------------------------
  178.   def need_refresh?
  179.     return true if @hp != @actor.hp
  180.     return true if @pow != @actor.mp
  181.     return true if @atk != @actor.atk
  182.     return true if @def != @actor.def
  183.     return true if @spi != @actor.spi
  184.     return true if @agi != @actor.agi
  185.     return true if @lvl != @actor.level
  186.     return true if @score != $game_scoretable.get_score
  187.     return true if @k1 != $game_party.item_number($data_items[12])
  188.     return true if @k2 != $game_party.item_number($data_items[13])
  189.     return true if @k3 != $game_party.item_number($data_items[14])
  190.     return true if @k4 != $game_party.item_number($data_items[15])
  191.     return true if @k5 != $game_party.item_number($data_items[5])
  192.     return true if @k6 != $game_variables[47]
  193.     return true if @floor != $game_variables[2]
  194.     #return true if @place != $game_variables[3]
  195.     return true if @gold != $game_party.gold
  196.     return true if @exp != @actor.exp
  197.     return false
  198.   end
  199. end
复制代码

点评

看不懂+无悬赏=没人  发表于 2012-8-28 17:34
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
11 小时
注册时间
2012-3-31
帖子
12
3
 楼主| 发表于 2012-8-28 20:57:09 | 只看该作者
贝多芬背多分 发表于 2012-8-28 16:45



回复@delv25

......
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 16:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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