comparison API/EventListeningWarFoundryLoader.cs @ 89:90dee8d781ee

Re #253: Allow multiple data files in a single zip * Add and use loader that just listens to events to capture new objects and does nothing else
author IBBoard <dev@ibboard.co.uk>
date Sun, 27 Feb 2011 19:44:08 +0000
parents
children 5d19fee8e9dc
comparison
equal deleted inserted replaced
88:31fd34f7d7cf 89:90dee8d781ee
1 using System;
2 using IBBoard.WarFoundry.API.Factories;
3 using System.Collections.Generic;
4 using IBBoard.WarFoundry.API.Objects;
5
6 namespace IBBoard.WarFoundry.API
7 {
8 public class EventListeningWarFoundryLoader : AbstractWarFoundryLoader
9 {
10 private IDictionary<string, GameSystem> gameSystems;
11 private IDictionary<string, Race> races;
12 private IDictionary<string, Army> armies;
13
14 public EventListeningWarFoundryLoader()
15 {
16 gameSystems = new Dictionary<string, GameSystem>();
17 races = new Dictionary<string, Race>();
18 armies = new Dictionary<string, Army>();
19 }
20
21 public override void RegisterFactory (INativeWarFoundryFactory factory)
22 {
23 base.RegisterFactory (factory);
24 factory.GameSystemLoaded+= DoStoreGameSystem;
25 factory.RaceLoaded+= DoStoreRace;
26 }
27
28 protected override GameSystem GetExistingSystemForSystem (GameSystem system)
29 {
30 throw new System.NotImplementedException();
31 }
32
33
34 protected override void DoStoreGameSystem (GameSystem system)
35 {
36 gameSystems.Add(system.ID, system);
37 }
38
39
40 protected override void DoStoreRace (Race race)
41 {
42 races.Add(race.ID, race);
43 }
44
45
46 public override GameSystem[] GetGameSystems ()
47 {
48 throw new System.NotImplementedException();
49 }
50
51
52 public override GameSystem GetGameSystem (string systemID)
53 {
54 return DictionaryUtils.GetValue(gameSystems, systemID);
55 }
56
57
58 protected override void RemoveGameSystem (GameSystem system)
59 {
60 throw new System.NotImplementedException();
61 }
62
63
64 public override Race[] GetRaces (GameSystem system)
65 {
66 throw new System.NotImplementedException();
67 }
68
69
70 public override Race GetRace (GameSystem system, string raceID)
71 {
72 return GetRace(system, raceID, "");
73 }
74
75
76 public override Race GetRace (GameSystem system, string raceID, string raceSubID)
77 {
78 return DictionaryUtils.GetValue(races, raceID);
79 }
80
81
82 protected override void RemoveRace (Race race)
83 {
84 throw new System.NotImplementedException();
85 }
86 }
87 }