Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length <= 0)
            {
                return;
            }

            hub.hub _hub = new hub.hub(args);

            players = new playermng();

            login _login = new login();

            hub.hub.modules.add_module("login", _login);

            Int64 tick      = Environment.TickCount;
            Int64 tickcount = 0;

            while (true)
            {
                Int64 tmptick = (Environment.TickCount & UInt32.MaxValue);
                if (tmptick < tick)
                {
                    tickcount += 1;
                    tmptick    = tmptick + tickcount * UInt32.MaxValue;
                }
                tick = tmptick;

                _hub.poll(tick);

                if (hub.hub.closeHandle.is_close)
                {
                    Console.WriteLine("server closed, hub server " + hub.hub.uuid);
                    break;
                }

                tmptick = (Environment.TickCount & UInt32.MaxValue);
                if (tmptick < tick)
                {
                    tickcount += 1;
                    tmptick    = tmptick + tickcount * UInt32.MaxValue;
                }
                Int64 ticktime = (tmptick - tick);
                tick = tmptick;

                if (ticktime < 50)
                {
                    Thread.Sleep(15);
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length <= 0)
            {
                return;
            }

            disable = false;

            hub.hub _hub = new hub.hub(args);

            hub.hub.gates.clientDisconnect += onClientDisconnect;

            login _login = new login();
            lobby _lobby = new lobby();
            gm    _gm    = new gm();
            agent _agent = new agent();
            match _match = new match();

            hub.hub.modules.add_module("login", _login);
            hub.hub.modules.add_module("lobby", _lobby);
            hub.hub.modules.add_module("gm", _gm);
            hub.hub.modules.add_module("agent", _agent);
            hub.hub.modules.add_module("match", _match);

            _hub.onConnectDB += () =>
            {
                players = new playermng();

                pay _pay = new pay();
                hub.hub.modules.add_module("pay", _pay);
            };

            while (true)
            {
                if (hub.hub.closeHandle.is_close)
                {
                    log.log.trace(new System.Diagnostics.StackFrame(true), service.timerservice.Tick, "server closed, hub server {0}", hub.hub.uuid);
                    break;
                }

                payUtil.tick_player_pay();

                if (_hub.poll() < 50)
                {
                    Thread.Sleep(15);
                }
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            if (args.Length <= 0)
            {
                return;
            }

            hub.hub _hub = new hub.hub(args);

            players = new playermng();

            login _login = new login();

            hub.hub.modules.add_module("login", _login);

            Int64 oldtick = 0;
            Int64 tick    = 0;

            while (true)
            {
                oldtick = tick;
                tick    = _hub.poll();

                if (hub.hub.closeHandle.is_close)
                {
                    log.log.trace(new System.Diagnostics.StackFrame(true), tick, "server closed, hub server:{0}", hub.hub.uuid);
                    break;
                }

                Int64 ticktime = (tick - oldtick);
                if (ticktime < 50)
                {
                    Thread.Sleep(15);
                }
            }
        }