Exemplo n.º 1
0
        protected override void OnScreenLoaded()
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();

            Service.Get <UXController>().HUD.Visible = false;
            this.InitButtons();
            this.SetUIText();
            this.LoadFx();
            UXSprite       element        = base.GetElement <UXSprite>("SpriteInstructions");
            BuildingTypeVO buildingTypeVO = null;

            if (this.isSpecialAttack)
            {
                if (buildingLookupController.HasStarshipCommand())
                {
                    FleetCommandNode head = buildingLookupController.FleetCommandNodeList.Head;
                    buildingTypeVO = head.BuildingComp.BuildingType;
                }
            }
            else
            {
                buildingTypeVO = buildingLookupController.GetHighestAvailableBuildingVOForTroop((TroopTypeVO)this.subjectVO);
            }
            if (buildingTypeVO != null)
            {
                ProjectorConfig projectorConfig = ProjectorUtils.GenerateGeometryConfig(buildingTypeVO, element, false);
                projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                ProjectorUtils.GenerateProjector(projectorConfig);
            }
            else
            {
                element.Visible = false;
            }
            this.fadingOutSubject = false;
        }
Exemplo n.º 2
0
        private void SetupTrainTroopsButtons()
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            Entity highestAvailableBarracks = buildingLookupController.GetHighestAvailableBarracks();

            if (highestAvailableBarracks != null)
            {
                this.trainTroopsButton.Tag       = highestAvailableBarracks;
                this.trainTroopsButton.OnClicked = new UXButtonClickedDelegate(this.OnTrainTroopsClicked);
                this.trainTroopsButton.Enabled   = true;
            }
            else
            {
                this.trainTroopsButton.Enabled = false;
            }
            Entity highestAvailableFactory = buildingLookupController.GetHighestAvailableFactory();

            if (highestAvailableFactory != null)
            {
                this.buildVehiclesButton.Tag       = highestAvailableFactory;
                this.buildVehiclesButton.OnClicked = new UXButtonClickedDelegate(this.OnTrainTroopsClicked);
                this.buildVehiclesButton.Enabled   = true;
                return;
            }
            this.buildVehiclesButton.Enabled = false;
        }
        private void InitUnlockItemGrid()
        {
            this.buildingLookupController = Service.Get <BuildingLookupController>();
            this.unlockGrid = base.GetElement <UXGrid>("BuildingUnlockGrid");
            this.unlockGrid.SetTemplateItem("BuildingUnlockTemplate");
            BuildingType type = this.nextBuildingInfo.Type;

            switch (type)
            {
            case BuildingType.Barracks:
            case BuildingType.Factory:
            case BuildingType.HeroMobilizer:
                break;

            case BuildingType.FleetCommand:
                this.InitStarshipUnlockGrid();
                goto IL_64;

            default:
                if (type != BuildingType.Cantina)
                {
                    goto IL_64;
                }
                break;
            }
            this.InitTroopUnlockGrid();
IL_64:
            if (this.unlockGrid.Count > 0)
            {
                this.unlockGrid.RepositionItems();
                this.unlockGrid.Scroll((this.unlockGrid.Count > 7) ? 0f : 0.5f);
                return;
            }
            base.GetElement <UXElement>("UnlockItems").Visible = false;
        }
