#==============================================================================
# ■ Game_Data
#------------------------------------------------------------------------------
# 全游戏内存数据的类。实例在Scene_Title中调用
#==============================================================================
class Game_Data
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :actors
attr_reader :classes
attr_reader :skills
attr_reader :items
attr_reader :weapons
attr_reader :armors
attr_reader :enemies
attr_reader :troops
attr_reader :states
attr_reader :animations
attr_reader :tilesets
attr_reader :common_events
attr_reader :system
attr_reader :maps
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# 载入数据库
@actors = load_data("Data/Actors.rxdata")
@classes = load_data("Data/Classes.rxdata")
@skills = load_data("Data/Skills.rxdata")
@items = load_data("Data/Items.rxdata")
@weapons = load_data("Data/Weapons.rxdata")
@armors = load_data("Data/Armors.rxdata")
@enemies = load_data("Data/Enemies.rxdata")
@troops = load_data("Data/Troops.rxdata")
@states = load_data("Data/States.rxdata")
@animations = load_data("Data/Animations.rxdata")
@tilesets = load_data("Data/Tilesets.rxdata")
@common_events = load_data("Data/CommonEvents.rxdata")
[url=home.php?mod=space&uid=34015]@system[/url] = load_data("Data/System.rxdata")
@maps = [nil]
index = 1
while FileTest.exist?(sprintf("Data/Map%03d.rxdata", index))
map = load_data(sprintf("Data/Map%03d.rxdata", index))
@maps.push(map)
index += 1
end
end
end
#=========================================
# 使用说明:
#=========================================
#
# 1. 脚本在main前插入
# 2. 找到 Scene_Title 的 main 定义,在“载入数据库”行以下加入
# 语句:data = Game_Data.new
# 3. 把所有 load_data(“xxxx.rxdata”) 改为 data.xxxx,再加上
# 语句 : $data_maps = data.maps
# 4. 找到 Game_Map 的 setup(map_id) 定义,将语句
# @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
# 改为 @map = $data_maps[@map_id]
#==========================================
# * 注意
# 本脚本可能会延长游戏初始化时间
#==========================================