Unstable 0.17.6.0
This commit is contained in:
@@ -25,12 +25,14 @@ namespace Barotrauma
|
||||
get { return _toggleOpen; }
|
||||
set
|
||||
{
|
||||
_toggleOpen = value;
|
||||
if (value) hideableElements.Visible = true;
|
||||
_toggleOpen = PreferChatBoxOpen = value;
|
||||
if (value) { hideableElements.Visible = true; }
|
||||
}
|
||||
}
|
||||
private float openState;
|
||||
|
||||
public static bool PreferChatBoxOpen = true;
|
||||
|
||||
public bool CloseAfterMessageSent;
|
||||
|
||||
private float prevUIScale;
|
||||
@@ -99,6 +101,7 @@ namespace Barotrauma
|
||||
var channelSettingsContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), channelSettingsFrame.RectTransform, Anchor.Center), isHorizontal: true, childAnchor: Anchor.CenterLeft)
|
||||
{
|
||||
Stretch = true,
|
||||
CanBeFocused = true,
|
||||
RelativeSpacing = 0.01f
|
||||
};
|
||||
|
||||
@@ -119,7 +122,7 @@ namespace Barotrauma
|
||||
Color = new Color(51, 59, 46),
|
||||
SpriteEffects = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally
|
||||
};
|
||||
arrowIcon.HoverColor = arrowIcon.PressedColor = arrowIcon.PressedColor = arrowIcon.Color;
|
||||
arrowIcon.HoverColor = arrowIcon.PressedColor = arrowIcon.SelectedColor = arrowIcon.Color;
|
||||
|
||||
channelText = new GUITextBox(new RectTransform(new Vector2(0.25f, 0.8f), channelSettingsContent.RectTransform), style: "DigitalFrameLight", textAlignment: Alignment.Center, font: GUIStyle.DigitalFont)
|
||||
{
|
||||
@@ -265,7 +268,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
showNewMessagesButton.Visible = false;
|
||||
ToggleOpen = GameSettings.CurrentConfig.ChatOpen;
|
||||
ToggleOpen = PreferChatBoxOpen = GameSettings.CurrentConfig.ChatOpen;
|
||||
}
|
||||
|
||||
public bool TypingChatMessage(GUITextBox textBox, string text)
|
||||
|
||||
@@ -415,9 +415,9 @@ namespace Barotrauma
|
||||
if (dir.EndsWith("/")) { dir = dir.Substring(0, dir.Length - 1); }
|
||||
int index = dir.LastIndexOf("/");
|
||||
if (index < 0) { return false; }
|
||||
CurrentDirectory = CurrentDirectory.Substring(0, index+1);
|
||||
CurrentDirectory = CurrentDirectory.Substring(0, index + 1);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void AddToGUIUpdateList()
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace Barotrauma
|
||||
foreach (string childKey in GameMain.PerformanceCounter.GetSavedPartialIdentifiers(key))
|
||||
{
|
||||
elapsedMillisecs = GameMain.PerformanceCounter.GetPartialAverageElapsedMillisecs(key, childKey);
|
||||
DrawString(spriteBatch, new Vector2(315, y),
|
||||
DrawString(spriteBatch, new Vector2(x + 15, y),
|
||||
childKey + ": " + elapsedMillisecs.ToString("0.00"),
|
||||
Color.Lerp(Color.LightGreen, GUIStyle.Red, elapsedMillisecs / 10.0f), Color.Black * 0.5f, 0, GUIStyle.SmallFont);
|
||||
y += 15;
|
||||
@@ -1422,8 +1422,9 @@ namespace Barotrauma
|
||||
|
||||
public static void DrawString(SpriteBatch sb, Vector2 pos, string text, Color color, Color? backgroundColor = null, int backgroundPadding = 0, GUIFont font = null, ForceUpperCase forceUpperCase = ForceUpperCase.Inherit)
|
||||
{
|
||||
if (font == null) font = GUIStyle.Font;
|
||||
if (backgroundColor != null)
|
||||
if (color.A == 0) { return; }
|
||||
if (font == null) { font = GUIStyle.Font; }
|
||||
if (backgroundColor != null && backgroundColor.Value.A > 0)
|
||||
{
|
||||
Vector2 textSize = font.MeasureString(text);
|
||||
DrawRectangle(sb, pos - Vector2.One * backgroundPadding, textSize + Vector2.One * 2.0f * backgroundPadding, (Color)backgroundColor, true);
|
||||
|
||||
@@ -95,14 +95,21 @@ namespace Barotrauma
|
||||
// Construct the GUI elements
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
GUILayoutGroup background = new GUILayoutGroup(new RectTransform(Vector2.One, RectTransform, Anchor.Center));
|
||||
GUILayoutGroup background = new GUILayoutGroup(new RectTransform(Vector2.One, RectTransform, Anchor.Center))
|
||||
{
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
Point listSize = estimatedSize;
|
||||
if (hasHeader)
|
||||
{
|
||||
HeaderLabel = new GUITextBlock(new RectTransform(new Vector2(1f, 0.2f), background.RectTransform), header, font: headerFont) { Padding = headerPadding };
|
||||
Point sz = Point.Zero;
|
||||
InflateSize(ref sz, header, headerFont);
|
||||
listSize.Y -= sz.Y;
|
||||
HeaderLabel = new GUITextBlock(new RectTransform(sz, background.RectTransform), header, font: headerFont) { Padding = headerPadding };
|
||||
}
|
||||
|
||||
GUIListBox optionList = new GUIListBox(new RectTransform(new Vector2(1f, hasHeader ? 0.8f : 1f), background.RectTransform), style: null)
|
||||
GUIListBox optionList = new GUIListBox(new RectTransform(listSize, background.RectTransform), style: null)
|
||||
{
|
||||
AutoHideScrollBar = false,
|
||||
ScrollBarVisible = false,
|
||||
|
||||
@@ -316,6 +316,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (Text == text) { return false; }
|
||||
textBlock.Text = text;
|
||||
ClearSelection();
|
||||
if (Text == null) textBlock.Text = "";
|
||||
if (Text != "" && !Wrap)
|
||||
{
|
||||
@@ -808,10 +809,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (selectedText.Length == 0) { return; }
|
||||
|
||||
selectionStartIndex = Math.Max(0, Math.Min(selectionEndIndex, Math.Min(selectionStartIndex, Text.Length - 1)));
|
||||
int selectionLength = Math.Min(Text.Length - selectionStartIndex, selectedText.Length);
|
||||
SetText(Text.Remove(selectionStartIndex, selectionLength));
|
||||
CaretIndex = Math.Min(Text.Length, selectionStartIndex);
|
||||
int targetCaretIndex = Math.Max(0, Math.Min(selectionEndIndex, Math.Min(selectionStartIndex, Text.Length - 1)));
|
||||
int selectionLength = Math.Min(Text.Length - targetCaretIndex, selectedText.Length);
|
||||
SetText(Text.Remove(targetCaretIndex, selectionLength));
|
||||
CaretIndex = targetCaretIndex;
|
||||
|
||||
ClearSelection();
|
||||
OnTextChanged?.Invoke(this, Text);
|
||||
|
||||
@@ -570,7 +570,7 @@ namespace Barotrauma
|
||||
AutoHideScrollBar = false,
|
||||
Visible = false
|
||||
};
|
||||
storeDailySpecialsGroup = CreateDealsGroup(storeBuyList);
|
||||
storeDailySpecialsGroup = CreateDealsGroup(storeBuyList, CurrentLocation?.DailySpecialsCount ?? 1);
|
||||
tabLists.Add(StoreTab.Buy, storeBuyList);
|
||||
|
||||
storeSellList = new GUIListBox(new RectTransform(Vector2.One, storeItemListContainer.RectTransform))
|
||||
@@ -578,7 +578,7 @@ namespace Barotrauma
|
||||
AutoHideScrollBar = false,
|
||||
Visible = false
|
||||
};
|
||||
storeRequestedGoodGroup = CreateDealsGroup(storeSellList);
|
||||
storeRequestedGoodGroup = CreateDealsGroup(storeSellList, CurrentLocation?.RequestedGoodsCount ?? 1);
|
||||
tabLists.Add(StoreTab.Sell, storeSellList);
|
||||
|
||||
storeSellFromSubList = new GUIListBox(new RectTransform(Vector2.One, storeItemListContainer.RectTransform))
|
||||
@@ -586,7 +586,7 @@ namespace Barotrauma
|
||||
AutoHideScrollBar = false,
|
||||
Visible = false
|
||||
};
|
||||
storeRequestedSubGoodGroup = CreateDealsGroup(storeSellFromSubList);
|
||||
storeRequestedSubGoodGroup = CreateDealsGroup(storeSellFromSubList, CurrentLocation?.RequestedGoodsCount ?? 1);
|
||||
tabLists.Add(StoreTab.SellSub, storeSellFromSubList);
|
||||
|
||||
// Shopping Crate ------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -713,8 +713,10 @@ namespace Barotrauma
|
||||
|
||||
private LocalizedString GetPlayerBalanceText() => TextManager.FormatCurrency(PlayerWallet.Balance);
|
||||
|
||||
private GUILayoutGroup CreateDealsGroup(GUIListBox parentList, int elementCount = 4)
|
||||
private GUILayoutGroup CreateDealsGroup(GUIListBox parentList, int elementCount)
|
||||
{
|
||||
// Add 1 for the header
|
||||
elementCount++;
|
||||
var elementHeight = (int)(GUI.yScale * 80);
|
||||
var frame = new GUIFrame(new RectTransform(new Point(parentList.Content.Rect.Width, elementCount * elementHeight + 3), parent: parentList.Content.RectTransform), style: null)
|
||||
{
|
||||
@@ -852,24 +854,20 @@ namespace Barotrauma
|
||||
FilterStoreItems(category, searchBox.Text);
|
||||
}
|
||||
|
||||
int prevDailySpecialCount;
|
||||
int prevDailySpecialCount, prevRequestedGoodsCount, prevSubRequestedGoodsCount;
|
||||
|
||||
private void RefreshStoreBuyList()
|
||||
{
|
||||
float prevBuyListScroll = storeBuyList.BarScroll;
|
||||
float prevShoppingCrateScroll = shoppingCrateBuyList.BarScroll;
|
||||
|
||||
bool hasPermissions = HasBuyPermissions;
|
||||
HashSet<GUIComponent> existingItemFrames = new HashSet<GUIComponent>();
|
||||
|
||||
int dailySpecialCount = ActiveStore.DailySpecials.Count;
|
||||
|
||||
if ((storeDailySpecialsGroup != null) != ActiveStore.DailySpecials.Any() || dailySpecialCount != prevDailySpecialCount)
|
||||
{
|
||||
if (storeDailySpecialsGroup == null || dailySpecialCount != prevDailySpecialCount)
|
||||
{
|
||||
storeBuyList.RemoveChild(storeDailySpecialsGroup?.Parent);
|
||||
storeDailySpecialsGroup = CreateDealsGroup(storeBuyList, 1 + dailySpecialCount);
|
||||
storeDailySpecialsGroup = CreateDealsGroup(storeBuyList, dailySpecialCount);
|
||||
storeDailySpecialsGroup.Parent.SetAsFirstChild();
|
||||
}
|
||||
else
|
||||
@@ -881,6 +879,8 @@ namespace Barotrauma
|
||||
prevDailySpecialCount = dailySpecialCount;
|
||||
}
|
||||
|
||||
bool hasPermissions = HasTabPermissions(StoreTab.Sell);
|
||||
var existingItemFrames = new HashSet<GUIComponent>();
|
||||
foreach (PurchasedItem item in ActiveStore.Stock)
|
||||
{
|
||||
CreateOrUpdateItemFrame(item.ItemPrefab, item.Quantity);
|
||||
@@ -942,29 +942,30 @@ namespace Barotrauma
|
||||
{
|
||||
float prevSellListScroll = storeSellList.BarScroll;
|
||||
float prevShoppingCrateScroll = shoppingCrateSellList.BarScroll;
|
||||
bool hasPermissions = HasTabPermissions(StoreTab.Sell);
|
||||
HashSet<GUIComponent> existingItemFrames = new HashSet<GUIComponent>();
|
||||
|
||||
if ((storeRequestedGoodGroup != null) != ActiveStore.RequestedGoods.Any())
|
||||
int requestedGoodsCount = ActiveStore.RequestedGoods.Count;
|
||||
if ((storeRequestedGoodGroup != null) != ActiveStore.RequestedGoods.Any() || requestedGoodsCount != prevRequestedGoodsCount)
|
||||
{
|
||||
if (storeRequestedGoodGroup == null)
|
||||
storeSellList.RemoveChild(storeRequestedGoodGroup?.Parent);
|
||||
if (storeRequestedGoodGroup == null || requestedGoodsCount != prevRequestedGoodsCount)
|
||||
{
|
||||
storeRequestedGoodGroup = CreateDealsGroup(storeSellList);
|
||||
storeRequestedGoodGroup = CreateDealsGroup(storeSellList, requestedGoodsCount);
|
||||
storeRequestedGoodGroup.Parent.SetAsFirstChild();
|
||||
}
|
||||
else
|
||||
{
|
||||
storeSellList.RemoveChild(storeRequestedGoodGroup.Parent);
|
||||
storeRequestedGoodGroup = null;
|
||||
}
|
||||
storeSellList.RecalculateChildren();
|
||||
prevRequestedGoodsCount = requestedGoodsCount;
|
||||
}
|
||||
|
||||
bool hasPermissions = HasTabPermissions(StoreTab.Sell);
|
||||
var existingItemFrames = new HashSet<GUIComponent>();
|
||||
foreach (PurchasedItem item in itemsToSell)
|
||||
{
|
||||
CreateOrUpdateItemFrame(item.ItemPrefab, item.Quantity);
|
||||
}
|
||||
|
||||
foreach (var requestedGood in ActiveStore.RequestedGoods)
|
||||
{
|
||||
if (itemsToSell.Any(pi => pi.ItemPrefab == requestedGood)) { continue; }
|
||||
@@ -1009,6 +1010,7 @@ namespace Barotrauma
|
||||
removedItemFrames.AddRange(storeRequestedGoodGroup.Children.Where(c => c.UserData is PurchasedItem).Except(existingItemFrames).ToList());
|
||||
}
|
||||
removedItemFrames.ForEach(f => f.RectTransform.Parent = null);
|
||||
|
||||
if (activeTab == StoreTab.Sell) { FilterStoreItems(); }
|
||||
SortItems(StoreTab.Sell);
|
||||
|
||||
@@ -1020,29 +1022,30 @@ namespace Barotrauma
|
||||
{
|
||||
float prevSellListScroll = storeSellFromSubList.BarScroll;
|
||||
float prevShoppingCrateScroll = shoppingCrateSellFromSubList.BarScroll;
|
||||
bool hasPermissions = HasSellSubPermissions;
|
||||
HashSet<GUIComponent> existingItemFrames = new HashSet<GUIComponent>();
|
||||
|
||||
if ((storeRequestedSubGoodGroup != null) != ActiveStore.RequestedGoods.Any())
|
||||
int requestedGoodsCount = ActiveStore.RequestedGoods.Count;
|
||||
if ((storeRequestedSubGoodGroup != null) != ActiveStore.RequestedGoods.Any() || requestedGoodsCount != prevSubRequestedGoodsCount)
|
||||
{
|
||||
if (storeRequestedSubGoodGroup == null)
|
||||
storeSellFromSubList.RemoveChild(storeRequestedSubGoodGroup?.Parent);
|
||||
if (storeRequestedSubGoodGroup == null || requestedGoodsCount != prevSubRequestedGoodsCount)
|
||||
{
|
||||
storeRequestedSubGoodGroup = CreateDealsGroup(storeSellList);
|
||||
storeRequestedSubGoodGroup = CreateDealsGroup(storeSellFromSubList, requestedGoodsCount);
|
||||
storeRequestedSubGoodGroup.Parent.SetAsFirstChild();
|
||||
}
|
||||
else
|
||||
{
|
||||
storeSellFromSubList.RemoveChild(storeRequestedSubGoodGroup.Parent);
|
||||
storeRequestedSubGoodGroup = null;
|
||||
}
|
||||
storeSellFromSubList.RecalculateChildren();
|
||||
prevSubRequestedGoodsCount = requestedGoodsCount;
|
||||
}
|
||||
|
||||
bool hasPermissions = HasSellSubPermissions;
|
||||
var existingItemFrames = new HashSet<GUIComponent>();
|
||||
foreach (PurchasedItem item in itemsToSellFromSub)
|
||||
{
|
||||
CreateOrUpdateItemFrame(item.ItemPrefab, item.Quantity);
|
||||
}
|
||||
|
||||
foreach (var requestedGood in ActiveStore.RequestedGoods)
|
||||
{
|
||||
if (itemsToSellFromSub.Any(pi => pi.ItemPrefab == requestedGood)) { continue; }
|
||||
@@ -1087,6 +1090,7 @@ namespace Barotrauma
|
||||
removedItemFrames.AddRange(storeRequestedSubGoodGroup.Children.Where(c => c.UserData is PurchasedItem).Except(existingItemFrames).ToList());
|
||||
}
|
||||
removedItemFrames.ForEach(f => f.RectTransform.Parent = null);
|
||||
|
||||
if (activeTab == StoreTab.SellSub) { FilterStoreItems(); }
|
||||
SortItems(StoreTab.SellSub);
|
||||
|
||||
@@ -2164,6 +2168,10 @@ namespace Barotrauma
|
||||
{
|
||||
RefreshItemsToSellFromSub();
|
||||
}
|
||||
if (needsRefresh)
|
||||
{
|
||||
Refresh(updateOwned: ownedItemsUpdateTimer > 0.0f);
|
||||
}
|
||||
if (needsBuyingRefresh || HavePermissionsChanged(StoreTab.Buy))
|
||||
{
|
||||
RefreshBuying(updateOwned: ownedItemsUpdateTimer > 0.0f);
|
||||
|
||||
@@ -84,19 +84,16 @@ namespace Barotrauma
|
||||
private void Initialize()
|
||||
{
|
||||
initialized = true;
|
||||
currentSubText = TextManager.Get("currentsub");
|
||||
deliveryFeeText = TextManager.Get("deliveryfee");
|
||||
deliveryText = TextManager.Get("requestdeliverybutton");
|
||||
switchText = TextManager.Get("switchtosubmarinebutton");
|
||||
purchaseAndSwitchText = TextManager.Get("purchaseandswitch");
|
||||
purchaseOnlyText = TextManager.Get("purchase");
|
||||
priceText = TextManager.Get("price");
|
||||
if (transferService)
|
||||
{
|
||||
deliveryFee = CalculateDeliveryFee();
|
||||
currentSubText = TextManager.Get("currentsub");
|
||||
deliveryFeeText = TextManager.Get("deliveryfee");
|
||||
deliveryText = TextManager.Get("requestdeliverybutton");
|
||||
switchText = TextManager.Get("switchtosubmarinebutton");
|
||||
}
|
||||
else
|
||||
{
|
||||
purchaseAndSwitchText = TextManager.Get("purchaseandswitch");
|
||||
purchaseOnlyText = TextManager.Get("purchase");
|
||||
priceText = TextManager.Get("price");
|
||||
}
|
||||
|
||||
currencyName = TextManager.Get("credit").Value.ToLowerInvariant();
|
||||
|
||||
@@ -305,10 +305,10 @@ namespace Barotrauma
|
||||
public static LocalizedString GetMoneyTransferVoteResultMessage(Client from, Client to, int transferAmount, int yesVoteCount, int noVoteCount, bool votePassed)
|
||||
{
|
||||
LocalizedString result = string.Empty;
|
||||
if (from != null)
|
||||
if (from == null && to != null)
|
||||
{
|
||||
result = TextManager.GetWithVariables(votePassed ? "crewwallet.banktoplayer.votepassed" : "crewwallet.banktoplayer.votefailed",
|
||||
("[playername]", from.Name),
|
||||
("[playername]", to.Name),
|
||||
("[amount]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", transferAmount)),
|
||||
("[yesvotecount]", yesVoteCount.ToString()),
|
||||
("[novotecount]", noVoteCount.ToString()));
|
||||
|
||||
Reference in New Issue
Block a user