More descriptive error message if server ip/port is can't be resolved, updateinfobox automatic scroll
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Launcher
|
||||
{
|
||||
public partial class LauncherMain : Form
|
||||
{
|
||||
string version = AssemblyName.GetAssemblyName("subsurface.exe").Version.ToString();
|
||||
string version = AssemblyName.GetAssemblyName("Barotrauma.exe").Version.ToString();
|
||||
|
||||
private const string configPath = "config.xml";
|
||||
private Subsurface.GameSettings settings;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Launcher2
|
||||
/// </summary>
|
||||
public class LauncherMain : Game
|
||||
{
|
||||
string version = AssemblyName.GetAssemblyName("subsurface.exe").Version.ToString();
|
||||
string version = AssemblyName.GetAssemblyName("Barotrauma.exe").Version.ToString();
|
||||
|
||||
private const string configPath = "config.xml";
|
||||
private Subsurface.GameSettings settings;
|
||||
@@ -440,7 +440,7 @@ namespace Launcher2
|
||||
filesToDownload = UpdaterUtil.GetRequiredFiles(doc);
|
||||
|
||||
string updaterVersion = ToolBox.GetAttributeString(doc.Root, "updaterversion", "1.0");
|
||||
if (updaterVersion!=UpdaterUtil.Version || true)
|
||||
if (updaterVersion!=UpdaterUtil.Version)
|
||||
{
|
||||
ShowError("Warning", "The update may contain changes which can't be installed by the autoupdater. If you receive any error messages during the install, please download and install the update manually.");
|
||||
}
|
||||
@@ -510,6 +510,8 @@ namespace Launcher2
|
||||
Alignment.TopLeft, Alignment.TopLeft,
|
||||
updateInfoBox, false, GUI.SmallFont);
|
||||
textBlock.CanBeFocused = false;
|
||||
|
||||
updateInfoBox.BarScroll = 1.0f;
|
||||
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Subsurface
|
||||
public delegate bool OnPressedHandler();
|
||||
public OnPressedHandler OnPressed;
|
||||
|
||||
public bool CanBeSelected = true;
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public override Color Color
|
||||
@@ -119,7 +121,7 @@ namespace Subsurface
|
||||
{
|
||||
if (OnClicked != null)
|
||||
{
|
||||
if (OnClicked(this, UserData)) state = ComponentState.Selected;
|
||||
if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,12 +82,25 @@ namespace Subsurface.Networking
|
||||
outmsg.Write(GameMain.SelectedPackage.MD5hash.Hash);
|
||||
outmsg.Write(name);
|
||||
|
||||
|
||||
System.Net.IPEndPoint IPEndPoint = null;
|
||||
try
|
||||
{
|
||||
IPEndPoint = new System.Net.IPEndPoint(NetUtility.Resolve(serverIP), Port);
|
||||
}
|
||||
catch (ArgumentNullException e)
|
||||
{
|
||||
new GUIMessageBox("Could not connect to server", "Failed to resolve address ''"+serverIP+":"+Port+"''. Please make sure you have entered a valid IP address.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Connect client, to ip previously requested from user
|
||||
try
|
||||
{
|
||||
client.Connect(serverIP, Port, outmsg);
|
||||
client.Connect(IPEndPoint, outmsg);
|
||||
}
|
||||
catch (ArgumentNullException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Couldn't connect to "+hostIP+". Error message: "+e.Message);
|
||||
Disconnect();
|
||||
@@ -108,7 +121,10 @@ namespace Subsurface.Networking
|
||||
// Funtion that waits for connection approval info from server
|
||||
if (reconnectBox==null)
|
||||
{
|
||||
reconnectBox = new GUIMessageBox("CONNECTING", "Connecting to " + serverIP, new string[0]);
|
||||
reconnectBox = new GUIMessageBox("CONNECTING", "Connecting to " + serverIP, new string[] { "Cancel" });
|
||||
|
||||
reconnectBox.Buttons[0].OnClicked += CancelConnect;
|
||||
reconnectBox.Buttons[0].OnClicked += reconnectBox.Close;
|
||||
}
|
||||
|
||||
CoroutineManager.StartCoroutine(WaitForStartingInfo());
|
||||
@@ -136,17 +152,35 @@ namespace Subsurface.Networking
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool connectCanceled;
|
||||
|
||||
private bool CancelConnect(GUIButton button, object obj)
|
||||
{
|
||||
connectCanceled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Before main looping starts, we loop here and wait for approval message
|
||||
private IEnumerable<object> WaitForStartingInfo()
|
||||
{
|
||||
connectCanceled = false;
|
||||
// When this is set to true, we are approved and ready to go
|
||||
bool CanStart = false;
|
||||
|
||||
DateTime timeOut = DateTime.Now + new TimeSpan(0,0,15);
|
||||
|
||||
// Loop until we are approved
|
||||
while (!CanStart)
|
||||
while (!CanStart && !connectCanceled)
|
||||
{
|
||||
int seconds = DateTime.Now.Second;
|
||||
|
||||
string connectingText = "Connecting to " + serverIP;
|
||||
for (int i = 0; i < 1 + (seconds % 3); i++ )
|
||||
{
|
||||
connectingText += ".";
|
||||
}
|
||||
reconnectBox.Text = connectingText;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
if (DateTime.Now > timeOut) break;
|
||||
@@ -236,6 +270,8 @@ namespace Subsurface.Networking
|
||||
reconnectBox = null;
|
||||
}
|
||||
|
||||
if (connectCanceled) yield return CoroutineStatus.Success;
|
||||
|
||||
if (client.ConnectionStatus != NetConnectionStatus.Connected)
|
||||
{
|
||||
var reconnect = new GUIMessageBox("CONNECTION FAILED", "Failed to connect to server.", new string[] { "Retry", "Cancel" });
|
||||
|
||||
@@ -184,6 +184,8 @@ namespace Subsurface
|
||||
otherButton.Selected = false;
|
||||
}
|
||||
|
||||
if (Screen.Selected != this) Select();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ namespace Subsurface
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.Style, menu);
|
||||
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
|
||||
|
||||
button.CanBeSelected = false;
|
||||
button.SelectedColor = button.Color;
|
||||
|
||||
refreshDisableTimer = DateTime.Now;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Subsurface</RootNamespace>
|
||||
<AssemblyName>Subsurface</AssemblyName>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user