Ejemplo n.º 1
0
        public MobInfoPanel()
        {
            CurrentNPC                 = null;
            this.OverridesMouse        = false;
            this.UpdateWhenOutOfBounds = true;
            mobImage   = new UIImage();
            mobImage.X = Spacing;
            mobImage.Y = Spacing;

            AddChild(mobImage);
        }
Ejemplo n.º 2
0
        public void SetMobType(NPCStats npc)
        {
            this.RemoveAllChildren();
            float yPos = Spacing;

            this.Width = 350;

            //if (npc.NetID < 0) return;
            CurrentNPC = npc;
            ModUtils.LoadNPC(npc.Type);
            mobImage.Texture         = Main.npcTexture[npc.Type];
            mobImage.SourceRectangle = new Rectangle(0, 0, (int)mobImage.Texture.Width, (int)mobImage.Texture.Height / Main.npcFrameCount[npc.Type]);
            //mobImage.ForegroundColor = CurrentNPC.AlphaColor;
            AddChild(mobImage);

            UIImage mobImage2 = new UIImage();

            mobImage2.Texture         = mobImage.Texture;
            mobImage2.SourceRectangle = mobImage.SourceRectangle;
            mobImage2.ForegroundColor = CurrentNPC.Color;
            AddChild(mobImage2);
            //AddChild(mobImage2);

            if (mobImage.Width > this.Width - Spacing * 2)
            {
                this.Width = mobImage.Width + Spacing * 2;
                mobImage.X = Spacing;
            }
            else
            {
                mobImage.X = Width / 2 - mobImage.Width / 2;
            }

            yPos += mobImage.Height;
            mobImage2.Position = mobImage.Position;

            //largestWidth =

            float statScale = .4f;

            UILabel lID = new UILabel("ID");

            lID.Scale = statScale;
            lID.X     = Spacing;
            lID.Y     = yPos;
            AddChild(lID);

            UILabel id = new UILabel(npc.NetID.ToString());

            id.Scale  = statScale;
            id.Anchor = AnchorPosition.TopRight;
            id.X      = Width - Spacing;
            id.Y      = yPos;
            AddChild(id);

            yPos += lID.Height;

            if (npc.Health > 0)
            {
                UILabel lHealth = new UILabel("Health");
                lHealth.Scale = statScale;
                lHealth.X     = Spacing;
                lHealth.Y     = yPos;
                AddChild(lHealth);

                UILabel lValue = new UILabel(npc.Health.ToString());
                lValue.Scale  = statScale;
                lValue.Anchor = AnchorPosition.TopRight;
                lValue.X      = Width - Spacing;
                lValue.Y      = yPos;
                AddChild(lValue);

                yPos += lHealth.Height;
            }

            if (npc.Damage > 0)
            {
                UILabel lDamage = new UILabel("Damage");
                lDamage.Scale = statScale;
                lDamage.X     = Spacing;
                lDamage.Y     = yPos;
                AddChild(lDamage);

                UILabel lValue = new UILabel(npc.Damage.ToString());
                lValue.Scale  = statScale;
                lValue.Anchor = AnchorPosition.TopRight;
                lValue.X      = Width - Spacing;
                lValue.Y      = yPos;
                AddChild(lValue);

                yPos += lDamage.Height;
            }

            if (npc.Defense > 0)
            {
                UILabel lDefense = new UILabel("Defense");
                lDefense.Scale = statScale;
                lDefense.X     = Spacing;
                lDefense.Y     = yPos;
                AddChild(lDefense);

                UILabel lValue = new UILabel(npc.Defense.ToString());
                lValue.Scale  = statScale;
                lValue.Anchor = AnchorPosition.TopRight;
                lValue.X      = Width - Spacing;
                lValue.Y      = yPos;
                AddChild(lValue);

                yPos += lDefense.Height;
            }

            if (npc.KncokbackResist > 0)
            {
                UILabel lKncokbackResist = new UILabel("Knockback Resistance");
                lKncokbackResist.Scale = statScale;
                lKncokbackResist.X     = Spacing;
                lKncokbackResist.Y     = yPos;
                AddChild(lKncokbackResist);

                UILabel lValue = new UILabel(npc.KncokbackResist.ToString());
                lValue.Scale  = statScale;
                lValue.Anchor = AnchorPosition.TopRight;
                lValue.X      = Width - Spacing;
                lValue.Y      = yPos;
                AddChild(lValue);

                yPos += lKncokbackResist.Height;
            }

            //DropTableView tableView = new DropTableView(DropTableBuilder.DropTable.NPCDropTables[npc.Type], this.Width - Spacing * 2);
            //tableView.Y = yPos;
            //tableView.X = Spacing;
            //AddChild(tableView);
            //yPos += tableView.Height;

            //this.Width = mobImage.Width + Spacing * 2;
            this.Height = yPos + Spacing;
        }