public AddFirmView(AddFirmViewModel addFirmViewModel, TypeOfNode typeOfNode) { _addFirmViewModel = addFirmViewModel; _typeOfNode = typeOfNode; InitializeComponent(); Init(); }
public List <CompanyStructureNode> GetNodesByType(TypeOfNode typeOfNode) { List <CompanyStructureNode> nodes = new List <CompanyStructureNode>(); using (SqlConnection connection = new SqlConnection(Constants.CONNECTION_STRING)) { connection.Open(); using (SqlCommand command = new SqlCommand()) { command.CommandText = "Select * from CompanyStructureNode where TypeOfNode = @typeOfNode"; command.Parameters.Add("@typeOfNode", SqlDbType.Int).Value = typeOfNode; command.Connection = connection; using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { CompanyStructureNode node = new CompanyStructureNode(); node.NodeId = reader.GetInt32(0); node.CodeOfNode = reader.GetString(1); node.NameOfNode = reader.GetString(2); node.TypeOfNode = (TypeOfNode)reader.GetInt32(3); node.HeadOfNodeId = reader.IsDBNull(5) ? 0 : reader.GetInt32(5); nodes.Add(node); } } } } return(nodes); }
public static string ToDescriptionString(this TypeOfNode val) { DescriptionAttribute[] attributes = (DescriptionAttribute[])val .GetType() .GetField(val.ToString()) .GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
public NodeA(Vector3 _position,int x,int y,TypeOfNode _InMap) { _Bloc = _InMap; x1 = x; y1 = y; Position = _position; FireZone = false; }
public PathfindingNode(TypeOfNode _selectedTypeOfNode, PathfindingNode _parent, Vector2 _gridPosition, Vector2 _start, Vector2 _end) { SelectedTypeOfNode = _selectedTypeOfNode; GridPosition = _gridPosition; Parent = _parent; G = CalculateGScore(_start); H = CalculateHScore(_end); F = G + H; }
public AddFirmView(AddFirmViewModel addFirmViewModel, TypeOfNode typeOfNode, int parentId, int firmId) { _addFirmViewModel = addFirmViewModel; _typeOfNode = typeOfNode; _parentId = parentId; _firmId = firmId; InitializeComponent(); Init(); }
public PathNode(Rect rect, TypeOfNode typeOfNode, Action <BaseNode> OnClickRemoveNode, string title) { this.typeOfNode = typeOfNode; windowRect = rect; OnRemoveNode = OnClickRemoveNode; this.title = title; CreatePathNode(); }
private void OnClickAddNode(Vector2 mousePosition, TypeOfNode typeOfNode, GUIStyle style, GUIStyle selectedStyle) { if (dialogue.nodes == null) { dialogue.nodes = new List <Node>(); } dialogue.nodes.Add(new Node(dialogue.globalNodeIndex, mousePosition, 200, 100, style, selectedStyle, inPointStyle, outPointStyle, labelStyle, selectedLabelStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, dialogue, typeOfNode)); dialogue.globalNodeIndex++; }
public CompanyStructureNode CreateFirm(string codeOfNode, string nameOfNode, TypeOfNode typeOfNode) { CompanyStructureNode firm = new CompanyStructureNode(); firm.CodeOfNode = codeOfNode; firm.NameOfNode = nameOfNode; firm.TypeOfNode = typeOfNode; return(firm); }
public CompanyStructureNode CreateNode(string codeOfNode, string nameOfNode, TypeOfNode typeOfNode, int parentNode) { CompanyStructureNode node = new CompanyStructureNode(); node.CodeOfNode = codeOfNode; node.NameOfNode = nameOfNode; node.TypeOfNode = typeOfNode; node.NodeAboveId = parentNode; return(node); }
public StartEndNode(Rect rect, TypeOfNode typeOfNode, Action <BaseNode> OnClickRemoveNode, string title, string name, GUID id, FlyThroughManager ftm) { this.typeOfNode = typeOfNode; windowRect = rect; OnRemoveNode = OnClickRemoveNode; this.title = title; this.name = name; this.id = id; this.ftm = ftm; //CreateStartEndNode(); }
public void AddNode(TypeOfNode typeOfNode, int parentId) { CompanyStructureNode node = new CompanyStructureNode(); if (HeadOfNodeId == 0) { node = _nodeFactory.CreateNode(CodeOfNode, NameOfNode, typeOfNode, parentId); RepositoryManager.CompanyStructureNodeRepository.AddNode(node); } else { node = _nodeFactory.CreateNode(CodeOfNode, NameOfNode, typeOfNode, parentId, HeadOfNodeId); RepositoryManager.CompanyStructureNodeRepository.AddNodeWithHead(node); } }
// test private bool Remove(TypeOfNode typeOfNode, Node node, T item) { if (node == null) { return(false); } // test // Deleting the head //if (parent == null) // return false; if (item.CompareTo(node.Value) < 0) { Remove(TypeOfNode.Left, node.Left, item); } else { if (item.CompareTo(node.Value) > 0) { Remove(TypeOfNode.Right, node.Right, item); } else { // Current node is sought-for node. if (node.Left != null && node.Right != null) { // Replace current node from the minimal element from the right sub-tree. node.Value = FindMin(node.Right).Value; // Delete element from the right sub-tree by using recursion. Remove(TypeOfNode.Right, node.Right, node.Value); } else { if (node.Left == null && node.Right == null) { switch (typeOfNode) { case (TypeOfNode.Left): node.Parent.Left = null; break; case (TypeOfNode.Right): node.Parent.Right = null; break; } // old // node = null; } else { if (node.Left != null) { node.Parent.Left = node.Left; //node = node.Left; } else { node.Parent.Left = node.Right; //node = node.Right; } } } } } return(true); }
public virtual void Visit(TypeOfNode node) { if (node != null) { AcceptChildren(node); } }
public override string ToString() { return($"{TypeOfNode.ToDescriptionString()} {NameOfNode}"); }
public Node(int _ID, Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, GUIStyle lStyle, GUIStyle slStyle, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <Node> OnClickRemoveNode, Dialogue dialogue, TypeOfNode _type) { //note pour plus tard : Creer une classe style avec une banque de donnée etc.. ID = _ID; ton = _type; outPoint = new List <ConnectionPoint>(); switch (ton) { case TypeOfNode.Start: rect = new Rect(position.x, position.y, width, height / 2); initialRect = new Rect(position.x, position.y, width, height / 2); labelRect = new Rect(rect.x + 20.0f, rect.y + 10, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 10, 175, 25); name = "Start"; outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.SentenceAnswer: rect = new Rect(position.x, position.y, width, height); initialRect = new Rect(position.x, position.y, width, height); labelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); answer = new List <string>() { "Reponse A", "Reponse B", "Reponse C", "Reponse D" }; pictures = new List <Sprite>() { null, null, null, null }; for (var i = 0; i < 4; i++) { outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); dialogue.globalConnectionPointIndex += 1; } inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.SentenceQuestion: rect = new Rect(position.x, position.y, width, height); initialRect = new Rect(position.x, position.y, width, height); labelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); questions = new List <string>() { "Je dois y aller", "", "", "" }; pictures = new List <Sprite>() { null, null, null, null }; for (var i = 0; i < 4; i++) { outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); dialogue.globalConnectionPointIndex += 1; } inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.Cinematique: rect = new Rect(position.x, position.y, width, height); initialRect = new Rect(position.x, position.y, width, height); labelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.ConditionCheck: rect = new Rect(position.x, position.y, width, height); initialRect = new Rect(position.x, position.y, width, height); labelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); name = "Condition"; for (var i = 0; i < 2; i++) { outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); dialogue.globalConnectionPointIndex += 1; } inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.ConditionChange: rect = new Rect(position.x, position.y, width, height); initialRect = new Rect(position.x, position.y, width, height); labelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); name = "Condition"; outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); dialogue.globalConnectionPointIndex += 1; inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.TextEntry: rect = new Rect(position.x, position.y, width, height); initialRect = new Rect(position.x, position.y, width, height); labelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 40, 175, 25); name = "Text Entry"; approTextEntry = new List <string>() { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; for (var i = 0; i < 2; i++) { outPoint.Add(new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, dialogue.globalConnectionPointIndex)); dialogue.globalConnectionPointIndex += 1; } inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; case TypeOfNode.End: rect = new Rect(position.x, position.y, width, height / 2); initialRect = new Rect(position.x, position.y, width, height / 2); labelRect = new Rect(rect.x + 20.0f, rect.y + 10, 175, 25); initialLabelRect = new Rect(rect.x + 20.0f, rect.y + 10, 175, 25); name = "End"; inPoint = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, dialogue.globalConnectionPointIndex); dialogue.globalConnectionPointIndex += 1; break; } style = nodeStyle; labelStyle = lStyle; defaultLabelStyle = lStyle; selectedLabelStyle = slStyle; defaultNodeStyle = nodeStyle; selectedNodeStyle = selectedStyle; OnRemoveNode = OnClickRemoveNode; }