(3dc4135ce) v0.9.5.1

This commit is contained in:
Regalis
2019-11-21 18:22:25 +01:00
parent b39922a074
commit 5c95c53118
287 changed files with 12655 additions and 5048 deletions
@@ -67,7 +67,10 @@ namespace Barotrauma.Networking
y += 20;
}
GUITextBlock.AutoScaleAndNormalize(tickBoxes.Select(t => t.TextBlock));
tickBoxes.Last().TextBlock.RectTransform.SizeChanged += () =>
{
GUITextBlock.AutoScaleAndNormalize(tickBoxes.Select(t => t.TextBlock));
};
var currLines = lines.ToList();
@@ -81,26 +84,76 @@ namespace Barotrauma.Networking
if (listBox.BarScroll == 0.0f || listBox.BarScroll == 1.0f) listBox.BarScroll = 1.0f;
GUIButton closeButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.05f), innerFrame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.02f, 0.03f) }, TextManager.Get("Close"));
closeButton.OnClicked = (button, userData) =>
GUIButton closeButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.05f), innerFrame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.02f, 0.03f) }, TextManager.Get("Close"))
{
LogFrame = null;
return true;
OnClicked = (button, userData) =>
{
LogFrame = null;
return true;
}
};
msgFilter = "";
}
public void AssignLogFrame(GUIListBox inListBox, GUIComponent tickBoxContainer, GUITextBox searchBox)
{
searchBox.OnTextChanged += (textBox, text) =>
{
msgFilter = text;
FilterMessages();
return true;
};
tickBoxContainer.ClearChildren();
List<GUITickBox> tickBoxes = new List<GUITickBox>();
foreach (MessageType msgType in Enum.GetValues(typeof(MessageType)))
{
var tickBox = new GUITickBox(new RectTransform(new Point(tickBoxContainer.Rect.Width, 16), tickBoxContainer.RectTransform), TextManager.Get("ServerLog." + messageTypeName[(int)msgType]), font: GUI.SmallFont)
{
Selected = true,
TextColor = messageColor[(int)msgType],
OnSelected = (GUITickBox tb) =>
{
msgTypeHidden[(int)msgType] = !tb.Selected;
FilterMessages();
return true;
}
};
tickBox.Selected = !msgTypeHidden[(int)msgType];
tickBoxes.Add(tickBox);
}
tickBoxes.Last().TextBlock.RectTransform.SizeChanged += () =>
{
GUITextBlock.AutoScaleAndNormalize(tickBoxes.Select(t => t.TextBlock));
};
inListBox.ClearChildren();
listBox = inListBox;
var currLines = lines.ToList();
foreach (LogMessage line in currLines)
{
AddLine(line);
}
FilterMessages();
listBox.UpdateScrollBarSize();
}
private void AddLine(LogMessage line)
{
float prevSize = listBox.BarSize;
var textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), listBox.Content.RectTransform),
line.Text, wrap: true, font: GUI.SmallFont);
textBlock.TextColor = messageColor[(int)line.Type];
textBlock.Visible = !msgTypeHidden[(int)line.Type];
textBlock.CanBeFocused = false;
textBlock.UserData = line;
var textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), listBox.Content.RectTransform),
line.Text, wrap: true, font: GUI.SmallFont)
{
TextColor = messageColor[(int)line.Type],
Visible = !msgTypeHidden[(int)line.Type],
CanBeFocused = false,
UserData = line
};
if ((prevSize == 1.0f && listBox.BarScroll == 0.0f) || (prevSize < 1.0f && listBox.BarScroll == 1.0f)) listBox.BarScroll = 1.0f;
}