Пример #1
0
        public ComparisonPopup(Texture2D blnkTx, SpriteFont stdFont, SpriteFont smallFont, ContentManager cmg, Armor pCArmor, Armor comparisonArmor)
        {
            blank_texture  = blnkTx;
            my_size        = new Rectangle(175, 90, 450, 420);
            comparingArmor = true;
            std_textfont   = stdFont;
            small_textfont = smallFont;

            textposition = new Vector2(my_size.X + 20, my_size.Y + 140);

            i1rect = new Rectangle(my_size.X + 220, my_size.Y + 30, 48, 48);
            i2rect = new Rectangle(my_size.X + 320, my_size.Y + 30, 48, 48);

            string bpath = "Icons/Armors/";

            i1text = cmg.Load <Texture2D>(bpath + comparisonArmor.get_my_texture_name());
            if (pCArmor != null)
            {
                i2text = cmg.Load <Texture2D>(bpath + pCArmor.get_my_texture_name());
            }
            else
            {
                i2text = blank_texture;
            }

            a1 = comparisonArmor;
            a2 = pCArmor;

            my_red_color  = new Color(255, 0, 0);
            my_dark_color = new Color(0, 0, 0);
        }
Пример #2
0
        public void draw_armorText(ref SpriteBatch sBatch, Armor ax, Vector2 ixtextPosition, bool compareA1)
        {
            int linedif        = 34;
            int axablative     = ax.get_armor_value(Armor.Armor_Value.Ablative);
            int axinsulat      = ax.get_armor_value(Armor.Armor_Value.Insulative);
            int axpadding      = ax.get_armor_value(Armor.Armor_Value.Padding);
            int axhardness     = ax.get_armor_value(Armor.Armor_Value.Hardness);
            int axrigidty      = ax.get_armor_value(Armor.Armor_Value.Rigidness);
            int slashingAbsorb = (axhardness * 4) + (axrigidty * 2);
            int piercingAbsorb = (axhardness * 4) + (axpadding * 2);
            int crushingAbsorb = (axrigidty * 4) + (axpadding * 2);
            int fireAbsorb     = (axablative * 4) + (axrigidty * 2);
            int frostAbsorb    = (axpadding * 4) + (axinsulat * 2);
            int elecAbsorb     = (axinsulat * 4) + (axpadding * 2);
            int acidAbsorb     = (axinsulat * 4) + (axablative * 2);
            int integrity      = ax.get_max_integ();

            string[]   wname    = ax.get_my_name().Split(' ');
            SpriteFont nameFont = std_textfont;

            if (ax.get_my_name().Length > 10 || wname.Count() > 1)
            {
                nameFont = small_textfont;
            }

            //Draw item name.
            Vector2 namePos = new Vector2(ixtextPosition.X, i1rect.Bottom + (nameFont.LineSpacing - 10));

            for (int i = 0; i < wname.Count(); i++)
            {
                namePos.X = ixtextPosition.X - (nameFont.MeasureString(wname[i]).X / 2);
                sBatch.DrawString(nameFont, wname[i], namePos, Color.White);
                namePos.Y += (nameFont.LineSpacing - 5);
            }

            //Draw slashing absorb
            sBatch.DrawString(std_textfont, slashingAbsorb.ToString() + "%", ixtextPosition, Color.White);
            //if comparison.
            if (compareA1)
            {
                int a1slashingabsorb = (a1.get_armor_value(Armor.Armor_Value.Hardness) * 4) + (a1.get_armor_value(Armor.Armor_Value.Rigidness) * 2);
                draw_difference(a1slashingabsorb - slashingAbsorb, ixtextPosition, slashingAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw crushing absorb
            sBatch.DrawString(std_textfont, crushingAbsorb.ToString() + "%", ixtextPosition, Color.White);
            if (compareA1)
            {
                int a1crushingabsorb = (a1.get_armor_value(Armor.Armor_Value.Hardness) * 4) + (a1.get_armor_value(Armor.Armor_Value.Padding) * 2);
                draw_difference(a1crushingabsorb - crushingAbsorb, ixtextPosition, crushingAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw piercing absorb
            sBatch.DrawString(std_textfont, piercingAbsorb.ToString() + "%", ixtextPosition, Color.White);
            if (compareA1)
            {
                int a1piercingabsorb = (a1.get_armor_value(Armor.Armor_Value.Hardness) * 4) + (a1.get_armor_value(Armor.Armor_Value.Padding) * 2);
                draw_difference(a1piercingabsorb - piercingAbsorb, ixtextPosition, piercingAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw fire absorb
            sBatch.DrawString(std_textfont, fireAbsorb.ToString() + "%", ixtextPosition, Color.White);
            if (compareA1)
            {
                int a1fireabsorb = (a1.get_armor_value(Armor.Armor_Value.Ablative) * 4) + (a1.get_armor_value(Armor.Armor_Value.Hardness) * 2);
                draw_difference(a1fireabsorb - fireAbsorb, ixtextPosition, fireAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw frost absorb
            sBatch.DrawString(std_textfont, frostAbsorb.ToString() + "%", ixtextPosition, Color.White);
            if (compareA1)
            {
                int a1frostabsorb = (a1.get_armor_value(Armor.Armor_Value.Padding) * 4) + (a1.get_armor_value(Armor.Armor_Value.Insulative) * 2);
                draw_difference(a1frostabsorb - frostAbsorb, ixtextPosition, frostAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw electric absorb
            sBatch.DrawString(std_textfont, elecAbsorb.ToString() + "%", ixtextPosition, Color.White);
            if (compareA1)
            {
                int a1elecabsorb = (a1.get_armor_value(Armor.Armor_Value.Insulative) * 4) + (a1.get_armor_value(Armor.Armor_Value.Padding) * 2);
                draw_difference(a1elecabsorb - elecAbsorb, ixtextPosition, elecAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw acid absorb
            sBatch.DrawString(std_textfont, acidAbsorb.ToString() + "%", ixtextPosition, Color.White);
            if (compareA1)
            {
                int a1acidabsorb = (a1.get_armor_value(Armor.Armor_Value.Insulative) * 4) + (a1.get_armor_value(Armor.Armor_Value.Ablative) * 2);
                draw_difference(a1acidabsorb - acidAbsorb, ixtextPosition, acidAbsorb.ToString(), ref sBatch, true);
            }
            ixtextPosition.Y += linedif;

            //draw integrity
            sBatch.DrawString(std_textfont, integrity.ToString(), ixtextPosition, Color.White);
            if (compareA1)
            {
                int diff = a1.get_max_integ() - ax.get_max_integ();
                draw_difference(diff, ixtextPosition, integrity.ToString(), ref sBatch, false);
            }
            ixtextPosition.Y += linedif;
        }