public static void PushMana(Nodes.Node nodeFrom, Nodes.Node nodeTo) { //If there is a mana on the first node, and no mana on the second node, it will move it. if (nodeFrom == null) { return; } if (nodeTo == null) { return; } if (nodeFrom.mana == null) { return; } if (nodeTo.mana != null) { return; } if (Time.timeSinceLevelLoad >= (nodeFrom.mana.timeSet + 1)) { Manas.Mana mana = nodeFrom.mana; mana.timeSet = Time.timeSinceLevelLoad; mana.go.transform.position = nodeTo.pos; mana.node = nodeTo; nodeFrom.mana = null; nodeTo.mana = mana; } }
/// <summary> /// Create a new node event. /// </summary> /// <param name="node">The node this event belongs to.</param> /// <param name="evnt">The event we want to attach to a node.</param> public Event(Nodes.Node node, string label, string description) { _label = label; _baselabel = label; _description = description; _node = node; }
public async Task <bool> RemoveNodes(List <string> nodes) { return(await Task.Run(() => { foreach (var id in nodes) { Nodes.Node oldNode = engine.GetNode(id); if (oldNode == null) { engine.LogEngineError($"Can`t remove node [{id}]. Does not exist."); return false; } if (oldNode.GetNodeOptions().ProtectedAccess) { if (!User.HasClaim(x => x.Type == UserClaims.EditorProtectedAccess)) { engine.LogEngineError( $"Can`t remove node [{oldNode.Category}/{oldNode.Type}]. No permissions for protected access."); continue; } } engine.RemoveNode(oldNode); } return true; })); }
/// <summary> /// Sets the value of the property for the given node from a string. /// </summary> /// <param name="node">The node we want to set the value on.</param> /// <param name="valueString">The string holding the value.</param> public void SetValueFromString(List <Nodes.Node.ErrorCheck> result, Nodes.Node node, string valueString) { if (_property != null) { _property.SetValue(node, FromStringValue(result, node, null, _property.PropertyType, valueString), null); } }
public async Task <bool> CloneNode(string id) { return(await Task.Run(() => { if (engine == null) { return false; } Nodes.Node node = engine.GetNode(id); if (node == null) { engine.LogEngineError($"Can`t clone node [{id}]. Does not exist."); return false; } if (node.GetNodeOptions().ProtectedAccess) { if (!User.HasClaim(x => x.Type == UserClaims.EditorProtectedAccess)) { engine.LogEngineError( $"Can`t clone node [{node.Category}/{node.Type}]. No permissions for protected access."); return false; } } engine.CloneNode(id); return true; })); }
void item_Click(object sender, EventArgs e) { MenuItem item = (MenuItem)sender; Type editorType = (Type)item.Tag; Label label = (Label)item.Parent.Tag; DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; Debug.Check(_selectedObject == editor.SelectedObject); Nodes.Node node = _selectedObject as Nodes.Node; if (node != null) { node.OnPropertyValueChanged(true); } Attachments.Attachment attach = _selectedObject as Attachments.Attachment; if (attach != null) { attach.OnPropertyValueChanged(true); } SelectedObject = _selectedObject; }
public async Task <bool> CreateLink(LiteGraph.Link link) { return(await Task.Run(() => { if (engine == null) { return false; } Nodes.Node outNode = SystemController.nodesEngine.GetNode(link.origin_id); Nodes.Node inNode = SystemController.nodesEngine.GetNode(link.target_id); if (outNode == null || inNode == null) { engine.LogEngineError( $"Can`t create link from [{link.origin_id}] to [{link.target_id}]. Does not exist."); return false; } if (outNode.GetNodeOptions().ProtectedAccess || inNode.GetNodeOptions().ProtectedAccess) { if (!User.HasClaim(x => x.Type == UserClaims.EditorProtectedAccess)) { engine.LogEngineError( $"Can`t create link from [{link.origin_id}] to [{link.target_id}]. No permissions for protected access."); return false; } } engine.AddLink(outNode.Outputs[link.origin_slot], inNode.Inputs[link.target_slot]); return true; })); }
protected void OnValueChanged() { if (!_valueWasAssigned) { return; } Nodes.Node node = _object as Nodes.Node; if (node != null) { node.OnPropertyValueChanged(true); if (ValueWasChanged != null) { ValueWasChanged(); } return; } Events.Event evnt = _object as Events.Event; if (evnt != null) { evnt.OnPropertyValueChanged(true); if (ValueWasChanged != null) { ValueWasChanged(); } return; } }
private void TreeViewItemExt_Drop(object sender, DragEventArgs e) { TreeViewItemExt tvie = sender as TreeViewItemExt; if (tvie != null && !tvie.IsDragging && e != null) { IDataObject data = e.Data; if (data.GetDataPresent(typeof(Nodes.Node).ToString())) { Nodes.Node payload = data.GetData(typeof(Nodes.Node)) as Nodes.Node; if (payload != null && this.DragNDropCmd != null) { // inform user string message = string.Format("moving {0}\nto {1}", payload.ToString(), this.Header.ToString()); string caption = "Moving Node"; MessageBoxResult answer = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (answer == MessageBoxResult.Yes) { // execute drop command this.DragNDropCmd.Execute(new WinUtils.TwoObjects { object1 = payload, object2 = this.Header }); e.Handled = true; } // restore the visual style of any containing nodes TreeViewItemExt.RestoreVisualStylesAfterDrop(); } } } }
private void InspectObject(AgentType agentType, string agentName, string agentFullname) { Nodes.Node node = null; if (agentType == null && !string.IsNullOrEmpty(agentFullname)) { int frame = AgentDataPool.CurrentFrame > -1 ? AgentDataPool.CurrentFrame : 0; string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentFullname, frame); List <string> highlightNodeIds = FrameStatePool.GetHighlightNodeIds(agentFullname, frame, behaviorFilename); List <string> updatedNodeIds = FrameStatePool.GetUpdatedNodeIds(agentFullname, frame, behaviorFilename); Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = FrameStatePool.GetProfileInfos(frame, behaviorFilename); BehaviorNode behavior = UIUtilities.ShowBehaviorTree(agentFullname, frame, highlightNodeIds, updatedNodeIds, HighlightBreakPoint.Instance, profileInfos); node = behavior as Nodes.Node; } _agentType = agentType; _agentName = agentName; Hide(); setText(agentType, agentName); parametersPanel.InspectObject(agentType, agentFullname, node); if (AgentDataPool.CurrentFrame > -1 && !string.IsNullOrEmpty(agentName)) { List <AgentDataPool.ValueMark> valueSet = AgentDataPool.GetValidValues(node, agentType, agentFullname, AgentDataPool.CurrentFrame); foreach (AgentDataPool.ValueMark value in valueSet) { SetProperty(agentType != null ? agentType.ToString() : null, agentName, value.Name, value.Value); } } lostAnyFocus(); Show(); }
private void setRootNode(Nodes.Node root) { _isParReady = false; this.Hide(); if (_rootNode != null) { for (int i = 0; i < _rootNode.Pars.Count; ++i) { ParInfo parameter = _rootNode.Pars[i]; parameter.ParameterSet -= parameter_ParameterSet; } deleteAllRowControls(); } _rootNode = root; if (_rootNode != null) { for (int i = 0; i < _rootNode.Pars.Count; ++i) { ParInfo parameter = _rootNode.Pars[i]; parameter.ParameterSet -= parameter_ParameterSet; parameter.ParameterSet += parameter_ParameterSet; addRowControl(_rootNode.Pars[i]); } } this.Show(); _isParReady = true; }
public void InspectObject(AgentType agentType, string agentFullname, Nodes.Node node) { _agentFullname = agentFullname; preLayout(); deleteAllRowControls(); if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { addRowControl(p, null); } } else if (node != null) { List <ParInfo> allPars = node.Pars; foreach (ParInfo par in allPars) { addRowControl(null, par); } } postLayout(); }
public async Task <bool> RemoveNode(LiteGraph.Node node) { return(await Task.Run(() => { if (engine == null) { return false; } Nodes.Node oldNode = engine.GetNode(node.id); if (oldNode == null) { engine.LogEngineError($"Can`t remove node [{node.id}]. Does not exist."); return false; } if (oldNode.GetNodeOptions().ProtectedAccess) { if (!User.HasClaim(x => x.Type == UserClaims.EditorProtectedAccess)) { engine.LogEngineError( $"Can`t remove node [{oldNode.Category}/{oldNode.Type}]. No permissions for protected access."); return false; } } engine.RemoveNode(oldNode); return true; })); }
private void listView_Click(object sender, EventArgs e) { // check if there is an item selected if (listView.SelectedItems.Count < 1) { return; } // check if this item has a node connected to it. The no-errors message doesn't Nodes.Node node = listView.SelectedItems[0].Tag as Nodes.Node; if (node == null) { return; } // show the behaviour and select the node. NodeViewData nvd = _behaviorTreeList.ShowNode(node); Debug.Check(nvd != null); _behaviorTreeView.SelectedNode = nvd; _behaviorTreeView.ShowNode(nvd); PropertiesDock.InspectObject(nvd.RootBehavior, nvd.Node); }
private void RootNode_WasModified(Nodes.BehaviorNode root, Nodes.Node node) { if (root == _behaviorTreeView.RootNode) { Text = TabText = "*" + ((Nodes.Node)root).Label; } }
private void Node_OnUpdate(Nodes.Node n) { if (albedoNode != null && albedoNode.Node == n) { SetAlbedo(n.GetActiveBuffer()); } else if (metallicNode != null && metallicNode.Node == n) { SetMetallic(n.GetActiveBuffer()); } else if (roughnessNode != null && roughnessNode.Node == n) { SetRoughness(n.GetActiveBuffer()); } else if (normalNode != null && normalNode.Node == n) { SetNormal(n.GetActiveBuffer()); } else if (heightNode != null && heightNode.Node == n) { SetHeight(n.GetActiveBuffer()); } else if (occlusionNode != null && occlusionNode.Node == n) { SetOcclusion(n.GetActiveBuffer()); } else if (thicknessNode != null && thicknessNode.Node == n) { SetThickness(n.GetActiveBuffer()); } else if (emissionNode != null && emissionNode.Node == n) { SetEmission(n.GetActiveBuffer()); } }
public static void LookForCrowprint(Nodes.Node node) { //Debug.Log("Looking for Crowprint, Node uId: " + node.uId); List <Nodes.Connection> connections = new List <Nodes.Connection>(); connections.Add(Nodes.Con(0, 0, 2, 0, 0, 0)); connections.Add(Nodes.Con(-2, 0, 0, 0, 0, 0)); connections.Add(Nodes.Con(2, 0, 1, 0, 0, 0)); connections.Add(Nodes.Con(2, 0, -2, 0, 0, 0)); connections.Add(Nodes.Con(-1, 0, -1, 0, 0, -2)); connections.Add(Nodes.Con(0, 0, -2, -1, 0, -1)); List <Nodes.Connection> result = Nodes.CheckRuneMulti(connections, node); if (result != null && result.Count > 0) { //Debug.Log("FOUND RUNE: Crowprint"); Rune rune = new Rune(); rune.type = RuneTypes.RuneCrowprint; InitRune(rune, result); CheckRuneRequirements(rune); runes.Add(rune); } }
protected void OnValueChanged(DesignerPropertyInfo property) { if (!_valueWasAssigned) { return; } Nodes.Node node = _object as Nodes.Node; if (node != null) { node.OnPropertyValueChanged(true); } else { Attachments.Attachment attach = _object as Attachments.Attachment; if (attach != null) { attach.OnPropertyValueChanged(true); } } if (ValueWasChanged != null) { ValueWasChanged(this, property); } }
private List <ParInfo> getPars() { List <ParInfo> pars = new List <ParInfo>(); Nodes.Node node = _object as Nodes.Node; Attachments.Attachment attach = _object as Attachments.Attachment; if (node != null || attach != null || this._root != null) { Behaviac.Design.Nodes.BehaviorNode bn = (node != null ? node.Behavior : null); if (bn == null) { bn = (attach != null ? attach.Behavior : null); } if (bn == null && this._root != null) { bn = this._root.Behavior; } List <ParInfo> allPars = new List <ParInfo>(); ((Nodes.Node)bn).GetAllPars(ref allPars); foreach (ParInfo par in allPars) { if (!string.IsNullOrEmpty(par.Name)) { if (Plugin.IsCompatibleType(FilterType, par.Type)) { pars.Add(par); } } } } return(pars); }
public void SetPar(ParInfo par, Nodes.Node rootNode, bool isNewPar) { Debug.Check(par != null && rootNode != null); _isNewPar = isNewPar; _initialized = false; this.Text = isNewPar ? Resources.NewPar : Resources.EditPar; _par = par; _parTemp = par.Clone(); _rootNode = rootNode; setParTypes(); if (par != null) { _isArray = Plugin.IsArrayType(par.Type); Type type = _isArray ? par.Type.GetGenericArguments()[0] : par.Type; nameTextBox.Text = par.Name; arrayCheckBox.Checked = _isArray; typeComboBox.Text = getTypeName(type); descTextBox.Text = par.Description; setValue(type); } enableOkButton(); _initialized = true; }
private void Node_OnUpdate(Nodes.Node n) { if (albedoNode != null && albedoNode.Node == n) { SetAlbedo(n.Buffer); } else if (metallicNode != null && metallicNode.Node == n) { SetMetallic(n.Buffer); } else if (roughnessNode != null && roughnessNode.Node == n) { SetRoughness(n.Buffer); } else if (normalNode != null && normalNode.Node == n) { SetNormal(n.Buffer); } else if (heightNode != null && heightNode.Node == n) { SetHeight(n.Buffer); } else if (occlusionNode != null && occlusionNode.Node == n) { SetOcclusion(n.Buffer); } }
protected Attachment(Nodes.Node node, string label, string description) { _node = node; _label = label; _baselabel = label; _description = description; }
public static void LookForRuneOfMomentum(Nodes.Node node) { //Debug.Log("Looking for Rune of Harvest, Node uId: " + node.uId); List <Nodes.Connection> connections = new List <Nodes.Connection>(); connections.Add(Nodes.Tag(0, 0, 0, NodeTags.CenterNode)); connections.Add(Nodes.Tag(0, 0, -1, NodeTags.ConveyanceNode1)); connections.Add(Nodes.Tag(0, 0, 1, NodeTags.ConveyanceNode2)); connections.Add(Nodes.Tag(0, 0, 2, NodeTags.ConveyanceNode3)); connections.Add(Nodes.Tag(0, 0, 3, NodeTags.ConveyanceNode4)); connections.Add(Nodes.Tag(0, 0, 4, NodeTags.ConveyanceNode5)); connections.Add(Nodes.Tag(0, 0, 5, NodeTags.ConveyanceNode6)); connections.Add(Nodes.Con(-1, 0, -1, 0, 0, 0)); connections.Add(Nodes.Con(1, 0, -1, 0, 0, 0)); connections.Add(Nodes.Con(0, 0, 2, 0, 0, 0)); connections.Add(Nodes.Con(0, 0, 2, 1, 0, 2)); connections.Add(Nodes.Con(1, 0, 2, 0, 0, 4)); connections.Add(Nodes.Con(0, 0, 4, -1, 0, 2)); List <Nodes.Connection> result = Nodes.CheckRuneMulti(connections, node); if (result != null && result.Count > 0) { //Debug.Log("FOUND RUNE: Rune of Harvest"); Rune rune = new Rune(); rune.type = RuneTypes.RuneOfMomentum; InitRune(rune, result); CheckRuneRequirements(rune); runes.Add(rune); } }
public static void LookForRuneOfHarvest(Nodes.Node node) { //Debug.Log("Looking for Rune of Harvest, Node uId: " + node.uId); List <Nodes.Connection> connections = new List <Nodes.Connection>(); connections.Add(Nodes.Tag(0, 0, 0, NodeTags.CenterNode)); connections.Add(Nodes.Tag(0, 0, 1, NodeTags.ShouldBe_ManaFountain)); connections.Add(Nodes.Tag(0, 0, -1, NodeTags.SpawnPointNode)); connections.Add(Nodes.Tag(0, 0, -2, NodeTags.PassToNode)); connections.Add(Nodes.Con(-1, 0, 1, 0, 0, 0)); connections.Add(Nodes.Con(1, 0, 1, 0, 0, 0)); connections.Add(Nodes.Con(0, 0, -1, 0, 0, 0)); connections.Add(Nodes.Con(-1, 0, 1, 0, 0, 2)); connections.Add(Nodes.Con(1, 0, 1, 0, 0, 2)); List <Nodes.Connection> result = Nodes.CheckRuneMulti(connections, node); if (result != null && result.Count > 0) { //Debug.Log("FOUND RUNE: Rune of Harvest"); Rune rune = new Rune(); rune.type = RuneTypes.RuneOfHarvest; InitRune(rune, result); rune.delay = 2; CheckRuneRequirements(rune); runes.Add(rune); } }
public override void GetObjectsByType(Nodes.Node root, string nodeType, bool matchCase, bool matchWholeWord, ref List <ObjectPair> objects) { Debug.Check(this.Reference != null); GetObjectsBySelfType(root, nodeType, matchCase, matchWholeWord, ref objects); ((Node)this.Reference).GetObjectsByType(root, nodeType, matchCase, matchWholeWord, ref objects); }
public override void GetObjectsByPropertyMethod(Nodes.Node root, string propertyName, bool matchCase, bool matchWholeWord, ref List <ObjectPair> objects) { Debug.Check(this.Reference != null); GetObjectsBySelfPropertyMethod(root, propertyName, matchCase, matchWholeWord, ref objects); ((Node)this.Reference).GetObjectsByPropertyMethod(root, propertyName, matchCase, matchWholeWord, ref objects); }
void Start() { timeSet = Time.timeSinceLevelLoad; //register on my node Nodes.Node node = Nodes.FindNearestNode(transform.position); Nodes.RegisterSpecialNode(node, Nodes.SpecialNodes.ManaFountain); }
private void updateHighlights(string agentFullname, int frame, List <string> highlightNodeIds, List <string> updatedNodeIds, HighlightBreakPoint breakPoint, Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos) { //if (agentFullname == Plugin.DebugAgentInstance || breakPoint != null) { BehaviorNode behavior = UIUtilities.ShowBehaviorTree(agentFullname, frame, highlightNodeIds, updatedNodeIds, breakPoint, profileInfos); _updateNode = behavior as Nodes.Node; } }
//Алгоритм Решения задачи с использованием Dancing Links public bool Solve() { if (header_root.right == header_root) { return(true); } bool flag = true; for (var head = header_root.right; head != header_root; head = head.right) { if (((Nodes.HeaderNode)head).isNodeID == false) { flag = false; } } if (flag) { return(true); } Nodes.HeaderNode header = ShortColumn(); Remove(header); Nodes.Node node = header.down; n++; while (node != header) { solution_array.Add(node); for (Nodes.Node node_it = node.right; node_it != node; node_it = node_it.right) { Remove(node_it.header); } if (Solve()) { return(true); } solution_array.RemoveAt(solution_array.Count - 1); header = node.header; for (Nodes.Node node_it = node.left; node_it != node; node_it = node_it.left) { Restore(node_it.header); } node = node.down; } Restore(header); return(false); }
private void InspectObject(AgentType agentType, string agentName, string agentFullName, FrameStatePool.PlanningState nodeState) { Nodes.Node node = null; if (!string.IsNullOrEmpty(agentFullName)) { int frame = AgentDataPool.CurrentFrame > -1 ? AgentDataPool.CurrentFrame : 0; string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentFullName, frame); List <string> transitionIds = FrameStatePool.GetHighlightTransitionIds(agentFullName, frame, behaviorFilename); List <string> highlightNodeIds = FrameStatePool.GetHighlightNodeIds(agentFullName, frame, behaviorFilename); List <string> updatedNodeIds = FrameStatePool.GetUpdatedNodeIds(agentFullName, frame, behaviorFilename); Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = FrameStatePool.GetProfileInfos(frame, behaviorFilename); BehaviorNode behavior = UIUtilities.ShowBehaviorTree(agentFullName, frame, transitionIds, highlightNodeIds, updatedNodeIds, HighlightBreakPoint.Instance, profileInfos); node = behavior as Nodes.Node; } _agentType = agentType; _agentName = agentName; Hide(); setText(agentType, agentName); if (nodeState != null) { foreach (string agentFullName1 in nodeState._agents.Keys) { string[] tokens = agentFullName1.Split('#'); Debug.Check(tokens.Length == 2); string at = tokens[0]; string an = tokens[1]; AgentType agentType1 = Plugin.GetAgentType(at); ParametersDock dock = findParametersDock(agentType1, an); dock.InspectObject(agentType1, agentFullName1); dock.setProperty(nodeState, agentFullName1); } } else if (AgentDataPool.CurrentFrame > -1 && !string.IsNullOrEmpty(agentName)) { ParametersDock dock = findParametersDock(agentType, agentName); dock.InspectObject(agentType, agentFullName); List <AgentDataPool.ValueMark> valueSet = AgentDataPool.GetValidValues(agentType, agentFullName, AgentDataPool.CurrentFrame); foreach (AgentDataPool.ValueMark value in valueSet) { dock.setProperty(null, value.Name, value.Value); } } lostAnyFocus(); Show(); }
public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) { Debug.Check(arrayProperty != null); _arrayProperty = arrayProperty; _object = obj; _node = _object as Nodes.Node; buildPropertyGrid(); }
public void SetStructProperty(DesignerStructPropertyInfo structProperty, object obj) { Debug.Check(structProperty != null); _structProperty = structProperty; _object = obj; _node = _object as Nodes.Node; buildPropertyGrid(); }
private void setObject(object obj) { _object = obj; _node = _object as Nodes.Node; if (_node == null) { Attachments.Attachment attach = _object as Attachments.Attachment; if (attach != null) { _node = attach.Node; } } }
public void SetParameter(ParInfo parameter, Nodes.Node node) { _parameter = parameter; _node = node; typeComboBox.Width = flowLayoutPanel.Width * 2 / 5; typeComboBox.Items.Clear(); foreach(Type key in Plugin.TypeHandlers.Keys) { typeComboBox.Items.Add(Plugin.GetNativeTypeName(key.Name)); } typeComboBox.Text = parameter.TypeName; }
public void SetRootNode(Nodes.Node root) { _root = root; }
/// <summary> /// Create a new node event. /// </summary> /// <param name="node">The node this event belongs to.</param> /// <param name="evnt">The event we want to attach to a node.</param> public Event(Nodes.Node node, string label, string description) { _label= label; _baselabel= label; _description= description; _node= node; }
public ObjectPair(Nodes.Node root, NodeTag.DefaultObject obj) { Root = root; Obj = obj; }