コード例 #1
0
        protected void SyncStationList()
        {
            this.App.UI.ClearItems("station_list");
            this.App.UI.ClearItems("stationModules");
            this.App.UI.ClearItems("moduleQue");
            this.App.UI.SetText("queueCost", "");
            this.App.UI.SetText("turnsToComplete", "");
            this.App.UI.SetPropertyString("moduleDescriptionText", "text", "");
            List <StationInfo> source = this._systemID == 0 ? this.App.GameDatabase.GetStationInfosByPlayerID(this.App.Game.LocalPlayer.ID).ToList <StationInfo>() : this.App.GameDatabase.GetStationForSystemAndPlayer(this._systemID, this.App.Game.LocalPlayer.ID).ToList <StationInfo>();

            foreach (StationInfo stationInfo in new List <StationInfo>((IEnumerable <StationInfo>)source))
            {
                if (!StationManagerDialog.StationViewFilter[stationInfo.DesignInfo.StationType])
                {
                    source.Remove(stationInfo);
                }
            }
            foreach (SystemWidget systemWidget in this._systemWidgets)
            {
                systemWidget.Terminate();
            }
            this._systemWidgets.Clear();
            List <int> intList = new List <int>();

            source.RemoveAll((Predicate <StationInfo>)(x => this.App.GameDatabase.GetOrbitalObjectInfo(x.OrbitalObjectID) == null));
            foreach (StationInfo stationInfo in source.OrderBy <StationInfo, string>((Func <StationInfo, string>)(x => this.App.GameDatabase.GetStarSystemInfo(this.App.GameDatabase.GetOrbitalObjectInfo(x.OrbitalObjectID).StarSystemID).Name)).ToList <StationInfo>())
            {
                if (stationInfo.DesignInfo.StationLevel > 0 && (stationInfo.DesignInfo.StationType == this._currentFilterMode || this._currentFilterMode == StationType.INVALID_TYPE))
                {
                    int starSystemId = this.App.GameDatabase.GetOrbitalObjectInfo(stationInfo.OrbitalObjectID).StarSystemID;
                    if (!intList.Contains(starSystemId))
                    {
                        StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(starSystemId);
                        if (!(starSystemInfo == (StarSystemInfo)null) && !starSystemInfo.IsDeepSpace)
                        {
                            this.App.UI.AddItem("station_list", "", starSystemId + 999999, "", "systemTitleCard");
                            string itemGlobalId = this.App.UI.GetItemGlobalID("station_list", "", starSystemId + 999999, "");
                            intList.Add(starSystemId);
                            this._systemWidgets.Add(new SystemWidget(this.App, itemGlobalId));
                            this._systemWidgets.Last <SystemWidget>().Sync(starSystemId);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    this.App.UI.AddItem("station_list", string.Empty, stationInfo.OrbitalObjectID, string.Empty, "navalStation_DetailsCard");
                    this._selectedStation = stationInfo;
                    this.SyncStationProgress();
                    StationUI.SyncStationDetailsWidget(this.App.Game, this.App.UI.GetItemGlobalID("station_list", string.Empty, stationInfo.OrbitalObjectID, string.Empty), stationInfo.OrbitalObjectID, true);
                }
            }
        }
コード例 #2
0
        internal static void SyncStationModulesControl(
            GameSession game,
            string panelName,
            StationInfo station,
            string itemId = null)
        {
            foreach (KeyValuePair <StationType, string> stationModulePanel in StationUI.StationModulePanelMap)
            {
                game.UI.SetVisible(game.UI.Path(panelName, stationModulePanel.Value), (stationModulePanel.Key == station.DesignInfo.StationType ? 1 : 0) != 0);
            }
            string str1 = game.UI.Path(panelName, StationUI.StationModulePanelMap[station.DesignInfo.StationType]);
            List <LogicalModuleMount> list1         = ((IEnumerable <LogicalModuleMount>)game.AssetDatabase.ShipSections.First <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x => x.FileName == station.DesignInfo.DesignSections[0].FilePath)).Modules).ToList <LogicalModuleMount>();
            List <DesignModuleInfo>   builtModules  = station.DesignInfo.DesignSections[0].Modules;
            List <DesignModuleInfo>   queuedModules = game.GameDatabase.GetQueuedStationModules(station.DesignInfo.DesignSections[0]).ToList <DesignModuleInfo>();

            foreach (string str2 in StationUI.StationModuleMap[station.DesignInfo.StationType])
            {
                string s = str2;
                List <LogicalModuleMount> list2 = list1.Where <LogicalModuleMount>((Func <LogicalModuleMount, bool>)(x => x.ModuleType == StationUI.ModuleTypeMap[s])).ToList <LogicalModuleMount>();
                List <LogicalModuleMount> list3 = list2.Where <LogicalModuleMount>((Func <LogicalModuleMount, bool>)(x => builtModules.Any <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(y => y.MountNodeName == x.NodeName)))).ToList <LogicalModuleMount>();
                List <LogicalModuleMount> list4 = list2.Where <LogicalModuleMount>((Func <LogicalModuleMount, bool>)(x => queuedModules.Any <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(y => y.MountNodeName == x.NodeName)))).ToList <LogicalModuleMount>();
                List <DesignModuleInfo>   list5 = builtModules.Where <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(x =>
                {
                    ModuleEnums.StationModuleType?stationModuleType1 = x.StationModuleType;
                    ModuleEnums.StationModuleType stationModuleType2 = StationUI.ModuleToStationModuleTypeMap[s];
                    if (stationModuleType1.GetValueOrDefault() == stationModuleType2)
                    {
                        return(stationModuleType1.HasValue);
                    }
                    return(false);
                })).ToList <DesignModuleInfo>();
                List <DesignModuleInfo> list6 = queuedModules.Where <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(x =>
                {
                    ModuleEnums.StationModuleType?stationModuleType1 = x.StationModuleType;
                    ModuleEnums.StationModuleType stationModuleType2 = StationUI.ModuleToStationModuleTypeMap[s];
                    if (stationModuleType1.GetValueOrDefault() == stationModuleType2)
                    {
                        return(stationModuleType1.HasValue);
                    }
                    return(false);
                })).ToList <DesignModuleInfo>();
                int count1           = list5.Count;
                int count2           = list6.Count;
                int modulesAvailable = list2.Count - list3.Count - list4.Count;
                StationUI.SyncModuleItemControl(game, game.UI.Path(str1, s), count1, count2, modulesAvailable, itemId);
            }
        }
