本文整理汇总了C#中OpenRA.Server.Server.SyncLobbySlots方法的典型用法代码示例。如果您正苦于以下问题:C# Server.SyncLobbySlots方法的具体用法?C# Server.SyncLobbySlots怎么用?C# Server.SyncLobbySlots使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Server.Server
的用法示例。
在下文中一共展示了Server.SyncLobbySlots方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InterpretCommand
//.........这里部分代码省略.........
{ "slot_close",
s =>
{
if (!ValidateSlotCommand(server, conn, client, s, true))
return false;
// kick any player that's in the slot
var occupant = server.LobbyInfo.ClientInSlot(s);
if (occupant != null)
{
if (occupant.Bot != null)
{
server.LobbyInfo.Clients.Remove(occupant);
server.SyncLobbyClients();
var ping = server.LobbyInfo.PingFromClient(occupant);
if (ping != null)
{
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
}
else
{
var occupantConn = server.Conns.FirstOrDefault(c => c.PlayerIndex == occupant.Index);
if (occupantConn != null)
{
server.SendOrderTo(occupantConn, "ServerError", "Your slot was closed by the host.");
server.DropClient(occupantConn);
}
}
}
server.LobbyInfo.Slots[s].Closed = true;
server.SyncLobbySlots();
return true;
}
},
{ "slot_open",
s =>
{
if (!ValidateSlotCommand(server, conn, client, s, true))
return false;
var slot = server.LobbyInfo.Slots[s];
slot.Closed = false;
server.SyncLobbySlots();
// Slot may have a bot in it
var occupant = server.LobbyInfo.ClientInSlot(s);
if (occupant != null && occupant.Bot != null)
{
server.LobbyInfo.Clients.Remove(occupant);
var ping = server.LobbyInfo.PingFromClient(occupant);
if (ping != null)
{
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
}
server.SyncLobbyClients();
return true;
}
},
{ "slot_bot",
s =>
示例2: InterpretCommand
//.........这里部分代码省略.........
{ "slot_close",
s =>
{
if (!ValidateSlotCommand(server, conn, client, s, true))
return false;
// kick any player that's in the slot
var occupant = server.LobbyInfo.ClientInSlot(s);
if (occupant != null)
{
if (occupant.Bot != null)
{
server.LobbyInfo.Clients.Remove(occupant);
server.SyncLobbyClients();
var ping = server.LobbyInfo.PingFromClient(occupant);
if (ping != null)
{
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
}
else
{
var occupantConn = server.Conns.FirstOrDefault(c => c.PlayerIndex == occupant.Index);
if (occupantConn != null)
{
server.SendOrderTo(occupantConn, "ServerError", "Your slot was closed by the host.");
server.DropClient(occupantConn);
}
}
}
server.LobbyInfo.Slots[s].Closed = true;
server.SyncLobbySlots();
return true;
}
},
{ "slot_open",
s =>
{
if (!ValidateSlotCommand(server, conn, client, s, true))
return false;
var slot = server.LobbyInfo.Slots[s];
slot.Closed = false;
server.SyncLobbySlots();
// Slot may have a bot in it
var occupant = server.LobbyInfo.ClientInSlot(s);
if (occupant != null && occupant.Bot != null)
{
server.LobbyInfo.Clients.Remove(occupant);
var ping = server.LobbyInfo.PingFromClient(occupant);
if (ping != null)
{
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
}
server.SyncLobbyClients();
return true;
}
},
{ "slot_bot",
s =>
示例3: InterpretCommand
//.........这里部分代码省略.........
else
return false;
}},
{ "slot_close",
s =>
{
if (!ValidateSlotCommand(server, conn, client, s, true))
return false;
// kick any player that's in the slot
var occupant = server.LobbyInfo.ClientInSlot(s);
if (occupant != null)
{
if (occupant.Bot != null)
{
server.LobbyInfo.Clients.Remove(occupant);
server.SyncLobbyClients();
var ping = server.LobbyInfo.PingFromClient(occupant);
server.LobbyInfo.ClientPings.Remove(ping);
server.SyncClientPing();
}
else
{
var occupantConn = server.Conns.FirstOrDefault(c => c.PlayerIndex == occupant.Index);
if (occupantConn != null)
{
server.SendOrderTo(occupantConn, "ServerError", "Your slot was closed by the host");
server.DropClient(occupantConn);
}
}
}
server.LobbyInfo.Slots[s].Closed = true;
server.SyncLobbySlots();
return true;
}},
{ "slot_open",
s =>
{
if (!ValidateSlotCommand( server, conn, client, s, true ))
return false;
var slot = server.LobbyInfo.Slots[s];
slot.Closed = false;
server.SyncLobbySlots();
// Slot may have a bot in it
var occupant = server.LobbyInfo.ClientInSlot(s);
if (occupant != null && occupant.Bot != null)
{
server.LobbyInfo.Clients.Remove(occupant);
var ping = server.LobbyInfo.PingFromClient(occupant);
server.LobbyInfo.ClientPings.Remove(ping);
}
server.SyncLobbyClients();
return true;
}},
{ "slot_bot",
s =>
{
var parts = s.Split(' ');
if (parts.Length < 3)
{
server.SendOrderTo(conn, "Message", "Malformed slot_bot command");