protected override void OnExit(GameState prev, ExitReason reason) { this.App.HotKeyManager.RemoveListener((IKeyBindListener)this); if (this._manager != null) { this._manager.Dispose(); this._manager = (FleetManager)null; } if (this._fleetWidget != null) { this._fleetWidget.OnFleetsModified -= new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); this._fleetWidget.Dispose(); this._fleetWidget = (FleetWidget)null; } foreach (ShipDummy shipDummy in this._shipDummies) { shipDummy.Dispose(); } this._shipDummies = (List <ShipDummy>)null; if (this._camera != null) { this._camera.Dispose(); this._camera = (OrbitCameraController)null; } if (this._crits != null) { this._crits.Dispose(); this._crits = (GameObjectSet)null; } this.App.UI.DestroyPanel(this._contextMenuID); this.App.UI.DestroyPanel(this._shipContextMenuID); this.App.UI.GameEvent -= new UIEventGameEvent(this.UICommChannel_GameEvent); }
public ReactionDialog(App game, ReactionInfo reaction) : base(game, "ReactionPopup") { this._currentReaction = reaction; this._interceptFleetWidget = new FleetWidget(game, game.UI.Path(this.ID, ReactionDialog.UILeftPanel, ReactionDialog.UIFleetWidget)); this._interceptFleetWidget.EnemySelectionEnabled = true; this._interceptFleetWidget.SetSyncedFleets(reaction.fleetsInRange); }
protected override void OnEnter() { base.OnEnter(); this._reactionfleet = new FleetWidget(this.App, this.App.UI.Path(this.ID, OverlayReactionlMission.UI_CURRENTFLEETLIST)); this._reactionfleet.ScrapEnabled = false; this._reactionfleet.SetEnabled(false); this.PathDrawEnabled = false; this._containers.Clear(); this._reactions = this._app.Game.GetPendingReactions().Where <ReactionInfo>((Func <ReactionInfo, bool>)(x => x.fleet.PlayerID == this._app.LocalPlayer.ID)).ToList <ReactionInfo>(); foreach (ReactionInfo reaction in this._reactions) { this._app.UI.AddItem(OverlayReactionlMission.UI_REACTIONLIST_PANEL, "", reaction.fleet.ID, ""); string itemGlobalId = this._app.UI.GetItemGlobalID(OverlayReactionlMission.UI_REACTIONLIST_PANEL, "", reaction.fleet.ID, ""); this._app.UI.SetText(this.App.UI.Path(itemGlobalId, "fleetname"), reaction.fleet.Name); string propertyValue = "ReactionButton|" + reaction.fleet.ID.ToString(); this._app.UI.SetPropertyString(this.UI.Path(itemGlobalId, "reaction_button"), "id", propertyValue); this._containers.Add(new OverlayReactionlMission.ReactionUIContainer() { Reaction = reaction, ListItemID = itemGlobalId, buttonID = propertyValue, TargetFleet = new int?() }); } this._fleetWidget.EnemySelectionEnabled = true; this._fleetWidget.OnFleetSelectionChanged += new FleetWidget.FleetSelectionChangedDelegate(this.OnFleetSelectionChanged); this._fleetWidget.MissionMode = MissionType.NO_MISSION; this._starMap.FocusEnabled = true; this._starMap.SelectEnabled = true; foreach (int key in this._starMap.Systems.Reverse.Keys) { bool flag = false; foreach (OverlayReactionlMission.ReactionUIContainer container in this._containers) { foreach (FleetInfo fleetInfo in container.Reaction.fleetsInRange) { if (fleetInfo.SystemID == key) { flag = true; break; } } if (container.Reaction.fleet.SystemID == key) { flag = true; } if (flag) { break; } } this._starMap.Systems.Reverse[key].SetIsEnabled(flag); this._starMap.Systems.Reverse[key].SetIsSelectable(flag); } this.SelectReaction(this._containers.First <OverlayReactionlMission.ReactionUIContainer>()); }
public override string[] CloseDialog() { if (this._RelocatefleetWidget != null) { this._fleetWidget.UnlinkWidgets(); this._RelocatefleetWidget.UnlinkWidgets(); this._RelocatefleetWidget.SetSyncedFleets(0); this._RelocatefleetWidget.SelectedFleet = 0; this._RelocatefleetWidget.OnFleetsModified -= new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); this._RelocatefleetWidget.Dispose(); } this.App.UI.PurgeFleetWidgetCache(); this._RelocatefleetWidget = (FleetWidget)null; return(base.CloseDialog()); }
protected override void OnPrepare(GameState prev, object[] stateParams) { if (this.App.GameDatabase == null) { this.App.NewGame(); this._targetSystemID = this.App.GameDatabase.GetPlayerHomeworld(this.App.LocalPlayer.ID).SystemID; DesignInfo design = new DesignInfo(); design.PlayerID = this.App.LocalPlayer.ID; design.DesignSections = new DesignSectionInfo[1]; design.DesignSections[0] = new DesignSectionInfo() { DesignInfo = design }; design.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\sn_drone_satellite.section"; int designID = this.App.GameDatabase.InsertDesignByDesignInfo(design); int id = this.App.GameDatabase.InsertOrGetDefenseFleetInfo(this._targetSystemID, this.App.LocalPlayer.ID).ID; for (int index = 0; index < 5; ++index) { this.App.GameDatabase.InsertShip(id, designID, null, (ShipParams)0, new int?(), 0); } } this._targetSystemID = ((IEnumerable <object>)stateParams).Count <object>() <= 0 ? this.App.GameDatabase.GetPlayerHomeworld(this.App.LocalPlayer.ID).SystemID : (int)stateParams[0]; PlanetInfo planetInfo = this.App.GameDatabase.GetPlanetInfosOrbitingStar(this._targetSystemID).FirstOrDefault <PlanetInfo>(); this._selectedPlanetID = planetInfo == null ? 0 : planetInfo.ID; base.OnPrepare(prev, new object[2] { (object)this._targetSystemID, (object)this._selectedPlanetID }); this._pendingObjects = new List <IGameObject>(); this._manager = new DefenseManager(this.App); this._dmcrits = new GameObjectSet(this.App); this.App.UI.LoadScreen("DefenseManager"); this._fleetWidget = new FleetWidget(this.App, "DefenseManager.gameFleetList"); bool enabled = true; if (((IEnumerable <object>)stateParams).Count <object>() >= 2) { enabled = (bool)stateParams[1]; } this._fleetWidget.EnableRightClick = enabled; this._fleetWidget.SetEnabled(enabled); this._defenseWidget = new DefenseWidget(this.App, "defenseItemTray"); this._fleetWidget.OnFleetsModified += new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); }
public override void Initialize() { this.App.UI.UnlockUI(); this._mainWidget = new FleetWidget(this.App, this.UI.Path(this.ID, "fleetList")); this._mainWidget.JumboMode = true; this.App.UI.AddItem("filterDropdown", "", 0, App.Localize("@UI_GENERAL_ALL")); this.App.UI.AddItem("filterDropdown", "", 1, App.Localize("@UI_GENERAL_NORMAL_FLEETS")); this.App.UI.AddItem("filterDropdown", "", 2, App.Localize("@UI_GENERAL_NAME")); this.App.UI.AddItem("filterDropdown", "", 3, App.Localize("@UI_GENERAL_ADMIRAL")); this.App.UI.AddItem("filterDropdown", "", 4, App.Localize("@UI_GENERAL_BASE_SYSTEM")); this.App.UI.AddItem("filterDropdown", "", 5, App.Localize("@UI_GENERAL_UNITCOUNT")); this.App.UI.AddItem("filterDropdown", "", 6, App.Localize("@UI_GENERAL_MISSION")); this.App.UI.AddItem("filterDropdown", "", 7, App.Localize("@UI_MISSIONFLEET_NO_MISSION")); this.App.UI.SetSelection("filterDropdown", 0); this._currentFilterMode = FleetSummaryDialog.FilterFleets.All; this._mainWidget.OnFleetSelectionChanged = new FleetWidget.FleetSelectionChangedDelegate(FleetSummaryDialog.FleetSelectionChanged); this.RefreshFleets(); }
public override void Initialize() { this.fleetlist = new FleetWidget(this._app, this.UI.Path(this.ID, "gameFleetList")); this.workingfleet = new FleetWidget(this._app, this.UI.Path(this.ID, "gameWorkingFleet")); this.fleetlist.DisableTooltips = true; this.workingfleet.DisableTooltips = true; this.fleetlist.LinkWidget(this.workingfleet); this.workingfleet.LinkWidget(this.fleetlist); if (this._app.CurrentState == this._app.GetGameState <FleetManagerState>()) { this._app.UI.SetVisible(this._app.UI.Path(this.ID, "FleetManager"), false); } else { this._app.UI.SetVisible(this._app.UI.Path(this.ID, "FleetManager"), true); } this.fleetlist.SetSyncedFleets(this._app.GameDatabase.GetFleetsByPlayerAndSystem(this.App.LocalPlayer.ID, this._systemid, FleetType.FL_NORMAL | FleetType.FL_RESERVE | FleetType.FL_DEFENSE).Where <FleetInfo>((Func <FleetInfo, bool>)(x => x.ID != this.fleetid)).ToList <FleetInfo>()); this.workingfleet.SetSyncedFleets(this.fleetid); OverlayMission.RefreshFleetAdmiralDetails(this.App, this.ID, this.fleetid, "admiralDetails"); }
protected override void OnEnter() { base.OnEnter(); StarSystemUI.SyncSystemDetailsWidget(this.App, "systemDetailsWidget", this.TargetSystem, false, true); if (this.MissionType == MissionType.RELOCATION) { this._RelocatefleetWidget = new FleetWidget(this.App, this.App.UI.Path(this.ID, "gameRelocateFleet")); } if (this.MissionType == MissionType.RELOCATION) { this._RelocatefleetWidget.MissionMode = MissionType.NO_MISSION; this._fleetWidget.LinkWidget(this._RelocatefleetWidget); this._RelocatefleetWidget.LinkWidget(this._fleetWidget); this._RelocatefleetWidget.OnFleetsModified += new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); } this.CaravanMode = false; this.CaravanFleet = new int?(); this.SelectedCaravanSourceSystem = new int?(); if (this._app.AssetDatabase.GetFaction(this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID).FactionID).Name == "loa" || this._fleetCentric) { this._app.UI.SetVisible(this.UI.Path(this.ID, "RelocateAssetsBTN"), false); this._app.UI.SetEnabled(this.UI.Path(this.ID, "RelocateAssetsBTN"), false); } else { this._app.UI.SetVisible(this.UI.Path(this.ID, "RelocateAssetsBTN"), true); if (this.CanDoCaravan()) { this._app.UI.SetEnabled(this.UI.Path(this.ID, "RelocateAssetsBTN"), true); } else { this._app.UI.SetEnabled(this.UI.Path(this.ID, "RelocateAssetsBTN"), false); } } this._app.UI.SetVisible(this.UI.Path(this.ID, "caravanFade"), false); }
protected override void OnPrepare(GameState prev, object[] stateParams) { if (this.App.GameDatabase == null) { this.App.NewGame(); } this._targetSystemID = ((IEnumerable <object>)stateParams).Count <object>() <= 0 ? this.App.GameDatabase.GetPlayerHomeworld(this.App.LocalPlayer.ID).SystemID : (int)stateParams[0]; this._prevFleetID = -1; this._sky = new Sky(this.App, SkyUsage.InSystem, 0); this._crits = new GameObjectSet(this.App); this._crits.Add((IGameObject)this._sky); this._manager = new FleetManager(this.App); this._shipDummies = new List <ShipDummy>(); this.SyncFleetShipModels(this._targetSystemID); this.App.UI.LoadScreen("FleetManager"); this._contextMenuID = this.App.UI.CreatePanelFromTemplate("FleetManagerContextMenu", null); this._shipContextMenuID = this.App.UI.CreatePanelFromTemplate("FleetManagerShipContextMenu", null); this._fleetWidget = new FleetWidget(this.App, "FleetManager.fleetDetailsWidget.gameFleetList"); this._fleetWidget.DisableTooltips = true; this._fleetWidget.SeparateDefenseFleet = false; this._fleetWidget.EnableMissionButtons = false; this._fleetWidget.OnFleetsModified += new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); this._fleetWidget.EnableCreateFleetButton = false; }
public override void Initialize() { this._colonyWidget = new FleetWidget(this._app, this.UI.Path(this.ID, "repairWidgetColonyList")); List <PlanetInfo> list1 = ((IEnumerable <PlanetInfo>) this._app.GameDatabase.GetStarSystemPlanetInfos(this._systemID)).ToList <PlanetInfo>(); List <PlanetInfo> planets1 = new List <PlanetInfo>(); List <ColonyInfo> source = new List <ColonyInfo>(); foreach (PlanetInfo planetInfo in list1) { ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(planetInfo.ID); if (colonyInfoForPlanet != null) { source.Add(colonyInfoForPlanet); if (colonyInfoForPlanet.PlayerID == this._app.LocalPlayer.ID) { planets1.Add(planetInfo); } } } this._colonyWidget.SetSyncedPlanets(planets1); this._suulkaWidget = new FleetWidget(this._app, this.UI.Path(this.ID, "gameRightListS")); this._suulkaWidget.ShipFilter += new FleetWidget.FleetWidgetShipFilter(this.SuulkaListFilter); this._suulkaWidget.SuulkaMode = true; this._suulkaWidget.DisableTooltips = true; this._suulkaDrainWidget = new FleetWidget(this._app, this.UI.Path(this.ID, "repairWidgetColonyList")); List <PlanetInfo> planets2 = new List <PlanetInfo>(); bool flag = this._fleets.Any <FleetInfo>((Func <FleetInfo, bool>)(x => { if (x.IsNormalFleet) { return(x.PlayerID != this._app.LocalPlayer.ID); } return(false); })); foreach (PlanetInfo planetInfo in list1) { PlanetInfo pi = planetInfo; ColonyInfo colonyInfo = source.FirstOrDefault <ColonyInfo>((Func <ColonyInfo, bool>)(x => x.OrbitalObjectID == pi.ID)); if ((!flag || colonyInfo == null || colonyInfo.PlayerID == this._app.LocalPlayer.ID) && (pi.Biosphere > 0 || colonyInfo != null)) { planets2.Add(pi); } } this._suulkaDrainWidget.SetSyncedPlanets(planets2); this._leftWidget = new FleetWidget(this._app, this.UI.Path(this.ID, "gameLeftList")); this._rightWidget = new FleetWidget(this._app, this.UI.Path(this.ID, "gameRightList")); this._leftWidget.DisableTooltips = true; this._rightWidget.RidersEnabled = true; this._rightWidget.SeparateDefenseFleet = false; this._rightWidget.DisableTooltips = true; this._leftWidget.ShipFilter += new FleetWidget.FleetWidgetShipFilter(this.LeftListFilter); this._rightWidget.ShipFilter += new FleetWidget.FleetWidgetShipFilter(this.RightListFilter); this._leftWidget.ShowColonies = true; this._leftWidget.OnlyLocalPlayer = true; this._leftWidget.ListStations = true; this._rightWidget.ListStations = true; List <StationInfo> list2 = this._app.GameDatabase.GetStationForSystemAndPlayer(this._systemID, this._app.LocalPlayer.ID).ToList <StationInfo>(); this._leftWidget.SetSyncedFleets(this._fleets); this._rightWidget.SetSyncedFleets(this._fleets); this._leftWidget.SetSyncedStations(list2); this._rightWidget.SetSyncedStations(list2); this._suulkaWidget.SetSyncedFleets(this._fleets); this._leftWidget.ShowEmptyFleets = false; this._rightWidget.ShowEmptyFleets = false; this._leftWidget.ShowFleetInfo = false; this._rightWidget.ShowFleetInfo = false; this._suulkaWidget.ShowEmptyFleets = false; this._suulkaWidget.ShowFleetInfo = false; this._rightWidget.RepairWidget = this._leftWidget; this._suulkaWidget.RepairWidget = this._suulkaDrainWidget; this._leftWidget.ShowRepairPoints = true; this._rightWidget.RepairMode = true; this._leftWidget.ExpandAll(); this._rightWidget.ExpandAll(); this._suulkaWidget.ExpandAll(); }
public FleetWidget.FilterShips RightListFilter(ShipInfo ship, DesignInfo design) { FleetInfo fleetInfo = this._app.GameDatabase.GetFleetInfo(ship.FleetID); if ((fleetInfo != null ? fleetInfo.PlayerID : design.PlayerID) != this._app.LocalPlayer.ID || Kerberos.Sots.StarFleet.StarFleet.DesignIsSuulka(this._app, design) || FleetWidget.IsWeaponBattleRider(design)) { return(FleetWidget.FilterShips.Ignore); } Kerberos.Sots.StarFleet.StarFleet.GetHealthAndHealthMax(this._app.Game, design, ship.ID); return(FleetWidget.FilterShips.Enable); }
public override string[] CloseDialog() { this._mainWidget.Dispose(); this._mainWidget = (FleetWidget)null; return((string[])null); }
protected override void OnPrepare(GameState prev, object[] stateParams) { if (this.App.GameDatabase == null) { this.App.NewGame(); this._targetSystemID = ((IEnumerable <object>)stateParams).Count <object>() <= 0 ? this.App.GameDatabase.GetPlayerHomeworld(this.App.LocalPlayer.ID).SystemID : (int)stateParams[0]; DesignInfo design1 = new DesignInfo(); design1.PlayerID = this.App.LocalPlayer.ID; design1.DesignSections = new DesignSectionInfo[2]; design1.DesignSections[0] = new DesignSectionInfo(); design1.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\br_eng_fusion.section"; design1.DesignSections[1] = new DesignSectionInfo(); design1.DesignSections[1].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\br_msn_spinal.section"; int designID1 = this.App.GameDatabase.InsertDesignByDesignInfo(design1); int?reserveFleetId = this.App.GameDatabase.GetReserveFleetID(this.App.LocalPlayer.ID, this._targetSystemID); for (int index = 0; index < 5; ++index) { this.App.GameDatabase.InsertShip(reserveFleetId.Value, designID1, null, (ShipParams)0, new int?(), 0); } DesignInfo design2 = new DesignInfo(); design2.PlayerID = this.App.LocalPlayer.ID; design2.DesignSections = new DesignSectionInfo[2]; design2.DesignSections[0] = new DesignSectionInfo(); design2.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\br_eng_fusion.section"; design2.DesignSections[1] = new DesignSectionInfo(); design2.DesignSections[1].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\br_msn_scout.section"; int designID2 = this.App.GameDatabase.InsertDesignByDesignInfo(design2); for (int index = 0; index < 5; ++index) { this.App.GameDatabase.InsertShip(reserveFleetId.Value, designID2, null, (ShipParams)0, new int?(), 0); } DesignInfo design3 = new DesignInfo(); design3.PlayerID = this.App.LocalPlayer.ID; design3.Name = "My Fun Design Has A Long Ass Name"; design3.Role = ShipRole.CARRIER; design3.DesignSections = new DesignSectionInfo[3]; design3.DesignSections[0] = new DesignSectionInfo(); design3.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\cr_eng_fusion.section"; design3.DesignSections[1] = new DesignSectionInfo(); design3.DesignSections[1].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\cr_mis_brcarrier.section"; design3.DesignSections[2] = new DesignSectionInfo(); design3.DesignSections[2].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\cr_cmd_assault.section"; int designID3 = this.App.GameDatabase.InsertDesignByDesignInfo(design3); Random random = new Random(); for (int index = 0; index < 5; ++index) { foreach (SectionInstanceInfo shipSectionInstance in this.App.GameDatabase.GetShipSectionInstances(this.App.GameDatabase.InsertShip(reserveFleetId.Value, designID3, null, (ShipParams)0, new int?(), 0))) { shipSectionInstance.Structure = (int)((double)shipSectionInstance.Structure * (double)random.NextSingle()); this.App.GameDatabase.UpdateSectionInstance(shipSectionInstance); } } DesignInfo design4 = new DesignInfo(); design4.PlayerID = this.App.LocalPlayer.ID; design4.Name = "Repair Dem"; design4.Role = ShipRole.CARRIER; design4.DesignSections = new DesignSectionInfo[3]; design4.DesignSections[0] = new DesignSectionInfo(); design4.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\cr_eng_fusion.section"; design4.DesignSections[1] = new DesignSectionInfo(); design4.DesignSections[1].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\cr_mis_repair.section"; design4.DesignSections[2] = new DesignSectionInfo(); design4.DesignSections[2].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\cr_cmd_assault.section"; int designID4 = this.App.GameDatabase.InsertDesignByDesignInfo(design4); for (int index = 0; index < 3; ++index) { this.App.GameDatabase.InsertShip(reserveFleetId.Value, designID4, null, (ShipParams)0, new int?(), 0); } DesignInfo designInfo = new DesignInfo(); design4.PlayerID = this.App.LocalPlayer.ID; design4.Name = "Little MEEP"; design4.DesignSections = new DesignSectionInfo[2]; design4.DesignSections[0] = new DesignSectionInfo(); design4.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\br_eng_fusion.section"; design4.DesignSections[1] = new DesignSectionInfo(); design4.DesignSections[1].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\br_msn_spinal.section"; this.App.GameDatabase.InsertDesignByDesignInfo(design4); DesignInfo design5 = new DesignInfo(); design5.PlayerID = this.App.LocalPlayer.ID; design5.Name = "My Fun Leviathan"; design5.Role = ShipRole.CARRIER; design5.Class = ShipClass.Leviathan; design5.DesignSections = new DesignSectionInfo[1]; design5.DesignSections[0] = new DesignSectionInfo(); design5.DesignSections[0].FilePath = "factions\\" + this.App.LocalPlayer.Faction.Name + "\\sections\\lv_carrier.section"; int designID5 = this.App.GameDatabase.InsertDesignByDesignInfo(design5); for (int index = 0; index < 5; ++index) { this.App.GameDatabase.InsertShip(reserveFleetId.Value, designID5, null, (ShipParams)0, new int?(), 0); } } else { this._targetSystemID = ((IEnumerable <object>)stateParams).Count <object>() <= 0 ? this.App.GameDatabase.GetPlayerHomeworld(this.App.LocalPlayer.ID).SystemID : (int)stateParams[0]; } this.App.UI.LoadScreen("RiderManager"); this._pendingObjects = new List <IGameObject>(); this._shipDummies = new List <ShipDummy>(); this._crits = new GameObjectSet(this.App); this._fleetWidget = new FleetWidget(this.App, "RiderManager.gameFleetWidget"); this._fleetWidget.SeparateDefenseFleet = false; this._fleetWidget.ShipSelectionEnabled = true; this.App.UI.ClearItems("RiderManager.riderList"); }