Faction Test v1.0.1.0
This commit is contained in:
@@ -244,18 +244,16 @@ namespace Barotrauma
|
||||
return parentHierarchy.Last();
|
||||
}
|
||||
|
||||
public void AddItem(LocalizedString text, object userData = null, LocalizedString toolTip = null)
|
||||
public GUIComponent AddItem(LocalizedString text, object userData = null, LocalizedString toolTip = null, Color? color = null, Color? textColor = null)
|
||||
{
|
||||
toolTip ??= "";
|
||||
if (selectMultiple)
|
||||
{
|
||||
var frame = new GUIFrame(new RectTransform(new Point(button.Rect.Width, button.Rect.Height), listBox.Content.RectTransform)
|
||||
{ IsFixedSize = false }, style: "ListBoxElement")
|
||||
var frame = new GUIFrame(new RectTransform(new Point(button.Rect.Width, button.Rect.Height), listBox.Content.RectTransform) { IsFixedSize = false }, style: "ListBoxElement", color: color)
|
||||
{
|
||||
UserData = userData,
|
||||
ToolTip = toolTip
|
||||
};
|
||||
|
||||
new GUITickBox(new RectTransform(new Vector2(1.0f, 0.8f), frame.RectTransform, anchor: Anchor.CenterLeft) { MaxSize = new Point(int.MaxValue, (int)(button.Rect.Height * 0.8f)) }, text)
|
||||
{
|
||||
UserData = userData,
|
||||
@@ -275,7 +273,7 @@ namespace Barotrauma
|
||||
foreach (GUIComponent child in ListBox.Content.Children)
|
||||
{
|
||||
var tickBox = child.GetChild<GUITickBox>();
|
||||
if (tickBox.Selected)
|
||||
if (tickBox is { Selected: true })
|
||||
{
|
||||
selectedDataMultiple.Add(child.UserData);
|
||||
selectedIndexMultiple.Add(i);
|
||||
@@ -289,11 +287,11 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Point(button.Rect.Width, button.Rect.Height), listBox.Content.RectTransform)
|
||||
{ IsFixedSize = false }, text, style: "ListBoxElement")
|
||||
return new GUITextBlock(new RectTransform(new Point(button.Rect.Width, button.Rect.Height), listBox.Content.RectTransform) { IsFixedSize = false }, text, style: "ListBoxElement", color: color, textColor: textColor)
|
||||
{
|
||||
UserData = userData,
|
||||
ToolTip = toolTip
|
||||
@@ -323,7 +321,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(component is GUITextBlock textBlock))
|
||||
if (component is not GUITextBlock textBlock)
|
||||
{
|
||||
textBlock = component.GetChild<GUITextBlock>();
|
||||
if (textBlock is null && !AllowNonText) { return false; }
|
||||
|
||||
Reference in New Issue
Block a user