private void DrawAnimalListheader( ref Vector2 cur, Vector2 size, PawnKindDef pawnKind, string header )
        {
            // use a third of available screenspace for labels
            var headerRect = new Rect( cur.x, cur.y, size.x / 3f, size.y );
            Utilities.Label( headerRect, header, anchor: TextAnchor.MiddleCenter, font: GameFont.Tiny );
            cur.x += size.x / 3f;

            // gender, lifestage, current meat (and if applicable, milking + shearing)
            var cols = 3;

            // extra columns?
            bool milk = pawnKind.Milkable();
            bool wool = pawnKind.Shearable();
            if ( milk )
            {
                cols++;
            }
            if ( wool )
            {
                cols++;
            }
            float colwidth = size.x * 2 / 3 / cols;

            // gender header
            var genderRect = new Rect( cur.x, cur.y, colwidth, size.y );
            Rect genderMale =
                new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( genderRect, -_smallIconSize / 2 );
            Rect genderFemale =
                new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( genderRect, _smallIconSize / 2 );
            GUI.DrawTexture( genderMale, Resources.MaleIcon );
            GUI.DrawTexture( genderFemale, Resources.FemaleIcon );
            TooltipHandler.TipRegion( genderRect, "FML.GenderHeader".Translate() );
            cur.x += colwidth;

            // lifestage header
            var ageRect = new Rect( cur.x, cur.y, colwidth, size.y );
            Rect ageRectC = new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( ageRect, _smallIconSize / 2 );
            Rect ageRectB = new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( ageRect );
            Rect ageRectA = new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( ageRect, -_smallIconSize / 2 );
            GUI.DrawTexture( ageRectC, Resources.LifeStages[2] );
            GUI.DrawTexture( ageRectB, Resources.LifeStages[1] );
            GUI.DrawTexture( ageRectA, Resources.LifeStages[0] );
            TooltipHandler.TipRegion( ageRect, "FML.AgeHeader".Translate() );
            cur.x += colwidth;

            // meat header
            var meatRect = new Rect( cur.x, cur.y, colwidth, size.y );
            Rect meatIconRect =
                new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( meatRect );
            GUI.DrawTexture( meatIconRect, Resources.MeatIcon );
            TooltipHandler.TipRegion( meatRect, "FML.MeatHeader".Translate() );
            cur.x += colwidth;

            // milk header
            if ( milk )
            {
                var milkRect = new Rect( cur.x, cur.y, colwidth, size.y );
                Rect milkIconRect =
                    new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( milkRect );
                GUI.DrawTexture( milkIconRect, Resources.MilkIcon );
                TooltipHandler.TipRegion( milkRect, "FML.MilkHeader".Translate() );
                cur.x += colwidth;
            }

            // wool header
            if ( wool )
            {
                var woolRect = new Rect( cur.x, cur.y, colwidth, size.y );
                Rect woolIconRect =
                    new Rect( 0f, 0f, Utilities.MediumIconSize, Utilities.MediumIconSize ).CenteredIn( woolRect );
                GUI.DrawTexture( woolIconRect, Resources.WoolIcon );
                TooltipHandler.TipRegion( woolRect, "FML.WoolHeader".Translate() );
                cur.x += colwidth;
            }

            // start next row
            cur.x = 0f;
            cur.y += size.y;
        }
