v1.6.17.0 (Unto the Breach update)
This commit is contained in:
@@ -28,7 +28,7 @@ namespace Barotrauma
|
||||
public GUIComponent ReportButtonFrame { get; set; }
|
||||
|
||||
private GUIFrame guiFrame;
|
||||
private GUIFrame crewArea;
|
||||
private GUILayoutGroup crewArea;
|
||||
private GUIListBox crewList;
|
||||
private float crewListOpenState;
|
||||
private bool _isCrewMenuOpen = true;
|
||||
@@ -93,12 +93,30 @@ namespace Barotrauma
|
||||
|
||||
#region Crew Area
|
||||
|
||||
crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), style: null, color: Color.Transparent)
|
||||
crewArea = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), childAnchor: Anchor.TopCenter)
|
||||
{
|
||||
CanBeFocused = false
|
||||
Stretch = true
|
||||
};
|
||||
crewArea.RectTransform.NonScaledSize = HUDLayoutSettings.CrewArea.Size;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
CharacterTeamType teamId = i == 0 ? CharacterTeamType.Team1 : CharacterTeamType.Team2;
|
||||
var nameText = new GUITextBlock(new RectTransform(new Point(crewArea.Rect.Width - GUI.IntScale(10), GUI.IntScale(30)), crewArea.RectTransform), CombatMission.GetTeamName(teamId), textColor: CombatMission.GetTeamColor(teamId))
|
||||
{
|
||||
ForceUpperCase = ForceUpperCase.Yes,
|
||||
TextGetter = () => CombatMission.GetTeamName(teamId),
|
||||
Visible = false,
|
||||
IgnoreLayoutGroups = true,
|
||||
UserData = teamId
|
||||
};
|
||||
var teamIcon = new GUIImage(new RectTransform(Vector2.One, nameText.RectTransform, Anchor.CenterLeft, scaleBasis: ScaleBasis.BothHeight), style: i == 0 ? "CoalitionIcon" : "SeparatistIcon")
|
||||
{
|
||||
Color = nameText.TextColor
|
||||
};
|
||||
nameText.Padding = new Vector4(teamIcon.Rect.Width + nameText.Padding.X, nameText.Padding.Y, nameText.Padding.Z, nameText.Padding.W);
|
||||
}
|
||||
|
||||
// AbsoluteOffset is set in UpdateProjectSpecific based on crewListOpenState
|
||||
crewList = new GUIListBox(new RectTransform(Vector2.One, crewArea.RectTransform), style: null, isScrollBarOnDefaultSide: false)
|
||||
{
|
||||
@@ -562,9 +580,19 @@ namespace Barotrauma
|
||||
public bool CharacterClicked(GUIComponent component, object selection)
|
||||
{
|
||||
if (!AllowCharacterSwitch) { return false; }
|
||||
if (!(selection is Character character) || character.IsDead || character.IsUnconscious) { return false; }
|
||||
if (selection is not Character character || character.IsDead || character.IsUnconscious) { return false; }
|
||||
if (!character.IsOnPlayerTeam) { return false; }
|
||||
|
||||
if (GameMain.IsMultiplayer)
|
||||
{
|
||||
if (Character.Controlled == null)
|
||||
{
|
||||
Camera cam = Screen.Selected.Cam;
|
||||
cam.Position = character.DrawPosition;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
SelectCharacter(character);
|
||||
if (GUI.KeyboardDispatcher.Subscriber == crewList) { GUI.KeyboardDispatcher.Subscriber = null; }
|
||||
return true;
|
||||
@@ -631,10 +659,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (crewList != this.crewList) { return; }
|
||||
if (draggedElementData is not Character) { return; }
|
||||
if (!IsSinglePlayer) { return; }
|
||||
if (crewList.HasDraggedElementIndexChanged)
|
||||
{
|
||||
UpdateCrewListIndices();
|
||||
if (IsSinglePlayer) { UpdateCrewListIndices(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -645,10 +672,13 @@ namespace Barotrauma
|
||||
private void ResetCrewListIndex(Character c)
|
||||
{
|
||||
if (c?.Info == null) { return; }
|
||||
c.Info.CrewListIndex = -1;
|
||||
UpdateCrewListIndices();
|
||||
//default to the bottom of the list
|
||||
c.Info.CrewListIndex = int.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refresh the <see cref="CharacterInfo.CrewListIndex"/> of the characters based on their order in the crew list
|
||||
/// </summary>
|
||||
private void UpdateCrewListIndices()
|
||||
{
|
||||
if (crewList == null) { return; }
|
||||
@@ -661,20 +691,23 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Order the crew list according to the characters' <see cref="CharacterInfo.CrewListIndex"/>
|
||||
/// </summary>
|
||||
private void SortCrewList()
|
||||
{
|
||||
if (crewList == null) { return; }
|
||||
crewList.Content.RectTransform.SortChildren((x, y) =>
|
||||
{
|
||||
var infoX = (x.GUIComponent.UserData as Character)?.Info?.CrewListIndex;
|
||||
var infoY = (y.GUIComponent.UserData as Character)?.Info?.CrewListIndex;
|
||||
if (infoX.HasValue)
|
||||
int? index1 = (x.GUIComponent.UserData as Character)?.Info?.CrewListIndex;
|
||||
int? index2 = (y.GUIComponent.UserData as Character)?.Info?.CrewListIndex;
|
||||
if (index1.HasValue)
|
||||
{
|
||||
return infoY.HasValue ? infoX.Value.CompareTo(infoY.Value) : -1;
|
||||
return index2.HasValue ? index1.Value.CompareTo(index2.Value) : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return infoY.HasValue ? 1 : 0;
|
||||
return index2.HasValue ? 1 : 0;
|
||||
}
|
||||
});
|
||||
UpdateCrewListIndices();
|
||||
@@ -1635,6 +1668,18 @@ namespace Barotrauma
|
||||
{
|
||||
crewArea.Visible = characters.Count > 0 && CharacterHealth.OpenHealthWindow == null;
|
||||
|
||||
var myTeam = Character.Controlled?.TeamID ?? GameMain.Client?.MyClient?.TeamID;
|
||||
if (GameMain.GameSession?.GameMode is PvPMode)
|
||||
{
|
||||
var team1Text = crewArea.GetChildByUserData(CharacterTeamType.Team1);
|
||||
team1Text.Visible = myTeam == CharacterTeamType.Team1;
|
||||
team1Text.IgnoreLayoutGroups = !team1Text.Visible;
|
||||
|
||||
var team2Text = crewArea.GetChildByUserData(CharacterTeamType.Team2);
|
||||
team2Text.Visible = myTeam == CharacterTeamType.Team2;
|
||||
team2Text.IgnoreLayoutGroups = !team2Text.Visible;
|
||||
}
|
||||
|
||||
foreach (GUIComponent characterComponent in crewList.Content.Children)
|
||||
{
|
||||
if (characterComponent.UserData is Character character)
|
||||
@@ -1645,7 +1690,7 @@ namespace Barotrauma
|
||||
continue;
|
||||
}
|
||||
|
||||
characterComponent.Visible = Character.Controlled == null || Character.Controlled.TeamID == character.TeamID;
|
||||
characterComponent.Visible = Character.Controlled == null || myTeam == character.TeamID;
|
||||
if (character.TeamID == CharacterTeamType.FriendlyNPC && Character.Controlled != null &&
|
||||
(character.CurrentHull == Character.Controlled.CurrentHull || Vector2.DistanceSquared(Character.Controlled.WorldPosition, character.WorldPosition) < 500.0f * 500.0f))
|
||||
{
|
||||
@@ -2098,7 +2143,7 @@ namespace Barotrauma
|
||||
CreateNodeConnectors();
|
||||
if (Character.Controlled != null)
|
||||
{
|
||||
Character.Controlled.dontFollowCursor = true;
|
||||
Character.Controlled.FollowCursor = false;
|
||||
}
|
||||
|
||||
HintManager.OnShowCommandInterface();
|
||||
@@ -2242,7 +2287,7 @@ namespace Barotrauma
|
||||
returnNodeHotkey = expandNodeHotkey = Keys.None;
|
||||
if (Character.Controlled != null)
|
||||
{
|
||||
Character.Controlled.dontFollowCursor = false;
|
||||
Character.Controlled.FollowCursor = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2511,7 +2556,7 @@ namespace Barotrauma
|
||||
// --> Create shortcut node for Steer order
|
||||
if (CanFitMoreNodes() && ShouldDelegateOrder("steer") && IsNonDuplicateOrderPrefab(OrderPrefab.Prefabs["steer"]) &&
|
||||
subItems.Find(i => i.HasTag(Tags.NavTerminal) && i.IsPlayerTeamInteractable) is Item nav && characters.None(c => c.SelectedItem == nav) &&
|
||||
nav.GetComponent<Steering>() is Steering steering && steering.Voltage > steering.MinVoltage)
|
||||
nav.GetComponent<Steering>() is Steering { HasPower: true } steering)
|
||||
{
|
||||
var order = new Order(OrderPrefab.Prefabs["steer"], steering.Item, steering);
|
||||
AddOrderNode(order);
|
||||
|
||||
@@ -395,13 +395,15 @@ namespace Barotrauma
|
||||
|
||||
protected void TryEndRoundWithFuelCheck(Action onConfirm, Action onReturnToMapScreen)
|
||||
{
|
||||
if (Submarine.MainSub == null) { return; }
|
||||
|
||||
Submarine.MainSub.CheckFuel();
|
||||
bool lowFuel = Submarine.MainSub.Info.LowFuel;
|
||||
if (PendingSubmarineSwitch != null)
|
||||
{
|
||||
lowFuel = TransferItemsOnSubSwitch ? (lowFuel && PendingSubmarineSwitch.LowFuel) : PendingSubmarineSwitch.LowFuel;
|
||||
}
|
||||
if (Level.IsLoadedFriendlyOutpost && lowFuel && CargoManager.PurchasedItems.None(i => i.Value.Any(pi => pi.ItemPrefab.Tags.Contains("reactorfuel"))))
|
||||
if (Level.IsLoadedFriendlyOutpost && lowFuel && CargoManager.PurchasedItems.None(i => i.Value.Any(pi => pi.ItemPrefab.Tags.Contains(Tags.ReactorFuel))))
|
||||
{
|
||||
var extraConfirmationBox =
|
||||
new GUIMessageBox(TextManager.Get("lowfuelheader"),
|
||||
|
||||
+2
-2
@@ -541,7 +541,7 @@ namespace Barotrauma
|
||||
{
|
||||
string savePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Multiplayer);
|
||||
|
||||
GameMain.GameSession = new GameSession(null, savePath, GameModePreset.MultiPlayerCampaign, CampaignSettings.Empty, mapSeed);
|
||||
GameMain.GameSession = new GameSession(null, Option.None, CampaignDataPath.CreateRegular(savePath), GameModePreset.MultiPlayerCampaign, CampaignSettings.Empty, mapSeed);
|
||||
campaign = (MultiPlayerCampaign)GameMain.GameSession.GameMode;
|
||||
campaign.CampaignID = campaignID;
|
||||
GameMain.NetLobbyScreen.ToggleCampaignMode(true);
|
||||
@@ -1044,7 +1044,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Save(XElement element)
|
||||
public override void Save(XElement element, bool isSavingOnLoading)
|
||||
{
|
||||
//do nothing, the clients get the save files from the server
|
||||
}
|
||||
|
||||
+4
-4
@@ -240,7 +240,7 @@ namespace Barotrauma
|
||||
if (!savedOnStart)
|
||||
{
|
||||
GUI.SetSavingIndicatorState(true);
|
||||
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
|
||||
SaveUtil.SaveGame(GameMain.GameSession.DataPath, isSavingOnLoading: true);
|
||||
savedOnStart = true;
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace Barotrauma
|
||||
if (success)
|
||||
{
|
||||
GameMain.GameSession.SubmarineInfo = new SubmarineInfo(GameMain.GameSession.Submarine);
|
||||
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
|
||||
SaveUtil.SaveGame(GameMain.GameSession.DataPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -479,7 +479,7 @@ namespace Barotrauma
|
||||
protected override void EndCampaignProjSpecific()
|
||||
{
|
||||
GameMain.GameSession.SubmarineInfo = new SubmarineInfo(GameMain.GameSession.Submarine);
|
||||
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
|
||||
SaveUtil.SaveGame(GameMain.GameSession.DataPath);
|
||||
GameMain.CampaignEndScreen.Select();
|
||||
GUI.DisableHUD = false;
|
||||
GameMain.CampaignEndScreen.OnFinished = () =>
|
||||
@@ -672,7 +672,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override void Save(XElement element)
|
||||
public override void Save(XElement element, bool isSavingOnLoading)
|
||||
{
|
||||
XElement modeElement = new XElement("SinglePlayerCampaign",
|
||||
new XAttribute("purchasedlostshuttles", PurchasedLostShuttles),
|
||||
|
||||
@@ -7,7 +7,7 @@ using Barotrauma.Items.Components;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
class TestGameMode : GameMode
|
||||
partial class TestGameMode : GameMode
|
||||
{
|
||||
public Action OnRoundEnd;
|
||||
|
||||
@@ -22,18 +22,6 @@ namespace Barotrauma
|
||||
|
||||
private GUIButton createEventButton;
|
||||
|
||||
public TestGameMode(GameModePreset preset) : base(preset)
|
||||
{
|
||||
foreach (JobPrefab jobPrefab in JobPrefab.Prefabs.OrderBy(p => p.Identifier))
|
||||
{
|
||||
for (int i = 0; i < jobPrefab.InitialCount; i++)
|
||||
{
|
||||
var variant = Rand.Range(0, jobPrefab.Variants);
|
||||
CrewManager.AddCharacterInfo(new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: jobPrefab, variant: variant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
@@ -42,17 +30,24 @@ namespace Barotrauma
|
||||
foreach (Submarine submarine in Submarine.Loaded)
|
||||
{
|
||||
submarine.NeutralizeBallast();
|
||||
//normally the body would be made static during level generation,
|
||||
//but in the test mode we load the outpost/wreck/beacon as if it was a normal sub and need to do this manually
|
||||
if (submarine.Info.Type == SubmarineType.Outpost ||
|
||||
submarine.Info.Type == SubmarineType.OutpostModule ||
|
||||
submarine.Info.Type == SubmarineType.Wreck ||
|
||||
submarine.Info.Type == SubmarineType.BeaconStation)
|
||||
switch (submarine.Info.Type)
|
||||
{
|
||||
submarine.PhysicsBody.BodyType = FarseerPhysics.BodyType.Static;
|
||||
case SubmarineType.Outpost:
|
||||
case SubmarineType.OutpostModule:
|
||||
case SubmarineType.Wreck:
|
||||
case SubmarineType.BeaconStation:
|
||||
//normally the body would be made static during level generation,
|
||||
//but in the test mode we load the outpost/wreck/beacon as if it was a normal sub and need to do this manually
|
||||
submarine.PhysicsBody.BodyType = FarseerPhysics.BodyType.Static;
|
||||
if (submarine.Info.ShouldBeRuin)
|
||||
{
|
||||
submarine.Info.Type = SubmarineType.Ruin;
|
||||
}
|
||||
submarine.TeamID = submarine.Info.IsOutpost ? CharacterTeamType.FriendlyNPC : CharacterTeamType.None;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (SpawnOutpost)
|
||||
{
|
||||
GenerateOutpost(Submarine.MainSub);
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
GameMain.GameSession = new GameSession(subInfo, GameModePreset.Tutorial, missionPrefabs: null);
|
||||
GameMain.GameSession = new GameSession(subInfo, Option.None, GameModePreset.Tutorial, missionPrefabs: null);
|
||||
(GameMain.GameSession.GameMode as TutorialMode).Tutorial = this;
|
||||
|
||||
if (generationParams is not null)
|
||||
@@ -138,7 +138,7 @@ namespace Barotrauma.Tutorials
|
||||
character = Character.Create(charInfo, wayPoint.WorldPosition, "", isRemotePlayer: false, hasAi: false);
|
||||
character.TeamID = CharacterTeamType.Team1;
|
||||
Character.Controlled = character;
|
||||
character.GiveJobItems(null);
|
||||
character.GiveJobItems(isPvPMode: false, null);
|
||||
|
||||
var idCard = character.Inventory.FindItemByTag("identitycard".ToIdentifier());
|
||||
if (idCard == null)
|
||||
|
||||
@@ -282,10 +282,10 @@ namespace Barotrauma
|
||||
public void SetRespawnInfo(string text, Color textColor, bool waitForNextRoundRespawn, bool hideButtons = false)
|
||||
{
|
||||
if (topLeftButtonGroup == null) { return; }
|
||||
|
||||
|
||||
bool permadeathMode = GameMain.NetworkMember?.ServerSettings is { RespawnMode: RespawnMode.Permadeath };
|
||||
bool ironmanMode = GameMain.NetworkMember is { ServerSettings: { RespawnMode: RespawnMode.Permadeath, IronmanMode: true } };
|
||||
|
||||
bool ironmanMode = GameMain.NetworkMember?.ServerSettings is { IronmanModeActive: true };
|
||||
|
||||
bool hasRespawnOptions;
|
||||
if (permadeathMode)
|
||||
{
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Barotrauma
|
||||
|
||||
if (Character.Controlled.SelectedItem.GetComponent<Reactor>() is Reactor reactor && reactor.PowerOn &&
|
||||
Character.Controlled.SelectedItem.OwnInventory?.AllItems is IEnumerable<Item> containedItems &&
|
||||
containedItems.Count(i => i.HasTag(Tags.Fuel)) > 1)
|
||||
containedItems.Count(i => i.HasTag(Tags.ReactorFuel)) > 1)
|
||||
{
|
||||
if (DisplayHint("onisinteracting.reactorwithextrarods".ToIdentifier())) { return; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class PvPMode : MissionMode
|
||||
{
|
||||
private GUIComponent scoreContainer;
|
||||
private readonly GUITextBlock[] scoreTexts = new GUITextBlock[2];
|
||||
private readonly GUITextBlock[] scoreTextShadows = new GUITextBlock[2];
|
||||
private readonly int[] prevScores = new int[2];
|
||||
|
||||
private void InitUI()
|
||||
{
|
||||
scoreContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.TutorialObjectiveListArea, GUI.Canvas), childAnchor: Anchor.TopRight)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(scoreContainer.Rect.Width, GUI.IntScale(80)), scoreContainer.RectTransform), style: null)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
new GUIImage(new RectTransform(Vector2.One, frame.RectTransform, Anchor.CenterRight, scaleBasis: ScaleBasis.BothHeight), style: i == 0 ? "CoalitionIcon" : "SeparatistIcon")
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
scoreTextShadows[i] = new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.CenterRight, scaleBasis: ScaleBasis.BothHeight) { AbsoluteOffset = new Point(GUI.IntScale(38), GUI.IntScale(2)) },
|
||||
string.Empty, textColor: GUIStyle.TextColorDark, textAlignment: Alignment.CenterRight, font: GUIStyle.SubHeadingFont)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
scoreTexts[i] = new GUITextBlock(new RectTransform(Vector2.One, frame.RectTransform, Anchor.CenterRight, scaleBasis: ScaleBasis.BothHeight) { AbsoluteOffset = new Point(GUI.IntScale(40), 0) },
|
||||
string.Empty, textAlignment: Alignment.CenterRight, font: GUIStyle.SubHeadingFont)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
base.AddToGUIUpdateList();
|
||||
|
||||
if (scoreContainer == null) { InitUI(); }
|
||||
|
||||
scoreContainer.Visible = false;
|
||||
foreach (var mission in Missions)
|
||||
{
|
||||
if (mission is CombatMission combatMission && combatMission.HasWinScore)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var scoreText = scoreTexts[i];
|
||||
//one team very close to the win score, start flashing the score
|
||||
if (combatMission.Scores[i] > combatMission.WinScore * 0.9f ||
|
||||
combatMission.Scores[i] == combatMission.WinScore - 1)
|
||||
{
|
||||
if (scoreText.Parent.FlashTimer <= 0.0f)
|
||||
{
|
||||
scoreText.Parent.Flash(GUIStyle.Orange);
|
||||
scoreText.Pulsate(Vector2.One, Vector2.One * 1.2f, scoreText.Parent.FlashTimer);
|
||||
}
|
||||
}
|
||||
if (prevScores[i] != combatMission.Scores[i] || scoreText.Text.IsNullOrEmpty())
|
||||
{
|
||||
scoreText.Text = scoreTextShadows[i].Text = $"{combatMission.Scores[i]}/{combatMission.WinScore}";
|
||||
scoreText.Parent.Flash(GUIStyle.Green);
|
||||
scoreText.Parent.GetAnyChild<GUIImage>().Pulsate(Vector2.One, Vector2.One * 1.2f, scoreText.Parent.FlashTimer);
|
||||
SoundPlayer.PlayUISound(GUISoundType.UIMessage);
|
||||
}
|
||||
scoreText.Parent.RectTransform.NonScaledSize =
|
||||
new Point(
|
||||
(int)(scoreText.TextSize.X + scoreText.Padding.X + scoreText.Padding.X) + scoreText.Parent.GetChild<GUIImage>().Rect.Width + GUI.IntScale(10),
|
||||
scoreText.Parent.Rect.Height);
|
||||
scoreText.Parent.ForceLayoutRecalculation();
|
||||
prevScores[i] = combatMission.Scores[i];
|
||||
}
|
||||
scoreContainer.Visible = true;
|
||||
}
|
||||
}
|
||||
scoreContainer.AddToGUIUpdateList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,11 +14,13 @@ namespace Barotrauma
|
||||
private float crewListAnimDelay = 0.25f;
|
||||
private float missionIconAnimDelay;
|
||||
|
||||
private const float jobColumnWidthPercentage = 0.11f;
|
||||
private const float characterColumnWidthPercentage = 0.44f;
|
||||
private const float statusColumnWidthPercentage = 0.45f;
|
||||
private const float JobColumnWidthPercentage = 0.1f;
|
||||
private const float CharacterColumnWidthPercentage = 0.4f;
|
||||
private const float StatusColumnWidthPercentage = 0.12f;
|
||||
private const float KillColumnWidthPercentage = 0.1f;
|
||||
private const float DeathColumnWidthPercentage = 0.1f;
|
||||
|
||||
private int jobColumnWidth, characterColumnWidth, statusColumnWidth;
|
||||
private int jobColumnWidth, characterColumnWidth, statusColumnWidth, killColumnWidth, deathColumnWidth;
|
||||
|
||||
private readonly List<Mission> selectedMissions;
|
||||
private readonly Location startLocation, endLocation;
|
||||
@@ -109,6 +112,16 @@ namespace Barotrauma
|
||||
CombatMission.GetTeamName(CharacterTeamType.Team2), textAlignment: Alignment.TopLeft, font: GUIStyle.SubHeadingFont);
|
||||
crewHeader2.RectTransform.MinSize = new Point(0, GUI.IntScale(crewHeader2.Rect.Height * 2.0f));
|
||||
CreateCrewList(crewContent2, gameSession.CrewManager.GetCharacterInfos().Where(c => c.TeamID == CharacterTeamType.Team2), traitorResults);
|
||||
|
||||
if (CombatMission.Winner != CharacterTeamType.None)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), crewHeader.RectTransform),
|
||||
TextManager.Get(CombatMission.Winner == CharacterTeamType.Team1 ? "pvpmode.victory" : "pvpmode.defeat"), textAlignment: Alignment.TopRight, font: GUIStyle.SubHeadingFont,
|
||||
textColor: CombatMission.Winner == CharacterTeamType.Team1 ? GUIStyle.Green : GUIStyle.Red);
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), crewHeader2.RectTransform),
|
||||
TextManager.Get(CombatMission.Winner == CharacterTeamType.Team2 ? "pvpmode.victory" : "pvpmode.defeat"), textAlignment: Alignment.TopRight, font: GUIStyle.SubHeadingFont,
|
||||
textColor: CombatMission.Winner == CharacterTeamType.Team2 ? GUIStyle.Green : GUIStyle.Red);
|
||||
}
|
||||
}
|
||||
|
||||
//header -------------------------------------------------------------------------------
|
||||
@@ -242,7 +255,7 @@ namespace Barotrauma
|
||||
|
||||
if (selectedMissions.Contains(mission))
|
||||
{
|
||||
UpdateMissionStateIcon(mission.Completed, missionIcon, animDelay);
|
||||
UpdateMissionStateIcon(mission is CombatMission combatMission ? CombatMission.IsInWinningTeam(GameMain.Client?.Character) : mission.Completed, missionIcon, animDelay);
|
||||
animDelay += 0.25f;
|
||||
}
|
||||
}
|
||||
@@ -567,7 +580,11 @@ namespace Barotrauma
|
||||
LocalizedString locationName = Submarine.MainSub is { AtEndExit: true } ? endLocation?.DisplayName : startLocation?.DisplayName;
|
||||
|
||||
string textTag;
|
||||
if (gameOver)
|
||||
if (gameMode is PvPMode)
|
||||
{
|
||||
textTag = "RoundSummaryRoundHasEnded";
|
||||
}
|
||||
else if (gameOver)
|
||||
{
|
||||
textTag = "RoundSummaryGameOver";
|
||||
}
|
||||
@@ -596,7 +613,14 @@ namespace Barotrauma
|
||||
textTag = "RoundSummaryReturnToEmptyLocation";
|
||||
break;
|
||||
default:
|
||||
textTag = Submarine.MainSub.AtEndExit ? "RoundSummaryProgress" : "RoundSummaryReturn";
|
||||
if (Submarine.MainSub == null)
|
||||
{
|
||||
textTag = "RoundSummaryRoundHasEnded";
|
||||
}
|
||||
else
|
||||
{
|
||||
textTag = Submarine.MainSub.AtEndExit ? "RoundSummaryProgress" : "RoundSummaryReturn";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -628,22 +652,28 @@ namespace Barotrauma
|
||||
{
|
||||
var headerFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.0f), parent.RectTransform, Anchor.TopCenter, minSize: new Point(0, (int)(30 * GUI.Scale))) { }, isHorizontal: true)
|
||||
{
|
||||
AbsoluteSpacing = 2
|
||||
AbsoluteSpacing = 2,
|
||||
Stretch = true
|
||||
};
|
||||
GUIButton jobButton = new GUIButton(new RectTransform(new Vector2(0f, 1f), headerFrame.RectTransform), TextManager.Get("tabmenu.job"), style: "GUIButtonSmallFreeScale");
|
||||
GUIButton characterButton = new GUIButton(new RectTransform(new Vector2(0f, 1f), headerFrame.RectTransform), TextManager.Get("name"), style: "GUIButtonSmallFreeScale");
|
||||
GUIButton statusButton = new GUIButton(new RectTransform(new Vector2(0f, 1f), headerFrame.RectTransform), TextManager.Get("label.statuslabel"), style: "GUIButtonSmallFreeScale");
|
||||
GUIButton jobButton = new GUIButton(new RectTransform(new Vector2(JobColumnWidthPercentage, 1f), headerFrame.RectTransform), TextManager.Get("tabmenu.job"), style: "GUIButtonSmallFreeScale");
|
||||
GUIButton characterButton = new GUIButton(new RectTransform(new Vector2(CharacterColumnWidthPercentage, 1f), headerFrame.RectTransform), TextManager.Get("name"), style: "GUIButtonSmallFreeScale");
|
||||
|
||||
float sizeMultiplier = 1.0f;
|
||||
//sizeMultiplier = (headerFrame.Rect.Width - headerFrame.AbsoluteSpacing * (headerFrame.CountChildren - 1)) / (float)headerFrame.Rect.Width;
|
||||
if (gameMode is PvPMode)
|
||||
{
|
||||
var killButton = new GUIButton(new RectTransform(new Vector2(KillColumnWidthPercentage, 1f), headerFrame.RectTransform), TextManager.Get("killcount"), style: "GUIButtonSmallFreeScale");
|
||||
killColumnWidth = killButton.Rect.Width;
|
||||
var deathButton = new GUIButton(new RectTransform(new Vector2(DeathColumnWidthPercentage, 1f), headerFrame.RectTransform), TextManager.Get("deathcount"), style: "GUIButtonSmallFreeScale");
|
||||
deathColumnWidth = deathButton.Rect.Width;
|
||||
}
|
||||
|
||||
jobButton.RectTransform.RelativeSize = new Vector2(jobColumnWidthPercentage * sizeMultiplier, 1f);
|
||||
characterButton.RectTransform.RelativeSize = new Vector2(characterColumnWidthPercentage * sizeMultiplier, 1f);
|
||||
statusButton.RectTransform.RelativeSize = new Vector2(statusColumnWidthPercentage * sizeMultiplier, 1f);
|
||||
GUIButton statusButton = new GUIButton(new RectTransform(new Vector2(StatusColumnWidthPercentage, 1f), headerFrame.RectTransform), TextManager.Get("label.statuslabel"), style: "GUIButtonSmallFreeScale");
|
||||
|
||||
jobButton.TextBlock.Font = characterButton.TextBlock.Font = statusButton.TextBlock.Font = GUIStyle.HotkeyFont;
|
||||
jobButton.CanBeFocused = characterButton.CanBeFocused = statusButton.CanBeFocused = false;
|
||||
jobButton.TextBlock.ForceUpperCase = characterButton.TextBlock.ForceUpperCase = statusButton.ForceUpperCase = ForceUpperCase.Yes;
|
||||
foreach (var btn in headerFrame.GetAllChildren<GUIButton>())
|
||||
{
|
||||
btn.TextBlock.Font = GUIStyle.HotkeyFont;
|
||||
btn.ForceUpperCase = ForceUpperCase.Yes;
|
||||
btn.CanBeFocused = false;
|
||||
}
|
||||
|
||||
jobColumnWidth = jobButton.Rect.Width;
|
||||
characterColumnWidth = characterButton.Rect.Width;
|
||||
@@ -658,8 +688,28 @@ namespace Barotrauma
|
||||
|
||||
headerFrame.RectTransform.RelativeSize -= new Vector2(crewList.ScrollBar.RectTransform.RelativeSize.X, 0.0f);
|
||||
|
||||
killCounts.Clear();
|
||||
if (GameMain.NetworkMember != null)
|
||||
{
|
||||
foreach (CharacterInfo characterInfo in characterInfos)
|
||||
{
|
||||
if (characterInfo == null) { continue; }
|
||||
Character character = characterInfo.Character;
|
||||
Client ownerClient = GameMain.NetworkMember.ConnectedClients.FirstOrDefault(c => c.Character == character);
|
||||
int killCount = 0, deathCount = 0;
|
||||
foreach (var mission in selectedMissions)
|
||||
{
|
||||
if (mission is not CombatMission combatMission) { continue; }
|
||||
killCount += ownerClient == null ? combatMission.GetBotKillCount(characterInfo) : combatMission.GetClientKillCount(ownerClient);
|
||||
deathCount += ownerClient == null ? combatMission.GetBotDeathCount(characterInfo) : combatMission.GetClientDeathCount(ownerClient);
|
||||
}
|
||||
killCounts[characterInfo] = killCount;
|
||||
deathCounts[characterInfo] = deathCount;
|
||||
}
|
||||
}
|
||||
|
||||
float delay = crewListAnimDelay;
|
||||
foreach (CharacterInfo characterInfo in characterInfos)
|
||||
foreach (CharacterInfo characterInfo in characterInfos.OrderByDescending(ci => killCounts.GetValueOrDefault(ci)))
|
||||
{
|
||||
if (characterInfo == null) { continue; }
|
||||
CreateCharacterElement(characterInfo, crewList, traitorResults, delay);
|
||||
@@ -670,6 +720,10 @@ namespace Barotrauma
|
||||
return crewList;
|
||||
}
|
||||
|
||||
private readonly Dictionary<CharacterInfo, int> killCounts = new();
|
||||
private readonly Dictionary<CharacterInfo, int> deathCounts = new();
|
||||
|
||||
|
||||
private void CreateCharacterElement(CharacterInfo characterInfo, GUIListBox listBox, TraitorManager.TraitorResults? traitorResults, float animDelay)
|
||||
{
|
||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(listBox.Content.Rect.Width, GUI.IntScale(45)), listBox.Content.RectTransform), style: "ListBoxElement")
|
||||
@@ -741,8 +795,19 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (gameMode is PvPMode pvpMode)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Point(killColumnWidth, paddedFrame.Rect.Height), paddedFrame.RectTransform),
|
||||
killCounts.GetValueOrDefault(characterInfo).ToString(), textAlignment: Alignment.Center);
|
||||
new GUITextBlock(new RectTransform(new Point(deathColumnWidth, paddedFrame.Rect.Height), paddedFrame.RectTransform),
|
||||
deathCounts.GetValueOrDefault(characterInfo).ToString(), textAlignment: Alignment.Center);
|
||||
}
|
||||
|
||||
GUITextBlock statusBlock = new GUITextBlock(new RectTransform(new Point(statusColumnWidth, paddedFrame.Rect.Height), paddedFrame.RectTransform),
|
||||
ToolBox.LimitString(statusText.Value, GUIStyle.Font, characterColumnWidth), textAlignment: Alignment.Center, textColor: statusColor);
|
||||
ToolBox.LimitString(statusText.Value, GUIStyle.Font, statusColumnWidth), textAlignment: Alignment.Center, textColor: statusColor, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = statusText.Value
|
||||
};
|
||||
|
||||
frame.FadeIn(animDelay, 0.15f);
|
||||
foreach (var child in frame.GetAllChildren())
|
||||
|
||||
Reference in New Issue
Block a user