fixups for player planet model updates
This commit is contained in:
		@@ -85,7 +85,7 @@ public class PlanetManager : IDisposable, IEnableLogger
 | 
			
		||||
                    if (playerPlanet.HasValue)
 | 
			
		||||
                        playerPlanet.Value.Planet = planet;
 | 
			
		||||
                    else
 | 
			
		||||
                        innerCache.Add(new PlayerPlanetViewModel(planet));
 | 
			
		||||
                        innerCache.AddOrUpdate(new PlayerPlanetViewModel(planet));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
 
 | 
			
		||||
@@ -16,18 +16,26 @@ public partial class PlayerPlanetViewModel : ViewModelBase
 | 
			
		||||
    [Reactive]
 | 
			
		||||
    private Model.Planet _planet;
 | 
			
		||||
 | 
			
		||||
    /* TODO
 | 
			
		||||
    /*
 | 
			
		||||
    public Model.Planet Planet
 | 
			
		||||
    {
 | 
			
		||||
        get => _planet;
 | 
			
		||||
        set
 | 
			
		||||
        {
 | 
			
		||||
            this.RaiseAndSetIfChanged(ref _planet, value);
 | 
			
		||||
            RaisePropertyChangedForAll();
 | 
			
		||||
            //this.RaiseAndSetIfChanged(ref _planet, value);
 | 
			
		||||
            //RaisePropertyChangedForAll(); 
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    private void RaisePropertyChangedForAll()
 | 
			
		||||
    {
 | 
			
		||||
        ONPropertChanged(nameof(Name));
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    */
 | 
			
		||||
    
 | 
			
		||||
    private readonly Services.Game Game;
 | 
			
		||||
 | 
			
		||||
    private readonly IObservable<Change<FleetSummaryByDestination, string>> _fleetSummaryChanges;
 | 
			
		||||
@@ -42,8 +50,13 @@ public partial class PlayerPlanetViewModel : ViewModelBase
 | 
			
		||||
        Planet = planet;
 | 
			
		||||
        PopulationTargetPercent = planet.PopulationTargetPercent;
 | 
			
		||||
        
 | 
			
		||||
        this.WhenAnyValue(vm => vm.Planet)
 | 
			
		||||
            .Subscribe(_ => this.RaisePlanetChangedNotifications());
 | 
			
		||||
 | 
			
		||||
        _populationTargetHelper = this
 | 
			
		||||
            .WhenAnyValue(vm => vm.PopulationTargetPercent)
 | 
			
		||||
            .WhenAnyValue(vm => vm.PopulationTargetPercent,
 | 
			
		||||
                vm => vm.Planet,
 | 
			
		||||
                (popTgtPct, _) => popTgtPct)
 | 
			
		||||
            .Select(popTgt => this.MaxPopulation * popTgt / 10000 * 100)
 | 
			
		||||
            .ToProperty(this, vm => vm.PopulationTarget);
 | 
			
		||||
    
 | 
			
		||||
