Пример #1
0
        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;
            }
        }
        public void DragActivityOnDropPoint(ToolType toolType)
        {
            UITestControl dropPoint         = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "DropPoint");
            var           boundingRectangle = dropPoint.BoundingRectangle;

            ToolboxUIMap.DragControlToWorkflowDesigner(toolType, new Point(boundingRectangle.X + 10, boundingRectangle.Y + 10));
        }
Пример #3
0
        public async Task CreateToolTypeSearchAsync(ToolType toolType)
        {
            var tts = new ToolTypeSearch
            {
                Name       = toolType.Name,
                RefId      = toolType.Id,
                Categories = toolType.MainType,
                Services   = toolType.Serves
            };


            List <string> keyWords = new List <string>();

            // Add All Key Words
            // add name
            //keyWords.Add(toolType.Name.ToUpper()); // ToolType.Name

            // add serves
            foreach (var serve in toolType.Serves)
            {
                keyWords.Add(serve.ToUpper() + " ");   // ToolTypes.Serves
            }

            tts.KeyWords = keyWords.ToArray();

            await _toolTypesSearch.InsertOneAsync(tts);
        }
 public SpawnPointPicker()
 {
     _Image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/spawn.png"));
     _Name = "Spawn Point Tool";
     _Type = ToolType.Pencil;
     IsActive = false;
 }
Пример #5
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="name">Name des Tools</param>
 /// <param name="controlident">Eindeutiger Identifier im gesammten Programmsystem für DIESES Tool</param>
 /// <param name="initcode">Der LaserScript Init Code</param>
 /// <param name="tt">Der Typ des zu erstellenden Tools</param>
 public Tool(string name, string controlident, ToolType tt)
     : base(name, controlident)
 {
     CameraOffset = new PointXD <int>(2);
     MyToolType   = tt;
     Load();
 }
        private void SelectTool(ToolType toolType)
        {
            SelectedToolType = toolType;

            DialogResult = true;
            Close();
        }
Пример #7
0
 public Selection()
 {
     _Image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/shape_square.png"));
     _Name = "Selection";
     _Type = ToolType.Selection;
     IsActive = false;
 }
Пример #8
0
        public void ChangeTool(ToolType toolType)
        {
            if (toolType == type)
            {
                return;
            }
            _type = toolType;

            if (toolType == ToolType.None)
            {
                _tool = null;
            }
            else if (toolType == ToolType.Translation)
            {
                _tool = TRANSLATION_TOOL;
            }
            else if (toolType == ToolType.Rotation)
            {
                _tool = ROTATION_TOOL;
            }
            else if (toolType == ToolType.Scaling)
            {
                _tool = SCALING_TOOL;
            }
            else if (toolType == ToolType.VertexTranslation)
            {
                _tool = VERTEX_TRANSLATION_TOOL;
            }

            _tool?.Reset();
            OnToolChanged(new ToolChangedEventArgs(toolType));
        }
        public void DragActivityOnLargeViewDropPoint(ToolType toolType)
        {

            UITestControl dropPoint = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "LargeViewContent", "ActivitiesPresenter");
            var boundingRectangle = dropPoint.BoundingRectangle;
            ToolboxUIMap.DragControlToWorkflowDesigner(toolType, new Point(boundingRectangle.X + 10, boundingRectangle.Y + 10));
        }
Пример #10
0
        public ToolDescriptor(Guid id, IWarewolfType designer, IWarewolfType activity, string name, string icon, Version version, bool isSupported, string category, ToolType toolType, string iconUri, string filterTag, string toolTip, string helpText)
        {
            if (id == Guid.Empty)
            {
                throw new ArgumentNullException("id", "empty guids not allowed fo tools");
            }

            VerifyArgument.AreNotNull(new Dictionary <string, object> {
                { "id", id }, { "designer", designer }, { "activity", activity }, { "name", name }, { "icon", icon }, { "version", version }, { "category", category }, { iconUri, "iconUri" }, { filterTag, "filterTag" }
            });
            ToolType    = toolType;
            Category    = category;
            IsSupported = isSupported;

            Version          = version;
            Icon             = icon;
            Name             = name;
            Activity         = activity;
            IconUri          = iconUri;
            Designer         = designer;
            Id               = id;
            FilterTag        = filterTag;
            ResourceToolTip  = toolTip;
            ResourceHelpText = helpText;
        }
