protected override void OnCommitMission() { foreach (OverlayReactionlMission.ReactionUIContainer container in this._containers) { OverlayReactionlMission.ReactionUIContainer rui = container; if (rui.TargetFleet.HasValue) { FleetInfo fleetInfo = rui.Reaction.fleetsInRange.FirstOrDefault <FleetInfo>((Func <FleetInfo, bool>)(x => { int id = x.ID; int?targetFleet = rui.TargetFleet; if (id == targetFleet.GetValueOrDefault()) { return(targetFleet.HasValue); } return(false); })); int systemId = rui.Reaction.fleet.SystemID; this._app.GameDatabase.ChangeDiplomacyState(rui.Reaction.fleet.PlayerID, fleetInfo.PlayerID, DiplomacyState.WAR); this._app.GameDatabase.UpdateFleetLocation(rui.Reaction.fleet.ID, fleetInfo.SystemID, new int?()); MissionInfo missionByFleetId = this._app.GameDatabase.GetMissionByFleetID(rui.Reaction.fleet.ID); if (missionByFleetId == null) { Kerberos.Sots.StarFleet.StarFleet.SetRelocationMission(this._app.Game, rui.Reaction.fleet.ID, systemId, false, (List <int>)null); } else { List <WaypointInfo> list = this._app.GameDatabase.GetWaypointsByMissionID(missionByFleetId.ID).ToList <WaypointInfo>(); foreach (WaypointInfo waypointInfo in list) { this._app.GameDatabase.RemoveWaypoint(waypointInfo.ID); } this._app.GameDatabase.InsertWaypoint(missionByFleetId.ID, WaypointType.TravelTo, new int?(systemId)); foreach (WaypointInfo waypointInfo in list) { this._app.GameDatabase.InsertWaypoint(missionByFleetId.ID, waypointInfo.Type, waypointInfo.SystemID); } } } this._app.Game.RemoveReaction(rui.Reaction); } if (!this._app.GameSetup.IsMultiplayer) { this._app.Game.Phase4_Combat(); } else if (this._app.Network.IsJoined) { this._app.GameDatabase.LogComment("SYNC REACTIONS"); this._app.Network.SendHistory(this._app.GameDatabase.GetTurnCount()); } else { if (!this._app.Network.IsHosting) { return; } this._app.Network.ReactionComplete(); } }
private void SelectReaction( OverlayReactionlMission.ReactionUIContainer reaction) { if (this._selectedReaction != null) { this._app.UI.SetVisible(this.UI.Path(this._selectedReaction.ListItemID, "reaction_selection"), false); } this._selectedReaction = reaction; if (this._selectedReaction == null) { return; } this.SelectedFleet = this._selectedReaction.Reaction.fleet.ID; this._app.UI.SetVisible(this.UI.Path(this._selectedReaction.ListItemID, "reaction_selection"), true); this._reactionfleet.SetSyncedFleets(this._selectedReaction.Reaction.fleet.ID); OverlayMission.RefreshFleetAdmiralDetails(this.App, this.ID, this._selectedReaction.Reaction.fleet.ID, "admiralDetails1"); this.SelectedFleet = 0; this.SelectedPlanet = 0; this._fleetWidget.Selected = -1; this._fleetWidget.SelectedFleet = 0; this._fleetWidget.SetSyncedFleets(this._selectedReaction.Reaction.fleetsInRange); if (this._selectedReaction.TargetFleet.HasValue) { this._fleetWidget.Selected = this._selectedReaction.TargetFleet.Value; this._fleetWidget.SelectedFleet = this._selectedReaction.TargetFleet.Value; } else { this.SelectedFleet = 0; this.SelectedPlanet = 0; this._fleetWidget.Selected = -1; this._fleetWidget.SelectedFleet = 0; } this.FocusOnStarSystem(this._selectedReaction.Reaction.fleet.SystemID); this._systemWidget.Sync(this._selectedReaction.Reaction.fleet.SystemID); }