diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs index 1ba9d78c8..3441113be 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIDropDown.cs @@ -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(); + if (textBlock == null) return false; + } + button.Text = textBlock.Text; Dropped = false; if (OnSelected != null) OnSelected(component, component.UserData); diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs index 5798c1b59..27fe27b40 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs @@ -83,7 +83,7 @@ namespace Barotrauma set { enabled = value; - scrollBar.Enabled = value; + //scrollBar.Enabled = value; } } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs b/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs index 807e77cfa..b0a6294bb 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/Voting.cs @@ -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); diff --git a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs index 70435cc17..1ba353740 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/CharacterEditorScreen.cs @@ -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 textures; - List texturePaths; + private List textures; + private List 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(); + } + /// /// This is called when the game should draw itself. /// diff --git a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs index 6ba3c951d..ae83e3c01 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/NetLobbyScreen.cs @@ -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 + }; } }