private void RefreshTroopDonationProgress() { TroopDonationTrackController troopDonationTrackController = Service.Get <TroopDonationTrackController>(); bool flag = troopDonationTrackController.IsTroopDonationProgressComplete(); this.completeGroup.Visible = flag; this.progressGroup.Visible = !flag; if (flag) { Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f); this.UpdateCountDownTimer(); return; } Service.Get <ViewTimeEngine>().UnregisterClockTimeObserver(this); this.UpdateInProgress(); }
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 UpdateInProgress() { TroopDonationTrackController troopDonationTrackController = Service.Get <TroopDonationTrackController>(); int num = troopDonationTrackController.GetTroopDonationProgressAmount(); int sQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD = GameConstants.SQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD; if (num > sQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD) { num = sQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD; } this.progressAmountLabel.Text = this.lang.Get("PERK_CHAT_DONATE_PROGRESS", new object[] { num, sQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD }); this.progressBar.Value = (float)num / (float)sQUADPERK_DONATION_REPUTATION_AWARD_THRESHOLD; }