-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first pass * working * cleanup * add some logging around this
- Loading branch information
Showing
8 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using OpenLocoTool.DatFileParsing; | ||
using OpenLocoTool.Headers; | ||
|
||
namespace OpenLocoTool | ||
{ | ||
public static class SObjectManager | ||
{ | ||
static readonly Dictionary<ObjectType, List<ILocoObject>> Objects = new(); | ||
|
||
static SObjectManager() | ||
{ | ||
foreach (var v in Enum.GetValues(typeof(ObjectType))) | ||
{ | ||
Objects.Add((ObjectType)v, new List<ILocoObject>()); | ||
} | ||
} | ||
|
||
public static List<T> Get<T>(ObjectType type) | ||
where T : ILocoStruct => Objects[type].Select(a => a.Object).Cast<T>().ToList(); | ||
|
||
public static void Add<T>(T obj) where T : ILocoObject | ||
=> Objects[obj.S5Header.ObjectType].Add(obj); | ||
} | ||
|
||
// unused for now | ||
//public class ObjectManager | ||
//{ | ||
// readonly Dictionary<ObjectType, List<ILocoObject>> Objects = new(); | ||
|
||
// public ObjectManager() | ||
// { | ||
// foreach (var v in Enum.GetValues(typeof(ObjectType))) | ||
// { | ||
// Objects.Add((ObjectType)v, new List<ILocoObject>()); | ||
// } | ||
// } | ||
|
||
// public List<T> Get<T>(ObjectType type) | ||
// where T : ILocoStruct => Objects[type].Select(a => a.Object).Cast<T>().ToList(); | ||
|
||
// public void Add<T>(T obj) where T : ILocoObject | ||
// => Objects[obj.S5Header.ObjectType].Add(obj); | ||
//} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters