Faction Test 100.4.0.0
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -15,8 +15,6 @@ namespace Barotrauma
|
||||
protected bool crewDead;
|
||||
|
||||
protected Color overlayColor;
|
||||
protected LocalizedString overlayText, overlayTextBottom;
|
||||
protected Color overlayTextColor;
|
||||
protected Sprite overlaySprite;
|
||||
|
||||
private TransitionType prevCampaignUIAutoOpenType;
|
||||
@@ -29,6 +27,12 @@ namespace Barotrauma
|
||||
protected GUIFrame campaignUIContainer;
|
||||
public CampaignUI CampaignUI;
|
||||
|
||||
public SlideshowPlayer SlideshowPlayer
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public static CancellationTokenSource StartRoundCancellationToken { get; private set; }
|
||||
|
||||
public bool ForceMapUI
|
||||
@@ -76,6 +80,7 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (Mission mission in Missions.ToList())
|
||||
{
|
||||
if (!mission.Prefab.ShowStartMessage) { continue; }
|
||||
new GUIMessageBox(
|
||||
RichString.Rich(mission.Prefab.IsSideObjective ? TextManager.AddPunctuation(':', TextManager.Get("sideobjective"), mission.Name) : mission.Name),
|
||||
RichString.Rich(mission.Description), Array.Empty<LocalizedString>(), type: GUIMessageBox.Type.InGame, icon: mission.Prefab.Icon)
|
||||
@@ -86,6 +91,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsOwner(Client client) => client != null && client.IsOwner;
|
||||
|
||||
/// <summary>
|
||||
/// There is a server-side implementation of the method in <see cref="MultiPlayerCampaign"/>
|
||||
/// </summary>
|
||||
@@ -97,10 +104,8 @@ namespace Barotrauma
|
||||
return
|
||||
GameMain.Client.HasPermission(permissions) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign) ||
|
||||
GameMain.Client.ConnectedClients.Count == 1 ||
|
||||
GameMain.Client.IsServerOwner ||
|
||||
//allow managing if no-one with permissions is alive
|
||||
GameMain.Client.ConnectedClients.None(c => c.InGame && c.Character is { IsIncapacitated: false, IsDead: false } && (c.IsOwner || c.HasPermission(permissions)));
|
||||
AnyOneAllowedToManageCampaign(permissions);
|
||||
}
|
||||
|
||||
public static bool AllowedToManageWallets()
|
||||
@@ -127,32 +132,10 @@ namespace Barotrauma
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), overlayColor, isFilled: true);
|
||||
}
|
||||
if (!overlayText.IsNullOrEmpty() && overlayTextColor.A > 0)
|
||||
{
|
||||
var backgroundSprite = GUIStyle.GetComponentStyle("CommandBackground").GetDefaultSprite();
|
||||
Vector2 centerPos = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) / 2;
|
||||
LocalizedString wrappedText = ToolBox.WrapText(overlayText, GameMain.GraphicsWidth / 3, GUIStyle.Font);
|
||||
Vector2 textSize = GUIStyle.Font.MeasureString(wrappedText);
|
||||
Vector2 textPos = centerPos - textSize / 2;
|
||||
backgroundSprite.Draw(spriteBatch,
|
||||
centerPos,
|
||||
Color.White * (overlayTextColor.A / 255.0f),
|
||||
origin: backgroundSprite.size / 2,
|
||||
rotate: 0.0f,
|
||||
scale: new Vector2(GameMain.GraphicsWidth / 2 / backgroundSprite.size.X, textSize.Y / backgroundSprite.size.Y * 1.5f));
|
||||
|
||||
GUI.DrawString(spriteBatch, textPos + Vector2.One, wrappedText, Color.Black * (overlayTextColor.A / 255.0f));
|
||||
GUI.DrawString(spriteBatch, textPos, wrappedText, overlayTextColor);
|
||||
|
||||
if (!overlayTextBottom.IsNullOrEmpty())
|
||||
{
|
||||
Vector2 bottomTextPos = centerPos + new Vector2(0.0f, textSize.Y / 2 + 40 * GUI.Scale) - GUIStyle.Font.MeasureString(overlayTextBottom) / 2;
|
||||
GUI.DrawString(spriteBatch, bottomTextPos + Vector2.One, overlayTextBottom.Value, Color.Black * (overlayTextColor.A / 255.0f));
|
||||
GUI.DrawString(spriteBatch, bottomTextPos, overlayTextBottom.Value, overlayTextColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SlideshowPlayer?.DrawManually(spriteBatch);
|
||||
|
||||
if (GUI.DisableHUD || GUI.DisableUpperHUD || ForceMapUI || CoroutineManager.IsCoroutineRunning("LevelTransition"))
|
||||
{
|
||||
endRoundButton.Visible = false;
|
||||
@@ -192,6 +175,7 @@ namespace Barotrauma
|
||||
case TransitionType.None:
|
||||
default:
|
||||
if (Level.Loaded.Type == LevelData.LevelType.Outpost &&
|
||||
!Level.Loaded.IsEndBiome &&
|
||||
(Character.Controlled?.Submarine?.Info.Type == SubmarineType.Player || (Character.Controlled?.CurrentHull?.OutpostModuleTags.Contains("airlock".ToIdentifier()) ?? false)))
|
||||
{
|
||||
buttonText = TextManager.GetWithVariable("LeaveLocation", "[locationname]", Level.Loaded.StartLocation?.Name ?? "[ERROR]");
|
||||
@@ -203,6 +187,10 @@ namespace Barotrauma
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (Level.IsLoadedOutpost && !ObjectiveManager.AllActiveObjectivesCompleted())
|
||||
{
|
||||
endRoundButton.Visible = false;
|
||||
}
|
||||
|
||||
if (ReadyCheckButton != null) { ReadyCheckButton.Visible = endRoundButton.Visible; }
|
||||
|
||||
@@ -266,7 +254,7 @@ namespace Barotrauma
|
||||
Rand.ThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
try
|
||||
{
|
||||
GameMain.GameSession.StartRound(newLevel, mirrorLevel: mirror);
|
||||
GameMain.GameSession.StartRound(newLevel, mirrorLevel: mirror, startOutpost: GetPredefinedStartOutpost());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -283,6 +271,18 @@ namespace Barotrauma
|
||||
return loadTask;
|
||||
}
|
||||
|
||||
protected SubmarineInfo GetPredefinedStartOutpost()
|
||||
{
|
||||
if (Map?.CurrentLocation?.Type?.GetForcedOutpostGenerationParams() is OutpostGenerationParams parameters && !parameters.OutpostFilePath.IsNullOrEmpty())
|
||||
{
|
||||
return new SubmarineInfo(parameters.OutpostFilePath.Value)
|
||||
{
|
||||
OutpostGenerationParams = parameters
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
partial void NPCInteractProjSpecific(Character npc, Character interactor)
|
||||
{
|
||||
if (npc == null || interactor == null) { return; }
|
||||
|
||||
Reference in New Issue
Block a user