Add a mechanism for custom drop messages. Implement for kick.
This commit is contained in:
@@ -241,7 +241,8 @@ namespace OpenRA.Mods.RA.Server
|
||||
server.SendChatTo( conn, "Noone in that slot." );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
server.SendOrderTo(connToKick, "ServerError", "You have been kicked from the server");
|
||||
server.DropClient(connToKick);
|
||||
|
||||
server.SyncLobbyInfo();
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
[ObjectCreator.UseCtor]
|
||||
public ConnectionFailedDelegate(
|
||||
[ObjectCreator.Param] Widget widget,
|
||||
[ObjectCreator.Param] string host,
|
||||
[ObjectCreator.Param] int port )
|
||||
[ObjectCreator.Param] OrderManager orderManager)
|
||||
{
|
||||
widget.GetWidget("CONNECTION_BUTTON_CANCEL").OnMouseUp = mi => {
|
||||
widget.GetWidget("CONNECTION_BUTTON_CANCEL").Parent.Visible = false;
|
||||
@@ -46,12 +45,12 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
return true;
|
||||
};
|
||||
widget.GetWidget("CONNECTION_BUTTON_RETRY").OnMouseUp = mi => {
|
||||
Game.JoinServer(host, port);
|
||||
Game.JoinServer(orderManager.Host, orderManager.Port);
|
||||
return true;
|
||||
};
|
||||
|
||||
widget.GetWidget<LabelWidget>("CONNECTION_FAILED_DESC").GetText = () =>
|
||||
"Could not connect to {0}:{1}".F(host, port);
|
||||
widget.GetWidget<LabelWidget>("CONNECTION_FAILED_DESC").GetText = () => string.IsNullOrEmpty(orderManager.ServerError) ?
|
||||
"Could not connect to {0}:{1}".F(orderManager.Host, orderManager.Port) : orderManager.ServerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
break;
|
||||
case ConnectionState.NotConnected:
|
||||
Widget.OpenWindow( "CONNECTION_FAILED_BG",
|
||||
new Dictionary<string, object> { { "host", orderManager.Host }, { "port", orderManager.Port } } );
|
||||
new Dictionary<string, object> { { "orderManager", orderManager } } );
|
||||
break;
|
||||
case ConnectionState.Connected:
|
||||
var lobby = Widget.OpenWindow( "SERVER_LOBBY", new Dictionary<string, object> { { "orderManager", orderManager } } );
|
||||
|
||||
Reference in New Issue
Block a user