コード例 #1
0
 public void Add(JoinQueue item)
 {
     myItems.Add(item);
 }
コード例 #2
0
        internal void PingElapsed(object sender, ElapsedEventArgs e)
        {
            //TeambuilderCorrect();

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                var keys = new List<Button>(ButtonTimers.Keys);
                foreach (Button pair in keys)
                {
                    ButtonTimers[pair]++;
                    TimeSpan time = TimeSpan.FromSeconds(ButtonTimers[pair]);
                    var realButton = (Button) pair.Tag;
                    realButton.Content = string.Format("{0:D2}:{1:D2} Re-Click To Leave", time.Minutes, time.Seconds);
                }
            }));
            if (i++ < 10) //Ping every 10 seconds
                return;

            i = 0;
            if (!Client.IsOnPlayPage)
                return;

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async () =>
            {
                if (!RunOnce)
                {
                    RunOnce = true;
                    WaitingForQueues.Visibility = Visibility.Visible;
                    for (int b = 0; b < 3; b++)
                    {
                        seperators[b] = new GameSeperator(QueueListView)
                        {
                            Height = 80
                        };
                        switch (b)
                        {
                            case 0:
                                seperators[b].QueueLabel.Content = "Bot Queues";
                                seperators[b].Tag = "Bot";
                                break;
                            case 1:
                                seperators[b].QueueLabel.Content = "Normal Queues";
                                seperators[b].Tag = "Normal";
                                break;
                            case 2:
                                seperators[b].QueueLabel.Content = "Ranked Queues";
                                seperators[b].Tag = "Ranked";
                                break;
                        }
                        QueueListView.Items.Add(seperators[b]);
                    }

                    //Ping
                    var bc = new BrushConverter();
                    Brush brush = null;
                    try
                    {
                        double pingAverage = HighestPingTime(Client.Region.PingAddresses);
                        PingLabel.Content = Math.Round(pingAverage) + "ms";
                        if (pingAverage == 0)
                            PingLabel.Content = "Timeout";

                        if (pingAverage == -1)
                            PingLabel.Content = "Ping not enabled for this region";                        
                        
                        if (pingAverage > 999 || pingAverage < 1)
                            brush = (Brush)bc.ConvertFrom("#FFFF6767");
                        
                        if (pingAverage > 110 && pingAverage < 999)
                            brush = (Brush)bc.ConvertFrom("#FFFFD667");
                        
                        if (pingAverage < 110 && pingAverage > 1)
                            brush = (Brush)bc.ConvertFrom("#FF67FF67");

                    } catch(NotImplementedException ex)
                    {
                        PingLabel.Content = "Ping not enabled for this region";
                        brush = (Brush)bc.ConvertFrom("#FFFF6767");
                        Client.Log(ex.Message);
                    } catch(Exception ex)
                    {
                        PingLabel.Content = "Error occured while pinging";
                        brush = (Brush)bc.ConvertFrom("#FFFF6767");
                        Client.Log(ex.Message);
                    }
                    finally
                    {
                        PingRectangle.Fill = brush;
                    }
                    //Queues
                    GameQueueConfig[] openQueues = Client.Queues;
                    Array.Sort(openQueues,
                        (config, config2) =>
                            string.Compare(config.CacheName, config2.CacheName, StringComparison.Ordinal));
                    foreach (GameQueueConfig config in openQueues)
                    {
                        QueueButtonConfig settings = new QueueButtonConfig();
                        settings.GameQueueConfig = config;

                        if(config.CacheName.Contains("INTRO"))
                            settings.BotLevel = "INTRO";
                        else if (config.CacheName.Contains("EASY") || config.Id == 25 || config.Id == 52)
                            settings.BotLevel = "EASY";
                        else if (config.CacheName.Contains("MEDIUM"))
                            settings.BotLevel = "MEDIUM";

                        var item = new JoinQueue
                        {
                            Height = 80,
                            QueueButton = {Tag = settings}
                        };
                        
                        item.QueueButton.Click += QueueButton_Click;
                        //item.QueueButton.IsEnabled = false;
                        item.QueueButton.Content = "Queue (Beta)";
                        item.TeamQueueButton.Tag = settings;
                        item.TeamQueueButton.Click += TeamQueueButton_Click;
                        item.QueueLabel.Content = Client.InternalQueueToPretty(config.CacheName);
                        item.QueueId = config.Id;
                        QueueInfo t = await RiotCalls.GetQueueInformation(config.Id);
                        item.AmountInQueueLabel.Content = "People in queue: " + t.QueueLength;
                        TimeSpan time = TimeSpan.FromMilliseconds(t.WaitTime);
                        string answer = string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds);
                        item.WaitTimeLabel.Content = "Avg Wait Time: " + answer;
                        if (config.TypeString == "BOT" || config.TypeString == "BOT_3x3")
                            seperators[0].Add(item);
                        else if (config.TypeString.StartsWith("RANKED_"))
                            seperators[2].Add(item);
                        else
                            seperators[1].Add(item);

                        switch (Client.InternalQueueToPretty(config.CacheName))
                        {
                            case "Teambuilder 5v5 Beta (In Dev. Do Not Play)":
                                item.QueueButton.IsEnabled = false;
                                //item.TeamQueueButton.IsEnabled = false;
                                break;
                            case "Ranked Team 5v5":
                                item.QueueButton.IsEnabled = false;
                                break;
                            case "Ranked Team 3v3":
                                item.QueueButton.IsEnabled = false;
                                break;
                        }

                        if (item.QueueId == 25 || item.QueueId == 52)   //TT and Dominion: easy and medium bots have the same QueueId
                        {
                            settings.BotLevel = "MEDIUM";
                            var item2 = new JoinQueue
                            {
                                Height = 80,
                                QueueButton = { Tag = settings }
                            };
                            item2.QueueButton.Click += QueueButton_Click;
                            item2.QueueButton.Content = "Queue (Beta)";
                            item2.TeamQueueButton.Tag = settings;
                            item2.TeamQueueButton.Click += TeamQueueButton_Click;
                            item2.QueueId = config.Id;
                            item2.QueueLabel.Content = item.QueueLabel.Content.ToString().Replace("Easy", "Medium");
                            item2.AmountInQueueLabel.Content = "People in queue: " + t.QueueLength;
                            item2.WaitTimeLabel.Content = "Avg Wait Time: " + answer;

                            seperators[0].Add(item2);

                            if(!Client.Dev)
                                item2.QueueButton.IsEnabled = false;
                        }
                        
                        currentAmount++;
                        if (currentAmount != openQueues.Length)
                            continue;

                        WaitingForQueues.Visibility = Visibility.Hidden;
                        foreach (GameSeperator seperator in seperators)
                            seperator.UpdateLabels();

                        DoneLoading = true;
                    }
                }
                else if (seperators[seperators.Length - 1] != null)
                    foreach (GameSeperator seperator in seperators)
                        seperator.UpdateLabels();
            }));
        }
