private void player_MouseLeave(object sender, MouseEventArgs e)
 {
     if (PlayerItem != null)
     {
         Client.MainGrid.Children.Remove(PlayerItem);
         PlayerItem = null;
     }
 }
Exemple #2
0
 void ProfileImage_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
 {
     if (PlayerItem != null)
     {
         Client.MainGrid.Children.Remove(PlayerItem);
         PlayerItem = null;
     }
 }
Exemple #3
0
        private void img_MouseMove(object sender, MouseEventArgs e)
        {
            var icon = (SmallChampionItem)sender;
            var img  = (BitmapImage)icon.ChampionImage.Source;

            if (img == null)
            {
                return;
            }

            var playerItem = (LargeChatPlayer)icon.Tag;

            if (playerItem == null)
            {
                string[] s  = img.UriSource.Segments;
                int      id = int.Parse(s[s.Length - 1].Replace(".png", ""));
                Client.MainGrid.Children.Add(playerItem);

                items item = items.GetItem(id);

                playerItem = new LargeChatPlayer();

                playerItem.PlayerName.Content = item.name;
                playerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                playerItem.Width = playerItem.PlayerName.DesiredSize.Width > 250
                    ? playerItem.PlayerName.DesiredSize.Width
                    : 250;
                playerItem.PlayerWins.Content        = item.price + " gold (" + item.sellprice + " sell)";
                playerItem.PlayerLeague.Content      = "Item ID " + item.id;
                playerItem.LevelLabel.Content        = "";
                playerItem.UsingLegendary.Visibility = Visibility.Hidden;

                string parsedDescription = item.description;
                parsedDescription            = parsedDescription.Replace("<br>", Environment.NewLine);
                parsedDescription            = Regex.Replace(parsedDescription, "<.*?>", string.Empty);
                playerItem.PlayerStatus.Text = parsedDescription;

                playerItem.ProfileImage.Source = img;
                playerItem.HorizontalAlignment = HorizontalAlignment.Left;
                playerItem.VerticalAlignment   = VerticalAlignment.Top;
                playerItem.Visibility          = Visibility.Hidden;
                icon.Tag = playerItem;
            }

            if (playerItem.ActualHeight == 0 || playerItem.ActualWidth == 0)
            {
                return;
            }

            double yMargin = (Client.MainGrid.ActualHeight / 2) - (playerItem.ActualHeight / 2);
            double xMargin = (Client.MainGrid.ActualWidth / 2) - (playerItem.ActualWidth / 2);

            playerItem.Margin = new Thickness(xMargin, yMargin, 0, 0);
            if (playerItem.Visibility == Visibility.Hidden)
            {
                playerItem.Visibility = Visibility.Visible;
            }
        }
Exemple #4
0
        private void img_MouseLeave(object sender, MouseEventArgs e)
        {
            if (_playerItem == null)
            {
                return;
            }

            Client.MainGrid.Children.Remove(_playerItem);
            _playerItem = null;
        }
        private void img_MouseMove(object sender, MouseEventArgs e)
        {
            var item       = (Image)sender;
            var playerItem = (ProfilePage.KeyValueItem)item.Tag;

            if (PlayerItem == null)
            {
                PlayerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(PlayerItem);

                items Item = items.GetItem(Convert.ToInt32(playerItem.Value));

                PlayerItem.PlayerName.Content = Item.name;

                PlayerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                if (PlayerItem.PlayerName.DesiredSize.Width > 250) //Make title fit in item
                {
                    PlayerItem.Width = PlayerItem.PlayerName.DesiredSize.Width;
                }
                else
                {
                    PlayerItem.Width = 250;
                }

                PlayerItem.PlayerWins.Content        = Item.price + " gold (" + Item.sellprice + " sell)";
                PlayerItem.PlayerLeague.Content      = "Item ID " + Item.id;
                PlayerItem.LevelLabel.Content        = "";
                PlayerItem.UsingLegendary.Visibility = Visibility.Hidden;

                string ParsedDescription = Item.description;
                ParsedDescription            = ParsedDescription.Replace("<br>", Environment.NewLine);
                ParsedDescription            = Regex.Replace(ParsedDescription, "<.*?>", string.Empty);
                PlayerItem.PlayerStatus.Text = ParsedDescription;

                var uriSource = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "item", Item.id + ".png"),
                                        UriKind.RelativeOrAbsolute);
                PlayerItem.ProfileImage.Source = new BitmapImage(uriSource);

                PlayerItem.HorizontalAlignment = HorizontalAlignment.Left;
                PlayerItem.VerticalAlignment   = VerticalAlignment.Top;
            }

            Point MouseLocation = e.GetPosition(Client.MainGrid);

            double YMargin = MouseLocation.Y;

            double XMargin = MouseLocation.X;

            if (XMargin + PlayerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                XMargin = Client.MainGrid.ActualWidth - PlayerItem.Width - 10;
            }

            PlayerItem.Margin = new Thickness(XMargin + 5, YMargin + 5, 0, 0);
        }
