Example #1
0
        public void UpgradeTroopsOrStarships(string uid, bool isStarship)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            IUpgradeableVO       upgradeableVO;
            InventoryStorage     storage;

            if (isStarship)
            {
                upgradeableVO = staticDataController.Get <SpecialAttackTypeVO>(uid);
                this.Starships.SetLevel(upgradeableVO);
                storage = GameUtils.GetWorldOwner().Inventory.SpecialAttack;
            }
            else
            {
                upgradeableVO = staticDataController.Get <TroopTypeVO>(uid);
                this.Troops.SetLevel(upgradeableVO);
                TroopType type = ((TroopTypeVO)upgradeableVO).Type;
                if (type != TroopType.Hero)
                {
                    if (type != TroopType.Champion)
                    {
                        storage = GameUtils.GetWorldOwner().Inventory.Troop;
                    }
                    else
                    {
                        storage = GameUtils.GetWorldOwner().Inventory.Champion;
                    }
                }
                else
                {
                    storage = GameUtils.GetWorldOwner().Inventory.Hero;
                }
            }
            UnlockedLevelData.UpgradeTroopsOrStarshipsInventory(storage, isStarship, upgradeableVO.UpgradeGroup, upgradeableVO.Uid);
        }
Example #2
0
        public GameShaders(AssetsCompleteDelegate onCompleteCallback, object onCompleteCookie)
        {
            this.shaders = new Dictionary <string, Shader>();
            List <string>        list = new List <string>();
            StaticDataController staticDataController = Service.StaticDataController;

            Dictionary <string, ShaderTypeVO> .ValueCollection all = staticDataController.GetAll <ShaderTypeVO>();
            foreach (ShaderTypeVO current in all)
            {
                list.Add(current.AssetName);
            }
            staticDataController.Unload <ShaderTypeVO>();
            List <object>      list2 = new List <object>();
            List <AssetHandle> list3 = new List <AssetHandle>();
            int i     = 0;
            int count = list.Count;

            while (i < count)
            {
                list2.Add(list[i]);
                list3.Add(AssetHandle.Invalid);
                i++;
            }
            Service.AssetManager.MultiLoad(list3, list, new AssetSuccessDelegate(this.LoadSuccess), null, list2, onCompleteCallback, onCompleteCookie);
        }
Example #3
0
        private void PopulateAvailablePlanetsPanel(StaticDataController sdc)
        {
            UXElement element = base.GetElement <UXElement>("PanelPlanetAvailability");

            element.Visible = true;
            base.GetElement <UXLabel>("LabelPlanetAvailability").Text = this.lang.Get("RESEARCH_LAB_ACTIVE_PLANETS", new object[0]);
            UXGrid element2 = base.GetElement <UXGrid>("GridPlanetAvailability");

            element2.SetTemplateItem("TemplatePlanet");
            element2.Clear();
            int i   = 0;
            int num = this.selectedEquipment.PlanetIDs.Length;

            while (i < num)
            {
                string    uid      = this.selectedEquipment.PlanetIDs[i];
                PlanetVO  planetVO = sdc.Get <PlanetVO>(uid);
                UXElement item     = element2.CloneTemplateItem(planetVO.Uid);
                element2.AddItem(item, planetVO.Order);
                element2.GetSubElement <UXLabel>(planetVO.Uid, "LabelAvailablePlanet").Text = LangUtils.GetPlanetDisplayName(uid);
                element2.GetSubElement <UXTexture>(planetVO.Uid, "TextureAvailablePlanet").LoadTexture(planetVO.LeaderboardButtonTexture);
                i++;
            }
            element2.RepositionItemsFrameDelayed();
        }
Example #4
0
        private string GetResearchDisplayName(string uid)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(uid))
            {
                StaticDataController staticDataController = Service.StaticDataController;
                TroopTypeVO          optional             = staticDataController.GetOptional <TroopTypeVO>(uid);
                if (optional != null)
                {
                    result = LangUtils.GetTroopDisplayName(optional);
                }
                else
                {
                    SpecialAttackTypeVO optional2 = staticDataController.GetOptional <SpecialAttackTypeVO>(uid);
                    if (optional2 != null)
                    {
                        result = LangUtils.GetStarshipDisplayName(optional2);
                    }
                    else
                    {
                        EquipmentVO optional3 = staticDataController.GetOptional <EquipmentVO>(uid);
                        if (optional3 != null)
                        {
                            result = LangUtils.GetEquipmentDisplayName(optional3);
                        }
                    }
                }
            }
            return(result);
        }
