当前位置: 首页>>代码示例>>C#>>正文


C# Pawn.EstimatedMeatCount方法代码示例

本文整理汇总了C#中Pawn.EstimatedMeatCount方法的典型用法代码示例。如果您正苦于以下问题:C# Pawn.EstimatedMeatCount方法的具体用法?C# Pawn.EstimatedMeatCount怎么用?C# Pawn.EstimatedMeatCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pawn的用法示例。


在下文中一共展示了Pawn.EstimatedMeatCount方法的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;
//.........这里部分代码省略.........
开发者ID:FluffierThanThou,项目名称:RW_Manager,代码行数:101,代码来源:ManagerTab_Livestock.cs


注:本文中的Pawn.EstimatedMeatCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。