(048b753e6) Merge branch 'dev' into human-ai
This commit is contained in:
@@ -62,6 +62,8 @@ namespace Barotrauma
|
||||
|
||||
private GUILayoutGroup subPreviewContainer;
|
||||
|
||||
private GUILayoutGroup subPreviewContainer;
|
||||
|
||||
private GUIButton loadGameButton;
|
||||
|
||||
public Action<Submarine, string, string> StartNewGame;
|
||||
@@ -105,7 +107,10 @@ namespace Barotrauma
|
||||
|
||||
// New game left side
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("SaveName") + ":");
|
||||
saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, string.Empty);
|
||||
saveNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, string.Empty)
|
||||
{
|
||||
textFilterFunction = (string str) => { return ToolBox.RemoveInvalidFileNameChars(str); }
|
||||
};
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("MapSeed") + ":");
|
||||
seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, ToolBox.RandomSeed(8));
|
||||
|
||||
@@ -78,7 +78,6 @@ namespace Barotrauma
|
||||
|
||||
int i = 0;
|
||||
var tabValues = Enum.GetValues(typeof(Tab));
|
||||
float minTextScale = 1.0f;
|
||||
foreach (Tab tab in tabValues)
|
||||
{
|
||||
var tabButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonContainer.RectTransform),
|
||||
@@ -93,17 +92,12 @@ namespace Barotrauma
|
||||
var buttonSprite = tabButton.Style.Sprites[GUIComponent.ComponentState.None][0];
|
||||
tabButton.RectTransform.MaxSize = new Point(
|
||||
(int)(tabButton.Rect.Height * (buttonSprite.Sprite.size.X / buttonSprite.Sprite.size.Y)), int.MaxValue);
|
||||
|
||||
tabButtons.Add(tabButton);
|
||||
tabButton.Font = GUI.LargeFont;
|
||||
tabButton.TextBlock.AutoScale = true;
|
||||
minTextScale = Math.Min(tabButton.TextBlock.TextScale, minTextScale);
|
||||
i++;
|
||||
}
|
||||
|
||||
foreach (GUIButton tabButton in tabButtons)
|
||||
{
|
||||
tabButton.TextBlock.TextScale = minTextScale;
|
||||
}
|
||||
GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(t => t.TextBlock));
|
||||
|
||||
// crew tab -------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -309,14 +309,23 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
int prevIndex = -1;
|
||||
var existingFrame = listBox.Content.FindChild(item);
|
||||
if (existingFrame != null) { listBox.Content.RemoveChild(existingFrame); }
|
||||
if (existingFrame != null)
|
||||
{
|
||||
prevIndex = listBox.Content.GetChildIndex(existingFrame);
|
||||
listBox.Content.RemoveChild(existingFrame);
|
||||
}
|
||||
|
||||
var itemFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), listBox.Content.RectTransform, minSize: new Point(0, 80)),
|
||||
style: "ListBoxElement")
|
||||
{
|
||||
UserData = item
|
||||
};
|
||||
if (prevIndex > -1)
|
||||
{
|
||||
itemFrame.RectTransform.RepositionChildInHierarchy(prevIndex);
|
||||
}
|
||||
|
||||
var innerFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), itemFrame.RectTransform, Anchor.Center), isHorizontal: true)
|
||||
{
|
||||
@@ -329,6 +338,7 @@ namespace Barotrauma
|
||||
{
|
||||
new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), itemPreviewSprites[item.PreviewImageUrl], scaleToFit: true)
|
||||
{
|
||||
UserData = "previewimage",
|
||||
CanBeFocused = false
|
||||
};
|
||||
}
|
||||
@@ -336,6 +346,7 @@ namespace Barotrauma
|
||||
{
|
||||
new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), SteamManager.Instance.DefaultPreviewImage, scaleToFit: true)
|
||||
{
|
||||
UserData = "previewimage",
|
||||
CanBeFocused = false
|
||||
};
|
||||
try
|
||||
@@ -383,6 +394,7 @@ namespace Barotrauma
|
||||
|
||||
var titleText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), rightColumn.RectTransform), EnsureUTF8(item.Title), textAlignment: Alignment.CenterLeft, wrap: true)
|
||||
{
|
||||
UserData = "titletext",
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
@@ -547,7 +559,17 @@ namespace Barotrauma
|
||||
itemPreviewSprites.Add(item.PreviewImageUrl, newSprite);
|
||||
}
|
||||
|
||||
CreateWorkshopItemFrame(item, listBox);
|
||||
|
||||
var previewImage = listBox.Content.FindChild(item)?.GetChildByUserData("previewimage") as GUIImage;
|
||||
if (previewImage != null)
|
||||
{
|
||||
previewImage.Sprite = newSprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateWorkshopItemFrame(item, listBox);
|
||||
}
|
||||
|
||||
if (modsPreviewFrame.FindChild(item) != null)
|
||||
{
|
||||
ShowItemPreview(item, modsPreviewFrame);
|
||||
@@ -575,8 +597,7 @@ namespace Barotrauma
|
||||
|
||||
private bool ToggleItemEnabled(GUITickBox tickBox)
|
||||
{
|
||||
Facepunch.Steamworks.Workshop.Item item = tickBox.UserData as Facepunch.Steamworks.Workshop.Item;
|
||||
if (item == null) { return false; }
|
||||
if (!(tickBox.UserData is Facepunch.Steamworks.Workshop.Item item)) { return false; }
|
||||
|
||||
var updateButton = tickBox.Parent.FindChild("updatebutton");
|
||||
|
||||
@@ -585,7 +606,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (!SteamManager.EnableWorkShopItem(item, false, out errorMsg))
|
||||
{
|
||||
tickBox.Enabled = false;
|
||||
tickBox.Visible = false;
|
||||
tickBox.Selected = false;
|
||||
if (tickBox.Parent.GetChildByUserData("titletext") is GUITextBlock titleText) { titleText.TextColor = Color.Red; }
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -317,10 +317,11 @@ namespace Barotrauma
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
||||
{
|
||||
OnClicked = (btn, userdata) => { ClearFilter(); return true; }
|
||||
};
|
||||
entityCategoryButtons.Add(
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
||||
{
|
||||
OnClicked = (btn, userdata) => { entityCategoryButtons.ForEach(b => b.Selected = b == btn); ClearFilter(); return true; }
|
||||
});
|
||||
|
||||
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
||||
{
|
||||
@@ -337,6 +338,8 @@ namespace Barotrauma
|
||||
});
|
||||
}
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(entityCategoryButtons.Select(b => b.TextBlock));
|
||||
|
||||
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter))
|
||||
{
|
||||
OnSelected = SelectPrefab,
|
||||
@@ -1494,7 +1497,9 @@ namespace Barotrauma
|
||||
ClearFilter();
|
||||
foreach (GUIButton button in entityCategoryButtons)
|
||||
{
|
||||
button.Selected = (MapEntityCategory)button.UserData == selectedCategory;
|
||||
button.Selected =
|
||||
button.UserData != null &&
|
||||
(MapEntityCategory)button.UserData == selectedCategory;
|
||||
}
|
||||
|
||||
foreach (GUIComponent child in toggleEntityMenuButton.Children)
|
||||
|
||||
Reference in New Issue
Block a user