private void OnGuaranteedRewardClicked(UXButton btn)
        {
            CrateSupplyVO crateSupplyVO = (CrateSupplyVO)btn.Tag;

            if (crateSupplyVO != null)
            {
                TimedEventPrizeUtils.HandleCrateSupplyRewardClicked(crateSupplyVO);
                this.HideHeaderFooter();
                this.HideAllParticleElements();
                Service.Get <UXController>().HUD.SetSquadScreenVisibility(false);
            }
        }
예제 #2
0
        private UXElement CreateTileWithPrizeInfo(string id, int count, PrizeType prizeType)
        {
            string title       = null;
            string description = null;
            DeployableShardUnlockController deployableShardUnlockController = Service.DeployableShardUnlockController;
            IGeometryVO geometryVO = TimedEventPrizeUtils.GetFinalUnitFromPrize(prizeType, id);
            int         quality    = 0;

            switch (prizeType)
            {
            case PrizeType.Currency:
                title      = this.lang.Get(id.ToUpper(), new object[0]);
                geometryVO = UXUtils.GetDefaultCurrencyIconVO(id);
                break;

            case PrizeType.Infantry:
            case PrizeType.Hero:
            case PrizeType.Vehicle:
            case PrizeType.Mercenary:
            {
                TroopTypeVO troopTypeVO = (TroopTypeVO)geometryVO;
                quality     = deployableShardUnlockController.GetUpgradeQualityForDeployable(troopTypeVO);
                title       = LangUtils.GetTroopDisplayName(troopTypeVO);
                description = LangUtils.GetTroopDescription(troopTypeVO);
                break;
            }

            case PrizeType.SpecialAttack:
            {
                SpecialAttackTypeVO specialAttackTypeVO = (SpecialAttackTypeVO)geometryVO;
                quality     = deployableShardUnlockController.GetUpgradeQualityForDeployable(specialAttackTypeVO);
                title       = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                description = LangUtils.GetStarshipDescription(specialAttackTypeVO);
                break;
            }

            case PrizeType.Crate:
            {
                CrateData crateData        = this.cp.Prizes.Crates.Available[id];
                string    crateDisplayName = LangUtils.GetCrateDisplayName(crateData.CrateId);
                title = this.lang.Get("CRATE_INVENTORY_CRATE_TITLE", new object[]
                    {
                        LangUtils.GetPlanetDisplayName(crateData.PlanetId),
                        crateDisplayName
                    });
                geometryVO = Service.StaticDataController.Get <CrateVO>(crateData.CrateId);
                break;
            }
            }
            return(this.CreateInventoryGridItem(id, prizeType, title, description, count, geometryVO, quality));
        }