Example #5
0
        public static List <IAssetVO> GetBattlePreloads(BattleInitializationData battleData)
        {
            List <IAssetVO>      list = new List <IAssetVO>();
            StaticDataController staticDataController = Service.StaticDataController;
            SkinController       skinController       = Service.SkinController;
            BattleTypeVO         battleTypeVO         = (battleData == null) ? null : battleData.BattleVO;

            if (battleTypeVO == null || !battleTypeVO.OverridePlayerUnits)
            {
                Inventory inventory = Service.CurrentPlayer.Inventory;
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(inventory.Troop, list, battleData.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <SpecialAttackTypeVO>(inventory.SpecialAttack, list, battleData.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(inventory.Hero, list, battleData.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(inventory.Champion, list, battleData.AttackerEquipment, staticDataController, skinController);
            }
            if (battleTypeVO != null)
            {
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(battleTypeVO.TroopData, list, battleData.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <SpecialAttackTypeVO>(battleTypeVO.SpecialAttackData, list, battleData.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(battleTypeVO.HeroData, list, battleData.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(battleTypeVO.ChampionData, list, battleData.AttackerEquipment, staticDataController, skinController);
            }
            MapDataLoaderUtils.AddSummonableVisitorsToList(battleData, staticDataController, list, skinController);
            MapDataLoaderUtils.AddFXPreloads(list);
            return(list);
        }
Example #6
0
        public static int CalculateSpaceOccupiedByQueuedTroops(Entity entity)
        {
            int num = 0;
            BuildingComponent buildingComponent = entity.Get <BuildingComponent>();
            List <Contract>   list = Service.ISupportController.FindAllTroopContractsForBuilding(buildingComponent.BuildingTO.Key);
            bool flag = false;

            if (buildingComponent.BuildingType.Type == BuildingType.FleetCommand)
            {
                flag = true;
            }
            StaticDataController staticDataController = Service.StaticDataController;

            for (int i = 0; i < list.Count; i++)
            {
                string productUid = list[i].ProductUid;
                int    size;
                if (flag)
                {
                    size = staticDataController.Get <SpecialAttackTypeVO>(productUid).Size;
                }
                else
                {
                    size = staticDataController.Get <TroopTypeVO>(productUid).Size;
                }
                num += size;
            }
            return(num);
        }
Example #7
0
        public static void GetArmyContractStorageAndSize(Contract contract, out InventoryStorage storage, out int size)
        {
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;
            StaticDataController staticDataController = Service.StaticDataController;

            switch (contract.DeliveryType)
            {
            case DeliveryType.Starship:
                storage = currentPlayer.Inventory.SpecialAttack;
                size    = staticDataController.Get <SpecialAttackTypeVO>(contract.ProductUid).Size;
                break;

            case DeliveryType.Hero:
                storage = currentPlayer.Inventory.Hero;
                size    = staticDataController.Get <TroopTypeVO>(contract.ProductUid).Size;
                break;

            case DeliveryType.Champion:
                storage = currentPlayer.Inventory.Champion;
                size    = staticDataController.Get <TroopTypeVO>(contract.ProductUid).Size;
                break;

            default:
                storage = currentPlayer.Inventory.Troop;
                size    = staticDataController.Get <TroopTypeVO>(contract.ProductUid).Size;
                break;
            }
        }
Example #8
0
        private NotificationObject CreateResearchNotification(string productUid, DeliveryType contractType, int remainingTime, string buildingKey)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            string displayName = null;
            int    level       = 0;

            if (contractType != DeliveryType.UpgradeTroop)
            {
                if (contractType != DeliveryType.UpgradeStarship)
                {
                    if (contractType == DeliveryType.UpgradeEquipment)
                    {
                        EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(productUid);
                        displayName = LangUtils.GetEquipmentDisplayName(equipmentVO);
                        level       = equipmentVO.Lvl;
                    }
                }
                else
                {
                    SpecialAttackTypeVO specialAttackTypeVO = staticDataController.Get <SpecialAttackTypeVO>(productUid);
                    displayName = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                    level       = specialAttackTypeVO.Lvl;
                }
            }
            else
            {
                TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(productUid);
                displayName = LangUtils.GetTroopDisplayName(troopTypeVO);
                level       = troopTypeVO.Lvl;
            }
            return(this.CreateSupportNotification(productUid, remainingTime, buildingKey, "notif3", displayName, level));
        }
Example #9
0
        public static BattleInitializationData CreateFromDefensiveCampaignMissionVO(string id)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CampaignMissionVO    vo = staticDataController.Get <CampaignMissionVO>(id);

            return(BattleInitializationData.CreateFromDefensiveCampaignMissionVO(vo));
        }
Example #10
0
        private void CacheHQBuildingIds()
        {
            if (this.HaveCachedBuildingIds())
            {
                return;
            }
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                if (this.HaveCachedBuildingIds())
                {
                    break;
                }
                if (current.Type == BuildingType.HQ && current.BuildingRequirement != null)
                {
                    if (current.Faction == FactionType.Empire)
                    {
                        this.empireHQId = current.BuildingID;
                    }
                    else if (current.Faction == FactionType.Rebel)
                    {
                        this.rebelHQId = current.BuildingID;
                    }
                    else if (current.Faction == FactionType.Smuggler)
                    {
                        this.smugglerHQId = current.BuildingID;
                    }
                }
            }
        }
Example #11
0
        public static List <string> GetValidEquipment(CurrentPlayer player, StaticDataController dc, string planetId)
        {
            List <string> list      = null;
            List <string> equipment = player.ActiveArmory.Equipment;

            if (equipment != null)
            {
                int i     = 0;
                int count = equipment.Count;
                while (i < count)
                {
                    EquipmentVO equipmentVO = dc.Get <EquipmentVO>(equipment[i]);
                    if (ArmoryUtils.IsEquipmentValidForPlanet(equipmentVO, planetId))
                    {
                        if (list == null)
                        {
                            list = new List <string>();
                        }
                        list.Add(equipmentVO.Uid);
                    }
                    i++;
                }
            }
            return(list);
        }
Example #12
0
        private void InitPlanetOptionTournamentTab()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;
            bool flag = false;

            this.planetGrid.Clear();
            this.planetGrid.Visible = true;
            List <TournamentVO> allLiveAndClosingTournaments = TournamentController.GetAllLiveAndClosingTournaments();
            int num = 2147483647;

            foreach (TournamentVO current in allLiveAndClosingTournaments)
            {
                PlanetVO planetVO = staticDataController.Get <PlanetVO>(current.PlanetId);
                if (planetVO != null)
                {
                    if (planetVO.Uid == currentPlayer.Planet.Uid)
                    {
                        flag = true;
                    }
                    if (current.EndTimestamp < num)
                    {
                        this.selectedPlanet = planetVO;
                        num = current.EndTimestamp;
                    }
                    this.AddPlanetButton(planetVO, true, planetVO.Uid == currentPlayer.Planet.Uid);
                }
                if (flag)
                {
                    this.selectedPlanet = currentPlayer.Planet;
                }
            }
            this.planetOptionPanelBackground.Height = (float)this.planetGrid.Count * this.planetGrid.CellHeight + 20f;
            this.planetGrid.RepositionItems();
        }
Example #13
0
        public void SetIAPRewardIcon(UXSprite iconSprite, string uid)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            InAppPurchaseTypeVO  inAppPurchaseTypeVO  = staticDataController.Get <InAppPurchaseTypeVO>(uid);
            string rewardUid = string.Empty;

            if (Service.CurrentPlayer.Faction == FactionType.Empire)
            {
                rewardUid = inAppPurchaseTypeVO.RewardEmpire;
            }
            else
            {
                rewardUid = inAppPurchaseTypeVO.RewardRebel;
            }
            if (inAppPurchaseTypeVO.CurrencyType.Equals("hard") || inAppPurchaseTypeVO.CurrencyType.Equals("pack"))
            {
                UXUtils.SetupGeometryForIcon(iconSprite, inAppPurchaseTypeVO.CurrencyIconId);
            }
            else
            {
                RewardType  rewardType = RewardType.Invalid;
                IGeometryVO config;
                Service.RewardManager.GetFirstRewardAssetName(rewardUid, ref rewardType, out config);
                RewardUtils.SetRewardIcon(iconSprite, config, AnimationPreference.NoAnimation);
            }
        }
Example #14
0
        public void UpgradeEquipmentLevel(Contract contract)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            IUpgradeableVO       level = staticDataController.Get <EquipmentVO>(contract.ProductUid);

            this.Equipment.SetLevel(level);
        }
