Project1

标题: 修改过的BasePackAce(基础包装Ace) [打印本页]

作者: tamashii    时间: 2013-10-12 20:07
标题: 修改过的BasePackAce(基础包装Ace)
本帖最后由 tamashii 于 2013-10-12 20:09 编辑

添加了ISA.require函数,该函数用来判断需要的脚本是否被引用,以及版本是否正确。
  1. #==============================================================================
  2. #  Name [ BasePack Ace ( 基础包装 Ace ) ]
  3. #  Apply To [ RPG Maker XP & RPG Maker VX & RPG Maker VX Ace ]
  4. #------------------------------------------------------------------------------
  5. #  Author [ 忧雪の伤, Modified by Tamashii ]
  6. #  Last Update [ 2012.1.27 ]
  7. #------------------------------------------------------------------------------
  8. #  Link [ 66RPG Ideal Script Association ]
  9. #  => http://rpg.blue/group-215-1.html
  10. #  Link [ OWL Authors' Protection Organization ]
  11. #  => http://oapo.qzworld.net/index.html
  12. #==============================================================================

  13. #==============================================================================
  14. # * Registered Section
  15. #==============================================================================

  16. $imported = {} if $imported.nil?
  17. $imported['BasePack Ace'] = '2012.1.27'

  18. #==============================================================================
  19. # * Running Section
  20. #==============================================================================

  21. ISA = Module.new
  22. ISA::Edition = self ? (RUBY_VERSION == '1.9.2' ? :va : :vx) : :xp

  23. #==============================================================================
  24. # * Require another pack
  25. #==============================================================================

  26. def ISA.require(name, version)
  27.   if $imported[name] != nil
  28.     # get required version numbers
  29.     version_tokens = version.split(/\./)
  30.     year = version_tokens[0].to_i
  31.     month = version_tokens[1].to_i
  32.     day = version_tokens[2].to_i
  33.     # get imported version numbers
  34.     v_i = $imported[name]
  35.     v_i_tokens = v_i.split(/\./)
  36.     year_i = v_i_tokens[0].to_i
  37.     month_i = v_i_tokens[1].to_i
  38.     day_i = v_i_tokens[2].to_i
  39.     # compare
  40.     if year > year_i or month > month_i or day > day_i
  41.       message = "[ISA]\tInvaled version : #{v_i} with required version #{version}"
  42.       method(RUBY_VERSION == '1.9.2' ? :msgbox : :print)[message]
  43.       exit
  44.     end
  45.     return
  46.   end
  47.   message = "[ISA]\tScript not imported : #{name}"
  48.   method(RUBY_VERSION == '1.9.2' ? :msgbox : :print)[message]
  49.   exit
  50. end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1