예제 #3
0
 private void OnTournamentRankUpdated(TournamentRank oldRank, TournamentRank rank, string tournamentUID)
 {
     if (!this.isLoaded)
     {
         return;
     }
     if (this.currentEventState == TimedEventState.Closing)
     {
         this.endedTierTitleLabel.Text = base.LangController.Get("CONFLICT_YOUR_LEAGUE", new object[0]);
         this.UpdateEndedUI();
     }
     else
     {
         if (this.currentTournamentVO == null || this.currentTournamentVO.Uid != tournamentUID)
         {
             return;
         }
         TournamentTierVO optional      = base.Sdc.GetOptional <TournamentTierVO>(rank.TierUid);
         TournamentTierVO vOForNextTier = TournamentController.GetVOForNextTier(optional);
         TournamentTierVO idForTopTier  = TournamentController.GetIdForTopTier();
         Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);
         TournamentRewardsVO rewardGroup  = null;
         TournamentRewardsVO rewardGroup2 = null;
         TournamentRewardsVO rewardGroup3 = null;
         if (optional != null && vOForNextTier != null && idForTopTier != null && tierRewardMap.TryGetValue(optional.Uid, out rewardGroup) && tierRewardMap.TryGetValue(vOForNextTier.Uid, out rewardGroup2) && tierRewardMap.TryGetValue(idForTopTier.Uid, out rewardGroup3))
         {
             this.UpdateTierInfoUI(optional, optional.Percentage, this.inProgressCurrentTierIconSprite, this.inProgressCurrentTierLabel, this.inProgressCurrentTierPercentLabel);
             this.inProgressCurrentTierPercentLabel.Text = base.LangController.Get("CONFLICT_TIER_PERCENTILE", new object[]
             {
                 Math.Round(rank.Percentile, 2)
             });
             this.UpdateTierInfoUI(vOForNextTier, vOForNextTier.Percentage, this.inProgressNextTierIconSprite, this.inProgressNextTierLabel, this.inProgressNextTierPercentLabel);
             this.UpdateTierInfoUI(idForTopTier, idForTopTier.Percentage, this.inProgressTopTierIconSprite, this.inProgressTopTierLabel, this.inProgressTopTierPercentLabel);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup, this.inProgressCurrentRewardLabel, this.inProgressCurrentRewardSprite, this.inProgressCurrentRewardCrateSprite, this.inProgressCurrentRewardItemCardUnit, this.inProgressCurrentRewardItemCardBasic, this.inProgressCurrentRewardItemCardAdvanced, this.inProgressCurrentRewardItemCardElite, this.currentCrateCount, this.inProgressCurrentRewardDataFragSprite, null);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup2, this.inProgressNextRewardLabel, this.inProgressNextRewardSprite, this.inProgressNextRewardCrateSprite, this.inProgressNextRewardItemCardUnit, this.inProgressNextRewardItemCardBasic, this.inProgressNextRewardItemCardAdvanced, this.inProgressNextRewardItemCardElite, this.nextCrateCount, this.inProgressNextRewardDataFragSprite, null);
             TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup3, this.inProgressTopRewardLabel, this.inProgressTopRewardSprite, this.inProgressTopRewardCrateSprite, this.inProgressTopRewardItemCardUnit, this.inProgressTopRewardItemCardBasic, this.inProgressTopRewardItemCardAdvanced, this.inProgressTopRewardItemCardElite, this.topCrateCount, this.inProgressTopRewardDataFragSprite, null);
             this.AnimateShowNext();
         }
         else
         {
             Service.Logger.ErrorFormat("Unable to load InProgress UI, invalid tiers meta data for tournamentUID: " + tournamentUID, new object[0]);
         }
     }
 }
예제 #4
0
        private void OnInfoButtonClicked(UXButton button)
        {
            PrizeInventoryItemTag prizeInventoryItemTag = button.Tag as PrizeInventoryItemTag;
            IUpgradeableVO        finalUnitFromPrize    = TimedEventPrizeUtils.GetFinalUnitFromPrize(prizeInventoryItemTag.PrizeType, prizeInventoryItemTag.PrizeID);

            if (finalUnitFromPrize != null)
            {
                SmartEntity     availableTroopResearchLab = Service.BuildingLookupController.GetAvailableTroopResearchLab();
                TroopUpgradeTag troopUpgradeTag           = new TroopUpgradeTag(finalUnitFromPrize as IDeployableVO, true);
                bool            showUpgradeControls       = !string.IsNullOrEmpty(troopUpgradeTag.Troop.UpgradeShardUid);
                Service.ScreenController.AddScreen(new DeployableInfoScreen(troopUpgradeTag, null, showUpgradeControls, availableTroopResearchLab));
            }
            else
            {
                prizeInventoryItemTag.MainElement.Visible = false;
                prizeInventoryItemTag.InfoLabel.Visible   = true;
            }
            Service.EventManager.SendEvent(EventId.InfoButtonClicked, null);
        }
