The "check updates" tickbox in the launcher can be clicked again, nicer changelog formatting in the launcher, setting kb focus to the item searchbox in sub editor automatically

This commit is contained in:
Regalis
2016-12-14 19:53:06 +02:00
parent d6ba825baf
commit 5db3315bf3
3 changed files with 35 additions and 18 deletions

View File

@@ -202,6 +202,10 @@ namespace Launcher2
}
}
GUIComponent.ClearUpdateList();
guiRoot.AddToGUIUpdateList();
GUIComponent.UpdateMouseOn();
guiRoot.Update(deltaTime);
}
@@ -296,24 +300,30 @@ namespace Launcher2
{
updateInfoBox.ClearChildren();
//string wrappedText = ToolBox.WrapText(text, updateInfoBox.Rect.Width, GUI.SmallFont);
//int lineHeight = (int)GUI.SmallFont.MeasureString(" ").Y;
string[] lines = text.Split('\n');
foreach (string line in lines)
{
if (string.IsNullOrWhiteSpace(line)) continue;
int indent = 10;
int heigth = 0;
if (!string.IsNullOrWhiteSpace(line))
{
if (line[0] == '-')
indent = 20;
}
else
{
heigth = 5;
}
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0,0,0,0),
new Rectangle(indent, 0, 0, heigth),
line, GUI.Style,
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, true, GUI.SmallFont);
textBlock.Padding = new Vector4(indent, 0, 0, 0);
textBlock.TextColor = indent > 10 ? Color.LightGray : Color.White;
textBlock.CanBeFocused = false;
}
}
private bool CheckForUpdates()
@@ -410,7 +420,7 @@ namespace Launcher2
if (currentVersion.CompareTo(latestVersion) >= 0)
{
updateInfoText.Text = "Game is up to date!";
updateInfoText.Text = "Your game is up to date!";
return false;
}
@@ -439,9 +449,14 @@ namespace Launcher2
string innerText = ToolBox.ElementInnerText(patchNote);
innerText = innerText.Replace("\r\n", "\n");
sb.Append(innerText+"\n");
innerText = innerText.Replace("\t", "");
sb.AppendLine("================================");
sb.AppendLine(patchNumber);
sb.AppendLine("================================\n");
sb.AppendLine(innerText);
sb.AppendLine("----------------------------\n");
}
SetUpdateInfoBox(sb.ToString());
@@ -577,7 +592,7 @@ namespace Launcher2
private void Completed(object sender, AsyncCompletedEventArgs e)
{
if (e.Error!=null)
if (e.Error != null)
{
string errorMsg = "Error while downloading: " + e.Error;

View File

@@ -33,7 +33,8 @@ namespace Barotrauma
public static void ClearUpdateList()
{
if (KeyboardDispatcher.Subscriber is GUIComponent &&
if (keyboardDispatcher != null &&
KeyboardDispatcher.Subscriber is GUIComponent &&
!ComponentsToUpdate.Contains((GUIComponent)KeyboardDispatcher.Subscriber))
{
KeyboardDispatcher.Subscriber = null;

View File

@@ -194,7 +194,6 @@ namespace Barotrauma
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), Alignment.TopRight, GUI.Style, GUItabs[i]);
searchBox.Font = GUI.SmallFont;
searchBox.OnTextChanged = FilterMessages;
GUIComponent.KeyboardDispatcher.Subscriber = searchBox;
var clearButton = new GUIButton(new Rectangle(0, 0, 15, 15), "x", Alignment.TopRight, GUI.Style, GUItabs[i]);
clearButton.OnClicked = ClearFilter;
@@ -601,9 +600,11 @@ namespace Barotrauma
{
selectedTab = (int)obj;
ClearFilter(GUItabs[selectedTab].GetChild<GUIButton>(), null);
GUIComponent.KeyboardDispatcher.Subscriber = GUItabs[selectedTab].GetChild<GUITextBox>();
var searchBox = GUItabs[selectedTab].GetChild<GUITextBox>();
ClearFilter(searchBox, null);
searchBox.AddToGUIUpdateList();
searchBox.Select();
return true;
}