Exemplo n.º 4
0
        private void SetupItemGrid()
        {
            this.itemGrid = base.GetElement <UXGrid>("UnlockItemsGrid");
            this.itemGrid.SetTemplateItem("UnlockItemsTemplate");
            BuildingLookupController         buildingLookupController = Service.BuildingLookupController;
            Dictionary <BuildingTypeVO, int> buildingsUnlockedBy      = buildingLookupController.GetBuildingsUnlockedBy(this.headQuarter);
            int num = 0;

            foreach (KeyValuePair <BuildingTypeVO, int> current in buildingsUnlockedBy)
            {
                BuildingTypeVO key   = current.Key;
                int            value = current.Value;
                if (key.Type == BuildingType.Turret && key.BuildingRequirement != this.headQuarter.Uid)
                {
                    if (num == 0)
                    {
                        num = value;
                    }
                }
                else
                {
                    string          uid             = key.Uid;
                    UXElement       item            = this.itemGrid.CloneTemplateItem(uid);
                    UXSprite        subElement      = this.itemGrid.GetSubElement <UXSprite>(uid, "SpriteItemImage");
                    ProjectorConfig projectorConfig = ProjectorUtils.GenerateBuildingConfig(key, subElement);
                    projectorConfig.AnimPreference = AnimationPreference.AnimationPreferred;
                    ProjectorUtils.GenerateProjector(projectorConfig);
                    UXLabel subElement2 = this.itemGrid.GetSubElement <UXLabel>(uid, "LabelUnlockCount");
                    if (key.Type == BuildingType.Turret)
                    {
                        subElement2.Visible = false;
                    }
                    else
                    {
                        subElement2.Text = this.lang.Get("TROOP_MULTIPLIER", new object[]
                        {
                            value
                        });
                    }
                    this.itemGrid.AddItem(item, key.Order);
                }
            }
            UXElement item2       = this.itemGrid.CloneTemplateItem("TURRETS");
            UXSprite  subElement3 = this.itemGrid.GetSubElement <UXSprite>("TURRETS", "SpriteItemImage");

            subElement3.Visible = false;
            UXLabel subElement4 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelUnlockCount");

            subElement4.Visible = false;
            UXLabel subElement5 = this.itemGrid.GetSubElement <UXLabel>("TURRETS", "LabelTurrets");

            subElement5.Visible = true;
            subElement5.Text    = this.lang.Get("HQ_UPGRADE_TURRETS_UNLOCKED", new object[]
            {
                num
            });
            this.itemGrid.AddItem(item2, 99999999);
            this.itemGrid.RepositionItems();
            this.itemGrid.Scroll((this.itemGrid.Count <= 7) ? 0.5f : 0f);
        }
Exemplo n.º 5
0
        public HQCelebScreen() : base("gui_building_complete")
        {
            Service.GalaxyViewController.GoToHome();
            this.buildingLookUpController = Service.BuildingLookupController;
            Entity currentHQ = this.buildingLookUpController.GetCurrentHQ();

            this.headQuarter   = currentHQ.Get <BuildingComponent>().BuildingType;
            this.upgradedLevel = this.headQuarter.Lvl;
        }
Exemplo n.º 6
0
        public static IUpgradeableVO GetFinalUnitFromPrize(PrizeType prizeType, string prizeID)
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            IUpgradeableVO           result = null;
            TroopUpgradeCatalog      troopUpgradeCatalog = Service.Get <TroopUpgradeCatalog>();

            switch (prizeType)
            {
            case PrizeType.Infantry:
            {
                int val   = buildingLookupController.GetHighestLevelForBarracks();
                int lvl   = troopUpgradeCatalog.GetMaxRewardableLevel(prizeID).Lvl;
                int level = Math.Min(val, lvl);
                result = troopUpgradeCatalog.GetByLevel(prizeID, level);
                break;
            }

            case PrizeType.Hero:
            {
                int val   = buildingLookupController.GetHighestLevelForHeroCommands();
                int lvl   = troopUpgradeCatalog.GetMaxRewardableLevel(prizeID).Lvl;
                int level = Math.Min(val, lvl);
                result = troopUpgradeCatalog.GetByLevel(prizeID, level);
                break;
            }

            case PrizeType.SpecialAttack:
            {
                StarshipUpgradeCatalog starshipUpgradeCatalog = Service.Get <StarshipUpgradeCatalog>();
                int val   = buildingLookupController.GetHighestLevelForStarshipCommands();
                int lvl   = starshipUpgradeCatalog.GetMaxRewardableLevel(prizeID).Lvl;
                int level = Math.Min(val, lvl);
                result = starshipUpgradeCatalog.GetByLevel(prizeID, level);
                break;
            }

            case PrizeType.Vehicle:
            {
                int val   = buildingLookupController.GetHighestLevelForFactories();
                int lvl   = troopUpgradeCatalog.GetMaxRewardableLevel(prizeID).Lvl;
                int level = Math.Min(val, lvl);
                result = troopUpgradeCatalog.GetByLevel(prizeID, level);
                break;
            }

            case PrizeType.Mercenary:
            {
                int val   = buildingLookupController.GetHighestLevelForCantinas();
                int lvl   = troopUpgradeCatalog.GetMaxRewardableLevel(prizeID).Lvl;
                int level = Math.Min(val, lvl);
                result = troopUpgradeCatalog.GetByLevel(prizeID, level);
                break;
            }
            }
            return(result);
        }