コード例 #3
0
 private void TeambuilderCorrect()
 {
     JoinQueue item = new JoinQueue();
     if (item.QueueLabel.Content == "matching-queue-GROUPFINDER-5x5-game-queue")
     {
          item.TeamQueueButton.Visibility = Visibility.Hidden;
          item.QueueButton.Visibility = Visibility.Hidden;
          item.QueueLabel.Content = "Team Builder";
          item.AmountInQueueLabel.Visibility = Visibility.Hidden;
          item.WaitTimeLabel.Visibility = Visibility.Hidden;
     }
 }
コード例 #4
0
        internal void PingElapsed(object sender, ElapsedEventArgs e)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                var keys = new List<Button>(ButtonTimers.Keys);
                foreach (Button pair in keys)
                {
                    ButtonTimers[pair] = ButtonTimers[pair] + 1;
                    TimeSpan time = TimeSpan.FromSeconds(ButtonTimers[pair]);
                    Button realButton = (Button)pair.Tag;
                    realButton.Content = string.Format("{0:D2}:{1:D2}", time.Minutes, time.Seconds);
                }
            }));
            if (i++ < 10) //Ping every 10 seconds
                return;
            i = 0;
            if (!Client.IsOnPlayPage)
                return;
            double PingAverage = HighestPingTime(Client.Region.PingAddresses);
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async () =>
            {
                //Ping
                PingLabel.Content = Math.Round(PingAverage).ToString() + "ms";
                if (PingAverage == 0)
                {
                    PingLabel.Content = "Timeout";
                }
                if (PingAverage == -1)
                {
                    PingLabel.Content = "Ping not enabled for this region";
                }
                BrushConverter bc = new BrushConverter();
                Brush brush = (Brush)bc.ConvertFrom("#FFFF6767");
                if (PingAverage > 999 || PingAverage < 1)
                {
                    PingRectangle.Fill = brush;
                }
                brush = (Brush)bc.ConvertFrom("#FFFFD667");
                if (PingAverage > 110 && PingAverage < 999)
                {
                    PingRectangle.Fill = brush;
                }
                brush = (Brush)bc.ConvertFrom("#FF67FF67");
                if (PingAverage < 110 && PingAverage > 1)
                {
                    PingRectangle.Fill = brush;
                }

                //Queues
                GameQueueConfig[] OpenQueues = await Client.PVPNet.GetAvailableQueues();
                Array.Sort(OpenQueues, delegate(GameQueueConfig config, GameQueueConfig config2)
                {
                    return config.CacheName.CompareTo(config2.CacheName);
                });
                foreach (GameQueueConfig config in OpenQueues)
                {
                    JoinQueue item = new JoinQueue();
                    if (configs.ContainsKey(config.Id))
                    {
                        item = configs[config.Id];
                    }
                    item.Height = 80;
                    item.QueueButton.Tag = config;
                    item.QueueButton.Click += QueueButton_Click;
                    item.QueueLabel.Content = Client.InternalQueueToPretty(config.CacheName);
                    QueueInfo t = await Client.PVPNet.GetQueueInformation(config.Id);
                    item.AmountInQueueLabel.Content = "People in queue: " + t.QueueLength;
                    TimeSpan time = TimeSpan.FromMilliseconds(t.WaitTime);
                    string answer = string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds);
                    item.WaitTimeLabel.Content = "Avg Wait Time: " + answer;
                    if (!configs.ContainsKey(config.Id))
                    {
                        configs.Add(config.Id, item);
                        QueueListView.Items.Add(item);
                    }
                }
            }));
        }
コード例 #5
0
 public void Add(JoinQueue item)
 {
     myItems.Add(item);
 }