public ViewModelWindowLithiumOreExtractor(
            IStaticWorldObject worldObjectManufacturer,
            IStaticWorldObject worldObjectDeposit,
            ObjectManufacturerPrivateState privateState,
            ManufacturingConfig manufacturingConfig,
            LiquidContainerState liquidContainerState,
            LiquidContainerConfig liquidContainerConfig)
            : base(worldObjectManufacturer,
                   privateState,
                   manufacturingConfig)
        {
            this.ViewModelLiquidContainerState = new ViewModelLiquidContainerState(liquidContainerState,
                                                                                   liquidContainerConfig);

            this.ViewModelDepositCapacityStatsControl = new ViewModelDepositCapacityStatsControl(worldObjectDeposit);
        }
 public ViewModelWindowWell(
     IStaticWorldObject worldObjectManufacturer,
     ObjectManufacturerPrivateState privateState,
     ManufacturingConfig manufacturingConfig,
     LiquidContainerState liquidContainerState,
     LiquidContainerConfig liquidContainerConfig)
     : base(
         worldObjectManufacturer,
         privateState,
         manufacturingConfig: manufacturingConfig)
 {
     this.CommandDrink = new ActionCommand(this.ExecuteCommandDrink);
     this.ViewModelLiquidContainerState = new ViewModelLiquidContainerState(
         liquidContainerState,
         liquidContainerConfig);
 }
Example #3
0
        public ViewModelWindowManufacturer(
            IStaticWorldObject worldObjectManufacturer,
            ObjectManufacturerPrivateState privateState,
            ManufacturingConfig manufacturingConfig)
        {
            this.WorldObjectManufacturer = worldObjectManufacturer;
            var fuelBurningState   = privateState.FuelBurningState;
            var manufacturingState = privateState.ManufacturingState;

            // please note - the order of creating these view models is important for the proper container exchange order
            this.ViewModelFuelBurningState = fuelBurningState is not null
                                                 ? new ViewModelFuelBurningState(fuelBurningState)
                                                 : null;

            this.ViewModelManufacturingState = new ViewModelManufacturingState(
                worldObjectManufacturer,
                manufacturingState,
                manufacturingConfig);

            this.ViewModelBurningFuel = ViewModelBurningFuel.Create(worldObjectManufacturer, fuelBurningState);

            this.ViewModelManufacturingState.SubscribePropertyChange(
                _ => _.SelectedRecipe,
                this.RefreshIsNeedFuel);

            this.ViewModelManufacturingState.SubscribePropertyChange(
                _ => _.IsInputMatchSelectedRecipe,
                this.RefreshIsNeedFuel);

            this.ViewModelBurningFuel?.SubscribePropertyChange(
                _ => _.IsActive,
                this.RefreshIsNeedFuel);

            this.ViewModelFuelBurningState?.SubscribePropertyChange(
                _ => _.FuelUsageCurrentValue,
                this.RefreshIsNeedFuel);

            this.ViewModelManufacturingState.ContainerInput.StateHashChanged += this.ContainerInputStateChanged;

            this.RefreshIsNeedFuel();

            this.publicState = worldObjectManufacturer.GetPublicState <ObjectManufacturerPublicState>();
            this.publicState.ClientSubscribe(_ => _.IsActive,
                                             _ => this.NotifyPropertyChanged(nameof(this.IsManufacturingActive)),
                                             this);
        }
Example #4
0
        public ViewModelWindowGeneratorWithFuel(
            IStaticWorldObject worldObjectGenerator,
            ObjectManufacturerPrivateState privateState,
            ManufacturingConfig manufacturingConfig,
            LiquidContainerState liquidContainerState,
            LiquidContainerConfig liquidContainerConfig)
            : base(
                worldObjectGenerator,
                privateState,
                manufacturingConfig)
        {
            this.protoGenerator = (IProtoObjectGeneratorWithFuel)worldObjectGenerator.ProtoStaticWorldObject;
            this.ViewModelLiquidContainerState = new ViewModelLiquidContainerState(
                liquidContainerState,
                liquidContainerConfig,
                liquidType: this.protoGenerator.LiquidType);

            this.Refresh();
        }
