static void lt_OnConnectionAccepted(object sender, SocketArg e) { GlobalClient gclient = new GlobalClient(e.Socket); gclient.OnAccountInfoRequest += new EventHandler<AccountInfoRequestArgs>(gclient_OnAccountInfoRequest); gclient.OnSpendCoins += Gclient_OnSpendCoins; _server.InputThread.AddConnection(gclient); }
void GlobalServerManagerThread() { while (true) { if (_gc == null || !_gc.Connected) { _gc = new GlobalClient(); _gc.OnAccountInfoResponse += OnAccountInfoResponse; _gc.Connect(_address, _port); if (_gc.Connected) LogThread.Log("Connected to global server", LogThread.LogMessageType.Normal, true); } else { _gc.Update(); } Thread.Sleep(1000); } }