public ExtractionModule Init(ItemProgress itemProgress, bool premium, MaterialResource extractionProportin) { if (itemProgress == null) { itemProgress = new ItemProgress { Level = 1 }; } var level = itemProgress.Level ?? 1; var property = PropertyList(level, premium); var power = property[0].CurrentValue; var extraction = new ExtractionResource(); extraction.SetAndCalcEmpFromProportion(extractionProportin, power, BaseProportion.Ir, BaseProportion.Dm); ItemProgress = itemProgress; Cost = CalcPrice(level, premium); Images = _images; Text = _text; Properties = property; ExtractionPerHour = extraction.ExtractionPerHour; ExtractionProportin = extraction.ExtractionProportin; Power = power; return(this); }
public BuildItemUnitView GetMotherViewModel(bool premiumIsActive, StorageResources resources = null) { if (resources?.Current == null) { throw new Exception(Error.ProportionNotSetInModel); } var description = new LangField(Resource.MotherExtractionModule, Resource.MotherStorageDescription); var images = new SpriteImages().BuildImages(MotherCssNativename); //todo временно // var power = GetPower(1, premiumIsActive); var power = GetPower(22, premiumIsActive); var extraction = new ExtractionResource(); extraction.SetAndCalcEmpFromProportion(resources.Current, power, BaseProportion.Ir, BaseProportion.Dm); var model = new BuildItemUnitView { TranslateName = description.Name, NativeName = NativeName, IconSelf = images.Icon, Info = new BuildDropItemInfo { Description = description.Name, DropImage = images.Detail }, Action = new BuildDropItemAction { ViewPath = BuildExtractionModuleActions.ViewPath, Data = new BuildExtractionModuleActions { //todo реализовать Power = power, Percent = extraction.ExtractionProportin, ExtractionPerHour = extraction.ExtractionPerHour } }, IsBuildItem = true }; model.SetComplexButtonView(); model.Action.SetButtons(); return(model); }