Exemplo n.º 1
0
        public override void RefreshView()
        {
            if (!base.IsLoaded())
            {
                return;
            }
            SquadWarManager   warManager       = Service.Get <SquadController>().WarManager;
            SquadWarSquadType participantSquad = warManager.GetParticipantSquad(this.participantState.SquadMemberId);
            SquadWarSquadData squadData        = warManager.GetSquadData(participantSquad);

            this.playerNameLabel.Text = this.lang.Get("WAR_PLAYER_DETAILS_NAME", new object[]
            {
                this.participantState.SquadMemberName,
                this.participantState.HQLevel
            });
            this.attacksRemainingLabel.Text = this.lang.Get("WAR_PLAYER_DETAILS_TURNS_LEFT", new object[]
            {
                this.participantState.TurnsLeft
            });
            this.uplinksAvailableLabel.Text = this.lang.Get("WAR_PLAYER_DETAILS_POINTS_LEFT", new object[]
            {
                this.participantState.VictoryPointsLeft
            });
            FactionIconUpgradeController factionIconUpgradeController = Service.Get <FactionIconUpgradeController>();
            int    rating = GameUtils.CalculateVictoryRating(this.participantState.AttacksWon, this.participantState.DefensesWon);
            string icon   = factionIconUpgradeController.GetIcon(squadData.Faction, rating);

            if (factionIconUpgradeController.UseUpgradeImage(rating))
            {
                this.factionSprite.SpriteName     = icon;
                this.factionSprite.Visible        = true;
                this.factionDefaultSprite.Visible = false;
            }
            else
            {
                this.factionSprite.Visible           = false;
                this.factionDefaultSprite.Visible    = true;
                this.factionDefaultSprite.SpriteName = icon;
            }
            string empty = string.Empty;

            if (warManager.CanScoutWarMember(this.participantState.SquadMemberId, ref empty))
            {
                this.scoutButton.VisuallyEnableButton();
                this.scoutButtonLabel.TextColor = this.scoutButtonLabel.OriginalTextColor;
            }
            else
            {
                this.scoutButton.VisuallyDisableButton();
                this.scoutButtonLabel.TextColor = UXUtils.COLOR_LABEL_DISABLED;
            }
            this.UpdateUplinkHelper(0, this.participantState.VictoryPointsLeft >= 3, "WAR_PLAYER_DETAILS_REQ_1");
            this.UpdateUplinkHelper(1, this.participantState.VictoryPointsLeft >= 2, "WAR_PLAYER_DETAILS_REQ_2");
            this.UpdateUplinkHelper(2, this.participantState.VictoryPointsLeft >= 1, "WAR_PLAYER_DETAILS_REQ_3");
        }