Example #1
0
        private void Add <T>(List <T> list, Entity marketItem, string preview) where T : GarageItem, new()
        {
            T item = GarageItemsRegistry.GetItem <T>(marketItem.Id);

            item.Preview = preview;
            list.Add(item);
        }
Example #2
0
 private void addModule(ModuleInfo m)
 {
     if (GarageItemsRegistry.GetItem <ModuleItem>(m.ModuleId).IsMutable())
     {
         Instantiate <MVPModuleContainer>(this.moduleContainerPrefab, base.transform).SetupModuleCard(m, this.moduleSize);
     }
 }
Example #3
0
        private void Buy(long key)
        {
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(key);

            FindObjectOfType <Dialogs60Component>().Get <BuyConfirmationDialog>().Show(item, new Action(this.SendOpenAvatarsEvent), this.GetName(item.Name), new Action(this.SendOpenAvatarsEvent));
            base.GetComponent <AvatarDialogComponent>().Hide();
        }
Example #4
0
        public static string GetDetailedName(Entity marketItem)
        {
            GarageItem item            = GarageItemsRegistry.GetItem <GarageItem>(marketItem);
            string     savedLocaleCode = LocaleUtils.GetSavedLocaleCode();

            return(!"ru".Equals(savedLocaleCode) ? (Instance.GetGarageItemName(item) + " " + Instance.GetCategoryName(marketItem)) : (Instance.GetCategoryName(marketItem) + " " + Instance.GetGarageItemName(item)));
        }
        public void UpdateViewByMarketItem(long marketItem)
        {
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(marketItem);

            this.imageSkin.SpriteUid = item.Preview;
            this.text.text           = item.Name.ToUpper();
            this.back.SetActive(true);
        }
        public void UpdateView(DailyBonusGarageItemReward containerItem)
        {
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(containerItem.MarketItemId);

            this.imageSkin.SpriteUid = item.Preview;
            this.text.text           = item.Name.ToUpper();
            this.back.SetActive(true);
        }
        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);
        }
Example #8
0
        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);
        }
Example #9
0
 public override void RunStep(TutorialData data)
 {
     TutorialCanvas.Instance.BlockInteractable();
     base.RunStep(data);
     this.selectedItem = GarageItemsRegistry.GetItem <TankPartItem>(data.TutorialStep.GetComponent <TutorialSelectItemDataComponent>().itemMarketId);
     if (ReferenceEquals(this.carousel.Selected.Item, this.selectedItem))
     {
         this.Complete(this.carousel.Selected);
     }
     else
     {
         this.carousel.onItemSelected += new UnityAction <GarageItemUI>(this.Complete);
         this.carousel.Select(this.selectedItem, false);
     }
 }
Example #10
0
 public void AddMarketItem(IEnumerable <long> avatarIds, int currentUserRank)
 {
     foreach (long num in avatarIds)
     {
         if (!this._avatars.ContainsKey(num))
         {
             Avatar item = GarageItemsRegistry.GetItem <Avatar>(num);
             if ((item.UserItem != null) || (item.IsBuyable || item.IsContainerItem))
             {
                 this.CreateAvatarButton(item, currentUserRank);
             }
             this._avatars.Add(item.MarketItem.Id, item);
         }
     }
     this.UpdateButtons();
 }
Example #11
0
        private DailyBonusGarageItemReward GetCompleteUntakenDetailTargetItem(DailyBonusScreenSystem.UserDailyBonusNode userDailyBonusNode, DailyBonusScreenSystem.DailyBonusConfig dailyBonusConfigNode)
        {
            DailyBonusCycleComponent cycle = this.GetCycle(userDailyBonusNode, dailyBonusConfigNode);
            int num = cycle.Zones[(int)((IntPtr)userDailyBonusNode.userDailyBonusZone.ZoneNumber)];

            DailyBonusData[] dailyBonuses    = cycle.DailyBonuses;
            List <long>      receivedRewards = userDailyBonusNode.userDailyBonusReceivedRewards.ReceivedRewards;

            for (int i = 0; i <= num; i++)
            {
                DailyBonusData data = dailyBonuses[i];
                if (receivedRewards.Contains(data.Code) && (data.DailyBonusType == DailyBonusType.DETAIL))
                {
                    DetailItem item = GarageItemsRegistry.GetItem <DetailItem>(data.DetailReward.MarketItemId);
                    if (item.Count == item.RequiredCount)
                    {
                        return(data.DetailReward);
                    }
                }
            }
            return(null);
        }
        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;
        }