Пример #11
0
    public void SwitchTool(ToolType tool)
    {
        m_currentTool = tool;
        switch (tool)
        {
        case ToolType.HAMMER:
            m_spriteRenderer.sprite = m_hammerSprite;
            break;

        case ToolType.HAND:
            m_spriteRenderer.sprite = m_handSprite;
            break;

        case ToolType.MAGICWAND:
            m_spriteRenderer.sprite = m_wandSprite;
            break;

        case ToolType.HOTGLUE:
            m_spriteRenderer.sprite = m_caulkingGunSprite;
            break;

        case ToolType.DUCKTAPE:
            m_spriteRenderer.sprite = m_ducktapeSprite;
            break;

        case ToolType.PLASTER:
            m_spriteRenderer.sprite = m_plasterSpreaderSprite;
            break;
        }
        toolChanged(tool);
    }
Пример #12
0
        private void inkPanel_MouseUp(object sender, MouseButtonEventArgs e)
        {
            DrawCommand command = new DrawCommand(currentShape, inkPanel);

            undoRedo.InsertComand(command);

            if (!btnEraser.IsChecked.Value)
            {
                draw(e);
            }
            else if (btnEraser.IsChecked.Value)
            {
                currentTool = ToolType.Ellipse;
                draw(e);
            }
            if (e.LeftButton == MouseButtonState.Pressed && !btnEraser.IsChecked.Value)
            {
                inkPanel.Children.Remove(currentShape);
            }

            /*else if (e.LeftButton == MouseButtonState.Released && previousMouseEvent == MouseButtonState.Pressed)
             * {*/

            //}
            previousMouseEvent = e.LeftButton;
        }
Пример #13
0
        private async Task <Utility.Process.Result?> RunToolInternal(ToolType tool, List <string>?args, bool?useShell, CancellationToken cancellationToken, bool lowPriority)
        {
            // always include the prepend args
            List <string> full_args = GetArgsToPrepend();

            if (args is not null)
            {
                full_args.AddRange(args);
            }

            string tool_path = GetToolExecutable(tool);

            if (useShell is null)
            {
                useShell = ShouldUseShell(tool, args);
            }

            if (useShell.Value)
            {
                return(await Utility.Process.StartProcessWithShell(BaseDirectory, tool_path, full_args, cancellationToken, lowPriority));
            }
            else
            {
                return(await Utility.Process.StartProcess(BaseDirectory, tool_path, full_args, cancellationToken, lowPriority));
            }
        }
Пример #14
0
        public void SetTool(ToolType toolType)
        {
            Tool nextTool;

            if (!toolList.TryGetValue(toolType, out nextTool))
            {
                Console.WriteLine("No matching tool found for :: {0}", toolType);
                return;
            }

            if (!nextTool.Initialize())
            {
                return;
            }

            if (_currentTool != null)
            {
                foreach (var worldObject in WorldObjects)
                {
                    _currentTool.Remove(worldObject);
                }
            }

            foreach (var worldObject in WorldObjects)
            {
                nextTool.Apply(worldObject);
            }

            _currentTool = nextTool;
        }
Пример #15
0
        private void SelectTool(ToolType toolType)
        {
            SelectedToolType = toolType;

            DialogResult = true;
            Close();
        }
Пример #16
0
 public Tool(string name, string internal_name, int durability, float weight, float volyme, string ui_sprite, SpriteManager.SpriteType ui_sprite_type, ToolType type, int level, float efficiency) :
     base(name, internal_name, durability, weight, volyme, ui_sprite, ui_sprite_type)
 {
     Type            = type;
     Level           = level;
     Base_Efficiency = efficiency;
 }