Exemple #6
0
        private void img_MouseLeave(object sender, MouseEventArgs e)
        {
            SmallChampionItem icon       = (SmallChampionItem)sender;
            LargeChatPlayer   PlayerItem = (LargeChatPlayer)icon.Tag;

            if (PlayerItem != null)
            {
                Client.MainGrid.Children.Remove(PlayerItem);
                icon.Tag = null;
            }
        }
Exemple #7
0
        private void img_MouseMove(object sender, MouseEventArgs e)
        {
            var item       = (Image)sender;
            var playerItem = (ProfilePage.KeyValueItem)item.Tag;

            if (this.playerItem == null)
            {
                var Item = items.GetItem(Convert.ToInt32(playerItem.Value));
                this.playerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(this.playerItem);


                this.playerItem.PlayerName.Content = Item.name;

                this.playerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                this.playerItem.Width = this.playerItem.PlayerName.DesiredSize.Width > 250
                    ? this.playerItem.PlayerName.DesiredSize.Width
                    : 250;

                this.playerItem.PlayerWins.Content        = Item.price + " gold (" + Item.sellprice + " sell)";
                this.playerItem.PlayerLeague.Content      = "Item ID " + Item.id;
                this.playerItem.LevelLabel.Content        = string.Empty;
                this.playerItem.UsingLegendary.Visibility = Visibility.Hidden;

                var parsedDescription = Item.description;
                parsedDescription = parsedDescription.Replace("<br>", Environment.NewLine);
                parsedDescription = Regex.Replace(parsedDescription, "<.*?>", string.Empty);
                this.playerItem.PlayerStatus.Text = parsedDescription;

                var UriSource = new System.Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "item", Item.id + ".png"),
                                               UriKind.RelativeOrAbsolute);
                this.playerItem.ProfileImage.Source = new BitmapImage(UriSource);

                this.playerItem.HorizontalAlignment = HorizontalAlignment.Left;
                this.playerItem.VerticalAlignment   = VerticalAlignment.Top;
            }

            var mouseLocation = e.GetPosition(Client.MainGrid);

            var yMargin = mouseLocation.Y;

            var xMargin = mouseLocation.X;

            if (xMargin + this.playerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                xMargin = Client.MainGrid.ActualWidth - this.playerItem.Width - 10;
            }

            this.playerItem.Margin = new Thickness(xMargin + 5, yMargin + 5, 0, 0);
        }
