public void DoLeftRow(Rect rect) { Widgets.DrawMenuSection(rect); // content float height = _leftRowHeight; var scrollView = new Rect(0f, 0f, rect.width, height); if (height > rect.height) { scrollView.width -= 16f; } Widgets.BeginScrollView(rect, ref _scrollPosition, scrollView); Rect scrollContent = scrollView; GUI.BeginGroup(scrollContent); Vector2 cur = Vector2.zero; var i = 0; foreach (ManagerJob_Forestry job in _jobs) { var row = new Rect(0f, cur.y, scrollContent.width, Utilities.LargeListEntryHeight); Widgets.DrawHighlightIfMouseover(row); if (_selected == job) { Widgets.DrawHighlightSelected(row); } if (i++ % 2 == 1) { Widgets.DrawAltRect(row); } Rect jobRect = row; if (ManagerTab_Overview.DrawOrderButtons(new Rect(row.xMax - 50f, row.yMin, 50f, 50f), manager, job)) { Refresh(); } jobRect.width -= 50f; job.DrawListEntry(jobRect, false); if (Widgets.ButtonInvisible(jobRect)) { _selected = job; } cur.y += Utilities.LargeListEntryHeight; } // row for new job. var newRect = new Rect(0f, cur.y, scrollContent.width, Utilities.LargeListEntryHeight); Widgets.DrawHighlightIfMouseover(newRect); if (i % 2 == 1) { Widgets.DrawAltRect(newRect); } Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(newRect, "<" + "FMF.NewForestryJob".Translate() + ">"); Text.Anchor = TextAnchor.UpperLeft; if (Widgets.ButtonInvisible(newRect)) { Selected = new ManagerJob_Forestry(manager); } TooltipHandler.TipRegion(newRect, "FMF.NewForestryJobTooltip".Translate()); cur.y += Utilities.LargeListEntryHeight; _leftRowHeight = cur.y; GUI.EndGroup(); Widgets.EndScrollView(); }
public void DoLeftRow(Rect canvas) { Widgets.DrawMenuSection(canvas, false); // filter var filterRect = new Rect(10f, canvas.yMin + 5f, canvas.width - _leftRowEntryHeight, _entryHeight); GUI.SetNextControlName("filterTextfield"); SourceFilter = Widgets.TextField(filterRect, SourceFilter); if (!_postOpenFocus) { GUI.FocusControl("filterTextfield"); _postOpenFocus = true; } if (SourceFilter != "") { var clearFilter = new Rect(filterRect.width + 10f, filterRect.yMin, _entryHeight, _entryHeight); if (Widgets.ButtonImage(clearFilter, Widgets.CheckboxOffTex)) { SourceFilter = ""; } TooltipHandler.TipRegion(clearFilter, "FMP.ClearFilterDesc".Translate()); } TooltipHandler.TipRegion(filterRect, "FMP.FilterDesc".Translate()); // tabs var list = new List <TabRecord>(); var availableTabRecord = new TabRecord("FMP.Available".Translate(), delegate { Source = SourceOptions.Available; Refresh(); }, Source == SourceOptions.Available); list.Add(availableTabRecord); var currentTabRecord = new TabRecord("FMP.Current".Translate(), delegate { Source = SourceOptions.Current; Refresh(); }, Source == SourceOptions.Current); list.Add(currentTabRecord); TabDrawer.DrawTabs(canvas, list); // content Rect scrollCanvas = canvas; scrollCanvas.yMin = scrollCanvas.yMin + _entryHeight + _margin; float height = SourceListHeight; var scrollView = new Rect(0f, 0f, scrollCanvas.width, height); if (height > scrollCanvas.height) { scrollView.width -= 16f; } Widgets.BeginScrollView(scrollCanvas, ref LeftRowScrollPosition, scrollView); Rect scrollContent = scrollView; GUI.BeginGroup(scrollContent); float y = 0; var i = 0; foreach (ManagerJob_Production current in from job in SourceList where job.Bill.recipe.label.ToUpper() .Contains(SourceFilter.ToUpper()) || job.MainProduct.Label.ToUpper() .Contains(SourceFilter.ToUpper()) select job) { var row = new Rect(0f, y, scrollContent.width, Utilities.LargeListEntryHeight); Widgets.DrawHighlightIfMouseover(row); if (_selected == current) { Widgets.DrawHighlightSelected(row); } if (i++ % 2 == 1) { Widgets.DrawAltRect(row); } Rect jobRect = row; if (Source == SourceOptions.Current) { if (ManagerTab_Overview.DrawOrderButtons( new Rect(row.xMax - _leftRowEntryHeight, row.yMin, _leftRowEntryHeight, _leftRowEntryHeight), manager, current)) { Refresh(); } jobRect.width -= _leftRowEntryHeight; } current.DrawListEntry(jobRect, false, Source == SourceOptions.Current); if (Widgets.ButtonInvisible(jobRect)) { _selected = current; } y += Utilities.LargeListEntryHeight; } SourceListHeight = y; GUI.EndGroup(); Widgets.EndScrollView(); }