赞 | 3 |
VIP | 0 |
好人卡 | 39 |
积分 | 1 |
经验 | 101436 |
最后登录 | 2017-9-1 |
在线时间 | 2276 小时 |
Lv1.梦旅人 路人党员
- 梦石
- 0
- 星屑
- 52
- 在线时间
- 2276 小时
- 注册时间
- 2010-12-30
- 帖子
- 3225
|
本帖最后由 英顺的马甲 于 2011-2-6 22:30 编辑
做脚本同学,别说我没有教你,
我解剖一个Window给你看- class Window_Menu < Window_Selectable
- def initialize
- super(0,0,160,224)
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = "状态"
- s5 = "存档"
- s6 = "结束游戏"
- @commands = [s1,s2,s3,s4,s5,s6]
- @item_max = 6
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- for i in [email protected]
- self.contents.draw_text(4, i * 32, 152, 32, @commands[i])
- end
- end
- def disable_item(i)
- self.contents.font.color = disabled_color
- self.contents.draw_text(4, i * 32, 152, 32, @commands[i])
- self.contents.font.color = normal_color
- end
- end
复制代码 class Window_Menu (Window名称,前面一定要放class) < Window_Selectable (继承Window_Selectable)
def initialize 初始化
这句super难以解释,不过是这样用的:super(x,y,宽,高)
s1-s6 只是变量
@commands 是一个Array,用作选择内容
@item_max 选项数量
self.contents = Bitmap.new(width - 32, @item_max * 32) 难以解释
for i in XXX 在XXX的内容进行循环一次,可用作:第一次会拿到1
第三次会拿到5,以此类推
self.contents.draw_text(4, i * 32, 152, 32, @commands[i]) 将选项绘制出来连同for 的 i
def 代表这个窗口的一个功能
到此结束,本人表达能力不是很好,请多多包涵 |
|