示例#1
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);
            }
        }