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(); }
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 ); } ) ); } }