本文整理汇总了C#中Pawn.Shearable方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.Shearable方法的具体用法?C# Pawn.Shearable怎么用?C# Pawn.Shearable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pawn
的用法示例。
在下文中一共展示了Pawn.Shearable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawAnimalRow
private void DrawAnimalRow( ref Vector2 cur, Vector2 size, Pawn p, bool alt )
{
// highlights and interactivity.
var row = new Rect( cur.x, cur.y, size.x, size.y );
if ( alt )
{
Widgets.DrawAltRect( row );
}
Widgets.DrawHighlightIfMouseover( row );
if ( Widgets.ButtonInvisible( row ) )
{
// move camera and select
Find.MainTabsRoot.EscapeCurrentTab();
Find.CameraDriver.JumpTo( p.PositionHeld );
Find.Selector.ClearSelection();
if ( p.Spawned )
{
Find.Selector.Select( p );
}
}
// use a third of available screenspace for labels
var nameRect = new Rect( cur.x, cur.y, size.x / 3f, size.y );
Utilities.Label( nameRect, p.LabelCap, 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?
if ( p.kindDef.Milkable() )
cols++;
if ( p.kindDef.Shearable() )
cols++;
float colwidth = size.x * 2 / 3 / cols;
// gender column
var genderRect = new Rect( cur.x, cur.y, colwidth, size.y );
Rect genderIconRect =
new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( genderRect );
switch ( p.gender )
{
case Gender.Female:
GUI.DrawTexture( genderIconRect, Resources.FemaleIcon );
break;
case Gender.Male:
GUI.DrawTexture( genderIconRect, Resources.MaleIcon );
break;
case Gender.None:
GUI.DrawTexture( genderIconRect, Resources.UnkownIcon );
break;
}
TooltipHandler.TipRegion( genderRect, p.gender.GetLabel() );
cur.x += colwidth;
// lifestage column
var ageRect = new Rect( cur.x, cur.y, colwidth, size.y );
Rect ageIconRect = new Rect( 0f, 0f, _smallIconSize, _smallIconSize ).CenteredIn( ageRect );
GUI.DrawTexture( ageIconRect, Resources.LifeStages[p.ageTracker.CurLifeStageIndex] );
TooltipHandler.TipRegion( ageRect, p.ageTracker.AgeTooltipString );
cur.x += colwidth;
// meat column
var meatRect = new Rect( cur.x, cur.y, colwidth, size.y );
// NOTE: When splitting tabs into separate mods; estimated meat count is defined in the Hunting helper.
Utilities.Label( meatRect, p.EstimatedMeatCount().ToString(), p.EstimatedMeatCount().ToString(),
TextAnchor.MiddleCenter,
font: GameFont.Tiny );
cur.x += colwidth;
// milk column
if ( p.Milkable() )
{
var milkRect = new Rect( cur.x, cur.y, colwidth, size.y );
var comp = p.TryGetComp<CompMilkable>();
Utilities.Label( milkRect, comp.Fullness.ToString( "0%" ),
"FML.Yields".Translate( comp.Props.milkDef.LabelCap, comp.Props.milkAmount ),
TextAnchor.MiddleCenter, font: GameFont.Tiny );
}
if ( p.kindDef.Milkable() )
cur.x += colwidth;
// wool column
if ( p.Shearable() )
{
var woolRect = new Rect( cur.x, cur.y, colwidth, size.y );
var comp = p.TryGetComp<CompShearable>();
Utilities.Label( woolRect, comp.Fullness.ToString( "0%" ),
"FML.Yields".Translate( comp.Props.woolDef.LabelCap, comp.Props.woolAmount ),
TextAnchor.MiddleCenter, font: GameFont.Tiny );
}
if ( p.kindDef.Milkable() )
cur.x += colwidth;
// do the carriage return on ref cur
cur.x = 0f;
cur.y += size.y;
//.........这里部分代码省略.........