(a410fd46c) Trying to help the merge script through a jungle of merges
This commit is contained in:
@@ -335,12 +335,6 @@ namespace Barotrauma
|
||||
}
|
||||
subName = doc.Root.GetAttributeString("submarine", "");
|
||||
saveTime = doc.Root.GetAttributeString("savetime", "");
|
||||
|
||||
if (long.TryParse(saveTime, out long unixTime))
|
||||
{
|
||||
DateTime time = ToolBox.Epoch.ToDateTime(unixTime);
|
||||
saveTime = time.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -350,6 +344,11 @@ namespace Barotrauma
|
||||
if (splitSaveFile.Length > 1) { subName = splitSaveFile[1]; }
|
||||
if (splitSaveFile.Length > 2) { saveTime = splitSaveFile[2]; }
|
||||
}
|
||||
if (!string.IsNullOrEmpty(saveTime) && long.TryParse(saveTime, out long unixTime))
|
||||
{
|
||||
DateTime time = ToolBox.Epoch.ToDateTime(unixTime);
|
||||
saveTime = time.ToString();
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform, Anchor.BottomLeft),
|
||||
text: subName, font: GUI.SmallFont)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Extensions;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -231,7 +232,16 @@ namespace Barotrauma
|
||||
"", style: "ItemCategory" + category.ToString())
|
||||
{
|
||||
UserData = category,
|
||||
OnClicked = (btn, userdata) => { FilterStoreItems((MapEntityCategory)userdata, searchBox.Text); return true; }
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
MapEntityCategory newCategory = (MapEntityCategory)userdata;
|
||||
if (newCategory != selectedItemCategory)
|
||||
{
|
||||
searchBox.Text = "";
|
||||
}
|
||||
FilterStoreItems((MapEntityCategory)userdata, searchBox.Text);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
itemCategoryButtons.Add(categoryButton);
|
||||
|
||||
@@ -487,10 +497,15 @@ namespace Barotrauma
|
||||
{
|
||||
//refresh store view
|
||||
FillStoreItemList();
|
||||
FilterStoreItems(MapEntityCategory.Equipment, searchBox.Text);
|
||||
}
|
||||
|
||||
MapEntityCategory? category = null;
|
||||
//only select a specific category if the search box is empty
|
||||
//(items from all categories are shown when searching)
|
||||
if (string.IsNullOrEmpty(searchBox.Text)) { category = selectedItemCategory; }
|
||||
FilterStoreItems(category, searchBox.Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawMap(SpriteBatch spriteBatch, GUICustomComponent mapContainer)
|
||||
{
|
||||
GameMain.GameSession?.Map?.Draw(spriteBatch, mapContainer);
|
||||
@@ -655,7 +670,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateItemFrame(PurchasedItem pi, PriceInfo priceInfo, GUIListBox listBox, int width)
|
||||
private GUIComponent CreateItemFrame(PurchasedItem pi, PriceInfo priceInfo, GUIListBox listBox, int width)
|
||||
{
|
||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(listBox.Content.Rect.Width, (int)(GUI.Scale * 50)), listBox.Content.RectTransform), style: "ListBoxElement")
|
||||
{
|
||||
@@ -739,6 +754,10 @@ namespace Barotrauma
|
||||
content.RectTransform.RecalculateChildren(true, true);
|
||||
amountInput?.LayoutGroup.Recalculate();
|
||||
textBlock.Text = ToolBox.LimitString(textBlock.Text, textBlock.Font, textBlock.Rect.Width);
|
||||
content.RectTransform.IsFixedSize = true;
|
||||
content.RectTransform.Children.ForEach(c => c.IsFixedSize = true);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
private bool BuyItem(GUIComponent component, object obj)
|
||||
@@ -776,12 +795,24 @@ namespace Barotrauma
|
||||
|
||||
private void RefreshMyItems()
|
||||
{
|
||||
myItemList.Content.ClearChildren();
|
||||
|
||||
foreach (PurchasedItem ip in Campaign.CargoManager.PurchasedItems)
|
||||
HashSet<GUIComponent> existingItemFrames = new HashSet<GUIComponent>();
|
||||
foreach (PurchasedItem pi in Campaign.CargoManager.PurchasedItems)
|
||||
{
|
||||
CreateItemFrame(ip, ip.ItemPrefab.GetPrice(Campaign.Map.CurrentLocation), myItemList, myItemList.Rect.Width);
|
||||
var itemFrame = myItemList.Content.GetChildByUserData(pi);
|
||||
if (itemFrame == null)
|
||||
{
|
||||
itemFrame = CreateItemFrame(pi, pi.ItemPrefab.GetPrice(Campaign.Map.CurrentLocation), myItemList, myItemList.Rect.Width);
|
||||
}
|
||||
itemFrame.GetChild(0).GetChild<GUINumberInput>().IntValue = pi.Quantity;
|
||||
existingItemFrames.Add(itemFrame);
|
||||
}
|
||||
|
||||
var removedItemFrames = myItemList.Content.Children.Except(existingItemFrames).ToList();
|
||||
foreach (GUIComponent removedItemFrame in removedItemFrames)
|
||||
{
|
||||
myItemList.Content.RemoveChild(removedItemFrame);
|
||||
}
|
||||
|
||||
myItemList.Content.RectTransform.SortChildren((x, y) =>
|
||||
(x.GUIComponent.UserData as PurchasedItem).ItemPrefab.Name.CompareTo((y.GUIComponent.UserData as PurchasedItem).ItemPrefab.Name));
|
||||
myItemList.Content.RectTransform.SortChildren((x, y) =>
|
||||
@@ -821,17 +852,28 @@ namespace Barotrauma
|
||||
|
||||
private void FillStoreItemList()
|
||||
{
|
||||
storeItemList.ClearChildren();
|
||||
|
||||
int width = storeItemList.Rect.Width;
|
||||
HashSet<GUIComponent> existingItemFrames = new HashSet<GUIComponent>();
|
||||
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
|
||||
{
|
||||
if (!(mapEntityPrefab is ItemPrefab itemPrefab)) { continue; }
|
||||
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
|
||||
if (priceInfo == null) continue;
|
||||
if (priceInfo == null) { continue; }
|
||||
|
||||
CreateItemFrame(new PurchasedItem(itemPrefab, 0), priceInfo, storeItemList, width);
|
||||
var itemFrame = myItemList.Content.GetChildByUserData(priceInfo);
|
||||
if (itemFrame == null)
|
||||
{
|
||||
itemFrame = CreateItemFrame(new PurchasedItem(itemPrefab, 0), priceInfo, storeItemList, width);
|
||||
}
|
||||
existingItemFrames.Add(itemFrame);
|
||||
}
|
||||
|
||||
var removedItemFrames = storeItemList.Content.Children.Except(existingItemFrames).ToList();
|
||||
foreach (GUIComponent removedItemFrame in removedItemFrames)
|
||||
{
|
||||
storeItemList.Content.RemoveChild(removedItemFrame);
|
||||
}
|
||||
|
||||
storeItemList.Content.RectTransform.SortChildren(
|
||||
(x, y) => (x.GUIComponent.UserData as PurchasedItem).ItemPrefab.Name.CompareTo((y.GUIComponent.UserData as PurchasedItem).ItemPrefab.Name));
|
||||
}
|
||||
|
||||
@@ -968,7 +968,10 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("Password"), textAlignment: textAlignment);
|
||||
passwordBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment);
|
||||
passwordBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), textAlignment: textAlignment)
|
||||
{
|
||||
Censor = true
|
||||
};
|
||||
|
||||
isPublicBox = new GUITickBox(new RectTransform(tickBoxSize, parent.RectTransform), TextManager.Get("PublicServer"))
|
||||
{
|
||||
|
||||
@@ -147,6 +147,12 @@ namespace Barotrauma
|
||||
get { return playerList; }
|
||||
}
|
||||
|
||||
public GUITextBox CharacterNameBox
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public GUIButton StartButton
|
||||
{
|
||||
get;
|
||||
@@ -920,7 +926,26 @@ namespace Barotrauma
|
||||
UserData = characterInfo
|
||||
};
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), infoContainer.RectTransform), characterInfo.Name, font: GUI.LargeFont, textAlignment: Alignment.Center, wrap: true);
|
||||
CharacterNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.1f), infoContainer.RectTransform), characterInfo.Name, font: GUI.LargeFont, textAlignment: Alignment.Center)
|
||||
{
|
||||
MaxTextLength = Client.MaxNameLength,
|
||||
OverflowClip = true
|
||||
};
|
||||
CharacterNameBox.OnEnterPressed += (tb, text) => { CharacterNameBox.Deselect(); return true; };
|
||||
CharacterNameBox.OnDeselected += (tb, key) =>
|
||||
{
|
||||
if (GameMain.Client == null) { return; }
|
||||
string newName = Client.SanitizeName(tb.Text);
|
||||
if (string.IsNullOrWhiteSpace(newName))
|
||||
{
|
||||
tb.Text = GameMain.Client.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadyToStartBox.Selected = false;
|
||||
GameMain.Client.Name = tb.Text;
|
||||
};
|
||||
};
|
||||
|
||||
GUIComponent headContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.6f, 0.2f), infoContainer.RectTransform, Anchor.TopCenter), isHorizontal: true)
|
||||
{
|
||||
@@ -1309,6 +1334,7 @@ namespace Barotrauma
|
||||
{
|
||||
Selected = true,
|
||||
Enabled = false,
|
||||
Visible = false,
|
||||
ToolTip = TextManager.Get("ReadyToStartTickBox"),
|
||||
UserData = "clientready"
|
||||
};
|
||||
|
||||
@@ -70,8 +70,14 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("YourName"));
|
||||
clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "")
|
||||
{
|
||||
Text = GameMain.Config.DefaultPlayerName
|
||||
Text = GameMain.Config.DefaultPlayerName,
|
||||
MaxTextLength = Client.MaxNameLength,
|
||||
OverflowClip = true
|
||||
};
|
||||
if (string.IsNullOrEmpty(clientNameBox.Text))
|
||||
{
|
||||
clientNameBox.Text = SteamManager.GetUsername();
|
||||
}
|
||||
clientNameBox.OnTextChanged += RefreshJoinButtonState;
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("ServerIP"));
|
||||
@@ -236,7 +242,7 @@ namespace Barotrauma
|
||||
{
|
||||
serverInfo = (ServerInfo)obj;
|
||||
ipBox.UserData = serverInfo;
|
||||
ipBox.Text = serverInfo.ServerName;
|
||||
ipBox.Text = ToolBox.LimitString(serverInfo.ServerName, ipBox.Font, ipBox.Rect.Width);
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
@@ -411,7 +417,6 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
var serverName = new GUITextBlock(new RectTransform(new Vector2(columnRelativeWidth[3], 1.0f), serverContent.RectTransform), serverInfo.ServerName, style: "GUIServerListTextBox");
|
||||
|
||||
var gameStartedBox = new GUITickBox(new RectTransform(new Vector2(columnRelativeWidth[4], 0.4f), serverContent.RectTransform, Anchor.Center),
|
||||
label: "", style: "GUIServerListRoundStartedTickBox") {
|
||||
ToolTip = TextManager.Get((serverInfo.GameStarted) ? "ServerListRoundStarted" : "ServerListRoundNotStarted"),
|
||||
|
||||
Reference in New Issue
Block a user