/// <summary>设置棋子状态</summary> /// <param name="i">第几行</param> /// <param name="j">第几列</param> /// <param name="dotColor">棋子颜色</param> public void SetDot(int i, int j, DotColor dotColor) { service.AddItemToListBox(string.Format("{0},{1},{2}", i, j, dotColor)); service.AddItemToListBox(string.Format("side:{0}",side)); grid[i, j] = dotColor; pictureBox1.Invalidate(); }
public static DotGraph AddBinaryTree <T>(this DotGraph dotGraph, GMacBinaryTree <T> quadTree, bool showFullGraph) { var maxTreeDepth = quadTree.TreeDepth; var activeIDs = quadTree.LeafNodeIDs.ToArray(); var inactiveColor = DotColor.Rgb(Color.Gray); var activeColor = DotColor.Rgb(Color.Black); dotGraph.SetRankDir(DotRankDirection.LeftToRight); dotGraph.SetSplines(DotSplines.Spline); dotGraph.SetOverlap(DotOverlap.False); dotGraph.SetNodeMarginDelta(12); var nodeDefaults = dotGraph.AddNodeDefaults(); nodeDefaults.SetShape(DotNodeShape.Circle); nodeDefaults.SetStyle(DotNodeStyle.Solid); nodeDefaults.SetColor(inactiveColor); nodeDefaults.SetFontColor(inactiveColor); nodeDefaults.SetPenWidth(1.0f); var edgeDefaults = dotGraph.AddEdgeDefaults(); edgeDefaults.SetArrowHead(DotArrowType.Vee); edgeDefaults.SetStyle(DotEdgeStyle.Dashed); edgeDefaults.SetColor(inactiveColor); edgeDefaults.SetFontColor(inactiveColor); edgeDefaults.SetPenWidth(1.0f); var idsStack = new Stack <ulong>(); idsStack.Push(0ul); var treeDepthStack = new Stack <int>(); treeDepthStack.Push(maxTreeDepth); var dotNodeName = "".PadRight(maxTreeDepth, '-'); var dotNodeLabel = dotNodeName; var dotNode = dotGraph.AddNode(dotNodeName); dotNode.SetShape(DotNodeShape.DoubleCircle); dotNode.SetStyle(DotNodeStyle.Solid); dotNode.SetColor(activeColor); dotNode.SetFontColor(activeColor); dotNode.SetPenWidth(2.0f); dotNode.SetLabel(dotNodeLabel); while (idsStack.Count > 0) { var parentNodeId = idsStack.Pop(); var parentNodeTreeDepth = treeDepthStack.Pop(); dotNodeName = parentNodeTreeDepth == maxTreeDepth ? "".PadRight(parentNodeTreeDepth, '-') : parentNodeId.PatternToStringPadRight(maxTreeDepth, parentNodeTreeDepth); dotNode = dotGraph.AddNode(dotNodeName); var childNodesBitMask = 1ul << (parentNodeTreeDepth - 1); //Add child node 0 var childNodeId = parentNodeId; var isActive = childNodeId.IsActiveBinaryTreeNodeId(childNodesBitMask, activeIDs); if (showFullGraph || isActive) { AddChildNode( dotNode, childNodeId, parentNodeTreeDepth - 1, maxTreeDepth, isActive, activeColor ); if (parentNodeTreeDepth > 1) { idsStack.Push(childNodeId); treeDepthStack.Push(parentNodeTreeDepth - 1); } } //Add child node 1 childNodeId = parentNodeId | childNodesBitMask; isActive = childNodeId.IsActiveBinaryTreeNodeId(childNodesBitMask, activeIDs); if (showFullGraph || isActive) { AddChildNode( dotNode, childNodeId, parentNodeTreeDepth - 1, maxTreeDepth, isActive, activeColor ); if (parentNodeTreeDepth > 1) { idsStack.Push(childNodeId); treeDepthStack.Push(parentNodeTreeDepth - 1); } } } return(dotGraph); }
//Case for user creating a square. Remove all dots of specified color void RemoveAllDotsOfColor(DotColor color) { List<GameObject> toDestroy = new List<GameObject>(); for(int row = 0; row < Rows; row++){ for(int column = 0; column < Columns; column++){ if(dotArray[column, row].GetComponent<Dot>().dotColor == color){ toDestroy.Add (dotArray[column, row]); } } } while(toDestroy.Count > 0){ GameObject game = toDestroy[0]; Dot dot = game.GetComponent<Dot>(); dotArray[dot.loc.column, dot.loc.row] = null; toDestroy.Remove (game); game.transform.position = new Vector3(-10, -10, 0); game.transform.parent = dotPools[(int)dot.dotColor].gameObject.transform; } StartCoroutine(FillDots ()); }
public DotEdge SetLabelFontColor(DotColor value) { AttrValues.SetAttribute("labelfontcolor", value.QuotedValue); return(this); }
public DotEdge SetFillColor(DotColor value) { AttrValues.SetAttribute("fillcolor", value.QuotedValue); return(this); }
/// <summary> /// Compare colors. /// </summary> public static bool HaveSameColor(this DotColor c, Transform other) { return(c == other.GetComponent <DotBase>().color); }
public DotGraph SetBackgroundColor(DotColor c1, DotColor c2) { return(SetAttribute("bgcolor", (c1.Value + ":" + c2.Value).DoubleQuote())); }
public void SetDot(int i, int j, DotColor dotColor) { service.AddItemToListBox(string.Format("{0},{1},{2}", i, j, dotColor)); grid[i, j] = dotColor; pictureBox1.Invalidate(); }
public static DotColor Gradient(DotColor start, DotColor end) => new DotColor(start.value + ':' + end.value);
public DotHtmlTable SetColor(DotColor value) { AttrValues.SetAttribute("COLOR", value.QuotedValue); return(this); }
public DotHtmlTable SetBackgroundColor(DotColor c1, DotColor c2) { AttrValues.SetAttribute("BGCOLOR", (c1.Value + ":" + c2.Value).DoubleQuote()); return(this); }
public DotHtmlTable SetBackgroundColor(DotColor c) { AttrValues.SetAttribute("BGCOLOR", c.QuotedValue); return(this); }
public DotHtmlCell SetBackgroundColor(DotColor value) { AttrValues.SetAttribute("BGCOLOR", value.QuotedValue); return(this); }
/// <summary> /// Create a font tag /// </summary> /// <param name="color"></param> /// <returns></returns> public static DotHtmlTagFont Font(DotColor color) { return (new DotHtmlTagFont() .SetColor(color)); }
public DotGraph SetFontColor(DotColor value) { return(SetAttribute("fontcolor", value.QuotedValue)); }
public static DotGraph AddQuadTree <T>(this DotGraph dotGraph, GMacQuadTree <T> quadTree, bool showFullGraph) { var maxTreeDepth = quadTree.TreeDepth; var activeIDs = quadTree.LeafNodeIDs.ToArray(); var inactiveColor = DotColor.Rgb(Color.Gray); var activeColor = DotColor.Rgb(Color.Black); dotGraph.SetRankDir(DotRankDirection.LeftToRight); dotGraph.SetSplines(DotSplines.Spline); dotGraph.SetOverlap(DotOverlap.False); dotGraph.SetNodeMarginDelta(12); var nodeDefaults = dotGraph.AddNodeDefaults(); nodeDefaults.SetShape(DotNodeShape.Circle); nodeDefaults.SetStyle(DotNodeStyle.Solid); nodeDefaults.SetColor(inactiveColor); nodeDefaults.SetFontColor(inactiveColor); nodeDefaults.SetPenWidth(1.0f); var edgeDefaults = dotGraph.AddEdgeDefaults(); edgeDefaults.SetArrowHead(DotArrowType.Vee); edgeDefaults.SetStyle(DotEdgeStyle.Dashed); edgeDefaults.SetColor(inactiveColor); edgeDefaults.SetFontColor(inactiveColor); edgeDefaults.SetPenWidth(1.0f); var idsStack1 = new Stack <ulong>(); idsStack1.Push(0ul); var idsStack2 = new Stack <ulong>(); idsStack2.Push(0ul); var treeDepthStack = new Stack <int>(); treeDepthStack.Push(maxTreeDepth); var s = "".PadRight(maxTreeDepth, '-'); var dotNodeName = s + ", " + s; var dotNodeLabel = s + '\n' + s; var dotNode = dotGraph.AddNode(dotNodeName); dotNode.SetShape(DotNodeShape.DoubleCircle); dotNode.SetStyle(DotNodeStyle.Solid); dotNode.SetColor(activeColor); dotNode.SetFontColor(activeColor); dotNode.SetPenWidth(2.0f); dotNode.SetLabel(dotNodeLabel); while (idsStack1.Count > 0) { var idPart1 = idsStack1.Pop(); var idPart2 = idsStack2.Pop(); var treeDepth = treeDepthStack.Pop(); var s1 = treeDepth == maxTreeDepth ? "".PadRight(treeDepth, '-') : idPart1.PatternToStringPadRight(maxTreeDepth, treeDepth); var s2 = treeDepth == maxTreeDepth ? "".PadRight(treeDepth, '-') : idPart2.PatternToStringPadRight(maxTreeDepth, treeDepth); dotNodeName = s1 + ", " + s2; dotNode = dotGraph.AddNode(dotNodeName); var childNodesBitMask = 1ul << (treeDepth - 1); //Add child node 00 var childNodeId = Tuple.Create(idPart1, idPart2); var isActive = childNodeId.IsActiveQuadTreeNodeId(childNodesBitMask, activeIDs); if (showFullGraph || isActive) { AddChildNode( dotNode, childNodeId, treeDepth - 1, maxTreeDepth, isActive, activeColor ); if (treeDepth > 1) { idsStack1.Push(childNodeId.Item1); idsStack2.Push(childNodeId.Item2); treeDepthStack.Push(treeDepth - 1); } } //Add child node 01 childNodeId = Tuple.Create(idPart1 | childNodesBitMask, idPart2); isActive = childNodeId.IsActiveQuadTreeNodeId(childNodesBitMask, activeIDs); if (showFullGraph || isActive) { AddChildNode( dotNode, childNodeId, treeDepth - 1, maxTreeDepth, isActive, activeColor ); if (treeDepth > 1) { idsStack1.Push(childNodeId.Item1); idsStack2.Push(childNodeId.Item2); treeDepthStack.Push(treeDepth - 1); } } //Add child node 10 childNodeId = Tuple.Create(idPart1, idPart2 | childNodesBitMask); isActive = childNodeId.IsActiveQuadTreeNodeId(childNodesBitMask, activeIDs); if (showFullGraph || isActive) { AddChildNode( dotNode, childNodeId, treeDepth - 1, maxTreeDepth, isActive, activeColor ); if (treeDepth > 1) { idsStack1.Push(childNodeId.Item1); idsStack2.Push(childNodeId.Item2); treeDepthStack.Push(treeDepth - 1); } } //Add child node 11 childNodeId = Tuple.Create(idPart1 | childNodesBitMask, idPart2 | childNodesBitMask); isActive = childNodeId.IsActiveQuadTreeNodeId(childNodesBitMask, activeIDs); if (showFullGraph || isActive) { AddChildNode( dotNode, childNodeId, treeDepth - 1, maxTreeDepth, isActive, activeColor ); if (treeDepth > 1) { idsStack1.Push(childNodeId.Item1); idsStack2.Push(childNodeId.Item2); treeDepthStack.Push(treeDepth - 1); } } } return(dotGraph); }
public DotNode SetFontColor(DotColor value) { AttrValues.SetAttribute("fontcolor", value.QuotedValue); return(this); }
public DotSubGraphDefaults SetBackgroundColor(DotColor value) { AttrValues.SetAttribute("bgcolor", value.QuotedValue); return(this); }
public DotSubGraphDefaults SetPenColor(DotColor value) { AttrValues.SetAttribute("pencolor", value.QuotedValue); return(this); }
public DotGraph SetBackgroundColor(DotColor value) { return(SetAttribute("bgcolor", value.QuotedValue)); }