public ProtoPlantTooltipPrivateData(
     PlantPrivateState privateState,
     double serverTimeNextHarvest,
     float speedMultiplier)
 {
     this.ProducedHarvestsCount  = privateState.ProducedHarvestsCount;
     this.AppliedFertilzerProto  = privateState.AppliedFertilizerProto;
     this.ServerTimeWateringEnds = privateState.ServerTimeWateringEnds;
     this.LastWateringDuration   = privateState.LastWateringDuration;
     this.ServerTimeNextHarvest  = serverTimeNextHarvest;
     this.SpeedMultiplier        = speedMultiplier;
 }
Ejemplo n.º 2
0
        private async void RefreshDataFromServer()
        {
            var data = await this.protoPlant.ClientGetTooltipData(this.objectPlant);

            if (this.IsDisposed)
            {
                return;
            }

            this.Visibility = Visibility.Visible;

            if (this.appliedFertilizedProto != data.AppliedFertilzerProto)
            {
                this.appliedFertilizedProto = data.AppliedFertilzerProto;
                this.FertilizerBonusText    = this.appliedFertilizedProto?.FertilizerShortDescription;
                this.NotifyPropertyChanged(nameof(this.IconFertilizer));
            }

            this.HarvestsCount          = data.ProducedHarvestsCount;
            this.nextHarvestOrSpoilTime = data.ServerTimeNextHarvestOrSpoil;
            this.totalHarvestDuration   = this.protoPlant.ClientCalculateHarvestTotalDuration(
                onlyForHarvestStage: this.HarvestsCount > 0)
                                          / data.SpeedMultiplier;

            this.wateringEndsTime = data.ServerTimeWateringEnds;
            this.wateringDuration = data.LastWateringDuration;

            this.SkillGrowthSpeedBonusText =
                data.SkillGrowthSpeedMultiplier > 1.0
                    ? string.Format(ItemMulch.ShortDescriptionText,
                                    "+"
                                    + (int)Math.Ceiling(100 * (data.SkillGrowthSpeedMultiplier - 1.0)))
                    : null;

            if (!this.isDataReceivedFromServer)
            {
                this.isDataReceivedFromServer  = true;
                this.VisibilityDataReceived    = Visibility.Visible;
                this.VisibilityDataNotReceived = Visibility.Collapsed;

                // start updating displayed time
                this.TimerUpdateDisplayedTime();
            }
        }
        private async void RefreshDataFromServer()
        {
            var data = await this.protoPlant.ClientGetTooltipData(this.objectPlant);

            if (this.IsDisposed)
            {
                return;
            }

            this.Visibility = Visibility.Visible;

            if (this.appliedFertilizedProto != data.AppliedFertilzerProto)
            {
                this.appliedFertilizedProto = data.AppliedFertilzerProto;
                this.TextFertilizerBonus    = this.appliedFertilizedProto?.FertilizerShortDescription;
                this.NotifyPropertyChanged(nameof(this.IconFertilizer));
                this.VisibilityFertilizer = this.appliedFertilizedProto != null
                                                ? Visibility.Visible
                                                : Visibility.Collapsed;
            }

            this.HarvestsCount        = data.ProducedHarvestsCount;
            this.nextHarvestTime      = data.ServerTimeNextHarvest;
            this.totalHarvestDuration = this.protoPlant.ClientCalculateHarvestTotalDuration(
                onlyForHarvestStage: this.HarvestsCount > 0)
                                        / data.SpeedMultiplier;

            this.wateringEndsTime = data.ServerTimeWateringEnds;
            this.wateringDuration = data.LastWateringDuration;

            if (!this.isDataReceivedFromServer)
            {
                this.isDataReceivedFromServer  = true;
                this.VisibilityDataReceived    = Visibility.Visible;
                this.VisibilityDataNotReceived = Visibility.Collapsed;

                // start updating displayed time
                this.TimerUpdateDisplayedTime();
            }
        }
Ejemplo n.º 4
0
 public ItemMulchViewModel([NotNull] IProtoItemFertilizer mulch) : base(mulch)
 {
 }
Ejemplo n.º 5
0
 public ProtoItemFertilizerViewModel([NotNull] IProtoItemFertilizer fertilizer) : base(fertilizer)
 {
 }