コード例 #3
0
        protected override void OnEnter()
        {
            base.OnEnter();
            this.UI.SetVisible("overlayStationList", false);
            this.UI.SetVisible("stationTypes", true);
            EmpireBarUI.SyncTitleFrame(this.App);
            this.App.UI.ClearItems("station_list");
            List <StationInfo> upgradableStations = this.App.Game.GetUpgradableStations(this.App.GameDatabase.GetStationForSystemAndPlayer(this.TargetSystem, this.App.LocalPlayer.ID).ToList <StationInfo>());

            foreach (StationInfo stationInfo in upgradableStations)
            {
                this.App.UI.AddItem("station_list", string.Empty, stationInfo.OrbitalObjectID, string.Empty);
                StationUI.SyncStationDetailsWidget(this.App.Game, this.App.UI.GetItemGlobalID("station_list", string.Empty, stationInfo.OrbitalObjectID, string.Empty), stationInfo.OrbitalObjectID, true);
            }
            OrbitalObjectInfo orbitalObjectInfo = this._app.GameDatabase.GetOrbitalObjectInfo(this.StartSelect);

            this.SelectedStation = orbitalObjectInfo == null || orbitalObjectInfo.StarSystemID != this.TargetSystem ? upgradableStations[0].OrbitalObjectID : this.StartSelect;
            this.App.UI.SetSelection("station_list", this.SelectedStation);
        }