Пример #17
0
 public Paste()
 {
     _Image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/paste.png"));
     _Name = "Paste";
     _Type = ToolType.Selection;
     _IsActive = false;
 }
        public void BtnMoveScreenEllipse_OnClick(object sender, RoutedEventArgs e)
        {
            ToolType currentTooltype = PocketPaintApplication.GetInstance().ToolCurrent.GetToolType();

            if (currentTooltype != ToolType.Move)
            {
                //PocketPaintApplication.GetInstance().PaintingAreaView.setVisibilityGrdSliderThickness(Visibility.Collapsed);
                PocketPaintApplication.GetInstance().SwitchTool(ToolType.Move);
                PocketPaintApplication.GetInstance().PaintingAreaView.changeVisibilityOfSelectionsControls(Visibility.Collapsed);
                PocketPaintApplication.GetInstance().PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Transparent, 1.0);
            }
            else if (currentTooltype == ToolType.Move)
            {
                if (PocketPaintApplication.GetInstance().ToolWhileMoveTool == null)
                {
                    return;
                }

                ToolType newSelectedTooltype = PocketPaintApplication.GetInstance().ToolWhileMoveTool.GetToolType();
                PocketPaintApplication.GetInstance().SwitchTool(newSelectedTooltype);
                PocketPaintApplication.GetInstance().PaintingAreaView.changeVisibilityOfActiveSelectionControl(Visibility.Visible);
                if (newSelectedTooltype == ToolType.Ellipse || newSelectedTooltype == ToolType.ImportPng || newSelectedTooltype == ToolType.Rect)
                {
                    PocketPaintApplication.GetInstance().PaintingAreaView.changeBackgroundColorAndOpacityOfPaintingAreaCanvas(Colors.Black, 0.5);
                }
                PocketPaintApplication.GetInstance().PaintingAreaView.resetActiveSelectionControl();
            }
        }
Пример #19
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="name">Name des Tools</param>
 /// <param name="controlident">Eindeutiger Identifier im gesammten Programmsystem für DIESES Tool</param>
 /// <param name="initcode">Der LaserScript Init Code</param>
 /// <param name="tt">Der Typ des zu erstellenden Tools</param>
 public Tool(string name, string controlident, ToolType tt)
     : base(name, controlident)
 {
     CameraOffset = new PointXD<int>(2);
     MyToolType = tt;
     Load();
 }
Пример #20
0
        /// <summary>
        /// Replaces the default cursor image depending on the current editing state
        /// and tool.
        /// </summary>
        void ToggleCursor()
        {
            if (!IsMouseInEditingArea())
            {
                CursorController.PopCursor(crosshairId);
                return;
            }

            // Transform editor is responsible for setting the cursor. Return.
            if (transformEditor.IsDragging())
            {
                return;
            }

            ToolType current = toolbarController.toolbar.GetActiveTool();

            if (current != ToolType.SelectionTool)
            {
                if (CursorController.GetCurrentId() < crosshairId)
                {
                    crosshairId = CursorController.PushCursor(cursorCrosshair, new Vector2(17.5f, 17.5f));
                }
            }
            else
            {
                CursorController.PopCursor(crosshairId);
            }
        }
Пример #21
0
        // Update is called once per frame
        void Update()
        {
            if (Keyboard.current.qKey.isPressed)
            {
                this.CurrentToolType = ToolType.Pan;
            }
            else if (Keyboard.current.wKey.isPressed)
            {
                this.CurrentToolType = ToolType.Rotate;
            }

            if (action.Desktop.Pan.phase == InputActionPhase.Started)
            {
                // pan
                var firingPos = action.Desktop.Aim.ReadValue <Vector2>();
                this.transform.position += startPlaneDownPos - GetGroundPosition(firingPos);
            }

            if (action.Desktop.Rotate.phase == InputActionPhase.Started)
            {
                // rotate
                var firingPos = action.Desktop.Aim.ReadValue <Vector2>();
                deltaFiringPos = prevFiringPos - firingPos;
                prevFiringPos  = firingPos;

                var   prevRotation  = this.transform.localRotation.eulerAngles;
                float xAxisRotation = prevRotation.x + deltaFiringPos.y / RotationFactor;
                float yAxisRotation = prevRotation.y - deltaFiringPos.x / RotationFactor;
                this.transform.localRotation = Quaternion.Euler(xAxisRotation, yAxisRotation, 0);
            }
        }
