| 赞 | 349 |
| VIP | |
| 好人卡 | |
| 积分 | 301 |
| 经验 | |
| 最后登录 | 2026-11-7 |
| 在线时间 | 2428 小时 |
遠航の猫咪
- 梦石
- 3
- 星屑
- 27057
- 在线时间
- 2428 小时
- 注册时间
- 2005-10-15
- 回帖
- 989

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
不想连写20条重复的内容,想把1简化成2,结果死活通不过……
是xp ruby版本太低了还是我写错了……
- #==============================================================================[/font]
- [font="]# ■ Vocab[/font]
- [font="]#------------------------------------------------------------------------------[/font]
- [font="]# 所有用语的整合模块。[/font]
- [font="]#==============================================================================[/font]
- [font="]module Vocab[/font]
- [font="]#--------------------------------------------------------------------------[/font]
- [font="]# ● 导入已经在数据库里定义的术语[/font]
- [font="]#--------------------------------------------------------------------------[/font]
- [font="]def self.gold; $data_system.words.gold; end[/font]
- def self.hp; $data_system.words.hp; end
- def self.sp; $data_system.words.sp; end
- ....
- [font="]end
复制代码
- #==============================================================================
- # ■ 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
复制代码
|
|