Exemple #8
0
        private void item_MouseMove(object sender, MouseEventArgs e)
        {
            runes playerItem = (runes)((RuneItem)sender).Tag;

            if (PlayerItem == null)
            {
                PlayerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(PlayerItem);

                Panel.SetZIndex(PlayerItem, 4);

                //Only load once
                PlayerItem.ProfileImage.Source = playerItem.icon;
                PlayerItem.PlayerName.Content  = playerItem.name;

                PlayerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                if (PlayerItem.PlayerName.DesiredSize.Width > 250) //Make title fit in item
                {
                    PlayerItem.Width = PlayerItem.PlayerName.DesiredSize.Width;
                }
                else
                {
                    PlayerItem.Width = 250;
                }
                PlayerItem.PlayerLeague.Content      = playerItem.id;
                PlayerItem.UsingLegendary.Visibility = System.Windows.Visibility.Hidden;

                PlayerItem.PlayerWins.Content  = ((string)playerItem.description.Replace("<br>", Environment.NewLine));
                PlayerItem.PlayerStatus.Text   = "";
                PlayerItem.LevelLabel.Content  = "";
                PlayerItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                PlayerItem.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            }

            Point MouseLocation = e.GetPosition(Client.MainGrid);

            double YMargin = MouseLocation.Y;

            double XMargin = MouseLocation.X;

            if (XMargin + PlayerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                XMargin = Client.MainGrid.ActualWidth - PlayerItem.Width - 10;
            }

            PlayerItem.Margin = new Thickness(XMargin + 5, YMargin + 5, 0, 0);
        }
Exemple #9
0
        private void item_MouseMove(object sender, MouseEventArgs e)
        {
            var playerItem = (runes)((RuneItem)sender).Tag;

            if (_playerItem == null)
            {
                _playerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(_playerItem);

                Panel.SetZIndex(_playerItem, 4);

                //Only load once
                _playerItem.ProfileImage.Source = playerItem.icon;
                _playerItem.PlayerName.Content  = playerItem.name;

                _playerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                _playerItem.Width = _playerItem.PlayerName.DesiredSize.Width > 250
                    ? _playerItem.PlayerName.DesiredSize.Width
                    : 250;
                _playerItem.PlayerLeague.Content      = playerItem.id;
                _playerItem.UsingLegendary.Visibility = Visibility.Hidden;

                _playerItem.PlayerWins.Content  = playerItem.description.Replace("<br>", Environment.NewLine);
                _playerItem.PlayerStatus.Text   = string.Empty;
                _playerItem.LevelLabel.Content  = string.Empty;
                _playerItem.HorizontalAlignment = HorizontalAlignment.Left;
                _playerItem.VerticalAlignment   = VerticalAlignment.Top;
            }

            var mouseLocation = e.GetPosition(Client.MainGrid);

            var yMargin = mouseLocation.Y;

            var xMargin = mouseLocation.X;

            if (xMargin + _playerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                xMargin = Client.MainGrid.ActualWidth - _playerItem.Width - 10;
            }

            _playerItem.Margin = new Thickness(xMargin + 5, yMargin + 5, 0, 0);
        }
