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

Project1

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

[已经解决] 经验条刷新问题

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3526
在线时间
1887 小时
注册时间
2010-6-19
帖子
1210
跳转到指定楼层
1
发表于 2014-8-2 08:40:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我在脚本里加入经验调脚本,可是切换人物的时候,经验条不刷新是怎么回事?  加入脚本为54-86行
  1. #==============================================================================
  2. # ■ JD_DL
  3. #------------------------------------------------------------------------------
  4. #  显示加点状态窗口。
  5. #==============================================================================
  6. class JD_DL < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     #=================显示图片===========
  13.     @back = Sprite.new
  14.     @back.bitmap = RPG::Cache.picture("图片显示/人物属性(新)")
  15.     #=================释放图片===========
  16.   def dispose
  17.     @back.dispose
  18.    super
  19.   end
  20.     #====================================
  21.     super(320, 0, 330, 360)
  22.     self.contents = Bitmap.new(width - 32, height - 32)
  23.     self.contents.font.size = 16
  24.     @actor = actor
  25.     # ** 文字高
  26.     # ** 可以放在refresh里 实时控制
  27.     @sh = 32
  28.     self.opacity = 0
  29.     refresh
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 刷新
  33.   #--------------------------------------------------------------------------
  34.   def refresh
  35.     self.contents.clear
  36.     draw_actor_face_lvup(@actor, x, y)                 
  37.     draw_actor_name_lvup(@actor, 113+10, 25)           
  38.     draw_actor_class_lvup(@actor, 113+10, 53)         
  39.     draw_actor_level_lvup(@actor, 113+10, 81)         
  40.     draw_actor_hp_lvup(@actor,15+10, 144)              
  41.     draw_actor_sp_lvup(@actor, 15+10, 144+28)         
  42.     draw_actor_lvup(@actor, 40-155+10, 144+28*2, 0)   
  43.     draw_actor_lvup(@actor, 40-155+10, 144+28*3, 2)   
  44.     draw_actor_parameter(@actor, -40, 297, 1)   
  45.     draw_actor_exp_lvup(@actor, 15, 254)         
  46.     draw_actor_lvup(@actor,-168-15, 101+8, 4)   
  47.     # ** 潜力描绘
  48.     self.contents.font.color = system_color
  49.     str = ""#潜力"
  50.     cx = sw(str)
  51.     self.contents.font.color = normal_color
  52.     self.contents.draw_text(44, 325, 300, 32, @actor.exp_s + "/" + @actor.next_exp_s)

  53.     #===============经验条显示==============================================
  54.     @exp_b = nil
  55.     @exp_c = nil   
  56.     @exp_b = Sprite.new
  57.     @exp_c = Sprite.new  
  58.     #=================图片显示============
  59.     @exp_b.bitmap = Bitmap.new(168,10)     #(经验条1宽度,第高度)
  60.     @exp_c.bitmap = Bitmap.new(168,5)     #(经验条2宽度,第高度)
  61.     #=================经验条颜色============
  62.     color2 = Color.new(111,172,115,255)  #经验条1颜色
  63.     color3 = Color.new(49,159,51,255)    #经验条2颜色
  64.     #=================经验值增幅度===============
  65.     @exp_d = 168*@actor.exp/@actor.next_exp_s.to_i
  66.     #=================经验条增幅条1==============
  67.     @exp_b.x = 61+310
  68.     @exp_b.y = 250+50-1
  69.     @exp_b.z = 10001
  70.     @exp_b.bitmap.fill_rect(0,0,@exp_d,32,color2)
  71.     #=================经验条增幅条2==============
  72.     @exp_c.x = 61+310
  73.     @exp_c.y = 253+50-1  
  74.     @exp_c.z = 10001
  75.     @exp_c.bitmap.fill_rect(0,0,@exp_d,32,color3)
  76.     end
  77.     #===================释放经验条====================
  78.     def dispose
  79.     super   
  80.     @exp_b.bitmap.dispose  
  81.     @exp_c.bitmap.dispose  
  82.     @exp_b.dispose   
  83.     @exp_c.dispose
  84.     @exp_b = nil
  85.     @exp_c = nil  
  86.     #=====================================================================   
  87.    
  88.     end  


  89.   #=======================================================================
  90.   #  **  属性描绘
  91.   #=======================================================================
  92.   
  93.   
  94.   # ** 返回字符串的宽度
  95.   def sw(s)
  96.     return self.contents.text_size(s).width
  97.   end
  98.   
  99.   
  100.   # ** HP AND SP 描绘
  101.   def draw_v(x, y, type)
  102.     case type
  103.     when 0
  104.       word = $data_system.words.hp
  105.       dl = @actor.hp
  106.       max = @actor.maxhp
  107.       temp = $temp_hp
  108.     when 1
  109.       word = $data_system.words.sp
  110.       dl = @actor.sp
  111.       max = @actor.maxsp
  112.       temp = $temp_sp
  113.     else
  114.       return
  115.     end
  116.     self.contents.font.color = system_color
  117.     # ** 用语
  118.     str = word
  119.     self.contents.draw_text(x, y, sw(str), @sh, str)
  120.     self.contents.font.color = normal_color
  121.   # ** 基本值
  122.     cx = sw(str)
  123.     str = dl.to_s + "/"
  124.     self.contents.draw_text(x + cx + 10, y, sw(str), @sh, str)
  125.     cx += sw(str)
  126.     # ** 调整颜色
  127.     if temp > 0
  128.       self.contents.font.color = text_color(6)
  129.     else
  130.       self.contents.font.color = normal_color
  131.     end
  132.     # ** 基本值 max
  133.     str = (max + temp).to_s
  134.     self.contents.draw_text(x + cx + 10, y, sw(str), @sh, str)
  135.     cx += sw(str)
  136.     # ** 附加值
  137.     if temp > 0
  138.       self.contents.font.color.set(255, 100, 100)
  139.       str = "(+" + temp.to_s + ")"
  140.       self.contents.draw_text(x + cx + 10, y, sw(str), @sh, str)
  141.     end
  142.   end
  143.   
  144.   # ** 属性 描绘
  145.   def draw_dl(x, y, type)
  146.     # ** 准备描绘
  147.     case type
  148.     when 0
  149.       word = $data_system.words.str
  150.       dl = @actor.str
  151.       plus = $temp_str
  152.     else
  153.       return
  154.     end
  155.    # ** 开始描绘
  156.     self.contents.font.color = system_color
  157.     # ** 用语
  158.     str = word
  159.     self.contents.draw_text(x, y, sw(str), @sh, str)
  160.     # ** 设置新值颜色
  161.     if plus > 0
  162.       self.contents.font.color = text_color(6)
  163.     else
  164.       self.contents.font.color = normal_color
  165.     end
  166.     # ** 基本值
  167.     cx = sw(str)
  168.     str = (dl + plus).to_s
  169.     self.contents.draw_text(x + cx + 10, y, sw(str), @sh, str)
  170.     cx += sw(str)
  171.     # ** 附加值
  172.     if plus > 0
  173.       self.contents.font.color.set(255, 100, 100)
  174.       str = "(+" + plus.to_s + ")"
  175.       self.contents.draw_text(x + cx + 10, y, sw(str), @sh, str)
  176.     end
  177.   end
  178. end
复制代码

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
2
发表于 2014-8-2 08:49:37 | 只看该作者
可能是因为没有refresh,dispose放在initialize里是失误么??

点评

要怎么改呢。。  发表于 2014-8-2 09:17

评分

参与人数 1星屑 +100 收起 理由
RyanBern + 100 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3526
在线时间
1887 小时
注册时间
2010-6-19
帖子
1210
3
 楼主| 发表于 2014-8-2 09:18:49 | 只看该作者
恐惧剑刃 发表于 2014-8-2 08:49
可能是因为没有refresh,dispose放在initialize里是失误么??

可以了。谢谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 22:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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