Exemple #1
0
        public override int CompareTo(object obj)
        {
            UIPlayerDPS other = obj as UIPlayerDPS;

            return(-dps.CompareTo(other.dps));
        }
Exemple #2
0
        internal void UpdateDamageLists()
        {
            //ShowFavoritePanel = favoritedRecipes.Count > 0;
            //	teamDPSPanel.RemoveAllChildren();

            //UIText label = new UIText("DPS");
            //label.OnClick += Label_OnClick;
            //teamDPSPanel.Append(label);

            //label.Recalculate();
            var labelDimensions = label.GetInnerDimensions();
            int top             = (int)labelDimensions.Height + 4;

            if (showDPSPanel)
            {
                dpsList.Clear();
                int   width  = 1;
                int   height = 0;
                float max    = 1f;
                int   total  = 0;
                for (int i = 0; i < DPSExtreme.dpss.Length; i++)
                {
                    int playerDPS = DPSExtreme.dpss[i];
                    if (playerDPS > -1)
                    {
                        max    = Math.Max(max, playerDPS);
                        total += playerDPS;
                    }
                }
                for (int i = 0; i < DPSExtreme.dpss.Length; i++)
                {
                    int playerDPS = DPSExtreme.dpss[i];
                    if (playerDPS > -1)
                    {
                        UIPlayerDPS t = new UIPlayerDPS(i, "", "");
                        t.SetDPS(playerDPS, max, total);
                        t.Recalculate();
                        var inner = t.GetInnerDimensions();
                        t.Width.Set(200, 0);
                        height += (int)(inner.Height + dpsList.ListPadding);
                        width   = Math.Max(width, (int)inner.Width);
                        dpsList.Add(t);
                        teamDPSPanel.AddDragTarget(t);
                    }
                }

                dpsList.Recalculate();
                var fff = dpsList.GetTotalHeight();

                width = 200;
                teamDPSPanel.Height.Pixels = top + /*height*/ fff + teamDPSPanel.PaddingBottom + teamDPSPanel.PaddingTop - dpsList.ListPadding;
                teamDPSPanel.Width.Pixels  = width + teamDPSPanel.PaddingLeft + teamDPSPanel.PaddingRight;
                teamDPSPanel.Recalculate();
            }
            else
            {
                bossList.Clear();

                int height = 0;
                int max    = 1;
                int total  = 0;
                for (int i = 0; i < DPSExtreme.bossDamage.Length; i++)
                {
                    int playerBossDamage = DPSExtreme.bossDamage[i];
                    if (playerBossDamage > -1)
                    {
                        max    = Math.Max(max, playerBossDamage);
                        total += playerBossDamage;
                    }
                }
                for (int i = 0; i < DPSExtreme.dpss.Length; i++)
                {
                    int playerBossDamage = DPSExtreme.bossDamage[i];
                    if (playerBossDamage > -1)
                    {
                        UIPlayerDPS t = new UIPlayerDPS(i, "", "");
                        t.SetDPS(playerBossDamage, max, total);
                        t.Recalculate();
                        var inner = t.GetInnerDimensions();
                        t.Width.Set(200, 0);
                        height += (int)(inner.Height + bossList.ListPadding);
                        bossList.Add(t);
                        teamDPSPanel.AddDragTarget(t);
                    }
                }

                if (bossUpdateNeeded)
                {
                    string bossname = "No Boss";
                    if (DPSExtreme.bossIndex > -1)
                    {
                        bossname = Lang.GetNPCNameValue(Main.npc[DPSExtreme.bossIndex].type);
                    }
                    label.SetText("Boss - " + bossname);
                    bossUpdateNeeded = false;
                }

                bossList.Recalculate();
                var fff = bossList.GetTotalHeight();
                teamDPSPanel.Height.Pixels = top + /*height*/ fff + teamDPSPanel.PaddingBottom + teamDPSPanel.PaddingTop - dpsList.ListPadding;
                teamDPSPanel.Width.Pixels  = 200 + teamDPSPanel.PaddingLeft + teamDPSPanel.PaddingRight;
                teamDPSPanel.Recalculate();
            }
        }