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

Project1

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

[已经解决] 还是行间距引发的问题。。

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
49
在线时间
76 小时
注册时间
2006-7-7
帖子
194
跳转到指定楼层
1
发表于 2009-7-12 10:04:10 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 海的那边 于 2009-7-12 11:37 编辑
  1. #--------------------------------------------------------------------------
  2. # ● 更新光标矩形
  3. #--------------------------------------------------------------------------
  4. def update_cursor_rect
  5. # 光标位置不满 0 的情况下
  6. if @index < 0
  7. self.cursor_rect.empty
  8. return
  9. end
  10. # 获取当前的行
  11. row = @index / @column_max
  12. # 当前行被显示开头行前面的情况下
  13. if row < self.top_row
  14. # 从当前行向开头行滚动
  15. self.top_row = row
  16. end
  17. # 当前行被显示末尾行之后的情况下
  18. if row > self.top_row + (self.page_row_max - 1)
  19. # 从当前行向末尾滚动
  20. self.top_row = row - (self.page_row_max - 1)
  21. end
  22. # 计算光标的宽度
  23. cursor_width = self.width / @column_max - 32
  24. # 计算光标坐标
  25. x = @index % @column_max * (cursor_width + 32)
  26. y = @index / @column_max * 24 - self.oy
  27. # 更新光标矩形
  28. self.cursor_rect.set(x, y, cursor_width, 24)
  29. end
  30. #--------------------------------------------------------------------------
  31. # ● 描绘项目
  32. # index : 项目编号
  33. #--------------------------------------------------------------------------
  34. def draw_item(index)
  35. item = @data[index]
  36. case item
  37. when RPG::Item
  38. number = $game_party.item_number(item.id)
  39. when RPG::Weapon
  40. number = $game_party.weapon_number(item.id)
  41. when RPG::Armor
  42. number = $game_party.armor_number(item.id)
  43. end
  44. if item.is_a?(RPG::Item) and
  45. $game_party.item_can_use?(item.id)
  46. self.contents.font.color = normal_color
  47. else
  48. self.contents.font.color = disabled_color
  49. end
  50. x = 4 + index % 2 * (288 + 32)
  51. y = index / 2 * 24
  52. rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  53. self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  54. bitmap = RPG::Cache.icon(item.icon_name)
  55. opacity = self.contents.font.color == normal_color ? 255 : 128
  56. self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  57. self.contents.draw_text(x + 28, y, 212, 22, item.name, 0)
  58. self.contents.draw_text(x + 240, y, 16, 22, ":", 1)
  59. self.contents.draw_text(x + 256, y, 24, 22, number.to_s, 2)
  60. end
  61. end
复制代码
我修改了:
y = @index / @column_max * 24 - self.oy
    # 更新光标矩形
self.cursor_rect.set(x, y, cursor_width, 24)
y = index / 2 * 24
但是把光标移到所有的物品最底下再向上移的时候就出现了怪异的事:
会缩到上面看不见的。



不知道是哪里还没有改,请前辈帮帮忙,谢谢。
工程: hangjian.rar (186.98 KB, 下载次数: 34)
头像被屏蔽

Lv1.梦旅人 (禁止发言)

Grox

梦石
0
星屑
50
在线时间
0 小时
注册时间
2009-5-18
帖子
213
2
发表于 2009-7-12 10:28:30 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
76 小时
注册时间
2006-7-7
帖子
194
3
 楼主| 发表于 2009-7-12 11:27:42 | 只看该作者
本帖最后由 海的那边 于 2009-7-12 11:36 编辑

它吧是会缩上去吗,那缩上去了还怎么看得见选什么物品?
也就是说那光标会移出框外。
下载工程来看看就明白了。
哪位前辈来帮帮忙啊?~

---------------------------------------------------
啊,我弄明白了,是我脑残了。
只要在Window_Selectable里设置下就行。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

B

梦石
0
星屑
50
在线时间
26 小时
注册时间
2007-8-26
帖子
3693
4
发表于 2009-7-12 11:46:28 | 只看该作者
将 @column_max 赋值为 2 即可
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-10-19
帖子
271
5
发表于 2009-7-14 12:33:14 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 15:30

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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