Exemplo n.º 7
0
        public HQCelebScreen()
        {
            this.outLineMatList = new List <Material>();
            base..ctor("gui_building_complete");
            Service.Get <GalaxyViewController>().GoToHome();
            this.buildingLookUpController = Service.Get <BuildingLookupController>();
            Entity currentHQ = this.buildingLookUpController.GetCurrentHQ();

            this.headQuarter   = currentHQ.Get <BuildingComponent>().BuildingType;
            this.upgradedLevel = this.headQuarter.Lvl;
        }
Exemplo n.º 8
0
        public static CrateInfoModalScreen CreateForStore(string crateUid, string planetID)
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;

            return(new CrateInfoModalScreen(crateUid, planetID, buildingType.Lvl)
            {
                ModalReason = CrateInfoReason.Reason_Store_Buy
            });
        }
Exemplo n.º 9
0
        public static bool CanStartMatchmakingPrep(SquadController squadController, BuildingLookupController blc)
        {
            SquadRole          role            = squadController.StateManager.Role;
            bool               flag            = role == SquadRole.Owner || role == SquadRole.Officer;
            int                highestLevelHQ  = blc.GetHighestLevelHQ();
            bool               flag2           = highestLevelHQ >= GameConstants.WAR_PARTICIPANT_MIN_LEVEL;
            SquadWarStatusType currentStatus   = squadController.WarManager.GetCurrentStatus();
            bool               flag3           = currentStatus == SquadWarStatusType.PhaseCooldown || currentStatus == SquadWarStatusType.PhaseOpen;
            SquadWarData       currentSquadWar = squadController.WarManager.CurrentSquadWar;
            bool               flag4           = currentSquadWar == null || currentSquadWar.RewardsProcessed;

            return(flag2 & flag & flag3 & flag4);
        }
Exemplo n.º 10
0
        public static CrateInfoModalScreen CreateForMobileConnectorAd(string crateUid, string planetID)
        {
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;
            FactionType    faction      = Service.CurrentPlayer.Faction;
            bool           flag         = ArmoryUtils.PlayerHasArmory();

            return(new CrateInfoModalScreen(crateUid, planetID, buildingType.Lvl, faction, flag)
            {
                ModalReason = CrateInfoReason.Reason_Mobile_Connector_Ad
            });
        }
Exemplo n.º 11
0
        public static CrateInfoModalScreen CreateForTargetedOffer(TargetedBundleVO offer, CrateVO crate)
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;
            string         planetId     = Service.Get <CurrentPlayer>().PlanetId;

            return(new CrateInfoModalScreen(crate.Uid, planetId, buildingType.Lvl)
            {
                ModalReason = CrateInfoReason.Reason_Targeted_Offer,
                CurrentOffer = offer
            });
        }
Exemplo n.º 12
0
        public static CrateInfoModalScreen CreateForTargetedOffer(TargetedBundleVO offer, CrateVO crate)
        {
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;
            string         planetId     = Service.CurrentPlayer.PlanetId;
            FactionType    faction      = Service.CurrentPlayer.Faction;
            bool           flag         = ArmoryUtils.PlayerHasArmory();

            return(new CrateInfoModalScreen(crate.Uid, planetId, buildingType.Lvl, faction, flag)
            {
                ModalReason = CrateInfoReason.Reason_Targeted_Offer,
                CurrentOffer = offer
            });
        }