Exemple #10
0
        private void ChatPlayerMouseOver(object sender, MouseEventArgs e)
        {
            var item       = (ChatPlayer)sender;
            var playerItem = (ChatPlayerItem)item.Tag;

            if (PlayerItem == null)
            {
                PlayerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(PlayerItem);
                Panel.SetZIndex(PlayerItem, 5);
                PlayerItem.Tag = playerItem;
                PlayerItem.PlayerName.Content   = playerItem.Username;
                PlayerItem.PlayerLeague.Content = playerItem.LeagueTier + " " + playerItem.LeagueDivision;
                PlayerItem.PlayerStatus.Text    = playerItem.Status;
                if (playerItem.RankedWins == 0)
                {
                    PlayerItem.PlayerWins.Content = playerItem.Wins + " Normal Wins";
                }
                else
                {
                    PlayerItem.PlayerWins.Content = playerItem.RankedWins + " Ranked Wins";
                }

                PlayerItem.LevelLabel.Content        = playerItem.Level;
                PlayerItem.UsingLegendary.Visibility = playerItem.UsingLegendary
                    ? Visibility.Visible
                    : Visibility.Hidden;

                //PlayerItem.Dev.Visibility = playerItem.IsLegendaryDev ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
                string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon",
                                                playerItem.ProfileIcon + ".png");
                PlayerItem.ProfileImage.Source = Client.GetImage(uriSource);
                if (playerItem.Status != null)
                {
                }
                else if (playerItem.Status == null)
                {
                    Client.hidelegendaryaddition = true;
                }
                else
                {
                    PlayerItem.PlayerStatus.Text = "";
                }

                if (playerItem.GameStatus != "outOfGame")
                {
                    var elapsed = new TimeSpan();
                    if (playerItem.Timestamp != 0)
                    {
                        elapsed = DateTime.Now.Subtract(Client.JavaTimeStampToDateTime(playerItem.Timestamp));
                    }

                    switch (playerItem.GameStatus)
                    {
                    case "inGame":
                        champions inGameChamp = champions.GetChampion(playerItem.Champion);
                        if (inGameChamp != null)
                        {
                            PlayerItem.InGameStatus.Text = "In Game" + Environment.NewLine +
                                                           "Playing as " + inGameChamp.displayName +
                                                           Environment.NewLine +
                                                           "For " +
                                                           string.Format("{0} Minutes and {1} Seconds",
                                                                         elapsed.Minutes, elapsed.Seconds);
                        }
                        else
                        {
                            PlayerItem.InGameStatus.Text = "In Game";
                        }
                        break;

                    case "hostingPracticeGame":
                        PlayerItem.InGameStatus.Text = "Creating Custom Game";
                        break;

                    case "inQueue":
                        PlayerItem.InGameStatus.Text = "In Queue" + Environment.NewLine +
                                                       "For " +
                                                       string.Format("{0} Minutes and {1} Seconds", elapsed.Minutes,
                                                                     elapsed.Seconds);
                        break;

                    case "spectating":
                        PlayerItem.InGameStatus.Text = "Spectating";
                        break;

                    case "championSelect":
                        PlayerItem.InGameStatus.Text = "In Champion Select" + Environment.NewLine +
                                                       "For " +
                                                       string.Format("{0} Minutes and {1} Seconds", elapsed.Minutes,
                                                                     elapsed.Seconds);
                        break;

                    case "hostingRankedGame":
                        PlayerItem.InGameStatus.Text = "Creating Ranked Game";
                        break;

                    case "teamSelect":
                        PlayerItem.InGameStatus.Text = "In Team Select";
                        break;

                    case "hostingNormalGame":
                        PlayerItem.InGameStatus.Text = "Creating Normal Game";
                        break;

                    case "hostingCoopVsAIGame":
                        PlayerItem.InGameStatus.Text = "Creating Co-op vs. AI Game";
                        break;

                    case "inTeamBuilder":
                        PlayerItem.InGameStatus.Text = "In Team Builder";
                        break;

                    case "tutorial":
                        PlayerItem.InGameStatus.Text = "In Tutorial";
                        break;
                    }
                    PlayerItem.InGameStatus.Visibility = Visibility.Visible;
                }

                PlayerItem.Width = 250;
                PlayerItem.HorizontalAlignment = HorizontalAlignment.Right;
                PlayerItem.VerticalAlignment   = VerticalAlignment.Top;
            }

            Point  mouseLocation = e.GetPosition(Client.MainGrid);
            double yMargin       = mouseLocation.Y;

            if (yMargin + 195 > Client.MainGrid.ActualHeight)
            {
                yMargin = Client.MainGrid.ActualHeight - 195;
            }
            PlayerItem.Margin = new Thickness(0, yMargin, 250, 0);
        }