예제 #5
0
        private void OnTileClicked(UXButton button)
        {
            PrizeInventoryItemTag prizeInventoryItemTag = button.Tag as PrizeInventoryItemTag;

            if (prizeInventoryItemTag.InfoLabel.Visible)
            {
                prizeInventoryItemTag.InfoLabel.Visible   = false;
                prizeInventoryItemTag.MainElement.Visible = true;
                return;
            }
            if (prizeInventoryItemTag.PrizeType == PrizeType.None)
            {
                Service.Get <EventManager>().SendEvent(EventId.InventoryCrateStoreOpen, prizeInventoryItemTag.IconAssetName);
                Service.Get <ScreenController>().CloseAll();
                GameUtils.OpenStoreTreasureTab();
                return;
            }
            if (prizeInventoryItemTag.PrizeType == PrizeType.Crate)
            {
                button.Enabled = false;
                CrateData crateData = this.cp.Prizes.Crates.Available[prizeInventoryItemTag.PrizeID];
                GameUtils.OpenInventoryCrateModal(crateData, new OnScreenModalResult(this.OnCrateInfoModalClosed));
                Service.Get <EventManager>().SendEvent(EventId.InventoryCrateTapped, crateData.CrateId + "|" + crateData.UId);
                return;
            }
            int num = TimedEventPrizeUtils.TransferPrizeFromInventory(prizeInventoryItemTag.PrizeType, prizeInventoryItemTag.PrizeID);

            if (num > 0)
            {
                prizeInventoryItemTag.CountLabel.Text = string.Format("x{0}", new object[]
                {
                    num
                });
            }
            else if (num == 0)
            {
                this.itemGrid.RemoveItem(prizeInventoryItemTag.TileElement);
                base.DestroyElement(prizeInventoryItemTag.TileElement);
                this.itemGrid.RepositionItems();
            }
            this.ToggleEmptyTabMessage();
        }
예제 #6
0
        protected override void OnScreenLoaded()
        {
            this.InitButtons();
            this.InitLabels();
            this.HideParentPlayScreenCloseButton();
            this.Update();
            this.tierGrid = base.GetElement <UXGrid>("LeagueGrid");
            this.tierGrid.SetTemplateItem("LeagueTemplate");
            TournamentTierVO tournamentTierVO = null;

            if (this.currentPlayerRank != null && this.currentPlayerRank.TierUid != null)
            {
                tournamentTierVO = Service.StaticDataController.Get <TournamentTierVO>(this.currentPlayerRank.TierUid);
            }
            Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);

            for (int i = 0; i < this.tiers.Count; i++)
            {
                this.AddTier(this.tiers[i], tournamentTierVO == this.tiers[i], i, tierRewardMap);
            }
            this.tierGrid.RepositionItemsFrameDelayed(new UXDragDelegate(this.ScrollCallback));
            Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
        }
예제 #7
0
        private void UpdateComingSoonUI()
        {
            TournamentTierVO idForTopTier = TournamentController.GetIdForTopTier();

            if (idForTopTier == null)
            {
                return;
            }
            this.comingSoonTopTierTitle.Text        = base.LangController.Get("CONFLICT_TOP_LEAGUE", new object[0]);
            this.comingSoonTopRewardTitleLabel.Text = base.LangController.Get("CONFLICT_TOP_REWARD", new object[0]);
            this.UpdateTierInfoUI(idForTopTier, idForTopTier.Percentage, this.comingSoonTopTierIcon, this.comingSoonTopTierName, this.comingSoonTopTierPercent);
            Dictionary <string, TournamentRewardsVO> tierRewardMap = TimedEventPrizeUtils.GetTierRewardMap(this.currentTournamentVO.RewardGroupId);

            if (tierRewardMap.ContainsKey(idForTopTier.Uid))
            {
                TournamentRewardsVO rewardGroup = tierRewardMap[idForTopTier.Uid];
                TimedEventPrizeUtils.TrySetupConflictItemRewardView(rewardGroup, this.comingSoonTopRewardIconLabel, this.comingSoonTopRewardSprite, this.comingSoonTopRewardCrateSprite, this.comingSoonTopRewardItemCardUnit, this.comingSoonTopRewardItemCardBasic, this.comingSoonTopRewardItemCardAdvanced, this.comingSoonTopRewardItemCardElite, this.comingSoonCrateCount, this.comingSoonTopRewardDataFragIcon, this.comingSoonTopRewardLabel);
                this.AnimateShowNext();
            }
            else
            {
                Service.Logger.ErrorFormat("No Tournament to display reward on planet " + this.screen.viewingPlanetVO.Uid, new object[0]);
            }
        }