Example #13
0
        protected override void FillFromEntity(Entity entity)
        {
            if (entity.HasComponent <ImageItemComponent>())
            {
                string spriteUid = entity.GetComponent <ImageItemComponent>().SpriteUid;
                base.banner.SpriteUid = spriteUid;
            }
            base.title.text = MarketItemNameLocalization.Instance.GetCategoryName(entity) + " \"";
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(entity);

            if (item != null)
            {
                base.title.text = base.title.text + MarketItemNameLocalization.Instance.GetGarageItemName(item);
            }
            else if (entity.HasComponent <DescriptionItemComponent>())
            {
                DescriptionItemComponent component = entity.GetComponent <DescriptionItemComponent>();
                base.title.text = base.title.text + component.Name;
            }
            base.title.text = base.title.text + "\"";
            XPriceItemComponent component2 = entity.GetComponent <XPriceItemComponent>();
            string priceStr = component2.Price.ToStringSeparatedByThousands();

            if (component2.Price < component2.OldPrice)
            {
                priceStr = priceStr + $" <s><#{this.greyColor.Color.ToHexString()}>{component2.OldPrice.ToStringSeparatedByThousands()}</color></s>";
            }
            this.SetPrice(priceStr, "<sprite=9>");
            base.EndDate = entity.GetComponent <MarketItemSaleComponent>().endDate;
            if (base.EndDate.UnityTime != 0f)
            {
                TextTimerComponent component = base.GetComponent <TextTimerComponent>();
                component.EndDate = base.EndDate;
                component.enabled = true;
            }
            base.FillFromEntity(entity);
        }
