44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using LibXom.Data;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LibW4M.Data.WeaponFactory
|
|
{
|
|
public class WeaponsCollective : SaveDataCollective
|
|
{
|
|
|
|
public WeaponsCollective(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer)
|
|
{
|
|
}
|
|
|
|
public override void Load()
|
|
{
|
|
int[] collective = mainContainer.Decompress();
|
|
for (int i = 0; i < collective[0]; i++)
|
|
{
|
|
WeaponStore store = new WeaponStore(this.fileBelongs, this.fileBelongs.LookupContainerById(collective[i + 1]));
|
|
base.collectiveEntries.Add(store);
|
|
}
|
|
}
|
|
|
|
public override void Save()
|
|
{
|
|
int len = this.Length;
|
|
int[] collective = new int[len+1];
|
|
collective[0] = len;
|
|
for (int i = 0; i < len; i++)
|
|
{
|
|
WeaponStore store = collectiveEntries[i] as WeaponStore;
|
|
if (store is null) continue;
|
|
|
|
store.Save();
|
|
collective[i + 1] = store.mainContainer.Id;
|
|
}
|
|
mainContainer.CompressAndUpdate(collective);
|
|
}
|
|
}
|
|
}
|