private void ShowDamageBonus(ModuleItem item, long max, long current, List <List <int> > level2PowerByTier, TankPartItem tank, TankPartItem weapon) { if (this.CalculateMaximumPercentSum(level2PowerByTier, 3) >= 0) { VisualProperty property = ((item.TankPartModuleType != null) ? weapon : tank).Properties[0]; GameObject obj2 = Instantiate <GameObject>(this.property, this.upgrade); obj2.SetActive(true); ModulePropertyView component = obj2.GetComponent <ModulePropertyView>(); component.PropertyName = property.Name; if (item.TankPartModuleType == TankPartModuleType.TANK) { component.PropertyName = (string)this.bonusArmor; component.SpriteUid = this.armorIcon; } else { component.PropertyName = (string)this.bonusDamage; component.SpriteUid = this.damageIcon; } int tierNumber = item.TierNumber; if (item.UserItem == null) { List <int[]> modulesParams = new List <int[]>(); int[] numArray1 = new int[] { tierNumber, (int)current }; modulesParams.Add(numArray1); List <int[]> list2 = new List <int[]>(); int[] numArray2 = new int[] { tierNumber, (int)max }; list2.Add(numArray2); component.CurrentParam = property.GetValue(this.CalculateUpgradeCoeff(modulesParams, 3, level2PowerByTier)) - property.InitialValue; component.MaxParam = property.GetValue(this.CalculateUpgradeCoeff(list2, 3, level2PowerByTier)) - property.InitialValue; } else if (current == max) { List <int[]> modulesParams = new List <int[]>(); int[] numArray3 = new int[] { tierNumber, (int)max }; modulesParams.Add(numArray3); float num3 = property.GetValue(this.CalculateUpgradeCoeff(modulesParams, 3, level2PowerByTier)); component.CurrentParam = num3 - property.InitialValue; component.MaxParam = num3 - property.InitialValue; } else { List <int[]> modulesParams = new List <int[]>(); int[] numArray4 = new int[] { tierNumber, (int)current }; modulesParams.Add(numArray4); List <int[]> list5 = new List <int[]>(); int[] numArray5 = new int[] { tierNumber, ((int)current) + 1 }; list5.Add(numArray5); List <int[]> list6 = new List <int[]>(); int[] numArray6 = new int[] { tierNumber, (int)max }; list6.Add(numArray6); component.CurrentParam = property.GetValue(this.CalculateUpgradeCoeff(modulesParams, 3, level2PowerByTier)) - property.InitialValue; component.NextParam = property.GetValue(this.CalculateUpgradeCoeff(list5, 3, level2PowerByTier)) - property.InitialValue; component.MaxParam = property.GetValue(this.CalculateUpgradeCoeff(list6, 3, level2PowerByTier)) - property.InitialValue; } component.ProgressBar = true; } }
public void UpdateView(TankPartItem tankPart) { this.activeSlot.UpdateView(); this.activeSlot2.UpdateView(); this.passiveSlot.UpdateView(); CalculateTankPartUpgradeCoeffEvent eventInstance = new CalculateTankPartUpgradeCoeffEvent(); tankPart.MarketItem.ScheduleEvent(eventInstance); this.SetStars(eventInstance.UpgradeCoeff); VisualProperty property = tankPart.Properties[0]; this.BasePartParam = $"{property.InitialValue}"; this.BonusFromModules = (int)(property.GetValue(eventInstance.UpgradeCoeff) - property.InitialValue); }
public void GetItemStat(GetItemStatEvent e, ModuleItemNode module, [JoinAll] SingleNode <SelectedPresetComponent> selectedPreset, [JoinByUser] MountedHullNode mountedHull, [JoinByUser] MountedWeaponNode mountedWeapon, [JoinByUser] ICollection <MountedModuleItemNode> mountedModules, [JoinByModule] Optional <ModuleItemNode> mountedToSelectedSlotModule, [JoinAll] ICollection <SlotNode> slots, [JoinAll] ModuleUpgradeConfigNode moduleUpgradeConfig, [JoinAll] ScreenNode screen) { List <ModuleItemNode> tankModules = new List <ModuleItemNode>(); List <ModuleItemNode> weaponModules = new List <ModuleItemNode>(); List <ModuleItemNode> tankModulesWithSelected = new List <ModuleItemNode>(); List <ModuleItemNode> weaponModulesWithSelected = new List <ModuleItemNode>(); this.FilterModules(mountedModules, module, !mountedToSelectedSlotModule.IsPresent() ? null : mountedToSelectedSlotModule.Get(), tankModules, weaponModules, tankModulesWithSelected, weaponModulesWithSelected); int slotsCount = this.GetSlotsCount(slots, TankPartModuleType.TANK); int slotCount = this.GetSlotsCount(slots, TankPartModuleType.WEAPON); UpgradeCoefs coefs2 = new UpgradeCoefs { tankCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(tankModulesWithSelected), slotsCount, moduleUpgradeConfig.moduleUpgradablePowerConfig), weaponCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionary(weaponModulesWithSelected), slotCount, moduleUpgradeConfig.moduleUpgradablePowerConfig) }; UpgradeCoefs coefs = coefs2; coefs2 = new UpgradeCoefs { tankCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionaryForNextLevelModule(tankModulesWithSelected, module), slotsCount, moduleUpgradeConfig.moduleUpgradablePowerConfig), weaponCoeffWithSelected = TankUpgradeUtils.CalculateUpgradeCoeff(this.GetTierAndLevelsDictionaryForNextLevelModule(weaponModulesWithSelected, module), slotCount, moduleUpgradeConfig.moduleUpgradablePowerConfig) }; UpgradeCoefs coefs3 = coefs2; float coef = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? coefs.weaponCoeffWithSelected : coefs.tankCoeffWithSelected; float num4 = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? coefs3.weaponCoeffWithSelected : coefs3.tankCoeffWithSelected; long marketId = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? mountedWeapon.marketItemGroup.Key : mountedHull.marketItemGroup.Key; VisualProperty property = GarageItemsRegistry.GetItem <TankPartItem>(marketId).Properties[0]; ModuleUpgradeCharacteristic characteristic = new ModuleUpgradeCharacteristic { Min = property.GetValue(0f) - (property.GetValue(0f) / 10f), Max = property.GetValue(1f), Current = property.GetValue(coef), Next = property.GetValue(num4), CurrentStr = property.GetFormatedValue(coef), NextStr = property.GetFormatedValue(num4), Unit = property.Unit, Name = (module.moduleTankPart.TankPart != TankPartModuleType.TANK) ? screen.newModulesScreenUi.TurretDamage : screen.newModulesScreenUi.HullHealth }; e.moduleUpgradeCharacteristic = characteristic; }