Fixed vote count text overlapping with the submarine preview button in NetLobbyScreen

This commit is contained in:
Joonas Rikkonen
2018-01-26 10:36:34 +02:00
parent a1ccf501c7
commit ad18eb0db0
5 changed files with 43 additions and 28 deletions

View File

@@ -135,9 +135,13 @@ namespace Barotrauma
private bool SelectItem(GUIComponent component, object obj)
{
GUITextBlock textBlock = component as GUITextBlock;
if (textBlock == null) return false;
button.Text = textBlock.Text;
if (textBlock == null)
{
textBlock = component.GetChild<GUITextBlock>();
if (textBlock == null) return false;
}
button.Text = textBlock.Text;
Dropped = false;
if (OnSelected != null) OnSelected(component, component.UserData);

View File

@@ -83,7 +83,7 @@ namespace Barotrauma
set
{
enabled = value;
scrollBar.Enabled = value;
//scrollBar.Enabled = value;
}
}

View File

@@ -69,7 +69,7 @@ namespace Barotrauma
GUIListBox listBox = (voteType == VoteType.Sub) ?
GameMain.NetLobbyScreen.SubList : GameMain.NetLobbyScreen.ModeList;
foreach (GUITextBlock comp in listBox.children)
foreach (GUIComponent comp in listBox.children)
{
GUITextBlock voteText = comp.FindChild("votes") as GUITextBlock;
if (voteText != null) comp.RemoveChild(voteText);

View File

@@ -10,27 +10,24 @@ namespace Barotrauma
{
class CharacterEditorScreen : Screen
{
Camera cam;
private Camera cam;
GUIComponent GUIpanel;
GUIButton physicsButton;
private GUIComponent GUIpanel;
private GUIButton physicsButton;
GUIListBox limbList, jointList;
private GUIListBox limbList, jointList;
GUIFrame limbPanel;
Character editingCharacter;
Limb editingLimb;
//RevoluteJoint editingJoint;
private GUIFrame limbPanel;
private Character editingCharacter;
private Limb editingLimb;
List<Texture2D> textures;
List<string> texturePaths;
private List<Texture2D> textures;
private List<string> texturePaths;
private bool physicsEnabled;
public Camera Cam
public override Camera Cam
{
get { return cam; }
}
@@ -99,6 +96,8 @@ namespace Barotrauma
{
cam.MoveCamera((float)deltaTime);
GUIpanel.Update((float)deltaTime);
if (physicsEnabled)
{
Character.UpdateAnimAll((float)deltaTime);
@@ -109,6 +108,11 @@ namespace Barotrauma
}
}
public override void AddToGUIUpdateList()
{
GUIpanel.AddToGUIUpdateList();
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>

View File

@@ -756,27 +756,31 @@ namespace Barotrauma
public void AddSubmarine(GUIComponent subList, Submarine sub)
{
var subTextBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25), ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), "ListBoxElement",
Alignment.TopLeft, Alignment.CenterLeft, subList)
var frame = new GUIFrame(new Rectangle(0, 0, 0, 25), "ListBoxElement", subList)
{
Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f),
ToolTip = sub.Description,
UserData = sub
};
var subTextBlock = new GUITextBlock(
new Rectangle(20, 0, 0, 0), ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), "",
Alignment.TopLeft, Alignment.CenterLeft, frame)
{
CanBeFocused = false
};
var matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == sub.Name && s.MD5Hash.Hash == sub.MD5Hash.Hash);
if (matchingSub == null) matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == sub.Name);
if (matchingSub == null)
{
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
subTextBlock.ToolTip = TextManager.Get("SubNotFound");
frame.ToolTip = TextManager.Get("SubNotFound");
}
else if (matchingSub.MD5Hash.Hash != sub.MD5Hash.Hash)
{
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
subTextBlock.ToolTip = TextManager.Get("SubDoesntMatch");
frame.ToolTip = TextManager.Get("SubDoesntMatch");
}
else
{
@@ -785,7 +789,7 @@ namespace Barotrauma
subTextBlock.TextColor = new Color(subTextBlock.TextColor, sub.HasTag(SubmarineTag.Shuttle) ? 1.0f : 0.6f);
}
GUIButton infoButton = new GUIButton(new Rectangle(0, 0, 20, 20), "?", Alignment.CenterRight, "", subTextBlock);
GUIButton infoButton = new GUIButton(new Rectangle(0, 0, 20, 20), "?", Alignment.CenterLeft, "", frame);
infoButton.UserData = sub;
infoButton.OnClicked += (component, userdata) =>
{
@@ -797,9 +801,12 @@ namespace Barotrauma
if (sub.HasTag(SubmarineTag.Shuttle))
{
var shuttleText = new GUITextBlock(new Rectangle(-20, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.CenterRight, Alignment.CenterRight, subTextBlock, false, GUI.SmallFont);
shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
shuttleText.ToolTip = subTextBlock.ToolTip;
new GUITextBlock(new Rectangle(-20, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.CenterRight, Alignment.CenterRight, subTextBlock, false, GUI.SmallFont)
{
TextColor = subTextBlock.TextColor * 0.8f,
ToolTip = subTextBlock.ToolTip,
CanBeFocused = false
};
}
}