예제 #8
0
 private void UpdateRewards()
 {
     base.GetElement <UXLabel>("LabelRewardTitle").Text = this.lang.Get("CONFLICT_END_PRIZE", new object[0]);
     TimedEventPrizeUtils.TrySetupConflictEndedRewardView(this.tournament.RedeemedRewards, base.GetElement <UXLabel>("LabelReward"), base.GetElement <UXSprite>("SpriteReward"));
 }
예제 #9
0
        private void SetupConflictTransmission(TransmissionVO transmission)
        {
            this.battleLogTransmission.Visible = false;
            this.ShowGenericTransmissionGroup(false);
            this.conflictContainer.Visible            = true;
            this.squadWarEndedContainer.Visible       = false;
            this.genericTransmissionTextGroup.Visible = false;
            this.SetupTransmissionButtons(transmission);
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();

            this.conflictEndVO = dataController.GetOptional <TournamentVO>(transmission.TransData);
            TournamentTierVO optional = dataController.GetOptional <TournamentTierVO>(transmission.Btn1Data);

            if (this.conflictEndVO == null || optional == null)
            {
                return;
            }
            Tournament tournament = currentPlayer.TournamentProgress.GetTournament(this.conflictEndVO.Uid);

            if (tournament == null)
            {
                Service.Get <StaRTSLogger>().ErrorFormat("Tournament doesn't exist for player. tournament {0}", new object[]
                {
                    this.conflictEndVO.Uid
                });
                this.conflictMessage.Visible  = false;
                this.conflictTierIcon.Visible = false;
                return;
            }
            TournamentRank finalRank = tournament.FinalRank;
            string         text      = LangUtils.AppendPlayerFactionToKey("hn_conflict_end_message");

            this.conflictMessage.Visible  = true;
            this.conflictTierIcon.Visible = true;
            this.conflictMessage.Text     = this.lang.Get(text.ToString(), new object[]
            {
                LangUtils.GetPlanetDisplayName(this.conflictEndVO.PlanetId)
            });
            this.conflictTierIcon.SpriteName = Service.Get <TournamentController>().GetTierIconName(optional);
            this.conflictTierTitle.Text      = this.lang.Get("s_YourTier", new object[0]);
            this.conflictTierLevel.Text      = this.lang.Get("CONFLICT_LEAGUE_AND_DIVISION", new object[]
            {
                this.lang.Get(optional.RankName, new object[0]),
                this.lang.Get(optional.DivisionSmall, new object[0])
            });
            this.conflictTierPercent.Text = this.lang.Get("CONFLICT_TIER_PERCENTILE", new object[]
            {
                Math.Round(finalRank.Percentile, 2)
            });
            bool flag = TimedEventPrizeUtils.TrySetupConflictEndedRewardView(tournament.RedeemedRewards, this.holonetScreen.GetElement <UXLabel>("LabelReward"), this.holonetScreen.GetElement <UXSprite>("SpriteReward"));

            if (flag)
            {
                this.holonetScreen.GetElement <UXLabel>("LabelRewardTitle").Text = this.lang.Get("CONFLICT_END_PRIZE", new object[0]);
            }
            else
            {
                Service.Get <StaRTSLogger>().ErrorFormat("There is no reward given to player for tournament {0}", new object[]
                {
                    this.conflictEndVO.Uid
                });
            }
            Service.Get <ViewTimerManager>().CreateViewTimer(0.5f, false, new TimerDelegate(this.ShowReward), null);
        }
예제 #10
0
        private void OnInfoButtonClicked(UXButton button)
        {
            CrateSupplyVO crateSupply = (CrateSupplyVO)button.Tag;

            TimedEventPrizeUtils.HandleCrateSupplyRewardClicked(crateSupply);
        }