Build 0.21.1.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));
|
||||
|
||||
|
||||
+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)
|
||||
{
|
||||
|
||||
@@ -189,7 +189,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public IReadOnlyList<SubmarineInfo> GetSubList()
|
||||
=> SubList.Content.Children.Select(c => c.UserData as SubmarineInfo).ToArray();
|
||||
=> (IReadOnlyList<SubmarineInfo>)GameMain.Client?.ServerSubmarines
|
||||
?? Array.Empty<SubmarineInfo>();
|
||||
|
||||
public readonly GUIListBox PlayerList;
|
||||
|
||||
@@ -929,6 +930,8 @@ namespace Barotrauma
|
||||
|
||||
var modeTitle = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), modeContent.RectTransform), mode.Name, font: GUIStyle.SubHeadingFont);
|
||||
var modeDescription = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), modeContent.RectTransform), mode.Description, font: GUIStyle.SmallFont, wrap: true);
|
||||
//leave some padding for the vote count text
|
||||
modeDescription.Padding = new Vector4(modeDescription.Padding.X, modeDescription.Padding.Y, GUI.IntScale(30), modeDescription.Padding.W);
|
||||
modeTitle.HoverColor = modeDescription.HoverColor = modeTitle.SelectedColor = modeDescription.SelectedColor = Color.Transparent;
|
||||
modeTitle.HoverTextColor = modeDescription.HoverTextColor = modeTitle.TextColor;
|
||||
modeTitle.TextColor = modeDescription.TextColor = modeTitle.TextColor * 0.5f;
|
||||
@@ -981,7 +984,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.Client.RequestSelectMode(ModeList.Content.GetChildIndex(ModeList.Content.GetChildByUserData(GameModePreset.Sandbox)));
|
||||
GameMain.Client.RequestRoundEnd(save: false, quitCampaign: true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -3291,16 +3294,15 @@ namespace Barotrauma
|
||||
{
|
||||
//campaign running
|
||||
settingsBlocker.Visible = true;
|
||||
CampaignFrame.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageCampaign);
|
||||
ContinueCampaignButton.Enabled = !GameMain.Client.GameStarted && (GameMain.Client.HasPermission(ClientPermissions.ManageCampaign) || GameMain.Client.HasPermission(ClientPermissions.ManageRound));
|
||||
QuitCampaignButton.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageCampaign);
|
||||
CampaignFrame.Visible = QuitCampaignButton.Enabled = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageRound);
|
||||
ContinueCampaignButton.Enabled = !GameMain.Client.GameStarted && CampaignFrame.Visible;
|
||||
CampaignSetupFrame.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CampaignFrame.Visible = false;
|
||||
CampaignSetupFrame.Visible = true;
|
||||
if (!GameMain.Client.HasPermission(ClientPermissions.ManageCampaign))
|
||||
if (!CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageRound))
|
||||
{
|
||||
CampaignSetupFrame.ClearChildren();
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.5f), CampaignSetupFrame.RectTransform, Anchor.Center),
|
||||
@@ -3364,7 +3366,7 @@ namespace Barotrauma
|
||||
CampaignFrame.Visible = CampaignSetupFrame.Visible = false;
|
||||
}
|
||||
RefreshEnabledElements();
|
||||
if (enabled)
|
||||
if (enabled && SelectedMode != GameModePreset.MultiPlayerCampaign)
|
||||
{
|
||||
ModeList.Select(GameModePreset.MultiPlayerCampaign, GUIListBox.Force.Yes);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -2726,11 +2714,13 @@ namespace Barotrauma
|
||||
|
||||
previewImageButtonHolder.RectTransform.MinSize = new Point(0, previewImageButtonHolder.RectTransform.Children.Max(c => c.MinSize.Y));
|
||||
|
||||
var contentPackageTabber = new GUILayoutGroup(new RectTransform((1.0f, 0.06f), rightColumn.RectTransform), isHorizontal: true);
|
||||
var contentPackageTabber = new GUILayoutGroup(new RectTransform((1.0f, 0.075f), rightColumn.RectTransform), isHorizontal: true);
|
||||
|
||||
GUIButton createTabberBtn(string labelTag)
|
||||
{
|
||||
var btn = new GUIButton(new RectTransform((0.5f, 1.0f), contentPackageTabber.RectTransform, Anchor.BottomCenter, Pivot.BottomCenter), TextManager.Get(labelTag), style: "GUITabButton");
|
||||
btn.TextBlock.Wrap = true;
|
||||
btn.TextBlock.SetTextPos();
|
||||
btn.RectTransform.MaxSize = RectTransform.MaxPoint;
|
||||
btn.Children.ForEach(c => c.RectTransform.MaxSize = RectTransform.MaxPoint);
|
||||
btn.Font = GUIStyle.SmallFont;
|
||||
@@ -5635,8 +5625,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