本文整理汇总了C#中GameServer.Start方法的典型用法代码示例。如果您正苦于以下问题:C# GameServer.Start方法的具体用法?C# GameServer.Start怎么用?C# GameServer.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameServer
的用法示例。
在下文中一共展示了GameServer.Start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
var settings = ReadSettings(Program.Location + "Settings.xml");
Console.WriteLine("Name: " + settings.Name);
Console.WriteLine("Port: " + settings.Port);
Console.WriteLine("Player Limit: " + settings.MaxPlayers);
Console.WriteLine("Starting...");
ServerInstance = new GameServer(settings.Port, settings.Name, settings.Gamemode);
ServerInstance.PasswordProtected = settings.PasswordProtected;
ServerInstance.Password = settings.Password;
ServerInstance.AnnounceSelf = settings.Announce;
ServerInstance.MasterServer = settings.MasterServer;
ServerInstance.MaxPlayers = settings.MaxPlayers;
ServerInstance.AllowDisplayNames = settings.AllowDisplayNames;
ServerInstance.Start(settings.Filterscripts);
Console.WriteLine("Started! Waiting for connections.");
while (true)
{
ServerInstance.Tick();
System.Threading.Thread.Sleep(10); // Reducing CPU Usage (Win7 from average 15 % to 0-1 %, Linux from 100 % to 0-2 %)
}
}
示例2: Main
static void Main(string[] args)
{
var settings = ReadSettings(Program.Location + "Settings.xml");
Console.WriteLine("Name: " + settings.Name);
Console.WriteLine("Port: " + settings.Port);
Console.WriteLine("Player Limit: " + settings.MaxPlayers);
Console.WriteLine("Starting...");
ServerInstance = new GameServer(settings.Port, settings.Name, settings.Gamemode);
ServerInstance.PasswordProtected = settings.PasswordProtected;
ServerInstance.Password = settings.Password;
ServerInstance.AnnounceSelf = settings.Announce;
ServerInstance.MasterServer = settings.MasterServer;
ServerInstance.MaxPlayers = settings.MaxPlayers;
ServerInstance.Start(settings.Filterscripts);
Console.WriteLine("Started! Waiting for connections.");
while (true)
{
ServerInstance.Tick();
}
}
示例3: Initialize
protected override void Initialize()
{
if (AppSettings.Default.EnableServer)
{
GameServer server = new GameServer(new MapGenerator().Generate(30, 16), AppSettings.Default.ListenPort);
server.Start();
}
ApplyGraphicsSettings();
base.Initialize();
}
示例4: Main
static void Main(string[] args)
{
GameServer server = new GameServer();
server.Start();
}