Пример #22
0
 private void correctRecordsStatus(DataTable table)
 {
     for (int i = 0; i < table.Rows.Count; ++i)
     {
         DataRow row = table.Rows[i];
         if (row.RowState == DataRowState.Modified)
         {
             bool changed = false;
             for (int c = 0; c < table.Columns.Count; ++c)
             {
                 object cur = row[c];
                 object orj = row[c, DataRowVersion.Original];
                 if (!ToolType.isEqual(cur, orj))
                 {
                     changed = true;
                     break;
                 }
             }
             if (!changed)
             {
                 row.AcceptChanges();
             }
         }
     }
 }
        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++;
            }
        }
Пример #24
0
        public async Task <IActionResult> Edit(int id, [Bind("ToolTypeId,Name")] ToolType toolType)
        {
            if (id != toolType.ToolTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(toolType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ToolTypeExists(toolType.ToolTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(toolType));
        }
Пример #25
0
    public void init(string id, int index, string name, string desc, ToolType tlType, Sprite img, bool upgrades = true)
    {
        this.index = index;
        this.id = id;
        el_name.text = name;
        el_img.sprite = img;
        this.toolType = tlType;

        this.upgrades = upgrades;
        el_upgradeMeter.gameObject.SetActive (upgrades);
        if (upgrades) {
            int upgdLevel = StoreInventory.GetGoodUpgradeLevel (id);

            if(upgdLevel==5){
                el_desc.text = LanguageManager.current.getText(LanguageNode.FullUpgraded);
                buy.gameObject.SetActive(false);
                el_upgradeMeter.fillAmount = 1f;
            }else{
                el_desc.text = desc;
                el_price.text = AnimineStoreAssets.UPGRADE_PRICE [upgdLevel]+"";
                buy.onClick.AddListener(()=>{
                    _OnElementBuy();
                });
            }
            el_upgradeMeter.fillAmount = upgdLevel / 5f;

        } else {
            el_desc.text = desc;
            el_price.text = AnimineStoreAssets.TOOLS_PRICE[(int)toolType]+"";
            buy.onClick.AddListener(()=>{
                _OnElementBuy();
            });
        }
    }
Пример #26
0
 public Arrow()
 {
     _Image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/cursor.png"));
     _Name = "Arrow";
     _Type = ToolType.Arrow;
     IsActive = false;
 }
Пример #27
0
        /// <summary>
        /// Create a ITool from an string and XElement.
        /// </summary>
        /// <param name="assemblyType"> The type for assembly. </param>
        /// <param name="type"> The source type. </param>
        /// <returns> The created ITool. </returns>
        public static ITool CreateTool(Type assemblyType, ToolType type)
        {
            if (XML.Tools.ContainsKey(type))
            {
                return(XML.Tools[type]);
            }

            if (type != ToolType.None)
            {
                Assembly assembly = assemblyType.GetTypeInfo().Assembly;
                IEnumerable <TypeInfo> typeInfos = assembly.DefinedTypes;

                TypeInfo typeInfo = typeInfos.FirstOrDefault(t => t.FullName == $"Retouch_Photo2.Tools.Models.{type}Tool");
                if ((typeInfo is null) == false)
                {
                    object obj = Activator.CreateInstance(typeInfo.AsType());
                    if (obj is ITool tool)
                    {
                        XML.Tools.Add(type, tool);
                        return(tool);
                    }
                }
            }

            return(new NoneTool());
        }
Пример #28
0
        /// <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;
        }
Пример #29
0
    /*
     * Converts enum types we use in this class to equivalent types in the Tool script from the original project
     * */
    private ToolType OptionToTool()
    {
        ToolType tType = ToolType.None;

        switch (toolType)
        {
        case ToolOptionType.Reset:
            tType = ToolType.Reset;
            break;

        case ToolOptionType.Rotate:
            tType = ToolType.Rotate;
            break;

        case ToolOptionType.Tilt:
            tType = ToolType.Pan;
            break;

        case ToolOptionType.Zoom:
            tType = ToolType.Zoom;
            break;

        default:
            Debug.LogError("Invalid Tool Type");
            break;
        }
        return(tType);
    }
Пример #30
0
 public FloodFill()
 {
     _Image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/paintcan.png"));
     _Name = "Flood Fill";
     _Type = ToolType.Pencil;
     IsActive = false;
 }
Пример #31
0
        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++;
            }
        }
Пример #32
0
 public UserToolPickedUpEvent(ToolType toolType, Int32 x, Int32 y, Int32 index)
 {
     this.ToolType = toolType;
     this.X = x;
     this.Y = y;
     this.Index = index;
 }