Exemplo n.º 2
0
        private void DrawAnimalListheader(ref Vector2 pos, Vector2 size, PawnKindDef pawnKind)
        {
            var start = pos;

            // use a third of available screenspace for labels
            pos.x += size.x / 3f;

            // gender, lifestage, current meat (and if applicable, milking + shearing)
            var cols = 3;

            // extra columns?
            bool milk = pawnKind.Milkable();
            bool wool = pawnKind.Shearable();

            if (milk)
            {
                cols++;
            }
            if (wool)
            {
                cols++;
            }
            float colwidth = (size.x * 2 / 3) / cols;

            // gender header
            var  genderRect = new Rect(pos.x, pos.y, colwidth, size.y);
            Rect genderMale =
                new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(genderRect, -SmallIconSize / 2);
            Rect genderFemale =
                new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(genderRect, SmallIconSize / 2);

            GUI.DrawTexture(genderMale, Resources.MaleIcon);
            GUI.DrawTexture(genderFemale, Resources.FemaleIcon);
            TooltipHandler.TipRegion(genderRect, "FML.GenderHeader".Translate());
            pos.x += colwidth;

            // lifestage header
            var  ageRect  = new Rect(pos.x, pos.y, colwidth, size.y);
            Rect ageRectC = new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(ageRect, SmallIconSize / 2);
            Rect ageRectB = new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(ageRect);
            Rect ageRectA = new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(ageRect, -SmallIconSize / 2);

            GUI.DrawTexture(ageRectC, Resources.LifeStages(2));
            GUI.DrawTexture(ageRectB, Resources.LifeStages(1));
            GUI.DrawTexture(ageRectA, Resources.LifeStages(0));
            TooltipHandler.TipRegion(ageRect, "FML.AgeHeader".Translate());
            pos.x += colwidth;

            // meat header
            var  meatRect     = new Rect(pos.x, pos.y, colwidth, size.y);
            Rect meatIconRect =
                new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(meatRect);

            GUI.DrawTexture(meatIconRect, Resources.MeatIcon);
            TooltipHandler.TipRegion(meatRect, "FML.MeatHeader".Translate());
            pos.x += colwidth;

            // milk header
            if (milk)
            {
                var  milkRect     = new Rect(pos.x, pos.y, colwidth, size.y);
                Rect milkIconRect =
                    new Rect(0f, 0f, SmallIconSize, SmallIconSize).CenteredIn(milkRect);
                GUI.DrawTexture(milkIconRect, Resources.MilkIcon);
                TooltipHandler.TipRegion(milkRect, "FML.MilkHeader".Translate());
                pos.x += colwidth;
            }

            // wool header
            if (wool)
            {
                var  woolRect     = new Rect(pos.x, pos.y, colwidth, size.y);
                Rect woolIconRect =
                    new Rect(0f, 0f, MediumIconSize, MediumIconSize).CenteredIn(woolRect);
                GUI.DrawTexture(woolIconRect, Resources.WoolIcon);
                TooltipHandler.TipRegion(woolRect, "FML.WoolHeader".Translate());
                pos.x += colwidth;
            }

            // start next row
            pos.x  = start.x;
            pos.y += size.y;
        }
        private void DrawAnimalListheader(ref Vector2 cur, Vector2 size, PawnKindDef pawnKind, string header)
        {
            // use a third of available screenspace for labels
            var headerRect = new Rect(cur.x, cur.y, size.x / 3f, size.y);

            Utilities.Label(headerRect, header, anchor: TextAnchor.MiddleCenter, font: GameFont.Tiny);
            cur.x += size.x / 3f;

            // gender, lifestage, current meat (and if applicable, milking + shearing)
            var cols = 3;

            // extra columns?
            bool milk = pawnKind.Milkable();
            bool wool = pawnKind.Shearable();

            if (milk)
            {
                cols++;
            }
            if (wool)
            {
                cols++;
            }
            float colwidth = size.x * 2 / 3 / cols;

            // gender header
            var  genderRect = new Rect(cur.x, cur.y, colwidth, size.y);
            Rect genderMale =
                new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(genderRect, -_smallIconSize / 2);
            Rect genderFemale =
                new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(genderRect, _smallIconSize / 2);

            GUI.DrawTexture(genderMale, Resources.MaleIcon);
            GUI.DrawTexture(genderFemale, Resources.FemaleIcon);
            TooltipHandler.TipRegion(genderRect, "FML.GenderHeader".Translate());
            cur.x += colwidth;

            // lifestage header
            var  ageRect  = new Rect(cur.x, cur.y, colwidth, size.y);
            Rect ageRectC = new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(ageRect, _smallIconSize / 2);
            Rect ageRectB = new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(ageRect);
            Rect ageRectA = new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(ageRect, -_smallIconSize / 2);

            GUI.DrawTexture(ageRectC, Resources.LifeStages[2]);
            GUI.DrawTexture(ageRectB, Resources.LifeStages[1]);
            GUI.DrawTexture(ageRectA, Resources.LifeStages[0]);
            TooltipHandler.TipRegion(ageRect, "FML.AgeHeader".Translate());
            cur.x += colwidth;

            // meat header
            var  meatRect     = new Rect(cur.x, cur.y, colwidth, size.y);
            Rect meatIconRect =
                new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(meatRect);

            GUI.DrawTexture(meatIconRect, Resources.MeatIcon);
            TooltipHandler.TipRegion(meatRect, "FML.MeatHeader".Translate());
            cur.x += colwidth;

            // milk header
            if (milk)
            {
                var  milkRect     = new Rect(cur.x, cur.y, colwidth, size.y);
                Rect milkIconRect =
                    new Rect(0f, 0f, _smallIconSize, _smallIconSize).CenteredIn(milkRect);
                GUI.DrawTexture(milkIconRect, Resources.MilkIcon);
                TooltipHandler.TipRegion(milkRect, "FML.MilkHeader".Translate());
                cur.x += colwidth;
            }

            // wool header
            if (wool)
            {
                var  woolRect     = new Rect(cur.x, cur.y, colwidth, size.y);
                Rect woolIconRect =
                    new Rect(0f, 0f, Utilities.MediumIconSize, Utilities.MediumIconSize).CenteredIn(woolRect);
                GUI.DrawTexture(woolIconRect, Resources.WoolIcon);
                TooltipHandler.TipRegion(woolRect, "FML.WoolHeader".Translate());
                cur.x += colwidth;
            }

            // start next row
            cur.x  = 0f;
            cur.y += size.y;
        }