Faction Test 100.13.0.0
This commit is contained in:
@@ -303,7 +303,7 @@ namespace Barotrauma
|
||||
|
||||
bool ChangeValue(GUIButton btn, object userData)
|
||||
{
|
||||
if (!(userData is int change)) { return false; }
|
||||
if (userData is not int change) { return false; }
|
||||
|
||||
int hiddenOptions = 0;
|
||||
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ namespace Barotrauma
|
||||
|
||||
private void CreateCustomizeWindow(CampaignSettings prevSettings, Action<CampaignSettings> onClosed = null)
|
||||
{
|
||||
CampaignCustomizeSettings = new GUIMessageBox("", "", new[] { TextManager.Get("OK") }, new Vector2(0.25f, 0.3f), minSize: new Point(450, 350));
|
||||
CampaignCustomizeSettings = new GUIMessageBox("", "", new[] { TextManager.Get("OK") }, new Vector2(0.25f, 0.5f), minSize: new Point(450, 350));
|
||||
|
||||
GUILayoutGroup campaignSettingContent = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.8f), CampaignCustomizeSettings.Content.RectTransform, Anchor.TopCenter));
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ namespace Barotrauma
|
||||
};
|
||||
missionRewardTexts.Add(rewardText);
|
||||
|
||||
LocalizedString reputationText = mission.GetReputationRewardText(mission.Locations[0]);
|
||||
LocalizedString reputationText = mission.GetReputationRewardText();
|
||||
if (!reputationText.IsNullOrEmpty())
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform), RichString.Rich(reputationText), wrap: true);
|
||||
|
||||
+1
-10
@@ -125,7 +125,7 @@ namespace Barotrauma.CharacterEditor
|
||||
{
|
||||
ResetVariables();
|
||||
var subInfo = new SubmarineInfo("Content/AnimEditor.sub");
|
||||
Submarine.MainSub = new Submarine(subInfo);
|
||||
Submarine.MainSub = new Submarine(subInfo, showErrorMessages: false);
|
||||
if (Submarine.MainSub.PhysicsBody != null)
|
||||
{
|
||||
Submarine.MainSub.PhysicsBody.Enabled = false;
|
||||
@@ -162,11 +162,6 @@ namespace Barotrauma.CharacterEditor
|
||||
OpenDoors();
|
||||
GameMain.Instance.ResolutionChanged += OnResolutionChanged;
|
||||
Instance = this;
|
||||
|
||||
if (!GameSettings.CurrentConfig.EditorDisclaimerShown)
|
||||
{
|
||||
GameMain.Instance.ShowEditorDisclaimer();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetVariables()
|
||||
@@ -2688,10 +2683,6 @@ namespace Barotrauma.CharacterEditor
|
||||
|
||||
// Character selection
|
||||
var characterLabel = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), GetCharacterEditorTranslation("CharacterPanel"), font: GUIStyle.LargeFont);
|
||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.2f, 0.7f), characterLabel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton")
|
||||
{
|
||||
OnClicked = (btn, userdata) => { GameMain.Instance.ShowEditorDisclaimer(); return true; }
|
||||
};
|
||||
|
||||
var characterDropDown = new GUIDropDown(new RectTransform(new Vector2(1, 0.2f), content.RectTransform)
|
||||
{
|
||||
|
||||
@@ -820,6 +820,15 @@ namespace Barotrauma
|
||||
};
|
||||
valueInput.Text = newValue?.ToString() ?? "<type here>";
|
||||
}
|
||||
else if (type == typeof(Identifier))
|
||||
{
|
||||
GUITextBox valueInput = new GUITextBox(new RectTransform(Vector2.One, layout.RectTransform), newValue?.ToString() ?? string.Empty);
|
||||
valueInput.OnTextChanged += (component, o) =>
|
||||
{
|
||||
newValue = new Identifier(o);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
else if (type == typeof(float) || type == typeof(int))
|
||||
{
|
||||
GUINumberInput valueInput = new GUINumberInput(new RectTransform(Vector2.One, layout.RectTransform), NumberType.Float) { FloatValue = (float) (newValue ?? 0.0f) };
|
||||
|
||||
@@ -51,9 +51,8 @@ namespace Barotrauma
|
||||
|
||||
private readonly GUIFrame modsButtonContainer;
|
||||
private readonly GUIButton modsButton, modUpdatesButton;
|
||||
private Task<IReadOnlyList<Steamworks.Ugc.Item>> modUpdateTask;
|
||||
private float modUpdateTimer = 0.0f;
|
||||
private const float ModUpdateInterval = 60.0f;
|
||||
private (DateTime WhenToRefresh, int Count) modUpdateStatus = (DateTime.Now, 0);
|
||||
private static readonly TimeSpan ModUpdateInterval = TimeSpan.FromSeconds(60.0f);
|
||||
|
||||
private readonly GameMain game;
|
||||
|
||||
@@ -736,8 +735,7 @@ namespace Barotrauma
|
||||
|
||||
public void ResetModUpdateButton()
|
||||
{
|
||||
modUpdateTask = null;
|
||||
modUpdateTimer = 0;
|
||||
modUpdateStatus = (DateTime.Now, 0);
|
||||
modUpdatesButton.Visible = false;
|
||||
}
|
||||
|
||||
@@ -875,7 +873,25 @@ namespace Barotrauma
|
||||
GameMain.ResetNetLobbyScreen();
|
||||
try
|
||||
{
|
||||
string exeName = serverExecutableDropdown.SelectedComponent?.UserData is ServerExecutableFile f ? f.Path.Value : "DedicatedServer";
|
||||
string fileName;
|
||||
if (serverExecutableDropdown.SelectedComponent?.UserData is ServerExecutableFile f &&
|
||||
f.ContentPackage != GameMain.VanillaContent)
|
||||
{
|
||||
fileName = Path.Combine(
|
||||
Path.GetDirectoryName(f.Path.Value),
|
||||
Path.GetFileNameWithoutExtension(f.Path.Value));
|
||||
#if WINDOWS
|
||||
fileName += ".exe";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if WINDOWS
|
||||
fileName = "DedicatedServer.exe";
|
||||
#else
|
||||
fileName = "./DedicatedServer";
|
||||
#endif
|
||||
}
|
||||
|
||||
string arguments = "-name \"" + ToolBox.EscapeCharacters(name) + "\"" +
|
||||
" -public " + isPublicBox.Selected.ToString() +
|
||||
@@ -899,19 +915,10 @@ namespace Barotrauma
|
||||
}
|
||||
int ownerKey = Math.Max(CryptoRandom.Instance.Next(), 1);
|
||||
arguments += " -ownerkey " + ownerKey;
|
||||
|
||||
string filename = Path.Combine(
|
||||
Path.GetDirectoryName(exeName),
|
||||
Path.GetFileNameWithoutExtension(exeName));
|
||||
#if WINDOWS
|
||||
filename += ".exe";
|
||||
#else
|
||||
filename = "./" + exeName;
|
||||
#endif
|
||||
|
||||
|
||||
var processInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = filename,
|
||||
FileName = fileName,
|
||||
Arguments = arguments,
|
||||
WorkingDirectory = Directory.GetCurrentDirectory(),
|
||||
#if !DEBUG
|
||||
@@ -958,15 +965,42 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateOutOfDateWorkshopItemCount()
|
||||
{
|
||||
if (DateTime.Now < modUpdateStatus.WhenToRefresh) { return; }
|
||||
if (!SteamManager.IsInitialized) { return; }
|
||||
|
||||
var installedPackages = ContentPackageManager.WorkshopPackages;
|
||||
|
||||
var ids = SteamManager.Workshop.GetSubscribedItemIds()
|
||||
.Select(id => id.Value)
|
||||
.Union(installedPackages
|
||||
.Select(pkg => pkg.UgcId)
|
||||
.NotNone()
|
||||
.OfType<SteamWorkshopId>()
|
||||
.Select(id => id.Value));
|
||||
var count = ids
|
||||
// Deliberately construct Steamworks.Ugc.Item directly
|
||||
// to not immediately generate a Workshop data request
|
||||
.Select(id => new Steamworks.Ugc.Item(id))
|
||||
.Count(item =>
|
||||
installedPackages.FirstOrDefault(p
|
||||
=> p.UgcId.TryUnwrap(out SteamWorkshopId id) && id.Value == item.Id)
|
||||
is { } pkg
|
||||
// Checking that this item is downloading, waiting to be downloaded
|
||||
// or is newer than the currently installed copy should be good enough,
|
||||
// and should still not make a Workshop data request
|
||||
&& (item.IsDownloading
|
||||
|| item.IsDownloadPending
|
||||
|| (item.InstallTime.TryGetValue(out var workshopInstallTime)
|
||||
&& pkg.InstallTime.TryUnwrap(out var localInstallTime)
|
||||
&& localInstallTime < workshopInstallTime)));
|
||||
|
||||
modUpdateStatus = (DateTime.Now + ModUpdateInterval, count);
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
modUpdateTimer -= (float)deltaTime;
|
||||
if (modUpdateTimer <= 0.0f && modUpdateTask is not { IsCompleted: false })
|
||||
{
|
||||
modUpdateTask = BulkDownloader.GetItemsThatNeedUpdating();
|
||||
modUpdateTimer = ModUpdateInterval;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
hostServerButton.Enabled = true;
|
||||
#else
|
||||
@@ -976,10 +1010,8 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
if (modUpdateTask is { IsCompletedSuccessfully: true })
|
||||
{
|
||||
modUpdatesButton.Visible = modUpdateTask.Result.Count > 0;
|
||||
}
|
||||
UpdateOutOfDateWorkshopItemCount();
|
||||
modUpdatesButton.Visible = modUpdateStatus.Count > 0;
|
||||
|
||||
if (modUpdatesButton.Visible)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Barotrauma
|
||||
{
|
||||
var slide = slideshowPrefab.Slides[Math.Min(state, slideshowPrefab.Slides.Length - 1)];
|
||||
currentText = slide.Text
|
||||
.Replace("[submarine]", Submarine.MainSub?.Info.Name ?? "Unknown")
|
||||
.Replace("[submarine]", Submarine.MainSub?.Info.Name ?? GameMain.GameSession?.SubmarineInfo?.Name ?? "Unknown")
|
||||
.Replace("[location]", Level.Loaded?.StartOutpost?.Info.Name ?? "Unknown");
|
||||
}
|
||||
|
||||
|
||||
@@ -543,13 +543,6 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), paddedTopPanel.RectTransform, Anchor.CenterRight), style: "GUINotificationButton")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
OnClicked = (btn, userdata) => { GameMain.Instance.ShowEditorDisclaimer(); return true; }
|
||||
};
|
||||
disclaimerBtn.RectTransform.MaxSize = new Point(disclaimerBtn.Rect.Height);
|
||||
|
||||
TopPanel.RectTransform.MinSize = new Point(0, (int)(paddedTopPanel.RectTransform.Children.Max(c => c.MinSize.Y) / paddedTopPanel.RectTransform.RelativeSize.Y));
|
||||
paddedTopPanel.Recalculate();
|
||||
|
||||
@@ -1425,7 +1418,7 @@ namespace Barotrauma
|
||||
else if (MainSub == null)
|
||||
{
|
||||
var subInfo = new SubmarineInfo();
|
||||
MainSub = new Submarine(subInfo);
|
||||
MainSub = new Submarine(subInfo, showErrorMessages: false);
|
||||
}
|
||||
|
||||
MainSub.UpdateTransform(interpolate: false);
|
||||
@@ -1462,11 +1455,6 @@ namespace Barotrauma
|
||||
|
||||
ImageManager.OnEditorSelected();
|
||||
ReconstructLayers();
|
||||
|
||||
if (!GameSettings.CurrentConfig.EditorDisclaimerShown)
|
||||
{
|
||||
GameMain.Instance.ShowEditorDisclaimer();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnFileDropped(string filePath, string extension)
|
||||
@@ -5646,8 +5634,7 @@ namespace Barotrauma
|
||||
MouseDragStart = Vector2.Zero;
|
||||
}
|
||||
|
||||
if (!saveAssemblyFrame.Rect.Contains(PlayerInput.MousePosition)
|
||||
&& !snapToGridFrame.Rect.Contains(PlayerInput.MousePosition)
|
||||
if ((GUI.MouseOn == null || !GUI.MouseOn.IsChildOf(TopPanel))
|
||||
&& dummyCharacter?.SelectedItem == null && !WiringMode
|
||||
&& (GUI.MouseOn == null || MapEntity.SelectedAny || MapEntity.SelectionPos != Vector2.Zero))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user