public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects) { try { InspectGizmoGrid.objList.Clear(); InspectGizmoGrid.objList.AddRange(selectedObjects); InspectGizmoGrid.gizmoList.Clear(); for (int i = 0; i < InspectGizmoGrid.objList.Count; i++) { ISelectable selectable = InspectGizmoGrid.objList[i] as ISelectable; if (selectable != null) { foreach (Gizmo current in selectable.GetGizmos()) { InspectGizmoGrid.gizmoList.Add(current); } } } for (int j = 0; j < InspectGizmoGrid.objList.Count; j++) { Thing t = InspectGizmoGrid.objList[j] as Thing; if (t != null) { List <Designator> allDesignators = ReverseDesignatorDatabase.AllDesignators; for (int k = 0; k < allDesignators.Count; k++) { Designator des = allDesignators[k]; if (des.CanDesignateThing(t).Accepted) { Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = des.LabelCapReverseDesignating(t); command_Action.icon = des.IconReverseDesignating(t); command_Action.defaultDesc = des.DescReverseDesignating(t); command_Action.action = delegate { des.DesignateThing(t); des.Finalize(true); }; command_Action.hotKey = des.hotKey; command_Action.groupKey = des.groupKey; InspectGizmoGrid.gizmoList.Add(command_Action); } } } } Gizmo gizmo; GizmoGridDrawer.DrawGizmoGrid(InspectGizmoGrid.gizmoList, RimWorld.MainTabWindow_Inspect.PaneSize.x + 20f, out gizmo); } catch (Exception ex) { Log.ErrorOnce(ex.ToString(), 3427734); } }
public void DesignationTabOnGUI() { if (DesignatorManager.SelectedDesignator != null) { DesignatorManager.SelectedDesignator.DoExtraGuiControls(0f, (float)(Screen.height - 35) - ((MainTabWindow_Architect)MainTabDefOf.Architect.Window).WinHeight - 230f); } float startX = 210f; Gizmo selectedDesignator; GizmoGridDrawer.DrawGizmoGrid(this.def.resolvedDesignators.Cast <Gizmo>(), startX, out selectedDesignator); if (selectedDesignator == null && DesignatorManager.SelectedDesignator != null) { selectedDesignator = DesignatorManager.SelectedDesignator; } this.DoInfoBox(ArchitectCategoryTab.InfoRect, (Designator)selectedDesignator); }