public void SetBackLengthMouse_PositivTest
            (double BackOfTheMouse, double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty  = lengthMouseCount;
            programKompas.BackOfTheMouseProperty = BackOfTheMouse;
        }
        public void SetFrontLengthMouse_PositivTest
            (double FrontOfTheMouse,
            double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty   = lengthMouseCount;
            programKompas.FrontOfTheMouseProperty = FrontOfTheMouse;
        }
        public void SetLengthMouse_NegativMoreTest
            (double LengthOfMouseCount)
        {
            var programKompas = new MouseSetting();

            Assert.Throws <ProgramKompas.ExceptionFolder.
                           LengthOfMouseException>(() =>
                                                   programKompas.LengthOfMouseProperty = LengthOfMouseCount);
        }
        public void SetHeightOfTheSecondMouse_PositivTest
            (double HeightOfTheSecondMouse, double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty          = lengthMouseCount;
            programKompas.HeightOfTheSecondMouseProperty =
                HeightOfTheSecondMouse;
        }
        public void SetTheHeightOfTheFirstLevelOfTheMouse_PositivTest
            (double TheHeightOfTheFirstLevelOfTheMouse,
            double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty = lengthMouseCount;
            programKompas.TheHeightOfTheFirstLevelOfTheMouseProperty =
                TheHeightOfTheFirstLevelOfTheMouse;
        }
        public void SetBackLengthMouse_NegativLessMoreTest
            (double BackOfTheMouse, double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty = lengthMouseCount;
            Assert.Throws <ProgramKompas.ExceptionFolder.
                           BackOfTheMouseException>(() =>
                                                    programKompas.BackOfTheMouseProperty = BackOfTheMouse);
        }
        public void SetFrontLengthMouse_NegativMoreTest
            (double FrontOfTheMouse, double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty = lengthMouseCount;
            Assert.Throws <ProgramKompas.ExceptionFolder.
                           FrontOfTheMouseException>(() =>
                                                     programKompas.FrontOfTheMouseProperty = FrontOfTheMouse);
        }
        public void SetHeightOfTheSecondMouse_NegativLessMoreTest
            (double HeightOfTheSecondMouse, double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty = lengthMouseCount;
            Assert.Throws <ProgramKompas.ExceptionFolder.
                           ExceptionHeightOfTheSecondMouse>(() =>
                                                            programKompas.HeightOfTheSecondMouseProperty =
                                                                HeightOfTheSecondMouse);
        }
        public void SetTheHeightOfTheFirstLevelOfTheMouse_NegativLessMoreTest
            (double TheHeightOfTheFirstLevelOfTheMouse,
            double lengthMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty = lengthMouseCount;
            Assert.Throws <ProgramKompas.ExceptionFolder.
                           TheHeightOfTheFirstLevelOfTheMouseException>(() =>
                                                                        programKompas.TheHeightOfTheFirstLevelOfTheMouseProperty =
                                                                            TheHeightOfTheFirstLevelOfTheMouse);
        }
Exemple #10
0
 public virtual bool onMousePress(MouseSetting mouse)
 {
     if (mouse == InputProcessor.LeftMouse)
     {
         for (var i = 0; i < this.ButtonList.Count; i++)
         {
             var button = this.ButtonList[i];
             if (button.isMouseOver())
             {
                 button.onPressed();
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #11
0
        public override bool onMousePress(MouseSetting mouse)
        {
            if (!base.onMousePress(mouse))
            {
                if (mouse == InputProcessor.LeftMouse && this.canMoveCamera())
                {
                    var selected = this.List.getSelectedComponent() as ListComponentItem;
                    if (selected != null)
                    {
                        var stack = selected.getStack();
                        if (stack != null)
                        {
                            var entity = stack.getHeldEntity();
                            if (entity != null)
                            {
                                var pos = EvolvinaryMain.get().Camera.toWorldPos(InputProcessor.getMousePos().ToVector2());

                                if (entity.canPlace(GameData.MainPlayer, GameData.WorldTest, pos))
                                {
                                    entity.place(GameData.MainPlayer, GameData.WorldTest, pos);

                                    stack.Amount--;
                                    if (stack.Amount <= 0)
                                    {
                                        selected.removeStack();
                                        this.List.removeComponent(selected);
                                    }

                                    if (!InputProcessor.Shift.IsDown)
                                    {
                                        this.List.unselectAllExcept(null);
                                    }

                                    return(true);
                                }
                            }
                        }
                    }
                }
                return(false);
            }

            this.List.unselectAllExcept(null);
            return(true);
        }
        public void SetLengthMouse_PositivTest(double LengthOfMouseCount)
        {
            var programKompas = new MouseSetting();

            programKompas.LengthOfMouseProperty = LengthOfMouseCount;
        }
Exemple #13
0
        public override bool onMousePress(MouseSetting mouse)
        {
            if (!base.onMousePress(mouse))
            {
                if (this.canSelectEntities())
                {
                    if (mouse == InputProcessor.LeftMouse)
                    {
                        if (this.selectableEntities.Count <= 0)
                        {
                            var mousePos = EvolvinaryMain.get().Camera.toWorldPos(InputProcessor.getMousePos().ToVector2());

                            var toReturn = false;
                            if (this.SelectedEntity != null)
                            {
                                if (InputProcessor.Shift.IsDown)
                                {
                                    var pathable = this.SelectedEntity as EntityPathable;
                                    if (pathable != null)
                                    {
                                        pathable.setPath(pathable.World.isWalkableExcept(MathHelp.floor(mousePos.X), MathHelp.floor(mousePos.Y), null) ? new Path(pathable, new[] { new PathWaypoint(mousePos) }, false, false) : null);
                                        toReturn = true;
                                    }
                                }
                                else
                                {
                                    this.setSelectedEntity(null);
                                    toReturn = true;
                                }
                            }

                            var entities = GameData.WorldTest.getEntitiesOnPoint(mousePos, null, true);

                            if (entities.Count > 0)
                            {
                                if (entities.Count > 1)
                                {
                                    foreach (var entity in entities)
                                    {
                                        if (entity.canSelect() && entity.MouseSelectBox != BoundBox.Empty)
                                        {
                                            var pos = EvolvinaryMain.get().Camera.toCameraPos(entity.Pos) / Scale;
                                            this.selectableEntities.Add(new ButtonTextOnly(this.selectableEntities.Count - 102834, this, (int)pos.X, (int)pos.Y, 30, 10, entity.getDisplayName(), 1F), entity);
                                        }
                                    }

                                    if (this.selectableEntities.Count > 0)
                                    {
                                        this.setSelectedEntity(null);
                                        this.ButtonList.AddRange(this.selectableEntities.Keys);

                                        toReturn = true;
                                    }
                                }
                                else
                                {
                                    var entity = entities[0];
                                    if (entity.canSelect())
                                    {
                                        this.setSelectedEntity(entity);

                                        toReturn = true;
                                    }
                                }
                            }

                            return(toReturn);
                        }

                        foreach (var key in this.selectableEntities.Keys)
                        {
                            this.ButtonList.Remove(key);
                        }
                        this.selectableEntities.Clear();

                        return(true);
                    }
                }
                return(false);
            }
            return(true);
        }