YGOSharp.CoreServer.Tick C# (CSharp) Method

Tick() public method

public Tick ( ) : void
return void
        public void Tick()
        {
            _listener.Update();

            List<YGOClient> disconnectedClients = new List<YGOClient>();

            foreach (YGOClient client in _clients)
            {
                client.Update();
                if (!client.IsConnected)
                {
                    disconnectedClients.Add(client);
                }
            }

            Game.TimeTick();

            while (disconnectedClients.Count > 0)
            {
                _clients.Remove(disconnectedClients[0]);
                disconnectedClients.RemoveAt(0);
            }

            if (_closePending && _clients.Count == 0)
                Stop();
        }

Usage Example

Beispiel #1
0
        public static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif
            Config.Load(args);

            BanlistManager.Init(Config.GetString("BanlistFile", "lflist.conf"));
            Api.Init(Config.GetString("RootPath", "."), Config.GetString("ScriptDirectory", "script"), Config.GetString("DatabaseFile", "cards.cdb"));

            ClientVersion = Config.GetUInt("ClientVersion", ClientVersion);

            CoreServer server = new CoreServer();
            server.Start();
            while (server.IsRunning)
            {
                server.Tick();
                Thread.Sleep(1);
            }
#if !DEBUG
        }

        catch (Exception ex)
        {
            File.WriteAllText("crash_" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss") + ".txt", ex.ToString());
        }
#endif
        }
All Usage Examples Of YGOSharp.CoreServer::Tick