private void RunMatchingGroup(int GroupIndex)
        {
            if (GroupIndex >= mTestMatchingBUserGroups.Count)
            {
                return;
            }

            List <StressTest_MatchingUser> TestUsers = mTestMatchingBUserGroups[GroupIndex];

            for (int i = 0; i < TestUsers.Count; i++)
            {
                StressTest_MatchingUser user = TestUsers[i];
                PrintStatus(0, "Send RequestGameMatchCmd ID = {0}", user.m_LoginID);
                user.m_Game.RequestGameMatchCmd(0, 4, (byte)PlayerRole.None);

                mTestGroupStatus[user.GroupID].mGameMatchSendCount++;
                mMainStatus.mGameMatchSendCount++;
            }

            UpdateMatchingTestStatueUI();
        }
        // Matching Test..
        public void StartTest(bool bAutoClick, int ClickIndex)
        {
            string PreFixUserID = MainWindow.Instance.PreFixUserID.Text.Trim();

            if (string.IsNullOrEmpty(PreFixUserID))
            {
                MessageBox.Show("Enter valid PreFixUserID");
                return;
            }

            int MaxConnectionUser = Convert.ToInt32(MainWindow.Instance.MatchKBMaxUserNumber.Text);

            if (MaxConnectionUser > MaxUser)
            {
                MessageBox.Show(string.Format("{0} users limit!!", MaxUser));
                return;
            }

            int PrefixStartID = Convert.ToInt32(MainWindow.Instance.UserBeginIdNum.Text);

            if (PrefixStartID <= 0)
            {
                MessageBox.Show("Enter valid StartID!! be Higher than Zero");
                return;
            }

            if (bAutoClick == false)
            {
                mReTryCount       = 0;
                mFailedReTryCount = 0;

                IsAutoTest = MainWindow.Instance.TestMatcingAutoCheck.IsChecked == true;

                MainWindow.Instance.buttonManual_Matcing.IsEnabled  = false;
                MainWindow.Instance.buttonManual_Matcing.Visibility = Visibility.Hidden;
            }

            if (bAutoClick == true && ClickIndex == 1)
            {
                PrintStatus(1, "ReTry Matcing Test!!");
            }

            if (bAutoClick == true && ClickIndex == 2)
            {
                mFailedReTryCount++;
            }


            CloseAllConnections();
            mCurrectMaxUser = MaxConnectionUser;

            InitStatusValue();
            UpdateMatchingTestStatueUI();

            MainWindow.Instance.textOutput2.Text = string.Empty;

            var StresssTestGameID = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Match);

            for (int i = 0; i < MaxConnectionUser; i++)
            {
                StressTest_MatchingUser TestMatchingUser = new StressTest_MatchingUser();
                TestMatchingUser.InitEngine();
                TestMatchingUser.SetPrintHanlde(PrintStatus);

                TestMatchingUser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);
                TestMatchingUser.gameID    = StresssTestGameID;
                mTestMatchingBUsers.Add(TestMatchingUser);
            }

            ServerAddressRegistry.SaveGameID(1, StresssTestGameID);
            mServerAddress = MainWindow.Instance.GetServerAddressFromUI(1, MainWindow.Instance.stress_comboBoxIPAddress,
                                                                        () =>
            {
                MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1));
            });


            CreateGroup();


            RunConnectGroup(0, mServerAddress);

            m_MatchingTestTimer       = new DispatcherTimer();
            m_MatchingTestTimer.Tick += new EventHandler(
                (object ts, EventArgs te) =>
            {
                for (int i = 0; i < mTestMatchingBUsers.Count; i++)
                {
                    mTestMatchingBUsers[i].OnTimerTick(UpdateTick);
                }

                if (IsAutoTest)
                {
                    if (IsProgressFailed() && MainWindow.Instance.InfiniteReTryFailedRepeatCheck_Match.IsChecked == true)
                    {
                        mCurDealyReTryTime += UpdateTick;

                        if (mCurDealyReTryTime >= 1000)
                        {
                            mCurDealyReTryTime = 0;
                            mTickCount++;
                            PrintStatus(1, "Plz ReTry Test!! {0}..", 3 - mTickCount);
                            if (mTickCount >= 3)
                            {
                                this.StartTest(true, 2);
                            }
                        }
                    }
                }
                else
                {
                    if (mMainStatus.mGameJoinUserCount == mTestMatchingBUsers.Count)
                    {
                        bool bJonedUser = false;

                        for (int i = 0; i < mTestMatchingBUsers.Count; i++)
                        {
                            if (mTestMatchingBUsers[i].m_JoinedGameUID != 0)
                            {
                                bJonedUser = true;
                                break;
                            }
                        }

                        if (bJonedUser)
                        {
                            return;
                        }

                        if (mbStartSend)
                        {
                            return;
                        }

                        MainWindow.Instance.buttonManual_Matcing.IsEnabled  = true;
                        MainWindow.Instance.buttonManual_Matcing.Visibility = Visibility.Visible;
                    }
                }
            });

            m_MatchingTestTimer.Interval = new TimeSpan(0, 0, 0, 0, UpdateTick);
            m_MatchingTestTimer.Start();
        }