Пример #33
0
 /// <summary>
 /// Function that determines what happens when the player is hit by another player's tool.
 /// </summary>
 /// <param name="toolTransform">Position of the other player.</param>
 /// <param name="toolType">Type of tool hit by.</param>
 /// <param name="toolMode">Tool mode hit by.</param>
 public override void HitByTool(PlayerServer player, Transform toolTransform, ToolType toolType, ToolMode toolMode)
 {
     if (!Dead)
     {
         base.HitByTool(player, toolTransform, toolType, toolMode);
     }
 }
Пример #34
0
    public override void HandleHit(ToolType toolType)
    {
        if (toolType == ToolType.Hammer || toolType == ToolType.Rock)
        {
            if (m_audioSource)
            {
                m_audioSource.Play();
            }
        }

        if (toolType == ToolType.Hammer)//hammer hits better
        {
            m_hits += m_hammerHitValue;
        }
        else if (toolType == ToolType.Rock)
        {
            m_hits += m_rockHitValue;
        }
        if (m_hits >= m_hitsPerRock)
        {
            if (m_rocks == 2)//last hit -> instantiate 2 rocks and destroy self
            {
                Instantiate(m_rockPrefab, m_rockSpawn.position, m_rockSpawn.rotation);
                Instantiate(m_rockPrefab, m_rockSpawn.position, m_rockSpawn.rotation);
                Destroy(gameObject);
                return;
            }
            Instantiate(m_rockPrefab, m_rockSpawn.position, m_rockSpawn.rotation);
            m_hits = 0;
            --m_rocks;
        }
    }
Пример #35
0
 public bool Damage(ToolType toolType, ToolMaterial toolMaterial)
 {
     if (toolType.CanHarvest(this.toolType) && toolMaterial.StrongEnough(this.toolMaterial))
     {
         float multiplier = toolType.RightTool(this.toolType) ? toolMaterial.Multiplier : 1;
         currentDamage += Time.deltaTime * multiplier * 0.666666f;
         if (currentDamage >= totalDamage)
         {
             if (destroyed)
             {
                 return(true);
             }
             destroyed = true;
             ItemEntity.Spawn(transform.position, item, 1);
         }
     }
     else
     {
         currentDamage += Time.deltaTime * 0.2f;
     }
     if (currentDamage >= totalDamage)
     {
         destroyed = true;
         OnDestroyed();
         Destroy(gameObject);
         return(true);
     }
     return(false);
 }
Пример #36
0
        public void CreateToolTypeSearch(string toolTypeName)
        {
            ToolType toolType = _toolTypes.Find(toolType => toolType.Name.Equals(toolTypeName)).FirstOrDefault();

            var tts = new ToolTypeSearch
            {
                Name       = toolType.Name,
                RefId      = toolType.Id,
                Categories = toolType.MainType,
                Services   = toolType.Serves
            };

            List <string> keyWords = new List <string>();

            // Add All Key Words
            // add name
            //keyWords.Add(toolType.Name.ToUpper()); // ToolType.Name

            // add serves
            foreach (var serve in toolType.Serves)
            {
                keyWords.Add(serve.ToUpper());   // ToolTypes.Serves
            }

            tts.KeyWords = keyWords.ToArray();

            _toolTypesSearch.InsertOne(tts);
        }
Пример #37
0
        private void toolChange(object sender, RoutedEventArgs e)
        {
            switch ((tool.SelectedItem as ComboBoxItem).Name)
            {
            case "Line":
                currentTool = ToolType.Line;
                break;

            case "Ellipse":
                currentTool = ToolType.Ellipse;
                break;

            case "Rectangle":
                currentTool = ToolType.Rectangle;
                break;

            case "Triangle":
                currentTool = ToolType.Triangle;
                break;

            default:
                break;
            }

            setMode();
        }
Пример #38
0
        /// <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);
        }