Example #15
0
        public void RemoveMissingMissionData()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            List <string>        list = new List <string>();

            foreach (string current in this.campaigns.Keys)
            {
                if (staticDataController.GetOptional <CampaignVO>(current) == null)
                {
                    list.Add(current);
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                this.campaigns.Remove(list[i]);
            }
            list.Clear();
            foreach (string current2 in this.missions.Keys)
            {
                if (staticDataController.GetOptional <CampaignMissionVO>(current2) == null)
                {
                    list.Add(current2);
                }
            }
            for (int j = 0; j < list.Count; j++)
            {
                this.missions.Remove(list[j]);
            }
            list.Clear();
        }
Example #16
0
        public static BattleInitializationData CreateFromCampaignMissionVO(string id)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CampaignMissionVO    campaignMissionVO    = staticDataController.Get <CampaignMissionVO>(id);

            return(BattleInitializationData.CreateFromCampaignMissionAndBattle(id, campaignMissionVO.Map));
        }
Example #17
0
        public void CheckForNewMissions(ref bool newChapterMission)
        {
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (string current in this.missions.Keys)
            {
                Mission mission = this.missions[current];
                if (mission.Status == MissionStatus.Default)
                {
                    CampaignMissionVO optional = staticDataController.GetOptional <CampaignMissionVO>(mission.Uid);
                    if (optional != null)
                    {
                        CampaignVO optional2 = staticDataController.GetOptional <CampaignVO>(optional.CampaignUid);
                        if (optional2 != null)
                        {
                            if (!optional2.Timed)
                            {
                                newChapterMission = true;
                            }
                            if (newChapterMission)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #18
0
        public static BattleInitializationData CreateFromCampaignMissionAndBattle(string id, string battleUid)
        {
            StaticDataController     staticDataController     = Service.StaticDataController;
            CampaignMissionVO        campaignMissionVO        = staticDataController.Get <CampaignMissionVO>(id);
            BattleInitializationData battleInitializationData = BattleInitializationData.CreateFromBattleTypeVO(battleUid);
            CampaignProgress         campaignProgress         = Service.CurrentPlayer.CampaignProgress;
            int missionLootCreditsRemaining    = campaignProgress.GetMissionLootCreditsRemaining(campaignMissionVO);
            int missionLootMaterialsRemaining  = campaignProgress.GetMissionLootMaterialsRemaining(campaignMissionVO);
            int missionLootContrabandRemaining = campaignProgress.GetMissionLootContrabandRemaining(campaignMissionVO);

            battleInitializationData.MissionUid              = campaignMissionVO.Uid;
            battleInitializationData.LootCreditsAvailable    = missionLootCreditsRemaining;
            battleInitializationData.LootMaterialsAvailable  = missionLootMaterialsRemaining;
            battleInitializationData.LootContrabandAvailable = missionLootContrabandRemaining;
            battleInitializationData.BattleType              = BattleType.PveAttack;
            battleInitializationData.BattleMusic             = campaignMissionVO.BattleMusic;
            battleInitializationData.AmbientMusic            = campaignMissionVO.AmbientMusic;
            battleInitializationData.BattleVO = staticDataController.Get <BattleTypeVO>(battleUid);
            battleInitializationData.AllowMultipleHeroDeploys = battleInitializationData.BattleVO.MultipleHeroDeploys;
            battleInitializationData.OverrideDeployables      = battleInitializationData.BattleVO.OverridePlayerUnits;
            battleInitializationData.VictoryConditions        = campaignMissionVO.Conditions;
            if (!string.IsNullOrEmpty(campaignMissionVO.FailureCondition))
            {
                battleInitializationData.FailureCondition = staticDataController.Get <ConditionVO>(campaignMissionVO.FailureCondition);
            }
            battleInitializationData.IsReplay          = false;
            battleInitializationData.IsRevenge         = false;
            battleInitializationData.AllowReplay       = false;
            battleInitializationData.AttackerEquipment = BattleInitializationData.GetCurrentPlayerEquipment(battleInitializationData.PlanetId);
            battleInitializationData.DefenderEquipment = null;
            return(battleInitializationData);
        }
Example #19
0
        public static bool CanCancelDeployableContract(Entity selectedBuilding)
        {
            if (!ContractUtils.IsArmyUpgrading(selectedBuilding))
            {
                return(false);
            }
            StaticDataController staticDataController = Service.StaticDataController;
            BuildingComponent    buildingComponent    = selectedBuilding.Get <BuildingComponent>();
            Contract             contract             = Service.ISupportController.FindCurrentContract(buildingComponent.BuildingTO.Key);
            string        productUid = contract.ProductUid;
            IDeployableVO optional   = staticDataController.GetOptional <TroopTypeVO>(productUid);
            string        value      = null;

            if (optional != null)
            {
                value = optional.UpgradeShardUid;
            }
            else
            {
                optional = staticDataController.GetOptional <SpecialAttackTypeVO>(productUid);
                if (optional != null)
                {
                    value = optional.UpgradeShardUid;
                }
                else
                {
                    Service.Logger.Error("CanCancelDeployableContract: Unsupported deployable type, not troop or special attack " + productUid);
                }
            }
            return(string.IsNullOrEmpty(value));
        }
Example #20
0
        public void PrepareContent(int lastTimeViewed)
        {
            int num = 0;

            this.DevNotes.Clear();
            int serverTime = (int)Service.ServerAPI.ServerTime;
            StaticDataController staticDataController = Service.StaticDataController;

            this.DevNotes = new List <DevNoteEntryVO>();
            foreach (DevNoteEntryVO current in staticDataController.GetAll <DevNoteEntryVO>())
            {
                if (current.StartTime <= serverTime && serverTime < current.EndTime)
                {
                    this.DevNotes.Add(current);
                    if (current.StartTime > lastTimeViewed)
                    {
                        num++;
                    }
                }
            }
            HolonetController holonetController = Service.HolonetController;

            this.DevNotes.Sort(new Comparison <DevNoteEntryVO>(holonetController.CompareTimestamps));
            holonetController.ContentPrepared(this, Math.Min(num, 3));
        }
Example #21
0
        private List <string> GetEffectNames(string planetaryFx)
        {
            if (string.IsNullOrEmpty(planetaryFx))
            {
                return(null);
            }
            List <string>        list = new List <string>();
            StaticDataController staticDataController = Service.StaticDataController;

            char[] separator = new char[]
            {
                '|'
            };
            string[] array = planetaryFx.Split(separator);
            int      i     = 0;
            int      num   = array.Length;

            while (i < num)
            {
                EffectsTypeVO optional = staticDataController.GetOptional <EffectsTypeVO>(array[i]);
                if (optional == null || string.IsNullOrEmpty(optional.AssetName))
                {
                    return(null);
                }
                list.Add(optional.AssetName);
                i++;
            }
            return(list);
        }
Example #22
0
        private void UpdateBuildings(FactionType newFaction)
        {
            StaticDataController  staticDataController = Service.StaticDataController;
            List <BuildingTypeVO> list = new List <BuildingTypeVO>();

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                list.Add(current);
            }
            List <BuildingTypeVO> arg_69_0 = list;

            if (ChooseFactionScreen.< > f__mg$cache0 == null)
            {
                ChooseFactionScreen.< > f__mg$cache0 = new Comparison <BuildingTypeVO>(GameUtils.SortBuildingByUID);
            }
            arg_69_0.Sort(ChooseFactionScreen.< > f__mg$cache0);
            List <Building> buildings = Service.CurrentPlayer.Map.Buildings;

            for (int i = 0; i < buildings.Count; i++)
            {
                Building       building       = buildings[i];
                BuildingTypeVO buildingTypeVO = staticDataController.Get <BuildingTypeVO>(building.Uid);
                if (buildingTypeVO.Faction != FactionType.Neutral)
                {
                    building.Uid = GameUtils.GetEquivalentFromPreSortedList(list, buildingTypeVO, newFaction);
                }
            }
            list.Clear();
            list = null;
        }
Example #23
0
        public static List <IAssetVO> GetBattleRecordPreloads(BattleRecord battleRecord)
        {
            List <IAssetVO> list = new List <IAssetVO>();

            if (battleRecord == null)
            {
                Service.Logger.Error("Battle Record is null in MapDataLoaderUtils.GetBattleRecordPreloads.");
                return(list);
            }
            StaticDataController staticDataController   = Service.StaticDataController;
            SkinController       skinController         = Service.SkinController;
            BattleDeploymentData attackerDeploymentData = battleRecord.AttackerDeploymentData;

            if (attackerDeploymentData != null)
            {
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(attackerDeploymentData.TroopData, list, battleRecord.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <SpecialAttackTypeVO>(attackerDeploymentData.SpecialAttackData, list, battleRecord.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(attackerDeploymentData.HeroData, list, battleRecord.AttackerEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(attackerDeploymentData.ChampionData, list, battleRecord.AttackerEquipment, staticDataController, skinController);
            }
            BattleDeploymentData defenderDeploymentData = battleRecord.DefenderDeploymentData;

            if (defenderDeploymentData != null)
            {
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(defenderDeploymentData.TroopData, list, battleRecord.DefenderEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <SpecialAttackTypeVO>(defenderDeploymentData.SpecialAttackData, list, battleRecord.DefenderEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(defenderDeploymentData.HeroData, list, battleRecord.DefenderEquipment, staticDataController, skinController);
                MapDataLoaderUtils.AddDeployablesToList <TroopTypeVO>(defenderDeploymentData.ChampionData, list, battleRecord.DefenderEquipment, staticDataController, skinController);
            }
            MapDataLoaderUtils.AddFXPreloads(list);
            return(list);
        }
Example #24
0
        public static void AddWarBuffs(BattleType battleType, List <string> attackerBuffs, List <string> defenderBuffs)
        {
            BuffController buffController = Service.BuffController;

            buffController.ClearWarBuffs();
            if (battleType != BattleType.PvpAttackSquadWar && battleType != BattleType.PveBuffBase)
            {
                return;
            }
            StaticDataController staticDataController = Service.StaticDataController;

            if (attackerBuffs != null)
            {
                int i     = 0;
                int count = attackerBuffs.Count;
                while (i < count)
                {
                    WarBuffVO warBuff = staticDataController.Get <WarBuffVO>(attackerBuffs[i]);
                    buffController.AddAttackerWarBuff(warBuff);
                    i++;
                }
            }
            if (battleType != BattleType.PveBuffBase && defenderBuffs != null)
            {
                int j      = 0;
                int count2 = defenderBuffs.Count;
                while (j < count2)
                {
                    WarBuffVO warBuff2 = staticDataController.Get <WarBuffVO>(defenderBuffs[j]);
                    buffController.AddDefenderWarBuff(warBuff2);
                    j++;
                }
            }
        }
Example #25
0
        protected override void VerifyCurrentGoalsAgainstMeta()
        {
            StaticDataController staticDataController      = Service.StaticDataController;
            Dictionary <string, ObjectiveGroup> objectives = Service.CurrentPlayer.Objectives;

            foreach (KeyValuePair <string, ObjectiveGroup> current in objectives)
            {
                bool flag  = false;
                int  i     = 0;
                int  count = current.Value.ProgressObjects.Count;
                while (i < count)
                {
                    string objectiveUid = current.Value.ProgressObjects[i].ObjectiveUid;
                    if (staticDataController.GetOptional <ObjectiveVO>(objectiveUid) == null)
                    {
                        flag = true;
                        Service.Logger.WarnFormat("Planet {0} has an invalid objective {1}", new object[]
                        {
                            current.Key,
                            objectiveUid
                        });
                    }
                    i++;
                }
                if (flag)
                {
                    ForceObjectivesUpdateCommand command = new ForceObjectivesUpdateCommand(current.Key);
                    Service.ServerAPI.Sync(command);
                }
            }
        }
Example #26
0
        protected override void OnScreenLoaded()
        {
            this.InitButtons();
            this.labelTitle        = base.GetElement <UXLabel>("LabelTitle");
            this.btnInfo           = base.GetElement <UXButton>("BtnInfo");
            this.labelSquadQueue   = base.GetElement <UXLabel>("LabelSquadQueue");
            this.buttonCancel      = base.GetElement <UXButton>("ButtonCancel");
            this.labelButtonCancel = base.GetElement <UXLabel>("LabelButtonCancel");
            this.buttonBack        = base.GetElement <UXButton>("ButtonBack");
            this.labelButtonBack   = base.GetElement <UXLabel>("LabelButtonBack");
            this.buttonConfirm     = base.GetElement <UXButton>("ButtonConfirm");
            this.labelButtonOk     = base.GetElement <UXLabel>("LabelButtonOk");
            this.queueTexture      = base.GetElement <UXTexture>("QueueTexture");
            StaticDataController staticDataController = Service.StaticDataController;
            TextureVO            textureVO            = staticDataController.Get <TextureVO>("gui_textures_cancel_matchmaking");

            this.queueTexture.LoadTexture(textureVO.AssetName);
            this.labelTitle.Text         = this.lang.Get("WAR_MATCHMAKE_TITLE", new object[0]);
            this.btnInfo.OnClicked       = new UXButtonClickedDelegate(Service.SquadController.WarManager.ShowInfoScreen);
            this.buttonCancel.OnClicked  = new UXButtonClickedDelegate(this.OnCancelButtonClicked);
            this.labelButtonCancel.Text  = this.lang.Get("WAR_CANCEL_MATCHMAKE", new object[0]);
            this.buttonBack.OnClicked    = new UXButtonClickedDelegate(this.OnBackClicked);
            this.labelButtonBack.Text    = this.lang.Get("WAR_CANCEL_MATCHMAKE_BACK", new object[0]);
            this.buttonConfirm.OnClicked = new UXButtonClickedDelegate(this.OnConfirmClicked);
            this.labelButtonOk.Text      = this.lang.Get("WAR_OK", new object[0]);
            this.finalConfirm            = false;
            this.Refresh();
        }
Example #27
0
        private string GetTaskCrateIcon()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeProgressInfo  episodeProgressInfo  = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: No episode progress found", new object[0]);
                return("episode_hudicon_crate_ready_bronzium");
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            if (currentTask == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: No current task found", new object[0]);
                return("episode_hudicon_crate_ready_bronzium");
            }
            EpisodeTaskVO optional = staticDataController.GetOptional <EpisodeTaskVO>(currentTask.uid);

            if (optional == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: Missing task data for {0}", new object[]
                {
                    currentTask.uid
                });
                return("episode_hudicon_crate_ready_bronzium");
            }
            if (string.IsNullOrEmpty(optional.CrateIconAsset))
            {
                return("episode_hudicon_crate_ready_bronzium");
            }
            return(optional.CrateIconAsset);
        }
Example #28
0
        private void OnPerkUpgraded(SquadMsg msg)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                Service.Logger.Error("SquadController.OnPerkUpgraded: Current Squad Null");
                return;
            }
            SquadPerks perks    = currentSquad.Perks;
            string     perkUId  = msg.PerkData.PerkUId;
            PerkVO     optional = staticDataController.GetOptional <PerkVO>(perkUId);

            if (optional == null)
            {
                Service.Logger.ErrorFormat("SquadController.OnPerkUpgraded: Given Perk is Null {0}", new object[]
                {
                    perkUId
                });
                return;
            }
            perks.UpdateUnlockedPerk(perkUId);
            Service.PerkViewController.AddToPerkBadgeList(perkUId);
            Service.EventManager.SendEvent(EventId.SquadPerkUpdated, null);
            Service.EventManager.SendEvent(EventId.PerkUpgraded, optional);
        }
Example #29
0
 private string GetAffectedUnit()
 {
     string[] effectUids = this.selectedEquipment.EffectUids;
     if (effectUids != null)
     {
         StaticDataController staticDataController = Service.StaticDataController;
         int i   = 0;
         int num = effectUids.Length;
         while (i < num)
         {
             EquipmentEffectVO equipmentEffectVO = staticDataController.Get <EquipmentEffectVO>(effectUids[i]);
             if (equipmentEffectVO.AffectedTroopIds != null && equipmentEffectVO.AffectedTroopIds.Length > 0)
             {
                 return(this.lang.Get("trp_title_" + equipmentEffectVO.AffectedTroopIds[0], new object[0]));
             }
             if (equipmentEffectVO.AffectedSpecialAttackIds != null && equipmentEffectVO.AffectedSpecialAttackIds.Length > 0)
             {
                 return(this.lang.Get("shp_title_" + equipmentEffectVO.AffectedSpecialAttackIds[0], new object[0]));
             }
             if (equipmentEffectVO.AffectedBuildingIds != null && equipmentEffectVO.AffectedBuildingIds.Length > 0)
             {
                 return(this.lang.Get("bld_title_" + equipmentEffectVO.AffectedBuildingIds[0], new object[0]));
             }
             i++;
         }
     }
     return(null);
 }
Example #30
0
        public static List <IAssetVO> GetBattleRecordProjectileAssets(Map map, BattleRecord battleRecord, List <string> attackerWarBuffs, List <string> defenderWarBuffs, List <string> attackerEquipment, List <string> defenderEquipment)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            List <IAssetVO>      list = new List <IAssetVO>();
            BattleDeploymentData attackerDeploymentData = battleRecord.AttackerDeploymentData;

            if (attackerDeploymentData != null)
            {
                ProjectileUtils.AddTroopProjectileAssets(attackerDeploymentData.TroopData, list, staticDataController);
                ProjectileUtils.AddSpecialAttackProjectileAssets(attackerDeploymentData.SpecialAttackData, list, staticDataController);
                ProjectileUtils.AddTroopProjectileAssets(attackerDeploymentData.HeroData, list, staticDataController);
                ProjectileUtils.AddTroopProjectileAssets(attackerDeploymentData.ChampionData, list, staticDataController);
            }
            BattleDeploymentData defenderDeploymentData = battleRecord.DefenderDeploymentData;

            if (defenderDeploymentData != null)
            {
                ProjectileUtils.AddTroopProjectileAssets(defenderDeploymentData.TroopData, list, staticDataController);
                ProjectileUtils.AddSpecialAttackProjectileAssets(defenderDeploymentData.SpecialAttackData, list, staticDataController);
                ProjectileUtils.AddTroopProjectileAssets(defenderDeploymentData.HeroData, list, staticDataController);
                ProjectileUtils.AddTroopProjectileAssets(defenderDeploymentData.ChampionData, list, staticDataController);
            }
            Dictionary <string, int> attackerGuildTroops = battleRecord.AttackerGuildTroops;

            ProjectileUtils.AddTroopProjectileAssets(attackerGuildTroops, list, staticDataController);
            Dictionary <string, int> defenderGuildTroops = battleRecord.DefenderGuildTroops;

            ProjectileUtils.AddTroopProjectileAssets(defenderGuildTroops, list, staticDataController);
            Dictionary <string, int> defenderChampions = battleRecord.DefenderChampions;

            ProjectileUtils.AddTroopProjectileAssets(defenderChampions, list, staticDataController);
            ProjectileUtils.AddBattleProjectileAssets(map, null, null, attackerWarBuffs, defenderWarBuffs, attackerEquipment, defenderEquipment, list, staticDataController);
            return(list);
        }