public void HullModules() { this.selectedItem = this.Hull; GoToModulesScreenEvent eventInstance = new GoToModulesScreenEvent(TankPartModuleType.TANK); EngineService.Engine.ScheduleEvent(eventInstance, EngineService.EntityStub); this.MainScreen.SendShowScreenStat(LogScreen.TurretModules); }
private void OnAnyBuyCallback(TankPartItem item) { if (this.Carousel.gameObject.activeInHierarchy && ReferenceEquals(item, this.Carousel.Selected.Item)) { this.buttonsAnimator.SetBool("Bought", true); item.WaitForBuy = false; } }
private void UpdateEquipment(LobbyUserListItemComponent uiItem, UserEquipmentComponent userEquipment) { Entity entityById = base.GetEntityById(userEquipment.WeaponId); Entity marketEntity = base.GetEntityById(userEquipment.HullId); TankPartItem item = GarageItemsRegistry.GetItem <TankPartItem>(marketEntity); TankPartItem item2 = GarageItemsRegistry.GetItem <TankPartItem>(entityById); uiItem.UpdateEquipment(item.Name, userEquipment.HullId, item2.Name, userEquipment.WeaponId); }
public void Clear() { this.target = null; this.skins = null; this.paints = null; this.graffities = null; this.ammo = null; this.nextList = null; this.selected = null; }
public void SetProgress(Entity itemEntity, float expReward, int previousUpgradeLevel, int[] levels, BattleResultsTextTemplatesComponent textTemplates) { TankPartItem item = GarageItemsRegistry.GetItem <TankPartItem>(itemEntity.GetComponent <MarketItemGroupComponent>().Key); this.name.text = item.Name; bool flag2 = item.UpgradeLevel == UpgradablePropertiesUtils.MAX_LEVEL; LevelInfo currentLevelInfo = LevelInfo.Get((previousUpgradeLevel != UpgradablePropertiesUtils.MAX_LEVEL) ? (!flag2 ? ((long)item.AbsExperience) : ((long)levels[levels.Length - 1])) : (levels[levels.Length - 1] + ((long)expReward)), levels); base.SetProgress(expReward, levels, currentLevelInfo, textTemplates); }
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 Show(TankPartItem tankPartItem, float coef, float coefWithSelected) { if (this.isShow) { this.Hide(); } else { tankPartItem ??= this.selectedItemUI.TankPartItem; this.AddProperties(tankPartItem, coef, coefWithSelected); this.contentRect.gameObject.SetActive(true); this.IsShow = true; } }
public void AddProperties(TankPartItem tankPartItem, float coef, float selectedCoef) { this.Clear(); bool flag = true; foreach (VisualProperty property in tankPartItem.Properties) { float minValue = property.GetValue(0f) - (property.GetValue(0f) / 10f); float maxValue = property.GetValue(1f); float currentValue = property.GetValue(coef); string formatedValue = property.GetFormatedValue(coef); float nextValue = property.GetValue(selectedCoef); string nextValueStr = property.GetFormatedValue(selectedCoef); if (currentValue == nextValue) { this.GetPropertyUi().SetValue(property.Name, property.Unit, formatedValue); continue; } this.GetPropertyUi().SetUpgradableValue(property.Name, property.Unit, formatedValue, nextValueStr, currentValue, nextValue, minValue, maxValue, property.Format); flag = false; } if (!flag) { this.contentRect.sizeDelta = new Vector2(this.maxContentWidth, this.contentRect.sizeDelta.y); } else { this.contentRect.sizeDelta = new Vector2(this.minContentWidth, this.contentRect.sizeDelta.y); foreach (UpgradePropertyUI yui in this.contentRect.GetComponentsInChildren <UpgradePropertyUI>(true)) { yui.DisableNextValueAndArrow(); RectTransform component = yui.GetComponent <RectTransform>(); Vector2 sizeDelta = component.sizeDelta; component.sizeDelta = new Vector2(this.minContentWidth - 20f, sizeDelta.y); } } }
private void InitializeSkinUnlocks(ItemUnlockUIComponent itemUnlockUI, SelectedItemUI selectedItemUI, Entity entity) { TankPartItem tankPartItem = selectedItemUI.TankPartItem; List <VisualItem> list = new List <VisualItem>(); foreach (VisualItem item2 in tankPartItem.Skins) { if (item2.RestrictionLevel > 0) { list.Add(item2); } } GetAllGraffitiesEvent eventInstance = new GetAllGraffitiesEvent(); base.ScheduleEvent(eventInstance, entity); foreach (VisualItem item3 in eventInstance.Items) { if (ReferenceEquals(item3.ParentItem, tankPartItem) && (item3.RestrictionLevel > 0)) { list.Add(item3); } } if (< > f__am$cache0 == null) {
public void SetItem(TankPartItem item) { this.currentTankPartItem = item; this.tankPartItemName.text = item.Name; this.FilterSlots(); }
public void ShowHulls(TankPartItem selected) {
public void UpdateView(ModuleItem moduleItem, List <List <int> > level2PowerByTier, TankPartItem tank, TankPartItem weapon) { IEnumerator enumerator = this.upgrade.GetEnumerator(); try { while (enumerator.MoveNext()) { Transform current = (Transform)enumerator.Current; Destroy(current.gameObject); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } if (moduleItem == null) { this.moduleName.text = null; } else { long level = moduleItem.Level; int maxLevel = moduleItem.MaxLevel; this.moduleName.text = (moduleItem.UserItem != null) ? $"{moduleItem.Name} <color=#838383FF>({this.localizeLVL.Value} {(moduleItem.Level + 1L)})" : $"{moduleItem.Name}"; this.ShowDamageBonus(moduleItem, (long)maxLevel, level, level2PowerByTier, tank, weapon); for (int i = 0; i < moduleItem.properties.Count; i++) { GameObject obj2 = Instantiate <GameObject>(this.property, this.upgrade); obj2.SetActive(true); ModulePropertyView component = obj2.GetComponent <ModulePropertyView>(); ModuleVisualProperty property = moduleItem.properties[i]; component.SpriteUid = property.SpriteUID; component.PropertyName = property.Name; component.Units = property.Unit; component.Format = property.Format; if (property.MaxAndMin) { if (moduleItem.UserItem == null) { component.CurrentParamString = property.MaxAndMinString[(int)((IntPtr)level)]; } else if (level == maxLevel) { component.CurrentParamString = property.MaxAndMinString[(int)((IntPtr)level)]; } else { component.CurrentParamString = property.MaxAndMinString[(int)((IntPtr)level)]; component.NextParamString = property.MaxAndMinString[(int)((IntPtr)(level + 1L))]; } } else if (moduleItem.UserItem == null) { component.CurrentParam = property.CalculateModuleEffectPropertyValue(0, maxLevel); component.MaxParam = property.CalculateModuleEffectPropertyValue(maxLevel, maxLevel); } else if (level == maxLevel) { float num6 = property.CalculateModuleEffectPropertyValue(maxLevel, maxLevel); component.CurrentParam = num6; component.MaxParam = num6; } else { float num7 = property.CalculateModuleEffectPropertyValue(maxLevel, maxLevel); component.CurrentParam = (level == -1L) ? 0f : property.CalculateModuleEffectPropertyValue((int)level, maxLevel); component.NextParam = property.CalculateModuleEffectPropertyValue(((int)level) + 1, maxLevel); component.MaxParam = num7; } component.ProgressBar = moduleItem.properties[i].ProgressBar; } } this.ShowButton(moduleItem); }
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; } }