public override void Initialize() { StationInfo stationInfo = this._app.GameDatabase.GetStationInfo(this._stationID); OrbitalObjectInfo orbitalObjectInfo1 = this._app.GameDatabase.GetOrbitalObjectInfo(this._stationID); OrbitalObjectInfo orbitalObjectInfo2 = this._app.GameDatabase.GetOrbitalObjectInfo(orbitalObjectInfo1.ParentID.Value); if (stationInfo == null || orbitalObjectInfo1 == null) { this._app.UI.CloseDialog((Dialog)this, true); } else { this._app.UI.SetText(this._app.UI.Path(this.ID, "station_class"), string.Format(App.Localize("@STATION_LEVEL"), (object)stationInfo.DesignInfo.StationLevel.ToString(), (object)stationInfo.DesignInfo.StationType.ToDisplayText(this._app.LocalPlayer.Faction.Name))); this._app.UI.SetText(this._app.UI.Path(this.ID, "upkeep_cost"), string.Format(App.Localize("@STATION_UPKEEP_COST"), (object)GameSession.CalculateStationUpkeepCost(this._app.GameDatabase, this._app.AssetDatabase, stationInfo).ToString())); if (stationInfo.DesignInfo.StationType == StationType.NAVAL) { this._app.UI.SetText(this._app.UI.Path(this.ID, "naval_capacity"), string.Format(App.Localize("@STATION_FLEET_CAPACITY"), (object)this._app.GameDatabase.GetSystemSupportedCruiserEquivalent(this._app.Game, orbitalObjectInfo2.StarSystemID, this._app.LocalPlayer.ID).ToString())); } else { this._app.UI.SetVisible(this._app.UI.Path(this.ID, "naval_capacity"), false); } StationUI.SyncStationDetailsWidget(this._app.Game, "detailsCard", this._stationID, true); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo2.StarSystemID); this._app.UI.SetText("gameStationName", orbitalObjectInfo1.Name); this._enteredStationName = orbitalObjectInfo2.Name; this._app.UI.SetText(this._app.UI.Path(this.ID, "system_name"), string.Format(App.Localize("@STATION_BUILT"), (object)starSystemInfo.Name).ToUpperInvariant()); } }
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); } } }
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); }
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); }