- Sliced sprites are scaled instead of tiling (so they work properly even if the UI element is smaller than the sprite)

- Option to use separate sprites for different states of a GUIComponent (e.g. hovered/pressed button)
- Option to configure "child styles" for the individual elements of a GUIComponent (e.g. the background frame and the handle of a scroll bar)
This commit is contained in:
Regalis
2017-04-08 22:22:53 +03:00
parent 3844dd9dac
commit 34f0ae39b6
18 changed files with 296 additions and 182 deletions
+10 -10
View File
@@ -31,7 +31,7 @@ namespace Barotrauma
const int PreviouslyUsedCount = 10;
private GUIListBox previouslyUsedList;
GUIDropDown linkedSubBox;
private GUIDropDown linkedSubBox;
//a Character used for picking up and manipulating items
private Character dummyCharacter;
@@ -126,7 +126,7 @@ namespace Barotrauma
selectedTab = -1;
topPanel = new GUIFrame(new Rectangle(0, 0, 0, 31), "");
topPanel = new GUIFrame(new Rectangle(0, 0, 0, 50), "GUIFrameTop");
topPanel.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
hullVolumeFrame = new GUIFrame(new Rectangle(145, 26, 280, 70), "", topPanel);
@@ -153,10 +153,10 @@ namespace Barotrauma
var nameLabel = new GUITextBlock(new Rectangle(170, -4, 150, 20), "", "", topPanel, GUI.LargeFont);
nameLabel.TextGetter = GetSubName;
linkedSubBox = new GUIDropDown(new Rectangle(750,0,200,20), "Add submarine", "", topPanel);
linkedSubBox.ToolTip =
"Places another submarine into the current submarine file. "+
"Can be used for adding things such as smaller vessels, "+
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), "Add submarine", "", topPanel);
linkedSubBox.ToolTip =
"Places another submarine into the current submarine file. " +
"Can be used for adding things such as smaller vessels, " +
"escape pods or detachable sections into the main submarine.";
foreach (Submarine sub in Submarine.SavedSubmarines)
@@ -164,17 +164,17 @@ namespace Barotrauma
linkedSubBox.AddItem(sub.Name, sub);
}
linkedSubBox.OnSelected += SelectLinkedSub;
leftPanel = new GUIFrame(new Rectangle(0, 30, 150, GameMain.GraphicsHeight-30), "");
leftPanel = new GUIFrame(new Rectangle(0, 0, 150, GameMain.GraphicsHeight), "GUIFrameLeft");
leftPanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", leftPanel);
itemCount.TextGetter = GetItemCount;
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 50, 0, 20), "", "", leftPanel);
structureCount.TextGetter = GetStructureCount;
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
int width = 400, height = 400;
int y = 90;
+3 -3
View File
@@ -170,7 +170,7 @@ namespace Barotrauma
Rectangle panelRect = new Rectangle(0,0,width,height);
menu = new GUIFrame(panelRect, Color.Transparent, Alignment.Center);
menu = new GUIFrame(panelRect, Color.Transparent, Alignment.Center, null);
//menu.Padding = GUI.style.smallPadding;
//server info panel ------------------------------------------------------------
@@ -251,7 +251,7 @@ namespace Barotrauma
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
mode.Name, "",
Alignment.Left, Alignment.Left,
Alignment.TopLeft, Alignment.CenterLeft,
modeList);
textBlock.ToolTip = mode.Description;
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
@@ -674,7 +674,7 @@ namespace Barotrauma
{
var subTextBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25), ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), "",
Alignment.Left, Alignment.CenterY | Alignment.Left, subList)
Alignment.TopLeft, Alignment.CenterLeft, subList)
{
Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f),
ToolTip = sub.Description,
@@ -176,13 +176,13 @@ namespace Barotrauma
passwordBox.Enabled = false;
passwordBox.UserData = "password";
new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, "", serverFrame);
new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, "", Alignment.TopLeft, Alignment.CenterLeft, serverFrame);
int playerCount = 0, maxPlayers = 1;
int.TryParse(currPlayersStr, out playerCount);
int.TryParse(maxPlayersStr, out maxPlayers);
new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, "", serverFrame);
new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, "", Alignment.TopLeft, Alignment.CenterLeft, serverFrame);
var gameStartedBox = new GUITickBox(new Rectangle(columnX[2] + (columnX[3] - columnX[2])/ 2, 0, 20, 20), "", Alignment.TopLeft, serverFrame);
gameStartedBox.Selected = gameStarted == "1";