Ejemplo n.º 1
0
        public void Show(GlobalManager oldgm)
        {
            gm = oldgm;
            gm.ChangeTransportWindow("Login");
            //以talk模式拦截
            gm.kh.SetHook(false);

            this.Show();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 窗口加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e) {
            gm = new GlobalManager("SearchMemory");

            //set map
            System.IO.File.Delete(gm.gameSettings.rootFolder + @"3D Entities\Level\Level_01.NMO");
            System.IO.File.Copy(Environment.CurrentDirectory + @"\TestMap.nmo", gm.gameSettings.rootFolder + @"3D Entities\Level\Level_01.NMO");

            //init
            mark = new CheatEngine();
            life = new CheatEngine();
            unit = new CheatEngine();

            measureProgress = 0;
            inputTick = 0;
            willExit = false;

            uiTestStep.Text = "请打开游戏第一关,按下Q跳过教程,等待2-3秒,按下Esc键,将左下角分数填入下部文本框中,按确认键";
        }
Ejemplo n.º 3
0
        private void uiNewPlay_Click(object sender, RoutedEventArgs e)
        {
            gm.kh.UnHook();

            var newWin = new Login();
            var newgm = new GlobalManager("Login");
            newgm.SetMonitor(gm.markMonitor, gm.lifeMonitor, gm.unitMonitor);
            newWin.Show(newgm);

            this.Close();
        }
Ejemplo n.º 4
0
        public void Show(GlobalManager oldgm)
        {
            gm = oldgm;
            gm.ChangeTransportWindow("GameResult");

            //set team name and shadow
            uiTeamAName.Text = gm.ms.TeamAName;
            uiTeamBName.Text = gm.ms.TeamBName;

            uiGameMapName.Text = gm.ms.MapName;
            switch (gm.ms.GameMode) {
                case BallanceOnline.Const.GameMode.RankedRace:
                    uiGameMode.Text = "排位赛";
                    break;
                case BallanceOnline.Const.GameMode.RelayRace:
                    uiGameMode.Text = "接力赛";
                    break;
            }
            switch (gm.ms.CountMode) {
                case BallanceOnline.Const.CountMode.HighScore:
                    uiGameRule.Text = "HS";
                    break;
                case BallanceOnline.Const.CountMode.SpeedRun:
                    uiGameRule.Text = "SR";
                    break;
                case BallanceOnline.Const.CountMode.CrazyHighScore:
                    uiGameRule.Text = "疯狂HS";
                    break;
                case BallanceOnline.Const.CountMode.CrazySpeedRun:
                    uiGameRule.Text = "疯狂SR";
                    break;

            }

            //以talk模式拦截
            gm.kh.UnHook();
            gm.kh.SetHook(false);

            gm.GameResult_allPlayerData = new Action<StringGroup>(allPlayerData);

            this.Show();
        }
        public void Show(GlobalManager oldgm)
        {
            gm = oldgm;
            gm.ChangeTransportWindow("LoadResources");

            gm.LoadResources_addPlayerInformation = new Action<StringGroup>(addPlayerInformation);
            gm.LoadResources_singlePlayerReady = new Action<string>(singlePlayerReady);
            gm.LoadResources_turnToNewWindow = new Action(turnToNewWindow);

            //以talk模式拦截-拦过了,继承拦截
            //gm.kh.SetHook(false);

            this.Show();
        }
