private void openSelectedFiles() { foreach (DataGridViewRow row in this.filesGridView.SelectedRows) { UIUtilities.ShowBehaviorTree((string)row.Cells["filepathColumn"].Value); Utilities.ReportLoadBehavior(); } this.Close(); }
private void initialize(TreeView treeView) { this.nodeTreeView.ImageList = treeView.ImageList; this.nodeTreeView.Nodes.Clear(); IList <NodeGroup> nodeGroups = Plugin.NodeGroups; foreach (NodeGroup group in nodeGroups) { group.Register(this.nodeTreeView.Nodes); } if (this.nodeTreeView.GetNodeCount(false) > 0) { UIUtilities.SortTreeview(this.nodeTreeView.Nodes); this.nodeTreeView.SelectedNode = this.nodeTreeView.Nodes[0]; } setCheckedNodes(this.nodeTreeView.Nodes, Plugin.FrequentlyUsedNodes); }
private void selectRowNode(DataGridViewRow row) { Debug.Check(row != null); row.Selected = true; string behaviorFilename = (string)row.Cells["BehaviorFilename"].Value; BehaviorTreeView behaviorTreeView = UIUtilities.ShowBehaviorTree(behaviorFilename); if (behaviorTreeView != null) { string nodeId = (string)row.Cells["NodeId"].Value; NodeViewData nvd = behaviorTreeView.RootNodeView.FindNodeViewData(nodeId); if (nvd != null) { behaviorTreeView.SelectedNode = nvd; //if (behaviorTreeView.ClickNode != null) // behaviorTreeView.ClickNode(nvd); behaviorTreeView.Invalidate(); } } }
private void updateParameters(AgentType agentType, string agentName, int frame) { if (string.IsNullOrEmpty(agentName)) { return; } string typeName = (agentType == null) ? agentName : agentType.ToString(); string agentFullname = (agentType == null) ? agentName : agentType.ToString() + "#" + agentName; string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentFullname, frame); BehaviorNode behavior = null; if (agentFullname == Plugin.DebugAgentInstance) { behavior = UIUtilities.ShowBehavior(behaviorFilename); } List <AgentDataPool.ValueMark> values = AgentDataPool.GetValidValues(agentType, agentFullname, frame); foreach (AgentDataPool.ValueMark value in values) { ParametersDock.SetProperty(behavior, typeName, agentName, value.Name, value.Value); } }
private void UpdateStackCb(string tree, bool bAdd) { if (bAdd) { callstackListBox.Items.Insert(0, tree); } else { //Debug.Check(callstackListBox.Items.Count < 2 || ((string)callstackListBox.Items[0]) == tree); if (callstackListBox.Items.Count > 0 && ((string)callstackListBox.Items[0]) == tree) { callstackListBox.Items.RemoveAt(0); } } if (callstackListBox.Items.Count > 0) { //callstackListBox.SelectedIndex = -1; callstackListBox.SelectedIndex = 0; string currentBt = (string)callstackListBox.Items[0]; UIUtilities.ShowBehaviorTree(currentBt); } }
static void Main(string[] args) { try { if (Settings.Default.UpdateRequired) { Settings.Default.Upgrade(); Settings.Default.UpdateRequired = false; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainWindow.SetDefaultSettings(); Plugin.LoadPlugins(); //only do it when there are args if (args.Length > 0) { NativeMethods.InitConsoleHandles(); } CommandOptions options = new CommandOptions(); bool bOk = options.Parse(args); if (!bOk || options.help) { string allFormats = string.Empty; foreach (ExporterInfo info in Plugin.Exporters) { if (!string.IsNullOrEmpty(allFormats)) { allFormats += "|"; } allFormats += info.ID; } string usage = string.Format (@" Usage: BehaviacDesigner.exe <workspaceFile> <options> options: /bt=btFile /export=<{0}> /help", allFormats); System.Console.WriteLine(usage); } if (options.export) { if (bOk) { string msg = string.Format("Exporting: format '{0}' workspace '{1}' ...", options.format, options.workspace); System.Console.WriteLine(msg); if (!System.IO.File.Exists(options.workspace)) { msg = string.Format("Workspace '{0}' does not exist! check the workspace path and name.", options.workspace); System.Console.WriteLine(msg); return; } try { new MainWindow(false); MainWindow.Instance.Hide(); if (MainWindow.Instance.SetWorkspace(options.workspace, false)) { MainWindow.Instance.ExportBehavior(true, options.format); } else { //msg = string.Format("Workspace '{0}' is not a valid workspace file!", options.workspace); //System.Console.WriteLine(msg); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { if (string.IsNullOrEmpty(options.workspace)) { System.Console.WriteLine("No workspace is specified!"); } if (string.IsNullOrEmpty(options.format)) { System.Console.WriteLine("No format is specified!"); } } return; } using (MainWindow mainWindow = new MainWindow(true)) { if (!string.IsNullOrEmpty(options.workspace)) { mainWindow.SetWorkspace(options.workspace, false); if (!string.IsNullOrEmpty(options.bt)) { UIUtilities.ShowBehaviorTree(options.bt); } } Application.Run(mainWindow); } } catch (Exception e) { Console.WriteLine("Exception is {0}", e); } }
private static void showPlanning(FrameStatePool.PlanningProcess planning) { BehaviorTreeView view = UIUtilities.ShowPlanning(planning); view.ClickNode += new BehaviorTreeView.ClickNodeEventDelegate(Planning_ClikcNode); }
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); if (dock != null) { dock.InspectObject(agentType1, agentFullName1); dock.setProperty(nodeState, agentFullName1); } } } else if (AgentDataPool.CurrentFrame > -1 && !string.IsNullOrEmpty(agentName)) { ParametersDock dock = findParametersDock(agentType, agentName); if (dock != null) { 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(); }