public void LoadDat(BinaryReader fin) { _mDatLoaded = false; _mDatSignature = 0; _mContentRevision = 0; var lastCategory = 0; var lastId = 0; _mDatSignature = (int)fin.ReadUInt32(); _mContentRevision = (UInt16)(_mDatSignature); for (int category = 0; category < (int)ThingCategory.ThingLastCategory; ++category) { int count = fin.ReadUInt16() + 1; _mThingTypes[category].Clear(); for (int i = 1; i <= count; ++i) { _mThingTypes[category].Add(i, _mNullThingType); } } for (int category = 0; category < (int)ThingCategory.ThingLastCategory; ++category) { lastCategory = category; UInt16 firstId = 1; if (category == (int)ThingCategory.ThingCategoryItem) { firstId = 100; } for (UInt16 id = firstId; id < _mThingTypes[category].Count; ++id) { lastId = id; ThingType typename = new ThingType(); typename.Unserialize(id, (ThingCategory)category, fin); _mThingTypes[category][id] = typename; } } _mDatLoaded = true; // } // catch (Exception e) // { // Debug.LogError(String.Format("Failed to read dat '{0}': {1}'", fin.BaseStream.Position + "/" + fin.BaseStream.Length, last_id)); // } }
public void Init() { _mNullThingType = new ThingType(); _mNullItemType = new ItemType(); _mDatSignature = 0; _mContentRevision = 0; _mOtbMinorVersion = 0; _mOtbMajorVersion = 0; _mDatLoaded = false; _mXmlLoaded = false; _mOtbLoaded = false; for (int i = 0; i < (int)ThingCategory.ThingLastCategory; ++i) { _mThingTypes.Add(i, new Dictionary <int, ThingType> { }); } _mItemTypes.Add(_mNullItemType); }