Ejemplo n.º 1
0
        public GlobalManager()
        {
            clientPlayerList = new List<Player>();
            stopPing = false;
            ms = new MapSetting();
            globalPrize = new GlobalPrizeLog();
            nowFinishPlayerCount = 0;

            //自动ping
            //Task.Run(() =>
            //{

            //    while (true) {

            //        if (stopPing == true) { break; }

            //        if (clientPlayerList.Count != 0) {
            //            foreach (Player item in clientPlayerList) {

            //                if (item.PingCount > 4) {
            //                    //超时,掉线
            //                    pingOut(item.PlayerIPAddress, item);
            //                    continue;
            //                }

            //                item.gameData.SendData(CombineAndSplitSign.Combine(ClientAndServerSign.Server, SocketSign.Ping, ""));
            //                item.PingCount++;
            //            }
            //        }

            //        System.Threading.Thread.Sleep(60000);
            //    }

            //});
        }
Ejemplo n.º 2
0
        public GlobalManager(string needWindow)
        {
            //window
            needTransportWindowTitle = needWindow;
            transportWindowFlag = true;

            Thread windowT = new Thread(new ThreadStart(() => {

                while (true) {

                    try {
                        int x, y, width, height;
                        FindBallanceWindow.GetWindow(out x, out y, out width, out height);

                        var aaa = Win32.SetWindowPos(Win32.FindWindow(null, needTransportWindowTitle), Win32.HWND_TOPMOST, x, y, width, height, Win32.SWP_NOZORDER);

                    } catch (Exception ex) {
                        //没进程
                    }

                    Thread.Sleep(1000);
                }

            }));
            windowT.IsBackground = true;
            windowT.Start();

            gameSettings = new GameSettings();
            gameSettings.Update();

            kh = new Hook();

            gamePlayerList = new List<Player>();
            df = new DownloadFile();
            ms = new MapSetting();
        }