Example #14
0
        public void ShowTutorialRewards(ShowTutorialRewardsEvent e, TutorialStepWithRewardsNode tutorialStepWithRewards, [JoinAll] ScreenNode screen)
        {
            List <SpecialOfferItem> items = new List <SpecialOfferItem>();

            foreach (Reward reward in tutorialStepWithRewards.tutorialRewardData.Rewards)
            {
                GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(reward.ItemId);
                if (item != null)
                {
                    items.Add(new SpecialOfferItem((int)reward.Count, item.Preview, item.Name));
                }
            }
            long crysCount = tutorialStepWithRewards.tutorialRewardData.CrysCount;

            if (crysCount > 0L)
            {
                items.Add(new SpecialOfferItem((int)crysCount, screen.battleResultsAwardsScreen.crysImageSkin.SpriteUid, screen.battleResultsAwardsScreen.crysLocalizedField.Value));
            }
            BattleResultSpecialOfferUiComponent specialOfferUI = screen.battleResultsAwardsScreen.specialOfferUI;

            specialOfferUI.ShowContent(screen.battleResultsAwardsScreen.tutorialCongratulationLocalizedField.Value, tutorialStepWithRewards.tutorialStepData.Message, items);
            specialOfferUI.SetTutorialRewardsButton();
            specialOfferUI.Appear();
        }
        private string GetTooltipText(DailyBonusData dailyBonusData, BonusElementState elementState)
        {
            if (elementState == BonusElementState.INACCESSIBLE)
            {
                return((string)this.hiddenText);
            }
            DailyBonusType dailyBonusType = dailyBonusData.DailyBonusType;

            switch (dailyBonusType)
            {
            case DailyBonusType.CRY:
                return(FirstCharToUpper(this.crystalText.Value) + " x" + dailyBonusData.CryAmount);

            case DailyBonusType.XCRY:
                return(FirstCharToUpper(this.xCrystalText.Value) + " x" + dailyBonusData.XcryAmount);

            case DailyBonusType.ENERGY:
                return(FirstCharToUpper(this.chargesText.Value) + " x" + dailyBonusData.EnergyAmount);

            case DailyBonusType.CONTAINER:
                return(FirstCharToUpper(GarageItemsRegistry.GetItem <GarageItem>(dailyBonusData.ContainerReward.MarketItemId).Name));
            }
            return((dailyBonusType == DailyBonusType.DETAIL) ? GarageItemsRegistry.GetItem <DetailItem>(dailyBonusData.DetailReward.MarketItemId).Name : string.Empty);
        }
 private static string GetItemGuid(long marketItemId) =>
 GarageItemsRegistry.GetItem <GarageItem>(marketItemId).AssertGuid;
 public void InitTurret(NodeAddedEvent e, SingleNode <CustomizationUIComponent> ui, TurretNode turret, [Context, JoinByMarketItem] MarketItemNode marketItem)
 {
     ui.component.Turret = GarageItemsRegistry.GetItem <TankPartItem>(marketItem.Entity);
 }
 public void InitHullForBattleSelectScreen(NodeAddedEvent e, SingleNode <MatchLobbyGUIComponent> ui, HullNode hull, [Context, JoinByMarketItem] MarketItemNode marketItem)
 {
     ui.component.Hull = GarageItemsRegistry.GetItem <TankPartItem>(marketItem.Entity);
     ui.component.SetHullLabels();
 }
 public void InitHull(NodeAddedEvent e, SingleNode <CustomizationUIComponent> ui, HullNode hull, [Context, JoinByMarketItem] MarketItemNode marketItem)
 {
     ui.component.Hull = GarageItemsRegistry.GetItem <TankPartItem>(marketItem.Entity);
 }
 public void InitTurretForBattleSelectScreen(NodeAddedEvent e, SingleNode <MatchLobbyGUIComponent> ui, TurretNode turret, [Context, JoinByMarketItem] MarketItemNode marketItem)
 {
     ui.component.Turret = GarageItemsRegistry.GetItem <TankPartItem>(marketItem.Entity);
     ui.component.SetTurretLabels();
 }
 public void OpenContainer(OpenContainerAnimationShownEvent e, Node any, [JoinAll] ContainerNode selectedItem)
 {
     base.ScheduleEvent(new OpenSelectedContainerEvent(), GarageItemsRegistry.GetItem <ContainerBoxItem>(selectedItem.marketItemGroup.Key).UserItem);
 }
Example #22
0
 private void SetItem(GarageUserItemNode item, SelectedItemUI ui, MountedSkin mountedSkin)
 {
     ui.Set(GarageItemsRegistry.GetItem <TankPartItem>(item.marketItemGroup.Key), mountedSkin.descriptionItem.Name, item.upgradeLevelItem.Level);
 }
Example #23
0
 public void InitHull(NodeAddedEvent e, SingleNode <MainScreenComponent> ui, SelfUserNode self, [JoinByUser, Context] MountedHullNode hull, [JoinByMarketItem, Context] GarageMarketItemNode marketItem)
 {
     ui.component.MountedHull = GarageItemsRegistry.GetItem <TankPartItem>(hull.marketItemGroup.Key);
 }
Example #24
0
 public void InitTurret(NodeAddedEvent e, SingleNode <MainScreenComponent> ui, SelfUserNode self, [JoinByUser, Context] MountedTurretNode turret, [JoinByMarketItem, Context] GarageMarketItemNode marketItem)
 {
     ui.component.MountedTurret = GarageItemsRegistry.GetItem <TankPartItem>(turret.marketItemGroup.Key);
 }