Пример #39
0
        private void ongui()
        {
            if (isLoaded)
            {
                gui.label(new Vector2(0, 100), string.Format("depth: {0}", currentMapDepth));
                gui.label(new Vector2(0, 120), string.Format("noise: {0}", noiseAmount));

                //if (input.WasKeyPressed(Keys.))
                //    selectedTool = ToolType.None;
                if (input.WasKeyPressed(Keys.D1))
                {
                    selectedTool = ToolType.DigWall;
                }

                //graphics.Draw(spriteSheetMaterial, AxisAlignedBox.FromRect(0, 400, 32, 32), AxisAlignedBox.FromRect(0, 96, 32, 32), selectedTool == ToolType.Dig ? Color.White : Color.Gray);

                if (isSelecting)
                {
                    //var miso = mouseIso;
                    gui.label(new Vector2(0, 140), string.Format(""));
                }

                gui.label(new Vector2(0, 160), "Tool: ");

                //gui.label2(AxisAlignedBox.FromRect(100, 200, 150, 150), new GUIContent("1234 1234 1234 1234", new GUITexture() { material = resources.createMaterialFromTexture("content/textures/ship.png") }));
                //gui.label2(AxisAlignedBox.FromRect(100, 500, 300, 300), new GUIContent("1234", new GUITexture() { material = resources.createMaterialFromTexture("content/textures/ship.png") }));
            }
        }
Пример #40
0
    public override void HandleHit(ToolType toolType)
    {
        if (toolType == ToolType.Hammer || toolType == ToolType.Rock)
        {
            if (m_audioSource)
            {
                m_audioSource.Play();
            }
        }

        if (toolType == ToolType.Hammer) // hammer better hits
        {
            m_hits -= 2;
        }
        else if (toolType == ToolType.Rock)
        {
            m_hits -= 1;
        }
        if (m_hits <= 0)
        {// instantiate two stone fragments and destroy self
            Instantiate(m_fragmentPrefab, transform.position, transform.rotation);
            Instantiate(m_fragmentPrefab, transform.position, transform.rotation);
            Destroy(gameObject);
        }
    }
Пример #41
0
 internal Tool(uint index, ToolType toolType)
 {
     _index    = index;
     _toolType = toolType;
     UpdateToolStatus();
     ID = toolType == ToolType.Item ? index : 0;
 }
Пример #42
0
 public Pencil()
 {
     _image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/pencil.png"));
     _name = "Pencil";
     _type = ToolType.Pencil;
     _isActive = false;
 }
Пример #43
0
        public MainForm()
        {
            currentUndo = null;
            selectedTile = null;
            undoBuffer = new Stack<UndoState>();
            redoBuffer = new Stack<UndoState>();
            selectedTool = ToolType.SELECTOR;

            InitializeComponent();
            UpdateUndoRedoItems();

            attributePaletteForm = new AttributePalette();
            attributePaletteForm.Owner = this;

            createRoomDialog = new CreateRoomDialog();
            createRoomDialog.Owner = this;

            GDIUtils.SetDoubleBuffered(this);

            this.tileSetPanel1.TileSelected += new TileSetPanel.TileSelectedHandler(HandleTileSelection);

            var toolButtons = this.toolStrip.Items;

            foreach (ToolStripItem item in toolButtons)
            {
                item.Click += new EventHandler(HandleToolStripItemClick);
            }

            SetShowAttributes(false);
        }
Пример #44
0
        /// <summary>
        /// Tool type selection
        /// </summary>
        private void m_btnSelection_Click(object sender, EventArgs e)
        {
            btnPointer.Checked   = false;
            btnRectangle.Checked = false;
            btnEllipse.Checked   = false;
            btnPolygon.Checked   = false;

            ToolStripButton tsBtn = (ToolStripButton)sender;

            tsBtn.Checked = true;
            switch (tsBtn.Name)
            {
            case "btnCursor":
                this._selectAction = ToolType.Pointer;
                break;

            case "btnRectangle":
                this._selectAction = ToolType.Rectangle;
                break;

            case "btnEllipse":
                this._selectAction = ToolType.Ellipse;
                break;

            case "btnPolygon":
                this._selectAction = ToolType.Polygon;
                break;

            default:
                this._selectAction = ToolType.Pointer;
                break;
            }

            _owner.ToolbarCommandChanged(this._selectAction);
        }
