public void OnViewFrameTime(float dt) { List <UXElement> elementList = this.gridWarLog.GetElementList(); SquadController squadController = Service.SquadController; uint serverTime = Service.ServerAPI.ServerTime; SquadMemberWarData currentMemberWarData = squadController.WarManager.GetCurrentMemberWarData(); int i = 0; int count = elementList.Count; while (i < count) { string text = elementList[i].Tag as string; UXLabel subElement = this.gridWarLog.GetSubElement <UXLabel>(text, "LabelWarlogExpires"); SquadWarRewardData rewardForWar = SquadUtils.GetRewardForWar(text, currentMemberWarData); if (rewardForWar != null) { int num = (int)(rewardForWar.ExpireDate - serverTime); if (num < 0) { this.HideCollectButton(text); } else { string text2 = LangUtils.FormatTime((long)num); subElement.Visible = true; subElement.Text = text2; } } else { this.HideCollectButton(text); } i++; } }
private string GetDisplayValueForPerk(PerkEffectVO vo) { string type = vo.Type; string result = string.Empty; if ("troopRequestTime" == type) { result = LangUtils.FormatTime((long)vo.TroopRequestTimeDiscount); } else if ("generator" == type) { result = Mathf.FloorToInt(vo.GenerationRate * 100f).ToString(); } else if ("contractCost" == type) { result = Mathf.FloorToInt(vo.ContractDiscount * 100f).ToString(); } else if ("contractTime" == type) { result = Mathf.FloorToInt(vo.ContractTimeReduction * 100f).ToString(); } else if ("relocation" == type) { result = vo.RelocationDiscount.ToString(); } else if ("troopRequestAmount" == type) { result = vo.TroopRequestAmount.ToString(); } return(result); }
private void UpdateTimeRemaining() { if (this.currentTournamentVO == null) { return; } int secondsRemaining = TimedEventUtils.GetSecondsRemaining(this.currentTournamentVO); string text = LangUtils.FormatTime((long)secondsRemaining); TimedEventState timedEventState = this.currentEventState; if (timedEventState != TimedEventState.Upcoming) { if (timedEventState == TimedEventState.Live) { this.inProgressEventTimerLabel.Text = base.LangController.Get("CAMPAIGN_ENDS_IN", new object[] { text }); this.comingSoonEventTimerLabel.Text = base.LangController.Get("CAMPAIGN_ENDS_IN", new object[] { text }); } } else { this.comingSoonEventTimerLabel.Text = base.LangController.Get("CAMPAIGN_BEGINS_IN", new object[] { text }); } }
private void Update() { int num = 0; string text = null; TimedEventState state = TimedEventUtils.GetState(this.currentTournamentVO); if (state != TimedEventState.Upcoming) { if (state == TimedEventState.Live) { text = "CAMPAIGN_ENDS_IN"; num = TimedEventUtils.GetSecondsRemaining(this.currentTournamentVO); } } else { text = "CAMPAIGN_BEGINS_IN"; num = TimedEventUtils.GetSecondsRemaining(this.currentTournamentVO); } if (text != null) { this.countdownLabel.Text = this.lang.Get(text, new object[] { LangUtils.FormatTime((long)num) }); return; } if (this.countdownLabel.Visible) { this.countdownLabel.Visible = false; } }
private void UpdateRaidTimer() { RaidDefenseController raidDefenseController = Service.RaidDefenseController; this.raidTimer.Text = this.lang.Get(this.raidTimerText, new object[] { LangUtils.FormatTime((long)raidDefenseController.GetRaidTimeSeconds()) }); }
private void UpdatePerkTimer(UXElement item) { ActivatedPerkData activatedPerkData = (ActivatedPerkData)item.Tag; UXLabel subElement = this.perksGrid.GetSubElement <UXLabel>(activatedPerkData.PerkId, "LabelTimerModalActivePerks"); int num = (int)(activatedPerkData.EndTime - ServerTime.Time); if (num < 1) { this.needsPerkStateRefresh = true; } string text = LangUtils.FormatTime((long)num); subElement.Text = text; }
private void UpdateLabelTimeRemaining(UXLabel label, Lang lang, string locKey, uint endTime) { if (ServerTime.Time > endTime) { this.needsPerkStatesRefresh = true; } int num = (int)(endTime - ServerTime.Time); string text = LangUtils.FormatTime((long)num); label.Text = lang.Get(locKey, new object[] { text }); }
private void OnCooldownButtonClicked(UXButton button) { if (base.ShouldBlockInput()) { return; } this.lastGridPosition = this.perksGrid.GetCurrentScrollPosition(true); PerkVO perkVO = (PerkVO)button.Tag; string uid = perkVO.Uid; string perkNameForGroup = Service.PerkViewController.GetPerkNameForGroup(perkVO.PerkGroup); int perkCooldownTimeLeft = this.GetPerkCooldownTimeLeft(uid); string crystalCost = GameUtils.SecondsToCrystalsForPerk(perkCooldownTimeLeft).ToString(); Service.PerkManager.ConfirmPurchaseCooldownSkip(uid, perkNameForGroup, LangUtils.FormatTime((long)perkCooldownTimeLeft), crystalCost); }
private void UpdateLabelTimeRemaining(UXLabel label) { int timeRemainingUntilNextProgressTrack = Service.Get <TroopDonationTrackController>().GetTimeRemainingUntilNextProgressTrack(); if (timeRemainingUntilNextProgressTrack <= 0) { this.ShowRepProgressDonationState(); } string text = LangUtils.FormatTime((long)timeRemainingUntilNextProgressTrack); label.Text = this.lang.Get("PERK_CHAT_DONATE_TIMER", new object[] { text }); }
private void SetBoundedTimer(long delay, TimerDelegate callback, bool warnIfExceeds = false) { if (delay > 0L && delay <= 432000L) { Service.ViewTimerManager.CreateViewTimer((float)delay, false, callback, null); } else if (warnIfExceeds) { Service.Logger.WarnFormat("Targeted offer tried to set a timer exceeding TimerManager.MAX_DELAY ({0}): {1} ({2})", new object[] { LangUtils.FormatTime(432000L), LangUtils.FormatTime(delay), delay }); } }
private void UpdateTimer() { string text; if (!string.IsNullOrEmpty(this.timerTextID)) { text = this.lang.Get(this.timerTextID, new object[] { LangUtils.FormatTime((long)this.timerEndSeconds) }); } else { text = LangUtils.FormatTime((long)this.timerEndSeconds); } this.labelTimer.Text = text; }
private void UpdateCountDownTimer() { TroopDonationTrackController troopDonationTrackController = Service.Get <TroopDonationTrackController>(); int timeRemainingUntilNextProgressTrack = troopDonationTrackController.GetTimeRemainingUntilNextProgressTrack(); if (timeRemainingUntilNextProgressTrack <= 0) { this.RefreshTroopDonationProgress(); return; } string text = LangUtils.FormatTime((long)timeRemainingUntilNextProgressTrack); this.countdownTimerLabel.Text = this.lang.Get("PERK_CHAT_DONATE_TIMER", new object[] { text }); }
private void UpdateTimeRemaining() { TimedEventState state = TimedEventUtils.GetState(this.Campaign); string text = ""; switch (state) { case TimedEventState.Upcoming: { int num = TimedEventUtils.GetSecondsRemaining(this.Campaign); string text2 = LangUtils.FormatTime((long)num); text = this.lang.Get("CAMPAIGN_BEGINS_IN", new object[] { text2 }); break; } case TimedEventState.Live: { int num = TimedEventUtils.GetSecondsRemaining(this.Campaign); string text2 = LangUtils.FormatTime((long)num); text = this.lang.Get("CAMPAIGN_ENDS_IN", new object[] { text2 }); break; } case TimedEventState.Closing: { int num = TimedEventUtils.GetStoreSecondsRemaining(this.Campaign); string text2 = LangUtils.FormatTime((long)num); text = this.lang.Get("REWARD_DURATION", new object[] { text2 }); break; } } if (!string.IsNullOrEmpty(text)) { this.label.Text = UXUtils.WrapTextInColor(text, this.timerColor); } }
private void UpdateActivationTimeRemaining() { uint endTime = this.activatedPerkData.EndTime; if (ServerTime.Time > endTime) { this.activationTimerLabel.Visible = false; Service.Get <ViewTimeEngine>().UnregisterClockTimeObserver(this); return; } int num = (int)(endTime - ServerTime.Time); string text = LangUtils.FormatTime((long)num); this.activationTimerLabel.Text = Service.Get <Lang>().Get("PERK_ACTIVATE_POPUP_TIMER", new object[] { text }); }
private void UpdateTimeText() { uint serverTime = Service.ServerAPI.ServerTime; int num = this.endTimeStamp - (int)serverTime; string text = string.Empty; if (!string.IsNullOrEmpty(this.timerTextUID)) { text = this.lang.Get(this.timerTextUID, new object[] { LangUtils.FormatTime((long)num) }); } else { text = LangUtils.FormatTime((long)num); } this.labelTimer.Text = text; }
public void OnViewFrameTime(float dt) { if (this.selectedPlanet == null) { return; } TournamentVO activeTournamentOnPlanet = TournamentController.GetActiveTournamentOnPlanet(this.selectedPlanet.Uid); if (activeTournamentOnPlanet != null) { TimedEventState state = TimedEventUtils.GetState(activeTournamentOnPlanet); if (state == TimedEventState.Live) { int secondsRemaining = TimedEventUtils.GetSecondsRemaining(activeTournamentOnPlanet); string text = LangUtils.FormatTime((long)secondsRemaining); this.labelUnlockPlanetTimer.Text = this.lang.Get("PLANETS_GNC_UPGRADE_CONFLICT_ENDS", new object[] { text }); } else if (state == TimedEventState.Upcoming) { int secondsRemaining2 = TimedEventUtils.GetSecondsRemaining(activeTournamentOnPlanet); string text2 = LangUtils.FormatTime((long)secondsRemaining2); this.labelUnlockPlanetTimer.Text = this.lang.Get("PLANETS_GNC_UPGRADE_NEXT_CONFLICT_BEGINS", new object[] { text2 }); } else { this.labelUnlockPlanetTimer.Text = string.Empty; } } else { this.labelUnlockPlanetTimer.Text = string.Empty; } }
private void UpdateFromTargetedOfferSummary(TargetedOfferSummary offerSummary) { DateTime serverDateTime = Service.Get <ServerAPI>().ServerDateTime; IDataController dataController = Service.Get <IDataController>(); bool flag = false; TargetedBundleVO targetedBundleVO = null; if (!string.IsNullOrEmpty(offerSummary.AvailableOffer)) { string availableOffer = offerSummary.AvailableOffer; targetedBundleVO = dataController.GetOptional <TargetedBundleVO>(availableOffer); if (targetedBundleVO != null) { flag = targetedBundleVO.IgnoreCooldown; } } int secondsFromEpoch = DateUtils.GetSecondsFromEpoch(serverDateTime); uint globalCooldownExpiresAt = offerSummary.GlobalCooldownExpiresAt; if (!flag && globalCooldownExpiresAt != 0u && (long)secondsFromEpoch < (long)((ulong)globalCooldownExpiresAt)) { Service.Get <StaRTSLogger>().DebugFormat("Offer global cooldown is in effect until {0}", new object[] { LangUtils.FormatTime((long)offerSummary.GlobalCooldownExpiresAt) }); this.GlobalCooldownExpiresAt = offerSummary.GlobalCooldownExpiresAt; this.OfferExpiresAt = 0u; this.NextOfferAvailableAt = 0u; this.SetBoundedTimer((long)((ulong)this.GlobalCooldownExpiresAt - (ulong)((long)secondsFromEpoch)), new TimerDelegate(this.CheckForNewOffer), false); } else if (targetedBundleVO != null) { Service.Get <StaRTSLogger>().DebugFormat("Available offer: {0}", new object[] { offerSummary.AvailableOffer }); if (targetedBundleVO.StartTime <= serverDateTime && serverDateTime < targetedBundleVO.EndTime && AudienceConditionUtils.IsValidForClient(targetedBundleVO.AudienceConditions)) { this.InitializeTriggerOffer(targetedBundleVO); } else { Service.Get <StaRTSLogger>().WarnFormat("Server provided offer {0} was outside of date range {1} to {2}.", new object[] { offerSummary.AvailableOffer, targetedBundleVO.StartTime, targetedBundleVO.EndTime }); } } else if (offerSummary.NextOfferAvailableAt > 0u) { Service.Get <StaRTSLogger>().DebugFormat("Next offer available at {0}.", new object[] { LangUtils.FormatTime((long)offerSummary.NextOfferAvailableAt) }); this.NextOfferAvailableAt = offerSummary.NextOfferAvailableAt; this.GlobalCooldownExpiresAt = 0u; this.OfferExpiresAt = 0u; this.SetBoundedTimer((long)((ulong)this.NextOfferAvailableAt - (ulong)((long)DateUtils.GetSecondsFromEpoch(serverDateTime))), new TimerDelegate(this.CheckForNewOffer), false); } else { this.GlobalCooldownExpiresAt = 0u; this.OfferExpiresAt = 0u; this.NextOfferAvailableAt = 0u; } this.lastKnownTargetedOffer = null; this.FetchingNewOffer = false; if (this.CurrentTargetedOffer != null) { Service.Get <EventManager>().SendEvent(EventId.TargetedBundleContentPrepared, null); } }
public override void RefreshView() { this.gridWarLog.Clear(); SquadController squadController = Service.SquadController; Squad currentSquad = squadController.StateManager.GetCurrentSquad(); if (currentSquad == null) { return; } uint serverTime = Service.ServerAPI.ServerTime; SquadMemberWarData currentMemberWarData = squadController.WarManager.GetCurrentMemberWarData(); int i = 0; int count = currentSquad.WarHistory.Count; while (i < count) { SquadWarHistoryEntry squadWarHistoryEntry = currentSquad.WarHistory[i]; UXElement uXElement = this.gridWarLog.CloneTemplateItem(squadWarHistoryEntry.WarId); this.gridWarLog.AddItem(uXElement, i); uXElement.Tag = squadWarHistoryEntry.WarId; SquadWarRewardData rewardForWar = SquadUtils.GetRewardForWar(squadWarHistoryEntry.WarId, currentMemberWarData); UXButton subElement = this.gridWarLog.GetSubElement <UXButton>(squadWarHistoryEntry.WarId, "BtnCollectWarReward"); UXLabel subElement2 = this.gridWarLog.GetSubElement <UXLabel>(squadWarHistoryEntry.WarId, "LabelBtnCollectWarReward"); subElement2.Text = this.lang.Get("SQUAD_WAR_LOG_COLLECT_REWARD", new object[0]); UXLabel subElement3 = this.gridWarLog.GetSubElement <UXLabel>(squadWarHistoryEntry.WarId, "LabelWarlogTimestamp"); subElement3.Text = this.lang.Get("TIME_AGO", new object[] { ChatTimeConversionUtils.GetFormattedAge(squadWarHistoryEntry.EndDate, this.lang) }); UXLabel subElement4 = this.gridWarLog.GetSubElement <UXLabel>(squadWarHistoryEntry.WarId, "LabelWarlogScore"); subElement4.Text = this.lang.Get("SQUAD_WAR_LOG_SCORE", new object[] { squadWarHistoryEntry.Score, squadWarHistoryEntry.OpponentScore }); UXLabel subElement5 = this.gridWarLog.GetSubElement <UXLabel>(squadWarHistoryEntry.WarId, "LabelWarlogOpponent"); string text = string.Empty; if (!string.IsNullOrEmpty(squadWarHistoryEntry.OpponentName)) { text = this.lang.Get("SQUAD_WAR_LOG_OPPONENT_VS", new object[] { squadWarHistoryEntry.OpponentName }); } subElement5.Text = text; UXLabel subElement6 = this.gridWarLog.GetSubElement <UXLabel>(squadWarHistoryEntry.WarId, "LabelWarlogExpires"); bool flag = rewardForWar != null && rewardForWar.ExpireDate > serverTime; if (flag) { int num = (int)(rewardForWar.ExpireDate - serverTime); string text2 = LangUtils.FormatTime((long)num); subElement6.Visible = true; text2 = this.lang.Get("expires_in", new object[] { text2 }); subElement6.Text = text2; subElement.Visible = true; subElement.OnClicked = new UXButtonClickedDelegate(this.OnCollectButtonClicked); subElement.Tag = rewardForWar.WarId; } else { subElement6.Visible = false; subElement.Visible = false; } UXSprite subElement7 = this.gridWarLog.GetSubElement <UXSprite>(squadWarHistoryEntry.WarId, "SpriteWarlogBgDraw"); subElement7.Visible = false; UXSprite subElement8 = this.gridWarLog.GetSubElement <UXSprite>(squadWarHistoryEntry.WarId, "SpriteWarlogBgLost"); subElement8.Visible = false; UXSprite subElement9 = this.gridWarLog.GetSubElement <UXSprite>(squadWarHistoryEntry.WarId, "SpriteWarlogBgWon"); subElement9.Visible = false; UXLabel subElement10 = this.gridWarLog.GetSubElement <UXLabel>(squadWarHistoryEntry.WarId, "LabelWarlogResult"); if (squadWarHistoryEntry.Score > squadWarHistoryEntry.OpponentScore) { subElement9.Visible = true; subElement10.Text = this.lang.Get("SQUAD_WAR_LOG_WIN", new object[0]); } else if (squadWarHistoryEntry.Score < squadWarHistoryEntry.OpponentScore) { subElement8.Visible = true; subElement10.Text = this.lang.Get("SQUAD_WAR_LOG_LOSS", new object[0]); } else { subElement7.Visible = true; subElement10.Text = this.lang.Get("SQUAD_WAR_LOG_DRAW", new object[0]); } i++; } this.gridWarLog.RepositionItemsFrameDelayed(); if (currentSquad.WarHistory.Count == 0) { this.labelEmptyWarlog.Visible = true; if (SquadUtils.SquadMeetsMatchmakingRequirements(squadController)) { this.labelEmptyWarlog.Text = this.lang.Get("SQUAD_WAR_LOG_EMPTY_HAS_REQUIREMENTS", new object[0]); } else { this.labelEmptyWarlog.Text = this.lang.Get("SQUAD_WAR_LOG_EMPTY_LACKS_REQUIREMENTS", new object[0]); } } else { this.labelEmptyWarlog.Visible = false; } this.RefreshBadge(); }