protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.starfield != null) this.starfield.Dispose(); if (this.DeepSpaceDone != null) this.DeepSpaceDone.Dispose(); if (this.EmpireDone != null) this.EmpireDone.Dispose(); if (this.DeepSpaceGateKeeper != null) this.DeepSpaceGateKeeper.Dispose(); if (this.ItemsToBuild != null) this.ItemsToBuild.Dispose(); if (this.WorkerBeginEvent != null) this.WorkerBeginEvent.Dispose(); if (this.WorkerCompletedEvent != null) this.WorkerCompletedEvent.Dispose(); if (this.anomalyManager != null) this.anomalyManager.Dispose(); if (this.bloomComponent != null) this.bloomComponent.Dispose(); if (this.ShipGateKeeper != null) this.ShipGateKeeper.Dispose(); if (this.SystemThreadGateKeeper != null) this.SystemThreadGateKeeper.Dispose(); if (this.FogMap != null) this.FogMap.Dispose(); if (this.MasterShipList != null) this.MasterShipList.Dispose(); if (this.EmpireGateKeeper != null) this.EmpireGateKeeper.Dispose(); if (this.BombList != null) this.BombList.Dispose(); if (this.flash != null) this.flash.Dispose(); if (this.lightning != null) this.lightning.Dispose(); if (this.neb_particles != null) this.neb_particles.Dispose(); if (this.photonExplosionParticles != null) this.photonExplosionParticles.Dispose(); if (this.projectileTrailParticles != null) this.projectileTrailParticles.Dispose(); if (this.sceneMap != null) this.sceneMap.Dispose(); if (this.shipListInfoUI != null) this.shipListInfoUI.Dispose(); if (this.smokePlumeParticles != null) this.smokePlumeParticles.Dispose(); if (this.sparks != null) this.sparks.Dispose(); if (this.star_particles != null) this.star_particles.Dispose(); if (this.engineTrailParticles != null) this.engineTrailParticles.Dispose(); if (this.explosionParticles != null) this.explosionParticles.Dispose(); if (this.explosionSmokeParticles != null) this.explosionSmokeParticles.Dispose(); if (this.fireTrailParticles != null) this.fireTrailParticles.Dispose(); if (this.fireParticles != null) this.fireParticles.Dispose(); if (this.flameParticles != null) this.flameParticles.Dispose(); if (this.beamflashes != null) this.beamflashes.Dispose(); if (this.dsbw != null) this.dsbw.Dispose(); if (this.SelectedShipList != null) this.SelectedShipList.Dispose(); if (this.NotificationManager != null) this.NotificationManager.Dispose(); if (this.FogMapTarget != null) this.FogMapTarget.Dispose(); } this.starfield = null; this.DeepSpaceDone = null; this.EmpireDone = null; this.DeepSpaceGateKeeper = null; this.ItemsToBuild = null; this.WorkerBeginEvent = null; this.WorkerCompletedEvent = null; this.anomalyManager = null; this.bloomComponent = null; this.ShipGateKeeper = null; this.SystemThreadGateKeeper = null; this.FogMap = null; this.MasterShipList = null; this.EmpireGateKeeper = null; this.BombList = null; this.flash = null; this.lightning = null; this.neb_particles = null; this.photonExplosionParticles = null; this.projectileTrailParticles = null; this.sceneMap = null; this.shipListInfoUI = null; this.smokePlumeParticles = null; this.sparks = null; this.star_particles = null; this.engineTrailParticles = null; this.explosionParticles = null; this.explosionSmokeParticles = null; this.fireTrailParticles = null; this.fireParticles = null; this.flameParticles = null; this.beamflashes = null; this.dsbw = null; this.SelectedShipList = null; this.NotificationManager = null; this.FogMapTarget = null; } }
public override void HandleInput(InputState input) { if (this.ScreenManager.input.CurrentKeyboardState.IsKeyDown(Keys.Space) && this.ScreenManager.input.LastKeyboardState.IsKeyUp(Keys.Space) && !GlobalStats.TakingInput) this.Paused = !this.Paused; for (int index = 0; index < this.SelectedShipList.Count; ++index) { Ship ship = this.SelectedShipList[index]; if (!ship.Active) this.SelectedShipList.QueuePendingRemoval(ship); } //CG: previous target code. if (this.previousSelection != null && input.CurrentMouseState.XButton1 == ButtonState.Pressed && input.LastMouseState.XButton1 == ButtonState.Released) { if (this.previousSelection.Active) { Ship tempship = this.previousSelection; if (this.SelectedShip != null && this.SelectedShip != this.previousSelection) this.previousSelection = this.SelectedShip; this.SelectedShip = tempship; this.ShipInfoUIElement.SetShip(this.SelectedShip); this.SelectedFleet = (Fleet)null; this.SelectedShipList.Clear(); this.SelectedItem = (UniverseScreen.ClickableItemUnderConstruction)null; this.SelectedSystem = (SolarSystem)null; this.SelectedPlanet = (Planet)null; this.SelectedShipList.Add(this.SelectedShip); } else this.SelectedShip = null; //fbedard: remove inactive ship } //fbedard: Set camera chase on ship if (input.CurrentMouseState.MiddleButton == ButtonState.Pressed) { this.ViewToShip(null); } this.input = input; this.ShowTacticalCloseup = input.CurrentKeyboardState.IsKeyDown(Keys.LeftAlt); // something nicer... //if (input.CurrentKeyboardState.IsKeyDown(Keys.P) && input.LastKeyboardState.IsKeyUp(Keys.P) && input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl)) if (input.CurrentKeyboardState.IsKeyDown(Keys.F5) && input.LastKeyboardState.IsKeyUp(Keys.F5)) { if (this.UseRealLights) { this.UseRealLights = false; } else { this.UseRealLights = true; this.SetLighting(this.UseRealLights); } } if (input.CurrentKeyboardState.IsKeyDown(Keys.F6) && input.LastKeyboardState.IsKeyUp(Keys.F6) && !ExceptionTracker.active) { bool switchedmode = false; #if RELEASE //only switch screens in release if (Game1.Instance.graphics.IsFullScreen) { switchedmode = true; Game1.Instance.graphics.ToggleFullScreen(); } #endif Exception ex = new Exception("Manual Report"); ExceptionTracker.TrackException(ex); // if(ExceptionViewer.ActiveForm == null) { bool paused = false; if (!this.Paused) { paused = true; this.Paused = true; } ExceptionTracker.DisplayException(ex); if (paused) { this.Paused = false; } } if (switchedmode) { switchedmode = false; Game1.Instance.graphics.ToggleFullScreen(); } } if (input.CurrentKeyboardState.IsKeyDown(Keys.F7) && input.LastKeyboardState.IsKeyUp(Keys.F7) && !ExceptionTracker.active) { bool switchedmode = false; #if RELEASE //only switch screens in release if (Game1.Instance.graphics.IsFullScreen) { switchedmode = true; Game1.Instance.graphics.ToggleFullScreen(); } #endif Exception ex = new Exception("Kudos"); ExceptionTracker.TrackException(ex); ExceptionTracker.Kudos = true; // if(ExceptionViewer.ActiveForm == null) { bool paused = false; if (!this.Paused) { paused = true; this.Paused = true; } ExceptionTracker.DisplayException(ex); if (paused) { this.Paused = false; } } if (switchedmode) { switchedmode = false; Game1.Instance.graphics.ToggleFullScreen(); } } if (input.CurrentKeyboardState.IsKeyDown(Keys.OemTilde) && input.LastKeyboardState.IsKeyUp(Keys.OemTilde) && (input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) && input.CurrentKeyboardState.IsKeyDown(Keys.LeftShift))) { this.Debug = !this.Debug; UniverseScreen.debug = !this.Debug; foreach (SolarSystem solarSystem in UniverseScreen.SolarSystemList) solarSystem.ExploredDict[this.player] = true; GlobalStats.LimitSpeed = this.Debug; } if (this.Debug && input.CurrentKeyboardState.IsKeyDown(Keys.G) && input.LastKeyboardState.IsKeyUp(Keys.G)) { this.Memory = (float)GC.GetTotalMemory(true); this.Memory /= 1000f; } this.HandleEdgeDetection(input); if (input.CurrentKeyboardState.IsKeyDown(Keys.OemPlus) && input.LastKeyboardState.IsKeyUp(Keys.OemPlus)) { if (this.GameSpeed < 1.0) this.GameSpeed = 1f; else ++this.GameSpeed; if (this.GameSpeed > 4.0 && GlobalStats.LimitSpeed) this.GameSpeed = 4f; } if (input.CurrentKeyboardState.IsKeyDown(Keys.OemMinus) && input.LastKeyboardState.IsKeyUp(Keys.OemMinus)) { if (this.GameSpeed <= 1.0) this.GameSpeed = 0.5f; else --this.GameSpeed; } if (input.CurrentKeyboardState.IsKeyDown(Keys.Add) && input.LastKeyboardState.IsKeyUp(Keys.Add)) { if (this.GameSpeed < 1.0) this.GameSpeed = 1f; else ++this.GameSpeed; if (this.GameSpeed > 4.0 && GlobalStats.LimitSpeed) this.GameSpeed = 4f; } if (input.CurrentKeyboardState.IsKeyDown(Keys.Subtract) && input.LastKeyboardState.IsKeyUp(Keys.Subtract)) { if (this.GameSpeed <= 1.0) this.GameSpeed = 0.5f; else --this.GameSpeed; } //fbedard: Click button to Cycle through ships in Combat if (!HelperFunctions.CheckIntersection(this.ShipsInCombat.Rect, input.CursorPosition)) { this.ShipsInCombat.State = UIButton.PressState.Normal; } else { this.ShipsInCombat.State = UIButton.PressState.Hover; if (input.InGameSelect) { if (this.player.empireShipCombat > 0) { AudioManager.PlayCue("echo_affirm"); int nbrship = 0; if (lastshipcombat >= this.player.empireShipCombat) lastshipcombat = 0; foreach (Ship ship in EmpireManager.GetEmpireByName(this.PlayerLoyalty).GetShips()) { if (ship.fleet != null || !ship.InCombat || ship.Mothership != null || !ship.Active || ship.Name == "Subspace Projector") continue; else { if (nbrship == lastshipcombat) { if (this.SelectedShip != null && this.SelectedShip != this.previousSelection) this.previousSelection = this.SelectedShip; this.SelectedShip = ship; this.ViewToShip(null); this.SelectedShipList.Add(this.SelectedShip); lastshipcombat++; break; } else nbrship++; } } } else { AudioManager.PlayCue("blip_click"); } } } //fbedard: Click button to Cycle through Planets in Combat if (!HelperFunctions.CheckIntersection(this.PlanetsInCombat.Rect, input.CursorPosition)) { this.PlanetsInCombat.State = UIButton.PressState.Normal; } else { this.PlanetsInCombat.State = UIButton.PressState.Hover; if (input.InGameSelect) { if (this.player.empirePlanetCombat > 0) { AudioManager.PlayCue("echo_affirm"); Planet PlanetToView = (Planet)null; int nbrplanet = 0; if (lastplanetcombat >= this.player.empirePlanetCombat) lastplanetcombat = 0; bool flagPlanet; foreach (SolarSystem system in UniverseScreen.SolarSystemList) { foreach (Planet p in system.PlanetList) { if (p.ExploredDict[EmpireManager.GetEmpireByName(Empire.universeScreen.PlayerLoyalty)] && p.RecentCombat) { if (p.Owner == EmpireManager.GetEmpireByName(Empire.universeScreen.PlayerLoyalty)) { if (nbrplanet == lastplanetcombat) PlanetToView = p; else nbrplanet++; } else { flagPlanet = false; foreach (PlanetGridSquare planetGridSquare in p.TilesList) { if (!flagPlanet) { planetGridSquare.TroopsHere.thisLock.EnterReadLock(); foreach (Troop troop in planetGridSquare.TroopsHere) { if (troop.GetOwner() != null && troop.GetOwner() == EmpireManager.GetEmpireByName(Empire.universeScreen.PlayerLoyalty)) { flagPlanet = true; break; } } planetGridSquare.TroopsHere.thisLock.ExitReadLock(); } } if (flagPlanet) { if (nbrplanet == lastplanetcombat) PlanetToView = p; else nbrplanet++; } } } } } if (PlanetToView != null) { this.SelectedShip = (Ship)null; //this.ShipInfoUIElement.SetShip(this.SelectedShip); this.SelectedFleet = (Fleet)null; this.SelectedShipList.Clear(); this.SelectedItem = (UniverseScreen.ClickableItemUnderConstruction)null; this.SelectedSystem = (SolarSystem)null; this.SelectedPlanet = PlanetToView; this.pInfoUI.SetPlanet(PlanetToView); lastplanetcombat++; this.transitionDestination = new Vector3(this.SelectedPlanet.Position.X, this.SelectedPlanet.Position.Y, 9000f); this.LookingAtPlanet = false; this.transitionStartPosition = this.camPos; this.AdjustCamTimer = 2f; this.transitionElapsedTime = 0.0f; this.transDuration = 5f; this.returnToShip = false; this.ViewingShip = false; this.snappingToShip = false; this.SelectedItem = (UniverseScreen.ClickableItemUnderConstruction)null; //PlanetToView.OpenCombatMenu(null); } } else { AudioManager.PlayCue("blip_click"); } } } if (!this.LookingAtPlanet) { if (this.HandleGUIClicks(input)) { this.SkipRightOnce = true; this.NeedARelease = true; return; } } else { if (this.SelectedShip != null && this.SelectedShip != this.previousSelection) this.previousSelection = this.SelectedShip; this.SelectedFleet = (Fleet)null; this.SelectedShip = (Ship)null; this.SelectedShipList.Clear(); this.SelectedItem = (UniverseScreen.ClickableItemUnderConstruction)null; this.SelectedSystem = (SolarSystem)null; } if ((input.CurrentKeyboardState.IsKeyDown(Keys.Back) || input.CurrentKeyboardState.IsKeyDown(Keys.Delete)) && (this.SelectedItem != null && this.SelectedItem.AssociatedGoal.empire == this.player)) { this.player.GetGSAI().Goals.QueuePendingRemoval(this.SelectedItem.AssociatedGoal); bool flag = false; foreach (Ship ship in (List<Ship>)this.player.GetShips()) { if (ship.Role == "construction" && ship.GetAI().OrderQueue.Count > 0) { for (int index = 0; index < ship.GetAI().OrderQueue.Count; ++index) { if (Enumerable.ElementAt<ArtificialIntelligence.ShipGoal>((IEnumerable<ArtificialIntelligence.ShipGoal>)ship.GetAI().OrderQueue, index).goal == this.SelectedItem.AssociatedGoal) { flag = true; ship.GetAI().OrderScrapShip(); break; } } } } if (!flag) { foreach (Planet planet in this.player.GetPlanets()) { foreach (QueueItem queueItem in (List<QueueItem>)planet.ConstructionQueue) { if (queueItem.Goal == this.SelectedItem.AssociatedGoal) { planet.ProductionHere += queueItem.productionTowards; if ((double)planet.ProductionHere > (double)planet.MAX_STORAGE) planet.ProductionHere = planet.MAX_STORAGE; planet.ConstructionQueue.QueuePendingRemoval(queueItem); } } planet.ConstructionQueue.ApplyPendingRemovals(); } } lock (GlobalStats.ClickableItemLocker) { for (int local_10 = 0; local_10 < this.ItemsToBuild.Count; ++local_10) { UniverseScreen.ClickableItemUnderConstruction local_11 = this.ItemsToBuild[local_10]; if (local_11.BuildPos == this.SelectedItem.BuildPos) { this.ItemsToBuild.QueuePendingRemoval(local_11); AudioManager.PlayCue("blip_click"); } } this.ItemsToBuild.ApplyPendingRemovals(); } this.player.GetGSAI().Goals.ApplyPendingRemovals(); this.SelectedItem = (UniverseScreen.ClickableItemUnderConstruction)null; } if (input.CurrentKeyboardState.IsKeyDown(Keys.H) && !input.LastKeyboardState.IsKeyDown(Keys.H) && this.Debug) { this.debugwin = new DebugInfoScreen(this.ScreenManager, this); this.showdebugwindow = !this.showdebugwindow; } if (this.DefiningAO) { if (this.NeedARelease) { if (input.CurrentMouseState.LeftButton == ButtonState.Released) this.NeedARelease = false; } else { this.DefineAO(input); return; } } this.pickedSomethingThisFrame = false; this.input = input; if (this.LookingAtPlanet) this.workersPanel.HandleInput(input); if (this.IsActive) this.EmpireUI.HandleInput(input); if (this.ShowingPlanetToolTip && (double)Vector2.Distance(new Vector2((float)input.CurrentMouseState.X, (float)input.CurrentMouseState.Y), this.tippedPlanet.ScreenPos) > (double)this.tippedPlanet.Radius) { this.ShowingPlanetToolTip = false; this.TooltipTimer = 0.5f; } if (this.ShowingSysTooltip && (double)Vector2.Distance(new Vector2((float)input.CurrentMouseState.X, (float)input.CurrentMouseState.Y), this.tippedSystem.ScreenPos) > (double)this.tippedSystem.Radius) { this.ShowingSysTooltip = false; this.sTooltipTimer = 0.5f; } if (!this.LookingAtPlanet) { Vector3 position = this.ScreenManager.GraphicsDevice.Viewport.Unproject(new Vector3((float)input.CurrentMouseState.X, (float)input.CurrentMouseState.Y, 0.0f), this.projection, this.view, Matrix.Identity); Vector3 direction = this.ScreenManager.GraphicsDevice.Viewport.Unproject(new Vector3((float)input.CurrentMouseState.X, (float)input.CurrentMouseState.Y, 1f), this.projection, this.view, Matrix.Identity) - position; direction.Normalize(); Ray ray = new Ray(position, direction); float num = -ray.Position.Z / ray.Direction.Z; Vector3 vector3 = new Vector3(ray.Position.X + num * ray.Direction.X, ray.Position.Y + num * ray.Direction.Y, 0.0f); this.mouseWorldPos = new Vector2(vector3.X, vector3.Y); if (input.CurrentKeyboardState.IsKeyDown(Keys.B) && !input.LastKeyboardState.IsKeyDown(Keys.B)) { if (!this.showingDSBW) { this.dsbw = new DeepSpaceBuildingWindow(this.ScreenManager, this); AudioManager.PlayCue("echo_affirm"); this.showingDSBW = true; } else this.showingDSBW = false; } if (input.CurrentKeyboardState.IsKeyDown(Keys.L) && !input.LastKeyboardState.IsKeyDown(Keys.L)) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.ScreenManager.AddScreen((GameScreen)new PlanetListScreen(this.ScreenManager, this.EmpireUI)); } if (input.CurrentKeyboardState.IsKeyDown(Keys.F1) && !input.LastKeyboardState.IsKeyDown(Keys.F1)) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (!this.showingFTLOverlay) { this.showingFTLOverlay = true; } else this.showingFTLOverlay = false; } if (input.CurrentKeyboardState.IsKeyDown(Keys.F2) && !input.LastKeyboardState.IsKeyDown(Keys.F2)) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (!this.showingRangeOverlay) { this.showingRangeOverlay = true; } else this.showingRangeOverlay = false; } if (input.CurrentKeyboardState.IsKeyDown(Keys.K) && !input.LastKeyboardState.IsKeyDown(Keys.K)) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.ScreenManager.AddScreen((GameScreen)new ShipListScreen(this.ScreenManager, this.EmpireUI)); } if (input.CurrentKeyboardState.IsKeyDown(Keys.J) && !input.LastKeyboardState.IsKeyDown(Keys.J)) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.ScreenManager.AddScreen((GameScreen)new FleetDesignScreen(this.EmpireUI)); FleetDesignScreen.Open = true; } if (input.CurrentKeyboardState.IsKeyDown(Keys.H) && !input.LastKeyboardState.IsKeyDown(Keys.H)) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.aw.isOpen = !this.aw.isOpen; } if (input.CurrentKeyboardState.IsKeyDown(Keys.PageUp) && !input.LastKeyboardState.IsKeyDown(Keys.PageUp)) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.AdjustCamTimer = 1f; this.transitionElapsedTime = 0.0f; this.transitionDestination.Z = 4500f; this.snappingToShip = true; this.ViewingShip = true; } if (input.CurrentKeyboardState.IsKeyDown(Keys.PageDown) && !input.LastKeyboardState.IsKeyDown(Keys.PageDown)) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.AdjustCamTimer = 1f; this.transitionElapsedTime = 0.0f; this.transitionDestination.X = this.camPos.X; this.transitionDestination.Y = this.camPos.Y; this.transitionDestination.Z = 4200000f * UniverseScreen.GameScaleStatic; } if (this.Debug) { if (input.C) ResourceManager.CreateShipAtPoint("Kulrathi Assault Ship", this.player, this.mouseWorldPos); else if (input.CurrentKeyboardState.IsKeyDown(Keys.LeftShift) && input.C) ResourceManager.CreateShipAtPoint("Kulrathi Assault Ship", EmpireManager.GetEmpireByName("The Remnant"), this.mouseWorldPos); try { if (input.CurrentKeyboardState.IsKeyDown(Keys.LeftShift) && input.CurrentKeyboardState.IsKeyDown(Keys.Z) && !input.LastKeyboardState.IsKeyDown(Keys.Z)) HelperFunctions.CreateFleetAt("Fleet 2", EmpireManager.GetEmpireByName("The Remnant"), this.mouseWorldPos); else if (input.CurrentKeyboardState.IsKeyDown(Keys.Z) && !input.LastKeyboardState.IsKeyDown(Keys.Z)) HelperFunctions.CreateFleetAt("Fleet 1", this.player, this.mouseWorldPos); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.InnerException); } if (this.SelectedShip != null && this.Debug) { if (input.CurrentKeyboardState.IsKeyDown(Keys.X) && !input.LastKeyboardState.IsKeyDown(Keys.X)) this.SelectedShip.Die((GameplayObject)null, false); } else if (this.SelectedPlanet != null && this.Debug && (input.CurrentKeyboardState.IsKeyDown(Keys.X) && !input.LastKeyboardState.IsKeyDown(Keys.X))) { foreach (KeyValuePair<string, Troop> keyValuePair in ResourceManager.TroopsDict) this.SelectedPlanet.AssignTroopToTile(ResourceManager.CreateTroop(keyValuePair.Value, EmpireManager.GetEmpireByName("The Remnant"))); } if (input.CurrentKeyboardState.IsKeyDown(Keys.X) && !input.LastKeyboardState.IsKeyDown(Keys.X)) ResourceManager.CreateShipAtPoint("Target Dummy", EmpireManager.GetEmpireByName("The Remnant"), this.mouseWorldPos); if (input.CurrentKeyboardState.IsKeyDown(Keys.V) && !input.LastKeyboardState.IsKeyDown(Keys.V)) ResourceManager.CreateShipAtPoint("Remnant Mothership", EmpireManager.GetEmpireByName("The Remnant"), this.mouseWorldPos); } this.HandleFleetSelections(input); if (input.Escaped) { this.snappingToShip = false; this.ViewingShip = false; if ((double)this.camHeight < 1175000.0 && (double)this.camHeight > 146900.0) { this.AdjustCamTimer = 1f; this.transitionElapsedTime = 0.0f; this.transitionDestination = new Vector3(this.camPos.X, this.camPos.Y, 1175000f); } else if ((double)this.camHeight < 146900.0) { this.AdjustCamTimer = 1f; this.transitionElapsedTime = 0.0f; this.transitionDestination = new Vector3(this.camPos.X, this.camPos.Y, 147000f); } else if (this.viewState < UniverseScreen.UnivScreenState.SystemView) this.transitionDestination =new Vector3(this.camPos.X, this.camPos.Y, this.GetZfromScreenState(UnivScreenState.SystemView)); } if (input.Tab) this.ShowShipNames = !this.ShowShipNames; this.HandleRightMouseNew(input); if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Released) { if ((double)this.ClickTimer < (double)this.TimerDelay) { this.SelectedShipList.Clear(); if (this.SelectedShip != null && this.SelectedShip != this.previousSelection) this.previousSelection = this.SelectedShip; this.SelectedShip = (Ship)null; if (this.viewState <= UniverseScreen.UnivScreenState.SystemView) { foreach (UniverseScreen.ClickablePlanets clickablePlanets in this.ClickPlanetList) { if ((double)Vector2.Distance(input.CursorPosition, clickablePlanets.ScreenPos) <= (double)clickablePlanets.Radius) { AudioManager.PlayCue("sub_bass_whoosh"); this.SelectedPlanet = clickablePlanets.planetToClick; if (!this.SnapBackToSystem) this.HeightOnSnap = this.camHeight; this.ViewPlanet((object)this.SelectedPlanet); } } } foreach (UniverseScreen.ClickableShip clickableShip in this.ClickableShipsList) { if ((double)Vector2.Distance(input.CursorPosition, clickableShip.ScreenPos) <= (double)clickableShip.Radius) { this.pickedSomethingThisFrame = true; this.SelectedShipList.Add(clickableShip.shipToClick); using (List<UniverseScreen.ClickableShip>.Enumerator enumerator = this.ClickableShipsList.GetEnumerator()) { while (enumerator.MoveNext()) { UniverseScreen.ClickableShip current = enumerator.Current; if (clickableShip.shipToClick != current.shipToClick && current.shipToClick.loyalty == clickableShip.shipToClick.loyalty && current.shipToClick.Role == clickableShip.shipToClick.Role) this.SelectedShipList.Add(current.shipToClick); } break; } } } if (this.viewState > UniverseScreen.UnivScreenState.SystemView) { lock (GlobalStats.ClickableSystemsLock) { for (int local_27 = 0; local_27 < this.ClickableSystems.Count; ++local_27) { UniverseScreen.ClickableSystem local_28 = this.ClickableSystems[local_27]; if ((double)Vector2.Distance(input.CursorPosition, local_28.ScreenPos) <= (double)local_28.Radius) { if (local_28.systemToClick.ExploredDict[this.player]) { AudioManager.GetCue("sub_bass_whoosh").Play(); this.HeightOnSnap = this.camHeight; this.ViewSystem(local_28.systemToClick); } else this.PlayNegativeSound(); } } } } } else if (this.SelectedShip !=null) this.ClickTimer = 0.0f; //this.ClickTimer = 0.5f; } this.HandleSelectionBox(input); this.HandleScrolls(input); } if (this.LookingAtPlanet) { if (input.Tab) this.ShowShipNames = !this.ShowShipNames; if ((input.Escaped || input.CurrentMouseState.RightButton == ButtonState.Pressed && input.LastMouseState.RightButton == ButtonState.Released || this.workersPanel is ColonyScreen && (this.workersPanel as ColonyScreen).close.HandleInput(input)) && (!(this.workersPanel is ColonyScreen) || !(this.workersPanel as ColonyScreen).ClickedTroop)) { if (this.workersPanel is ColonyScreen && (this.workersPanel as ColonyScreen).p.Owner == null) { this.AdjustCamTimer = 1f; if (this.returnToShip) { this.ViewingShip = true; this.returnToShip = false; this.snappingToShip = true; this.transitionDestination.Z = this.transitionStartPosition.Z; } else this.transitionDestination = this.transitionStartPosition; this.transitionElapsedTime = 0.0f; this.LookingAtPlanet = false; } else { this.AdjustCamTimer = 1f; if (this.returnToShip) { this.ViewingShip = true; this.returnToShip = false; this.snappingToShip = true; this.transitionDestination.Z = this.transitionStartPosition.Z; } else this.transitionDestination = this.transitionStartPosition; this.transitionElapsedTime = 0.0f; this.LookingAtPlanet = false; } } } if (input.InGameSelect && !this.pickedSomethingThisFrame && (!input.CurrentKeyboardState.IsKeyDown(Keys.LeftShift) && !this.pieMenu.Visible)) { if (this.SelectedShip != null && this.SelectedShip != this.previousSelection) this.previousSelection = this.SelectedShip; this.SelectedShip = (Ship)null; this.SelectedShipList.Clear(); this.SelectedFleet = (Fleet)null; lock (GlobalStats.FleetButtonLocker) { for (int local_31 = 0; local_31 < this.FleetButtons.Count; ++local_31) { UniverseScreen.FleetButton local_32 = this.FleetButtons[local_31]; if (HelperFunctions.CheckIntersection(local_32.ClickRect, input.CursorPosition)) { this.SelectedFleet = local_32.Fleet; this.SelectedShipList.Clear(); foreach (Ship item_7 in (List<Ship>)this.SelectedFleet.Ships) { if (item_7.inSensorRange) this.SelectedShipList.Add(item_7); } if (this.SelectedShipList.Count == 1) { this.SelectedShip = this.SelectedShipList[0]; this.ShipInfoUIElement.SetShip(this.SelectedShip); this.SelectedShipList.Clear(); } else if (this.SelectedShipList.Count > 1) this.shipListInfoUI.SetShipList((List<Ship>)this.SelectedShipList, true); this.SelectedSomethingTimer = 3f; if ((double)this.ClickTimer < (double)this.TimerDelay) { this.ViewingShip = false; this.AdjustCamTimer = 0.5f; this.transitionDestination.X = this.SelectedFleet.findAveragePosition().X; this.transitionDestination.Y = this.SelectedFleet.findAveragePosition().Y; if (this.viewState < UniverseScreen.UnivScreenState.SystemView) this.transitionDestination.Z = this.GetZfromScreenState(UniverseScreen.UnivScreenState.SystemView); } else this.ClickTimer = 0.0f; } } } } this.cState = this.SelectedShip != null || this.SelectedShipList.Count > 0 ? UniverseScreen.CursorState.Move : UniverseScreen.CursorState.Normal; if (this.SelectedShip == null && this.SelectedShipList.Count <= 0) return; foreach (UniverseScreen.ClickableShip clickableShip in this.ClickableShipsList) { if ((double)Vector2.Distance(input.CursorPosition, clickableShip.ScreenPos) <= (double)clickableShip.Radius) this.cState = UniverseScreen.CursorState.Follow; } if (this.cState == UniverseScreen.CursorState.Follow) return; lock (GlobalStats.ClickableSystemsLock) { foreach (UniverseScreen.ClickablePlanets item_9 in this.ClickPlanetList) { if ((double)Vector2.Distance(input.CursorPosition, item_9.ScreenPos) <= (double)item_9.Radius && item_9.planetToClick.habitable) this.cState = UniverseScreen.CursorState.Orbit; } } }