diff --git a/sqr/User/Asset/AssetManager.nut b/sqr/User/Asset/AssetManager.nut index 768d87e..1bb7ce0 100644 --- a/sqr/User/Asset/AssetManager.nut +++ b/sqr/User/Asset/AssetManager.nut @@ -51,6 +51,15 @@ class _AssetManager_ { DataTable.growtype[i].name <- name; } } + //默认时装 + else if (Key == "[default avatar]") { + DataTable.default_avatar <- []; + while (true) { + local Ret = Data.Get(); + if (Ret == "[/default avatar]") break; + DataTable.default_avatar.append(Ret); + } + } //基础属性 else if (Key == "[HP MAX]]" || Key == "[MP MAX]]" || Key == "[physical attack]]" || Key == "[physical defense]]" || Key == "[magical attack]]" || Key == "[magical defense]]" || Key == "[inventory limit]]" || Key == "[MP regen speed]]" || Key == "[move speed]]" || Key == "[attack speed]]" || Key == "[cast speed]]" || Key == "[hit recovery]]" || Key == "[jump power]]" || Key == "[weight]]" || Key == "[jump speed]]") { local RealKey = Key.slice(1, Key.len() - 1); @@ -115,7 +124,11 @@ class _AssetManager_ { EquipmentList = ScriptData.GetFileData("equipment/equipment.lst", function(DataTable, Data) { while (!Data.Eof()) { local Key = Data.Get(); - DataTable.rawset(Key, Data.Get()); + //注册装备列表 路径写入 数据未读取 + DataTable.rawset(Key, { + Path = Data.Get(), + Data = null + }); } if (_DEBUG_) print("加载装备List完成, 共" + DataTable.len() + "个"); }); @@ -141,7 +154,9 @@ class _AssetManager_ { function GetEquipment(Idx) { //如果没有这件装备则返回 if (!(EquipmentList.rawin(Idx))) return; - local Path = EquipmentList[Idx]; + //如果装备数据已经读取过存在了则直接返回 + if (EquipmentList[Idx].Data) return EquipmentList[Idx].Data; + local Path = EquipmentList[Idx].Path; local m_data = ScriptData.GetFileData("equipment/" + Path, function(DataTable, Data) { DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1); while (!Data.Eof()) { @@ -203,6 +218,7 @@ class _AssetManager_ { } } }); + EquipmentList[Idx].Data = m_data; return m_data; } } \ No newline at end of file