GUIStyle logic changes: instead of having a predetermined GUIComponentStyle for each type of GUIComponent, any GUIComponent can use any style. The GUIComponent constructors take the name of the style as a parameter, and if no style is specified, the default style for the GUIComponent in question will be used.

This commit is contained in:
Regalis
2017-04-07 22:29:07 +03:00
parent 1fe6427c05
commit 3844dd9dac
54 changed files with 484 additions and 475 deletions

View File

@@ -187,18 +187,18 @@ namespace Barotrauma
int width = 450;
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10;
editingHUD = new GUIFrame(new Rectangle(x, y, width, 100), GUI.Style);
editingHUD = new GUIFrame(new Rectangle(x, y, width, 100), "");
editingHUD.Padding = new Vector4(10, 10, 0, 0);
editingHUD.UserData = this;
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", GUI.Style,
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", "",
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
var pathBox = new GUITextBox(new Rectangle(10,30,300,20), GUI.Style, editingHUD);
var pathBox = new GUITextBox(new Rectangle(10,30,300,20), "", editingHUD);
pathBox.Font = GUI.SmallFont;
pathBox.Text = filePath;
var reloadButton = new GUIButton(new Rectangle(320,30,80,20), "Refresh", GUI.Style, editingHUD);
var reloadButton = new GUIButton(new Rectangle(320,30,80,20), "Refresh", "", editingHUD);
reloadButton.OnClicked = Reload;
reloadButton.UserData = pathBox;
@@ -209,7 +209,7 @@ namespace Barotrauma
if (!inGame)
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to a docking port",
GUI.Style, Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
"", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
y += 25;
}

View File

@@ -657,7 +657,7 @@ namespace Barotrauma
highlightedListBox = new GUIListBox(
new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 15),
null, Alignment.TopLeft, GUI.Style, null, false);
null, Alignment.TopLeft, "", null, false);
highlightedListBox.Color = Color.Black * 0.6f;
@@ -665,7 +665,7 @@ namespace Barotrauma
{
var textBlock = new GUITextBlock(
new Rectangle(0,0,0,15),
ToolBox.LimitString(entity.Name, GUI.SmallFont, 140), GUI.Style, highlightedListBox, GUI.SmallFont);
ToolBox.LimitString(entity.Name, GUI.SmallFont, 140), "", highlightedListBox, GUI.SmallFont);
textBlock.UserData = entity;
}

View File

@@ -272,28 +272,28 @@ namespace Barotrauma
if (spawnType == SpawnType.Path)
{
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", GUI.Style, editingHUD);
new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", GUI.Style, editingHUD);
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", "", editingHUD);
new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", "", editingHUD);
}
else
{
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", GUI.Style, editingHUD);
new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", GUI.Style, editingHUD);
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", "", editingHUD);
new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", "", editingHUD);
var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), GUI.Style, Alignment.Right, Alignment.TopLeft, editingHUD);
var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD);
var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, GUI.Style, spawnTypeText);
var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, "", spawnTypeText);
button.UserData = -1;
button.OnClicked = ChangeSpawnType;
button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, GUI.Style, spawnTypeText);
button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, "", spawnTypeText);
button.UserData = 1;
button.OnClicked = ChangeSpawnType;
y = 40 + 20;
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD);
propertyBox.Text = string.Join(", ", idCardTags);
propertyBox.OnEnterPressed = EnterIDCardTags;
propertyBox.OnTextChanged = TextBoxChanged;
@@ -302,7 +302,7 @@ namespace Barotrauma
y = y + 30;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD);
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
propertyBox.OnEnterPressed = EnterAssignedJob;
propertyBox.OnTextChanged = TextBoxChanged;