赞 | 0 |
VIP | 52 |
好人卡 | 56 |
积分 | 1 |
经验 | 13692 |
最后登录 | 2018-12-4 |
在线时间 | 673 小时 |
Lv1.梦旅人 勥
- 梦石
- 0
- 星屑
- 72
- 在线时间
- 673 小时
- 注册时间
- 2006-10-3
- 帖子
- 1795
![开拓者](static/image/common/p1/thx.png)
|
首先声明我不熟悉RUBY以及RGSS,完全现看现卖。
我认为这里可以理解为将@item_window.help_window指向先前建立的@help_window这个对象,从而可以通过调用@item_window.help_window来调用先前建立的@help_window对象。
我感觉并不仅仅是将help_window的属性附了过去,而是直接指向,这里包括属性、方法等等都过关联去了。(说白了就是让@item_window.help_window指向了@help_window的对象地址)
help_window这个有事先定义的:
1.通过这句"@item_window = Window_Item.new",我们找"Window_Item"这个脚本。
2.在"Window_Item"中,并没有发现"help_window"关键字。接下来通过第七行的"class Window_Item < Window_Selectable"去找"Window_Selectable"脚本
3.在"Window_Selectable"脚本中,我们看到12行"attr_reader :help_window",还有下面有def定义"def help_window=(help_window)"。
这样的话,我做了一个实验,在"Window_Selectable"中加入:
attr_reader :hell
def hell=(hell)
p "已经关联"
end
发现在"Scene_Item"中,你那红色句的下一行加入"@item_window.hell = @help_window"就可以成功输出"已经关联"了。
不知道这是否解答了你"谁能说说怎么样关联窗口?"的问题。 |
|