Ejemplo n.º 6
0
        public void Show(GlobalManager oldgm)
        {
            gm = oldgm;
            gm.ChangeTransportWindow("PlayNow");

            //set team name and shadow
            uiTeamAName.Text = gm.ms.TeamAName;
            uiTeamBName.Text = gm.ms.TeamBName;

            string myself = "";
            foreach (Player item in gm.gamePlayerList) {
                if (item.PlayerName == gm.gameSettings.playerName) { myself = item.PlayerGroupName; break; }
            }

            if (myself == gm.ms.TeamAName) {
                uiTeamAShadow.Color = Color.FromArgb(255, 0, 0, 255);
                uiTeamBShadow.Color = Color.FromArgb(255, 255, 0, 0);
            } else {
                uiTeamAShadow.Color = Color.FromArgb(255, 255, 0, 0);
                uiTeamBShadow.Color = Color.FromArgb(255, 0, 0, 255);
            }

            //以talk模式拦截-拦过了,继承拦截
            //gm.kh.SetHook(false);

            gm.PlayNow_inputPlayerData = new Action<StringGroup>(inputPlayerData);
            gm.PlayNow_playerDied = new Action<string>(playerDied);
            gm.PlayNow_playerSuccess = new Action<string>(playerSuccess);
            gm.PlayNow_teamDied = new Action<string>(teamDied);
            gm.PlayNow_turnToNewWindow = new Action(turnToNewWindow);
            gm.PlayNow_newMessage = new Action<string>(newMessage);

            //show player
            var playerSplit = from item in gm.gamePlayerList
                              where item.PlayerGroupName != ""
                              group item by item.PlayerGroupName;
            foreach (var item in playerSplit) {
                if (item.Key == gm.ms.TeamAName) {
                    uiTeamAList.ItemsSource = item.ToList<Player>();
                } else {
                    uiTeamBList.ItemsSource = item.ToList<Player>();
                }
            }

            stopTurnIn = false;
            stopShowPrize = false;
            talkList = new List<TalkListItem>();
            prizeLine = new Queue<PrizeStructure>();

            this.Show();

            //数据传输的操作
            Task.Run(async () =>
               {

               SpeechSynthesizer speakStart = new SpeechSynthesizer();
               speakStart.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);

               uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = "20"; });

               //显示欢迎来到
               uiNoticeText.Dispatcher.Invoke(() => { uiNoticeText.Text = "欢迎来到Ballance的世界"; });
               speakStart.SpeakAsync("欢迎来到Ballance的世界");

               for (int i = 0; i < 5; i++) {
                   Thread.Sleep(1000);
                   uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = (int.Parse(uiTimer.Text) - 1).ToString(); });
               }

               //此时=15
               //显示负责的关卡
               foreach (Player item in gm.gamePlayerList) {
                   if (item.PlayerName == gm.gameSettings.playerName) {
                       uiNoticeText.Dispatcher.Invoke(() => { uiNoticeText.Text = "你的任务:完成" + item.DutyUnitToString + "小节,请在这些小节好好表现"; });
                       speakStart.SpeakAsync("鼓足干劲,力争上游");
                   }
               }

               for (int i = 0; i < 10; i++) {
                   Thread.Sleep(1000);
                   uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = (int.Parse(uiTimer.Text) - 1).ToString(); });
               }

               //此时=5
               //准备开始
               uiNoticeText.Dispatcher.Invoke(() => { uiNoticeText.Text = "请就绪"; });
               speakStart.SpeakAsync("还有五秒开始游戏");

               for (int i = 0; i < 5; i++) {
                   Thread.Sleep(1000);
                   uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = (int.Parse(uiTimer.Text) - 1).ToString(); });
               }

               //隐藏
               uiTimerContainer.Dispatcher.Invoke(() => { uiTimerContainer.Visibility = Visibility.Collapsed; });
               //全军出击
               uiNoticeText.Dispatcher.Invoke(() => { uiNoticeText.Text = ""; });
               uiNotice.Dispatcher.Invoke(() => { uiNotice.Visibility = Visibility.Hidden; });
               speakStart.SpeakAsync("全军出击");

               //提交循环
               long previousMark = 1000;
               int similarityCount = 20;
               //是否达到极限溢出了
               bool overCount = false;
               while (true) {

                   if (stopTurnIn == true) { break; }

                   long mark = gm.markMonitor.Mode(await gm.markMonitor.ReadDataAsync());
                   long life = gm.lifeMonitor.Mode(await gm.lifeMonitor.ReadDataAsync());
                   long unit = gm.unitMonitor.Mode(await gm.unitMonitor.ReadDataAsync());

                   gm.dataGiveIn.SendData(CombineAndSplitSign.Combine(BallanceOnline.Const.ClientAndServerSign.Client, BallanceOnline.Const.SocketSign.GameDataTurnIn, mark.ToString() + "," + life.ToString() + "," + unit.ToString()));

                   //如果有相同情况出现,提醒警告
                   if (overCount == false) {
                       if (previousMark == mark) {
                           similarityCount--;
                           //检查超限
                           if (similarityCount < 0) {
                               uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = ""; });
                               uiTimerContainer.Dispatcher.Invoke(() => { uiTimerContainer.Visibility = Visibility.Collapsed; });
                               overCount = true;
                           } else {
                               uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = similarityCount.ToString(); });
                               uiTimerContainer.Dispatcher.Invoke(() => { uiTimerContainer.Visibility = Visibility.Visible; });
                           }

                       } else {
                           if (similarityCount != 20) {
                               similarityCount = 20;
                               uiTimer.Dispatcher.Invoke(() => { uiTimer.Text = ""; });
                               uiTimerContainer.Dispatcher.Invoke(() => { uiTimerContainer.Visibility = Visibility.Collapsed; });
                           }
                       }
                   }

                   previousMark = mark;

                   Thread.Sleep(1000);

               }

               speakStart.Dispose();

               //结束

               });

            //显示成就的操作
            Task.Run(() =>
            {
                while (true) {
                    if (stopShowPrize == true) { break; }
                    if (prizeLine.Count == 0) { Thread.Sleep(500); continue; }

                    //展示
                    var cache = prizeLine.Dequeue();
                    string sayWord = "";
                    string showWord = cache.PlayerName + " ";

                    switch (cache.PrizeName) {
                        case GamePrize.FirstBlood:
                            showWord += GamePrize.FirstBloodShow;
                            sayWord = GamePrize.FirstBloodSpeech;
                            break;
                        case GamePrize.Reborn:
                            showWord += GamePrize.RebornShow;
                            sayWord = GamePrize.RebornSpeech;
                            break;
                        case GamePrize.Silence:
                            showWord += GamePrize.SilenceShow;
                            sayWord = GamePrize.SilenceSpeech;
                            break;
                        case GamePrize.Time:
                            showWord += GamePrize.TimeShow;
                            sayWord = GamePrize.TimeSpeech;
                            break;
                        case GamePrize.Ace:
                            showWord += GamePrize.AceShow;
                            sayWord = GamePrize.AceSpeech;
                            break;
                    }

                    //show
                    uiNoticeText.Dispatcher.Invoke(() =>
                    {
                        uiNoticeText.Text = showWord;
                    });
                    uiNotice.Dispatcher.Invoke(() =>
                    {
                        uiNotice.Visibility = Visibility.Visible;
                    });

                    //say
                    SpeechSynthesizer speak = new SpeechSynthesizer();
                    speak.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);
                    speak.Speak(sayWord);
                    speak.Dispose();

                    //hide
                    uiNotice.Dispatcher.Invoke(() =>
                    {
                        uiNotice.Visibility = Visibility.Visible;
                    });
                }

            });
        }
Ejemplo n.º 7
0
        public void Show(GlobalManager oldgm, ref TcpClient tc)
        {
            gm = oldgm;
            gm.ChangeTransportWindow("WaitPlayer");

            //set client
            gm.dataGiveIn = new GameData(ref tc, gm.dataProcess);

            gm.WaitPlayer_addAllPlayer = new Action<StringGroup>(addAllPlayer);
            gm.WaitPlayer_addSinglePlayer = new Action<string>(addSinglePlayer);
            gm.WaitPlayer_newMessage = new Action<string>(newMessage);
            gm.WaitPlayer_turnToNewWindow = new Action(turnToNewWindow);
            //以talk模式拦截-拦过了,继承拦截
            //gm.kh.SetHook(false);
            uiPlayerList.ItemsSource = gm.gamePlayerList;
            talkList = new List<TalkListItem>();
            uiTalkList.ItemsSource = talkList;

            this.Show();
        }