示例#1
0
        private void DrawPawnRow(PawnKindDef pawnKind, float currentY, float width)
        {
            //List<PawnKindDef> pawnKindsToSpawn = spawner.getPawnKindsToSpawn();
            //// skip already selected pawn kind
            //if (pawnKindsToSpawn.Contains(pawnKind))
            //{
            //    return;
            //}

            // pawn kind image
            if (pawnKind.IconTexture() != null)
            {
                Rect iconRect = new Rect(0, currentY, 30, PAWN_ROW_HEIGHT);
                pawnKind.DrawColouredIcon(iconRect);
            }

            // pawn kind name and point cost
            Rect labelRect = new Rect(60, currentY, width, PAWN_ROW_HEIGHT);

            Widgets.Label(labelRect, "RimSpawners_PawnSelectionListEntry".Translate(pawnKind.LabelCap, pawnKind.combatPower));

            // button for selecting a new pawn kind
            Rect selectButtonRect = new Rect(350, currentY, 100, PAWN_ROW_HEIGHT);

            if (Widgets.ButtonText(selectButtonRect, "RimSpawners_PawnSelectionButtonUnselected".Translate()))
            {
                if (spawners != null)
                {
                    foreach (VanometricFabricator spawner in spawners)
                    {
                        spawner.SetChosenKind(pawnKind);
                        Close();
                    }
                }
            }
        }