/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="location">The location to track.</param> public LocationTracker(GameLocation location) { this.Location = location; // init watchers this.BuildingsWatcher = location is BuildableGameLocation buildableLocation?WatcherFactory.ForNetCollection(buildableLocation.buildings) : WatcherFactory.ForImmutableCollection <Building>(); this.DebrisWatcher = WatcherFactory.ForNetCollection(location.debris); this.LargeTerrainFeaturesWatcher = WatcherFactory.ForNetCollection(location.largeTerrainFeatures); this.NpcsWatcher = WatcherFactory.ForNetCollection(location.characters); this.ObjectsWatcher = WatcherFactory.ForNetDictionary(location.netObjects); this.TerrainFeaturesWatcher = WatcherFactory.ForNetDictionary(location.terrainFeatures); this.FurnitureWatcher = WatcherFactory.ForNetCollection(location.furniture); this.Watchers.AddRange(new IWatcher[] { this.BuildingsWatcher, this.DebrisWatcher, this.LargeTerrainFeaturesWatcher, this.NpcsWatcher, this.ObjectsWatcher, this.TerrainFeaturesWatcher, this.FurnitureWatcher }); this.UpdateChestWatcherList(added: location.Objects.Pairs, removed: Array.Empty <KeyValuePair <Vector2, SObject> >()); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="location">The location to track.</param> public LocationTracker(GameLocation location) { this.Location = location; // init watchers this.BuildingsWatcher = location is BuildableGameLocation buildableLocation ? WatcherFactory.ForNetCollection(buildableLocation.buildings) : (ICollectionWatcher <Building>)WatcherFactory.ForObservableCollection(new ObservableCollection <Building>()); this.DebrisWatcher = WatcherFactory.ForNetCollection(location.debris); this.LargeTerrainFeaturesWatcher = WatcherFactory.ForNetCollection(location.largeTerrainFeatures); this.NpcsWatcher = WatcherFactory.ForNetCollection(location.characters); this.ObjectsWatcher = WatcherFactory.ForNetDictionary(location.netObjects); this.TerrainFeaturesWatcher = WatcherFactory.ForNetDictionary(location.terrainFeatures); this.Watchers.AddRange(new IWatcher[] { this.BuildingsWatcher, this.DebrisWatcher, this.LargeTerrainFeaturesWatcher, this.NpcsWatcher, this.ObjectsWatcher, this.TerrainFeaturesWatcher }); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="location">The location to track.</param> public LocationTracker(GameLocation location) { this.Location = location; // init watchers this.ObjectsWatcher = WatcherFactory.ForNetDictionary(location.netObjects); this.BuildingsWatcher = location is BuildableGameLocation buildableLocation ? WatcherFactory.ForNetCollection(buildableLocation.buildings) : (ICollectionWatcher <Building>)WatcherFactory.ForObservableCollection(new ObservableCollection <Building>()); this.Watchers.AddRange(new IWatcher[] { this.BuildingsWatcher, this.ObjectsWatcher }); }