More UI tweaking
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 449 KiB After Width: | Height: | Size: 444 KiB |
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<style>
|
||||
<GUIFrame
|
||||
padding="40.0, 40.0, 40.0, 40.0"
|
||||
padding="40.0, 50.0, 40.0, 50.0"
|
||||
color="1.0,1.0,1.0,1.0"
|
||||
hovercolor="1.0,1.0,1.0,1.0"
|
||||
selectedcolor="1.0,1.0,1.0,1.0"
|
||||
@@ -152,6 +152,26 @@
|
||||
</GUIFrameVertical>
|
||||
</GUIScrollBar>
|
||||
|
||||
<GUISlider>
|
||||
<GUIFrameHorizontal
|
||||
color="1.0,1.0,1.0,1.0"
|
||||
hovercolor="1.0,1.0,1.0,1.0"
|
||||
selectedcolor="1.0,1.0,1.0,1.0"
|
||||
textcolor="1.0,1.0,1.0,1.0"
|
||||
padding="0.0, 0.0, 0.0, 0.0">
|
||||
<Sprite texture="Content/UI/UI_Atlas.png" sourcerect="555, 61, 338, 13" slice="558, 64, 889, 69"/>
|
||||
</GUIFrameHorizontal>
|
||||
|
||||
<GUIButtonHorizontal
|
||||
color="1.0,1.0,1.0,1.0"
|
||||
textcolor="1.0,1.0,1.0,1.0"
|
||||
padding="2.0, 6.0, 2.0, 6.0">
|
||||
<Sprite texture="Content/UI/UI_Atlas.png" state="None" sourcerect="805, 318, 26, 15" slice="813,318,822,332"/>
|
||||
<Sprite texture="Content/UI/UI_Atlas.png" state="Hover" sourcerect="795, 518, 26, 15" slice="813,518,822,532"/>
|
||||
<Sprite texture="Content/UI/UI_Atlas.png" state="Selected" sourcerect="795, 518, 26, 15" slice="813,518,822,532"/>
|
||||
</GUIButtonHorizontal>
|
||||
</GUISlider>
|
||||
|
||||
<GUIDropDown
|
||||
color="1.0,1.0,1.0,1.0"
|
||||
hovercolor="1.0,1.0,1.0,1.0"
|
||||
|
||||
@@ -174,6 +174,14 @@ namespace Barotrauma
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
public override void ApplyStyle(GUIComponentStyle style)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (frame != null) frame.ApplyStyle(style);
|
||||
if (textBlock != null) textBlock.ApplyStyle(style);
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (!Visible) return;
|
||||
|
||||
@@ -111,6 +111,11 @@ namespace Barotrauma
|
||||
set;
|
||||
}
|
||||
|
||||
public GUIComponentStyle Style
|
||||
{
|
||||
get { return style; }
|
||||
}
|
||||
|
||||
public bool Visible
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -36,15 +36,21 @@ namespace Barotrauma
|
||||
GUIComponentStyle componentStyle = null;
|
||||
if (parent != null)
|
||||
{
|
||||
string parentStyleName = parent.GetType().Name.ToLowerInvariant();
|
||||
|
||||
GUIComponentStyle parentStyle = null;
|
||||
if (!componentStyles.TryGetValue(parentStyleName, out parentStyle))
|
||||
GUIComponentStyle parentStyle = parent.Style;
|
||||
|
||||
if (parent.Style == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Couldn't find a GUI style \""+ parentStyleName + "\"");
|
||||
return;
|
||||
string parentStyleName = parent.GetType().Name.ToLowerInvariant();
|
||||
|
||||
if (!componentStyles.TryGetValue(parentStyleName, out parentStyle))
|
||||
{
|
||||
DebugConsole.ThrowError("Couldn't find a GUI style \""+ parentStyleName + "\"");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string childStyleName = string.IsNullOrEmpty(styleName) ? targetComponent.GetType().Name : styleName;
|
||||
parentStyle.ChildStyles.TryGetValue(childStyleName.ToLowerInvariant(), out componentStyle);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Barotrauma
|
||||
GUI.Style.Apply(box, "GUITickBox");
|
||||
|
||||
text = new GUITextBlock(new Rectangle(rect.Right, rect.Y, 20, rect.Height), label, "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, this, false, font);
|
||||
GUI.Style.Apply(text, "", this);
|
||||
GUI.Style.Apply(text, "GUIButtonHorizontal", this);
|
||||
|
||||
this.rect = new Rectangle(box.Rect.X, box.Rect.Y, 240, rect.Height);
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
private void CreateSettingsFrame()
|
||||
{
|
||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
|
||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f, null);
|
||||
|
||||
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 430), null, Alignment.Center, "", settingsFrame);
|
||||
innerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||
@@ -327,7 +327,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
SelectSettingsTab(null, 0);
|
||||
|
||||
var closeButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Close", Alignment.BottomRight, "", innerFrame);
|
||||
var closeButton = new GUIButton(new Rectangle(10, 0, 100, 20), "Close", Alignment.BottomRight, "", innerFrame);
|
||||
closeButton.OnClicked = ToggleSettingsFrame;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
@@ -378,9 +378,9 @@ namespace Barotrauma.Networking
|
||||
};
|
||||
|
||||
|
||||
var votesRequiredText = new GUITextBlock(new Rectangle(20, y + 20, 20, 20), "Votes required: 50 %", "", settingsTabs[0], GUI.SmallFont);
|
||||
var votesRequiredText = new GUITextBlock(new Rectangle(20, y + 15, 20, 20), "Votes required: 50 %", "", settingsTabs[0], GUI.SmallFont);
|
||||
|
||||
var votesRequiredSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), "", 0.1f, settingsTabs[0]);
|
||||
var votesRequiredSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 15), "", 0.1f, settingsTabs[0]);
|
||||
votesRequiredSlider.UserData = votesRequiredText;
|
||||
votesRequiredSlider.Step = 0.2f;
|
||||
votesRequiredSlider.BarScroll = (EndVoteRequiredRatio - 0.5f) * 2.0f;
|
||||
@@ -405,9 +405,9 @@ namespace Barotrauma.Networking
|
||||
};
|
||||
|
||||
|
||||
var respawnIntervalText = new GUITextBlock(new Rectangle(20, y + 18, 20, 20), "Respawn interval", "", settingsTabs[0], GUI.SmallFont);
|
||||
var respawnIntervalText = new GUITextBlock(new Rectangle(20, y + 13, 20, 20), "Respawn interval", "", settingsTabs[0], GUI.SmallFont);
|
||||
|
||||
var respawnIntervalSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), "", 0.1f, settingsTabs[0]);
|
||||
var respawnIntervalSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 15), "", 0.1f, settingsTabs[0]);
|
||||
respawnIntervalSlider.UserData = respawnIntervalText;
|
||||
respawnIntervalSlider.Step = 0.05f;
|
||||
respawnIntervalSlider.BarScroll = RespawnInterval / 600.0f;
|
||||
@@ -426,7 +426,7 @@ namespace Barotrauma.Networking
|
||||
var minRespawnText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Minimum players to respawn", "", settingsTabs[0]);
|
||||
minRespawnText.ToolTip = "What percentage of players has to be dead/spectating until a respawn shuttle is dispatched";
|
||||
|
||||
var minRespawnSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), "", 0.1f, settingsTabs[0]);
|
||||
var minRespawnSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 15), "", 0.1f, settingsTabs[0]);
|
||||
minRespawnSlider.ToolTip = minRespawnText.ToolTip;
|
||||
minRespawnSlider.UserData = minRespawnText;
|
||||
minRespawnSlider.Step = 0.1f;
|
||||
@@ -447,7 +447,7 @@ namespace Barotrauma.Networking
|
||||
respawnDurationText.ToolTip = "The amount of time respawned players have to navigate the respawn shuttle to the main submarine. " +
|
||||
"After the duration expires, the shuttle will automatically head back out of the level.";
|
||||
|
||||
var respawnDurationSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), "", 0.1f, settingsTabs[0]);
|
||||
var respawnDurationSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 15), "", 0.1f, settingsTabs[0]);
|
||||
respawnDurationSlider.ToolTip = minRespawnText.ToolTip;
|
||||
respawnDurationSlider.UserData = respawnDurationText;
|
||||
respawnDurationSlider.Step = 0.1f;
|
||||
@@ -541,17 +541,16 @@ namespace Barotrauma.Networking
|
||||
|
||||
GUITextBlock textBlock = new GUITextBlock(
|
||||
new Rectangle(0, 0, 260, 25),
|
||||
pf.Name,
|
||||
"",
|
||||
Alignment.Left, Alignment.Left, cargoFrame);
|
||||
textBlock.Padding = new Vector4(30.0f, 3.0f, 0.0f, 0.0f);
|
||||
pf.Name, "",
|
||||
Alignment.Left, Alignment.CenterLeft, cargoFrame, false, GUI.SmallFont);
|
||||
textBlock.Padding = new Vector4(40.0f, 3.0f, 0.0f, 0.0f);
|
||||
textBlock.UserData = cargoFrame;
|
||||
textBlock.CanBeFocused = false;
|
||||
|
||||
if (pf.sprite != null)
|
||||
{
|
||||
float scale = Math.Min(Math.Min(30.0f / pf.sprite.SourceRect.Width, 30.0f / pf.sprite.SourceRect.Height), 1.0f);
|
||||
GUIImage img = new GUIImage(new Rectangle(-15-(int)(pf.sprite.SourceRect.Width*scale*0.5f), 12-(int)(pf.sprite.SourceRect.Height*scale*0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock);
|
||||
GUIImage img = new GUIImage(new Rectangle(-20-(int)(pf.sprite.SourceRect.Width*scale*0.5f), 12-(int)(pf.sprite.SourceRect.Height*scale*0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock);
|
||||
img.Color = pf.SpriteColor;
|
||||
img.Scale = scale;
|
||||
}
|
||||
@@ -559,12 +558,12 @@ namespace Barotrauma.Networking
|
||||
int cargoVal = 0;
|
||||
extraCargo.TryGetValue(pf.Name, out cargoVal);
|
||||
var countText = new GUITextBlock(
|
||||
new Rectangle(180, 0, 50, 25),
|
||||
new Rectangle(160, 0, 55, 25),
|
||||
cargoVal.ToString(),
|
||||
"",
|
||||
Alignment.Left, Alignment.Center, textBlock);
|
||||
|
||||
var incButton = new GUIButton(new Rectangle(220, 5, 10, 15), ">", "", textBlock);
|
||||
var incButton = new GUIButton(new Rectangle(200, 5, 15, 15), ">", "", textBlock);
|
||||
incButton.UserData = countText;
|
||||
incButton.OnClicked = (button, obj) =>
|
||||
{
|
||||
@@ -582,7 +581,7 @@ namespace Barotrauma.Networking
|
||||
return true;
|
||||
};
|
||||
|
||||
var decButton = new GUIButton(new Rectangle(180, 5, 10, 15), "<", "", textBlock);
|
||||
var decButton = new GUIButton(new Rectangle(160, 5, 15, 15), "<", "", textBlock);
|
||||
decButton.UserData = countText;
|
||||
decButton.OnClicked = (button, obj) =>
|
||||
{
|
||||
@@ -613,7 +612,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
|
||||
var startIntervalText = new GUITextBlock(new Rectangle(-10, y, 100, 20), "Autorestart delay", "", settingsTabs[1]);
|
||||
var startIntervalSlider = new GUIScrollBar(new Rectangle(10, y + 22, 100, 10), "", 0.1f, settingsTabs[1]);
|
||||
var startIntervalSlider = new GUIScrollBar(new Rectangle(10, y + 22, 100, 15), "", 0.1f, settingsTabs[1]);
|
||||
startIntervalSlider.UserData = startIntervalText;
|
||||
startIntervalSlider.Step = 0.05f;
|
||||
startIntervalSlider.BarScroll = AutoRestartInterval / 300.0f;
|
||||
@@ -651,7 +650,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
var kickVotesRequiredText = new GUITextBlock(new Rectangle(20, y + 20, 20, 20), "Votes required: 50 %", "", settingsTabs[1], GUI.SmallFont);
|
||||
|
||||
var kickVoteSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), "", 0.1f, settingsTabs[1]);
|
||||
var kickVoteSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 15), "", 0.1f, settingsTabs[1]);
|
||||
kickVoteSlider.UserData = kickVotesRequiredText;
|
||||
kickVoteSlider.Step = 0.2f;
|
||||
kickVoteSlider.BarScroll = (KickVoteRequiredRatio - 0.5f) * 2.0f;
|
||||
|
||||
@@ -154,18 +154,18 @@ namespace Barotrauma.Networking
|
||||
return true;
|
||||
};
|
||||
|
||||
new GUITextBlock(new Rectangle(0, -25, 90, 20), "Name:", "", Alignment.BottomLeft, Alignment.TopLeft, parent, false, GUI.Font);
|
||||
nameBox = new GUITextBox(new Rectangle(100, -25, 170, 20), Alignment.BottomLeft, "", parent);
|
||||
new GUITextBlock(new Rectangle(0, -35, 90, 20), "Name:", "", Alignment.BottomLeft, Alignment.CenterLeft, parent, false, GUI.Font);
|
||||
nameBox = new GUITextBox(new Rectangle(100, -35, 170, 20), Alignment.BottomLeft, "", parent);
|
||||
nameBox.Font = GUI.Font;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 5, 90, 20), "IP Address:", "", Alignment.BottomLeft, Alignment.TopLeft, parent, false, GUI.Font);
|
||||
ipBox = new GUITextBox(new Rectangle(100, 5, 170, 20), Alignment.BottomLeft, "", parent);
|
||||
new GUITextBlock(new Rectangle(0, 0, 90, 20), "IP Address:", "", Alignment.BottomLeft, Alignment.CenterLeft, parent, false, GUI.Font);
|
||||
ipBox = new GUITextBox(new Rectangle(100, 0, 170, 20), Alignment.BottomLeft, "", parent);
|
||||
ipBox.Font = GUI.Font;
|
||||
|
||||
var addnewButton = new GUIButton(new Rectangle(0, 45, 150, 20), "Add to whitelist", Alignment.BottomLeft, "", parent);
|
||||
var addnewButton = new GUIButton(new Rectangle(0, 35, 150, 20), "Add to whitelist", Alignment.BottomLeft, "", parent);
|
||||
addnewButton.OnClicked = AddToWhiteList;
|
||||
|
||||
whitelistFrame = new GUIListBox(new Rectangle(0, 30, 0, parent.Rect.Height-100), "", parent);
|
||||
whitelistFrame = new GUIListBox(new Rectangle(0, 30, 0, parent.Rect.Height-110), "", parent);
|
||||
|
||||
foreach (WhiteListedPlayer wlp in whitelistedPlayers)
|
||||
{
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace Barotrauma
|
||||
|
||||
new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
|
||||
|
||||
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), Alignment.TopRight, "", GUItabs[i]);
|
||||
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), null,null, Alignment.TopRight, Alignment.CenterLeft, "", GUItabs[i]);
|
||||
searchBox.Font = GUI.SmallFont;
|
||||
searchBox.OnTextChanged = FilterMessages;
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ namespace Barotrauma
|
||||
traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 205, 20, 20), "<", "", infoFrame);
|
||||
traitorProbabilityButtons[0].UserData = -1;
|
||||
|
||||
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX+20, 205, 80, 20), "No", null,null, Alignment.TopCenter, "", infoFrame);
|
||||
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX+20, 205, 80, 20), "No", null,null, Alignment.Center, "", infoFrame);
|
||||
|
||||
traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 205, 20, 20), ">", "", infoFrame);
|
||||
traitorProbabilityButtons[1].UserData = 1;
|
||||
@@ -422,7 +422,7 @@ namespace Barotrauma
|
||||
|
||||
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.Selected = GameMain.Server.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
@@ -466,7 +466,7 @@ namespace Barotrauma
|
||||
|
||||
if (IsServer && GameMain.Server != null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.Selected = GameMain.Server.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
|
||||
Reference in New Issue
Block a user