finished rewrite of player planet loading
This commit is contained in:
parent
8f63587966
commit
bfdbc347eb
@ -25,10 +25,7 @@ public class PlanetManager : IDisposable, IEnableLogger
|
|||||||
/// Observable changeset showing all player planets converted to view models.
|
/// Observable changeset showing all player planets converted to view models.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IObservable<IChangeSet<PlayerPlanetViewModel, string>> PlayerPlanetsSource
|
public IObservable<IChangeSet<PlayerPlanetViewModel, string>> PlayerPlanetsSource
|
||||||
=> _planets
|
=> _playerPlanets.AsObservableCache().Connect();
|
||||||
.Connect()
|
|
||||||
.Filter(planet => planet.OwnerId == Game.Player.Name)
|
|
||||||
.Transform(planet => new PlayerPlanetViewModel(planet));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cache with all player planets, indexed by planet name.
|
/// Cache with all player planets, indexed by planet name.
|
||||||
@ -64,6 +61,7 @@ public class PlanetManager : IDisposable, IEnableLogger
|
|||||||
var planetsToDelete = cacheKeys.Except(planetNames);
|
var planetsToDelete = cacheKeys.Except(planetNames);
|
||||||
_planets.Edit(innerCache =>
|
_planets.Edit(innerCache =>
|
||||||
{
|
{
|
||||||
|
// TODO: Update Planet loop in the same way as the player planet update loop
|
||||||
foreach (var name in planetsToDelete)
|
foreach (var name in planetsToDelete)
|
||||||
innerCache.RemoveKey(name);
|
innerCache.RemoveKey(name);
|
||||||
innerCache.AddOrUpdate(allPlanets);
|
innerCache.AddOrUpdate(allPlanets);
|
||||||
|
Loading…
Reference in New Issue
Block a user