Beispiel #1
0
        private void DrawFactionResourceIcons(Rect inRect, int x, int y, int resourceSize)         //Used to draw a list of resources from the faction
        {
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;
            int   k;
            int   j;
            float resourcesPerRow = 7;
            int   ySpacing        = 30;

            for (int i = 0; i < faction.returnNumberResource(); i++)
            {
                k = (int)Math.Floor(i / resourcesPerRow);
                j = (int)(i % resourcesPerRow);
                if (Widgets.ButtonImage(new Rect(5 + x + (j * (resourceSize + 5)), y - 5 + ySpacing * k, resourceSize, resourceSize), faction.returnResourceByInt(i).getIcon()))
                {
                    Find.WindowStack.Add(new descWindowFC("TotalFactionProduction".Translate() + ": " + faction.returnResourceByInt(i).name, char.ToUpper(faction.returnResourceByInt(i).name[0]) + faction.returnResourceByInt(i).name.Substring(1)));
                }
                Widgets.Label(new Rect(5 + x + (j * (resourceSize + 5)), y + resourceSize - 10 + ySpacing * k, resourceSize, resourceSize), faction.returnResourceByInt(i).amount.ToString());
            }
        }