Beispiel #1
0
		private void DrawMiniSelected () 
		{
			if (selected.Count != 1)
				return;

			Generator gen = selected.Any();

			Vector2 cellSize = new Vector2(gen.guiSize.x, 0);
			Vector2 cellPos = PlaceByAnchor(graph.guiMiniAnchor, graph.guiMiniPos, gen.guiSize);

			using (Cell.Custom(cellPos, cellSize))
			{
				//dragging
				if (!UI.current.layout)
				{
					if (DragDrop.TryDrag(Cell.current, UI.current.mousePos))
					{
						Vector2 newPosition = GeneratorDraw.MoveGenerator(Cell.current, DragDrop.initialRect.position + DragDrop.totalDelta);
						(graph.guiMiniAnchor, graph.guiMiniPos) = GetAnchorPos(newPosition, gen.guiSize);
					}
					DragDrop.TryRelease(Cell.current);
					DragDrop.TryStart(Cell.current, UI.current.mousePos, Cell.current.InternalRect);
				}

				//shadow
				//GUIStyle shadowStyle = UI.current.textures.GetElementStyle("MapMagic/Node/ShadowMini", 
				//	borders:GeneratorDraw.shadowBorders,
				//	overflow:GeneratorDraw.shadowOverflow);
				//Draw.Element(shadowStyle);

				//drawing
				try { GeneratorDraw.DrawGenerator(gen, graph, selected:false, activeLinks:true); }
				catch (ExitGUIException)
					{ } //ignoring
				catch (Exception e) 
					{ Debug.LogError("Draw Graph Window failed: " + e); }

				//right click menu (should have access to cellObjs)
				if (!UI.current.layout  &&  Event.current.type == EventType.MouseDown  &&  Event.current.button == 1)
					RightClick.DrawRightClickItems(miniSelectedUI, miniSelectedUI.mousePos, graph);
			}
		}