Exemplo n.º 13
0
        private void AddNavigationCenterHolo()
        {
            BuildingLookupController        buildingLookupController = Service.Get <BuildingLookupController>();
            NodeList <NavigationCenterNode> navigationCenterNodeList = buildingLookupController.NavigationCenterNodeList;

            for (NavigationCenterNode navigationCenterNode = navigationCenterNodeList.Head; navigationCenterNode != null; navigationCenterNode = navigationCenterNode.Next)
            {
                bool flag  = ContractUtils.IsBuildingUpgrading(navigationCenterNode.Entity);
                bool flag2 = ContractUtils.IsBuildingConstructing(navigationCenterNode.Entity);
                if (!(flag2 | flag))
                {
                    this.CreateEffect(navigationCenterNode.BuildingComp.Entity, "GalacticNavHologram", false, true);
                }
            }
        }
Exemplo n.º 14
0
        private void AddNavigationCenterHolo()
        {
            BuildingLookupController        buildingLookupController = Service.BuildingLookupController;
            NodeList <NavigationCenterNode> navigationCenterNodeList = buildingLookupController.NavigationCenterNodeList;

            for (NavigationCenterNode navigationCenterNode = navigationCenterNodeList.Head; navigationCenterNode != null; navigationCenterNode = navigationCenterNode.Next)
            {
                SmartEntity selectedBuilding = (SmartEntity)navigationCenterNode.Entity;
                bool        flag             = ContractUtils.IsBuildingUpgrading(selectedBuilding);
                if (!ContractUtils.IsBuildingConstructing(selectedBuilding) && !flag)
                {
                    this.CreateEffect(navigationCenterNode.BuildingComp.Entity, "GalacticNavHologram", false, true);
                }
            }
        }
Exemplo n.º 15
0
        private void AddAllEffects(bool checkContracts)
        {
            BuildingLookupController       buildingLookupController = Service.BuildingLookupController;
            NodeList <TacticalCommandNode> tacticalCommandNodeList  = buildingLookupController.TacticalCommandNodeList;

            for (TacticalCommandNode tacticalCommandNode = tacticalCommandNodeList.Head; tacticalCommandNode != null; tacticalCommandNode = tacticalCommandNode.Next)
            {
                this.UpdateEffectsForBuilding(tacticalCommandNode.BuildingComp, false, checkContracts);
            }
            NodeList <FleetCommandNode> fleetCommandNodeList = buildingLookupController.FleetCommandNodeList;

            for (FleetCommandNode fleetCommandNode = fleetCommandNodeList.Head; fleetCommandNode != null; fleetCommandNode = fleetCommandNode.Next)
            {
                this.UpdateEffectsForBuilding(fleetCommandNode.BuildingComp, true, checkContracts);
            }
            this.AddNavigationCenterHolo();
        }
Exemplo n.º 16
0
        private void OnNextButtonClicked(UXButton button)
        {
            this.Close(null);
            SquadController          squadController          = Service.SquadController;
            bool                     flag                     = squadController.StateManager.GetCurrentSquad() != null;
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            int  highestLevelHQ = buildingLookupController.GetHighestLevelHQ();
            bool flag2          = SquadUtils.CanStartMatchmakingPrep(squadController, buildingLookupController);

            if (!flag)
            {
                Service.BILoggingController.TrackGameAction(highestLevelHQ.ToString(), "UI_squadwar_joinsquad", ServerTime.Time.ToString(), null);
                Service.ScreenController.AddScreen(new SquadJoinScreen());
            }
            else if (flag2)
            {
                squadController.WarManager.StartMatchMakingPreparation();
            }
        }
Exemplo n.º 17
0
        private void LogMemberAttemptingWarStart()
        {
            SquadController          squadController          = Service.SquadController;
            Squad                    currentSquad             = squadController.StateManager.GetCurrentSquad();
            string                   squadID                  = currentSquad.SquadID;
            int                      memberCount              = currentSquad.MemberCount;
            int                      activeMemberCount        = currentSquad.ActiveMemberCount;
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            int                      highestLevelHQ           = buildingLookupController.GetHighestLevelHQ();

            Service.BILoggingController.TrackGameAction(highestLevelHQ.ToString(), "UI_squadwar_askforwar", string.Concat(new object[]
            {
                squadID,
                "|",
                memberCount,
                "|",
                activeMemberCount
            }), null);
        }
