public Node(string reference, GTASprite sprite, NodeType type) { Ref = reference; Direction = TreeDirection.Auto; Type = type; Sprite = sprite; }
public Node(string reference, GTASprite sprite, NodeType type, TreeDirection direction = TreeDirection.Auto) { Ref = reference; Direction = direction; Type = type; Sprite = sprite; }
public Node(string reference, WeaponHash wepHash, GTASprite sprite, NodeType type, TreeDirection direction = TreeDirection.Auto) { Ref = reference; Direction = direction; Type = type; Sprite = sprite; WepHash = wepHash; }
public Node(string reference, WeaponHash wepHash, GTASprite sprite, NodeType type, TreeDirection direction = TreeDirection.Auto) { Ref = reference; Direction = direction; Type = type; Sprite = sprite; WepHash = wepHash; }
private void DrawNode(Node nodedata, Node parent, TreeDirection direction) { var selected = SelectedObj == nodedata; var color = selected ? Color.DodgerBlue : Color.FromArgb(120, 128, 128, 128); if (parent != null) { var parentUnlocked = parent.Unlocked(DataTree); if (!parentUnlocked && !selected) { color = Color.FromArgb(150, 120, 120, 120); } if (parentUnlocked && parent == SelectedObj && !SelectedObj.Unlocked(DataTree)) { color = Color.FromArgb(150, 255, 150, 0); } } new UIRectangle(nodedata.Position, new Size(NTree.NodeSize, NTree.NodeSize), Color.Black).Draw(); new UIRectangle(nodedata.Position + new Size(2, 2), new Size(NTree.NodeSize - 4, NTree.NodeSize - 4), color).Draw(); new UIRectangle(nodedata.Position + new Size(4, 4), new Size(NTree.NodeSize - 8, NTree.NodeSize - 8), Color.FromArgb(255, 24, 24, 24)).Draw(); nodedata.Sprite.Draw(nodedata.Position + new Size(4, 4), NTree.NodeSize - 8, NTree.NodeSize - 8, Color.White); new UIText(nodedata.GetName(), nodedata.Position + new Size(NTree.NodeSize / 2, NTree.NodeSize), 0.35f, Color.White, 0, true).Draw(); new UIText(nodedata.GetFooter(DataTree), nodedata.Position + new Size(NTree.NodeSize / 2, NTree.NodeSize + 17), 0.21f, Color.White, 0, true).Draw(); if (parent == null) { return; } var pPos = parent.Position; var dir = nodedata.Direction; var linkColor = parent == SelectedObj && !nodedata.Unlocked(DataTree) ? Color.FromArgb(150, 255, 150, 0) : Color.White; switch (dir) { case TreeDirection.Right: new UIRectangle(pPos + NTree.NodeCenter + new Size(NTree.NodeSize / 2 + 29, -NTree.LinkThickness / 2), new Size(NTree.LinkLength - 19, NTree.LinkThickness), linkColor).Draw(); break; case TreeDirection.Down: new UIRectangle(pPos + NTree.NodeCenter + new Size(-NTree.LinkThickness / 2, NTree.NodeSize / 2 + 29), new Size(NTree.LinkThickness, NTree.LinkLength - 19), linkColor).Draw(); break; case TreeDirection.Left: new UIRectangle(pPos + NTree.NodeCenter + new Size(-(NTree.NodeSize / 2 + 29) - 50, -NTree.LinkThickness / 2), new Size(NTree.LinkLength - 19, NTree.LinkThickness), linkColor).Draw(); break; case TreeDirection.Up: new UIRectangle(pPos + NTree.NodeCenter + new Size(-NTree.LinkThickness / 2, -(NTree.NodeSize / 2 + 29) - 31), new Size(NTree.LinkThickness, NTree.LinkLength - 19), linkColor).Draw(); break; } }
private void DrawNode(Node nodedata, Node parent, TreeDirection direction) { var selected = SelectedObj == nodedata; var color = selected ? Color.DodgerBlue : Color.FromArgb(120, 128, 128, 128); if(parent != null) { var parentUnlocked = parent.Unlocked(DataTree); if (!parentUnlocked && !selected) color = Color.FromArgb(150, 120, 120, 120); if (parentUnlocked && parent == SelectedObj && !RPG.PlayerData.GetSkill(SelectedObj.Ref).Unlocked) color = Color.FromArgb(150, 255, 150, 0); } new UIRectangle(nodedata.Position, new Size(NTree.NodeSize, NTree.NodeSize), Color.Black).Draw(); new UIRectangle(nodedata.Position + new Size(2,2), new Size(NTree.NodeSize -4, NTree.NodeSize-4), color).Draw(); new UIRectangle(nodedata.Position + new Size(4, 4), new Size(NTree.NodeSize - 8, NTree.NodeSize - 8), Color.FromArgb(255, 24, 24, 24)).Draw(); nodedata.Sprite.Draw(nodedata.Position + new Size(4, 4),56,56,Color.White); new UIText(nodedata.GetName(), nodedata.Position + new Size(NTree.NodeSize / 2, NTree.NodeSize), 0.35f, Color.White, 0, true).Draw(); new UIText(nodedata.GetFooter(DataTree), nodedata.Position + new Size(NTree.NodeSize / 2, NTree.NodeSize + 17), 0.21f, Color.White, 0, true).Draw(); if (parent == null) return; var pPos = parent.Position; var dir = nodedata.Direction; var linkColor = parent == SelectedObj && !nodedata.Unlocked(DataTree) ? Color.FromArgb(150, 255, 150, 0) : Color.White; switch (dir) { case TreeDirection.Right: new UIRectangle(pPos + NTree.NodeCenter + new Size(NTree.NodeSize / 2 + 29, -NTree.LinkThickness / 2), new Size(NTree.LinkLength - 19, NTree.LinkThickness), linkColor).Draw(); break; case TreeDirection.Down: new UIRectangle(pPos + NTree.NodeCenter + new Size(-NTree.LinkThickness / 2, NTree.NodeSize / 2 + 29), new Size(NTree.LinkThickness, NTree.LinkLength - 19), linkColor).Draw(); break; case TreeDirection.Left: new UIRectangle(pPos + NTree.NodeCenter + new Size(-(NTree.NodeSize / 2 + 29) - 50, -NTree.LinkThickness / 2), new Size(NTree.LinkLength - 19, NTree.LinkThickness), linkColor).Draw(); break; case TreeDirection.Up: new UIRectangle(pPos + NTree.NodeCenter + new Size(-NTree.LinkThickness / 2, -(NTree.NodeSize / 2 + 29) - 50), new Size(NTree.LinkThickness, NTree.LinkLength - 19), linkColor).Draw(); break; } }
public static ExpressionTree AssociateTreeWithFilter(ExpressionTree tree, FilterBase filter, FilterImplication implication, TreeDirection treeDirection) { // check the parameters Debug.Assert(tree != null && filter != null, "Null parameters"); ExpressionTree result = new ExpressionTree(); if(treeDirection == TreeDirection.Left) { result.AddRoot(ExpressionType.Implication, implication); result.Root.Left = tree.Root; result.AddNode(result.Root, TreeDirection.Right, ExpressionType.Filter, filter); } else { result.AddRoot(ExpressionType.Implication, implication); result.Root.Right = tree.Root; result.AddNode(result.Root, TreeDirection.Left, ExpressionType.Filter, filter); } return result; }
public void RemoveChildren(ExpressionNode parent, TreeDirection direction) { // check the parameters Debug.Assert(parent != null, "Parent is null"); if(direction == TreeDirection.Left) { parent.Left = null; } else { parent.Right = null; } }
/// <summary> /// Adds the node. /// </summary> /// <param name="parent">The parent.</param> /// <param name="direction">The direction.</param> /// <param name="type">The type.</param> /// <param name="item">The item.</param> public void AddNode(ExpressionNode parent, TreeDirection direction, ExpressionType type, object item) { // check the parameters Debug.Assert(parent != null && item != null, "Parent or Item are null"); if(direction == TreeDirection.Left) { parent.Left = NewNodeByType(type, item); parent.Left.Parent = parent; } else { parent.Right = NewNodeByType(type, item); parent.Right.Parent = parent; } }