本文整理汇总了C#中UnityEngine.Rect.CenteredOnXIn方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.CenteredOnXIn方法的具体用法?C# Rect.CenteredOnXIn怎么用?C# Rect.CenteredOnXIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Rect
的用法示例。
在下文中一共展示了Rect.CenteredOnXIn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoWindowContents
public override void DoWindowContents( Rect canvas )
{
// zooming in seems to cause Text.Font to start at Tiny, make sure it's set to Small for our panels.
Text.Font = GameFont.Small;
// three areas of icons for tabs, left middle and right.
var leftIcons = new Rect( 0f, 0f, _margin + Manager.For( Find.VisibleMap ).ManagerTabsLeft.Count * ( _iconSize + _margin ),
_iconSize );
var middleIcons = new Rect( 0f, 0f,
_margin + Manager.For( Find.VisibleMap ).ManagerTabsMiddle.Count * ( _iconSize + _margin ),
_iconSize );
var rightIcons = new Rect( 0f, 0f, _margin + Manager.For( Find.VisibleMap ).ManagerTabsRight.Count * ( _iconSize + _margin ),
_iconSize );
// finetune rects
middleIcons = middleIcons.CenteredOnXIn( canvas );
rightIcons.x += canvas.width - rightIcons.width;
// left icons (probably only overview, but hey...)
GUI.BeginGroup( leftIcons );
var cur = new Vector2( _margin, 0f );
foreach ( ManagerTab tab in Manager.For( Find.VisibleMap ).ManagerTabsLeft )
{
var iconRect = new Rect( cur.x, cur.y, _iconSize, _iconSize );
DrawTabIcon( iconRect, tab );
cur.x += _iconSize + _margin;
}
GUI.EndGroup();
// middle icons (the bulk of icons)
GUI.BeginGroup( middleIcons );
cur = new Vector2( _margin, 0f );
foreach ( ManagerTab tab in Manager.For( Find.VisibleMap ).ManagerTabsMiddle )
{
var iconRect = new Rect( cur.x, cur.y, _iconSize, _iconSize );
DrawTabIcon( iconRect, tab );
cur.x += _iconSize + _margin;
}
GUI.EndGroup();
// right icons (probably only import/export, possbile settings?)
GUI.BeginGroup( rightIcons );
cur = new Vector2( _margin, 0f );
foreach ( ManagerTab tab in Manager.For( Find.VisibleMap ).ManagerTabsRight )
{
var iconRect = new Rect( cur.x, cur.y, _iconSize, _iconSize );
DrawTabIcon( iconRect, tab );
cur.x += _iconSize + _margin;
}
GUI.EndGroup();
// delegate actual content to the specific manager.
var contentCanvas = new Rect( 0f, _iconSize + _margin, canvas.width, canvas.height - _iconSize - _margin );
GUI.BeginGroup( contentCanvas );
CurrentTab.DoWindowContents( contentCanvas );
GUI.EndGroup();
}
示例2: DoWindowContents
public override void DoWindowContents( Rect inRect )
{
GUI.DrawTexture( inRect, BGTex );
Rect button = new Rect(0f, 0f, 200f, 35f);
button = button.CenteredOnXIn( inRect ).CenteredOnXIn( inRect );
if (Widgets.TextButton(button, "Change Colour" ) )
{
Find.WindowStack.Add( new Dialog_ColourPicker( BGCol, delegate { BGTex = SolidColorMaterials.NewSolidColorTexture( BGCol.Color ); } ) );
}
}