private void DrawRightRect(Rect rightOutRect) { rightOutRect.yMin += 32f; Widgets.DrawMenuSection(rightOutRect); List <TabRecord> list = new List <TabRecord>(); foreach (ResearchTabDef allDef in DefDatabase <ResearchTabDef> .AllDefs) { ResearchTabDef localTabDef = allDef; list.Add(new TabRecord(localTabDef.LabelCap, delegate { CurTab = localTabDef; }, CurTab == localTabDef)); } TabDrawer.DrawTabs(rightOutRect, list); if (Prefs.DevMode) { Rect rect = rightOutRect; rect.yMax = rect.yMin + 20f; rect.xMin = rect.xMax - 80f; Rect butRect = rect.RightPartPixels(30f); rect = rect.LeftPartPixels(rect.width - 30f); Widgets.CheckboxLabeled(rect, "Edit", ref editMode); if (Widgets.ButtonImageFitted(butRect, TexButton.Copy)) { StringBuilder stringBuilder = new StringBuilder(); foreach (ResearchProjectDef item in from def in DefDatabase <ResearchProjectDef> .AllDefsListForReading where def.Debug_IsPositionModified() select def) { stringBuilder.AppendLine(item.defName); stringBuilder.AppendLine(string.Format(" <researchViewX>{0}</researchViewX>", item.ResearchViewX.ToString("F2"))); stringBuilder.AppendLine(string.Format(" <researchViewY>{0}</researchViewY>", item.ResearchViewY.ToString("F2"))); stringBuilder.AppendLine(); } GUIUtility.systemCopyBuffer = stringBuilder.ToString(); Messages.Message("Modified data copied to clipboard.", MessageTypeDefOf.SituationResolved, historical: false); } } else { editMode = false; } Rect outRect = rightOutRect.ContractedBy(10f); Rect rect2 = new Rect(0f, 0f, rightViewWidth, rightViewHeight); Rect rect3 = rect2.ContractedBy(10f); rect2.width = rightViewWidth; rect3 = rect2.ContractedBy(10f); Vector2 start = default(Vector2); Vector2 end = default(Vector2); Widgets.ScrollHorizontal(outRect, ref rightScrollPosition, rect2); Widgets.BeginScrollView(outRect, ref rightScrollPosition, rect2); GUI.BeginGroup(rect3); List <ResearchProjectDef> allDefsListForReading = DefDatabase <ResearchProjectDef> .AllDefsListForReading; for (int i = 0; i < 2; i++) { for (int j = 0; j < allDefsListForReading.Count; j++) { ResearchProjectDef researchProjectDef = allDefsListForReading[j]; if (researchProjectDef.tab == CurTab) { start.x = PosX(researchProjectDef); start.y = PosY(researchProjectDef) + 25f; for (int k = 0; k < researchProjectDef.prerequisites.CountAllowNull(); k++) { ResearchProjectDef researchProjectDef2 = researchProjectDef.prerequisites[k]; if (researchProjectDef2 != null && researchProjectDef2.tab == CurTab) { end.x = PosX(researchProjectDef2) + 140f; end.y = PosY(researchProjectDef2) + 25f; if (selectedProject == researchProjectDef || selectedProject == researchProjectDef2) { if (i == 1) { Widgets.DrawLine(start, end, TexUI.HighlightLineResearchColor, 4f); } } else if (i == 0) { Widgets.DrawLine(start, end, TexUI.DefaultLineResearchColor, 2f); } } } } } } for (int l = 0; l < allDefsListForReading.Count; l++) { ResearchProjectDef researchProjectDef3 = allDefsListForReading[l]; if (researchProjectDef3.tab == CurTab) { Rect source = new Rect(PosX(researchProjectDef3), PosY(researchProjectDef3), 140f, 50f); string label = GetLabel(researchProjectDef3); Rect rect4 = new Rect(source); Color textColor = Widgets.NormalOptionColor; Color color = default(Color); Color color2 = default(Color); bool flag = !researchProjectDef3.IsFinished && !researchProjectDef3.CanStartNow; if (researchProjectDef3 == Find.ResearchManager.currentProj) { color = TexUI.ActiveResearchColor; } else if (researchProjectDef3.IsFinished) { color = TexUI.FinishedResearchColor; } else if (flag) { color = TexUI.LockedResearchColor; } else if (researchProjectDef3.CanStartNow) { color = TexUI.AvailResearchColor; } if (selectedProject == researchProjectDef3) { color += TexUI.HighlightBgResearchColor; color2 = TexUI.HighlightBorderResearchColor; } else { color2 = TexUI.DefaultBorderResearchColor; } if (flag) { textColor = ProjectWithMissingPrerequisiteLabelColor; } for (int m = 0; m < researchProjectDef3.prerequisites.CountAllowNull(); m++) { ResearchProjectDef researchProjectDef4 = researchProjectDef3.prerequisites[m]; if (researchProjectDef4 != null && selectedProject == researchProjectDef4) { color2 = TexUI.HighlightLineResearchColor; } } if (requiredByThisFound) { for (int n = 0; n < researchProjectDef3.requiredByThis.CountAllowNull(); n++) { ResearchProjectDef researchProjectDef5 = researchProjectDef3.requiredByThis[n]; if (selectedProject == researchProjectDef5) { color2 = TexUI.HighlightLineResearchColor; } } } if (Widgets.CustomButtonText(ref rect4, label, color, textColor, color2, cacheHeight: true)) { SoundDefOf.Click.PlayOneShotOnCamera(); selectedProject = researchProjectDef3; } if (editMode && Mouse.IsOver(rect4) && Input.GetMouseButtonDown(0)) { draggingTab = researchProjectDef3; } } } GUI.EndGroup(); Widgets.EndScrollView(); if (!Input.GetMouseButton(0)) { draggingTab = null; } if (draggingTab != null && !Input.GetMouseButtonDown(0) && Event.current.type == EventType.Layout) { ResearchProjectDef researchProjectDef6 = draggingTab; Vector2 delta = Event.current.delta; float x = PixelsToCoordX(delta.x); Vector2 delta2 = Event.current.delta; researchProjectDef6.Debug_ApplyPositionDelta(new Vector2(x, PixelsToCoordY(delta2.y))); } }