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

Project1

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

[已经解决] 图标和光标错位了

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
跳转到指定楼层
1
发表于 2016-2-9 21:11:53 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_MenuStatus
  3. #------------------------------------------------------------------------------
  4. #  显示菜单画面和同伴状态的窗口。
  5. #==============================================================================
  6.  
  7.  
  8.  
  9.  
  10. class Window_MenuStatus < Window_Selectable
  11.   #--------------------------------------------------------------------------
  12.   # ● 初始化对像
  13.   #--------------------------------------------------------------------------
  14.     def initialize(actor_index = 0, equip_index = 0)#def initialize(index = 0)
  15.     super(0, 64, 1200, 480)
  16.     @item_max = $game_party.actors.size
  17.     self.contents = Bitmap.new(width - 32, height - 32)
  18.     refresh
  19.    # self.active = index
  20.     self.index =  index
  21.    # equip_index =
  22.     @column_max = 4
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.     def refresh
  28.  
  29.     self.contents.clear
  30.  
  31.    # @item_max = $game_party.actors.size
  32.     for i in 0...$game_party.actors.size
  33. #    draw_item(i, normal_color)
  34.     x = ( i + 1 ) * 92 +25
  35.     y = 44
  36.  
  37.  
  38.  
  39.  
  40.     actor = $game_party.actors[i]
  41.     bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue)
  42.     cw = bitmap.width
  43.     ch = bitmap.height
  44.     src_rect = Rect.new(0, 0, cw, ch)
  45.     self.contents.blt(x - ch , y - cw/ 2, bitmap, src_rect)
  46.     draw_actor_xdrs_lx(actor, x-ch, y)#转生次数
  47.  
  48.  
  49.     end
  50.   end
  51. #
  52.  
  53.   #--------------------------------------------------------------------------
  54.   # ● 更新光标举行
  55.   #--------------------------------------------------------------------------
  56.  
  57.  
  58.   #--------------------------------------------------------------------------
  59.   # ● 项目无效化
  60.   #     index : 项目编号
  61.   #--------------------------------------------------------------------------
  62.   def disable_item(index)
  63.     draw_item(index, disabled_color)
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 刷新光标矩形
  67.   #--------------------------------------------------------------------------
  68.  
  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 * 128 - self.oy
  98.     # 更新国标矩形
  99.     self.cursor_rect.set(x, y, cursor_width, 128)#(x, y, cursor_width, 32)
  100.  
  101.     end
  102.  
  103. end

图片.jpg (79.74 KB, 下载次数: 1)

图片.jpg

评分

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

查看全部评分

Lv3.寻梦者

梦石
0
星屑
3846
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
2
发表于 2016-2-9 22:43:45 | 只看该作者
把@column_max改一下

评分

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

查看全部评分

《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
3
 楼主| 发表于 2016-2-10 09:11:00 | 只看该作者
紫英晓狼1130 发表于 2016-2-9 22:43
把@column_max改一下

我想把图片移过来

点评

那就需要改一下34和35行了,lz可以自己挑战一下  发表于 2016-2-10 11:35
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
4
 楼主| 发表于 2016-2-10 12:01:54 | 只看该作者
本帖最后由 金芒芒 于 2016-2-10 16:32 编辑

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_MenuStatus
  3. #------------------------------------------------------------------------------
  4. #  显示菜单画面和同伴状态的窗口。
  5. #==============================================================================
  6.  
  7.  
  8.  
  9.  
  10. class Window_MenuStatus < Window_Selectable
  11.   #--------------------------------------------------------------------------
  12.   # ● 初始化对像
  13.   #--------------------------------------------------------------------------
  14.     def initialize(actor_index = 0, equip_index = 0)#def initialize(index = 0)
  15.     super(0, 64, 440, 480)
  16.     @item_max = $game_party.actors.size
  17.     self.contents = Bitmap.new(width - 32, 300)
  18.     refresh
  19.    # self.active = index
  20.     self.index =  index
  21.    # equip_index =
  22.     @column_max = 4
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.     def refresh
  28.  
  29.     self.contents.clear
  30.  
  31.    # @item_max = $game_party.actors.size
  32.     for i in 0...$game_party.actors.size
  33. #    draw_item(i, normal_color)
  34.   #  x = ( i + 1 ) * 92 +25
  35.   #  y = 44
  36. #    x = ( i + 1 ) % @column_max * (cursor_width + 1) - 4
  37. #   y = ( i + 1 ) / @column_max * 128 - self.oy
  38.    # x = 0 + index % 4 * (90 + 1) - 4
  39.   #  y = index / 90 * 128 - self.oy
  40.    # actor_width = 128
  41.     x =120 + i % 4 * (58 + 32)  # 根据包裹坐标修改过来的
  42.     y = 44 +  i / 4 * 128
  43.     actor = $game_party.actors[i]
  44.     bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue)
  45.     cw = bitmap.width
  46.     ch = bitmap.height
  47.     src_rect = Rect.new(0, 0, cw, ch + 50)
  48.     self.contents.blt(x - ch , y  - cw/ 2, bitmap, src_rect) #src_rect
  49.     draw_actor_xdrs_lx(actor, x-ch, y)#转生次数
  50.  
  51.  
  52.   end
  53.   #   @item_max = $game_party.actors.size
  54.   #  if @item_max > 4
  55.    #   self.contents = Bitmap.new(width - 32, row_max * 32)
  56.    #   for i in 0...@item_max
  57.     #    raw_item(i, normal_color)
  58.     #  end
  59.   #  end
  60. end
  61. #
  62.  
  63.   #--------------------------------------------------------------------------
  64.   # ● 更新光标举行
  65.   #--------------------------------------------------------------------------
  66.  
  67.  
  68.   #--------------------------------------------------------------------------
  69.   # ● 项目无效化
  70.   #     index : 项目编号
  71.   #--------------------------------------------------------------------------
  72.   def disable_item(index)
  73.     draw_item(index, disabled_color)
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● 刷新光标矩形
  77.   #--------------------------------------------------------------------------
  78.  
  79.  
  80.  
  81.  
  82. def update_cursor_rect
  83.     # 光标位置不满 0 的情况下
  84.     if @index <= - 1
  85.       self.cursor_rect.empty
  86.  
  87.       return
  88.     end
  89.     # 获取当前的行
  90.     row = @index / @column_max
  91.     # 当前行被显示开头行前面的情况下
  92.     if row < self.top_row
  93.       # 从当前行向开头行滚动
  94.       self.top_row = row
  95.    end
  96.     # 当前行被显示末尾行之后的情况下
  97.     if row > self.top_row + (self.page_row_max - 1)
  98.       # 从当前行向末尾滚动
  99.       self.top_row = row - (self.page_row_max - 1)
  100.     end
  101.     # 计算光标的宽
  102.     cursor_width = 90
  103.     #cursor_width = 536 / (@column_max + 1) + 1  #光标大小
  104.     # 计算光标坐标
  105.  
  106.     x = 0 + @index % @column_max * (cursor_width + 1) - 4 #光标位置调节 覆盖31行
  107.     y = @index / @column_max * 128 - self.oy
  108.     # 更新国标矩形
  109.     self.cursor_rect.set(x, y, cursor_width, 128)#(x, y, cursor_width, 32)
  110.  
  111.     end
  112.  
  113. end
金芒芒 发表于 2016-2-10 09:11
我想把图片移过来


3Q,自己研究

QQ截图20160210163026.jpg (59.03 KB, 下载次数: 2)

QQ截图20160210163026.jpg
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 17:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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