Exemple #11
0
        private void item_MouseMove(object sender, MouseEventArgs e)
        {
            MasteryItem item       = (MasteryItem)sender;
            masteries   playerItem = (masteries)item.Tag;

            if (PlayerItem == null)
            {
                PlayerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(PlayerItem);

                Panel.SetZIndex(PlayerItem, 4);

                //Only load once
                PlayerItem.ProfileImage.Source = playerItem.icon;
                PlayerItem.PlayerName.Content  = playerItem.name;

                PlayerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                if (PlayerItem.PlayerName.DesiredSize.Width > 250) //Make title fit in item
                {
                    PlayerItem.Width = PlayerItem.PlayerName.DesiredSize.Width;
                }
                else
                {
                    PlayerItem.Width = 250;
                }

                PlayerItem.PlayerWins.Content = "Requires " + playerItem.treeRow * 4 + " points in " + playerItem.tree;

                bool IsAtRequirement = true;
                switch (playerItem.tree)
                {
                case "Offense":
                    if (OffenseUsedPoints < playerItem.treeRow * 4)
                    {
                        IsAtRequirement = false;
                    }
                    break;

                case "Defense":
                    if (DefenseUsedPoints < playerItem.treeRow * 4)
                    {
                        IsAtRequirement = false;
                    }
                    break;

                default:
                    if (UtilityUsedPoints < playerItem.treeRow * 4)
                    {
                        IsAtRequirement = false;
                    }
                    break;
                }

                if (IsAtRequirement)
                {
                    if (playerItem.prereq != 0)
                    {
                        masteries prereqMastery = Client.Masteries.Find(x => playerItem.prereq == x.id);
                        PlayerItem.PlayerWins.Content = "Requires " + prereqMastery.ranks + " points in " + prereqMastery.name;
                    }
                }

                PlayerItem.PlayerLeague.Content      = playerItem.id;
                PlayerItem.LevelLabel.Content        = playerItem.selectedRank + "/" + playerItem.ranks;
                PlayerItem.UsingLegendary.Visibility = System.Windows.Visibility.Hidden;

                int SelectedRank = playerItem.selectedRank;
                if (SelectedRank == 0)
                {
                    SelectedRank = 1;
                }
                PlayerItem.PlayerStatus.Text = ((string)playerItem.description[SelectedRank - 1]).Replace("<br>", Environment.NewLine);

                PlayerItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                PlayerItem.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            }

            Point MouseLocation = e.GetPosition(Client.MainGrid);

            double YMargin = MouseLocation.Y;

            double XMargin = MouseLocation.X;

            if (XMargin + PlayerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                XMargin = Client.MainGrid.ActualWidth - PlayerItem.Width - 10;
            }

            PlayerItem.Margin = new Thickness(XMargin + 5, YMargin + 5, 0, 0);
        }
