public static void DrawGroup(Group group) { //CellObject.SetObject(Cell.current, group); if (UI.current.layout) { UI.current.cellObjs.ForceAdd(group, Cell.current, "Group"); } Texture2D tex = UI.current.textures.GetColorizedTexture("MapMagic/Group", group.color); GUIStyle style = UI.current.textures.GetElementStyle(tex); Draw.Element(style); Cell.EmptyRowPx(5); using (Cell.Row) { Cell.EmptyLinePx(5); using (Cell.LinePx(24)) Draw.EditableLabelRight(ref group.name, style: UI.current.styles.bigLabel); //using (Cell.LineStd) Draw.EditableLabelRight(ref group.comment); Cell.EmptyLinePx(3); using (Cell.LineStd) { using (Cell.RowPx(0)) { using (Cell.RowPx(20)) Draw.Icon(UI.current.textures.GetTexture("DPUI/Chevrons/Down")); using (Cell.RowPx(35)) Draw.Label("Color"); if (Draw.Button("", visible: false)) { GroupRightClick.DrawGroupColorSelector(group); } } } } }
public static void DrawGroup(Group group, bool isMini = false) { float miniFactor = !isMini ? 1 : 0.5f / GraphWindow.miniZoom; //group controls are slightly smaller than in fullscreen //CellObject.SetObject(Cell.current, group); if (UI.current.layout) { UI.current.cellObjs.ForceAdd(group, Cell.current, "Group"); } Texture2D tex = UI.current.textures.GetColorizedTexture("MapMagic/Group", group.color); GUIStyle style = UI.current.textures.GetElementStyle(tex); Draw.Element(style); Cell.EmptyRowPx(5 * miniFactor); using (Cell.Row) { if (isMini && miniNameStyle == null) { miniNameStyle = new GUIStyle(UI.current.styles.bigLabel); miniNameStyle.fontSize = (int)(miniNameStyle.fontSize / GraphWindow.miniZoom * 0.6f); } Cell.EmptyLinePx(5 * miniFactor); GUIStyle labelStyle = !isMini ? UI.current.styles.bigLabel : miniNameStyle; using (Cell.LinePx(24 * miniFactor)) Draw.EditableLabelRight(ref group.name, style: labelStyle); //using (Cell.LineStd) Draw.EditableLabelRight(ref group.comment); Cell.EmptyLinePx(3 * miniFactor); using (Cell.LineStd) { using (Cell.RowPx(0)) { if (!isMini) { using (Cell.RowPx(20)) Draw.Icon(UI.current.textures.GetTexture("DPUI/Chevrons/Down"), scale: 0.5f * miniFactor); using (Cell.RowPx(35)) Draw.Label("Color"); } if (Draw.Button("", visible: false)) { GroupRightClick.DrawGroupColorSelector(group); } } } } }
public static Item RightClickItems(UI ui, Vector2 mousePos, Graph graph) { ClickedNear(ui, mousePos, out Group clickedGroup, out Generator clickedGen, out IOutlet <object> clickedLayer, out IInlet <object> clickedLink, out IInlet <object> clickedInlet, out IOutlet <object> clickedOutlet, out FieldInfo clickedField); Item menu = new Item("Menu"); menu.subItems = new List <Item>(); if (clickedOutlet != null) { menu.subItems.Add(CreateRightClick.AppendItems(mousePos, graph, clickedOutlet, priority: 5)); } else if (clickedLink != null) { menu.subItems.Add(CreateRightClick.InsertItems(mousePos, graph, clickedLink, priority: 5)); } else { menu.subItems.Add(CreateRightClick.CreateItems(mousePos, graph, priority: 5)); } menu.subItems.Add(GeneratorRightClick.GeneratorItems(clickedGen, graph, priority: 4)); menu.subItems.Add(GroupRightClick.GroupItems(mousePos, clickedGroup, graph, priority: 3)); menu.subItems.Add(ValueRightClick.ValueItems(clickedField, clickedLayer, clickedGen, graph, priority: 2)); menu.subItems.Add(GraphPopup.GraphItems(graph, priority: 1)); return(menu); }