Exemplo n.º 18
0
        public static bool HasExistingHeroContract(string heroUpgradeGroup)
        {
            bool                     result                   = false;
            IDataController          dataController           = Service.Get <IDataController>();
            ISupportController       supportController        = Service.Get <ISupportController>();
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            BuildingComponent        buildingComp             = buildingLookupController.TacticalCommandNodeList.Head.BuildingComp;
            string                   key  = buildingComp.BuildingTO.Key;
            List <Contract>          list = supportController.FindAllTroopContractsForBuilding(key);
            int i     = 0;
            int count = list.Count;

            while (i < count)
            {
                TroopTypeVO troopTypeVO = dataController.Get <TroopTypeVO>(list[i].ProductUid);
                if (troopTypeVO.UpgradeGroup == heroUpgradeGroup)
                {
                    result = true;
                    break;
                }
                i++;
            }
            return(result);
        }
Exemplo n.º 19
0
        private Dictionary <string, VideosSearch.FilterData> GetFilterData()
        {
            Lang   lang = Service.Get <Lang>();
            string key  = lang.Get("hn_ui_hq_level", new object[0]);
            string key2 = lang.Get("hn_ui_source", new object[0]);
            Dictionary <string, VideosSearch.FilterData> dictionary = new Dictionary <string, VideosSearch.FilterData>
            {
                {
                    lang.Get("hn_ui_date", new object[0]),
                    new VideosSearch.FilterData(new Dictionary <string, string[]>
                    {
                        {
                            lang.Get("hn_ui_anytime", new object[0]),
                            new string[]
                            {
                                ""
                            }
                        },
                        {
                            lang.Get("hn_ui_past_week", new object[0]),
                            new string[]
                            {
                                "7"
                            }
                        },
                        {
                            lang.Get("hn_ui_past_month", new object[0]),
                            new string[]
                            {
                                "30"
                            }
                        }
                    }, ChoiceType.SimpleList, FilterType.Date)
                },
                {
                    key2,
                    new VideosSearch.FilterData(new Dictionary <string, string[]>
                    {
                        {
                            lang.Get("hn_ui_all", new object[0]),
                            new string[]
                            {
                                ""
                            }
                        }
                    }, ChoiceType.SimpleList, FilterType.Tag)
                },
                {
                    key,
                    new VideosSearch.FilterData(new Dictionary <string, string[]>
                    {
                        {
                            lang.Get("hn_ui_any", new object[0]),
                            new string[]
                            {
                                ""
                            }
                        }
                    }, ChoiceType.Picker, FilterType.Tag)
                },
                {
                    lang.Get("hn_ui_faction", new object[0]),
                    new VideosSearch.FilterData(new Dictionary <string, string[]>
                    {
                        {
                            lang.Get("hn_ui_both", new object[0]),
                            new string[]
                            {
                                ""
                            }
                        },
                        {
                            lang.Get("hn_ui_rebel", new object[0]),
                            new string[]
                            {
                                "rebel"
                            }
                        },
                        {
                            lang.Get("hn_ui_empire", new object[0]),
                            new string[]
                            {
                                "empire"
                            }
                        }
                    }, ChoiceType.SimpleList, FilterType.Tag)
                }
            };
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            Entity         currentHQ    = buildingLookupController.GetCurrentHQ();
            BuildingTypeVO buildingType = currentHQ.Get <BuildingComponent>().BuildingType;
            int            lvl          = Service.Get <BuildingUpgradeCatalog>().GetMaxLevel(buildingType.UpgradeGroup).Lvl;

            for (int i = 1; i <= lvl; i++)
            {
                string text = i.ToString();
                dictionary[key].Choices[text] = new string[]
                {
                    text
                };
            }
            Dictionary <string, string> sourceTypes = Service.Get <VideoDataManager>().SourceTypes;

            foreach (string current in sourceTypes.Keys)
            {
                string key3 = lang.Get(sourceTypes[current], new object[0]);
                dictionary[key2].Choices[key3] = new string[]
                {
                    current
                };
            }
            return(dictionary);
        }