Separate component style for item UIs + option to select the style in the item config files, removed a bunch of hard-coded UI element color changes

This commit is contained in:
Regalis
2017-04-10 18:11:23 +03:00
parent 34f0ae39b6
commit dc6ed7daf1
21 changed files with 98 additions and 84 deletions

View File

@@ -52,7 +52,7 @@ namespace Barotrauma
private void CreateGUIFrame()
{
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f);
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f, null);
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", Alignment.BottomCenter, "", frame);
@@ -110,12 +110,12 @@ namespace Barotrauma
private GUIButton CreateOrderButton(Rectangle rect, Order order, bool createSymbol = true)
{
var orderButton = new GUIButton(rect, order.Name, Color.Black * 0.7f, Alignment.TopCenter, Alignment.Center, null, frame);
var orderButton = new GUIButton(rect, order.Name, null, Alignment.TopCenter, Alignment.Center, "GUITextBox", frame);
orderButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
orderButton.TextColor = Color.White;
/*orderButton.TextColor = Color.White;
orderButton.Color = Color.Black * 0.5f;
orderButton.HoverColor = Color.LightGray * 0.5f;
orderButton.OutlineColor = Color.LightGray * 0.8f;
orderButton.OutlineColor = Color.LightGray * 0.8f;*/
orderButton.UserData = order;
orderButton.OnClicked = SetOrder;
@@ -169,15 +169,15 @@ namespace Barotrauma
int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count));
int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow));
GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", Color.Black, Alignment.TopCenter, null, frame);
GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", null, Alignment.TopCenter, "GUITextBox", frame);
characterButton.UserData = character;
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
characterButton.Color = Character.Controlled == character ? Color.Gold * 0.2f : Color.Black * 0.5f;
characterButton.HoverColor = Color.LightGray * 0.5f;
characterButton.Color = Character.Controlled == character ? Color.Gold : Color.White;
/*characterButton.HoverColor = Color.LightGray * 0.5f;
characterButton.SelectedColor = Color.Gold * 0.6f;
characterButton.OutlineColor = Color.LightGray * 0.8f;
characterButton.OutlineColor = Color.LightGray * 0.8f;*/
characterFrameBottom = Math.Max(characterFrameBottom, characterButton.Rect.Bottom);
@@ -187,9 +187,9 @@ namespace Barotrauma
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40, 0, 0, 25),
name,
Color.Transparent, Color.White,
Color.Transparent, null,
Alignment.Left, Alignment.Left,
null, characterButton, false);
"", characterButton, false);
textBlock.Font = GUI.SmallFont;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
@@ -259,8 +259,8 @@ namespace Barotrauma
var existingOrder = characterFrame.children.Find(c => c.UserData is Order);
if (existingOrder != null) characterFrame.RemoveChild(existingOrder);
var orderFrame = new GUIFrame(new Rectangle(-5, characterFrame.Rect.Height, characterFrame.Rect.Width, 30 + order.Options.Length * 15), null, characterFrame);
orderFrame.OutlineColor = Color.LightGray * 0.5f;
var orderFrame = new GUIFrame(new Rectangle(-5, characterFrame.Rect.Height, characterFrame.Rect.Width, 30 + order.Options.Length * 15), "InnerFrame", characterFrame);
/*orderFrame.OutlineColor = Color.LightGray * 0.5f;*/
orderFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
orderFrame.UserData = order;
@@ -269,18 +269,14 @@ namespace Barotrauma
img.Color = order.Color;
img.CanBeFocused = false;
new GUITextBlock(new Rectangle(0, 0, 0, 20), order.DoingText, "", Alignment.TopLeft, Alignment.TopCenter, orderFrame);
new GUITextBlock(new Rectangle(img.Rect.Width, 0, 0, 20), order.DoingText, "", Alignment.TopLeft, Alignment.CenterLeft, orderFrame);
var optionList = new GUIListBox(new Rectangle(0, 20, 0, 80), Color.Transparent, null, orderFrame);
optionList.UserData = order;
for (int i = 0; i < order.Options.Length; i++ )
{
var optionBox = new GUITextBlock(new Rectangle(0, 0, 0, 15), order.Options[i], "", optionList);
var optionBox = new GUITextBlock(new Rectangle(0, 0, 0, 15), order.Options[i], "", Alignment.TopLeft, Alignment.CenterLeft, optionList);
optionBox.Font = GUI.SmallFont;
optionBox.UserData = order.Options[i];

View File

@@ -254,14 +254,9 @@ namespace Barotrauma
public GUIFrame CreateCharacterFrame(GUIComponent parent, string text, object userData)
{
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, parent);
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, "ListBoxElement", parent);
frame.UserData = userData;
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
frame.HoverColor = Color.LightGray * 0.5f;
frame.SelectedColor = Color.Gold * 0.5f;
// string name = character.Info.Name.Replace(' ', '\n');
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40, 0, 0, 25),
text,