コード例 #4
0
        internal static void SyncStationDetailsWidget(
            GameSession game,
            string panelName,
            int stationID,
            bool updateButtonIds)
        {
            StationInfo    station        = game.GameDatabase.GetStationInfo(stationID);
            StarSystemInfo starSystemInfo = game.GameDatabase.GetStarSystemInfo(game.GameDatabase.GetOrbitalObjectInfo(station.OrbitalObjectID).StarSystemID);
            Dictionary <ModuleEnums.StationModuleType, int> requiredModules1;
            float  stationUpgradeProgress1 = game.GetStationUpgradeProgress(station, out requiredModules1);
            string propertyValue           = string.Format("{0}|station_upgrade", (object)station.OrbitalObjectID);

            if (updateButtonIds)
            {
                game.UI.SetPropertyString(game.UI.Path(panelName, "station_upgrade"), "id", propertyValue);
            }
            game.UI.SetPropertyString(game.UI.Path(panelName, "station_system"), "text", starSystemInfo.Name);
            game.UI.SetPropertyString(game.UI.Path(panelName, "station_name"), "text", game.GameDatabase.GetOrbitalObjectInfo(station.OrbitalObjectID).Name);
            game.UI.SetPropertyString(game.UI.Path(panelName, "station_preview"), "sprite", StationUI.GetStationIcon(station.DesignInfo.StationType, game.GameDatabase.GetFactionName(game.GameDatabase.GetPlayerFactionID(station.PlayerID)) == "zuul"));
            game.UI.SetPropertyString(game.UI.Path(panelName, "station_level"), "text", string.Format("{0} {1}", (object)App.Localize("@UI_STATIONMANAGER_STAGE"), (object)station.DesignInfo.StationLevel));
            game.UI.SetPropertyString(game.UI.Path(panelName, "stationLevel"), "text", string.Format("{0}", (object)station.DesignInfo.StationLevel));
            game.UI.SetEnabled(game.UI.Path(panelName, propertyValue), ((double)stationUpgradeProgress1 == 1.0 ? 1 : 0) != 0);
            game.UI.SetPropertyInt(game.UI.Path(panelName, "station_progress"), "value", (int)((double)stationUpgradeProgress1 * 100.0));
            game.UI.SetPropertyString(game.UI.Path(panelName, "itemSubTitle"), "text", station.DesignInfo.StationType.ToDisplayText(game.GameDatabase.GetFactionName(game.GameDatabase.GetPlayerFactionID(station.PlayerID))) + " | " + station.DesignInfo.Name);
            game.UI.SetPropertyString(game.UI.Path(panelName, "stationPopulation"), "text", station.DesignInfo.CrewRequired.ToString("N0"));
            int[] healthAndHealthMax = Kerberos.Sots.StarFleet.StarFleet.GetHealthAndHealthMax(game, station.DesignInfo, station.ShipID);
            game.UI.SetPropertyString(game.UI.Path(panelName, "stationStructure"), "text", healthAndHealthMax[0].ToString() + "/" + (object)healthAndHealthMax[1]);
            game.UI.SetPropertyString(game.UI.Path(panelName, "stationUpkeep"), "text", GameSession.CalculateStationUpkeepCost(game.GameDatabase, game.AssetDatabase, station).ToString("N0"));
            string str1             = station.GetBaseStratSensorRange().ToString();
            float  stratSensorRange = game.GameDatabase.GetStationAdditionalStratSensorRange(station);

            if ((double)stratSensorRange > 0.0)
            {
                str1 = str1 + "(+" + stratSensorRange.ToString() + ")";
            }
            string str2 = GameSession.GetStationBaseTacSensorRange(game, station).ToString("N0");
            float  additionalTacSensorRange = GameSession.GetStationAdditionalTacSensorRange(game, station);

            if ((double)additionalTacSensorRange > 0.0)
            {
                str2 = str2 + "(+" + additionalTacSensorRange.ToString("N0") + ")";
            }
            game.UI.SetPropertyString(game.UI.Path(panelName, "stationStratSensorRange"), "text", str1 + " ly");
            game.UI.SetPropertyString(game.UI.Path(panelName, "stationTacSensorRange"), "text", str2 + " km");
            StationUI.SyncStationDetailsControl(game, game.UI.Path(panelName, "generalstats"), station);
            if (updateButtonIds)
            {
                StationUI.SyncStationModulesControl(game, game.UI.Path(panelName, "module_details"), station, stationID.ToString());
            }
            else
            {
                StationUI.SyncStationModulesControl(game, game.UI.Path(panelName, "module_details"), station, null);
            }
            ((IEnumerable <LogicalModuleMount>)game.AssetDatabase.ShipSections.First <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x => x.FileName == station.DesignInfo.DesignSections[0].FilePath)).Modules).ToList <LogicalModuleMount>();
            List <DesignModuleInfo> modules = station.DesignInfo.DesignSections[0].Modules;

            if (station.DesignInfo.StationLevel == 5)
            {
                game.UI.SetPropertyInt(game.UI.Path(panelName, "upgradeProgress"), "value", 100);
                game.UI.SetPropertyColorNormalized(game.UI.Path(panelName, "upgradeProgress.overlay_idle.image"), "color", 0.8f, 0.7f, 0.0f);
            }
            else
            {
                Dictionary <ModuleEnums.StationModuleType, int> requiredModules2 = new Dictionary <ModuleEnums.StationModuleType, int>();
                float stationUpgradeProgress2 = game.GetStationUpgradeProgress(station, out requiredModules2);
                game.UI.SetPropertyInt(game.UI.Path(panelName, "upgradeProgress"), "value", (int)((double)stationUpgradeProgress2 * 100.0));
                game.UI.SetPropertyColorNormalized(game.UI.Path(panelName, "upgradeProgress.overlay_idle.image"), "color", 0.0f, 0.4f, 0.9f);
            }
        }
