查看: 1817|回复: 0

[已经过期] 选择任何一个角色光标老是返回到一个角色求解

[复制链接]
梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2016-1-25 17:28:42 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 金芒芒 于 2016-1-25 17:29 编辑

QQ截图20160125115004.png [attach]
300272[/attach]
  1. #==============================================================================
  2. # ■ Window_MenuStatus
  3. #------------------------------------------------------------------------------
  4. #  显示菜单画面和同伴状态的窗口。
  5. #==============================================================================




  6. class Window_MenuStatus < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize(index = 0)
  11.     super(0, 64, 1200, 480)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     refresh
  14.     self.index = index

  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 刷新
  18.   #--------------------------------------------------------------------------
  19.     def refresh
  20.    
  21.     self.contents.clear
  22.    # @item_max = 4 #$game_party.actors.size
  23.   #  @item_may = 4
  24.   #  @column_max = 4
  25.   #  for i in 0...4   #$game_party.actors.size
  26.      
  27.    #   x = i * 116
  28.     #  y = 0
  29.       
  30.     @item_max = $game_party.actors.size
  31.     for i in 0...$game_party.actors.size
  32.     x = ( i + 1 ) * 92 +25
  33.     y = 44

  34.     @column_max = 4
  35.      

  36.     actor = $game_party.actors[i]
  37.     bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue)
  38.     cw = bitmap.width
  39.     ch = bitmap.height
  40.     src_rect = Rect.new(0, 0, cw, ch)
  41.     self.contents.blt(x - ch , y - cw/ 2, bitmap, src_rect)
  42.       #draw_actor_graphic(actor, x - 40, y + 80)
  43.      # draw_actor_name(actor, x, y)
  44. #      draw_actor_class(actor, x + 144, y)
  45. #      draw_actor_level(actor, x, y + 32)
  46. #     draw_actor_state(actor, x + 90, y + 32)
  47. #      draw_actor_exp(actor, x, y + 64)
  48. #      draw_actor_hp(actor, x + 236, y + 32)
  49. #      draw_actor_sp(actor, x + 236, y + 64)

  50.     draw_item(i)
  51.     end
  52.   end
  53.   
  54.     #--------------------------------------------------------------------------
  55.   # ● 更新光标举行
  56.   #--------------------------------------------------------------------------
  57.   def draw_item(index, color = normal_color)
  58.     self.contents.font.color = color
  59.     x = 104 + index * 80 + 40
  60. #    self.contents.draw_text(x-11, 0, 44, 32, @menustatus[index])
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 项目无效化
  64.   #     index : 项目编号
  65.   #--------------------------------------------------------------------------
  66.   def disable_item(index)
  67.     draw_item(index, disabled_color)
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 刷新光标矩形
  71.   #--------------------------------------------------------------------------
  72. def update_cursor_rect
  73.     # 光标位置不满 0 的情况下
  74.     if @index <= -1
  75.       self.cursor_rect.empty
  76.       
  77.       return
  78.     end
  79.     # 获取当前的行
  80.     row = @index / @column_max
  81.     # 当前行被显示开头行前面的情况下
  82.     if row < self.top_row
  83.       # 从当前行向开头行滚动
  84.       self.top_row = row
  85.     end
  86.     # 当前行被显示末尾行之后的情况下
  87.     if row > self.top_row + (self.page_row_max - 1)
  88.       # 从当前行向末尾滚动
  89.       self.top_row = row - (self.page_row_max - 1)
  90.     end
  91.     # 计算光标的宽
  92.     cursor_width = 90
  93.     #cursor_width = 536 / (@column_max + 1) + 1  #光标大小
  94.     # 计算光标坐标
  95.    
  96.     x = 0 + @index % @column_max * (cursor_width + 1) - 4 #光标位置调节 覆盖31行
  97.     y = @index / @column_max * 32 - self.oy
  98.     # 更新国标矩形
  99.     self.cursor_rect.set(x, y, cursor_width, 128)#(x, y, cursor_width, 32)
  100.   
  101.     end

  102.   end

  103.   
复制代码



选择第2角色光标使用后就跳到第一个角色去了

2016新制作.zip

925.8 KB, 下载次数: 43

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部