当前位置: 首页>>代码示例>>C#>>正文


C# Server.SyncLobbySlots方法代码示例

本文整理汇总了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 =>
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:67,代码来源:LobbyCommands.cs

示例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 =>
开发者ID:CH4Code,项目名称:OpenRA,代码行数:67,代码来源:LobbyCommands.cs

示例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");
开发者ID:Berzeger,项目名称:OpenRA,代码行数:67,代码来源:LobbyCommands.cs


注:本文中的OpenRA.Server.Server.SyncLobbySlots方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。