Exemple #12
0
        private void item_MouseMove(object sender, MouseEventArgs e)
        {
            var item       = (MasteryItem)sender;
            var playerItem = (masteries)item.Tag;

            if (_playerItem == null)
            {
                _playerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(_playerItem);

                Panel.SetZIndex(_playerItem, 4);

                //Only load once
                _playerItem.ProfileImage.Source = playerItem.icon;
                _playerItem.PlayerName.Content  = playerItem.name;

                _playerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                _playerItem.Width = _playerItem.PlayerName.DesiredSize.Width > 250
                    ? _playerItem.PlayerName.DesiredSize.Width
                    : 250;

                _playerItem.PlayerWins.Content = "Requires " + playerItem.treeRow * 4 + " points in " + playerItem.tree;

                var isAtRequirement = true;
                switch (playerItem.tree)
                {
                case "Offense":
                    if (_offenseUsedPoints < playerItem.treeRow * 4)
                    {
                        isAtRequirement = false;
                    }
                    break;

                case "Defense":
                    if (_defenseUsedPoints < playerItem.treeRow * 4)
                    {
                        isAtRequirement = false;
                    }
                    break;

                default:
                    if (_utilityUsedPoints < playerItem.treeRow * 4)
                    {
                        isAtRequirement = false;
                    }
                    break;
                }

                if (isAtRequirement)
                {
                    if (playerItem.prereq != 0)
                    {
                        var prereqMastery = Client.Masteries.Find(x => playerItem.prereq == x.id);
                        _playerItem.PlayerWins.Content = "Requires " + prereqMastery.ranks + " points in " +
                                                         prereqMastery.name;
                    }
                }

                _playerItem.PlayerLeague.Content      = playerItem.id;
                _playerItem.LevelLabel.Content        = playerItem.selectedRank + "/" + playerItem.ranks;
                _playerItem.UsingLegendary.Visibility = Visibility.Hidden;

                var selectedRank = playerItem.selectedRank;
                if (selectedRank == 0)
                {
                    selectedRank = 1;
                }

                _playerItem.PlayerStatus.Text = ((string)playerItem.description[selectedRank - 1]).Replace("<br>",
                                                                                                           Environment.NewLine);

                _playerItem.HorizontalAlignment = HorizontalAlignment.Left;
                _playerItem.VerticalAlignment   = VerticalAlignment.Top;
            }

            var mouseLocation = e.GetPosition(Client.MainGrid);

            var yMargin = mouseLocation.Y;

            var xMargin = mouseLocation.X;

            if (xMargin + _playerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                xMargin = Client.MainGrid.ActualWidth - _playerItem.Width - 10;
            }

            _playerItem.Margin = new Thickness(xMargin + 5, yMargin + 5, 0, 0);
        }
Exemple #13
0
        private void img_MouseMove(object sender, MouseEventArgs e)
        {
            SmallChampionItem icon = (SmallChampionItem)sender;
            BitmapImage       img  = (BitmapImage)icon.ChampionImage.Source;

            if (img == null)
            {
                return;
            }

            LargeChatPlayer PlayerItem = (LargeChatPlayer)icon.Tag;

            if (PlayerItem == null)
            {
                PlayerItem = new LargeChatPlayer();
                string[] s  = img.UriSource.Segments;
                int      id = int.Parse(s[s.Length - 1].Replace(".png", ""));
                Client.MainGrid.Children.Add(PlayerItem);

                items Item = items.GetItem(id);

                PlayerItem.PlayerName.Content = Item.name;

                PlayerItem.PlayerName.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                if (PlayerItem.PlayerName.DesiredSize.Width > 250) //Make title fit in item
                {
                    PlayerItem.Width = PlayerItem.PlayerName.DesiredSize.Width;
                }
                else
                {
                    PlayerItem.Width = 250;
                }

                PlayerItem.PlayerWins.Content        = Item.price + " gold (" + Item.sellprice + " sell)";
                PlayerItem.PlayerLeague.Content      = "Item ID " + Item.id;
                PlayerItem.LevelLabel.Content        = "";
                PlayerItem.UsingLegendary.Visibility = System.Windows.Visibility.Hidden;

                string ParsedDescription = Item.description;
                ParsedDescription            = ParsedDescription.Replace("<br>", Environment.NewLine);
                ParsedDescription            = Regex.Replace(ParsedDescription, "<.*?>", string.Empty);
                PlayerItem.PlayerStatus.Text = ParsedDescription;

                PlayerItem.ProfileImage.Source = img;
                PlayerItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                PlayerItem.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                PlayerItem.Visibility          = Visibility.Hidden;
                icon.Tag = PlayerItem;
            }

            if (PlayerItem.ActualHeight != 0 && PlayerItem.ActualWidth != 0)
            {
                double YMargin = (Client.MainGrid.ActualHeight / 2) - (PlayerItem.ActualHeight / 2);
                double XMargin = (Client.MainGrid.ActualWidth / 2) - (PlayerItem.ActualWidth / 2);
                PlayerItem.Margin = new Thickness(XMargin, YMargin, 0, 0);
                if (PlayerItem.Visibility == Visibility.Hidden)
                {
                    PlayerItem.Visibility = Visibility.Visible;
                }
            }
        }
