(3622747f3) Unstable 0.9.705.0
This commit is contained in:
@@ -226,7 +226,10 @@ namespace Barotrauma
|
||||
if (openHealthWindow != null)
|
||||
{
|
||||
openHealthWindow.characterName.Text = value.Character.Name;
|
||||
Character.Controlled.SelectedConstruction = null;
|
||||
if (Character.Controlled.SelectedConstruction != null && Character.Controlled.SelectedConstruction.GetComponent<Ladder>() == null)
|
||||
{
|
||||
Character.Controlled.SelectedConstruction = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1733,21 +1733,15 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
if (!int.TryParse(args[0], out int id))
|
||||
{
|
||||
ThrowError("\"" + id + "\" is not a valid client ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
NewMessage("Valid permissions are:", Color.White);
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
NewMessage(" - " + permission.ToString(), Color.White);
|
||||
}
|
||||
ShowQuestionPrompt("Permission to grant to client #" + id + "?", (perm) =>
|
||||
ShowQuestionPrompt("Permission to grant to client " + args[0] + "?", (perm) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("giveperm " + id + " " + perm);
|
||||
});
|
||||
GameMain.Client?.SendConsoleCommand("giveperm " + args[0] + " " + perm);
|
||||
}, args, 1);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1757,22 +1751,16 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
if (!int.TryParse(args[0], out int id))
|
||||
{
|
||||
ThrowError("\"" + id + "\" is not a valid client ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
NewMessage("Valid permissions are:", Color.White);
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
NewMessage(" - " + permission.ToString(), Color.White);
|
||||
}
|
||||
|
||||
ShowQuestionPrompt("Permission to revoke from client #" + id + "?", (perm) =>
|
||||
ShowQuestionPrompt("Permission to revoke from client " + args[0] + "?", (perm) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("revokeperm " + id + " " + perm);
|
||||
});
|
||||
GameMain.Client?.SendConsoleCommand("revokeperm " + args[0] + " " + perm);
|
||||
}, args, 1);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1782,21 +1770,15 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
if (!int.TryParse(args[0], out int id))
|
||||
{
|
||||
ThrowError("\"" + id + "\" is not a valid client ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
NewMessage("Valid ranks are:", Color.White);
|
||||
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
|
||||
{
|
||||
NewMessage(" - " + permissionPreset.Name, Color.White);
|
||||
}
|
||||
ShowQuestionPrompt("Rank to grant to client #" + id + "?", (rank) =>
|
||||
ShowQuestionPrompt("Rank to grant to client " + args[0] + "?", (rank) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("giverank " + id + " " + rank);
|
||||
});
|
||||
GameMain.Client?.SendConsoleCommand("giverank " + args[0] + " " + rank);
|
||||
}, args, 1);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1806,16 +1788,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
if (!int.TryParse(args[0], out int id))
|
||||
ShowQuestionPrompt("Console command permissions to grant to client " + args[0] + "? You may enter multiple commands separated with a space.", (commandNames) =>
|
||||
{
|
||||
ThrowError("\"" + id + "\" is not a valid client ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
ShowQuestionPrompt("Console command permissions to grant to client #" + id + "? You may enter multiple commands separated with a space.", (commandNames) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("givecommandperm " + id + " " + commandNames);
|
||||
});
|
||||
GameMain.Client?.SendConsoleCommand("givecommandperm " + args[0] + " " + commandNames);
|
||||
}, args, 1);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1825,16 +1801,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
if (!int.TryParse(args[0], out int id))
|
||||
ShowQuestionPrompt("Console command permissions to revoke from client " + args[0] + "? You may enter multiple commands separated with a space.", (commandNames) =>
|
||||
{
|
||||
ThrowError("\"" + id + "\" is not a valid client ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
ShowQuestionPrompt("Console command permissions to revoke from client #" + id + "? You may enter multiple commands separated with a space.", (commandNames) =>
|
||||
{
|
||||
GameMain.Client?.SendConsoleCommand("revokecommandperm " + id + " " + commandNames);
|
||||
});
|
||||
GameMain.Client?.SendConsoleCommand("revokecommandperm " + args[0] + " " + commandNames);
|
||||
}, args, 1);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1844,13 +1814,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
|
||||
if (!int.TryParse(args[0], out int id))
|
||||
{
|
||||
ThrowError("\"" + id + "\" is not a valid client ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
GameMain.Client.SendConsoleCommand("showperm " + id);
|
||||
GameMain.Client.SendConsoleCommand("showperm " + args[0]);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -288,10 +288,6 @@ namespace Barotrauma
|
||||
public void SetVisibility(bool visible)
|
||||
{
|
||||
GUIFrame.Parent.Visible = visible;
|
||||
if (GameMain.GameSession?.CrewManager?.ReportButtonFrame != null)
|
||||
{
|
||||
GameMain.GameSession.CrewManager.ReportButtonFrame.Visible = visible;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<object> UpdateMessageAnimation(GUIComponent message, float animDuration)
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Barotrauma
|
||||
|
||||
var crewAreaY = AfflictionAreaLeft.Bottom + Padding;
|
||||
var crewAreaHeight = ObjectiveAnchor.Top - Padding - crewAreaY;
|
||||
CrewArea = new Rectangle(Padding, crewAreaY, (int)Math.Max(400 * GUI.Scale, 400), crewAreaHeight);
|
||||
CrewArea = new Rectangle(Padding, crewAreaY, (int)Math.Max(400 * GUI.Scale, 150), crewAreaHeight);
|
||||
|
||||
InventoryAreaLower = new Rectangle(Padding, inventoryTopY, GameMain.GraphicsWidth - Padding * 2, GameMain.GraphicsHeight - inventoryTopY);
|
||||
|
||||
|
||||
@@ -647,7 +647,7 @@ namespace Barotrauma
|
||||
public void SortChildren(Comparison<RectTransform> comparison)
|
||||
{
|
||||
children.Sort(comparison);
|
||||
RecalculateAll(false, true, true);
|
||||
RecalculateAll(false, false, true);
|
||||
Parent.ChildrenChanged?.Invoke(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -648,7 +648,6 @@ namespace Barotrauma
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
protected override void Update(GameTime gameTime)
|
||||
{
|
||||
Timing.TotalTime = gameTime.TotalGameTime.TotalSeconds;
|
||||
Timing.Accumulator += gameTime.ElapsedGameTime.TotalSeconds;
|
||||
int updateIterations = (int)Math.Floor(Timing.Accumulator / Timing.Step);
|
||||
if (Timing.Accumulator > Timing.Step * 6.0)
|
||||
@@ -677,6 +676,8 @@ namespace Barotrauma
|
||||
|
||||
while (Timing.Accumulator >= Timing.Step)
|
||||
{
|
||||
Timing.TotalTime += Timing.Step;
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Barotrauma
|
||||
|
||||
crewArea = new GUIFrame(
|
||||
new RectTransform(
|
||||
new Point(crewAreaWithButtons.Rect.Width, crewAreaWithButtons.Rect.Height - 3 * buttonHeight - 2 * HUDLayoutSettings.Padding),
|
||||
new Point(crewAreaWithButtons.Rect.Width, crewAreaWithButtons.Rect.Height - (int)(1.5f * buttonHeight) - 2 * HUDLayoutSettings.Padding),
|
||||
crewAreaWithButtons.RectTransform,
|
||||
Anchor.BottomLeft),
|
||||
style: null,
|
||||
@@ -111,39 +111,32 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var buttonSize = new Point((int)(79.0f / 126.0f * (2 * buttonHeight)), 2 * buttonHeight);
|
||||
var buttonSize = new Point((int)(182.0f / 99.0f * buttonHeight), buttonHeight);
|
||||
var commandButton = new GUIButton(
|
||||
new RectTransform(buttonSize, parent: crewAreaWithButtons.RectTransform),
|
||||
style: null)
|
||||
style: "CommandButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("inputtype.command"),
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
ToggleCommandUI();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
new GUIImage(
|
||||
new RectTransform(Vector2.One, commandButton.RectTransform),
|
||||
new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(551, 1, 79, 126)),
|
||||
scaleToFit: true)
|
||||
{
|
||||
Color = GUIColorSettings.InventorySlotColor * 0.8f,
|
||||
HoverColor = GUIColorSettings.InventorySlotColor,
|
||||
PressedColor = GUIColorSettings.InventorySlotColor,
|
||||
SelectedColor = GUIColorSettings.InventorySlotColor * 0.8f,
|
||||
ToolTip = TextManager.Get("inputtype.command")
|
||||
};
|
||||
|
||||
var keybindText = new GUITextBlock(new RectTransform(Vector2.One, commandButton.RectTransform), "", font: GUI.SmallFont,
|
||||
textAlignment: Alignment.TopLeft, color: GUI.Style.TextColorBright)
|
||||
var keybindText = new GUITextBlock(new RectTransform(new Vector2(0.9f), commandButton.RectTransform, Anchor.Center),
|
||||
"",
|
||||
font: GUI.SmallFont,
|
||||
textAlignment: Alignment.TopLeft,
|
||||
textColor: GUI.Style.TextColorBright,
|
||||
style: null)
|
||||
{
|
||||
TextGetter = () =>
|
||||
{
|
||||
//hide the text if using a long non-default keybind
|
||||
string txt = GameMain.Config.KeyBindText(InputType.CrewOrders);
|
||||
string txt = GameMain.Config.KeyBindText(InputType.Command);
|
||||
return txt.Length > 2 ? "" : txt;
|
||||
},
|
||||
HoverTextColor = GUI.Style.TextColorBright,
|
||||
Padding = Vector4.One * 3,
|
||||
CanBeFocused = false
|
||||
};
|
||||
@@ -162,10 +155,10 @@ namespace Barotrauma
|
||||
|
||||
toggleCrewButton = new GUIButton(
|
||||
new RectTransform(
|
||||
new Point(buttonHeight),
|
||||
new Point(buttonSize.X, (int)(0.5f * buttonHeight)),
|
||||
parent: crewAreaWithButtons.RectTransform)
|
||||
{
|
||||
AbsoluteOffset = new Point(0, 2 * buttonHeight + HUDLayoutSettings.Padding)
|
||||
AbsoluteOffset = new Point(0, buttonHeight + HUDLayoutSettings.Padding)
|
||||
},
|
||||
style: "UIToggleButton")
|
||||
{
|
||||
@@ -389,7 +382,7 @@ namespace Barotrauma
|
||||
private void AddCharacterToCrewList(Character character)
|
||||
{
|
||||
int width = crewList.Content.Rect.Width - HUDLayoutSettings.Padding;
|
||||
int height = Math.Max(45, (int)((1.0f / 8.0f) * width));
|
||||
int height = Math.Max(32, (int)((1.0f / 8.0f) * width));
|
||||
var background = new GUIImage(
|
||||
new RectTransform(new Point(width, height), parent: crewList.Content.RectTransform, anchor: Anchor.TopRight),
|
||||
crewMemberBackground,
|
||||
@@ -435,11 +428,13 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
var relativeWidth = 1.0f - 4.5f * iconRelativeSize - 5 * layoutGroup.RelativeSpacing;
|
||||
var font = layoutGroup.Rect.Width < 150 ? GUI.SmallFont : GUI.Font;
|
||||
new GUITextBlock(
|
||||
new RectTransform(
|
||||
new Vector2(relativeWidth, 1.0f),
|
||||
layoutGroup.RectTransform),
|
||||
ToolBox.LimitString(character.Name, GUI.SubHeadingFont, (int)(relativeWidth * layoutGroup.Rect.Width)),
|
||||
ToolBox.LimitString(character.Name, font, (int)(relativeWidth * layoutGroup.Rect.Width)),
|
||||
font: font,
|
||||
textColor: character.Info?.Job?.Prefab?.UIColor)
|
||||
{
|
||||
CanBeFocused = false
|
||||
@@ -651,12 +646,6 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public void SetCharacterOrder(Character character, Order order, string option, Character orderGiver)
|
||||
{
|
||||
if (character == null)
|
||||
{
|
||||
//can't issue an order if no characters are available
|
||||
return;
|
||||
}
|
||||
|
||||
if (order != null && order.TargetAllCharacters)
|
||||
{
|
||||
if (orderGiver == null || orderGiver.CurrentHull == null) { return; }
|
||||
@@ -675,6 +664,12 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (character == null)
|
||||
{
|
||||
//can't issue an order if no characters are available
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsSinglePlayer)
|
||||
{
|
||||
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
||||
@@ -2289,7 +2284,10 @@ namespace Barotrauma
|
||||
|
||||
if (canIssueOrders)
|
||||
{
|
||||
ReportButtonFrame.Visible = true;
|
||||
//report buttons are hidden when accessing another character's inventory
|
||||
ReportButtonFrame.Visible =
|
||||
Character.Controlled?.SelectedCharacter?.Inventory == null ||
|
||||
!Character.Controlled.SelectedCharacter.CanInventoryBeAccessed;
|
||||
|
||||
var reportButtonParent = ChatBox ?? GameMain.Client?.ChatBox;
|
||||
if (reportButtonParent == null) { return; }
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
loadCampaignContainer.Visible = false;
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(newCampaignButton.TextBlock, loadCampaignButton.TextBlock);
|
||||
|
||||
campaignSetupUI.StartNewGame = GameMain.Client.SetupNewCampaign;
|
||||
campaignSetupUI.LoadGame = GameMain.Client.SetupLoadCampaign;
|
||||
|
||||
@@ -1062,12 +1062,6 @@ namespace Barotrauma
|
||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||
}
|
||||
|
||||
GameMain.Instance.OnResolutionChanged += () =>
|
||||
{
|
||||
foreach (GUILayoutGroup inputContainer in inputColumnLeft.Children) { inputContainer.Recalculate(); }
|
||||
foreach (GUILayoutGroup inputContainer in inputColumnRight.Children) { inputContainer.Recalculate(); }
|
||||
};
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(inputNameBlocks);
|
||||
|
||||
var resetControlsArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), style: null);
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace Barotrauma
|
||||
private Vector2 inventoryExtendButtonOffset, inventoryArrowOffset;
|
||||
private int inventoryOpeningOffset;
|
||||
|
||||
private Point prevResolution;
|
||||
|
||||
public const InvSlotType PersonalSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.OuterClothes | InvSlotType.Head;
|
||||
|
||||
public Vector2[] SlotPositions;
|
||||
@@ -120,7 +122,6 @@ namespace Barotrauma
|
||||
SlotPositions = new Vector2[SlotTypes.Length];
|
||||
CurrentLayout = Layout.Default;
|
||||
SetSlotPositions();
|
||||
GameMain.Instance.OnResolutionChanged += SetSlotPositions;
|
||||
}
|
||||
|
||||
protected override ItemInventory GetActiveEquippedSubInventory(int slotIndex)
|
||||
@@ -282,7 +283,9 @@ namespace Barotrauma
|
||||
Point slotSize = (SlotSpriteSmall.size * UIScale).ToPoint();
|
||||
int bottomOffset = slotSize.Y + spacing * 2 + ContainedIndicatorHeight;
|
||||
|
||||
if (slots == null) CreateSlots();
|
||||
prevResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
|
||||
if (slots == null) { CreateSlots(); }
|
||||
|
||||
hideButton.Visible = false;
|
||||
|
||||
@@ -539,29 +542,38 @@ namespace Barotrauma
|
||||
((selectedSlot != null && selectedSlot.IsSubSlot) || (draggingItem != null && (draggingSlot == null || !draggingSlot.MouseOn())));
|
||||
if (CharacterHealth.OpenHealthWindow != null) hoverOnInventory = true;
|
||||
|
||||
if (layout == Layout.Default && hideButton.Visible)
|
||||
if (layout == Layout.Default)
|
||||
{
|
||||
hideButton.AddToGUIUpdateList();
|
||||
hideButton.UpdateManually(deltaTime, alsoChildren: true);
|
||||
|
||||
hidePersonalSlotsState = hidePersonalSlots ?
|
||||
Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) :
|
||||
Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f);
|
||||
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
if (hideButton.Visible)
|
||||
{
|
||||
if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; }
|
||||
if (HidePersonalSlots)
|
||||
hideButton.AddToGUIUpdateList();
|
||||
hideButton.UpdateManually(deltaTime, alsoChildren: true);
|
||||
|
||||
hidePersonalSlotsState = hidePersonalSlots ?
|
||||
Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) :
|
||||
Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f);
|
||||
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; }
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]);
|
||||
if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; }
|
||||
if (HidePersonalSlots)
|
||||
{
|
||||
if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; }
|
||||
highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]);
|
||||
}
|
||||
slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
|
||||
}
|
||||
slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
|
||||
}
|
||||
|
||||
InventoryToggleContains = InventoryToggleArea.Contains(PlayerInput.MousePosition);
|
||||
if (InventoryToggleContains && PlayerInput.PrimaryMouseButtonClicked())
|
||||
{
|
||||
ToggleInventory();
|
||||
}
|
||||
}
|
||||
|
||||
if (hoverOnInventory) HideTimer = 0.5f;
|
||||
if (HideTimer > 0.0f) HideTimer -= deltaTime;
|
||||
|
||||
if (hoverOnInventory) { HideTimer = 0.5f; }
|
||||
if (HideTimer > 0.0f) { HideTimer -= deltaTime; }
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
@@ -1007,8 +1019,13 @@ namespace Barotrauma
|
||||
|
||||
public void DrawThis(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!AccessibleWhenAlive && !character.IsDead) return;
|
||||
if (slots == null) CreateSlots();
|
||||
if (!AccessibleWhenAlive && !character.IsDead) { return; }
|
||||
if (slots == null) { CreateSlots(); }
|
||||
|
||||
if (prevResolution.X != GameMain.GraphicsWidth || prevResolution.Y != GameMain.GraphicsHeight)
|
||||
{
|
||||
SetSlotPositions();
|
||||
}
|
||||
|
||||
if (hideButton != null && hideButton.Visible && !Locked)
|
||||
{
|
||||
@@ -1033,12 +1050,6 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
GUI.DrawString(spriteBatch, arrowPosition + new Vector2(UIScale * 25, -3 * UIScale), GameMain.Config.KeyBindText(InputType.ToggleInventory), Color.White, font: GUI.HotkeyFont);
|
||||
|
||||
InventoryToggleContains = InventoryToggleArea.Contains(PlayerInput.MousePosition);
|
||||
if (InventoryToggleContains && PlayerInput.PrimaryMouseButtonClicked())
|
||||
{
|
||||
ToggleInventory();
|
||||
}
|
||||
}
|
||||
|
||||
InventorySlot highlightedQuickUseSlot = null;
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private GUICustomComponent guiCustomComponent;
|
||||
|
||||
private Point prevResolution;
|
||||
|
||||
public Sprite InventoryTopSprite
|
||||
{
|
||||
get { return inventoryTopSprite; }
|
||||
@@ -118,7 +120,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
//if a GUIFrame has been defined, draw the inventory inside it
|
||||
CreateGUI();
|
||||
GameMain.Instance.OnResolutionChanged += () => { GuiFrame.ClearChildren(); CreateGUI(); };
|
||||
prevResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +167,16 @@ namespace Barotrauma.Items.Components
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing = false, float itemDepth = -1)
|
||||
{
|
||||
if (hideItems || (item.body != null && !item.body.Enabled)) { return; }
|
||||
|
||||
if ((prevResolution.X > 0 && prevResolution.Y > 0) &&
|
||||
(prevResolution.X != GameMain.GraphicsWidth || prevResolution.Y != GameMain.GraphicsHeight))
|
||||
{
|
||||
GuiFrame.ClearChildren();
|
||||
CreateGUI();
|
||||
|
||||
prevResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
}
|
||||
|
||||
DrawContainedItems(spriteBatch, itemDepth);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,14 @@ namespace Barotrauma.Items.Components
|
||||
partial void InitProjSpecific(XElement element)
|
||||
{
|
||||
CreateGUI();
|
||||
GameMain.Instance.OnResolutionChanged += () =>
|
||||
{
|
||||
GuiFrame.ClearChildren();
|
||||
CreateGUI();
|
||||
OnItemLoadedProjSpecific();
|
||||
};
|
||||
GameMain.Instance.OnResolutionChanged += RecreateGUI;
|
||||
}
|
||||
|
||||
private void RecreateGUI()
|
||||
{
|
||||
GuiFrame.ClearChildren();
|
||||
CreateGUI();
|
||||
OnItemLoadedProjSpecific();
|
||||
}
|
||||
|
||||
private void CreateGUI()
|
||||
@@ -168,5 +170,10 @@ namespace Barotrauma.Items.Components
|
||||
SetActive(msg.ReadBoolean());
|
||||
progressTimer = msg.ReadSingle();
|
||||
}
|
||||
|
||||
protected override void RemoveComponentSpecific()
|
||||
{
|
||||
GameMain.Instance.OnResolutionChanged -= RecreateGUI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,14 @@ namespace Barotrauma.Items.Components
|
||||
partial void InitProjSpecific()
|
||||
{
|
||||
CreateGUI();
|
||||
GameMain.Instance.OnResolutionChanged += () =>
|
||||
{
|
||||
GuiFrame.ClearChildren();
|
||||
CreateGUI();
|
||||
OnItemLoadedProjSpecific();
|
||||
};
|
||||
GameMain.Instance.OnResolutionChanged += RecreateGUI;
|
||||
}
|
||||
|
||||
private void RecreateGUI()
|
||||
{
|
||||
GuiFrame.ClearChildren();
|
||||
CreateGUI();
|
||||
OnItemLoadedProjSpecific();
|
||||
}
|
||||
|
||||
private void CreateGUI()
|
||||
@@ -600,5 +602,10 @@ namespace Barotrauma.Items.Components
|
||||
StartFabricating(fabricationRecipes[itemIndex], user);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RemoveComponentSpecific()
|
||||
{
|
||||
GameMain.Instance.OnResolutionChanged -= RecreateGUI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,13 +638,14 @@ namespace Barotrauma.Items.Components
|
||||
signalWarningText.Text = TextManager.Get(signalStrength <= 0.0f ? "SonarNoSignal" : "SonarSignalWeak");
|
||||
signalWarningText.Color = signalStrength <= 0.0f ? negativeColor : warningColor;
|
||||
signalWarningText.Visible = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
signalWarningText.Visible = false;
|
||||
}
|
||||
|
||||
if (GameMain.GameSession == null) return;
|
||||
if (GameMain.GameSession == null) { return; }
|
||||
|
||||
DrawMarker(spriteBatch,
|
||||
GameMain.GameSession.StartLocation.Name,
|
||||
@@ -1376,6 +1377,8 @@ namespace Barotrauma.Items.Components
|
||||
sprite.Remove();
|
||||
}
|
||||
targetIcons.Clear();
|
||||
|
||||
GameMain.Instance.OnResolutionChanged -= RecreateGUI;
|
||||
}
|
||||
|
||||
public void ClientWrite(IWriteMessage msg, object[] extraData = null)
|
||||
|
||||
@@ -804,6 +804,8 @@ namespace Barotrauma.Items.Components
|
||||
maintainPosIndicator?.Remove();
|
||||
maintainPosOriginIndicator?.Remove();
|
||||
steeringIndicator?.Remove();
|
||||
|
||||
GameMain.Instance.OnResolutionChanged -= RecreateGUI;
|
||||
}
|
||||
|
||||
public void ClientWrite(IWriteMessage msg, object[] extraData = null)
|
||||
|
||||
@@ -79,11 +79,11 @@ namespace Barotrauma.Items.Components
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
|
||||
progressBar = new GUIProgressBar(new RectTransform(new Vector2(0.7f, 1.0f), progressBarHolder.RectTransform),
|
||||
progressBar = new GUIProgressBar(new RectTransform(new Vector2(0.6f, 1.0f), progressBarHolder.RectTransform),
|
||||
color: GUI.Style.Green, barSize: 0.0f, style: "DeviceProgressBar");
|
||||
repairButtonText = TextManager.Get("RepairButton");
|
||||
repairingText = TextManager.Get("Repairing");
|
||||
RepairButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), progressBarHolder.RectTransform, Anchor.TopCenter), repairButtonText)
|
||||
RepairButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), progressBarHolder.RectTransform, Anchor.TopCenter), repairButtonText)
|
||||
{
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
@@ -92,6 +92,7 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
}
|
||||
};
|
||||
RepairButton.TextBlock.AutoScaleHorizontal = true;
|
||||
progressBarHolder.RectTransform.MinSize = RepairButton.RectTransform.MinSize;
|
||||
RepairButton.RectTransform.MinSize = new Point((int)(RepairButton.TextBlock.TextSize.X * 1.2f), RepairButton.RectTransform.MinSize.Y);
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Barotrauma.Items.Components
|
||||
x = (int)(x + width / 2 - step * (panel.DisconnectedWires.Count() - 1) / 2);
|
||||
foreach (Wire wire in panel.DisconnectedWires)
|
||||
{
|
||||
if (wire == DraggingConnected && !mouseInRect) { continue; }
|
||||
if (wire == DraggingConnected) { continue; }
|
||||
|
||||
Connection recipient = wire.OtherConnection(null);
|
||||
string label = recipient == null ? "" : recipient.item.Name + $" ({recipient.DisplayName})";
|
||||
|
||||
@@ -222,5 +222,10 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RemoveComponentSpecific()
|
||||
{
|
||||
GameMain.Instance.OnResolutionChanged -= RecreateGUI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1151,7 +1151,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item != null && Character.Controlled.HasEquippedItem(item))
|
||||
if (item != null && Character.Controlled != null && Character.Controlled.HasEquippedItem(item))
|
||||
{
|
||||
slotColor = slot.IsHighlighted ? GUIColorSettings.InventorySlotEquippedColor : GUIColorSettings.InventorySlotEquippedColor * 0.8f;
|
||||
}
|
||||
|
||||
@@ -207,6 +207,7 @@ namespace Barotrauma.Networking
|
||||
return true;
|
||||
}
|
||||
};
|
||||
ShowLogButton.TextBlock.AutoScaleHorizontal = true;
|
||||
|
||||
GameMain.DebugDraw = false;
|
||||
Hull.EditFire = false;
|
||||
|
||||
@@ -757,22 +757,24 @@ namespace Barotrauma.Networking
|
||||
};
|
||||
tickBoxContainer.Padding *= 2.0f;
|
||||
|
||||
var allowFriendlyFire = new GUITickBox(new RectTransform(new Vector2(0.4f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
var allowFriendlyFire = new GUITickBox(new RectTransform(new Vector2(0.48f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
TextManager.Get("ServerSettingsAllowFriendlyFire"));
|
||||
GetPropertyData("AllowFriendlyFire").AssignGUIComponent(allowFriendlyFire);
|
||||
|
||||
var allowRewiring = new GUITickBox(new RectTransform(new Vector2(0.4f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
var allowRewiring = new GUITickBox(new RectTransform(new Vector2(0.48f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
TextManager.Get("ServerSettingsAllowRewiring"));
|
||||
GetPropertyData("AllowRewiring").AssignGUIComponent(allowRewiring);
|
||||
|
||||
var allowDisguises = new GUITickBox(new RectTransform(new Vector2(0.4f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
var allowDisguises = new GUITickBox(new RectTransform(new Vector2(0.48f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
TextManager.Get("ServerSettingsAllowDisguises"));
|
||||
GetPropertyData("AllowDisguises").AssignGUIComponent(allowDisguises);
|
||||
|
||||
var voteKickBox = new GUITickBox(new RectTransform(new Vector2(0.4f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
var voteKickBox = new GUITickBox(new RectTransform(new Vector2(0.48f, 0.05f), tickBoxContainer.Content.RectTransform),
|
||||
TextManager.Get("ServerSettingsAllowVoteKick"));
|
||||
GetPropertyData("AllowVoteKick").AssignGUIComponent(voteKickBox);
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(tickBoxContainer.Content.Children.Select(c => ((GUITickBox)c).TextBlock));
|
||||
|
||||
tickBoxContainer.RectTransform.MinSize = new Point(0, (int)(tickBoxContainer.Content.Children.First().Rect.Height * 2.0f + tickBoxContainer.Padding.Y + tickBoxContainer.Padding.W));
|
||||
|
||||
CreateLabeledSlider(antigriefingTab, "ServerSettingsKickVotesRequired", out slider, out sliderLabel);
|
||||
@@ -913,9 +915,12 @@ namespace Barotrauma.Networking
|
||||
ToolTip = TextManager.Get(labelTag)
|
||||
};
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), container.RectTransform),
|
||||
TextManager.Get(labelTag), textAlignment: Alignment.CenterLeft, font: GUI.SmallFont);
|
||||
var input = new GUINumberInput(new RectTransform(new Vector2(0.5f, 1.0f), container.RectTransform), GUINumberInput.NumberType.Int)
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 1.0f), container.RectTransform),
|
||||
TextManager.Get(labelTag), textAlignment: Alignment.CenterLeft, font: GUI.SmallFont)
|
||||
{
|
||||
AutoScaleHorizontal = true
|
||||
};
|
||||
var input = new GUINumberInput(new RectTransform(new Vector2(0.3f, 1.0f), container.RectTransform), GUINumberInput.NumberType.Int)
|
||||
{
|
||||
MinValueInt = min,
|
||||
MaxValueInt = max
|
||||
|
||||
@@ -12,22 +12,24 @@ namespace Barotrauma
|
||||
{
|
||||
public enum Tab { Map, Crew, Store, Repair }
|
||||
private Tab selectedTab;
|
||||
private readonly GUIFrame[] tabs;
|
||||
private readonly GUIFrame topPanel;
|
||||
private GUIFrame[] tabs;
|
||||
private GUIFrame topPanel;
|
||||
|
||||
private readonly GUIListBox characterList;
|
||||
private GUIListBox characterList;
|
||||
|
||||
private Point prevResolution;
|
||||
|
||||
private MapEntityCategory selectedItemCategory = MapEntityCategory.Equipment;
|
||||
|
||||
private readonly GUIListBox myItemList;
|
||||
private readonly GUIListBox storeItemList;
|
||||
private readonly GUITextBox searchBox;
|
||||
private GUIListBox myItemList;
|
||||
private GUIListBox storeItemList;
|
||||
private GUITextBox searchBox;
|
||||
|
||||
private readonly GUIComponent missionPanel;
|
||||
private readonly GUIComponent selectedLocationInfo;
|
||||
private readonly GUIListBox selectedMissionInfo;
|
||||
private GUIComponent missionPanel;
|
||||
private GUIComponent selectedLocationInfo;
|
||||
private GUIListBox selectedMissionInfo;
|
||||
|
||||
private readonly GUIButton repairHullsButton, replaceShuttlesButton, repairItemsButton;
|
||||
private GUIButton repairHullsButton, replaceShuttlesButton, repairItemsButton;
|
||||
|
||||
private GUIFrame characterPreviewFrame;
|
||||
|
||||
@@ -51,10 +53,31 @@ namespace Barotrauma
|
||||
|
||||
public CampaignMode Campaign { get; }
|
||||
|
||||
public CampaignUI(CampaignMode campaign, GUIComponent container)
|
||||
public CampaignUI(CampaignMode campaign, GUIComponent parent)
|
||||
{
|
||||
this.Campaign = campaign;
|
||||
|
||||
var container = new GUIFrame(new RectTransform(Vector2.One, parent.RectTransform), style: null);
|
||||
|
||||
CreateUI(container);
|
||||
|
||||
campaign.Map.OnLocationSelected += SelectLocation;
|
||||
campaign.Map.OnLocationChanged += (prevLocation, newLocation) => UpdateLocationView(newLocation);
|
||||
campaign.Map.OnMissionSelected += (connection, mission) =>
|
||||
{
|
||||
var selectedTickBox = (missionRadioButtonGroup.UserData as List<Mission>).FindIndex(m => m == mission);
|
||||
if (selectedTickBox >= 0)
|
||||
{
|
||||
missionRadioButtonGroup.Selected = selectedTickBox;
|
||||
}
|
||||
};
|
||||
campaign.CargoManager.OnItemsChanged += RefreshMyItems;
|
||||
}
|
||||
|
||||
private void CreateUI(GUIComponent container)
|
||||
{
|
||||
container.ClearChildren();
|
||||
|
||||
MapContainer = new GUICustomComponent(new RectTransform(Vector2.One, container.RectTransform), DrawMap, UpdateMap);
|
||||
new GUIFrame(new RectTransform(Vector2.One, MapContainer.RectTransform), style: "InnerGlow", color: Color.Black * 0.9f)
|
||||
{
|
||||
@@ -72,10 +95,10 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
var outpostBtn = new GUIButton(new RectTransform(new Vector2(0.15f, 0.55f), topPanelContent.RectTransform),
|
||||
var outpostBtn = new GUIButton(new RectTransform(new Vector2(0.15f, 0.55f), topPanelContent.RectTransform),
|
||||
TextManager.Get("Outpost"), textAlignment: Alignment.Center, style: "GUISlopedHeader")
|
||||
{
|
||||
OnClicked = (btn, userdata) => { SelectTab(Tab.Map); return true; }
|
||||
OnClicked = (btn, userdata) => { SelectTab(Tab.Map); return true; }
|
||||
};
|
||||
outpostBtn.TextBlock.Font = GUI.LargeFont;
|
||||
outpostBtn.TextBlock.AutoScaleHorizontal = true;
|
||||
@@ -105,7 +128,7 @@ namespace Barotrauma
|
||||
TextManager.Get(tab.ToString()), textColor: tabButton.TextColor, font: GUI.LargeFont, textAlignment: Alignment.Center, style: null)
|
||||
{
|
||||
UserData = "buttontext",
|
||||
Padding = new Vector4(GUI.Scale * 1)
|
||||
Padding = new Vector4(GUI.Scale * 1)
|
||||
};
|
||||
}
|
||||
else
|
||||
@@ -145,7 +168,7 @@ namespace Barotrauma
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), crewContent.RectTransform), "", font: GUI.LargeFont)
|
||||
{
|
||||
TextGetter = GetMoney
|
||||
@@ -163,7 +186,7 @@ namespace Barotrauma
|
||||
CanBeFocused = false,
|
||||
AutoScaleHorizontal = true
|
||||
};
|
||||
if (campaign is SinglePlayerCampaign)
|
||||
if (Campaign is SinglePlayerCampaign)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), characterList.Content.RectTransform),
|
||||
TextManager.Get("CampaignMenuHireable"), font: GUI.LargeFont)
|
||||
@@ -173,9 +196,9 @@ namespace Barotrauma
|
||||
AutoScaleHorizontal = true
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// store tab -------------------------------------------------------------------------
|
||||
|
||||
|
||||
tabs[(int)Tab.Store] = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.7f), container.RectTransform, Anchor.TopLeft)
|
||||
{
|
||||
RelativeOffset = new Vector2(0.1f, topPanel.RectTransform.RelativeSize.Y)
|
||||
@@ -185,7 +208,7 @@ namespace Barotrauma
|
||||
UserData = "outerglow",
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
|
||||
var storeContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), tabs[(int)Tab.Store].RectTransform, Anchor.Center))
|
||||
{
|
||||
UserData = "content",
|
||||
@@ -217,9 +240,13 @@ namespace Barotrauma
|
||||
RelativeSpacing = 0.03f,
|
||||
Stretch = true
|
||||
};
|
||||
myItemList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), storeItemLists.RectTransform));
|
||||
myItemList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), storeItemLists.RectTransform))
|
||||
{
|
||||
AutoHideScrollBar = false
|
||||
};
|
||||
storeItemList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), storeItemLists.RectTransform))
|
||||
{
|
||||
AutoHideScrollBar = false,
|
||||
OnSelected = BuyItem
|
||||
};
|
||||
|
||||
@@ -238,7 +265,7 @@ namespace Barotrauma
|
||||
"", style: "ItemCategory" + category.ToString())
|
||||
{
|
||||
UserData = category,
|
||||
OnClicked = (btn, userdata) =>
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
MapEntityCategory newCategory = (MapEntityCategory)userdata;
|
||||
if (newCategory != selectedItemCategory)
|
||||
@@ -314,25 +341,25 @@ namespace Barotrauma
|
||||
ForceUpperCase = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), CampaignMode.HullRepairCost.ToString(), textAlignment: Alignment.Right, font: GUI.SubHeadingFont);
|
||||
repairHullsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("Repair"))
|
||||
repairHullsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairHullsHolder.RectTransform) { MinSize = new Point(140, 0) }, TextManager.Get("Repair"))
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (campaign.PurchasedHullRepairs)
|
||||
if (Campaign.PurchasedHullRepairs)
|
||||
{
|
||||
campaign.Money += CampaignMode.HullRepairCost;
|
||||
campaign.PurchasedHullRepairs = false;
|
||||
Campaign.Money += CampaignMode.HullRepairCost;
|
||||
Campaign.PurchasedHullRepairs = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (campaign.Money >= CampaignMode.HullRepairCost)
|
||||
if (Campaign.Money >= CampaignMode.HullRepairCost)
|
||||
{
|
||||
campaign.Money -= CampaignMode.HullRepairCost;
|
||||
campaign.PurchasedHullRepairs = true;
|
||||
Campaign.Money -= CampaignMode.HullRepairCost;
|
||||
Campaign.PurchasedHullRepairs = true;
|
||||
}
|
||||
}
|
||||
GameMain.Client?.SendCampaignState();
|
||||
btn.GetChild<GUITickBox>().Selected = campaign.PurchasedHullRepairs;
|
||||
btn.GetChild<GUITickBox>().Selected = Campaign.PurchasedHullRepairs;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -359,25 +386,25 @@ namespace Barotrauma
|
||||
ForceUpperCase = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), CampaignMode.ItemRepairCost.ToString(), textAlignment: Alignment.Right, font: GUI.SubHeadingFont);
|
||||
repairItemsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("Repair"))
|
||||
repairItemsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairItemsHolder.RectTransform) { MinSize = new Point(140, 0) }, TextManager.Get("Repair"))
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (campaign.PurchasedItemRepairs)
|
||||
if (Campaign.PurchasedItemRepairs)
|
||||
{
|
||||
campaign.Money += CampaignMode.ItemRepairCost;
|
||||
campaign.PurchasedItemRepairs = false;
|
||||
Campaign.Money += CampaignMode.ItemRepairCost;
|
||||
Campaign.PurchasedItemRepairs = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (campaign.Money >= CampaignMode.ItemRepairCost)
|
||||
if (Campaign.Money >= CampaignMode.ItemRepairCost)
|
||||
{
|
||||
campaign.Money -= CampaignMode.ItemRepairCost;
|
||||
campaign.PurchasedItemRepairs = true;
|
||||
Campaign.Money -= CampaignMode.ItemRepairCost;
|
||||
Campaign.PurchasedItemRepairs = true;
|
||||
}
|
||||
}
|
||||
GameMain.Client?.SendCampaignState();
|
||||
btn.GetChild<GUITickBox>().Selected = campaign.PurchasedItemRepairs;
|
||||
btn.GetChild<GUITickBox>().Selected = Campaign.PurchasedItemRepairs;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -399,37 +426,37 @@ namespace Barotrauma
|
||||
IgnoreLayoutGroups = true,
|
||||
CanBeFocused = false
|
||||
};
|
||||
var replaceShuttlesLabel = new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.3f), replaceShuttlesHolder.RectTransform), TextManager.Get("ReplaceLostShuttles"), textAlignment: Alignment.Right, font: GUI.LargeFont)
|
||||
var replaceShuttlesLabel = new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.3f), replaceShuttlesHolder.RectTransform), TextManager.Get("ReplaceLostShuttles"), textAlignment: Alignment.Right, font: GUI.SubHeadingFont)
|
||||
{
|
||||
ForceUpperCase = true
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), replaceShuttlesHolder.RectTransform), CampaignMode.ShuttleReplaceCost.ToString(), textAlignment: Alignment.Right, font: GUI.SubHeadingFont);
|
||||
replaceShuttlesButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), replaceShuttlesHolder.RectTransform), TextManager.Get("ReplaceShuttles"))
|
||||
replaceShuttlesButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), replaceShuttlesHolder.RectTransform) { MinSize = new Point(140, 0) }, TextManager.Get("ReplaceShuttles"))
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (GameMain.GameSession?.Submarine != null &&
|
||||
if (GameMain.GameSession?.Submarine != null &&
|
||||
GameMain.GameSession.Submarine.LeftBehindSubDockingPortOccupied)
|
||||
{
|
||||
new GUIMessageBox("", TextManager.Get("ReplaceShuttleDockingPortOccupied"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (campaign.PurchasedLostShuttles)
|
||||
if (Campaign.PurchasedLostShuttles)
|
||||
{
|
||||
campaign.Money += CampaignMode.ShuttleReplaceCost;
|
||||
campaign.PurchasedLostShuttles = false;
|
||||
Campaign.Money += CampaignMode.ShuttleReplaceCost;
|
||||
Campaign.PurchasedLostShuttles = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (campaign.Money >= CampaignMode.ShuttleReplaceCost)
|
||||
if (Campaign.Money >= CampaignMode.ShuttleReplaceCost)
|
||||
{
|
||||
campaign.Money -= CampaignMode.ShuttleReplaceCost;
|
||||
campaign.PurchasedLostShuttles = true;
|
||||
Campaign.Money -= CampaignMode.ShuttleReplaceCost;
|
||||
Campaign.PurchasedLostShuttles = true;
|
||||
}
|
||||
}
|
||||
GameMain.Client?.SendCampaignState();
|
||||
btn.GetChild<GUITickBox>().Selected = campaign.PurchasedLostShuttles;
|
||||
btn.GetChild<GUITickBox>().Selected = Campaign.PurchasedLostShuttles;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -439,6 +466,7 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
GUITextBlock.AutoScaleAndNormalize(repairHullsLabel, repairItemsLabel, replaceShuttlesLabel);
|
||||
GUITextBlock.AutoScaleAndNormalize(repairHullsButton.GetChild<GUITickBox>().TextBlock, repairItemsButton.GetChild<GUITickBox>().TextBlock, replaceShuttlesButton.GetChild<GUITickBox>().TextBlock);
|
||||
|
||||
|
||||
// mission info -------------------------------------------------------------------------
|
||||
@@ -450,7 +478,7 @@ namespace Barotrauma
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), missionPanel.RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
|
||||
{
|
||||
UserData = "outerglow",
|
||||
@@ -476,7 +504,7 @@ namespace Barotrauma
|
||||
Stretch = true
|
||||
};
|
||||
selectedMissionInfo = new GUIListBox(new RectTransform(new Vector2(0.9f, 0.25f), missionPanel.RectTransform, Anchor.BottomRight, Pivot.TopRight)
|
||||
{ MinSize = new Point(0, (int)(150 * GUI.Scale)) })
|
||||
{ MinSize = new Point(0, (int)(150 * GUI.Scale)) })
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
@@ -493,21 +521,24 @@ namespace Barotrauma
|
||||
|
||||
SelectTab(Tab.Map);
|
||||
|
||||
UpdateLocationView(campaign.Map.CurrentLocation);
|
||||
UpdateLocationView(Campaign.Map.CurrentLocation);
|
||||
|
||||
campaign.Map.OnLocationSelected += SelectLocation;
|
||||
campaign.Map.OnLocationChanged += (prevLocation, newLocation) => UpdateLocationView(newLocation);
|
||||
campaign.Map.OnMissionSelected += (connection, mission) =>
|
||||
menuPanelParent?.ClearChildren();
|
||||
missionPanelParent?.ClearChildren();
|
||||
if (menuPanelParent != null)
|
||||
{
|
||||
var selectedTickBox = (missionRadioButtonGroup.UserData as List<Mission>).FindIndex(m => m == mission);
|
||||
if (selectedTickBox >= 0)
|
||||
{
|
||||
missionRadioButtonGroup.Selected = selectedTickBox;
|
||||
}
|
||||
};
|
||||
campaign.CargoManager.OnItemsChanged += RefreshMyItems;
|
||||
SetMenuPanelParent(menuPanelParent);
|
||||
}
|
||||
if (missionPanelParent != null)
|
||||
{
|
||||
SetMissionPanelParent(missionPanelParent);
|
||||
}
|
||||
|
||||
prevResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
}
|
||||
|
||||
private RectTransform missionPanelParent, menuPanelParent;
|
||||
|
||||
public void SetMissionPanelParent(RectTransform parent)
|
||||
{
|
||||
missionPanel.RectTransform.Parent = parent;
|
||||
@@ -522,6 +553,7 @@ namespace Barotrauma
|
||||
|
||||
selectedMissionInfo.RectTransform.RelativeOffset = Vector2.Zero;
|
||||
selectedMissionInfo.RectTransform.SetPosition(Anchor.BottomLeft, Pivot.BottomRight);
|
||||
missionPanelParent = parent;
|
||||
}
|
||||
public void SetMenuPanelParent(RectTransform parent)
|
||||
{
|
||||
@@ -548,6 +580,7 @@ namespace Barotrauma
|
||||
}.SetAsFirstChild();
|
||||
}
|
||||
}
|
||||
menuPanelParent = parent;
|
||||
}
|
||||
|
||||
private void UpdateLocationView(Location location)
|
||||
@@ -637,6 +670,11 @@ namespace Barotrauma
|
||||
|
||||
private void DrawMap(SpriteBatch spriteBatch, GUICustomComponent mapContainer)
|
||||
{
|
||||
if (GameMain.GraphicsWidth != prevResolution.X || GameMain.GraphicsHeight != prevResolution.Y)
|
||||
{
|
||||
CreateUI(MapContainer.Parent);
|
||||
}
|
||||
|
||||
GameMain.GameSession?.Map?.Draw(spriteBatch, mapContainer);
|
||||
}
|
||||
|
||||
@@ -727,6 +765,7 @@ namespace Barotrauma
|
||||
{
|
||||
Enabled = GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign)
|
||||
};
|
||||
tickBox.Font = tickBox.Rect.Width < 150 ? GUI.SmallFont : GUI.Font;
|
||||
tickBox.TextBlock.Wrap = true;
|
||||
missionTickBoxes.Add(tickBox);
|
||||
missionRadioButtonGroup.AddRadioButton(i, tickBox);
|
||||
|
||||
@@ -408,10 +408,11 @@ namespace Barotrauma
|
||||
Visible = false
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), bottomBarLeft.RectTransform), TextManager.Get("disconnect"))
|
||||
var disconnectButton = new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), bottomBarLeft.RectTransform), TextManager.Get("disconnect"))
|
||||
{
|
||||
OnClicked = (bt, userdata) => { GameMain.QuitToMainMenu(save: false, showVerificationPrompt: true); return true; }
|
||||
};
|
||||
disconnectButton.TextBlock.AutoScaleHorizontal = true;
|
||||
|
||||
// file transfers ------------------------------------------------------------
|
||||
FileTransferFrame = new GUIFrame(new RectTransform(Vector2.One, bottomBarLeft.RectTransform), style: "TextFrame");
|
||||
@@ -637,11 +638,11 @@ namespace Barotrauma
|
||||
|
||||
// Spectate button
|
||||
spectateButton = new GUIButton(new RectTransform(Vector2.One, roundControlsHolder.RectTransform),
|
||||
TextManager.Get("SpectateButton"), style: "GUIButtonLarge");
|
||||
TextManager.Get("SpectateButton"));
|
||||
|
||||
// Start button
|
||||
StartButton = new GUIButton(new RectTransform(Vector2.One, roundControlsHolder.RectTransform),
|
||||
TextManager.Get("StartGameButton"), style: "GUIButtonLarge")
|
||||
TextManager.Get("StartGameButton"))
|
||||
{
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
@@ -1013,9 +1014,9 @@ namespace Barotrauma
|
||||
RelativeSpacing = 0.025f
|
||||
};
|
||||
|
||||
var traitorsSettingHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), isHorizontal: true) { Stretch = true };
|
||||
var traitorsSettingHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) { Stretch = true };
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 1.0f), traitorsSettingHolder.RectTransform), TextManager.Get("Traitors"));
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.0f), traitorsSettingHolder.RectTransform), TextManager.Get("Traitors"), wrap: true);
|
||||
|
||||
var traitorProbContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), traitorsSettingHolder.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) { RelativeSpacing = 0.05f, Stretch = true };
|
||||
traitorProbabilityButtons = new GUIButton[2];
|
||||
@@ -1045,9 +1046,9 @@ namespace Barotrauma
|
||||
|
||||
//bot count ------------------------------------------------------------------
|
||||
|
||||
var botCountSettingHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), isHorizontal: true) { Stretch = true };
|
||||
var botCountSettingHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) { Stretch = true };
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 1.0f), botCountSettingHolder.RectTransform), TextManager.Get("BotCount"));
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.0f), botCountSettingHolder.RectTransform), TextManager.Get("BotCount"), wrap: true);
|
||||
var botCountContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), botCountSettingHolder.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) { RelativeSpacing = 0.05f, Stretch = true };
|
||||
botCountButtons = new GUIButton[2];
|
||||
botCountButtons[0] = new GUIButton(new RectTransform(new Vector2(0.15f, 1.0f), botCountContainer.RectTransform), style: "GUIButtonToggleLeft")
|
||||
@@ -1071,9 +1072,9 @@ namespace Barotrauma
|
||||
|
||||
clientDisabledElements.AddRange(botCountButtons);
|
||||
|
||||
var botSpawnModeSettingHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), isHorizontal: true) { Stretch = true };
|
||||
var botSpawnModeSettingHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), settingsContent.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) { Stretch = true };
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 1.0f), botSpawnModeSettingHolder.RectTransform), TextManager.Get("BotSpawnMode"), wrap: true);
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.0f), botSpawnModeSettingHolder.RectTransform), TextManager.Get("BotSpawnMode"), wrap: true);
|
||||
var botSpawnModeContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), botSpawnModeSettingHolder.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) { RelativeSpacing = 0.05f, Stretch = true };
|
||||
botSpawnModeButtons = new GUIButton[2];
|
||||
botSpawnModeButtons[0] = new GUIButton(new RectTransform(new Vector2(0.15f, 1.0f), botSpawnModeContainer.RectTransform), style: "GUIButtonToggleLeft")
|
||||
@@ -1097,9 +1098,9 @@ namespace Barotrauma
|
||||
|
||||
List<GUIComponent> settingsElements = settingsContent.Children.ToList();
|
||||
int spacingElementCount = 0;
|
||||
for (int i = 1; i < settingsElements.Count; i++)
|
||||
for (int i = 0; i < settingsElements.Count; i++)
|
||||
{
|
||||
settingsElements[i].RectTransform.MinSize = new Point(0, (int)(20 * GUI.Scale));
|
||||
settingsElements[i].RectTransform.MinSize = new Point(0, Math.Max(settingsElements[i].RectTransform.Children.Max(c => c.Rect.Height), (int)(20 * GUI.Scale)));
|
||||
if (settingsElements[i] is GUITextBlock)
|
||||
{
|
||||
var spacing = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), settingsContent.RectTransform), style: null);
|
||||
@@ -1495,14 +1496,13 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
string name =
|
||||
TextManager.Get("jobname." + jobPrefab.Identifier + (variant + 1), returnNull: true) ??
|
||||
jobPrefab.Name;
|
||||
TextManager.Get("jobname." + jobPrefab.Identifier + (variant + 1), returnNull: true, fallBackTag: "jobname." + jobPrefab.Identifier) ??
|
||||
"";
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), name, font: GUI.SubHeadingFont);
|
||||
|
||||
string description =
|
||||
TextManager.Get("jobdescription." + jobPrefab.Identifier + (variant + 1), returnNull: true) ??
|
||||
TextManager.Get("jobdescription." + jobPrefab.Identifier, returnNull: true) ??
|
||||
TextManager.Get("jobdescription." + jobPrefab.Identifier + (variant + 1), returnNull: true, fallBackTag: "jobdescription." + jobPrefab.Identifier) ??
|
||||
"";
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), description, wrap: true, font: GUI.SmallFont);
|
||||
@@ -2326,7 +2326,7 @@ namespace Barotrauma
|
||||
|
||||
Rectangle slotRect = new Rectangle(slotPos.ToPoint(), slotSize);
|
||||
Inventory.SlotSpriteSmall.Draw(spriteBatch, slotPos,
|
||||
scale: slotSize.X / (float)Inventory.SlotSpriteSmall.SourceRect.Width,
|
||||
scale: slotSize.X / (float)Inventory.SlotSpriteSmall.SourceRect.Width,
|
||||
color: slotRect.Contains(PlayerInput.MousePosition) ? Color.White : Color.White * 0.6f);
|
||||
|
||||
Sprite icon = itemPrefab.InventoryIcon ?? itemPrefab.sprite;
|
||||
@@ -2342,7 +2342,7 @@ namespace Barotrauma
|
||||
|
||||
if (slotRect.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
GUIComponent.DrawToolTip(spriteBatch, itemPrefab.Name+'\n'+itemPrefab.Description, slotRect);
|
||||
GUIComponent.DrawToolTip(spriteBatch, itemPrefab.Name + '\n' + itemPrefab.Description, slotRect);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -2784,9 +2784,10 @@ namespace Barotrauma
|
||||
var textBlock = new GUITextBlock(
|
||||
innerFrame.CountChildren == 0 ?
|
||||
new RectTransform(Vector2.One, parent.RectTransform, Anchor.Center) :
|
||||
new RectTransform(new Vector2(selectedByPlayer ? 0.75f : 0.95f, 0.25f), parent.RectTransform, Anchor.TopCenter),
|
||||
jobPrefab.Name, wrap: true, textAlignment: Alignment.Center)
|
||||
new RectTransform(new Vector2(selectedByPlayer ? 0.65f : 0.95f, 0.3f), parent.RectTransform, Anchor.TopCenter),
|
||||
jobPrefab.Name, wrap: true, textAlignment: Alignment.TopCenter)
|
||||
{
|
||||
Padding = Vector4.Zero,
|
||||
HoverColor = Color.Transparent,
|
||||
SelectedColor = Color.Transparent,
|
||||
TextColor = jobPrefab.UIColor,
|
||||
@@ -3109,7 +3110,6 @@ namespace Barotrauma
|
||||
(variantIndex + 1).ToString(), style: "JobVariantButton")
|
||||
{
|
||||
Selected = jobPrefab.Second == variantIndex,
|
||||
//ToolTip = TextManager.Get("jobdescription." + jobPrefab.First.Identifier + (variantIndex + 1), returnNull: true) ?? "",
|
||||
UserData = new Pair<JobPrefab, int>(jobPrefab.First, variantIndex),
|
||||
};
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ namespace Barotrauma.Sounds
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Disabled) { return 0.0f; }
|
||||
float aggregateAmplitude = 0.0f;
|
||||
//NOTE: this is obviously not entirely accurate;
|
||||
//It assumes a linear falloff model, and assumes that audio
|
||||
@@ -228,6 +229,7 @@ namespace Barotrauma.Sounds
|
||||
{
|
||||
DebugConsole.ThrowError("ALC device creation failed too many times!");
|
||||
Disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
int[] alcContextAttrs = new int[] { };
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.704.0</Version>
|
||||
<Version>0.9.705.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.704.0</Version>
|
||||
<Version>0.9.705.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma</Product>
|
||||
<Version>0.9.704.0</Version>
|
||||
<Version>0.9.705.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma Dedicated Server</Product>
|
||||
<Version>0.9.704.0</Version>
|
||||
<Version>0.9.705.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>DedicatedServer</AssemblyName>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma Dedicated Server</Product>
|
||||
<Version>0.9.704.0</Version>
|
||||
<Version>0.9.705.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>DedicatedServer</AssemblyName>
|
||||
|
||||
@@ -250,11 +250,13 @@ namespace Barotrauma
|
||||
|
||||
private static Client FindClient(string arg)
|
||||
{
|
||||
int.TryParse(arg, out int id);
|
||||
var client = GameMain.Server.ConnectedClients.Find(c => c.ID == id);
|
||||
Client client = GameMain.Server.ConnectedClients.Find(c => Homoglyphs.Compare(c.Name, arg));
|
||||
if (int.TryParse(arg, out int id))
|
||||
{
|
||||
client ??= GameMain.Server.ConnectedClients.Find(c => c.ID == id);
|
||||
}
|
||||
client ??= GameMain.Server.ConnectedClients.Find(c => c.EndpointMatches(arg));
|
||||
client ??= GameMain.Server.ConnectedClients.Find(c => c.SteamID == Steam.SteamManager.SteamIDStringToUInt64(arg));
|
||||
client ??= GameMain.Server.ConnectedClients.Find(c => Homoglyphs.Compare(c.Name, arg));
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -296,6 +298,20 @@ namespace Barotrauma
|
||||
}
|
||||
});
|
||||
|
||||
AssignOnExecute("killdisconnectedtimer", (string[] args) =>
|
||||
{
|
||||
if (args.Length < 1 || GameMain.Server == null) return;
|
||||
float seconds = GameMain.Server.ServerSettings.KillDisconnectedTime;
|
||||
if (float.TryParse(args[0], out seconds))
|
||||
{
|
||||
NewMessage("Set kill disconnected timer to " + seconds + " seconds", Color.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
NewMessage("\"" + args[0] + "\" is not a valid duration.", Color.White);
|
||||
}
|
||||
});
|
||||
|
||||
AssignOnExecute("autorestart", (string[] args) =>
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
@@ -457,6 +473,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
NewMessage("Cannot revoke permissions from the server owner!", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
NewMessage("Valid permissions are:", Color.White);
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
@@ -492,6 +513,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
NewMessage("Cannot modify the rank of the server owner!", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
NewMessage("Valid ranks are:", Color.White);
|
||||
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
|
||||
@@ -570,6 +596,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
NewMessage("Cannot revoke command permissions from the server owner!", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
ShowQuestionPrompt("Console command permissions to revoke from \"" + client.Name + "\"? You may enter multiple commands separated with a space.", (commandsStr) =>
|
||||
{
|
||||
@@ -1609,6 +1640,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Cannot revoke permissions from the server owner!", senderClient);
|
||||
return;
|
||||
}
|
||||
|
||||
string perm = string.Join("", args.Skip(1));
|
||||
|
||||
@@ -1637,6 +1673,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Cannot modify the rank of the server owner!", senderClient);
|
||||
return;
|
||||
}
|
||||
|
||||
string rank = string.Join("", args.Skip(1));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.ToLowerInvariant() == rank.ToLowerInvariant());
|
||||
@@ -1665,6 +1706,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Cannot modify the command permissions of the server owner!", senderClient);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] splitCommands = args.Skip(1).ToArray();
|
||||
List<Command> grantedCommands = new List<Command>();
|
||||
@@ -1702,6 +1748,11 @@ namespace Barotrauma
|
||||
ThrowError("Client \"" + args[0] + "\" not found.");
|
||||
return;
|
||||
}
|
||||
if (client.Connection == GameMain.Server.OwnerConnection)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Cannot revoke command permissions from the server owner!", senderClient);
|
||||
return;
|
||||
}
|
||||
|
||||
string[] splitCommands = args.Skip(1).ToArray();
|
||||
List<Command> revokedCommands = new List<Command>();
|
||||
@@ -1874,7 +1925,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
if (string.IsNullOrWhiteSpace(command)) return;
|
||||
if (!client.HasPermission(ClientPermissions.ConsoleCommands))
|
||||
if (!client.HasPermission(ClientPermissions.ConsoleCommands) && client.Connection != GameMain.Server.OwnerConnection)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("You are not permitted to use console commands!", client);
|
||||
GameServer.Log(client.Name + " attempted to execute the console command \"" + command + "\" without a permission to use console commands.", ServerLog.MessageType.ConsoleUsage);
|
||||
@@ -1883,7 +1934,7 @@ namespace Barotrauma
|
||||
|
||||
string[] splitCommand = SplitCommand(command);
|
||||
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommand[0].ToLowerInvariant()));
|
||||
if (matchingCommand != null && !client.PermittedConsoleCommands.Contains(matchingCommand))
|
||||
if (matchingCommand != null && !client.PermittedConsoleCommands.Contains(matchingCommand) && client.Connection != GameMain.Server.OwnerConnection)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("You are not permitted to use the command\"" + matchingCommand.names[0] + "\"!", client);
|
||||
GameServer.Log(client.Name + " attempted to execute the console command \"" + command + "\" without a permission to use the command.", ServerLog.MessageType.ConsoleUsage);
|
||||
|
||||
@@ -333,10 +333,10 @@ namespace Barotrauma
|
||||
//prevent spiral of death
|
||||
Timing.Accumulator = Timing.Step;
|
||||
}
|
||||
Timing.TotalTime += elapsedTime;
|
||||
prevTicks = currTicks;
|
||||
while (Timing.Accumulator >= Timing.Step)
|
||||
{
|
||||
Timing.TotalTime += Timing.Step;
|
||||
DebugConsole.Update();
|
||||
Screen.Selected?.Update((float)Timing.Step);
|
||||
Server.Update((float)Timing.Step);
|
||||
|
||||
@@ -357,18 +357,20 @@ namespace Barotrauma.Networking
|
||||
|
||||
character.KillDisconnectedTimer += deltaTime;
|
||||
character.SetStun(1.0f);
|
||||
if (character.KillDisconnectedTimer > serverSettings.KillDisconnectedTime)
|
||||
|
||||
Client owner = connectedClients.Find(c =>
|
||||
c.Name == character.OwnerClientName &&
|
||||
c.EndpointMatches(character.OwnerClientEndPoint));
|
||||
|
||||
if ((OwnerConnection == null || owner?.Connection != OwnerConnection) && character.KillDisconnectedTimer > serverSettings.KillDisconnectedTime)
|
||||
{
|
||||
character.Kill(CauseOfDeathType.Disconnected, null);
|
||||
continue;
|
||||
}
|
||||
|
||||
Client owner = connectedClients.Find(c =>
|
||||
c.InGame && !c.NeedsMidRoundSync &&
|
||||
c.Name == character.OwnerClientName &&
|
||||
c.EndpointMatches(character.OwnerClientEndPoint));
|
||||
|
||||
if (owner != null && (!serverSettings.AllowSpectating || !owner.SpectateOnly))
|
||||
if (owner != null &&
|
||||
owner.InGame && !owner.NeedsMidRoundSync &&
|
||||
(!serverSettings.AllowSpectating || !owner.SpectateOnly))
|
||||
{
|
||||
SetClientCharacter(owner, character);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
var timedOutClients = clients.FindAll(c => c.InGame && c.NeedsMidRoundSync && Timing.TotalTime > c.MidRoundSyncTimeOut);
|
||||
var timedOutClients = clients.FindAll(c => c.Connection != GameMain.Server.OwnerConnection && c.InGame && c.NeedsMidRoundSync && Timing.TotalTime > c.MidRoundSyncTimeOut);
|
||||
foreach (Client timedOutClient in timedOutClients)
|
||||
{
|
||||
GameServer.Log("Disconnecting client " + timedOutClient.Name + ". Syncing the client with the server took too long.", ServerLog.MessageType.Error);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<Authors>FakeFish, Undertow Games</Authors>
|
||||
<Product>Barotrauma Dedicated Server</Product>
|
||||
<Version>0.9.704.0</Version>
|
||||
<Version>0.9.705.0</Version>
|
||||
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AssemblyName>DedicatedServer</AssemblyName>
|
||||
|
||||
@@ -262,7 +262,10 @@ namespace Barotrauma
|
||||
|
||||
#if CLIENT
|
||||
private Sprite jobIcon;
|
||||
private Vector2 jobIconPos;
|
||||
private Vector2 jobIconPos
|
||||
{
|
||||
get { return new Vector2(HUDLayoutSettings.HealthBarAreaLeft.Right, HUDLayoutSettings.HealthBarAreaLeft.Y - HUDLayoutSettings.Padding); }
|
||||
}
|
||||
#endif
|
||||
|
||||
private Sprite portraitBackground;
|
||||
@@ -449,9 +452,6 @@ namespace Barotrauma
|
||||
Job = (jobPrefab == null) ? Job.Random(Rand.RandSync.Server) : new Job(jobPrefab, variant);
|
||||
#if CLIENT
|
||||
jobIcon = Job.Prefab.Icon;
|
||||
//TODO: fix jobIconPos
|
||||
jobIconPos = new Vector2(HUDLayoutSettings.HealthBarAreaLeft.Right, HUDLayoutSettings.HealthBarAreaLeft.Y - HUDLayoutSettings.Padding);
|
||||
GameMain.Instance.OnResolutionChanged += () => jobIconPos = new Vector2(HUDLayoutSettings.HealthBarAreaLeft.Right, HUDLayoutSettings.HealthBarAreaLeft.Y - HUDLayoutSettings.Padding);
|
||||
#endif
|
||||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
|
||||
@@ -282,6 +282,8 @@ namespace Barotrauma
|
||||
|
||||
commands.Add(new Command("botspawnmode", "botspawnmode [fill/normal]: Set how bots are spawned in the multiplayer.", null));
|
||||
|
||||
commands.Add(new Command("killdisconnectedtimer", "killdisconnectedtimer [seconds]: Set the time after which disconnect players' characters get automatically killed.", null));
|
||||
|
||||
commands.Add(new Command("autorestart", "autorestart [true/false]: Enable or disable round auto-restart.", null));
|
||||
|
||||
commands.Add(new Command("autorestartinterval", "autorestartinterval [seconds]: Set how long the server waits between rounds before automatically starting a new one. If set to 0, autorestart is disabled.", null));
|
||||
|
||||
@@ -67,6 +67,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (isClient) { return; }
|
||||
|
||||
pendingEventSets.Clear();
|
||||
selectedEvents.Clear();
|
||||
|
||||
var suitableSettings = EventManagerSettings.List.FindAll(s =>
|
||||
level.Difficulty >= s.MinLevelDifficulty &&
|
||||
level.Difficulty <= s.MaxLevelDifficulty);
|
||||
@@ -322,6 +325,12 @@ namespace Barotrauma
|
||||
|
||||
pendingEventSets.RemoveAt(i);
|
||||
|
||||
if (!selectedEvents.ContainsKey(eventSet))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in EventManager.Update: pending event set \"" + eventSet.DebugIdentifier + "\" not present in selected event sets.");
|
||||
continue;
|
||||
}
|
||||
|
||||
//start events in this set
|
||||
foreach (ScriptedEvent scriptedEvent in selectedEvents[eventSet])
|
||||
{
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (!free) continue;
|
||||
if (!free) { continue; }
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
@@ -212,7 +212,8 @@ namespace Barotrauma
|
||||
item.Equip(character);
|
||||
placedInSlot = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (placedInSlot > -1) { break; }
|
||||
}
|
||||
|
||||
return placedInSlot > -1;
|
||||
|
||||
@@ -752,7 +752,7 @@ namespace Barotrauma.Networking
|
||||
private set;
|
||||
}
|
||||
|
||||
[Serialize(30.0f, true)]
|
||||
[Serialize(120.0f, true)]
|
||||
public float KillDisconnectedTime
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Barotrauma
|
||||
HashSet<string> newLanguages = new HashSet<string>();
|
||||
Dictionary<string, List<TextPack>> newTextPacks = new Dictionary<string, List<TextPack>>();
|
||||
|
||||
var textFiles = ContentPackage.GetFilesOfType(selectedContentPackages, ContentType.Text);
|
||||
var textFiles = ContentPackage.GetFilesOfType(selectedContentPackages, ContentType.Text).ToList();
|
||||
|
||||
foreach (ContentFile file in textFiles)
|
||||
{
|
||||
@@ -131,13 +131,7 @@ namespace Barotrauma
|
||||
{
|
||||
textPacks = newTextPacks;
|
||||
availableLanguages = newLanguages;
|
||||
|
||||
string loadedLangsMsg = "Loaded languages: ";
|
||||
foreach (string language in newLanguages)
|
||||
{
|
||||
loadedLangsMsg += language + ", ";
|
||||
}
|
||||
DebugConsole.NewMessage(loadedLangsMsg.Substring(0,loadedLangsMsg.Length-2));
|
||||
DebugConsole.NewMessage("Loaded languages: " + string.Join(", ", newLanguages));
|
||||
}
|
||||
|
||||
Initialized = true;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public readonly string TranslatedName;
|
||||
|
||||
private Dictionary<string, List<string>> texts;
|
||||
private readonly Dictionary<string, List<string>> texts;
|
||||
|
||||
public readonly string FilePath;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Barotrauma
|
||||
|
||||
public static double Accumulator;
|
||||
public const int FixedUpdateRate = 60;
|
||||
public static double Step = 1.0 / FixedUpdateRate;
|
||||
public const double Step = 1.0 / FixedUpdateRate;
|
||||
|
||||
private static int frameLimit;
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.9.705.0 (Unstable)
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Fixed server owner occasionally timing out if loading the round takes too long.
|
||||
- Fixed server owner's character occasionally being killed due to round start timeouts.
|
||||
- Reduced the severity of the burns caused by deusizine.
|
||||
- Fixed report buttons doing nothing.
|
||||
- Fixed report buttons being visible when not controlling a character.
|
||||
- Fixed sonar markers being visible when not receiving a signal from a remotely controlled shuttle.
|
||||
- Fixed wire being drawn twice in the connection panel interface if it's first connected from both ends and then dragged away from the connection.
|
||||
- Fixed client-side giveperm/giverank.
|
||||
- Added "killdisconnectedtime" command that can be used to set the time after a disconnected player's character gets automatically killed.
|
||||
- Increased default killdisconnectedtime to 2 minutes.
|
||||
- Fixed items that can be put in either hand slot, but not in the "Any" slots (e.g. duffel bag), being put into both hand slots.
|
||||
- Fixed crashing when attempting to draw an inventory when not controlling a character (happened in the sub editor when selecting an item container in the character mode and switching to default mode).
|
||||
- Fixed crashing if there's no audio device available.
|
||||
- Fixed wire being drawn twice in the connection panel interface if it's first connected from both ends and then dragged away from the connection.
|
||||
- Fixed inventory toggle button working unreliably.
|
||||
- Fixed alarm buzzer not returning to the original rotation when the alarm stops.
|
||||
- Fixed grenades sometimes not exploding client-side in multiplayer.
|
||||
- Fixed characters letting go of ladders when opening the health interface.
|
||||
- An attempt to fix occasional crashing when autoupdating workshop items.
|
||||
- Improved crewlist scaling on small resolutions.
|
||||
- Fixes to text overflows on small resolutions.
|
||||
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.9.704.0 (Unstable)
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
modeselectionmode="Manual"
|
||||
endvoterequiredratio="0.6"
|
||||
kickvoterequiredratio="0.6"
|
||||
killdisconnectedtime="30"
|
||||
killdisconnectedtime="120"
|
||||
kickafktime="120"
|
||||
traitoruseratio="True"
|
||||
traitorratio="0.2"
|
||||
|
||||
Reference in New Issue
Block a user