Пример #45
0
 /// <summary>
 /// Drags a control from the Toolbox to the Workflow
 /// </summary>
 /// <param name="controlId">The name of the control you to drag - Eg: Assign, Calculate, Etc</param>
 /// <param name="p">The point you wish to drop the control - Point p = WorkflowDesignerUIMap.GetPointUnderStartNode("someWorkflow"); is a good palce to start</param>
 /// <param name="searchID">The search unique identifier.</param>
 public void DragControlToWorkflowDesigner(ToolType tool, Point p, string searchID = "")
 {
     UITestControl theControl = FindToolboxItemByAutomationId(tool, searchID);
     theControl.WaitForControlEnabled();
     Playback.Wait(100);
     Mouse.StartDragging(theControl, MouseButtons.Left);
     Mouse.StopDragging(p);
 }
Пример #46
0
 void Start()
 {
     currentTool = ToolType.brush;
     saltToolUsed = false;
     saltToolActivated = false;
     saltHealth = STARTING_HEALTH;
     saltCurrentlyTurnedOff = false;
 }
Пример #47
0
 public Brush()
 {
     _lastUsedSize = new SizeInt32(0, 0);
     _image = new BitmapImage(new Uri(@"pack://application:,,,/TEdit;component/Images/Tools/paintbrush.png"));
     _name = "Brush";
     _type = ToolType.Brush;
     _isActive = false;
 }
Пример #48
0
 public ActivationInfo(ToolSlot slot, ToolType type, bool state, string propertyName, float propertyValue)
 {
     Slot = slot;
     State = state;
     Type = type;
     PropertyName = propertyName;
     PropertyValue = propertyValue;
 }
Пример #49
0
 public ToolPlacedEvent(ToolType toolType, Actor toolActor, Int32 x, Int32 y, Int32 index)
 {
     this.ToolType = toolType;
     this.ToolActor = toolActor;
     this.X = x;
     this.Y = y;
     this.Index = index;
 }
Пример #50
0
 public static ToolCommandBase Create(ToolType tool, ArchitectToolControler toolControler, ArchitectTilePositionGetter getter)
 {
     switch (tool)
     {
         case ToolType.Brush: return new BrushCommand(getter, toolControler.SelectedTileType, toolControler.RotationFlip);
         //case ToolType.Eraser: return new EraserTool(architect, getter);
     }
     return null;
 }
Пример #51
0
        /// <summary>
        /// Create opening on wall
        /// </summary>
        /// <param name="points">Points use to create Opening</param>
        /// <param name="type">Tool type</param>
        public override void DrawOpening(List<Vector4> points, ToolType type)
        {
            //get the rectangle two points
            Autodesk.Revit.DB.XYZ p1 = new Autodesk.Revit.DB.XYZ (points[0].X, points[0].Y, points[0].Z);
            Autodesk.Revit.DB.XYZ p2 = new Autodesk.Revit.DB.XYZ (points[2].X, points[2].Y, points[2].Z);

            //draw opening on wall
            m_docCreator.NewOpening(m_data, p1, p2);
        }
Пример #52
0
        public static void ActivateTool(ToolType toolType)
        {
            _gameData.ToolCounts[(int)toolType] -= 1;

            switch (toolType)
            {
                case ToolType.FireExtinguisher: _gameData.ToolActiveTimeRemaining = Constants.Fire_Extinguisher_Duration; break;
            }
        }
Пример #53
0
 public Tool GetTool(ToolType type, object[] arguments)
 {
     Type toolType = _toolConstructors[type];
     var argumentTypes = GetArgumentTypes(arguments);
     var constructor = toolType.GetConstructor(argumentTypes);
     if (constructor != null)
     {
         return (Tool) constructor.Invoke(arguments);
     }
     return null;
 }
Пример #54
0
 public Tool GetTool(ToolType type)
 {
     Tool result;
     _tools.TryGetValue(type, out result);
     if (result == null)
     {
         result = _factory.GetTool(type, new object[]{_viewModel});
         _tools[type] = result;
     }
     return result;
 }
    // ToolType - The type of tool that is trying to activate this switch
    public void Trigger(ToolType type)
    {
        Debug.Log("Trigger called by tool type: " + type);

        if (m_Activatable.Length == 0) {
            Debug.LogWarning("Triggered a switch with no Activatables attached");
        }

        for (int idx = 0; idx < m_Activatable.Length; ++idx) {
            m_Activatable[idx].Activate();
        }
    }