Example #5
0
        public ViewModelWindowOilPump(
            IStaticWorldObject worldObjectManufacturer,
            IStaticWorldObject worldObjectDeposit,
            ObjectManufacturerPrivateState privateState,
            ManufacturingConfig manufacturingConfig,
            LiquidContainerState liquidContainerState,
            LiquidContainerConfig liquidContainerConfig)
            : base(
                worldObjectManufacturer,
                privateState,
                manufacturingConfig)
        {
            this.ViewModelLiquidContainerState = new ViewModelLiquidContainerState(
                liquidContainerState,
                liquidContainerConfig);

            this.ViewModelDepositCapacityStatsControl
                = new ViewModelDepositCapacityStatsControl(worldObjectDeposit,
                                                           worldObjectManufacturer.TilePosition);
        }
        public ViewModelWindowBarrel(
            IStaticWorldObject worldObjectManufacturer,
            ObjectManufacturerPrivateState privateState,
            ManufacturingConfig manufacturingConfig)
            : base(
                worldObjectManufacturer,
                privateState,
                manufacturingConfig)
        {
            this.protoBarrel    = (IProtoObjectBarrel)worldObjectManufacturer.ProtoStaticWorldObject;
            this.LiquidCapacity = this.protoBarrel.LiquidCapacity;

            this.privateState = this.protoBarrel.GetBarrelPrivateState(worldObjectManufacturer);
            this.privateState.ClientSubscribe(
                _ => _.LiquidAmount,
                _ => this.RefreshLiquidAmount(),
                this);

            this.privateState.ClientSubscribe(
                _ => _.LiquidType,
                _ => this.RefreshLiquidType(),
                this);

            var manufacturingState = privateState.ManufacturingState;

            manufacturingState.ClientSubscribe(
                _ => _.SelectedRecipe,
                _ => this.RefreshRecipe(),
                this);

            this.craftingQueueItems = manufacturingState.CraftingQueue.QueueItems;
            this.craftingQueueItems.ClientAnyModification += this.QueueItemsClientAnyModificationHandler;

            this.RefreshLiquidAmount();
            this.RefreshRecipe();

            // no need - automatically refreshed with the recipe refresh
            //this.RefreshLiquidType();
        }
        public ViewModelWindowManufacturer(
            IStaticWorldObject worldObjectManufacturer,
            ObjectManufacturerPrivateState privateState,
            ManufacturingConfig manufacturingConfig)
        {
            this.WorldObjectManufacturer = worldObjectManufacturer;
            var fuelBurningState   = privateState.FuelBurningState;
            var manufacturingState = privateState.ManufacturingState;

            // please note - the order of creating these view models is important for the proper container exchange order
            this.ViewModelFuelBurningState = fuelBurningState != null
                ? new ViewModelFuelBurningState(fuelBurningState)
                : null;

            this.ViewModelManufacturingState = new ViewModelManufacturingState(
                worldObjectManufacturer,
                manufacturingState,
                manufacturingConfig);

            this.ViewModelBurningFuel = ViewModelBurningFuel.Create(worldObjectManufacturer, fuelBurningState);

            this.ViewModelManufacturingState.SubscribePropertyChange(
                _ => _.SelectedRecipe,
                this.RefreshIsNeedFuel);

            this.ViewModelManufacturingState.SubscribePropertyChange(
                _ => _.IsInputMatchSelectedRecipe,
                this.RefreshIsNeedFuel);

            this.ViewModelBurningFuel?.SubscribePropertyChange(
                _ => _.IsActive,
                this.RefreshIsNeedFuel);

            this.ViewModelFuelBurningState?.SubscribePropertyChange(
                _ => _.FuelUsageCurrentValue,
                this.RefreshIsNeedFuel);

            this.ViewModelManufacturingState.ContainerInput.StateHashChanged += this.ContainerInputStateChanged;

            this.RefreshIsNeedFuel();

            this.publicState = worldObjectManufacturer.GetPublicState <ObjectManufacturerPublicState>();
            this.publicState.ClientSubscribe(_ => _.IsActive,
                                             _ => this.NotifyPropertyChanged(nameof(this.IsManufacturingActive)),
                                             this);

            var insertIfInputEmpty = worldObjectManufacturer.ProtoStaticWorldObject switch
            {
                ProtoObjectWell _ => true,
                ProtoObjectOilPump _ => true,
                ObjectGeneratorEngine _ => true,
                _ => false
            };

            viewModelManufacturerExchange = new ViewModelManufacturerExchange(
                privateState.ManufacturingState.ContainerOutput,
                new List <IItemsContainer> {
                privateState.ManufacturingState.ContainerInput
            },
                insertIfInputEmpty);
        }