Exemplo n.º 1
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id != EventId.WorldInTransitionComplete)
     {
         if (id == EventId.PlanetRelocate)
         {
             this.CurrentPlanetActiveTournament = this.GetActiveTournamentOnCurrentPlanet();
         }
     }
     else if (Service.Get <GameStateMachine>().CurrentState is HomeState)
     {
         if (this.showConflictPopup)
         {
             this.showConflictPopup = false;
             this.SetConflictPopupIsShown();
             AlertScreen.ShowModal(false, null, Service.Get <Lang>().Get("VICTORY_BONUS_MESSAGE", new object[0]), null, null);
         }
         else if (this.NotifyEndForTournamentVO != null)
         {
             this.ShowTournamentEnded();
         }
         else
         {
             TournamentRank tournamentCurrentRank = this.currentPlayer.TournamentProgress.GetTournamentCurrentRank(this.CurrentPlanetActiveTournament.Uid);
             Service.Get <ScreenController>().AddScreen(new TournamentTierChangedScreen(tournamentCurrentRank));
             string newValue = ServerTime.Time.ToString();
             Service.Get <ServerPlayerPrefs>().SetPref(ServerPref.TournamentTierChangeTimeViewed, newValue);
             SetPrefsCommand command = new SetPrefsCommand(false);
             Service.Get <ServerAPI>().Enqueue(command);
         }
         Service.Get <EventManager>().UnregisterObserver(this, EventId.WorldInTransitionComplete);
     }
     return(EatResponse.NotEaten);
 }
Exemplo n.º 2
0
 public TournamentEndedScreen(Tournament tournament) : base("gui_tournaments")
 {
     this.tournament   = tournament;
     this.tournamentVO = Service.StaticDataController.Get <TournamentVO>(tournament.Uid);
     this.playerRank   = tournament.FinalRank;
     this.tierVO       = Service.StaticDataController.Get <TournamentTierVO>(this.playerRank.TierUid);
 }
Exemplo n.º 3
0
        private void UpdateCurrentTournamentTier()
        {
            TournamentRank tournamentFinalRank = base.Player.TournamentProgress.GetTournamentFinalRank(this.currentTournamentVO.Uid);

            if (tournamentFinalRank != null && !string.IsNullOrEmpty(tournamentFinalRank.TierUid))
            {
                this.OnTournamentRankUpdated(null, tournamentFinalRank, this.currentTournamentVO.Uid);
            }
            else
            {
                UXLabel arg_90_0 = this.endedTierLabel;
                string  text     = base.LangController.Get("CONFLICT_TIER_LOADING", new object[0]);
                this.inProgressTopTierLabel.Text = text;
                text = text;
                this.inProgressNextTierLabel.Text = text;
                text = text;
                this.inProgressCurrentTierLabel.Text = text;
                arg_90_0.Text = text;
                UXLabel arg_CD_0 = this.inProgressCurrentRewardLabel;
                text = base.LangController.Get("s_Loading", new object[0]);
                this.inProgressTopRewardLabel.Text = text;
                text = text;
                this.inProgressNextRewardLabel.Text = text;
                arg_CD_0.Text = text;
                UXSprite arg_131_0 = this.inProgressNextTierIconSprite;
                text = string.Empty;
                this.endedTierIconSprite.SpriteName = text;
                text = text;
                this.inProgressTopRewardSprite.SpriteName = text;
                text = text;
                this.inProgressNextRewardSprite.SpriteName = text;
                text = text;
                this.inProgressCurrentRewardSprite.SpriteName = text;
                text = text;
                this.inProgressTopTierIconSprite.SpriteName = text;
                text = text;
                this.inProgressCurrentTierIconSprite.SpriteName = text;
                arg_131_0.SpriteName = text;
                UXLabel arg_16B_0 = this.endedTierPercentLabel;
                text = string.Empty;
                this.inProgressTopTierPercentLabel.Text = text;
                text = text;
                this.inProgressNextTierPercentLabel.Text = text;
                text = text;
                this.inProgressCurrentTierPercentLabel.Text = text;
                arg_16B_0.Text = text;
                this.inProgressCurrentRewardItemCardBasic.Visible    = false;
                this.inProgressCurrentRewardItemCardAdvanced.Visible = false;
                this.inProgressCurrentRewardItemCardElite.Visible    = false;
                this.inProgressNextRewardItemCardBasic.Visible       = false;
                this.inProgressNextRewardItemCardAdvanced.Visible    = false;
                this.inProgressNextRewardItemCardElite.Visible       = false;
                this.inProgressTopRewardItemCardBasic.Visible        = false;
                this.inProgressTopRewardItemCardAdvanced.Visible     = false;
                this.inProgressTopRewardItemCardElite.Visible        = false;
                this.tournamentController.UpdatePlayerRank(new TournamentController.PlayerRankUpdatedCallback(this.OnTournamentRankUpdated), this.currentTournamentVO);
            }
        }
