public override void DoWindowContents(Rect inRect) { // Handle Window Resizing HandleWindowDrag(inRect); var rect = inRect.ContractedBy(18f); // Adjust by our (removed) margin var profilersRect = rect; if (GUIController.CurrentProfiler == null) { Panel_Tabs.Draw(profilersRect, GUIController.Tabs); rect.AdjustHorizonallyBy(Panel_Tabs.width); if (GUIController.CurrentCategory == Category.Settings) { Panel_Settings.Draw(rect); return; } Panel_TopRow.Draw(rect.TopPartPixels(TOP_ROW_HEIGHT)); rect.AdjustVerticallyBy(TOP_ROW_HEIGHT); Panel_Logs.DrawLogs(rect); return; } profilersRect.height -= GraphHeight + DRAGGABLE_RECT_DIM; Panel_Tabs.Draw(profilersRect, GUIController.Tabs); rect.AdjustHorizonallyBy(Panel_Tabs.width); Panel_TopRow.Draw(rect.TopPartPixels(TOP_ROW_HEIGHT)); rect.AdjustVerticallyBy(TOP_ROW_HEIGHT); // If there is a current profiler, we need to adjust the height of the logs rect.height -= GraphHeight + DRAGGABLE_RECT_DIM; Panel_Logs.DrawLogs(rect); // Move our rect down to just below the Logs rect.x -= Panel_Tabs.width; rect.width += Panel_Tabs.width; rect.y = rect.yMax; rect.height = GraphHeight + DRAGGABLE_RECT_DIM; var barRect = rect.TopPartPixels(DRAGGABLE_RECT_DIM); HandleGraphDrag(inRect, rect, barRect); rect.AdjustVerticallyBy(DRAGGABLE_RECT_DIM); Panel_BottomRow.Draw(rect, inRect); }
public static void LoadEntries() { List <Type> allEntries = GenTypes.AllTypes.Where(m => m.TryGetAttribute <Entry>(out _)).OrderBy(m => m.TryGetAttribute <Entry>().name).ToList(); foreach (Type entryType in allEntries) { try { Entry entry = entryType.TryGetAttribute <Entry>(); entry.Settings = new Dictionary <FieldInfo, Setting>(); foreach (FieldInfo fieldInfo in entryType.GetFields().Where(m => m.TryGetAttribute <Setting>(out _))) { Setting sett = fieldInfo.TryGetAttribute <Setting>(); entry.Settings.SetOrAdd(fieldInfo, sett); } entry.onMouseOver = AccessTools.Method(entryType, "MouseOver"); entry.onClick = AccessTools.Method(entryType, "Clicked"); entry.onSelect = AccessTools.Method(entryType, "Selected"); entry.checkBox = AccessTools.Method(entryType, "Checkbox"); entry.type = entryType; // Find and append Entry to the correct Tab if (!GUIController.Tab(entry.category).entries.ContainsKey(entry)) { GUIController.Tab(entry.category).entries.Add(entry, entryType); } } catch (Exception e) { ThreadSafeLogger.ReportException(e, "Failed to initialise entries"); } } // Loop through our static instances and add them to the Correct Tab foreach (Entry entry in Entry.entries) { if (!GUIController.Tab(entry.category).entries.ContainsKey(entry)) { GUIController.Tab(entry.category).entries.Add(entry, entry.type); } } Panel_Logs.Initialise(); }