コード例 #1
0
 public void Stop()
 {
     StopVote();
     spring.ExitGame();
     tas.ChangeMyStatus(false, false);
     tas.LeaveBattle();
 }
コード例 #2
0
        public void Stop()
        {
            Trace.TraceInformation("Closing current battle");
            isVisible = false;
            client.LeaveBattle();

            Program.NotifySection.RemoveBar(this);
        }
コード例 #3
0
        public void Stop()
        {
            Trace.TraceInformation("Closing current battle");
            isVisible = false;
            client.LeaveBattle();

            Program.NotifySection.RemoveBar(this);
            NavigationControl.Instance.Path = "battles";
        }
コード例 #4
0
 public void Stop()
 {
     StopVote();
     //if (unsyncKicker != null) unsyncKicker.Close();
     //unsyncKicker = null;
     spring.ExitGame();
     tas.ChangeMyStatus(false, false);
     tas.LeaveBattle();
 }
コード例 #5
0
 public void Stop()
 {
     if (manager != null)
     {
         manager.Stop();
     }
     StopVote();
     spring.ExitGame();
     tas.ChangeMyStatus(false, false);
     tas.LeaveBattle();
 }
コード例 #6
0
        public void RunNub(int num)
        {
            var tas = new TasClient("Nubotron");

            var maps = AutoRegistrator.RegistratorRes.campaignMaps.Split('\n');
            var name = "TestNub" + num;
            var ord  = num / 16;

            //tas.Input += (sender, args) => { Console.WriteLine(" < {0}", args); };
            //tas.Output += (sender, args) => { Console.WriteLine(" > {0}", args); };

            tas.Connected += (sender, args) =>
            {
                tas.Login(name, "dummy");
            };

            tas.ConnectionLost += (sender, args) => { tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort); Console.WriteLine("disconnected"); };


            tas.LoginAccepted += (sender, args) => { Console.WriteLine(name + " accepted"); };
            tas.LoginDenied   += (sender, args) => { tas.Register(name, "dummy"); };

            tas.RegistrationAccepted += (sender, args) => { tas.Login(name, "dummy"); };
            tas.RegistrationDenied   += (sender, response) => { Console.WriteLine(name + "registration denied"); };



            tas.Connect(GlobalConst.LobbyServerHost, GlobalConst.LobbyServerPort);

            Task.Factory.StartNew(async() =>
            {
                while (true)
                {
                    await Task.Delay(rand.Next(10000));
                    if (tas.IsLoggedIn)
                    {
                        await tas.LeaveBattle();
                        if (tas.ExistingBattles.Count < 20)
                        {
                            await tas.OpenBattle(new BattleHeader()
                            {
                                Title      = "" + name,
                                MaxPlayers = 16,
                                Mode       = AutohostMode.None,
                                Engine     = tas.ServerWelcome.Engine,
                                Game       = tas.ServerWelcome.Game,
                                Map        = maps[rand.Next(maps.Length)],
                            });
                        }
                        else
                        {
                            var bats = tas.ExistingBattles.Values.ToList();
                            if (bats.Count > 0)
                            {
                                var bat = bats[rand.Next(bats.Count)];
                                if (bat != null)
                                {
                                    tas.JoinBattle(bat.BattleID);
                                }
                            }
                        }
                    }
                }
            }, TaskCreationOptions.LongRunning);


            Task.Factory.StartNew(async() =>
            {
                while (true)
                {
                    await Task.Delay(rand.Next(50000));
                    if (tas.IsLoggedIn)
                    {
                        tas.Say(SayPlace.Channel, "zk", sent.GetNext(), false);
                    }
                }
            }, TaskCreationOptions.LongRunning);

            Task.Factory.StartNew(async() =>
            {
                bool cycler = false;
                while (true)
                {
                    await Task.Delay(rand.Next(5000));
                    if (tas.IsLoggedIn)
                    {
                        await tas.ChangeMyUserStatus(cycler, cycler);
                        //await tas.ChangeMyBattleStatus(cycler, SyncStatuses.Synced, 1);
                        cycler = !cycler;
                    }
                }
            }, TaskCreationOptions.LongRunning);
        }