private void AddDialogNode() { TreeNode dialog = new Dialog(parent.ActivatedWorkSpaceData); dialog.AddChild(new TaskNode(parent.ActivatedWorkSpaceData)); parent.Insert(dialog); }
public TaskDialog() { _dlg = new Dialog <bool>(2, 2, Console.WindowWidth * 2 / 3, Console.WindowHeight * 3 / 4) { Title = "Edit task" }; _txtSubject = new TextLine(2, 2, _dlg.Size.width - 4) { Label = "subject" }; _dlg.AddChild(_txtSubject); _txtDescription = new TextArea(2, 4, _txtSubject.Size.width / 2, _dlg.Size.height - 7) { Label = "description" }; _dlg.AddChild(_txtDescription); _txtDueDate = new TextLine(_txtDescription.Position.left + _txtDescription.Size.width + 2, 4, 10) { Label = "due date" }; _dlg.AddChild(_txtDueDate); _cboPriority = new Combobox(_txtDueDate.Position.left, _txtDueDate.Position.top + 2, _txtDueDate.Size.width, 6, new[] { "", "Low", "Medium", "High", "ASAP" }) { LimitTextToItems = true }; _dlg.AddChild(_cboPriority); _txtTags = new TextLine(_cboPriority.Position.left, _cboPriority.Position.top + 2, _cboPriority.Size.width) { Label = "tags" }; _dlg.AddChild(_txtTags); var btnSave = new Button(2, _txtDescription.Position.top + _txtDescription.Size.height + 1, 10, "Save") { OnPressed = (w, e) => { _dlg.Result = true; BashForms.Close(); } }; _dlg.AddChild(btnSave); _dlg.AddChild(new Button(14, btnSave.Position.top, 10, "Cancel") { OnPressed = (w, e) => { _dlg.Result = false; BashForms.Close(); } }); }
private void _initGUI() { this._scrollView = new Scrollview(this, new Rect(10, 10, Screen.width - 20, Screen.height - 20), root, new Rect(0, 0, 4000, 4000)); this._controllList = new Scrollview(this, new Rect(0, 0, 100, Screen.height - 20), root, new Rect(0, 100, 100, 800)); this._controllList.textureBg = null; root.AddChild(this._controllList); root.AddChild(this._scrollView); //btn save Vector2 ptStart = new Vector2(10, 10); Button btnSave = new Button("保存", this, new Rect(ptStart.x, ptStart.y, 70, 32), this.root); btnSave.OnClick = new Button.ButtonDelegate(OnBtnSaveClick); root.AddChild(btnSave); //btn create Button btnCreate = new Button("新建", this, new Rect(ptStart.x + 100, ptStart.y, 70, 32), this.root); btnCreate.OnClick = new Button.ButtonDelegate(OnBtnCreateClick); root.AddChild(btnCreate); ptStart.y += 32 + 15; //ddl projects string[] directoryEntries = System.IO.Directory.GetFileSystemEntries("Assets/Editor/BTEditor/Projects"); foreach (string str in directoryEntries) { if (str.EndsWith(".json")) { this._lstProjects.Add(str); } } if (this._lstProjects.Count > 0) { Rect rcDDL = new Rect(ptStart.x, ptStart.y, 180, 20); DropdownList <string> ddlProj = new DropdownList <string>(this, rcDDL, root, this._lstProjects, 0); ddlProj.OnSelectChange = new DropdownList <string> .DropDownListDelegate(OnSelProjChange); root.AddChild(ddlProj); ptStart.y += 20 + 2; } //file name Rect rcLable = new Rect(ptStart.x, ptStart.y, 50, 20); root.AddChild(new Label("文件名:", this, rcLable, root)); Rect rcFileName = new Rect(ptStart.x + 50, ptStart.y, 130, 20); this._tfFileName = new Textfield("", this, rcFileName, root); root.AddChild(this._tfFileName); ptStart.y += 20 + 5; //agent category Rect rcAgent = new Rect(ptStart.x, ptStart.y, 50, 20); root.AddChild(new Label("Agent:", this, rcAgent, root)); Rect rcDDLAgent = new Rect(ptStart.x + 50, ptStart.y, 100, 20); this.DDLAgent = new DropdownList <string>(this, rcDDLAgent, root, this._lstAgents, 0); root.AddChild(this.DDLAgent); ptStart.y += 20 + 15; //load firest proj if (this._lstProjects.Count > 0) { string firstCfg = this._lstProjects[0]; this._loadProject(firstCfg); } //entry Button btnEntry = new Button("入口节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnEntry.OnClick = new Button.ButtonDelegate(OnBtnEntryClick); _controllList.AddChild(btnEntry); ptStart.y += 22 + 5; _controllList.AddChild(new Label("动作节点:", this, new Rect(ptStart.x, ptStart.y, 150, 22), this.root)); ptStart.y += 20; //task Button btnTask = new Button("任务节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnTask.OnClick = new Button.ButtonDelegate(OnBtnTaskClick); _controllList.AddChild(btnTask); ptStart.y += 22 + 5; _controllList.AddChild(new Label("组合节点:", this, new Rect(ptStart.x, ptStart.y, 150, 22), this.root)); ptStart.y += 20; //sequenct Button btnSequence = new Button("顺序节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnSequence.OnClick = new Button.ButtonDelegate(OnBtnSequenceClick); _controllList.AddChild(btnSequence); ptStart.y += 22 + 5; //randomsequence Button btnRandonSequence = new Button("随机序列", this, new Rect(10, ptStart.y, 150, 22), this.root); btnRandonSequence.OnClick = new Button.ButtonDelegate(OnBtnRandomSequenceClick); _controllList.AddChild(btnRandonSequence); ptStart.y += 22 + 5; //priority Button btnPriority = new Button("优先节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnPriority.OnClick = new Button.ButtonDelegate(OnBtnPriorityClick); _controllList.AddChild(btnPriority); ptStart.y += 22 + 5; //parallel Button btnParallel = new Button("并行节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnParallel.OnClick = new Button.ButtonDelegate(OnBtnParallelClick); _controllList.AddChild(btnParallel); ptStart.y += 22 + 5; //randomselector Button btnRandom = new Button("随机节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnRandom.OnClick = new Button.ButtonDelegate(OnBtnRandomClick); _controllList.AddChild(btnRandom); ptStart.y += 22 + 5; //weightselector Button btnWeight = new Button("权重节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnWeight.OnClick = new Button.ButtonDelegate(OnBtnWeightClick); _controllList.AddChild(btnWeight); ptStart.y += 22 + 5; //conditionselector Button btnCondition = new Button("条件节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnCondition.OnClick = new Button.ButtonDelegate(OnBtnConditionClick); _controllList.AddChild(btnCondition); ptStart.y += 22 + 5; //logic Button btnLogic = new Button("逻辑节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnLogic.OnClick = new Button.ButtonDelegate(OnBtnLogicClick); _controllList.AddChild(btnLogic); ptStart.y += 22 + 5; //subtree Button btnTree = new Button("子树节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnTree.OnClick = new Button.ButtonDelegate(OnBtnSubTreeClick); _controllList.AddChild(btnTree); ptStart.y += 22 + 5; _controllList.AddChild(new Label("装饰:", this, new Rect(ptStart.x, ptStart.y, 150, 22), this.root)); ptStart.y += 20; //loop Button btnLoop = new Button("循环节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnLoop.OnClick = new Button.ButtonDelegate(OnBtnLoopClick); _controllList.AddChild(btnLoop); ptStart.y += 22 + 5; //loopuntil Button btnLoopUtl = new Button("循环直到", this, new Rect(10, ptStart.y, 150, 22), this.root); btnLoopUtl.OnClick = new Button.ButtonDelegate(OnBtnLoopUntilClick); _controllList.AddChild(btnLoopUtl); ptStart.y += 22 + 5; //monitor Button btnMonitor = new Button("监控节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnMonitor.OnClick = new Button.ButtonDelegate(OnBtnMonitorClick); _controllList.AddChild(btnMonitor); ptStart.y += 22 + 5; //inverter Button btnInverter = new Button("取反节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnInverter.OnClick = new Button.ButtonDelegate(OnBtnInverterClick); _controllList.AddChild(btnInverter); ptStart.y += 22 + 5; //retfail Button btnFail = new Button("失败节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnFail.OnClick = new Button.ButtonDelegate(OnBtnFailClick); _controllList.AddChild(btnFail); ptStart.y += 22 + 5; //retsuccess Button btnSuccess = new Button("成功节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnSuccess.OnClick = new Button.ButtonDelegate(OnBtnSuccessClick); _controllList.AddChild(btnSuccess); ptStart.y += 22 + 5; //retrunning Button btnRetRunning = new Button("运行中节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnRetRunning.OnClick = new Button.ButtonDelegate(OnBtnRetrunningClick); _controllList.AddChild(btnRetRunning); ptStart.y += 22 + 5; //utlfail Button btnUtilFail = new Button("直到失败节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnUtilFail.OnClick = new Button.ButtonDelegate(OnBtnUtilFailClick); _controllList.AddChild(btnUtilFail); ptStart.y += 22 + 5; //utlsuccess Button btnUtilSuc = new Button("直到成功节点", this, new Rect(10, ptStart.y, 150, 22), this.root); btnUtilSuc.OnClick = new Button.ButtonDelegate(OnBtnUtilSucClick); _controllList.AddChild(btnUtilSuc); ptStart.y += 22 + 5; //persistwhile Button btnPersist = new Button("持续时间", this, new Rect(10, ptStart.y, 150, 22), this.root); btnPersist.OnClick = new Button.ButtonDelegate(OnBtnPersistWhileClick); _controllList.AddChild(btnPersist); ptStart.y += 22 + 5; //countlimit Button btnCountLimit = new Button("持续次数", this, new Rect(10, ptStart.y, 150, 22), this.root); btnCountLimit.OnClick = new Button.ButtonDelegate(OnBtnCountLimitClick); _controllList.AddChild(btnCountLimit); ptStart.y += 22 + 5; }