コード例 #5
0
        public override void Initialize()
        {
            this.App.UI.HideTooltip();
            this.BankDict       = new Dictionary <string, int>();
            this.ItemIDDict     = new Dictionary <string, string>();
            this.ModuleBankdict = new Dictionary <int, string>();
            DesignInfo designInfo = this._ship.DesignInfo;

            if (designInfo.DesignSections[0].Modules.Any <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(x =>
            {
                ModuleEnums.StationModuleType?stationModuleType = x.StationModuleType;
                if ((stationModuleType.GetValueOrDefault() != ModuleEnums.StationModuleType.Combat ? 0 : (stationModuleType.HasValue ? 1 : 0)) != 0)
                {
                    return(!x.WeaponID.HasValue);
                }
                return(false);
            })))
            {
                this.UpdateStationDesignInfo(designInfo);
                this._app.GameDatabase.UpdateDesign(designInfo);
            }
            this.WorkingDesign = new DesignInfo(this._ship.DesignInfo.PlayerID, this._ship.DesignInfo.Name, new string[1]
            {
                this._ship.DesignInfo.DesignSections[0].FilePath
            });
            this.WorkingDesign.StationLevel = designInfo.StationLevel;
            this.WorkingDesign.StationType  = designInfo.StationType;
            DesignLab.SummarizeDesign(this._app.AssetDatabase, this._app.GameDatabase, this.WorkingDesign);
            this.WorkingDesign.DesignSections[0].Modules          = new List <DesignModuleInfo>();
            this.WorkingDesign.DesignSections[0].WeaponBanks      = new List <WeaponBankInfo>();
            this.WorkingDesign.DesignSections[0].Techs            = new List <int>();
            this.WorkingDesign.DesignSections[0].ShipSectionAsset = designInfo.DesignSections[0].ShipSectionAsset;
            int num = 0;

            foreach (DesignModuleInfo module in designInfo.DesignSections[0].Modules)
            {
                DesignModuleInfo designModuleInfo = new DesignModuleInfo()
                {
                    MountNodeName     = module.MountNodeName,
                    ModuleID          = module.ModuleID,
                    WeaponID          = module.WeaponID,
                    DesignID          = module.DesignID,
                    StationModuleType = module.StationModuleType,
                    ID = num
                };
                ++num;
                this.WorkingDesign.DesignSections[0].Modules.Add(designModuleInfo);
            }
            this.UpdateStationDesignInfo(this.WorkingDesign);
            this.App.UI.ClearItems(this.App.UI.Path(this.ID, RetrofitStationDialog.RetrofitBankListID));
            DesignLab.SummarizeDesign(this._app.AssetDatabase, this._app.GameDatabase, this.WorkingDesign);
            foreach (DesignSectionInfo designSection in this.WorkingDesign.DesignSections)
            {
                foreach (DesignModuleInfo module in designSection.Modules)
                {
                    if (module.WeaponID.HasValue)
                    {
                        this.App.UI.AddItem(this.App.UI.Path(this.ID, RetrofitStationDialog.RetrofitBankListID), "", module.ID, "");
                        string        itemGlobalId  = this.App.UI.GetItemGlobalID(this.App.UI.Path(this.ID, RetrofitStationDialog.RetrofitBankListID), "", module.ID, "");
                        string        asset         = this.App.GameDatabase.GetWeaponAsset(module.WeaponID.Value);
                        LogicalWeapon logicalWeapon = this.App.AssetDatabase.Weapons.First <LogicalWeapon>((Func <LogicalWeapon, bool>)(x => x.FileName == asset));
                        this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "wepimg"), "sprite", logicalWeapon.IconSpriteName);
                        string index = "retrofitButton|" + module.ID.ToString();
                        this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "btnImageButton"), "id", index);
                        if (!this.BankDict.ContainsKey(index))
                        {
                            this.BankDict[index] = module.ID;
                        }
                        if (!this.ItemIDDict.ContainsKey(index))
                        {
                            this.ItemIDDict[index] = itemGlobalId;
                        }
                    }
                }
            }
            this._weaponSelector = new WeaponSelector(this.App.UI, "gameWeaponSelector", "");
            this.App.UI.SetParent(this._weaponSelector.ID, this.UI.Path(this.ID, "gameWeaponSelectorbox"));
            this._weaponSelector.SelectedWeaponChanged += new WeaponSelectionChangedEventHandler(this.WeaponSelectorSelectedWeaponChanged);
            StationInfo stationInfo = this.App.GameDatabase.GetStationInfosByPlayerID(this._ship.DesignInfo.PlayerID).FirstOrDefault <StationInfo>((Func <StationInfo, bool>)(x => x.ShipID == this._ship.ID));

            if (stationInfo != null)
            {
                StationUI.SyncStationDetailsWidget(this.App.Game, this.UI.Path(this.ID, "stationDetails"), stationInfo.OrbitalObjectID, true);
            }
            this.UpdateUICostETA();
            this.App.UI.SetEnabled(this.UI.Path(this.ID, "okButton"), (this.DesignChanged() ? 1 : 0) != 0);
        }