Пример #56
0
        public static void ActivateTool(ToolType toolType)
        {
            _gameData.ActiveTool = toolType;
            if (toolType != ToolType.SuperJump) { _gameData.ToolCounts[(int)toolType] -= 1; }

            switch (toolType)
            {
                case ToolType.Invincibility: _gameData.ActiveToolTimeRemaining = Constants.Invincibility_Duration; break;
                case ToolType.Jetpack: _gameData.ActiveToolTimeRemaining = Constants.Jetpack_Duration; break;
                case ToolType.Pickaxe: _gameData.ActiveToolTimeRemaining = Constants.Pickaxe_Duration; break;
                case ToolType.FireExtinguisher: _gameData.ActiveToolTimeRemaining = Constants.Fire_Extinguisher_Duration; break;
            }
        }
Пример #57
0
 /// <summary> Gets or sets the raw effectiveness of
 ///           this tool for the specified tool type. </summary>
 public float this[ToolType type]
 {
     get { return ((Enum.IsDefined(typeof(ToolType), type) && (type != ToolType.None))
                        ? _toolEffectiveness[(int)type - 1] : 0.0F); }
     set {
         if ((value < 0.0F) || (value > 1.0F))
             throw new ArgumentOutOfRangeException("value", value,
                 "Effectiveness is not a valid value (0.0 to 1.0)");
         if (!Enum.IsDefined(typeof(ToolType), type) || (type == ToolType.None))
             throw new ArgumentException(string.Format(
                 "'{0}' is not a valid ToolType", type), "type");
         _toolEffectiveness[(int)type - 1] = value;
     }
 }
 public void Refill(ToolType refillType, int refillCount)
 {
     switch (refillType)
     {
     case ToolType.Beacon:
         m_BeaconCount = refillCount;
         break;
     case ToolType.Magnet:
         break;
     case ToolType.Stunner:
         m_GrenadeCount = refillCount;
         break;
     }
 }
Пример #59
0
        public static void SendActivateToolMessage(Player player, ToolSlot slot, ToolType type, bool newState,
                                                   string propertyName,
                                                   float propertyValue, byte id, bool immediate)
        {
            SendMessageHeader(MessageType.ActivateTool, id);

            Storage.PacketWriter.Write((byte)slot);
            Storage.PacketWriter.Write((byte)type);
            Storage.PacketWriter.Write(newState);
            Storage.PacketWriter.Write(propertyName ?? "");
            Storage.PacketWriter.Write(propertyValue);

            if(immediate)
            {
                SendOneOffMessage(player);
            }
        }
Пример #60
0
	// Update is called once per frame
	void Update ()
	{
		// Plant
		if (GameManager.Instance.state == GameManager.GameState.Playing) {
			if (Input.GetButtonDown ("P2_A"))
			{
				switch (currentTool) {
				case ToolType.Candy:
					if (currentTile != null && currentTile.GetComponent<EdgeTile> ().GetIsInUse () == false) {
						currentTile.GetComponent<EdgeTile> ().SetIsInUse (true);
						if (tools[(int)currentTool] > 0) {
							currentTile.GetComponent<EdgeTile>().SetTrap();
							StartCoroutine (Candy(0.25f));
							tools[(int)currentTool]--;
							RenderTools ();
						}
					}
					break;
				case ToolType.Boot:
					if (tools[(int)currentTool] > 0) {
						foreach (GameObject ant in GameManager.Instance.antList) {
							ant.GetComponent<AntAI> ().Retreat ();
						}
						StartCoroutine (Stomp(0.4f));
						tools[(int)currentTool]--;
						RenderTools ();
					}
					break;
				}
			}

			//Weapon Toggle
			if (Input.GetButtonDown ("P2_R1"))
			{
				int nextSeed = ((int)currentTool + 1);
				currentTool = nextSeed >= tools.Count ? 0 : (ToolType)nextSeed;
				RenderTools ();
			}
			else if (Input.GetButtonDown ("P2_L1"))
			{
				int nextSeed = ((int)currentTool - 1);
				currentTool = nextSeed < 0 ? (ToolType)(tools.Count-1) : (ToolType)nextSeed;
				RenderTools ();
			}
		}
    }