public void ClientStateChangeProcess(int state, float progress)
{
//TODO: queue these up and try and sift through them in an update loop to avoid UI issues. (on main thread)
if (state == 4) //disconnected
{
var reason = (VMCloseNetReason)progress;
if (reason == VMCloseNetReason.Unspecified)
{
var alert = UIScreen.ShowAlert(new UIAlertOptions
{
Title = GameFacade.Strings.GetString("222", "3"),
Message = GameFacade.Strings.GetString("222", "2", new string[] { "0" }),
}, true);
if (Connecting)
{
UIScreen.RemoveDialog(ConnectingDialog);
ConnectingDialog = null;
Connecting = false;
}
alert.ButtonMap[UIAlertButtonType.OK].OnButtonClick += DisconnectedOKClick;
} else
{
DisconnectedOKClick(null);
}
}
if (ConnectingDialog == null) return;
switch (state)
{
case 1:
ConnectingDialog.ProgressCaption = GameFacade.Strings.GetString("211", "26");
ConnectingDialog.Progress = 25f;
break;
case 2:
ConnectingDialog.ProgressCaption = GameFacade.Strings.GetString("211", "27");
ConnectingDialog.Progress = 100f*(0.5f+progress*0.5f);
break;
case 3:
UIScreen.RemoveDialog(ConnectingDialog);
ConnectingDialog = null;
Connecting = false;
ZoomLevel = 1;
ucp.SetInLot(true);
break;
}
}