Exemplo n.º 4
0
 private void CheckForTierChangeAfterBattle(TournamentRank oldRank, TournamentRank rank, string tournamentUID)
 {
     if (oldRank != null && !string.IsNullOrEmpty(oldRank.TierUid))
     {
         IDataController  dataController    = Service.Get <IDataController>();
         TournamentTierVO tournamentTierVO  = dataController.Get <TournamentTierVO>(oldRank.TierUid);
         TournamentTierVO tournamentTierVO2 = dataController.Get <TournamentTierVO>(rank.TierUid);
         if (tournamentTierVO2.Percentage < tournamentTierVO.Percentage)
         {
             Service.Get <EventManager>().RegisterObserver(this, EventId.WorldInTransitionComplete, EventPriority.Default);
         }
     }
 }
Exemplo n.º 5
0
        private void OnGetTournamentRank(TournamentRankResponse rankResponse, object cookie)
        {
            TournamentRank tournamentRank          = rankResponse.Rank;
            TournamentRank oldRank                 = null;
            Tournament     tournament              = null;
            Dictionary <string, object> dictionary = (Dictionary <string, object>)cookie;
            string text = (string)dictionary["tournamentId"];

            TournamentController.PlayerRankUpdatedCallback playerRankUpdatedCallback = (TournamentController.PlayerRankUpdatedCallback)dictionary["callback"];
            if (!string.IsNullOrEmpty(text))
            {
                tournament             = this.currentPlayer.TournamentProgress.GetTournament(text);
                oldRank                = tournament.CurrentRank;
                tournament.CurrentRank = tournamentRank;
                tournament.Sync(rankResponse.TournamentData);
            }
            if (tournamentRank == null)
            {
                tournamentRank = new TournamentRank();
                if (tournament != null)
                {
                    tournament.CurrentRank = tournamentRank;
                }
            }
            if (string.IsNullOrEmpty(tournamentRank.TierUid))
            {
                TournamentTierVO tournamentTierVO = null;
                IDataController  dataController   = Service.Get <IDataController>();
                foreach (TournamentTierVO current in dataController.GetAll <TournamentTierVO>())
                {
                    if (tournamentTierVO == null || current.Percentage > tournamentTierVO.Percentage)
                    {
                        tournamentTierVO       = current;
                        tournamentRank.TierUid = tournamentTierVO.Uid;
                    }
                }
                if (tournamentTierVO != null)
                {
                    tournamentRank.Percentile = (double)tournamentTierVO.Percentage;
                }
                else
                {
                    tournamentRank.Percentile = 100.0;
                }
            }
            if (playerRankUpdatedCallback != null)
            {
                playerRankUpdatedCallback(oldRank, tournamentRank, text);
            }
        }
Exemplo n.º 6
0
 public void Sync(Tournament tournament)
 {
     if (tournament == null)
     {
         return;
     }
     if (base.Uid != tournament.Uid)
     {
         Service.Get <StaRTSLogger>().Error("Trying to sync mismatched tournament data.");
         return;
     }
     base.Collected       = tournament.Collected;
     this.Rating          = tournament.Rating;
     this.FinalRank       = tournament.FinalRank;
     this.RedeemedRewards = new List <string>(tournament.RedeemedRewards);
 }
        public TournamentTiersScreen(TournamentVO tournamentVO, Tournament tournament) : base("gui_conflict_leagues")
        {
            Dictionary <string, TournamentTierVO> .ValueCollection all = Service.Get <IDataController>().GetAll <TournamentTierVO>();
            this.tiers = new List <TournamentTierVO>();
            foreach (TournamentTierVO current in all)
            {
                this.tiers.Add(current);
            }
            this.tiers.Sort(new Comparison <TournamentTierVO>(this.CompareTiers));
            this.particleElements    = new List <string>();
            this.currentTournamentVO = tournamentVO;
            this.currentPlayerRank   = ((tournament != null) ? tournament.CurrentRank : null);
            EventManager eventManager = Service.Get <EventManager>();

            eventManager.RegisterObserver(this, EventId.ScreenLoaded, EventPriority.Default);
            eventManager.RegisterObserver(this, EventId.ScreenClosing, EventPriority.Default);
        }
Exemplo n.º 8
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]);
         }
     }
 }
Exemplo n.º 9
0
 public TournamentTierChangedScreen(TournamentRank rank) : base("gui_tournaments_celebration")
 {
     this.playerRank = rank;
 }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
 public Tournament()
 {
     this.RedeemedRewards = new List <string>();
     this.CurrentRank     = new TournamentRank();
     this.FinalRank       = new TournamentRank();
 }