@@ -282,55 +295,55 @@ public partial class PlayerPlanetViewModel : ViewModelBase
 | 
			
		||||
            , 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void RaisePropertyChangedForAll()
 | 
			
		||||
    private void RaisePlanetChangedNotifications()
 | 
			
		||||
    {
 | 
			
		||||
    OnPropertyChanged(nameof(Name));
 | 
			
		||||
    OnPropertyChanged(nameof(Owner));
 | 
			
		||||
    OnPropertyChanged(nameof(StarbaseType));
 | 
			
		||||
    OnPropertyChanged(nameof(Population));
 | 
			
		||||
    OnPropertyChanged(nameof(Value));
 | 
			
		||||
    OnPropertyChanged(nameof(Mines));
 | 
			
		||||
    OnPropertyChanged(nameof(Factories));
 | 
			
		||||
    OnPropertyChanged(nameof(DefPercent));
 | 
			
		||||
    OnPropertyChanged(nameof(SurfaceIronium));
 | 
			
		||||
    OnPropertyChanged(nameof(SurfaceBoranium));
 | 
			
		||||
    OnPropertyChanged(nameof(SurfaceGermanium));
 | 
			
		||||
    OnPropertyChanged(nameof(MRIronium));
 | 
			
		||||
    OnPropertyChanged(nameof(MRBoranium));
 | 
			
		||||
    OnPropertyChanged(nameof(MRGermanium));
 | 
			
		||||
    OnPropertyChanged(nameof(MCIronium));
 | 
			
		||||
    OnPropertyChanged(nameof(MCBoranium));
 | 
			
		||||
    OnPropertyChanged(nameof(MCGermanium));
 | 
			
		||||
    OnPropertyChanged(nameof(Resources));
 | 
			
		||||
    OnPropertyChanged(nameof(Gravity));
 | 
			
		||||
    OnPropertyChanged(nameof(Temperature));
 | 
			
		||||
    OnPropertyChanged(nameof(Radiation));
 | 
			
		||||
    OnPropertyChanged(nameof(GravityOrig));
 | 
			
		||||
    OnPropertyChanged(nameof(TemperatureOrig));
 | 
			
		||||
    OnPropertyChanged(nameof(RadiationOrig));
 | 
			
		||||
    OnPropertyChanged(nameof(MaxTerraforming));
 | 
			
		||||
    OnPropertyChanged(nameof(CapacityPercent));
 | 
			
		||||
    OnPropertyChanged(nameof(ScanRange));
 | 
			
		||||
    OnPropertyChanged(nameof(PenScanRange));
 | 
			
		||||
    OnPropertyChanged(nameof(Driver));
 | 
			
		||||
    OnPropertyChanged(nameof(DriverWarp));
 | 
			
		||||
    OnPropertyChanged(nameof(RouteTarget));
 | 
			
		||||
    OnPropertyChanged(nameof(GateRange));
 | 
			
		||||
    OnPropertyChanged(nameof(GateMass));
 | 
			
		||||
    OnPropertyChanged(nameof(PctDamage));
 | 
			
		||||
    OnPropertyChanged(nameof(EffectiveValue));
 | 
			
		||||
    OnPropertyChanged(nameof(MaxPopulation));
 | 
			
		||||
    OnPropertyChanged(nameof(PopulationGrowth));
 | 
			
		||||
    OnPropertyChanged(nameof(PopulationT1));
 | 
			
		||||
    OnPropertyChanged(nameof(BuildableFactories));
 | 
			
		||||
    OnPropertyChanged(nameof(BuildableMines));
 | 
			
		||||
    OnPropertyChanged(nameof(OperableFactories));
 | 
			
		||||
    OnPropertyChanged(nameof(OperableMines));
 | 
			
		||||
    OnPropertyChanged(nameof(ResourcesFromPopulation));
 | 
			
		||||
    OnPropertyChanged(nameof(ResourcesFromFactories));
 | 
			
		||||
    OnPropertyChanged(nameof(AvailableIronium));
 | 
			
		||||
    OnPropertyChanged(nameof(AvailableBoranium));
 | 
			
		||||
    OnPropertyChanged(nameof(AvailableGermanium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Name));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Owner));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(StarbaseType));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Population));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Value));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Mines));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Factories));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(DefPercent));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(SurfaceIronium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(SurfaceBoranium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(SurfaceGermanium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MRIronium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MRBoranium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MRGermanium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MCIronium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MCBoranium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MCGermanium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Resources));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Gravity));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Temperature));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Radiation));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(GravityOrig));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(TemperatureOrig));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(RadiationOrig));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MaxTerraforming));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(CapacityPercent));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(ScanRange));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(PenScanRange));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(Driver));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(DriverWarp));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(RouteTarget));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(GateRange));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(GateMass));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(PctDamage));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(EffectiveValue));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(MaxPopulation));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(PopulationGrowth));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(PopulationT1));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(BuildableFactories));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(BuildableMines));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(OperableFactories));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(OperableMines));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(ResourcesFromPopulation));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(ResourcesFromFactories));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(AvailableIronium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(AvailableBoranium));
 | 
			
		||||
        this.RaisePropertyChanged(nameof(AvailableGermanium));
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    #endregion
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user