66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using LibW4M.Data.WeaponFactory;
|
|
using LibXom.Data;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LibW4M.Data
|
|
{
|
|
public abstract class SaveDataCollective : SaveDataEntry, IEnumerable<SaveDataEntry>
|
|
{
|
|
internal List<SaveDataEntry> collectiveEntries = new List<SaveDataEntry>();
|
|
|
|
public SaveDataEntry this[int i]
|
|
{
|
|
get
|
|
{
|
|
return collectiveEntries[i];
|
|
}
|
|
set
|
|
{
|
|
collectiveEntries[i] = value;
|
|
}
|
|
}
|
|
public int Length
|
|
{
|
|
get
|
|
{
|
|
return collectiveEntries.Count;
|
|
}
|
|
}
|
|
public SaveDataCollective(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer)
|
|
{
|
|
}
|
|
|
|
public virtual void Delete(SaveDataEntry entry)
|
|
{
|
|
for (int i = 0; i < this.Length; i++)
|
|
{
|
|
SaveDataEntry saveDataEntry = this[i];
|
|
if (saveDataEntry.Equals(entry))
|
|
{
|
|
saveDataEntry.DeleteEntries();
|
|
collectiveEntries.RemoveAt(i);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
public abstract void Create();
|
|
public abstract override void Load();
|
|
public abstract override void Save();
|
|
|
|
public IEnumerator<SaveDataEntry> GetEnumerator()
|
|
{
|
|
return collectiveEntries.GetEnumerator();
|
|
}
|
|
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return collectiveEntries.GetEnumerator();
|
|
}
|
|
}
|
|
}
|