| 赞 | 349 |
| VIP | |
| 好人卡 | |
| 积分 | 299 |
| 经验 | |
| 最后登录 | 2026-10-1 |
| 在线时间 | 2423 小时 |
遠航の猫咪
- 梦石
- 3
- 星屑
- 26947
- 在线时间
- 2423 小时
- 注册时间
- 2005-10-15
- 回帖
- 987

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
不想连写20条重复的内容,想把1简化成2,结果死活通不过……
是xp ruby版本太低了还是我写错了……
[pre lang="ruby"]#==============================================================================
# ■ Vocab
#------------------------------------------------------------------------------
# 所有用语的整合模块。
#==============================================================================
module Vocab
#--------------------------------------------------------------------------
# ● 导入已经在数据库里定义的术语
#--------------------------------------------------------------------------
def self.gold; $data_system.words.gold; end
def self.hp; $data_system.words.hp; end
def self.sp; $data_system.words.sp; end
....
end[/pre]
[pre lang="ruby"]#==============================================================================
# ■ Vocab
#------------------------------------------------------------------------------
# 所有用语的整合模块。
#==============================================================================
module Vocab
#--------------------------------------------------------------------------
# ● 导入已经在数据库里定义的术语
#--------------------------------------------------------------------------
def self.words(sym); $data_system.words.send(sym); end
[:gold, :hp, :sp, :str, :dex, :agi, :int, :atk, :pdef, :mdef,
:weapon, :armor1, :armor2, :armor3, :armor4,
:attack, :skill, :defend, :item, :equip].each do |sym|
self.send :define_method, sym {words(sym)}
end
end[/pre]
|
|