示例#3
0
        // Matching Test..
        public void StartTest(bool bAutoClick, int ClickIndex)
        {
            string PreFixUserID = MainWindow.Instance.PreFixUserID.Text.Trim();

            if (string.IsNullOrEmpty(PreFixUserID))
            {
                MessageBox.Show("Enter valid PreFixUserID");
                return;
            }

            int MaxConnectionUser = Convert.ToInt32(MainWindow.Instance.MatchKBMaxUserNumber.Text);

            if (MaxConnectionUser > MaxUser)
            {
                MessageBox.Show(string.Format("{0} users limit!!", MaxUser));
                return;
            }

            int PrefixStartID = Convert.ToInt32(MainWindow.Instance.UserBeginIdNum.Text);

            if (PrefixStartID <= 0)
            {
                MessageBox.Show("Enter valid StartID!! be Higher than Zero");
                return;
            }

            if (bAutoClick == false)
            {
                mReTryCount       = 0;
                mFailedReTryCount = 0;
                // IsAutoTest = MainWindow.Instance.TestMatcingAutoCheck.IsChecked == true;
                //  MainWindow.Instance.buttonManual_Matcing.IsEnabled = false;
                // MainWindow.Instance.buttonManual_Matcing.Visibility = Visibility.Hidden;
            }

            if (bAutoClick == true && ClickIndex == 1)
            {
                PrintStatus(1, "ReTry Matcing Test!!");
            }

            if (bAutoClick == true && ClickIndex == 2)
            {
                mFailedReTryCount++;
            }

            mTestSendDataStatus.Clear();

            CloseAllConnections();
            mCurrectMaxUser = MaxConnectionUser;

            InitStatusValue();
            UpdateMatchingTestStatueUI();

            MainWindow.Instance.textOutput2.Text = string.Empty;

            var StresssTestGameID = MainWindow.GetGameIDFromUI(MainWindow.Instance.stress_comboBoxGameID_Match);

            for (int i = 0; i < MaxConnectionUser; i++)
            {
                StressTest_MatchingUser TestMatchingUser = new StressTest_MatchingUser();
                TestMatchingUser.InitEngine();
                TestMatchingUser.SetPrintHanlde(PrintStatus);

                TestMatchingUser.m_LoginID = MakeStreesTestUserID(PrefixStartID, PreFixUserID, i);
                TestMatchingUser.gameID    = StresssTestGameID;
                mTestMatchingBUsers.Add(TestMatchingUser);
            }

            ServerAddressRegistry.SaveGameID(1, StresssTestGameID);
            mServerAddress = MainWindow.Instance.GetServerAddressFromUI(1, MainWindow.Instance.stress_comboBoxIPAddress,
                                                                        () =>
            {
                MainWindow.InitIPAdressComboBox(MainWindow.Instance.stress_comboBoxIPAddress, ServerAddressRegistry.GetServerAddresses(1));
            });


            CreateGroup();

            RunConnectGroup(0, mServerAddress);

            m_MatchingTestTimer       = new DispatcherTimer();
            m_MatchingTestTimer.Tick += new EventHandler(UpdateTickProcess);

            m_MatchingTestTimer.Interval = new TimeSpan(0, 0, 0, 0, UpdateTickTime);
            m_MatchingTestTimer.Start();
        }