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");
        }
        public SquadWarSquadType GetCurrentDisplaySquad()
        {
            SquadWarManager    warManager    = Service.Get <SquadController>().WarManager;
            SquadWarStatusType currentStatus = warManager.GetCurrentStatus();
            SquadWarSquadType  result        = SquadWarSquadType.PLAYER_SQUAD;

            if (currentStatus == SquadWarStatusType.PhasePrep || currentStatus == SquadWarStatusType.PhasePrepGrace)
            {
                result = SquadWarSquadType.PLAYER_SQUAD;
            }
            else if (currentStatus == SquadWarStatusType.PhaseAction || currentStatus == SquadWarStatusType.PhaseActionGrace || currentStatus == SquadWarStatusType.PhaseCooldown)
            {
                result = SquadWarSquadType.OPPONENT_SQUAD;
            }
            return(result);
        }
        public void ShowWarBuildings(SquadWarSquadType squadType, bool deselectSelectedBuilding)
        {
            bool flag = squadType == SquadWarSquadType.PLAYER_SQUAD;
            Dictionary <SquadWarBoardBuilding, SquadWarParticipantState> dictionary = flag ? this.participantBuildingsPlayer : this.participantBuildingsOpponent;

            if (dictionary != null)
            {
                foreach (KeyValuePair <SquadWarBoardBuilding, SquadWarParticipantState> current in this.participantBuildingsPlayer)
                {
                    current.get_Key().ToggleVisibility(flag);
                }
                foreach (KeyValuePair <SquadWarBoardBuilding, SquadWarParticipantState> current2 in this.participantBuildingsOpponent)
                {
                    current2.get_Key().ToggleVisibility(!flag);
                }
                this.currentSquadType = squadType;
                if (deselectSelectedBuilding)
                {
                    this.DeselectSelectedBuilding();
                }
            }
        }
        private void InitializeWarBoardBuildings()
        {
            SquadWarSquadType currentDisplaySquad = this.GetCurrentDisplaySquad();

            Service.Get <WarBoardBuildingController>().ShowWarBuildings(currentDisplaySquad, true);
        }