Exemplo n.º 1
0
        private static BattleInitializationData CreateBuffBaseBattleFromBattleTypeVO(string id, SquadWarBuffBaseData buffBaseData)
        {
            BattleInitializationData battleInitializationData = BattleInitializationData.CreateFromBattleTypeVO(id);

            battleInitializationData.BattleType                   = BattleType.PveBuffBase;
            battleInitializationData.Attacker.GuildId             = Service.SquadController.StateManager.GetCurrentSquad().SquadID;
            battleInitializationData.AttackerGuildTroopsAvailable = BattleInitializationData.GetCurrentPlayerGuildTroops();
            SquadWarManager warManager = Service.SquadController.WarManager;

            battleInitializationData.AttackerWarBuffs = warManager.GetBuffBasesOwnedBySquad(battleInitializationData.Attacker.GuildId);
            battleInitializationData.DefenderWarBuffs = null;
            SquadWarSquadData squadData  = warManager.GetSquadData(SquadWarSquadType.PLAYER_SQUAD);
            SquadWarSquadData squadData2 = warManager.GetSquadData(SquadWarSquadType.OPPONENT_SQUAD);
            string            ownerId    = buffBaseData.OwnerId;

            if (!string.IsNullOrEmpty(ownerId))
            {
                if (ownerId == squadData2.SquadId)
                {
                    battleInitializationData.Defender.PlayerFaction = squadData2.Faction;
                }
                else if (ownerId == squadData.SquadId)
                {
                    battleInitializationData.Defender.PlayerFaction = squadData.Faction;
                }
            }
            else
            {
                battleInitializationData.Defender.PlayerFaction = FactionType.Smuggler;
            }
            battleInitializationData.AttackerEquipment = BattleInitializationData.GetCurrentPlayerEquipment(battleInitializationData.PlanetId);
            battleInitializationData.DefenderEquipment = null;
            return(battleInitializationData);
        }
        public void ShowBuildings(List <Transform> warBuildingLocators)
        {
            if (this.assetHandles == null)
            {
                this.assetHandles = new List <AssetHandle>();
            }
            if (this.outline == null)
            {
                this.outline = new OutlinedAsset();
            }
            this.pressedBuilding     = null;
            this.pressTimerId        = 0u;
            this.pressScreenPosition = Vector2.zero;
            this.selectedBuilding    = null;
            this.dragged             = false;
            this.CacheHQBuildingIds();
            BuildingUpgradeCatalog catalog      = Service.Get <BuildingUpgradeCatalog>();
            AssetManager           assetManager = Service.Get <AssetManager>();
            SquadWarManager        warManager   = Service.Get <SquadController>().WarManager;
            SquadWarSquadData      squadData    = warManager.GetSquadData(SquadWarSquadType.PLAYER_SQUAD);

            this.AddBuildingsForParticipants(squadData, true, catalog, assetManager, warBuildingLocators);
            SquadWarSquadData squadData2 = warManager.GetSquadData(SquadWarSquadType.OPPONENT_SQUAD);

            this.AddBuildingsForParticipants(squadData2, false, catalog, assetManager, warBuildingLocators);
            Service.Get <UserInputManager>().RegisterObserver(this, UserInputLayer.World);
        }
Exemplo n.º 3
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");
        }
Exemplo n.º 4
0
        private void Refresh()
        {
            WarBuffVO         warBuffVO   = Service.Get <IDataController>().Get <WarBuffVO>(this.buffBaseData.BuffBaseId);
            SquadWarManager   warManager  = Service.Get <SquadController>().WarManager;
            SquadWarSquadData squadData   = warManager.GetSquadData(this.buffBaseData.OwnerId);
            FactionType       factionType = FactionType.Neutral;
            string            text        = this.buffBaseData.GetDisplayBaseLevel().ToString();

            if (squadData != null)
            {
                factionType = squadData.Faction;
            }
            string uid;
            string text2;

            if (factionType == FactionType.Empire)
            {
                uid   = warBuffVO.MasterEmpireBuildingUid;
                text2 = LangUtils.GetFactionName(factionType);
            }
            else if (factionType == FactionType.Rebel)
            {
                uid   = warBuffVO.MasterRebelBuildingUid;
                text2 = LangUtils.GetFactionName(factionType);
            }
            else
            {
                uid   = warBuffVO.MasterNeutralBuildingUid;
                text2 = this.lang.Get("BUFF_BASE_UNOWNED_FACTION_NAME", new object[0]);
            }
            this.spriteFactionIcon.SpriteName = UXUtils.GetIconNameFromFactionType(factionType);
            this.labelBuffBaseName.Text       = this.lang.Get("WAR_BOARD_BUFF_BASE_TITLE", new object[]
            {
                this.lang.Get(warBuffVO.BuffBaseName, new object[0]),
                LangUtils.GetPlanetDisplayName(warBuffVO.PlanetId)
            });
            this.labelBuffBaseLevel.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_LEVEL", new object[]
            {
                text,
                text2
            });
            this.labelCaptureRequirement.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_CAPTURE_REQUIREMENT", new object[0]);
            this.labelProduces.Text           = this.lang.Get("BUFF_BASE_PRODUCES", new object[0]);
            this.labelBuffDescription.Text    = this.lang.Get(warBuffVO.BuffStringDesc, new object[0]);
            this.labelLocked.Text             = this.lang.Get("PLANET_LOCKED_REQUIREMENT", new object[0]);
            this.labelLocked.Visible          = !Service.Get <CurrentPlayer>().IsPlanetUnlocked(warBuffVO.PlanetId);
            TextureVO       textureVO      = null;
            IDataController dataController = Service.Get <IDataController>();

            if (warBuffVO.PlanetId == GameConstants.TATOOINE_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_tatooine");
            }
            else if (warBuffVO.PlanetId == GameConstants.YAVIN_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_yavin");
            }
            else if (warBuffVO.PlanetId == GameConstants.DANDORAN_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_dandoran");
            }
            else if (warBuffVO.PlanetId == GameConstants.ERKIT_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_erkit");
            }
            else if (warBuffVO.PlanetId == GameConstants.TFA_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_tfa");
            }
            else if (warBuffVO.PlanetId == GameConstants.HOTH_PLANET_UID)
            {
                textureVO = dataController.GetOptional <TextureVO>("squadwars_basedetails_hoth");
            }
            if (textureVO != null)
            {
                this.textureBaseDetail.LoadTexture(textureVO.AssetName);
            }
            BuildingTypeVO data = Service.Get <IDataController>().Get <BuildingTypeVO>(uid);

            UXUtils.SetupGeometryForIcon(this.spriteBuffBaseIcon, data);
            this.spriteBuffIcon.SpriteName = warBuffVO.BuffIcon;
            string empty = string.Empty;

            if (warManager.CanScoutBuffBase(this.buffBaseData, ref empty))
            {
                this.btnScout.VisuallyEnableButton();
                this.labelScout.TextColor = this.labelScout.OriginalTextColor;
                return;
            }
            this.btnScout.VisuallyDisableButton();
            this.labelScout.TextColor = UXUtils.COLOR_LABEL_DISABLED;
        }