private void UpdateAmountStored(int sliderIndex) { this.sliders[sliderIndex].DescLabel.Text = this.lang.Get("STORAGE_CAPACITY", new object[0]); int num = StorageSpreadUtils.CalculateAssumedCurrencyInStorage(this.buildingInfo.Currency, this.selectedBuilding); int storage = this.buildingInfo.Storage; UXLabel currentLabel = this.sliders[sliderIndex].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(storage) }); UXSlider currentSlider = this.sliders[sliderIndex].CurrentSlider; float num2 = (storage != 0) ? ((float)num / (float)storage) : 0f; currentSlider.Value = num2; this.projector.Config.MeterValue = num2; }
public void UpdateFillState(Entity entity, BuildingTypeVO buildingVO) { SmartEntity smartEntity = (SmartEntity)entity; if (buildingVO.Storage <= 0 || string.IsNullOrEmpty(buildingVO.FillStateAssetName) || string.IsNullOrEmpty(buildingVO.FillStateBundleName)) { return; } if (!entity.Has <GameObjectViewComponent>()) { return; } int num = 0; IResourceFillable resourceFillable = null; if (buildingVO.Type == BuildingType.Resource) { GeneratorComponent generatorComponent = entity.Get <GeneratorComponent>(); BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); num = buildingComponent.BuildingTO.AccruedCurrency; resourceFillable = generatorComponent; } else if (buildingVO.Type == BuildingType.Storage) { num = StorageSpreadUtils.CalculateAssumedCurrencyInStorage(buildingVO.Currency, entity); resourceFillable = entity.Get <StorageComponent>(); } if (resourceFillable == null) { return; } float num2 = (float)num / (float)buildingVO.Storage; float currentFullnessPercentage = resourceFillable.CurrentFullnessPercentage; resourceFillable.CurrentFullnessPercentage = num2; resourceFillable.PreviousFullnessPercentage = currentFullnessPercentage; this.UpdateFillStateFX(entity, buildingVO, num2, currentFullnessPercentage); if (smartEntity.BuildingComp.BuildingType.Type == BuildingType.Storage && smartEntity.BuildingComp.BuildingType.Currency == CurrencyType.Credits) { Service.EventManager.SendEvent(EventId.StorageDoorEvent, smartEntity); } }
private void UpdateCapacity(int sliderIndex) { BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>(); int storage = this.buildingInfo.Storage; int storage2 = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo).Storage; int storage3 = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup).Storage; this.sliders[sliderIndex].DescLabel.Text = this.lang.Get("STORAGE_CAPACITY", new object[0]); this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(storage); this.sliders[sliderIndex].NextLabel.Text = this.lang.Get("PLUS", new object[] { this.lang.ThousandsSeparated(storage2 - storage) }); this.sliders[sliderIndex].CurrentSlider.Value = ((storage3 == 0) ? 0f : ((float)storage / (float)storage3)); this.sliders[sliderIndex].NextSlider.Value = ((storage3 == 0) ? 0f : ((float)storage2 / (float)storage3)); int num = StorageSpreadUtils.CalculateAssumedCurrencyInStorage(this.buildingInfo.Currency, this.selectedBuilding); int storage4 = this.buildingInfo.Storage; float meterValue = (storage4 == 0) ? 0f : ((float)num / (float)storage4); this.projector.Config.MeterValue = meterValue; }