/// <summary> /// Drags a control from the Toolbox to the Workflow /// </summary> /// <param name="toolName">The name of the control you to drag - Eg: Assign, Calculate, Etc</param> /// <param name="tabToDropOnto">The tab on which to drop the control</param> /// <param name="pointToDragTo">The point you wish to drop the control</param> /// <param name="getDroppedActivity">Get and return the dropped control</param> public UITestControl DragControlToWorkflowDesigner(ToolType tool, UITestControl tabToDropOnto, Point pointToDragTo = new Point(), bool getDroppedActivity = true) { UITestControl theControl = FindToolboxItemByAutomationId(tool); theControl.WaitForControlEnabled(); if(pointToDragTo.X == 0 && pointToDragTo.Y == 0) { UITestControl theStartButton = WorkflowDesignerUIMap.FindStartNode(tabToDropOnto); pointToDragTo = new Point(theStartButton.BoundingRectangle.X, theStartButton.BoundingRectangle.Y + 200); } Mouse.StartDragging(theControl, MouseButtons.Left); Playback.Wait(20); Mouse.StopDragging(pointToDragTo); Playback.Wait(100); UITestControl resourceOnDesignSurface = null; if(getDroppedActivity) { resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, tool.ToString()); int counter = 0; while(resourceOnDesignSurface == null && counter < 5) { Playback.Wait(1000); resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, tool.ToString()); Playback.Wait(500); counter++; } } return resourceOnDesignSurface; }
public void LargeViewTextboxesEnterTestData(ToolType tool, UITestControl theTab) { //Find the start point UITestControl theStartButton = WorkflowDesignerUIMap.FindControlByAutomationId(theTab, "Start"); Point workflowPoint1 = new Point(theStartButton.BoundingRectangle.X, theStartButton.BoundingRectangle.Y + 200); // Drag the tool onto the workflow ToolboxUIMap.DragControlToWorkflowDesigner(tool, workflowPoint1); WorkflowDesignerUIMap.OpenCloseLargeView(tool, theTab); // Add the data! List <UITestControl> listOfTextboxes = GetAllTextBoxesFromLargeView(tool.ToString(), theTab); int counter = 0; foreach (var textbox in listOfTextboxes) { WpfEdit tb = textbox as WpfEdit; if (tb != null && !tb.IsPassword) { tb.SetFocus(); SendKeys.SendWait("[[theVar" + counter.ToString(CultureInfo.InvariantCulture) + "]]"); } counter++; } }
private void GetTool() { if ((int)currentType > 3) { currentType = ToolType.Multi; // Reset the currentType to Multi. } item.toolTip = "Active function: " + currentType.ToString(); switch (currentType) { case ToolType.Multi: item.pick = 300; // 300% pickaxe power. item.hammer = 300; // 300% hammer power. item.axe = 60; // 300% axe power. break; case ToolType.Pickaxe: item.pick = 300; // 300% pickaxe power. item.hammer = 0; // 0% hammer power. item.axe = 0; // 0% axe power. break; case ToolType.Hammer: item.pick = 0; // 300% pickaxe power. item.hammer = 300; // 0% hammer power. item.axe = 0; // 0% axe power. break; case ToolType.Axe: item.pick = 0; // 0% pickaxe power. item.hammer = 0; // 300% hammer power. item.axe = 60; // 300% axe power. break; } }
// Update tool wheel and guide based on current fields private void UpdateUI() { // Tool wheel toolWheel.SetActive(wandMenuOpen); // Tool guide if (!hasSetUIPointers) { SetupUIPointers(); } // Update tool toolUI.SetActive(tool != ToolType.None); toolText.text = tool.ToString().Replace('_', ' '); // Enable UI main action mainUI.SetActive(toolActionMain != ToolAction.None); mainText.text = toolActionMain.ToString().Replace('_', ' '); // Enable UI off action offUI.SetActive(toolActionOff != ToolAction.None); offText.text = toolActionOff.ToString().Replace('_', ' '); // Enable UI off action if (!wandMenuOpen) { spaceText.text = "Tool Wheel"; } else { spaceText.text = "Garden"; } }
public void LargeViewTextboxesEnterTestData(ToolType tool, UITestControl theTab) { //Find the start point UITestControl theStartButton = WorkflowDesignerUIMap.FindControlByAutomationId(theTab, "Start"); Point workflowPoint1 = new Point(theStartButton.BoundingRectangle.X, theStartButton.BoundingRectangle.Y + 200); // Drag the tool onto the workflow ToolboxUIMap.DragControlToWorkflowDesigner(tool, workflowPoint1); WorkflowDesignerUIMap.OpenCloseLargeView(tool, theTab); // Add the data! List<UITestControl> listOfTextboxes = GetAllTextBoxesFromLargeView(tool.ToString(), theTab); int counter = 0; foreach(var textbox in listOfTextboxes) { WpfEdit tb = textbox as WpfEdit; if(tb != null && !tb.IsPassword) { tb.SetFocus(); SendKeys.SendWait("[[theVar" + counter.ToString(CultureInfo.InvariantCulture) + "]]"); } counter++; } }
/// <summary> /// 向流程中添加工具,需要根据选择的工具名对工具类型等进行判断 /// </summary> /// <param name="tool">工具类型</param> /// <param name="isInsert">插入位置,当为-1时,表示在末尾插入,当不为-1时,表示被插入的工具索引</param> public void Add_Tool(ToolType tool, int insertPos = -1, int imageKey = 0) { string toolName = GetNewToolName(tool.ToString()); IToolInfo insertTool = VisionToolFactory.CreateToolVision(tool, toolName); TreeNode insertNode = new TreeNode(); insertNode = VisionJobParams.myJobTreeView.Nodes.Add("", insertTool.toolName, (int)tool, (int)tool); // 该工具对应的节点 // 判断节点是否添加默认输入输出图 // 输入 for (int i = 0; i < insertTool.toolInput.Count; i++) { TreeNode childrenInputNode = insertNode.Nodes.Add("<--" + insertTool.toolInput[i].IOName); childrenInputNode.Tag = insertTool.toolInput[i].ioType; childrenInputNode.ForeColor = Color.DarkMagenta; } // 输出 for (int i = 0; i < insertTool.toolOutput.Count; i++) { TreeNode childrenOutputNode = insertNode.Nodes.Add("-->" + insertTool.toolOutput[i].IOName); childrenOutputNode.Tag = insertTool.toolOutput[i].ioType; childrenOutputNode.ForeColor = Color.Blue; } insertNode.Expand(); VisionJobParams.myVisionJob.L_toolList.Add(insertTool); }
/// <summary> /// 向流程中添加工具,需要根据选择的工具名对工具类型等进行判断 /// </summary> /// <param name="tool">工具类型</param> /// <param name="isInsert">插入位置,当为-1时,表示在末尾插入,当不为-1时,表示被插入的工具索引</param> public void Add_Tool(ToolType tool, bool newAddTool = true, int insertPos = -1, int imageKey = 0) { string jobName = FormJobManage.Instance.tabJobUnion.SelectedTab.Text; string toolName = GetNewToolName(jobName, tool.ToString()); IToolInfo insertTool = VisionToolFactory.CreateToolVision(tool, toolName); TreeNode insertNode = new TreeNode(); insertNode = GetJobTree(jobName).Nodes.Add("", insertTool.toolName, (int)tool, (int)tool); // 该工具对应的节点 // 判断节点是否添加默认输入输出图 // 输入 for (int i = 0; i < insertTool.toolInput.Count; i++) { TreeNode childrenInputNode = insertNode.Nodes.Add("<--" + insertTool.toolInput[i].IOName); childrenInputNode.Tag = insertTool.toolInput[i].ioType; childrenInputNode.ForeColor = Color.DarkMagenta; } // 输出 for (int i = 0; i < insertTool.toolOutput.Count; i++) { TreeNode childrenOutputNode = insertNode.Nodes.Add("-->" + insertTool.toolOutput[i].IOName); childrenOutputNode.Tag = insertTool.toolOutput[i].ioType; childrenOutputNode.ForeColor = Color.Blue; } insertNode.Expand(); if (newAddTool) { VisionJobParams.pVisionProject.Project[jobName].L_toolList.Add(insertTool); } }
public ToolItem(ToolType type, int stackSize = 1) : base("", "", 1.0f, ItemCategory.Tools, stackSize) { ToolType = type; Icon = ToolType.ToString(); switch (ToolType) { case ToolType.Pickaxe: Name = "Pickaxe"; Description = "Tool used for mining stone."; break; case ToolType.Shovel: Name = "Shovel"; Description = "Tool used for excavating earth."; break; case ToolType.Axe: Name = "Axe"; Description = "Tool used for chopping trees."; break; case ToolType.Hammer: Name = "Hammer"; Description = "Tool used for crafting mechanics."; break; case ToolType.DroneChain: Name = "Chain Drone"; Description = "Drone used for creating chains of vertical digging constraints."; break; default: Debug.Fail("Unknown tool type"); break; } }
// Gets tool information from a tool type. public static ToolInfo GetToolInfo(ToolType type) { if (ToolMap.TryGetValue(type, out ToolInfo info)) { return(ToolMap[type]); } else { Console.WriteLine("Error: Could not get tool type " + type.ToString() + " from tool info map."); return(new ToolInfo()); } }
public void SelectToolName(ToolType toolName) //get toolname { previousToolName = toolName; Debug.Log(previousToolName.ToString()); // GameObject DrawingAlgo = GameObject.Find ("Main Camera"); // DrawingAlgo.SendMessage ("getToolName", toolName); GameObject canvas = GameObject.Find("canvas"); canvas.SendMessage("OnToolChange", previousToolName); }
void MainBody(List <string> args) { string help_name = "tool=" + mToolType.ToString().ToLowerInvariant(); switch (mToolType) { case ToolType.Pkg: Hogan.PkgTool._Main(help_name, args); break; default: Program.UnavailableOption(mToolType); break; } }
// Update is called once per frame void Update() { if (AllowTool) { if (Input.GetKeyDown(KeyCode.Alpha1)) { tool = ToolType.MOVE; } if (Input.GetKeyDown(KeyCode.Alpha2)) { tool = ToolType.WIRE; } if (Input.GetKeyDown(KeyCode.Alpha3)) { tool = ToolType.WIRE_CUTTER; } if (Input.GetKeyDown(KeyCode.Alpha4)) { tool = ToolType.EDITOR; } if (Input.GetKeyDown(KeyCode.Alpha5)) { tool = ToolType.REMOVE; } } else { tool = ToolType.NONE; } if (uiText != null) { uiText.text = "Tool: " + (char.ToUpper(tool.ToString()[0]) + tool.ToString().Substring(1)); } SelectedTool = tool; SelectedItem = item; }
void MainBody(List <string> args) { string help_name = "tool=" + mToolType.ToString().ToLowerInvariant(); switch (mToolType) { case ToolType.Gvar: Blam.GameVariantTool._Main(help_name, args); break; case ToolType.Metadata: Blam.ContentMiniMetadataTool._Main(help_name, args); break; default: Program.UnavailableOption(mToolType); break; } }
public override bool FromString(string ParaList) { string[] list = ParaList.Split('|'); if (list.Count() == 3) { Enum.TryParse(list[0], out EnumToolType type); HalconData = list[2]; if (type != EnumToolType.LineTool) { throw new Exception($"Wrong {ToolType.ToString()} when parse {ParaList}, Please check!"); } else { var L1 = list[1].Split('&'); if (L1.Count() != 5) { throw new Exception($"Wrong para num when parse {ParaList}"); } bool bRet = true; bRet &= int.TryParse(L1[0], out int caliperNum); bRet &= Enum.TryParse(L1[1], out EnumEdgeType polarity); bRet &= Enum.TryParse(L1[2], out EnumSelectType selectType); bRet &= double.TryParse(L1[3], out double contrast); string modelName = L1[4]; if (bRet == false) { throw new Exception("Error happend when parse {ParaList}"); } else { this.CaliperNum = caliperNum; this.Polarity = polarity; this.ModelName = modelName; this.SelectType = selectType; this.Contrast = (int)contrast; return(true); } } } else { throw new Exception($"Wrong {ToolType.ToString()} format when parse {ParaList}"); } }
public void getToolName(ToolType toolName) { currentTool = toolName; Debug.Log(currentTool.ToString() + "Drawing"); }
/// <summary> /// Executes tool action /// </summary> /// <param name="layer">Layer to operate on.</param> /// <param name="startingCoords">Click coordinates.</param> /// <param name="color">Color that tool will use.</param> /// <param name="toolSize">Size/thickness of tool</param> /// <param name="tool">Tool to execute</param> /// <returns></returns> public Layer ExecuteTool(Layer layer, Coordinates startingCoords, Color color, int toolSize, ToolType tool) { if (toolSize < 1) { return(null); } Layer cLayer = layer; _oldBitmap = new WriteableBitmap(layer.LayerBitmap); switch (tool) { case ToolType.Pen: cLayer.LayerBitmap = DrawPixel(cLayer.LayerBitmap, startingCoords, toolSize, color); break; case ToolType.Bucket: cLayer.LayerBitmap = FloodFill(cLayer.LayerBitmap, startingCoords, color); break; case ToolType.Line: if (_toolIsExecuting == false) { LineAsync(cLayer, startingCoords, color, toolSize); } break; case ToolType.Circle: if (_toolIsExecuting == false) { CircleAsync(cLayer, startingCoords, color); } break; case ToolType.Rectangle: if (_toolIsExecuting == false) { RectangleAsync(cLayer, startingCoords, color); } break; case ToolType.Earser: cLayer.LayerBitmap = DrawPixel(cLayer.LayerBitmap, startingCoords, toolSize, Colors.Transparent); break; case ToolType.Lighten: if (Mouse.LeftButton == MouseButtonState.Pressed) { cLayer.LayerBitmap = Lighten(cLayer.LayerBitmap, startingCoords); } else if (Mouse.RightButton == MouseButtonState.Pressed) { cLayer.LayerBitmap = Darken(cLayer.LayerBitmap, startingCoords); } break; } if (tool != ToolType.ColorPicker) { UndoManager.RecordChanges("ActiveLightLayer", new LightLayer(_oldBitmap.ToByteArray(), (int)_oldBitmap.Height, (int)_oldBitmap.Width), $"{tool.ToString()} Tool."); } return(cLayer); }
public override string ToString() { return($"{ToolType.ToString()}|{CaliperNum}&{Polarity.ToString()}&{SelectType.ToString()}&{Contrast}&{ModelName}|{HalconData}"); }
public void OpenCloseLargeView(ToolType tool, UITestControl theTab) { DoubleClickOnActivity(theTab, tool.ToString()); }
public bool HasToolEquipped(ToolType toolType) { return(equippedTool != null && equippedTool.name.Equals(toolType.ToString())); }
/// <summary> /// 创建文件夹 /// (创建:[项目文件夹]、[Bug文件夹]、[记录文件夹]、[图片文件夹]、[备份文件夹]) /// </summary> /// <param name="_saveFolderPath">保存文件夹的路径</param> /// <param name="_toolType">工具的类型</param> /// <returns>项目文件夹的路径</returns> public string CreateFolders(string _saveFolderPath, ToolType _toolType = ToolType.Convert) { /* 判断[项目]文件夹是否存在,不存在就创建 */ DirectoryInfo _directoryInfo = new DirectoryInfo(_saveFolderPath);//文件夹的信息 if (_directoryInfo.Exists == false) { _directoryInfo.Create(); } /* 创建文件和文件夹 */ //创建[项目]文件夹(XXXXX/Convert - 202002041325/) DirectoryInfo _projectDirectoryInfo = new DirectoryInfo(_saveFolderPath + "/" + _toolType.ToString() + " - " + DateTimeTool.DateTimeToString(DateTime.Now, TimeFormatType.YearMonthDayHourMinuteSecondMillisecond)); if (_projectDirectoryInfo.Exists == false) { _projectDirectoryInfo.Create(); } //创建bug文件夹(_projectFolderPath/Bug/) DirectoryInfo _bugDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Bug"); if (_bugDirectoryInfo.Exists == false) { _bugDirectoryInfo.Create(); } //创建[Record]文件夹(_projectFolderPath/Record/) DirectoryInfo _recordDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Record"); if (_recordDirectoryInfo.Exists == false) { _recordDirectoryInfo.Create(); } //创建[Image]文件夹(_projectFolderPath/Image/) DirectoryInfo _imageDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Image"); if (_imageDirectoryInfo.Exists == false) { _imageDirectoryInfo.Create(); } //创建[Backup]文件夹(_projectFolderPath/Backup/) DirectoryInfo _backupDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Backup"); if (_backupDirectoryInfo.Exists == false) { _backupDirectoryInfo.Create(); } /*创建[Backup]文件夹(_projectFolderPath/Backup/)*/ DirectoryInfo _projectBackupDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Backup/Project"); //如果没有文件夹,就创建文件夹 if (_projectBackupDirectoryInfo.Exists == false) { _projectBackupDirectoryInfo.Create(); } /*创建[Backup/Bug]文件夹(_projectFolderPath/Backup/Bug/)*/ DirectoryInfo _bugBackupDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Backup/Bug"); //如果没有文件夹,就创建文件夹 if (_bugBackupDirectoryInfo.Exists == false) { _bugBackupDirectoryInfo.Create(); } /*创建[Backup/Record]文件夹(_projectFolderPath/Backup/Record/)*/ DirectoryInfo _recordBackupDirectoryInfo = new DirectoryInfo(_projectDirectoryInfo + "/Backup/Record"); //如果没有文件夹,就创建文件夹 if (_recordBackupDirectoryInfo.Exists == false) { _recordBackupDirectoryInfo.Create(); } return(_projectDirectoryInfo.FullName); }
/// <summary> /// Drags a control from the Toolbox to the Workflow /// </summary> /// <param name="toolName">The name of the control you to drag - Eg: Assign, Calculate, Etc</param> /// <param name="tabToDropOnto">The tab on which to drop the control</param> /// <param name="pointToDragTo">The point you wish to drop the control</param> /// <param name="getDroppedActivity">Get and return the dropped control</param> public UITestControl DragControlToWorkflowDesigner(ToolType tool, UITestControl tabToDropOnto, Point pointToDragTo = new Point(), bool getDroppedActivity = true) { UITestControl theControl = FindToolboxItemByAutomationId(tool); theControl.WaitForControlEnabled(); if (pointToDragTo.X == 0 && pointToDragTo.Y == 0) { UITestControl theStartButton = WorkflowDesignerUIMap.FindStartNode(tabToDropOnto); pointToDragTo = new Point(theStartButton.BoundingRectangle.X, theStartButton.BoundingRectangle.Y + 200); } Mouse.StartDragging(theControl, MouseButtons.Left); Playback.Wait(20); Mouse.StopDragging(pointToDragTo); Playback.Wait(100); UITestControl resourceOnDesignSurface = null; if (getDroppedActivity) { resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, tool.ToString()); int counter = 0; while (resourceOnDesignSurface == null && counter < 5) { Playback.Wait(1000); resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, tool.ToString()); Playback.Wait(500); counter++; } } return(resourceOnDesignSurface); }
public override void draw(SpriteBatch b) { int w = 80 * 2 + 64, h = 540; int x = Game1.viewport.Width / 2 - w / 2; int y = Game1.viewport.Height / 2 - h / 2 - 100; IClickableMenu.drawTextureBox(b, x, y, w, h, Color.White); Game1.drawDialogueBox(this.xPositionOnScreen - IClickableMenu.borderWidth / 2, this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 64 + 150, this.width, this.height - (IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192), false, true, (string)null, false, false); this.inventory.draw(b); b.DrawString(Game1.dialogueFont, tool.ToString(), new Vector2(x + IClickableMenu.borderWidth * 1, y + IClickableMenu.borderWidth * 1), Color.Black); bool foundPrismatic = false; for (int i = 0; i < items.Length; ++i) { if (i >= 3 && !foundPrismatic) { continue; } Vector2 vec = new Vector2(x + 80, y + 64 * i + 96); b.Draw(Game1.menuTexture, vec, new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.menuTexture, 10, -1, -1)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.5f); if (items[i] != null) { items[i].drawInMenu(b, vec, 1); if (items[i] is SObject obj && obj.ParentSheetIndex == SObject.prismaticShardIndex) { foundPrismatic = true; } } Rectangle rect = new Rectangle((int)vec.X, (int)vec.Y, 64, 64); if (rect.Contains(clickX, clickY) && justClicked) { if (heldItem == null) { heldItem = items[i]; items[i] = null; } else { if (items[i] == null) { items[i] = heldItem.getOne(); heldItem.Stack--; if (heldItem.Stack == 0) { heldItem = null; } } else { // If something is held and in the slot, do nothing } } } } if (this.hoverText != null) { IClickableMenu.drawHoverText(b, this.hoverText, Game1.smallFont); } if (this.hoveredItem != null) { IClickableMenu.drawToolTip(b, getDescription(hoveredItem), this.hoveredItem.DisplayName, this.hoveredItem, this.heldItem != null); } this.heldItem?.drawInMenu(b, new Vector2((float)(Game1.getOldMouseX() + 8), (float)(Game1.getOldMouseY() + 8)), 1f); base.drawMouse(b); justClicked = false; }