Exemple #14
0
        void ProfileImage_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image  item       = (Image)sender;
            string playerName = (string)item.Tag;

            if (PlayerItem == null && Metadata.ContainsKey(playerName))
            {
                PlayerItem = new LargeChatPlayer();
                Client.MainGrid.Children.Add(PlayerItem);
                Panel.SetZIndex(PlayerItem, 5);
                var playerItem = Client.ParsePresence(Metadata[playerName]);
                PlayerItem.Tag = playerItem;

                PlayerItem.PlayerName.Content   = playerItem.Username;
                PlayerItem.PlayerLeague.Content = playerItem.LeagueTier + " " + playerItem.LeagueDivision;
                if (playerItem.RankedWins == 0)
                {
                    PlayerItem.PlayerWins.Content = playerItem.Wins + " Normal Wins";
                }
                else
                {
                    PlayerItem.PlayerWins.Content = playerItem.RankedWins + " Ranked Wins";
                }
                PlayerItem.LevelLabel.Content        = playerItem.Level;
                PlayerItem.UsingLegendary.Visibility = playerItem.UsingLegendary ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
                var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", playerItem.ProfileIcon + ".png");
                PlayerItem.ProfileImage.Source = Client.GetImage(uriSource);
                if (playerItem.Status != null)
                {
                    PlayerItem.PlayerStatus.Text = playerItem.Status.Replace("∟", "");
                }
                else
                {
                    PlayerItem.PlayerStatus.Text = "";
                }

                if (playerItem.GameStatus != "outOfGame")
                {
                    TimeSpan elapsed = new TimeSpan();
                    if (playerItem.Timestamp != 0)
                    {
                        elapsed = DateTime.Now.Subtract(Client.JavaTimeStampToDateTime(playerItem.Timestamp));
                    }
                    switch (playerItem.GameStatus)
                    {
                    case "inGame":
                        champions InGameChamp = champions.GetChampion(playerItem.Champion);
                        if (InGameChamp != null)
                        {
                            PlayerItem.InGameStatus.Text = "In Game" + Environment.NewLine +
                                                           "Playing as " + InGameChamp.displayName + Environment.NewLine +
                                                           "For " + string.Format("{0} Minutes and {1} Seconds", elapsed.Minutes, elapsed.Seconds);
                        }
                        else
                        {
                            PlayerItem.InGameStatus.Text = "In Game";
                        }
                        break;

                    case "hostingPracticeGame":
                        PlayerItem.InGameStatus.Text = "Creating Custom Game";
                        break;

                    case "inQueue":
                        PlayerItem.InGameStatus.Text = "In Queue" + Environment.NewLine +
                                                       "For " + string.Format("{0} Minutes and {1} Seconds", elapsed.Minutes, elapsed.Seconds);
                        break;

                    case "spectating":
                        PlayerItem.InGameStatus.Text = "Spectating";
                        break;

                    case "championSelect":
                        PlayerItem.InGameStatus.Text = "In Champion Select" + Environment.NewLine +
                                                       "For " + string.Format("{0} Minutes and {1} Seconds", elapsed.Minutes, elapsed.Seconds);
                        break;
                    }
                    PlayerItem.InGameStatus.Visibility = System.Windows.Visibility.Visible;
                }

                PlayerItem.Width = 250;
                PlayerItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                PlayerItem.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            }

            if (PlayerItem == null)
            {
                return;
            }

            Point MouseLocation = e.GetPosition(Client.MainGrid);

            double YMargin = MouseLocation.Y;

            double XMargin = MouseLocation.X;

            if (XMargin + PlayerItem.Width + 10 > Client.MainGrid.ActualWidth)
            {
                XMargin = Client.MainGrid.ActualWidth - PlayerItem.Width - 10;
            }

            PlayerItem.Margin = new Thickness(XMargin + 5, YMargin + 5, 0, 0);
        }