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


C# GameServer.Start方法代码示例

本文整理汇总了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 %)
            }
        }
开发者ID:butich,项目名称:GTACoop,代码行数:27,代码来源:Program.cs

示例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();
            }
        }
开发者ID:Mercurial,项目名称:GTACoop,代码行数:25,代码来源:Program.cs

示例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();
        }
开发者ID:NobodysNightmare,项目名称:BlockDefender,代码行数:11,代码来源:BlockDefenderGame.cs

示例4: Main

 static void Main(string[] args)
 {
     GameServer server = new GameServer();
     server.Start();
 }
开发者ID:manyxu,项目名称:UnitySampleSimpleServer,代码行数:5,代码来源:Program.cs


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